@qwen-code/qwen-harness 0.1.10 → 0.1.11-yjk.1
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.
- package/README.md +28 -7
- package/dist/child-runtime.js +2 -1
- package/dist/child-runtime.js.map +2 -2
- package/dist/entrypoint.js +2378 -98
- package/dist/entrypoint.js.map +4 -4
- package/dist/verify-scaling-constraints.js +1306 -0
- package/dist/verify-scaling-constraints.js.map +7 -0
- package/npm-shrinkwrap.json +2595 -0
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Pi Training Harness
|
|
2
2
|
|
|
3
|
+
中文入门:[新人指南:项目用途、任务提交与 Scaling Harness](docs/beginner-guide.zh-CN.md)。
|
|
4
|
+
|
|
3
5
|
This repository provides Pi-based focused harness profiles without replacing Pi's runtime. See [Profiles](#profiles) for the complete list.
|
|
4
6
|
|
|
5
7
|
The custom profiles share Pi's model runtime, TUI, headless modes, compaction, resume, and native JSONL sessions. Their system prompts and tool contracts remain isolated from the `pi` harness.
|
|
@@ -87,6 +89,25 @@ count or per-child call ceiling. Experiment runtime limits belong to the evaluat
|
|
|
87
89
|
runner and should be held constant across configurations. `--scaling-describe`
|
|
88
90
|
reports the component parameters for output handling and context management.
|
|
89
91
|
|
|
92
|
+
The original **S1/S2/S3 remain unchanged**. Six optional constraints (A02, A05,
|
|
93
|
+
A01, U02, U07, A07) and their runtime audit/offline verifiers are implemented.
|
|
94
|
+
Use `--scaling-experiment examples/scaling-constraints/a05.json` to select only
|
|
95
|
+
A05. It reuses complete file contents and confirmed edits in the model's context;
|
|
96
|
+
existing file-tool schemas do not acquire version parameters.
|
|
97
|
+
See the [constraint guide](docs/scaling-constraints.zh-CN.md) for each module,
|
|
98
|
+
controlled baselines, coverage limits, and verification commands.
|
|
99
|
+
|
|
100
|
+
Set `"auditVersion": 2` in the experiment JSON to opt into
|
|
101
|
+
[file audit v2](docs/scaling-constraints-v2.zh-CN.md): per-file contextual knowledge,
|
|
102
|
+
streamed prefix checks, and shell operand parsing. Omitting it retains v1.
|
|
103
|
+
|
|
104
|
+
`file-tools-v2` has been removed from the runtime and its ID produces a clear
|
|
105
|
+
error. Historical reproduction requires the prior fixed build. Earlier addons
|
|
106
|
+
and the full `--scaling-prompt-version v2` bundle retain their original meaning;
|
|
107
|
+
see the [addon catalog](docs/scaling-prompt-addons.zh-CN.md). Omitting the new
|
|
108
|
+
experiment option retains the original baseline. The six-axis JSON and H01–H18
|
|
109
|
+
are unchanged.
|
|
110
|
+
|
|
90
111
|
| Component | Design 1 | Design 2 | Design 3 | Mechanism reference |
|
|
91
112
|
| --- | --- | --- | --- | --- |
|
|
92
113
|
| S: system prompt | Minimal guidance | Eight explicit engineering rules | The same rules plus steps, failure branches, and two examples | Pi's concise core; Codex engineering rules and Qwen Code mandates/workflows |
|
|
@@ -558,18 +579,18 @@ Manager, Executor, Auditor, prompt, or runtime setup.
|
|
|
558
579
|
Sessions use Pi's native storage under `~/.pi/agent/sessions/`, organized by working directory. Pi writes its append-only JSONL containing messages, tool calls/results, usage, model changes, and compaction entries.
|
|
559
580
|
|
|
560
581
|
```bash
|
|
561
|
-
npm run agent-arena --
|
|
562
|
-
npm run code-arena-react --
|
|
563
|
-
npm run code-arena-html --
|
|
564
|
-
npm run long-horizon-mea --
|
|
582
|
+
npm run dev -- --harness agent-arena --resume
|
|
583
|
+
npm run dev -- --harness code-arena-react --continue
|
|
584
|
+
npm run dev -- --harness code-arena-html --session /absolute/path/to/session.jsonl
|
|
585
|
+
npm run dev -- --harness long-horizon-mea --resume
|
|
565
586
|
```
|
|
566
587
|
|
|
567
588
|
Headless modes use the same session behavior:
|
|
568
589
|
|
|
569
590
|
```bash
|
|
570
|
-
npm run agent-arena
|
|
571
|
-
npm run agent-arena --
|
|
572
|
-
npm run code-arena-full-stack --
|
|
591
|
+
npm run dev -- --harness agent-arena -p "First turn"
|
|
592
|
+
npm run dev -- --harness agent-arena --continue -p "Continue"
|
|
593
|
+
npm run dev -- --harness code-arena-full-stack --mode json "Build the application"
|
|
573
594
|
```
|
|
574
595
|
|
|
575
596
|
## Validate
|
package/dist/child-runtime.js
CHANGED
|
@@ -31,7 +31,8 @@ function fail(error) {
|
|
|
31
31
|
if (finished) return;
|
|
32
32
|
finished = true;
|
|
33
33
|
clearHostTimers();
|
|
34
|
-
const
|
|
34
|
+
const cause = error instanceof repl.Recoverable ? error.err : error;
|
|
35
|
+
const message = cause instanceof Error ? cause.message || cause.name : String(cause);
|
|
35
36
|
send({ type: "done", error: message });
|
|
36
37
|
takeOutput?.();
|
|
37
38
|
if (!persistent) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/capabilities/tools/programmatic-tool-calling/child-runtime.js"],
|
|
4
|
-
"sourcesContent": ["// @ts-check\n\n/**\n * Short-lived JavaScript runtime used by run_code.\n *\n * This file is both directly executable from the source tree and compiled as a\n * separate package entrypoint. Model-authored code runs in a vm context without\n * Node globals. Nested tool calls are forwarded to the parent over JSON lines.\n */\n\nimport readline from \"node:readline\";\nimport repl from \"node:repl\";\nimport { PassThrough } from \"node:stream\";\nimport vm from \"node:vm\";\n\n/** @typedef {import(\"./protocol.js\").ChildDoneMessage} ChildDoneMessage */\n/** @typedef {import(\"./protocol.js\").ChildMessage} ChildMessage */\n/** @typedef {import(\"./protocol.js\").ChildToolCallMessage} ChildToolCallMessage */\n/** @typedef {import(\"./protocol.js\").NestedToolMetadata} NestedToolMetadata */\n/** @typedef {import(\"./protocol.js\").ParentMessage} ParentMessage */\n\nconst input = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });\nlet initialized = false;\nlet finished = false;\nlet persistent = false;\n/** @type {vm.Context | undefined} */\nlet runtimeContext;\n/** @type {repl.REPLServer | undefined} */\nlet replServer;\n/** @type {((error: unknown) => void) | undefined} */\nlet rejectEvaluation;\nlet nextCallId = 1;\nlet nextTimerId = 1;\n/** @type {Map<string, ReturnType<typeof setTimeout>>} */\nconst hostTimers = new Map();\n/** @type {((id: string, value: string | undefined, error: string | undefined) => void) | undefined} */\nlet settleToolCall;\n/** @type {(() => string) | undefined} */\nlet takeOutput;\n/** @type {((id: string) => unknown) | undefined} */\nlet fireTimer;\n\n/** @param {ChildMessage} message */\nfunction send(message) {\n\tprocess.stdout.write(`${JSON.stringify(message)}\\n`);\n}\n\nfunction sendTimerState() {\n\tif (!finished) send({ type: \"timer_state\", active: hostTimers.size });\n}\n\nfunction clearHostTimers() {\n\tfor (const timer of hostTimers.values()) clearTimeout(timer);\n\thostTimers.clear();\n}\n\n/** @param {unknown} error */\nfunction fail(error) {\n\tif (finished) return;\n\tfinished = true;\n\tclearHostTimers();\n\tconst message = error instanceof Error ? error.message : String(error);\n\tsend({ type: \"done\", error: message });\n\ttakeOutput?.(); // Discard output and pending callbacks from the failed cell.\n\tif (!persistent) {\n\t\tinput.close();\n\t\tprocess.stdin.unref();\n\t}\n}\n\nfunction createBridge() {\n\t/**\n\t * @param {\"register\" | \"call\" | \"set_timer\" | \"clear_timer\"} operation\n\t * @param {string | ((id: string, value: string | undefined, error: string | undefined) => void)} first\n\t * @param {(() => string) | undefined} [second]\n\t * @param {((id: string) => unknown) | undefined} [third]\n\t */\n\tconst bridge = (operation, first, second, third) => {\n\t\tif (operation === \"register\") {\n\t\t\tif (\n\t\t\t\tsettleToolCall\n\t\t\t\t\t|| takeOutput\n\t\t\t\t\t|| fireTimer\n\t\t\t\t\t|| typeof first !== \"function\"\n\t\t\t\t\t|| typeof second !== \"function\"\n\t\t\t\t\t|| typeof third !== \"function\"\n\t\t\t) {\n\t\t\t\tthrow new Error(\"run_code bridge registration failed\");\n\t\t\t}\n\t\t\tsettleToolCall = first;\n\t\t\ttakeOutput = second;\n\t\t\tfireTimer = third;\n\t\t\treturn undefined;\n\t\t}\n\t\tif (typeof first !== \"string\") {\n\t\t\tthrow new TypeError(\"run_code bridge expects serialized input\");\n\t\t}\n\t\tif (operation === \"set_timer\") {\n\t\t\t/** @type {{ delay?: unknown }} */\n\t\t\tconst request = JSON.parse(first);\n\t\t\tconst delay = Number(request.delay ?? 0);\n\t\t\tif (!Number.isFinite(delay) || delay < 0 || delay > 600_000) {\n\t\t\t\tthrow new RangeError(\"setTimeout delay must be between 0 and 600000 ms\");\n\t\t\t}\n\t\t\tconst id = `timer-${String(nextTimerId++)}`;\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\thostTimers.delete(id);\n\t\t\t\tsendTimerState();\n\t\t\t\tif (finished || typeof fireTimer !== \"function\") return;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = fireTimer(id);\n\t\t\t\t\tif (result && typeof /** @type {any} */ (result).then === \"function\") {\n\t\t\t\t\t\tvoid Promise.resolve(result).catch(fail);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfail(error);\n\t\t\t\t}\n\t\t\t}, Math.floor(delay));\n\t\t\ttimer.unref();\n\t\t\thostTimers.set(id, timer);\n\t\t\tsendTimerState();\n\t\t\treturn id;\n\t\t}\n\t\tif (operation === \"clear_timer\") {\n\t\t\tconst timer = hostTimers.get(first);\n\t\t\tif (timer) clearTimeout(timer);\n\t\t\thostTimers.delete(first);\n\t\t\tsendTimerState();\n\t\t\treturn undefined;\n\t\t}\n\t\tif (operation !== \"call\") throw new Error(`Unknown run_code bridge operation: ${operation}`);\n\t\t/** @type {{ name: string; args?: unknown }} */\n\t\tconst request = JSON.parse(first);\n\t\tconst id = String(nextCallId++);\n\t\tsend({ type: \"tool_call\", id, name: request.name, args: request.args });\n\t\treturn id;\n\t};\n\tObject.setPrototypeOf(bridge, null);\n\treturn bridge;\n}\n\n/**\n * This function is stringified and evaluated inside the model's vm context so\n * all user-facing functions belong to that realm, not the Node host realm.\n */\nfunction bootstrapGlobals() {\n\tconst runtimeGlobal = /** @type {any} */ (globalThis);\n\t/** @type {(operation: \"register\" | \"call\" | \"set_timer\" | \"clear_timer\", first: string | ((id: string, value: string | undefined, error: string | undefined) => void), second?: () => string, third?: (id: string) => unknown) => string | undefined} */\n\tconst bridge = runtimeGlobal.__runCodeBridge;\n\tconst parse = JSON.parse.bind(JSON);\n\tconst stringify = JSON.stringify.bind(JSON);\n\t/** @type {NestedToolMetadata[]} */\n\tconst metadata = parse(runtimeGlobal.__runCodeMetadata);\n\t/** @type {Array<{ type: \"text\"; text: string } | { type: \"image\"; data: string; mimeType: string }>} */\n\tconst emitted = [];\n\t/** @type {Map<string, { resolve: (value: unknown) => void; reject: (reason?: unknown) => void }>} */\n\tconst pending = new Map();\n\t/** @type {Map<string, { callback: (...args: unknown[]) => unknown; args: unknown[] }>} */\n\tconst timerCallbacks = new Map();\n\n\t/**\n\t * @param {string} id\n\t * @param {string | undefined} value\n\t * @param {string | undefined} error\n\t */\n\tconst settle = (id, value, error) => {\n\t\tconst entry = pending.get(id);\n\t\tif (!entry) return;\n\t\tpending.delete(id);\n\t\tif (error !== undefined) entry.reject(new Error(error));\n\t\telse entry.resolve(value === undefined ? undefined : parse(value));\n\t};\n\tconst output = () => {\n\t\tconst result = stringify(emitted);\n\t\temitted.length = 0;\n\t\tpending.clear();\n\t\ttimerCallbacks.clear();\n\t\treturn result;\n\t};\n\t/** @param {string} id */\n\tconst fireTimerCallback = (id) => {\n\t\tconst entry = timerCallbacks.get(id);\n\t\tif (!entry) return undefined;\n\t\ttimerCallbacks.delete(id);\n\t\treturn entry.callback(...entry.args);\n\t};\n\tbridge(\"register\", settle, output, fireTimerCallback);\n\n\tconst tools = Object.create(null);\n\tfor (const item of metadata) {\n\t\tObject.defineProperty(tools, item.name, {\n\t\t\tenumerable: true,\n\t\t\tvalue: (/** @type {unknown} */ args) => new Promise((resolve, reject) => {\n\t\t\t\tlet request;\n\t\t\t\ttry {\n\t\t\t\t\trequest = stringify({ name: item.name, args });\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst id = bridge(\"call\", request);\n\t\t\t\tif (typeof id !== \"string\") {\n\t\t\t\t\treject(new Error(\"run_code bridge did not return a tool call id\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpending.set(id, { resolve, reject });\n\t\t\t}),\n\t\t});\n\t}\n\tObject.freeze(tools);\n\n\t/** @param {unknown} value */\n\tconst printable = (value) => {\n\t\tif (typeof value === \"string\") return value;\n\t\tif (value === undefined) return \"undefined\";\n\t\ttry {\n\t\t\tconst encoded = stringify(value);\n\t\t\treturn encoded === undefined ? String(value) : encoded;\n\t\t} catch {\n\t\t\treturn String(value);\n\t\t}\n\t};\n\t/** @param {unknown} value */\n\tconst text = (value) => emitted.push({ type: \"text\", text: printable(value) });\n\t/** @param {unknown} value */\n\tconst image = (value) => {\n\t\tif (!value || typeof value !== \"object\") {\n\t\t\tthrow new TypeError(\"image() expects an image content block or nested tool result\");\n\t\t}\n\t\tconst item = /** @type {Record<string, unknown>} */ (value);\n\t\tconst candidates = Array.isArray(item.content) ? item.content : [item];\n\t\tlet count = 0;\n\t\tfor (const candidate of candidates) {\n\t\t\tif (!candidate || typeof candidate !== \"object\") continue;\n\t\t\tconst content = /** @type {Record<string, unknown>} */ (candidate);\n\t\t\tif (\n\t\t\t\t(content.type === undefined || content.type === \"image\")\n\t\t\t\t\t&& typeof content.data === \"string\"\n\t\t\t\t\t&& typeof content.mimeType === \"string\"\n\t\t\t) {\n\t\t\t\temitted.push({ type: \"image\", data: content.data, mimeType: content.mimeType });\n\t\t\t\tcount += 1;\n\t\t\t}\n\t\t}\n\t\tif (!count) throw new TypeError(\"image() input does not contain an image block\");\n\t};\n\t/**\n\t * @param {(...args: unknown[]) => unknown} callback\n\t * @param {unknown} [delay]\n\t * @param {...unknown} args\n\t */\n\tconst scheduleTimeout = (callback, delay = 0, ...args) => {\n\t\tif (typeof callback !== \"function\") throw new TypeError(\"setTimeout callback must be a function\");\n\t\tconst numericDelay = Number(delay);\n\t\tif (!Number.isFinite(numericDelay) || numericDelay < 0 || numericDelay > 600_000) {\n\t\t\tthrow new RangeError(\"setTimeout delay must be between 0 and 600000 ms\");\n\t\t}\n\t\tconst id = bridge(\"set_timer\", stringify({ delay: Math.floor(numericDelay) }));\n\t\tif (typeof id !== \"string\") throw new Error(\"run_code bridge did not return a timer id\");\n\t\ttimerCallbacks.set(id, { callback, args });\n\t\treturn id;\n\t};\n\t/** @param {unknown} handle */\n\tconst cancelTimeout = (handle) => {\n\t\tif (typeof handle !== \"string\") return;\n\t\ttimerCallbacks.delete(handle);\n\t\tbridge(\"clear_timer\", handle);\n\t};\n\n\tObject.defineProperties(runtimeGlobal, {\n\t\ttools: { value: tools, enumerable: true },\n\t\tALL_TOOLS: {\n\t\t\tvalue: Object.freeze(metadata.map((item) => Object.freeze({ ...item }))),\n\t\t\tenumerable: true,\n\t\t},\n\t\ttext: { value: text, enumerable: true },\n\t\timage: { value: image, enumerable: true },\n\t\tsetTimeout: { value: scheduleTimeout, enumerable: true },\n\t\tclearTimeout: { value: cancelTimeout, enumerable: true },\n\t\tconsole: { value: undefined },\n\t});\n\tdelete runtimeGlobal.__runCodeBridge;\n\tdelete runtimeGlobal.__runCodeMetadata;\n}\n\n/**\n * @param {vm.Context} context\n * @param {NestedToolMetadata[]} metadata\n */\nfunction installGlobals(context, metadata) {\n\tcontext.__runCodeBridge = createBridge();\n\tcontext.__runCodeMetadata = JSON.stringify(metadata);\n\tconst bootstrap = new vm.Script(`(${bootstrapGlobals.toString()})()`);\n\tbootstrap.runInContext(context);\n\tif (typeof settleToolCall !== \"function\" || typeof takeOutput !== \"function\") {\n\t\tthrow new Error(\"run_code failed to initialize its tool bridge\");\n\t}\n}\n\n/** @param {import(\"./protocol.js\").ChildToolResultMessage | import(\"./protocol.js\").ChildToolErrorMessage} message */\nfunction handleToolResponse(message) {\n\tif (typeof settleToolCall !== \"function\") return;\n\tif (message.type === \"tool_result\") {\n\t\tconst value = message.value === undefined ? undefined : JSON.stringify(message.value);\n\t\tsettleToolCall(message.id, value, undefined);\n\t} else {\n\t\tsettleToolCall(message.id, undefined, message.error || \"Nested tool call failed\");\n\t}\n}\n\n/** @param {import(\"./protocol.js\").ChildInitMessage} message */\nasync function start(message) {\n\tif (initialized) throw new Error(\"run_code child received more than one init message\");\n\tinitialized = true;\n\tpersistent = message.mode === \"persistent\";\n\tconst context = vm.createContext(Object.create(null), {\n\t\tname: \"pi-run-code\",\n\t\tcodeGeneration: { strings: false, wasm: false },\n\t});\n\tinstallGlobals(context, message.tools);\n\truntimeContext = context;\n\tif (persistent) {\n\t\tconst output = new PassThrough();\n\t\toutput.resume();\n\t\tconst replOptions = {\n\t\t\tinput: new PassThrough(), output, terminal: false, prompt: \"\", useGlobal: false,\n\t\t\t// Node 26 replaced REPL domains with an explicit error handler.\n\t\t\thandleError: (/** @type {unknown} */ error) => { rejectEvaluation?.(error); return \"ignore\"; },\n\t\t};\n\t\treplServer = repl.start(replOptions);\n\t\t// Keep Node's native top-level-await/declaration handling, but replace its\n\t\t// default context (which exposes require/process) with our restricted realm.\n\t\tObject.defineProperty(replServer, \"context\", { value: context });\n\t\t// Node sends runtime exceptions through this domain instead of eval's callback.\n\t\t/** @type {any} */ (replServer)._domain?.on(\"error\", (/** @type {unknown} */ error) => rejectEvaluation?.(error));\n\t}\n\tawait evaluate(message);\n}\n\n/** @param {import(\"./protocol.js\").ChildInitMessage | import(\"./protocol.js\").ChildEvalMessage} message */\nasync function evaluate(message) {\n\tif (!runtimeContext) throw new Error(\"Code runtime has not been initialized\");\n\tconst context = runtimeContext;\n\tif (message.type === \"eval\" && (!persistent || !finished)) throw new Error(\"Concurrent code cells are not supported\");\n\tfinished = false;\n\tif (replServer) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\trejectEvaluation = reject;\n\t\t\treplServer?.eval(message.code + \"\\n\", context, \"exec-cell.js\", (error, value) => error ? reject(error) : resolve(value));\n\t\t});\n\t\trejectEvaluation = undefined;\n\t} else {\n\t\tconst wrapped = `\"use strict\"; (async () => {\\n${message.code}\\n})()`;\n\t\tconst script = new vm.Script(wrapped, { filename: \"run_code.js\" });\n\t\tawait script.runInContext(runtimeContext, { timeout: message.syncTimeoutMs });\n\t}\n\n\tif (finished) return;\n\tfinished = true;\n\tclearHostTimers();\n\tif (typeof takeOutput !== \"function\") {\n\t\tthrow new Error(\"run_code output bridge is unavailable\");\n\t}\n\tconst output = takeOutput();\n\tsend({ type: \"done\", content: JSON.parse(output) });\n\tif (!persistent) {\n\t\tinput.close();\n\t\tprocess.stdin.unref();\n\t}\n}\n\ninput.on(\"line\", (line) => {\n\t/** @type {ParentMessage} */\n\tlet message;\n\ttry {\n\t\tmessage = JSON.parse(line);\n\t} catch (error) {\n\t\tfail(new Error(`Invalid parent message: ${error instanceof Error ? error.message : String(error)}`));\n\t\treturn;\n\t}\n\tif (message.type === \"init\") {\n\t\tvoid start(message).catch(fail);\n\t\treturn;\n\t}\n\tif (message.type === \"eval\") {\n\t\tvoid evaluate(message).catch(fail);\n\t\treturn;\n\t}\n\tif (message.type === \"tool_result\" || message.type === \"tool_error\") {\n\t\thandleToolResponse(message);\n\t}\n});\n\ninput.on(\"close\", () => {\n\tif (!finished) fail(new Error(\"run_code parent disconnected\"));\n\tclearHostTimers();\n\treplServer?.close();\n\tprocess.stdin.unref();\n});\n"],
|
|
5
|
-
"mappings": ";AAUA,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,SAAS,mBAAmB;AAC5B,OAAO,QAAQ;AAQf,IAAM,QAAQ,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC;AACpF,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,aAAa;AAEjB,IAAI;AAEJ,IAAI;AAEJ,IAAI;AACJ,IAAI,aAAa;AACjB,IAAI,cAAc;AAElB,IAAM,aAAa,oBAAI,IAAI;AAE3B,IAAI;AAEJ,IAAI;AAEJ,IAAI;AAGJ,SAAS,KAAK,SAAS;AACtB,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,OAAO,CAAC;AAAA,CAAI;AACpD;AAEA,SAAS,iBAAiB;AACzB,MAAI,CAAC,SAAU,MAAK,EAAE,MAAM,eAAe,QAAQ,WAAW,KAAK,CAAC;AACrE;AAEA,SAAS,kBAAkB;AAC1B,aAAW,SAAS,WAAW,OAAO,EAAG,cAAa,KAAK;AAC3D,aAAW,MAAM;AAClB;AAGA,SAAS,KAAK,OAAO;AACpB,MAAI,SAAU;AACd,aAAW;AACX,kBAAgB;
|
|
4
|
+
"sourcesContent": ["// @ts-check\n\n/**\n * Short-lived JavaScript runtime used by run_code.\n *\n * This file is both directly executable from the source tree and compiled as a\n * separate package entrypoint. Model-authored code runs in a vm context without\n * Node globals. Nested tool calls are forwarded to the parent over JSON lines.\n */\n\nimport readline from \"node:readline\";\nimport repl from \"node:repl\";\nimport { PassThrough } from \"node:stream\";\nimport vm from \"node:vm\";\n\n/** @typedef {import(\"./protocol.js\").ChildDoneMessage} ChildDoneMessage */\n/** @typedef {import(\"./protocol.js\").ChildMessage} ChildMessage */\n/** @typedef {import(\"./protocol.js\").ChildToolCallMessage} ChildToolCallMessage */\n/** @typedef {import(\"./protocol.js\").NestedToolMetadata} NestedToolMetadata */\n/** @typedef {import(\"./protocol.js\").ParentMessage} ParentMessage */\n\nconst input = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });\nlet initialized = false;\nlet finished = false;\nlet persistent = false;\n/** @type {vm.Context | undefined} */\nlet runtimeContext;\n/** @type {repl.REPLServer | undefined} */\nlet replServer;\n/** @type {((error: unknown) => void) | undefined} */\nlet rejectEvaluation;\nlet nextCallId = 1;\nlet nextTimerId = 1;\n/** @type {Map<string, ReturnType<typeof setTimeout>>} */\nconst hostTimers = new Map();\n/** @type {((id: string, value: string | undefined, error: string | undefined) => void) | undefined} */\nlet settleToolCall;\n/** @type {(() => string) | undefined} */\nlet takeOutput;\n/** @type {((id: string) => unknown) | undefined} */\nlet fireTimer;\n\n/** @param {ChildMessage} message */\nfunction send(message) {\n\tprocess.stdout.write(`${JSON.stringify(message)}\\n`);\n}\n\nfunction sendTimerState() {\n\tif (!finished) send({ type: \"timer_state\", active: hostTimers.size });\n}\n\nfunction clearHostTimers() {\n\tfor (const timer of hostTimers.values()) clearTimeout(timer);\n\thostTimers.clear();\n}\n\n/** @param {unknown} error */\nfunction fail(error) {\n\tif (finished) return;\n\tfinished = true;\n\tclearHostTimers();\n\t// REPL wraps incomplete input in Recoverable with an empty message. Preserve\n\t// its underlying syntax error so the caller can repair the failed cell.\n\tconst cause = error instanceof repl.Recoverable ? error.err : error;\n\tconst message = cause instanceof Error ? cause.message || cause.name : String(cause);\n\tsend({ type: \"done\", error: message });\n\ttakeOutput?.(); // Discard output and pending callbacks from the failed cell.\n\tif (!persistent) {\n\t\tinput.close();\n\t\tprocess.stdin.unref();\n\t}\n}\n\nfunction createBridge() {\n\t/**\n\t * @param {\"register\" | \"call\" | \"set_timer\" | \"clear_timer\"} operation\n\t * @param {string | ((id: string, value: string | undefined, error: string | undefined) => void)} first\n\t * @param {(() => string) | undefined} [second]\n\t * @param {((id: string) => unknown) | undefined} [third]\n\t */\n\tconst bridge = (operation, first, second, third) => {\n\t\tif (operation === \"register\") {\n\t\t\tif (\n\t\t\t\tsettleToolCall\n\t\t\t\t\t|| takeOutput\n\t\t\t\t\t|| fireTimer\n\t\t\t\t\t|| typeof first !== \"function\"\n\t\t\t\t\t|| typeof second !== \"function\"\n\t\t\t\t\t|| typeof third !== \"function\"\n\t\t\t) {\n\t\t\t\tthrow new Error(\"run_code bridge registration failed\");\n\t\t\t}\n\t\t\tsettleToolCall = first;\n\t\t\ttakeOutput = second;\n\t\t\tfireTimer = third;\n\t\t\treturn undefined;\n\t\t}\n\t\tif (typeof first !== \"string\") {\n\t\t\tthrow new TypeError(\"run_code bridge expects serialized input\");\n\t\t}\n\t\tif (operation === \"set_timer\") {\n\t\t\t/** @type {{ delay?: unknown }} */\n\t\t\tconst request = JSON.parse(first);\n\t\t\tconst delay = Number(request.delay ?? 0);\n\t\t\tif (!Number.isFinite(delay) || delay < 0 || delay > 600_000) {\n\t\t\t\tthrow new RangeError(\"setTimeout delay must be between 0 and 600000 ms\");\n\t\t\t}\n\t\t\tconst id = `timer-${String(nextTimerId++)}`;\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\thostTimers.delete(id);\n\t\t\t\tsendTimerState();\n\t\t\t\tif (finished || typeof fireTimer !== \"function\") return;\n\t\t\t\ttry {\n\t\t\t\t\tconst result = fireTimer(id);\n\t\t\t\t\tif (result && typeof /** @type {any} */ (result).then === \"function\") {\n\t\t\t\t\t\tvoid Promise.resolve(result).catch(fail);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfail(error);\n\t\t\t\t}\n\t\t\t}, Math.floor(delay));\n\t\t\ttimer.unref();\n\t\t\thostTimers.set(id, timer);\n\t\t\tsendTimerState();\n\t\t\treturn id;\n\t\t}\n\t\tif (operation === \"clear_timer\") {\n\t\t\tconst timer = hostTimers.get(first);\n\t\t\tif (timer) clearTimeout(timer);\n\t\t\thostTimers.delete(first);\n\t\t\tsendTimerState();\n\t\t\treturn undefined;\n\t\t}\n\t\tif (operation !== \"call\") throw new Error(`Unknown run_code bridge operation: ${operation}`);\n\t\t/** @type {{ name: string; args?: unknown }} */\n\t\tconst request = JSON.parse(first);\n\t\tconst id = String(nextCallId++);\n\t\tsend({ type: \"tool_call\", id, name: request.name, args: request.args });\n\t\treturn id;\n\t};\n\tObject.setPrototypeOf(bridge, null);\n\treturn bridge;\n}\n\n/**\n * This function is stringified and evaluated inside the model's vm context so\n * all user-facing functions belong to that realm, not the Node host realm.\n */\nfunction bootstrapGlobals() {\n\tconst runtimeGlobal = /** @type {any} */ (globalThis);\n\t/** @type {(operation: \"register\" | \"call\" | \"set_timer\" | \"clear_timer\", first: string | ((id: string, value: string | undefined, error: string | undefined) => void), second?: () => string, third?: (id: string) => unknown) => string | undefined} */\n\tconst bridge = runtimeGlobal.__runCodeBridge;\n\tconst parse = JSON.parse.bind(JSON);\n\tconst stringify = JSON.stringify.bind(JSON);\n\t/** @type {NestedToolMetadata[]} */\n\tconst metadata = parse(runtimeGlobal.__runCodeMetadata);\n\t/** @type {Array<{ type: \"text\"; text: string } | { type: \"image\"; data: string; mimeType: string }>} */\n\tconst emitted = [];\n\t/** @type {Map<string, { resolve: (value: unknown) => void; reject: (reason?: unknown) => void }>} */\n\tconst pending = new Map();\n\t/** @type {Map<string, { callback: (...args: unknown[]) => unknown; args: unknown[] }>} */\n\tconst timerCallbacks = new Map();\n\n\t/**\n\t * @param {string} id\n\t * @param {string | undefined} value\n\t * @param {string | undefined} error\n\t */\n\tconst settle = (id, value, error) => {\n\t\tconst entry = pending.get(id);\n\t\tif (!entry) return;\n\t\tpending.delete(id);\n\t\tif (error !== undefined) entry.reject(new Error(error));\n\t\telse entry.resolve(value === undefined ? undefined : parse(value));\n\t};\n\tconst output = () => {\n\t\tconst result = stringify(emitted);\n\t\temitted.length = 0;\n\t\tpending.clear();\n\t\ttimerCallbacks.clear();\n\t\treturn result;\n\t};\n\t/** @param {string} id */\n\tconst fireTimerCallback = (id) => {\n\t\tconst entry = timerCallbacks.get(id);\n\t\tif (!entry) return undefined;\n\t\ttimerCallbacks.delete(id);\n\t\treturn entry.callback(...entry.args);\n\t};\n\tbridge(\"register\", settle, output, fireTimerCallback);\n\n\tconst tools = Object.create(null);\n\tfor (const item of metadata) {\n\t\tObject.defineProperty(tools, item.name, {\n\t\t\tenumerable: true,\n\t\t\tvalue: (/** @type {unknown} */ args) => new Promise((resolve, reject) => {\n\t\t\t\tlet request;\n\t\t\t\ttry {\n\t\t\t\t\trequest = stringify({ name: item.name, args });\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst id = bridge(\"call\", request);\n\t\t\t\tif (typeof id !== \"string\") {\n\t\t\t\t\treject(new Error(\"run_code bridge did not return a tool call id\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpending.set(id, { resolve, reject });\n\t\t\t}),\n\t\t});\n\t}\n\tObject.freeze(tools);\n\n\t/** @param {unknown} value */\n\tconst printable = (value) => {\n\t\tif (typeof value === \"string\") return value;\n\t\tif (value === undefined) return \"undefined\";\n\t\ttry {\n\t\t\tconst encoded = stringify(value);\n\t\t\treturn encoded === undefined ? String(value) : encoded;\n\t\t} catch {\n\t\t\treturn String(value);\n\t\t}\n\t};\n\t/** @param {unknown} value */\n\tconst text = (value) => emitted.push({ type: \"text\", text: printable(value) });\n\t/** @param {unknown} value */\n\tconst image = (value) => {\n\t\tif (!value || typeof value !== \"object\") {\n\t\t\tthrow new TypeError(\"image() expects an image content block or nested tool result\");\n\t\t}\n\t\tconst item = /** @type {Record<string, unknown>} */ (value);\n\t\tconst candidates = Array.isArray(item.content) ? item.content : [item];\n\t\tlet count = 0;\n\t\tfor (const candidate of candidates) {\n\t\t\tif (!candidate || typeof candidate !== \"object\") continue;\n\t\t\tconst content = /** @type {Record<string, unknown>} */ (candidate);\n\t\t\tif (\n\t\t\t\t(content.type === undefined || content.type === \"image\")\n\t\t\t\t\t&& typeof content.data === \"string\"\n\t\t\t\t\t&& typeof content.mimeType === \"string\"\n\t\t\t) {\n\t\t\t\temitted.push({ type: \"image\", data: content.data, mimeType: content.mimeType });\n\t\t\t\tcount += 1;\n\t\t\t}\n\t\t}\n\t\tif (!count) throw new TypeError(\"image() input does not contain an image block\");\n\t};\n\t/**\n\t * @param {(...args: unknown[]) => unknown} callback\n\t * @param {unknown} [delay]\n\t * @param {...unknown} args\n\t */\n\tconst scheduleTimeout = (callback, delay = 0, ...args) => {\n\t\tif (typeof callback !== \"function\") throw new TypeError(\"setTimeout callback must be a function\");\n\t\tconst numericDelay = Number(delay);\n\t\tif (!Number.isFinite(numericDelay) || numericDelay < 0 || numericDelay > 600_000) {\n\t\t\tthrow new RangeError(\"setTimeout delay must be between 0 and 600000 ms\");\n\t\t}\n\t\tconst id = bridge(\"set_timer\", stringify({ delay: Math.floor(numericDelay) }));\n\t\tif (typeof id !== \"string\") throw new Error(\"run_code bridge did not return a timer id\");\n\t\ttimerCallbacks.set(id, { callback, args });\n\t\treturn id;\n\t};\n\t/** @param {unknown} handle */\n\tconst cancelTimeout = (handle) => {\n\t\tif (typeof handle !== \"string\") return;\n\t\ttimerCallbacks.delete(handle);\n\t\tbridge(\"clear_timer\", handle);\n\t};\n\n\tObject.defineProperties(runtimeGlobal, {\n\t\ttools: { value: tools, enumerable: true },\n\t\tALL_TOOLS: {\n\t\t\tvalue: Object.freeze(metadata.map((item) => Object.freeze({ ...item }))),\n\t\t\tenumerable: true,\n\t\t},\n\t\ttext: { value: text, enumerable: true },\n\t\timage: { value: image, enumerable: true },\n\t\tsetTimeout: { value: scheduleTimeout, enumerable: true },\n\t\tclearTimeout: { value: cancelTimeout, enumerable: true },\n\t\tconsole: { value: undefined },\n\t});\n\tdelete runtimeGlobal.__runCodeBridge;\n\tdelete runtimeGlobal.__runCodeMetadata;\n}\n\n/**\n * @param {vm.Context} context\n * @param {NestedToolMetadata[]} metadata\n */\nfunction installGlobals(context, metadata) {\n\tcontext.__runCodeBridge = createBridge();\n\tcontext.__runCodeMetadata = JSON.stringify(metadata);\n\tconst bootstrap = new vm.Script(`(${bootstrapGlobals.toString()})()`);\n\tbootstrap.runInContext(context);\n\tif (typeof settleToolCall !== \"function\" || typeof takeOutput !== \"function\") {\n\t\tthrow new Error(\"run_code failed to initialize its tool bridge\");\n\t}\n}\n\n/** @param {import(\"./protocol.js\").ChildToolResultMessage | import(\"./protocol.js\").ChildToolErrorMessage} message */\nfunction handleToolResponse(message) {\n\tif (typeof settleToolCall !== \"function\") return;\n\tif (message.type === \"tool_result\") {\n\t\tconst value = message.value === undefined ? undefined : JSON.stringify(message.value);\n\t\tsettleToolCall(message.id, value, undefined);\n\t} else {\n\t\tsettleToolCall(message.id, undefined, message.error || \"Nested tool call failed\");\n\t}\n}\n\n/** @param {import(\"./protocol.js\").ChildInitMessage} message */\nasync function start(message) {\n\tif (initialized) throw new Error(\"run_code child received more than one init message\");\n\tinitialized = true;\n\tpersistent = message.mode === \"persistent\";\n\tconst context = vm.createContext(Object.create(null), {\n\t\tname: \"pi-run-code\",\n\t\tcodeGeneration: { strings: false, wasm: false },\n\t});\n\tinstallGlobals(context, message.tools);\n\truntimeContext = context;\n\tif (persistent) {\n\t\tconst output = new PassThrough();\n\t\toutput.resume();\n\t\tconst replOptions = {\n\t\t\tinput: new PassThrough(), output, terminal: false, prompt: \"\", useGlobal: false,\n\t\t\t// Node 26 replaced REPL domains with an explicit error handler.\n\t\t\thandleError: (/** @type {unknown} */ error) => { rejectEvaluation?.(error); return \"ignore\"; },\n\t\t};\n\t\treplServer = repl.start(replOptions);\n\t\t// Keep Node's native top-level-await/declaration handling, but replace its\n\t\t// default context (which exposes require/process) with our restricted realm.\n\t\tObject.defineProperty(replServer, \"context\", { value: context });\n\t\t// Node sends runtime exceptions through this domain instead of eval's callback.\n\t\t/** @type {any} */ (replServer)._domain?.on(\"error\", (/** @type {unknown} */ error) => rejectEvaluation?.(error));\n\t}\n\tawait evaluate(message);\n}\n\n/** @param {import(\"./protocol.js\").ChildInitMessage | import(\"./protocol.js\").ChildEvalMessage} message */\nasync function evaluate(message) {\n\tif (!runtimeContext) throw new Error(\"Code runtime has not been initialized\");\n\tconst context = runtimeContext;\n\tif (message.type === \"eval\" && (!persistent || !finished)) throw new Error(\"Concurrent code cells are not supported\");\n\tfinished = false;\n\tif (replServer) {\n\t\tawait new Promise((resolve, reject) => {\n\t\t\trejectEvaluation = reject;\n\t\t\treplServer?.eval(message.code + \"\\n\", context, \"exec-cell.js\", (error, value) => error ? reject(error) : resolve(value));\n\t\t});\n\t\trejectEvaluation = undefined;\n\t} else {\n\t\tconst wrapped = `\"use strict\"; (async () => {\\n${message.code}\\n})()`;\n\t\tconst script = new vm.Script(wrapped, { filename: \"run_code.js\" });\n\t\tawait script.runInContext(runtimeContext, { timeout: message.syncTimeoutMs });\n\t}\n\n\tif (finished) return;\n\tfinished = true;\n\tclearHostTimers();\n\tif (typeof takeOutput !== \"function\") {\n\t\tthrow new Error(\"run_code output bridge is unavailable\");\n\t}\n\tconst output = takeOutput();\n\tsend({ type: \"done\", content: JSON.parse(output) });\n\tif (!persistent) {\n\t\tinput.close();\n\t\tprocess.stdin.unref();\n\t}\n}\n\ninput.on(\"line\", (line) => {\n\t/** @type {ParentMessage} */\n\tlet message;\n\ttry {\n\t\tmessage = JSON.parse(line);\n\t} catch (error) {\n\t\tfail(new Error(`Invalid parent message: ${error instanceof Error ? error.message : String(error)}`));\n\t\treturn;\n\t}\n\tif (message.type === \"init\") {\n\t\tvoid start(message).catch(fail);\n\t\treturn;\n\t}\n\tif (message.type === \"eval\") {\n\t\tvoid evaluate(message).catch(fail);\n\t\treturn;\n\t}\n\tif (message.type === \"tool_result\" || message.type === \"tool_error\") {\n\t\thandleToolResponse(message);\n\t}\n});\n\ninput.on(\"close\", () => {\n\tif (!finished) fail(new Error(\"run_code parent disconnected\"));\n\tclearHostTimers();\n\treplServer?.close();\n\tprocess.stdin.unref();\n});\n"],
|
|
5
|
+
"mappings": ";AAUA,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,SAAS,mBAAmB;AAC5B,OAAO,QAAQ;AAQf,IAAM,QAAQ,SAAS,gBAAgB,EAAE,OAAO,QAAQ,OAAO,WAAW,SAAS,CAAC;AACpF,IAAI,cAAc;AAClB,IAAI,WAAW;AACf,IAAI,aAAa;AAEjB,IAAI;AAEJ,IAAI;AAEJ,IAAI;AACJ,IAAI,aAAa;AACjB,IAAI,cAAc;AAElB,IAAM,aAAa,oBAAI,IAAI;AAE3B,IAAI;AAEJ,IAAI;AAEJ,IAAI;AAGJ,SAAS,KAAK,SAAS;AACtB,UAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,OAAO,CAAC;AAAA,CAAI;AACpD;AAEA,SAAS,iBAAiB;AACzB,MAAI,CAAC,SAAU,MAAK,EAAE,MAAM,eAAe,QAAQ,WAAW,KAAK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