mirror of
https://github.com/openai/codex.git
synced 2026-11-06 20:20:34 +00:00
comments
This commit is contained in:
@@ -13784,7 +13784,7 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ToolFeatureConfigV2": {
|
||||
"ToolFeatureConfig": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": [
|
||||
@@ -13800,7 +13800,7 @@
|
||||
"agent_jobs": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13810,7 +13810,7 @@
|
||||
"agents": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13826,7 +13826,7 @@
|
||||
"document_generation": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13836,7 +13836,7 @@
|
||||
"filesystem": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13846,7 +13846,7 @@
|
||||
"image_generation": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13856,7 +13856,7 @@
|
||||
"javascript": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13866,7 +13866,7 @@
|
||||
"planning": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13876,7 +13876,7 @@
|
||||
"shell": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13886,7 +13886,7 @@
|
||||
"user_input": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -13903,7 +13903,7 @@
|
||||
"web_search": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/v2/WebSearchFeatureConfigV2"
|
||||
"$ref": "#/definitions/v2/WebSearchFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -14525,7 +14525,7 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"WebSearchFeatureConfigV2": {
|
||||
"WebSearchFeatureConfig": {
|
||||
"properties": {
|
||||
"allowed_domains": {
|
||||
"items": {
|
||||
|
||||
+12
-12
@@ -11544,7 +11544,7 @@
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"ToolFeatureConfigV2": {
|
||||
"ToolFeatureConfig": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": [
|
||||
@@ -11560,7 +11560,7 @@
|
||||
"agent_jobs": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11570,7 +11570,7 @@
|
||||
"agents": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11586,7 +11586,7 @@
|
||||
"document_generation": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11596,7 +11596,7 @@
|
||||
"filesystem": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11606,7 +11606,7 @@
|
||||
"image_generation": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11616,7 +11616,7 @@
|
||||
"javascript": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11626,7 +11626,7 @@
|
||||
"planning": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11636,7 +11636,7 @@
|
||||
"shell": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11646,7 +11646,7 @@
|
||||
"user_input": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -11663,7 +11663,7 @@
|
||||
"web_search": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/WebSearchFeatureConfigV2"
|
||||
"$ref": "#/definitions/WebSearchFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -12285,7 +12285,7 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"WebSearchFeatureConfigV2": {
|
||||
"WebSearchFeatureConfig": {
|
||||
"properties": {
|
||||
"allowed_domains": {
|
||||
"items": {
|
||||
|
||||
@@ -760,7 +760,7 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"ToolFeatureConfigV2": {
|
||||
"ToolFeatureConfig": {
|
||||
"properties": {
|
||||
"enabled": {
|
||||
"type": [
|
||||
@@ -776,7 +776,7 @@
|
||||
"agent_jobs": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -786,7 +786,7 @@
|
||||
"agents": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -802,7 +802,7 @@
|
||||
"document_generation": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -812,7 +812,7 @@
|
||||
"filesystem": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -822,7 +822,7 @@
|
||||
"image_generation": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -832,7 +832,7 @@
|
||||
"javascript": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -842,7 +842,7 @@
|
||||
"planning": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -852,7 +852,7 @@
|
||||
"shell": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -862,7 +862,7 @@
|
||||
"user_input": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/ToolFeatureConfigV2"
|
||||
"$ref": "#/definitions/ToolFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -879,7 +879,7 @@
|
||||
"web_search": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/WebSearchFeatureConfigV2"
|
||||
"$ref": "#/definitions/WebSearchFeatureConfig"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
@@ -906,7 +906,7 @@
|
||||
],
|
||||
"type": "string"
|
||||
},
|
||||
"WebSearchFeatureConfigV2": {
|
||||
"WebSearchFeatureConfig": {
|
||||
"properties": {
|
||||
"allowed_domains": {
|
||||
"items": {
|
||||
|
||||
+1
-1
@@ -2,4 +2,4 @@
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
|
||||
export type ToolFeatureConfigV2 = { enabled: boolean | null, };
|
||||
export type ToolFeatureConfig = { enabled: boolean | null, };
|
||||
@@ -1,10 +1,10 @@
|
||||
// GENERATED CODE! DO NOT MODIFY BY HAND!
|
||||
|
||||
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
|
||||
import type { ToolFeatureConfigV2 } from "./ToolFeatureConfigV2";
|
||||
import type { WebSearchFeatureConfigV2 } from "./WebSearchFeatureConfigV2";
|
||||
import type { ToolFeatureConfig } from "./ToolFeatureConfig";
|
||||
import type { WebSearchFeatureConfig } from "./WebSearchFeatureConfig";
|
||||
|
||||
export type ToolsV2 = { disable_defaults: boolean | null, shell: ToolFeatureConfigV2 | null, filesystem: ToolFeatureConfigV2 | null, javascript: ToolFeatureConfigV2 | null, agents: ToolFeatureConfigV2 | null, agent_jobs: ToolFeatureConfigV2 | null, planning: ToolFeatureConfigV2 | null, user_input: ToolFeatureConfigV2 | null, web_search: WebSearchFeatureConfigV2 | null, image_generation: ToolFeatureConfigV2 | null, document_generation: ToolFeatureConfigV2 | null,
|
||||
export type ToolsV2 = { disable_defaults: boolean | null, shell: ToolFeatureConfig | null, filesystem: ToolFeatureConfig | null, javascript: ToolFeatureConfig | null, agents: ToolFeatureConfig | null, agent_jobs: ToolFeatureConfig | null, planning: ToolFeatureConfig | null, user_input: ToolFeatureConfig | null, web_search: WebSearchFeatureConfig | null, image_generation: ToolFeatureConfig | null, document_generation: ToolFeatureConfig | null,
|
||||
/**
|
||||
* Legacy enablement for the `view_image` capability.
|
||||
*/
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@
|
||||
import type { WebSearchContextSize } from "../WebSearchContextSize";
|
||||
import type { WebSearchLocation } from "../WebSearchLocation";
|
||||
|
||||
export type WebSearchFeatureConfigV2 = { enabled: boolean | null, context_size: WebSearchContextSize | null, allowed_domains: Array<string> | null, location: WebSearchLocation | null, };
|
||||
export type WebSearchFeatureConfig = { enabled: boolean | null, context_size: WebSearchContextSize | null, allowed_domains: Array<string> | null, location: WebSearchLocation | null, };
|
||||
@@ -305,7 +305,7 @@ export type { ThreadUnsubscribeParams } from "./ThreadUnsubscribeParams";
|
||||
export type { ThreadUnsubscribeResponse } from "./ThreadUnsubscribeResponse";
|
||||
export type { ThreadUnsubscribeStatus } from "./ThreadUnsubscribeStatus";
|
||||
export type { TokenUsageBreakdown } from "./TokenUsageBreakdown";
|
||||
export type { ToolFeatureConfigV2 } from "./ToolFeatureConfigV2";
|
||||
export type { ToolFeatureConfig } from "./ToolFeatureConfig";
|
||||
export type { ToolRequestUserInputAnswer } from "./ToolRequestUserInputAnswer";
|
||||
export type { ToolRequestUserInputOption } from "./ToolRequestUserInputOption";
|
||||
export type { ToolRequestUserInputParams } from "./ToolRequestUserInputParams";
|
||||
@@ -329,7 +329,7 @@ export type { TurnSteerParams } from "./TurnSteerParams";
|
||||
export type { TurnSteerResponse } from "./TurnSteerResponse";
|
||||
export type { UserInput } from "./UserInput";
|
||||
export type { WebSearchAction } from "./WebSearchAction";
|
||||
export type { WebSearchFeatureConfigV2 } from "./WebSearchFeatureConfigV2";
|
||||
export type { WebSearchFeatureConfig } from "./WebSearchFeatureConfig";
|
||||
export type { WindowsSandboxSetupCompletedNotification } from "./WindowsSandboxSetupCompletedNotification";
|
||||
export type { WindowsSandboxSetupMode } from "./WindowsSandboxSetupMode";
|
||||
export type { WindowsSandboxSetupStartParams } from "./WindowsSandboxSetupStartParams";
|
||||
|
||||
@@ -536,14 +536,14 @@ pub struct SandboxWorkspaceWrite {
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ToolFeatureConfigV2 {
|
||||
pub struct ToolFeatureConfig {
|
||||
pub enabled: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema, TS)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct WebSearchFeatureConfigV2 {
|
||||
pub struct WebSearchFeatureConfig {
|
||||
pub enabled: Option<bool>,
|
||||
#[serde(flatten)]
|
||||
pub config: WebSearchToolConfig,
|
||||
@@ -554,16 +554,16 @@ pub struct WebSearchFeatureConfigV2 {
|
||||
#[ts(export_to = "v2/")]
|
||||
pub struct ToolsV2 {
|
||||
pub disable_defaults: Option<bool>,
|
||||
pub shell: Option<ToolFeatureConfigV2>,
|
||||
pub filesystem: Option<ToolFeatureConfigV2>,
|
||||
pub javascript: Option<ToolFeatureConfigV2>,
|
||||
pub agents: Option<ToolFeatureConfigV2>,
|
||||
pub agent_jobs: Option<ToolFeatureConfigV2>,
|
||||
pub planning: Option<ToolFeatureConfigV2>,
|
||||
pub user_input: Option<ToolFeatureConfigV2>,
|
||||
pub web_search: Option<WebSearchFeatureConfigV2>,
|
||||
pub image_generation: Option<ToolFeatureConfigV2>,
|
||||
pub document_generation: Option<ToolFeatureConfigV2>,
|
||||
pub shell: Option<ToolFeatureConfig>,
|
||||
pub filesystem: Option<ToolFeatureConfig>,
|
||||
pub javascript: Option<ToolFeatureConfig>,
|
||||
pub agents: Option<ToolFeatureConfig>,
|
||||
pub agent_jobs: Option<ToolFeatureConfig>,
|
||||
pub planning: Option<ToolFeatureConfig>,
|
||||
pub user_input: Option<ToolFeatureConfig>,
|
||||
pub web_search: Option<WebSearchFeatureConfig>,
|
||||
pub image_generation: Option<ToolFeatureConfig>,
|
||||
pub document_generation: Option<ToolFeatureConfig>,
|
||||
/// Legacy enablement for the `view_image` capability.
|
||||
pub view_image: Option<bool>,
|
||||
}
|
||||
|
||||
@@ -115,7 +115,10 @@ Example with notification opt-out:
|
||||
},
|
||||
"capabilities": {
|
||||
"experimentalApi": true,
|
||||
"optOutNotificationMethods": ["thread/started", "item/agentMessage/delta"]
|
||||
"optOutNotificationMethods": [
|
||||
"thread/started",
|
||||
"item/agentMessage/delta"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,13 +306,10 @@ When `nextCursor` is `null`, you’ve reached the final page.
|
||||
- `thread/start`, `thread/fork`, and detached review threads do not emit a separate initial `thread/status/changed`; their `thread/started` notification already carries the current `thread.status`.
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "thread/status/changed",
|
||||
"params": {
|
||||
{ "method": "thread/status/changed", "params": {
|
||||
"threadId": "thr_123",
|
||||
"status": { "type": "active", "activeFlags": [] }
|
||||
}
|
||||
}
|
||||
} }
|
||||
```
|
||||
|
||||
### Example: Unsubscribe from a loaded thread
|
||||
@@ -987,7 +987,10 @@ The built-in `request_permissions` tool sends an `item/permissions/requestApprov
|
||||
"reason": "Select a workspace root",
|
||||
"permissions": {
|
||||
"fileSystem": {
|
||||
"write": ["/Users/me/project", "/Users/me/shared"]
|
||||
"write": [
|
||||
"/Users/me/project",
|
||||
"/Users/me/shared"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1003,7 +1006,9 @@ The client responds with `result.permissions`, which should be the granted subse
|
||||
"scope": "session",
|
||||
"permissions": {
|
||||
"fileSystem": {
|
||||
"write": ["/Users/me/project"]
|
||||
"write": [
|
||||
"/Users/me/project"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,9 @@ use codex_app_server_protocol::JSONRPCResponse;
|
||||
use codex_app_server_protocol::MergeStrategy;
|
||||
use codex_app_server_protocol::RequestId;
|
||||
use codex_app_server_protocol::SandboxMode;
|
||||
use codex_app_server_protocol::ToolFeatureConfigV2;
|
||||
use codex_app_server_protocol::ToolFeatureConfig;
|
||||
use codex_app_server_protocol::ToolsV2;
|
||||
use codex_app_server_protocol::WebSearchFeatureConfigV2;
|
||||
use codex_app_server_protocol::WebSearchFeatureConfig;
|
||||
use codex_app_server_protocol::WriteStatus;
|
||||
use codex_core::config::set_project_trust_level;
|
||||
use codex_protocol::config_types::TrustLevel;
|
||||
@@ -140,14 +140,14 @@ view_image = false
|
||||
tools,
|
||||
ToolsV2 {
|
||||
disable_defaults: Some(true),
|
||||
shell: Some(ToolFeatureConfigV2 { enabled: None }),
|
||||
filesystem: Some(ToolFeatureConfigV2 { enabled: None }),
|
||||
shell: Some(ToolFeatureConfig { enabled: None }),
|
||||
filesystem: Some(ToolFeatureConfig { enabled: None }),
|
||||
javascript: None,
|
||||
agents: None,
|
||||
agent_jobs: None,
|
||||
planning: None,
|
||||
user_input: None,
|
||||
web_search: Some(WebSearchFeatureConfigV2 {
|
||||
web_search: Some(WebSearchFeatureConfig {
|
||||
enabled: Some(true),
|
||||
config: WebSearchToolConfig {
|
||||
context_size: Some(WebSearchContextSize::Low),
|
||||
@@ -229,7 +229,7 @@ location = { country = "US", city = "New York", timezone = "America/New_York" }
|
||||
|
||||
assert_eq!(
|
||||
config.tools.expect("tools present").web_search,
|
||||
Some(WebSearchFeatureConfigV2 {
|
||||
Some(WebSearchFeatureConfig {
|
||||
enabled: None,
|
||||
config: WebSearchToolConfig {
|
||||
context_size: Some(WebSearchContextSize::High),
|
||||
|
||||
@@ -25,39 +25,49 @@ use codex_protocol::models::VIEW_IMAGE_TOOL_NAME;
|
||||
use codex_utils_readiness::Readiness;
|
||||
use tracing::warn;
|
||||
|
||||
pub(crate) const CONTAINER_EXEC_TOOL_NAME: &str = "container.exec";
|
||||
pub(crate) const EXEC_COMMAND_TOOL_NAME: &str = "exec_command";
|
||||
pub(crate) const LOCAL_SHELL_TOOL_NAME: &str = "local_shell";
|
||||
pub(crate) const SHELL_COMMAND_TOOL_NAME: &str = "shell_command";
|
||||
pub(crate) const SHELL_TOOL_NAME: &str = "shell";
|
||||
pub(crate) const WRITE_STDIN_TOOL_NAME: &str = "write_stdin";
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
/// Individual built-in tools known to Codex, independent of how they are
|
||||
/// grouped for config-driven enablement.
|
||||
pub(crate) enum BuiltinToolKey {
|
||||
ApplyPatch,
|
||||
Artifacts,
|
||||
CloseAgent,
|
||||
CodeMode,
|
||||
ExecCommand,
|
||||
WriteStdin,
|
||||
ListMcpResources,
|
||||
ListMcpResourceTemplates,
|
||||
ReadMcpResource,
|
||||
UpdatePlan,
|
||||
GrepFiles,
|
||||
ImageGeneration,
|
||||
JsRepl,
|
||||
JsReplReset,
|
||||
RequestUserInput,
|
||||
RequestPermissions,
|
||||
SearchToolBm25,
|
||||
ApplyPatch,
|
||||
GrepFiles,
|
||||
ReadFile,
|
||||
ListDir,
|
||||
TestSyncTool,
|
||||
WebSearch,
|
||||
ImageGeneration,
|
||||
ViewImage,
|
||||
Artifacts,
|
||||
SpawnAgent,
|
||||
SendInput,
|
||||
ResumeAgent,
|
||||
Wait,
|
||||
CloseAgent,
|
||||
SpawnAgentsOnCsv,
|
||||
ListMcpResources,
|
||||
ListMcpResourceTemplates,
|
||||
ReadFile,
|
||||
ReadMcpResource,
|
||||
RequestPermissions,
|
||||
RequestUserInput,
|
||||
ReportAgentJobResult,
|
||||
ResumeAgent,
|
||||
SearchToolBm25,
|
||||
SendInput,
|
||||
SpawnAgent,
|
||||
SpawnAgentsOnCsv,
|
||||
TestSyncTool,
|
||||
UpdatePlan,
|
||||
ViewImage,
|
||||
Wait,
|
||||
WebSearch,
|
||||
WriteStdin,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
||||
/// Coarse-grained built-in tool capability groups exposed in `config.tools`.
|
||||
pub(crate) enum ToolFeatureKey {
|
||||
Shell,
|
||||
Filesystem,
|
||||
@@ -73,34 +83,34 @@ pub(crate) enum ToolFeatureKey {
|
||||
|
||||
impl BuiltinToolKey {
|
||||
pub(crate) const ALL: [Self; 28] = [
|
||||
Self::ApplyPatch,
|
||||
Self::Artifacts,
|
||||
Self::CloseAgent,
|
||||
Self::CodeMode,
|
||||
Self::ExecCommand,
|
||||
Self::WriteStdin,
|
||||
Self::ListMcpResources,
|
||||
Self::ListMcpResourceTemplates,
|
||||
Self::ReadMcpResource,
|
||||
Self::UpdatePlan,
|
||||
Self::GrepFiles,
|
||||
Self::ImageGeneration,
|
||||
Self::JsRepl,
|
||||
Self::JsReplReset,
|
||||
Self::RequestUserInput,
|
||||
Self::RequestPermissions,
|
||||
Self::SearchToolBm25,
|
||||
Self::ApplyPatch,
|
||||
Self::GrepFiles,
|
||||
Self::ReadFile,
|
||||
Self::ListDir,
|
||||
Self::TestSyncTool,
|
||||
Self::WebSearch,
|
||||
Self::ImageGeneration,
|
||||
Self::ViewImage,
|
||||
Self::Artifacts,
|
||||
Self::SpawnAgent,
|
||||
Self::SendInput,
|
||||
Self::ResumeAgent,
|
||||
Self::Wait,
|
||||
Self::CloseAgent,
|
||||
Self::SpawnAgentsOnCsv,
|
||||
Self::ListMcpResources,
|
||||
Self::ListMcpResourceTemplates,
|
||||
Self::ReadFile,
|
||||
Self::ReadMcpResource,
|
||||
Self::RequestPermissions,
|
||||
Self::RequestUserInput,
|
||||
Self::ReportAgentJobResult,
|
||||
Self::ResumeAgent,
|
||||
Self::SearchToolBm25,
|
||||
Self::SendInput,
|
||||
Self::SpawnAgent,
|
||||
Self::SpawnAgentsOnCsv,
|
||||
Self::TestSyncTool,
|
||||
Self::UpdatePlan,
|
||||
Self::ViewImage,
|
||||
Self::Wait,
|
||||
Self::WebSearch,
|
||||
Self::WriteStdin,
|
||||
];
|
||||
|
||||
pub(crate) fn iter() -> impl Iterator<Item = Self> {
|
||||
@@ -111,13 +121,13 @@ impl BuiltinToolKey {
|
||||
match self {
|
||||
Self::CodeMode => &[PUBLIC_TOOL_NAME],
|
||||
Self::ExecCommand => &[
|
||||
"exec_command",
|
||||
"shell",
|
||||
"container.exec",
|
||||
"local_shell",
|
||||
"shell_command",
|
||||
SHELL_TOOL_NAME,
|
||||
EXEC_COMMAND_TOOL_NAME,
|
||||
CONTAINER_EXEC_TOOL_NAME,
|
||||
LOCAL_SHELL_TOOL_NAME,
|
||||
SHELL_COMMAND_TOOL_NAME,
|
||||
],
|
||||
Self::WriteStdin => &["write_stdin"],
|
||||
Self::WriteStdin => &[WRITE_STDIN_TOOL_NAME],
|
||||
Self::ListMcpResources => &["list_mcp_resources"],
|
||||
Self::ListMcpResourceTemplates => &["list_mcp_resource_templates"],
|
||||
Self::ReadMcpResource => &["read_mcp_resource"],
|
||||
|
||||
@@ -33,8 +33,14 @@ use crate::tools::handlers::multi_agents::MIN_WAIT_TIMEOUT_MS;
|
||||
use crate::tools::handlers::request_permissions_tool_description;
|
||||
use crate::tools::handlers::request_user_input_tool_description;
|
||||
use crate::tools::registry::BuiltinToolKey;
|
||||
use crate::tools::registry::CONTAINER_EXEC_TOOL_NAME;
|
||||
use crate::tools::registry::EXEC_COMMAND_TOOL_NAME;
|
||||
use crate::tools::registry::LOCAL_SHELL_TOOL_NAME;
|
||||
use crate::tools::registry::SHELL_COMMAND_TOOL_NAME;
|
||||
use crate::tools::registry::SHELL_TOOL_NAME;
|
||||
use crate::tools::registry::ToolFeatureKey;
|
||||
use crate::tools::registry::ToolRegistryBuilder;
|
||||
use crate::tools::registry::WRITE_STDIN_TOOL_NAME;
|
||||
use crate::tools::registry::builtin_tool_key;
|
||||
use crate::tools::registry::tool_handler_key;
|
||||
use codex_features::Feature;
|
||||
@@ -506,6 +512,10 @@ impl ToolsConfig {
|
||||
return true;
|
||||
};
|
||||
if self.is_feature_explicitly_controlled(feature) {
|
||||
// In explicit grouped mode (`tools.disable_defaults = true`), the
|
||||
// `[tools.<feature>]` table is the source of truth for exposure.
|
||||
// That intentionally bypasses legacy fallback logic such as
|
||||
// top-level `web_search` mode-based enablement.
|
||||
return self.is_tool_feature_enabled(feature);
|
||||
}
|
||||
|
||||
@@ -2439,7 +2449,6 @@ fn push_builtin_tool_with_handler_if_enabled<H>(
|
||||
invocation_name: &str,
|
||||
spec: ToolSpec,
|
||||
supports_parallel_tool_calls: bool,
|
||||
handler_name: &str,
|
||||
handler: std::sync::Arc<H>,
|
||||
) where
|
||||
H: crate::tools::registry::ToolHandler + 'static,
|
||||
@@ -2451,7 +2460,7 @@ fn push_builtin_tool_with_handler_if_enabled<H>(
|
||||
supports_parallel_tool_calls,
|
||||
config.code_mode_enabled,
|
||||
);
|
||||
builder.register_handler(handler_name, handler);
|
||||
builder.register_handler(invocation_name, handler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2797,7 +2806,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_builtin_tool_spec_if_enabled(
|
||||
&mut builder,
|
||||
config,
|
||||
"exec_command",
|
||||
SHELL_TOOL_NAME,
|
||||
create_shell_tool(exec_permission_approvals_enabled),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
);
|
||||
@@ -2806,7 +2815,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_builtin_tool_spec_if_enabled(
|
||||
&mut builder,
|
||||
config,
|
||||
"local_shell",
|
||||
LOCAL_SHELL_TOOL_NAME,
|
||||
ToolSpec::LocalShell {},
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
);
|
||||
@@ -2815,22 +2824,20 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_builtin_tool_with_handler_if_enabled(
|
||||
&mut builder,
|
||||
config,
|
||||
"exec_command",
|
||||
EXEC_COMMAND_TOOL_NAME,
|
||||
create_exec_command_tool(
|
||||
config.allow_login_shell,
|
||||
exec_permission_approvals_enabled,
|
||||
),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
"exec_command",
|
||||
unified_exec_handler.clone(),
|
||||
);
|
||||
push_builtin_tool_with_handler_if_enabled(
|
||||
&mut builder,
|
||||
config,
|
||||
"write_stdin",
|
||||
WRITE_STDIN_TOOL_NAME,
|
||||
create_write_stdin_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"write_stdin",
|
||||
unified_exec_handler,
|
||||
);
|
||||
}
|
||||
@@ -2841,7 +2848,7 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
push_builtin_tool_spec_if_enabled(
|
||||
&mut builder,
|
||||
config,
|
||||
"shell_command",
|
||||
SHELL_COMMAND_TOOL_NAME,
|
||||
create_shell_command_tool(
|
||||
config.allow_login_shell,
|
||||
exec_permission_approvals_enabled,
|
||||
@@ -2852,13 +2859,13 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
}
|
||||
|
||||
if config.shell_type != ConfigShellToolType::Disabled
|
||||
&& config.is_builtin_tool_invocation_enabled("exec_command")
|
||||
&& config.is_builtin_tool_invocation_enabled(SHELL_TOOL_NAME)
|
||||
{
|
||||
// Always register shell aliases so older prompts remain compatible.
|
||||
builder.register_handler("shell", shell_handler.clone());
|
||||
builder.register_handler("container.exec", shell_handler.clone());
|
||||
builder.register_handler("local_shell", shell_handler);
|
||||
builder.register_handler("shell_command", shell_command_handler);
|
||||
builder.register_handler(SHELL_TOOL_NAME, shell_handler.clone());
|
||||
builder.register_handler(CONTAINER_EXEC_TOOL_NAME, shell_handler.clone());
|
||||
builder.register_handler(LOCAL_SHELL_TOOL_NAME, shell_handler);
|
||||
builder.register_handler(SHELL_COMMAND_TOOL_NAME, shell_command_handler);
|
||||
}
|
||||
|
||||
if mcp_tools.is_some() {
|
||||
@@ -2891,7 +2898,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"update_plan",
|
||||
PLAN_TOOL.clone(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"update_plan",
|
||||
plan_handler,
|
||||
);
|
||||
|
||||
@@ -2902,7 +2908,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"js_repl",
|
||||
create_js_repl_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"js_repl",
|
||||
js_repl_handler,
|
||||
);
|
||||
push_builtin_tool_with_handler_if_enabled(
|
||||
@@ -2911,7 +2916,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"js_repl_reset",
|
||||
create_js_repl_reset_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"js_repl_reset",
|
||||
js_repl_reset_handler,
|
||||
);
|
||||
}
|
||||
@@ -2926,7 +2930,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
default_mode_request_user_input: config.default_mode_request_user_input,
|
||||
}),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"request_user_input",
|
||||
request_user_input_handler,
|
||||
);
|
||||
}
|
||||
@@ -3011,7 +3014,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"grep_files",
|
||||
create_grep_files_tool(),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
"grep_files",
|
||||
grep_files_handler,
|
||||
);
|
||||
}
|
||||
@@ -3028,7 +3030,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"read_file",
|
||||
create_read_file_tool(),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
"read_file",
|
||||
read_file_handler,
|
||||
);
|
||||
}
|
||||
@@ -3046,7 +3047,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"list_dir",
|
||||
create_list_dir_tool(),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
"list_dir",
|
||||
list_dir_handler,
|
||||
);
|
||||
}
|
||||
@@ -3126,7 +3126,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"view_image",
|
||||
create_view_image_tool(config.can_request_original_image_detail),
|
||||
/*supports_parallel_tool_calls*/ true,
|
||||
"view_image",
|
||||
view_image_handler,
|
||||
);
|
||||
|
||||
@@ -3137,7 +3136,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"artifacts",
|
||||
create_artifacts_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"artifacts",
|
||||
artifacts_handler,
|
||||
);
|
||||
}
|
||||
@@ -3149,7 +3147,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"spawn_agent",
|
||||
create_spawn_agent_tool(config),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"spawn_agent",
|
||||
Arc::new(SpawnAgentHandler),
|
||||
);
|
||||
push_builtin_tool_with_handler_if_enabled(
|
||||
@@ -3158,7 +3155,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"send_input",
|
||||
create_send_input_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"send_input",
|
||||
Arc::new(SendInputHandler),
|
||||
);
|
||||
if !config.multi_agent_v2 {
|
||||
@@ -3168,7 +3164,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"resume_agent",
|
||||
create_resume_agent_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"resume_agent",
|
||||
Arc::new(ResumeAgentHandler),
|
||||
);
|
||||
builder.register_handler("resume_agent", Arc::new(ResumeAgentHandler));
|
||||
@@ -3179,7 +3174,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"wait_agent",
|
||||
create_wait_agent_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"wait_agent",
|
||||
Arc::new(WaitAgentHandler),
|
||||
);
|
||||
push_builtin_tool_with_handler_if_enabled(
|
||||
@@ -3188,7 +3182,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"close_agent",
|
||||
create_close_agent_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"close_agent",
|
||||
Arc::new(CloseAgentHandler),
|
||||
);
|
||||
}
|
||||
@@ -3201,7 +3194,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"spawn_agents_on_csv",
|
||||
create_spawn_agents_on_csv_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"spawn_agents_on_csv",
|
||||
agent_jobs_handler.clone(),
|
||||
);
|
||||
if config.agent_jobs_worker_tools
|
||||
@@ -3213,7 +3205,6 @@ pub(crate) fn build_specs_with_discoverable_tools(
|
||||
"report_agent_job_result",
|
||||
create_report_agent_job_result_tool(),
|
||||
/*supports_parallel_tool_calls*/ false,
|
||||
"report_agent_job_result",
|
||||
agent_jobs_handler,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user