python-codex 0.1.13__py3-none-any.whl → 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. pycodex/agent.py +71 -11
  2. pycodex/cli.py +16 -356
  3. pycodex/context.py +12 -0
  4. pycodex/feishu_card.py +76 -30
  5. pycodex/feishu_link.py +131 -11
  6. pycodex/interactive_session.py +397 -0
  7. pycodex/model.py +11 -22
  8. pycodex/protocol.py +0 -5
  9. pycodex/runtime.py +23 -0
  10. pycodex/runtime_services.py +2 -2
  11. pycodex/tools/agent_tool_schemas.py +1 -1
  12. pycodex/tools/apply_patch_tool.py +1 -1
  13. pycodex/tools/base_tool.py +1 -27
  14. pycodex/tools/close_agent_tool.py +11 -4
  15. pycodex/tools/code_mode_manager.py +1 -1
  16. pycodex/tools/exec_command_tool.py +40 -16
  17. pycodex/tools/exec_tool.py +18 -2
  18. pycodex/tools/grep_files_tool.py +19 -6
  19. pycodex/tools/ipython_tool.py +3 -2
  20. pycodex/tools/list_dir_tool.py +19 -6
  21. pycodex/tools/read_file_tool.py +39 -9
  22. pycodex/tools/request_permissions_tool.py +12 -1
  23. pycodex/tools/request_user_input_tool.py +28 -1
  24. pycodex/tools/send_input_tool.py +4 -2
  25. pycodex/tools/shell_command_tool.py +23 -6
  26. pycodex/tools/shell_tool.py +13 -4
  27. pycodex/tools/spawn_agent_tool.py +31 -8
  28. pycodex/tools/unified_exec_manager.py +49 -93
  29. pycodex/tools/update_plan_tool.py +14 -6
  30. pycodex/tools/view_image_tool.py +17 -16
  31. pycodex/tools/wait_agent_tool.py +15 -3
  32. pycodex/tools/wait_tool.py +18 -4
  33. pycodex/tools/web_search_tool.py +2 -1
  34. pycodex/tools/write_stdin_tool.py +42 -10
  35. pycodex/utils/compactor.py +7 -1
  36. pycodex/utils/session_persist.py +42 -1
  37. pycodex/utils/truncation.py +206 -0
  38. pycodex/utils/visualize.py +34 -15
  39. {python_codex-0.1.13.dist-info → python_codex-0.2.0.dist-info}/METADATA +4 -1
  40. python_codex-0.2.0.dist-info/RECORD +88 -0
  41. {python_codex-0.1.13.dist-info → python_codex-0.2.0.dist-info}/entry_points.txt +1 -0
  42. workspace_server/__init__.py +23 -0
  43. workspace_server/__main__.py +5 -0
  44. workspace_server/app.py +1347 -0
  45. workspace_server/workspace.html +866 -0
  46. pycodex/prompts/exec_tools.json +0 -411
  47. pycodex/prompts/subagent_tools.json +0 -163
  48. python_codex-0.1.13.dist-info/RECORD +0 -84
  49. {python_codex-0.1.13.dist-info → python_codex-0.2.0.dist-info}/WHEEL +0 -0
  50. {python_codex-0.1.13.dist-info → python_codex-0.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,411 +0,0 @@
1
- [
2
- {
3
- "type": "function",
4
- "name": "exec_command",
5
- "description": "Runs a command in a PTY, returning output or a session ID for ongoing interaction.",
6
- "strict": false,
7
- "parameters": {
8
- "type": "object",
9
- "properties": {
10
- "cmd": {
11
- "type": "string",
12
- "description": "Shell command to execute."
13
- },
14
- "justification": {
15
- "type": "string",
16
- "description": "Only set if sandbox_permissions is \\\"require_escalated\\\".\n Request approval from the user to run this command outside the sandbox.\n Phrased as a simple question that summarizes the purpose of the\n command as it relates to the task at hand - e.g. 'Do you want to\n fetch and pull the latest version of this git branch?'"
17
- },
18
- "login": {
19
- "type": "boolean",
20
- "description": "Whether to run the shell with -l/-i semantics. Defaults to true."
21
- },
22
- "max_output_tokens": {
23
- "type": "number",
24
- "description": "Maximum number of tokens to return. Excess output will be truncated."
25
- },
26
- "prefix_rule": {
27
- "type": "array",
28
- "items": {
29
- "type": "string"
30
- },
31
- "description": "Only specify when sandbox_permissions is `require_escalated`.\n Suggest a prefix command pattern that will allow you to fulfill similar requests from the user in the future.\n Should be a short but reasonable prefix, e.g. [\\\"git\\\", \\\"pull\\\"] or [\\\"uv\\\", \\\"run\\\"] or [\\\"pytest\\\"]."
32
- },
33
- "sandbox_permissions": {
34
- "type": "string",
35
- "description": "Sandbox permissions for the command. Set to \"require_escalated\" to request running without sandbox restrictions; defaults to \"use_default\"."
36
- },
37
- "shell": {
38
- "type": "string",
39
- "description": "Shell binary to launch. Defaults to the user's default shell."
40
- },
41
- "tty": {
42
- "type": "boolean",
43
- "description": "Whether to allocate a TTY for the command. Defaults to false (plain pipes); set to true to open a PTY and access TTY process."
44
- },
45
- "workdir": {
46
- "type": "string",
47
- "description": "Optional working directory to run the command in; defaults to the turn cwd."
48
- },
49
- "yield_time_ms": {
50
- "type": "number",
51
- "description": "How long to wait (in milliseconds) for output before yielding."
52
- }
53
- },
54
- "required": [
55
- "cmd"
56
- ],
57
- "additionalProperties": false
58
- }
59
- },
60
- {
61
- "type": "function",
62
- "name": "write_stdin",
63
- "description": "Writes characters to an existing unified exec session and returns recent output.",
64
- "strict": false,
65
- "parameters": {
66
- "type": "object",
67
- "properties": {
68
- "chars": {
69
- "type": "string",
70
- "description": "Bytes to write to stdin (may be empty to poll)."
71
- },
72
- "max_output_tokens": {
73
- "type": "number",
74
- "description": "Maximum number of tokens to return. Excess output will be truncated."
75
- },
76
- "session_id": {
77
- "type": "number",
78
- "description": "Identifier of the running unified exec session."
79
- },
80
- "yield_time_ms": {
81
- "type": "number",
82
- "description": "How long to wait (in milliseconds) for output before yielding."
83
- }
84
- },
85
- "required": [
86
- "session_id"
87
- ],
88
- "additionalProperties": false
89
- }
90
- },
91
- {
92
- "type": "function",
93
- "name": "update_plan",
94
- "description": "Updates the task plan.\nProvide an optional explanation and a list of plan items, each with a step and status.\nAt most one step can be in_progress at a time.\n",
95
- "strict": false,
96
- "parameters": {
97
- "type": "object",
98
- "properties": {
99
- "explanation": {
100
- "type": "string"
101
- },
102
- "plan": {
103
- "type": "array",
104
- "items": {
105
- "type": "object",
106
- "properties": {
107
- "status": {
108
- "type": "string",
109
- "description": "One of: pending, in_progress, completed"
110
- },
111
- "step": {
112
- "type": "string"
113
- }
114
- },
115
- "required": [
116
- "step",
117
- "status"
118
- ],
119
- "additionalProperties": false
120
- },
121
- "description": "The list of steps"
122
- }
123
- },
124
- "required": [
125
- "plan"
126
- ],
127
- "additionalProperties": false
128
- }
129
- },
130
- {
131
- "type": "function",
132
- "name": "request_user_input",
133
- "description": "Request user input for one to three short questions and wait for the response. This tool is only available in Plan mode.",
134
- "strict": false,
135
- "parameters": {
136
- "type": "object",
137
- "properties": {
138
- "questions": {
139
- "type": "array",
140
- "items": {
141
- "type": "object",
142
- "properties": {
143
- "header": {
144
- "type": "string",
145
- "description": "Short header label shown in the UI (12 or fewer chars)."
146
- },
147
- "id": {
148
- "type": "string",
149
- "description": "Stable identifier for mapping answers (snake_case)."
150
- },
151
- "options": {
152
- "type": "array",
153
- "items": {
154
- "type": "object",
155
- "properties": {
156
- "description": {
157
- "type": "string",
158
- "description": "One short sentence explaining impact/tradeoff if selected."
159
- },
160
- "label": {
161
- "type": "string",
162
- "description": "User-facing label (1-5 words)."
163
- }
164
- },
165
- "required": [
166
- "label",
167
- "description"
168
- ],
169
- "additionalProperties": false
170
- },
171
- "description": "Provide 2-3 mutually exclusive choices. Put the recommended option first and suffix its label with \"(Recommended)\". Do not include an \"Other\" option in this list; the client will add a free-form \"Other\" option automatically."
172
- },
173
- "question": {
174
- "type": "string",
175
- "description": "Single-sentence prompt shown to the user."
176
- }
177
- },
178
- "required": [
179
- "id",
180
- "header",
181
- "question",
182
- "options"
183
- ],
184
- "additionalProperties": false
185
- },
186
- "description": "Questions to show the user. Prefer 1 and do not exceed 3"
187
- }
188
- },
189
- "required": [
190
- "questions"
191
- ],
192
- "additionalProperties": false
193
- }
194
- },
195
- {
196
- "type": "custom",
197
- "name": "apply_patch",
198
- "description": "Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.",
199
- "format": {
200
- "type": "grammar",
201
- "syntax": "lark",
202
- "definition": "start: begin_patch hunk+ end_patch\nbegin_patch: \"*** Begin Patch\" LF\nend_patch: \"*** End Patch\" LF?\n\nhunk: add_hunk | delete_hunk | update_hunk\nadd_hunk: \"*** Add File: \" filename LF add_line+\ndelete_hunk: \"*** Delete File: \" filename LF\nupdate_hunk: \"*** Update File: \" filename LF change_move? change?\n\nfilename: /(.+)/\nadd_line: \"+\" /(.*)/ LF -> line\n\nchange_move: \"*** Move to: \" filename LF\nchange: (change_context | change_line)+ eof_line?\nchange_context: (\"@@\" | \"@@ \" /(.+)/) LF\nchange_line: (\"+\" | \"-\" | \" \") /(.*)/ LF\neof_line: \"*** End of File\" LF\n\n%import common.LF\n"
203
- }
204
- },
205
- {
206
- "type": "web_search",
207
- "external_web_access": true
208
- },
209
- {
210
- "type": "function",
211
- "name": "view_image",
212
- "description": "View a local image from the filesystem (only use if given a full filepath by the user, and the image isn't already attached to the thread context within <image ...> tags).",
213
- "strict": false,
214
- "parameters": {
215
- "type": "object",
216
- "properties": {
217
- "path": {
218
- "type": "string",
219
- "description": "Local filesystem path to an image file"
220
- }
221
- },
222
- "required": [
223
- "path"
224
- ],
225
- "additionalProperties": false
226
- }
227
- },
228
- {
229
- "type": "function",
230
- "name": "spawn_agent",
231
- "description": "\n Only use `spawn_agent` if and only if the user explicitly asks for sub-agents, delegation, or parallel agent work.\n Requests for depth, thoroughness, research, investigation, or detailed codebase analysis do not count as permission to spawn.\n Agent-role guidance below only helps choose which agent to use after spawning is already authorized; it never authorizes spawning by itself.\n Spawn a sub-agent for a well-scoped task. Returns the agent id (and user-facing nickname when available) to use to communicate with this agent. This spawn_agent tool provides you access to smaller but more efficient sub-agents. A mini model can solve many tasks faster than the main model. You should follow the rules and guidelines below to use this tool.\n\n- gpt-5.3-codex (`gpt-5.3-codex`): Latest frontier agentic coding model. Default reasoning effort: medium. Supported reasoning efforts: low (Fast responses with lighter reasoning), medium (Balances speed and reasoning depth for everyday tasks), high (Greater reasoning depth for complex problems), xhigh (Extra high reasoning depth for complex problems).\n- gpt-5.4 (`gpt-5.4`): Latest frontier agentic coding model. Default reasoning effort: medium. Supported reasoning efforts: low (Fast responses with lighter reasoning), medium (Balances speed and reasoning depth for everyday tasks), high (Greater reasoning depth for complex problems), xhigh (Extra high reasoning depth for complex problems).\n- gpt-5.2-codex (`gpt-5.2-codex`): Frontier agentic coding model. Default reasoning effort: medium. Supported reasoning efforts: low (Fast responses with lighter reasoning), medium (Balances speed and reasoning depth for everyday tasks), high (Greater reasoning depth for complex problems), xhigh (Extra high reasoning depth for complex problems).\n- gpt-5.1-codex-max (`gpt-5.1-codex-max`): Codex-optimized flagship for deep and fast reasoning. Default reasoning effort: medium. Supported reasoning efforts: low (Fast responses with lighter reasoning), medium (Balances speed and reasoning depth for everyday tasks), high (Greater reasoning depth for complex problems), xhigh (Extra high reasoning depth for complex problems).\n- gpt-5.2 (`gpt-5.2`): Latest frontier model with improvements across knowledge, reasoning and coding Default reasoning effort: medium. Supported reasoning efforts: low (Balances speed with some reasoning; useful for straightforward queries and short explanations), medium (Provides a solid balance of reasoning depth and latency for general-purpose tasks), high (Maximizes reasoning depth for complex or ambiguous problems), xhigh (Extra high reasoning for complex problems).\n- gpt-5.1-codex-mini (`gpt-5.1-codex-mini`): Optimized for codex. Cheaper, faster, but less capable. Default reasoning effort: medium. Supported reasoning efforts: medium (Dynamically adjusts reasoning based on the task), high (Maximizes reasoning depth for complex or ambiguous problems).\n### When to delegate vs. do the subtask yourself\n- First, quickly analyze the overall user task and form a succinct high-level plan. Identify which tasks are immediate blockers on the critical path, and which tasks are sidecar tasks that are needed but can run in parallel without blocking the next local step. As part of that plan, explicitly decide what immediate task you should do locally right now. Do this planning step before delegating to agents so you do not hand off the immediate blocking task to a submodel and then waste time waiting on it.\n- Use the smaller subagent when a subtask is easy enough for it to handle and can run in parallel with your local work. Prefer delegating concrete, bounded sidecar tasks that materially advance the main task without blocking your immediate next local step.\n- Do not delegate urgent blocking work when your immediate next step depends on that result. If the very next action is blocked on that task, the main rollout should usually do it locally to keep the critical path moving.\n- Keep work local when the subtask is too difficult to delegate well and when it is tightly coupled, urgent, or likely to block your immediate next step.\n\n### Designing delegated subtasks\n- Subtasks must be concrete, well-defined, and self-contained.\n- Delegated subtasks must materially advance the main task.\n- Do not duplicate work between the main rollout and delegated subtasks.\n- Avoid issuing multiple delegate calls on the same unresolved thread unless the new delegated task is genuinely different and necessary.\n- Narrow the delegated ask to the concrete output you need next.\n- For coding tasks, prefer delegating concrete code-change worker subtasks over read-only explorer analysis when the subagent can make a bounded patch in a clear write scope.\n- When delegating coding work, instruct the submodel to edit files directly in its forked workspace and list the file paths it changed in the final answer.\n- For code-edit subtasks, decompose work so each delegated task has a disjoint write set.\n\n### After you delegate\n- Call wait_agent very sparingly. Only call wait_agent when you need the result immediately for the next critical-path step and you are blocked until it returns.\n- Do not redo delegated subagent tasks yourself; focus on integrating results or tackling non-overlapping work.\n- While the subagent is running in the background, do meaningful non-overlapping work immediately.\n- Do not repeatedly wait by reflex.\n- When a delegated coding task returns, quickly review the uploaded changes, then integrate or refine them.\n\n### Parallel delegation patterns\n- Run multiple independent information-seeking subtasks in parallel when you have distinct questions that can be answered independently.\n- Split implementation into disjoint codebase slices and spawn multiple agents for them in parallel when the write scopes do not overlap.\n- Delegate verification only when it can run in parallel with ongoing implementation and is likely to catch a concrete risk before final integration.\n- The key is to find opportunities to spawn multiple independent subtasks in parallel within the same round, while ensuring each subtask is well-defined, self-contained, and materially advances the main task.",
232
- "strict": false,
233
- "parameters": {
234
- "type": "object",
235
- "properties": {
236
- "agent_type": {
237
- "type": "string",
238
- "description": "Optional type name for the new agent. If omitted, `default` is used.\nAvailable roles:\ndefault: {\nDefault agent.\n}\nexplorer: {\nUse `explorer` for specific codebase questions.\nExplorers are fast and authoritative.\nThey must be used to ask specific, well-scoped questions on the codebase.\nRules:\n- In order to avoid redundant work, you should avoid exploring the same problem that explorers have already covered. Typically, you should trust the explorer results without additional verification. You are still allowed to inspect the code yourself to gain the needed context!\n- You are encouraged to spawn up multiple explorers in parallel when you have multiple distinct questions to ask about the codebase that can be answered independently. This allows you to get more information faster without waiting for one question to finish before asking the next. While waiting for the explorer results, you can continue working on other local tasks that do not depend on those results. This parallelism is a key advantage of delegation, so use it whenever you have multiple questions to ask.\n- Reuse existing explorers for related questions.\n}\nworker: {\nUse for execution and production work.\nTypical tasks:\n- Implement part of a feature\n- Fix tests or bugs\n- Split large refactors into independent chunks\nRules:\n- Explicitly assign **ownership** of the task (files / responsibility). When the subtask involves code changes, you should clearly specify which files or modules the worker is responsible for. This helps avoid merge conflicts and ensures accountability. For example, you can say \"Worker 1 is responsible for updating the authentication module, while Worker 2 will handle the database layer.\" By defining clear ownership, you can delegate more effectively and reduce coordination overhead.\n- Always tell workers they are **not alone in the codebase**, and they should not revert the edits made by others, and they should adjust their implementation to accommodate the changes made by others. This is important because there may be multiple workers making changes in parallel, and they need to be aware of each other's work to avoid conflicts and ensure a cohesive final product.\n}"
239
- },
240
- "fork_context": {
241
- "type": "boolean",
242
- "description": "When true, fork the current thread history into the new agent before sending the initial prompt. This must be used when you want the new agent to have exactly the same context as you."
243
- },
244
- "items": {
245
- "type": "array",
246
- "items": {
247
- "type": "object",
248
- "properties": {
249
- "image_url": {
250
- "type": "string",
251
- "description": "Image URL when type is image."
252
- },
253
- "name": {
254
- "type": "string",
255
- "description": "Display name when type is skill or mention."
256
- },
257
- "path": {
258
- "type": "string",
259
- "description": "Path when type is local_image/skill, or structured mention target such as app://<connector-id> or plugin://<plugin-name>@<marketplace-name> when type is mention."
260
- },
261
- "text": {
262
- "type": "string",
263
- "description": "Text content when type is text."
264
- },
265
- "type": {
266
- "type": "string",
267
- "description": "Input item type: text, image, local_image, skill, or mention."
268
- }
269
- },
270
- "additionalProperties": false
271
- },
272
- "description": "Structured input items. Use this to pass explicit mentions (for example app:// connector paths)."
273
- },
274
- "message": {
275
- "type": "string",
276
- "description": "Initial plain-text task for the new agent. Use either message or items."
277
- },
278
- "model": {
279
- "type": "string",
280
- "description": "Optional model override for the new agent. Replaces the inherited model."
281
- },
282
- "reasoning_effort": {
283
- "type": "string",
284
- "description": "Optional reasoning effort override for the new agent. Replaces the inherited reasoning effort."
285
- }
286
- },
287
- "additionalProperties": false
288
- }
289
- },
290
- {
291
- "type": "function",
292
- "name": "send_input",
293
- "description": "Send a message to an existing agent. Use interrupt=true to redirect work immediately. You should reuse the agent by send_input if you believe your assigned task is highly dependent on the context of a previous task.",
294
- "strict": false,
295
- "parameters": {
296
- "type": "object",
297
- "properties": {
298
- "id": {
299
- "type": "string",
300
- "description": "Agent id to message (from spawn_agent)."
301
- },
302
- "interrupt": {
303
- "type": "boolean",
304
- "description": "When true, stop the agent's current task and handle this immediately. When false (default), queue this message."
305
- },
306
- "items": {
307
- "type": "array",
308
- "items": {
309
- "type": "object",
310
- "properties": {
311
- "image_url": {
312
- "type": "string",
313
- "description": "Image URL when type is image."
314
- },
315
- "name": {
316
- "type": "string",
317
- "description": "Display name when type is skill or mention."
318
- },
319
- "path": {
320
- "type": "string",
321
- "description": "Path when type is local_image/skill, or structured mention target such as app://<connector-id> or plugin://<plugin-name>@<marketplace-name> when type is mention."
322
- },
323
- "text": {
324
- "type": "string",
325
- "description": "Text content when type is text."
326
- },
327
- "type": {
328
- "type": "string",
329
- "description": "Input item type: text, image, local_image, skill, or mention."
330
- }
331
- },
332
- "additionalProperties": false
333
- },
334
- "description": "Structured input items. Use this to pass explicit mentions (for example app:// connector paths)."
335
- },
336
- "message": {
337
- "type": "string",
338
- "description": "Legacy plain-text message to send to the agent. Use either message or items."
339
- }
340
- },
341
- "required": [
342
- "id"
343
- ],
344
- "additionalProperties": false
345
- }
346
- },
347
- {
348
- "type": "function",
349
- "name": "resume_agent",
350
- "description": "Resume a previously closed agent by id so it can receive send_input and wait_agent calls.",
351
- "strict": false,
352
- "parameters": {
353
- "type": "object",
354
- "properties": {
355
- "id": {
356
- "type": "string",
357
- "description": "Agent id to resume."
358
- }
359
- },
360
- "required": [
361
- "id"
362
- ],
363
- "additionalProperties": false
364
- }
365
- },
366
- {
367
- "type": "function",
368
- "name": "wait_agent",
369
- "description": "Wait for agents to reach a final status. Completed statuses may include the agent's final message. Returns empty status when timed out. Once the agent reaches a final status, a notification message will be received containing the same completed status.",
370
- "strict": false,
371
- "parameters": {
372
- "type": "object",
373
- "properties": {
374
- "ids": {
375
- "type": "array",
376
- "items": {
377
- "type": "string"
378
- },
379
- "description": "Agent ids to wait on. Pass multiple ids to wait for whichever finishes first."
380
- },
381
- "timeout_ms": {
382
- "type": "number",
383
- "description": "Optional timeout in milliseconds. Defaults to 30000, min 10000, max 3600000. Prefer longer waits (minutes) to avoid busy polling."
384
- }
385
- },
386
- "required": [
387
- "ids"
388
- ],
389
- "additionalProperties": false
390
- }
391
- },
392
- {
393
- "type": "function",
394
- "name": "close_agent",
395
- "description": "Close an agent when it is no longer needed and return its last known status. Don't keep agents open for too long if they are not needed anymore.",
396
- "strict": false,
397
- "parameters": {
398
- "type": "object",
399
- "properties": {
400
- "id": {
401
- "type": "string",
402
- "description": "Agent id to close (from spawn_agent)."
403
- }
404
- },
405
- "required": [
406
- "id"
407
- ],
408
- "additionalProperties": false
409
- }
410
- }
411
- ]
@@ -1,163 +0,0 @@
1
- [
2
- {
3
- "type": "function",
4
- "name": "exec_command",
5
- "description": "Runs a command in a PTY, returning output or a session ID for ongoing interaction.",
6
- "strict": false,
7
- "parameters": {
8
- "type": "object",
9
- "properties": {
10
- "cmd": {
11
- "type": "string",
12
- "description": "Shell command to execute."
13
- },
14
- "justification": {
15
- "type": "string",
16
- "description": "Only set if sandbox_permissions is \\\"require_escalated\\\".\n Request approval from the user to run this command outside the sandbox.\n Phrased as a simple question that summarizes the purpose of the\n command as it relates to the task at hand - e.g. 'Do you want to\n fetch and pull the latest version of this git branch?'"
17
- },
18
- "login": {
19
- "type": "boolean",
20
- "description": "Whether to run the shell with -l/-i semantics. Defaults to true."
21
- },
22
- "max_output_tokens": {
23
- "type": "number",
24
- "description": "Maximum number of tokens to return. Excess output will be truncated."
25
- },
26
- "prefix_rule": {
27
- "type": "array",
28
- "items": {
29
- "type": "string"
30
- },
31
- "description": "Only specify when sandbox_permissions is `require_escalated`.\n Suggest a prefix command pattern that will allow you to fulfill similar requests from the user in the future.\n Should be a short but reasonable prefix, e.g. [\\\"git\\\", \\\"pull\\\"] or [\\\"uv\\\", \\\"run\\\"] or [\\\"pytest\\\"]."
32
- },
33
- "sandbox_permissions": {
34
- "type": "string",
35
- "description": "Sandbox permissions for the command. Set to \"require_escalated\" to request running without sandbox restrictions; defaults to \"use_default\"."
36
- },
37
- "shell": {
38
- "type": "string",
39
- "description": "Shell binary to launch. Defaults to the user's default shell."
40
- },
41
- "tty": {
42
- "type": "boolean",
43
- "description": "Whether to allocate a TTY for the command. Defaults to false (plain pipes); set to true to open a PTY and access TTY process."
44
- },
45
- "workdir": {
46
- "type": "string",
47
- "description": "Optional working directory to run the command in; defaults to the turn cwd."
48
- },
49
- "yield_time_ms": {
50
- "type": "number",
51
- "description": "How long to wait (in milliseconds) for output before yielding."
52
- }
53
- },
54
- "required": [
55
- "cmd"
56
- ],
57
- "additionalProperties": false
58
- }
59
- },
60
- {
61
- "type": "function",
62
- "name": "write_stdin",
63
- "description": "Writes characters to an existing unified exec session and returns recent output.",
64
- "strict": false,
65
- "parameters": {
66
- "type": "object",
67
- "properties": {
68
- "chars": {
69
- "type": "string",
70
- "description": "Bytes to write to stdin (may be empty to poll)."
71
- },
72
- "max_output_tokens": {
73
- "type": "number",
74
- "description": "Maximum number of tokens to return. Excess output will be truncated."
75
- },
76
- "session_id": {
77
- "type": "number",
78
- "description": "Identifier of the running unified exec session."
79
- },
80
- "yield_time_ms": {
81
- "type": "number",
82
- "description": "How long to wait (in milliseconds) for output before yielding."
83
- }
84
- },
85
- "required": [
86
- "session_id"
87
- ],
88
- "additionalProperties": false
89
- }
90
- },
91
- {
92
- "type": "function",
93
- "name": "update_plan",
94
- "description": "Updates the task plan.\nProvide an optional explanation and a list of plan items, each with a step and status.\nAt most one step can be in_progress at a time.\n",
95
- "strict": false,
96
- "parameters": {
97
- "type": "object",
98
- "properties": {
99
- "explanation": {
100
- "type": "string"
101
- },
102
- "plan": {
103
- "type": "array",
104
- "items": {
105
- "type": "object",
106
- "properties": {
107
- "status": {
108
- "type": "string",
109
- "description": "One of: pending, in_progress, completed"
110
- },
111
- "step": {
112
- "type": "string"
113
- }
114
- },
115
- "required": [
116
- "step",
117
- "status"
118
- ],
119
- "additionalProperties": false
120
- },
121
- "description": "The list of steps"
122
- }
123
- },
124
- "required": [
125
- "plan"
126
- ],
127
- "additionalProperties": false
128
- }
129
- },
130
- {
131
- "type": "custom",
132
- "name": "apply_patch",
133
- "description": "Use the `apply_patch` tool to edit files. This is a FREEFORM tool, so do not wrap the patch in JSON.",
134
- "format": {
135
- "type": "grammar",
136
- "syntax": "lark",
137
- "definition": "start: begin_patch hunk+ end_patch\nbegin_patch: \"*** Begin Patch\" LF\nend_patch: \"*** End Patch\" LF?\n\nhunk: add_hunk | delete_hunk | update_hunk\nadd_hunk: \"*** Add File: \" filename LF add_line+\ndelete_hunk: \"*** Delete File: \" filename LF\nupdate_hunk: \"*** Update File: \" filename LF change_move? change?\n\nfilename: /(.+)/\nadd_line: \"+\" /(.*)/ LF -> line\n\nchange_move: \"*** Move to: \" filename LF\nchange: (change_context | change_line)+ eof_line?\nchange_context: (\"@@\" | \"@@ \" /(.+)/) LF\nchange_line: (\"+\" | \"-\" | \" \") /(.*)/ LF\neof_line: \"*** End of File\" LF\n\n%import common.LF\n"
138
- }
139
- },
140
- {
141
- "type": "web_search",
142
- "external_web_access": true
143
- },
144
- {
145
- "type": "function",
146
- "name": "view_image",
147
- "description": "View a local image from the filesystem (only use if given a full filepath by the user, and the image isn't already attached to the thread context within <image ...> tags).",
148
- "strict": false,
149
- "parameters": {
150
- "type": "object",
151
- "properties": {
152
- "path": {
153
- "type": "string",
154
- "description": "Local filesystem path to an image file"
155
- }
156
- },
157
- "required": [
158
- "path"
159
- ],
160
- "additionalProperties": false
161
- }
162
- }
163
- ]