* feat(ptc): define scoped REPL top-level scopes and import base in guidance The scoped REPL guidance now states the rules a program follows instead of listing edge cases: each run_code call runs one program in its own top-level scope, whose top-level declarations and received names are copied, not referenced, into later programs; a program either uses a copied name or declares it again; block-level var is discouraged because it changes which value later programs copy; a failed program keeps earlier values. It names the missing require and module and separates the import base, fixed at the environment's first program, from process.cwd(), which follows each program. Formats without top-level return say to await work before the program ends. * test(ptc): pin the scoped REPL scope and import guidance Update the verbatim scoped REPL guidance assertion and refresh, without a key, the recorded run_code descriptions of the PTC and CUA scenarios whose guidance changed: the scoped REPL rules and the "before the program ends" wording shared by retained formats. * test(cua-mcp): refresh the cua_run_code description for the scoped REPL guidance The cua-mcp profile expectation landed on master after this branch's base; it lists cua_run_code with the scoped REPL execution instructions. * fix(ptc): keep the shared scoped guidance free of a consumer tool name The runtime execution instructions are shared by run_code and cua_run_code, so the new sentence no longer names run_code. The Agent Note also gives the missing top-level return as the reason for the retained-state wording, which covers the persistent script format as well as the REPLs. * test(ptc): pin the unchanged scoped guidance across consumers The verbatim assertion, the three scoped tool schemas, and the cua-mcp profile fixture follow the shared sentence, which no longer names run_code.
43 lines
4.1 KiB
JSON
43 lines
4.1 KiB
JSON
{
|
||
"initial": [
|
||
{
|
||
"name": "run_code",
|
||
"description": "Execute a TypeScript program against the available tools. Takes two required arguments: `code`, the program to execute, and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Show selected text and images with inspect(...values). The program contains TypeScript script statements; only erasable syntax is accepted, with no enum or namespaces. Type annotations are advisory. Top-level declarations and await are supported; top-level return is not supported. Use inspect(...values) to display output. Do not use console. The final expression is awaited if it is a Promise. Variables, functions, and imported modules remain in memory for this Agent across calls. Use await import(...) for modules. Relative paths use the supplied working directory. Direct filesystem access follows the environment's launch-time sandbox policy; process.env starts empty. Await asynchronous work: an uncaught callback exception or unhandled rejection terminates the process and clears its variables. Values from bindings and imports can belong to another realm; use Array.isArray for arrays and the supplied binding error classes for failures, because instanceof Array or Error may be false. Timeout and cancellation results say whether retained variables were preserved or cleared. Restart, sandbox changes, output overflow, or process failure clears them. Recreate missing variables and resources; conversation history does not restore state. Earlier mutations and tool effects are not rolled back. Approved sandbox escalations use a fresh environment and discard its variables afterward. Do not redeclare existing let, const, or class names; reuse mutable bindings or choose new names. Await tools and cleanup before the program ends; unfinished tools reject. After completion, timeout, or cancellation, new tool calls are rejected and captured output is discarded; background work may still change state. Await child-process completion before the program ends; raw output belongs to the active evaluation. If a native top-level let, const, or class initializer throws, its name may remain permanently uninitialized; use a new name or restart the environment. Each program starts in the Session's current directory. Running programs keep their initial directory. A sandbox escalation approves this complete program for one execution only. Nested tools retain their own policies and approvals. Request wider access only after evidence of a denial. Earlier effects may already have completed: inspect them before explicitly retrying. Programs are never replayed automatically.",
|
||
"parameters": {
|
||
"type": "object",
|
||
"properties": {
|
||
"code": {
|
||
"type": "string",
|
||
"description": "The TypeScript program to execute, following this tool's execution instructions."
|
||
},
|
||
"description": {
|
||
"type": "string",
|
||
"description": "Clear, concise description of what this program does in active voice, 5-10 words (shown in the UI). Examples: \"Count TODO markers across packages\"; \"Read failing test and its fixture\"; \"Rename config key in every cordis.yml\"."
|
||
},
|
||
"timeoutMs": {
|
||
"type": "number",
|
||
"description": "Positive elapsed-time budget in milliseconds, including nested tool and approval waits. Default 10000; capped at 600000. Zero does not disable the deadline."
|
||
},
|
||
"sandbox_permissions": {
|
||
"type": "string",
|
||
"description": "Wider sandbox mode for this complete program execution; requires justification and approval.",
|
||
"enum": [
|
||
"workspace-write",
|
||
"danger-full-access"
|
||
]
|
||
},
|
||
"justification": {
|
||
"type": "string",
|
||
"description": "Reason this complete program needs wider access, shown to the user for approval. Use the language of the user’s current request."
|
||
}
|
||
},
|
||
"required": [
|
||
"code",
|
||
"description"
|
||
]
|
||
}
|
||
}
|
||
],
|
||
"changes": []
|
||
}
|