@qwen-code/qwen-harness 0.1.11 → 0.1.12
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 +77 -3
- package/dist/child-runtime.js +10 -1
- package/dist/child-runtime.js.map +2 -2
- package/dist/entrypoint.js +9357 -3793
- package/dist/entrypoint.js.map +4 -4
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -63,6 +63,15 @@ times, and each of the 135 cross-component pairs appears twice. These are the fi
|
|
|
63
63
|
evaluation batch: evaluate all 18, identify weak configurations, add targeted SFT/RL,
|
|
64
64
|
and reevaluate. The full six-axis space contains 729 configurations.
|
|
65
65
|
|
|
66
|
+
All 18 presets use the complete S v2 policies: S1 is a concise maintainer with
|
|
67
|
+
dense rules, S2 an implementation partner with conditional workflow stages, and
|
|
68
|
+
S3 a contract-oriented engineer with layered constraints. Each policy covers the
|
|
69
|
+
same core responsibilities while differing in clarification, regression tests,
|
|
70
|
+
comments, and delivery defaults. Runtime context supplies the actual workspace,
|
|
71
|
+
platform, command shell, date, and interaction mode. Print/JSON runs and delegated
|
|
72
|
+
children are non-interactive; the bound host determines dialog support.
|
|
73
|
+
The TS/TC/O/C/W composition and tool interfaces remain independent of S.
|
|
74
|
+
|
|
66
75
|
```bash
|
|
67
76
|
# Show the 18 configurations without calling a model.
|
|
68
77
|
npm run dev -- --harness scaling --scaling-list
|
|
@@ -90,7 +99,7 @@ reports the component parameters for output handling and context management.
|
|
|
90
99
|
| Component | Design 1 | Design 2 | Design 3 | Mechanism reference |
|
|
91
100
|
| --- | --- | --- | --- | --- |
|
|
92
101
|
| 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 |
|
|
93
|
-
| TS: task tools |
|
|
102
|
+
| TS: task tools | 70 standard snake_case tools | Baseline 20 with fixed new names | The same 70 with fixed new names | Existing capabilities, Pi MCP, and Harness Corpus tool contracts |
|
|
94
103
|
| TC: invocation | Direct tools | `run_code`, fresh JavaScript scope per call | `exec`, persistent JavaScript variables and functions | Pi's native codemode; [Fibona](https://github.com/FibonaAI/fibona-agent) native REPL pattern |
|
|
95
104
|
| O: observations | Direct text within the feedback limit | Fixed head/tail preview, no saved-output path | Same preview plus a complete output file, read through the selected task tools | Qwen Code / OpenCode / Pi / Kimi Code saved-output paths |
|
|
96
105
|
| C: context | Host-generated summary at pressure threshold | Model-authored Notes and explicit window handoff | Segment summaries, older summary rollups, and source index | Pi compaction; local Qwen Code Notes; [Headlong](https://github.com/laude-institute/headlong) tiered recap |
|
|
@@ -103,6 +112,71 @@ callable-only and expose one entry point. Every nested call goes through Pi's
|
|
|
103
112
|
and usage records. Pi's registration allowlist includes both visible and callable
|
|
104
113
|
tools; the active loadout controls visibility.
|
|
105
114
|
|
|
115
|
+
The baseline 20 are `read_file`, `apply_patch`, `list_directory`, `glob`, `grep`,
|
|
116
|
+
`bash`, `list_processes`, `read_process_output`, `write_stdin`, `stop_process`,
|
|
117
|
+
`web_search`, `http_request`, `skill`, `notebook_edit`, `memory_search`,
|
|
118
|
+
`memory_write`, `enter_worktree`, `exit_worktree`, `list_mcp_resources`, and
|
|
119
|
+
`read_mcp_resource`. The additional 50 cover LSP and batch edits, scheduling and
|
|
120
|
+
monitoring, skills, media, workflows, goals, tasks, MCP, session archives,
|
|
121
|
+
communications, artifacts, plugins, connections, intents, secrets, and local portals.
|
|
122
|
+
There are no browser tools. C/W tools and TC entry points are counted separately.
|
|
123
|
+
|
|
124
|
+
Each tool lives in `src/capabilities/tools/<category>/`; shared state and clients
|
|
125
|
+
live in `src/utils/`. The two capability builders assemble 20 or 70 definitions;
|
|
126
|
+
scaling adds policy guards and then applies the versioned name mapping. TS2 and TS3
|
|
127
|
+
share the same aliases for the baseline 20. Aliases use synonymous functional names,
|
|
128
|
+
such as `read_file` → `inspect_file`, `bash` → `run_shell`, and
|
|
129
|
+
`http_request` → `request_url`. Schemas and execution remain the same. TC programs can call
|
|
130
|
+
every exact name with `tools["name"](args)`. The JavaScript bridges also support
|
|
131
|
+
normalized identifier aliases; Pi's native QuickJS tool catalog lists those identifiers.
|
|
132
|
+
|
|
133
|
+
Optional services are supplied with `--scaling-tool-config ./tool-services.json`:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"mcpServers": {
|
|
138
|
+
"project": { "command": "node", "args": ["./mcp-server.js"] },
|
|
139
|
+
"remote": {
|
|
140
|
+
"url": "https://example.com/mcp",
|
|
141
|
+
"headers": { "Authorization": "Bearer ${MCP_TOKEN}" }
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"skillPaths": ["./skills"],
|
|
145
|
+
"lspServers": {
|
|
146
|
+
"typescript": {
|
|
147
|
+
"command": "typescript-language-server",
|
|
148
|
+
"args": ["--stdio"],
|
|
149
|
+
"extensions": [".ts", ".tsx"],
|
|
150
|
+
"language_id": "typescript"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"sessionDirectory": "/path/to/authorized/session-archives"
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Commands and paths are resolved from the project working directory. Environment
|
|
158
|
+
references in MCP headers/environment, LSP environment, and gateway tokens expand
|
|
159
|
+
as `${NAME}`; missing values are errors. Configuration never evaluates shell
|
|
160
|
+
substitutions. `gateway` accepts an OpenClaw `url`, `token`, and `session_key` for
|
|
161
|
+
the external conversation tools. `transcriptProviders` maps names to stdout capture
|
|
162
|
+
commands. Media generation and search reuse the existing capability provider settings.
|
|
163
|
+
Missing external providers return a configuration error when their tools are called.
|
|
164
|
+
Interactive secret entry and clarification require Pi's UI; headless calls report
|
|
165
|
+
their unavailability. Secret references can be used in HTTP/MCP headers, MCP
|
|
166
|
+
environment, and gateway tokens; children can resolve inherited references without
|
|
167
|
+
copying plaintext into tool results.
|
|
168
|
+
|
|
169
|
+
State defaults to `scaling-tools/<exact-session-id>/` under Pi's session directory.
|
|
170
|
+
`stateRoot` can change the parent directory. Memory, task records, schedules, goals,
|
|
171
|
+
and configured connections survive resume; runtime processes and handles are stopped
|
|
172
|
+
on shutdown. Interrupted execution records are marked cancelled on restart; missed
|
|
173
|
+
wakeups are recorded rather than replayed. Timers and monitors run only while the
|
|
174
|
+
hosting session is alive. Resuming requires the same six-axis configuration, limits,
|
|
175
|
+
tool catalog, naming version, and state root. Sessions from the former TS design
|
|
176
|
+
require a new run. Background notifications pass through the selected O policy;
|
|
177
|
+
workflow tools use the same guarded execution path. Explicit goal budgets use the
|
|
178
|
+
shared parent/child/summary accounting; no goal budget is added automatically.
|
|
179
|
+
|
|
106
180
|
The concrete adaptations are:
|
|
107
181
|
|
|
108
182
|
- **S:** all three designs share the same identity, workspace description, and selected
|
|
@@ -195,8 +269,8 @@ file before applying the preview budget. The 64,000-character feedback ceiling d
|
|
|
195
269
|
truncate that file. Large native spools are copied in full and previewed with bounded reads;
|
|
196
270
|
program output is also preserved before the requested display limit is applied.
|
|
197
271
|
|
|
198
|
-
O3 returns the file path and a reading hint:
|
|
199
|
-
`grep
|
|
272
|
+
O3 returns the file path and a reading hint: use `read_file` with line offset/limit or
|
|
273
|
+
`grep`, or use `bash` to select byte ranges. TS2/TS3 hints use the mapped names. A long single-line result
|
|
200
274
|
needs a byte-range read or a query of the saved data. These are the existing task tools,
|
|
201
275
|
reached directly in TC1 or through `run_code`/`exec` in TC2/TC3. Every retrieval still
|
|
202
276
|
passes through O at the model delivery boundary and is included in usage accounting. Output files live under
|
package/dist/child-runtime.js
CHANGED
|
@@ -148,6 +148,10 @@ function bootstrapGlobals() {
|
|
|
148
148
|
pending.set(id, { resolve, reject });
|
|
149
149
|
})
|
|
150
150
|
});
|
|
151
|
+
let identifier = item.name.replace(/[^A-Za-z0-9_$]/gu, "_");
|
|
152
|
+
if (!/^[A-Za-z_$]/u.test(identifier)) identifier = `_${identifier}`;
|
|
153
|
+
if (identifier !== item.name)
|
|
154
|
+
Object.defineProperty(tools, identifier, { enumerable: false, value: tools[item.name] });
|
|
151
155
|
}
|
|
152
156
|
Object.freeze(tools);
|
|
153
157
|
const printable = (value) => {
|
|
@@ -272,7 +276,12 @@ async function evaluate(message) {
|
|
|
272
276
|
if (replServer) {
|
|
273
277
|
await new Promise((resolve, reject) => {
|
|
274
278
|
rejectEvaluation = reject;
|
|
275
|
-
replServer?.eval(
|
|
279
|
+
replServer?.eval(
|
|
280
|
+
message.code + "\n",
|
|
281
|
+
context,
|
|
282
|
+
"exec-cell.js",
|
|
283
|
+
(error, value) => error ? reject(error) : resolve(value)
|
|
284
|
+
);
|
|
276
285
|
});
|
|
277
286
|
rejectEvaluation = void 0;
|
|
278
287
|
} else {
|
|
@@ -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;AAChB,QAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,OAAK,EAAE,MAAM,QAAQ,OAAO,QAAQ,CAAC;AACrC,eAAa;AACb,MAAI,CAAC,YAAY;AAChB,UAAM,MAAM;AACZ,YAAQ,MAAM,MAAM;AAAA,EACrB;AACD;AAEA,SAAS,eAAe;AAOvB,QAAM,SAAS,CAAC,WAAW,OAAO,QAAQ,UAAU;AACnD,QAAI,cAAc,YAAY;AAC7B,UACC,
|
|
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\ttakeOutput ||\n\t\t\t\tfireTimer ||\n\t\t\t\ttypeof first !== \"function\" ||\n\t\t\t\ttypeof second !== \"function\" ||\n\t\t\t\ttypeof 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) =>\n\t\t\t\tnew Promise((resolve, reject) => {\n\t\t\t\t\tlet request;\n\t\t\t\t\ttry {\n\t\t\t\t\t\trequest = stringify({ name: item.name, args });\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst id = bridge(\"call\", request);\n\t\t\t\t\tif (typeof id !== \"string\") {\n\t\t\t\t\t\treject(new Error(\"run_code bridge did not return a tool call id\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tpending.set(id, { resolve, reject });\n\t\t\t\t}),\n\t\t});\n\t\t// Exact provider names remain callable with tools[\"name-with-hyphens\"].\n\t\t// Preserve the conventional JavaScript identifier alias for existing callers.\n\t\tlet identifier = item.name.replace(/[^A-Za-z0-9_$]/gu, \"_\");\n\t\tif (!/^[A-Za-z_$]/u.test(identifier)) identifier = `_${identifier}`;\n\t\tif (identifier !== item.name)\n\t\t\tObject.defineProperty(tools, identifier, { enumerable: false, value: tools[item.name] });\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\ttypeof content.data === \"string\" &&\n\t\t\t\ttypeof 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(),\n\t\t\toutput,\n\t\t\tterminal: false,\n\t\t\tprompt: \"\",\n\t\t\tuseGlobal: false,\n\t\t\t// Node 26 replaced REPL domains with an explicit error handler.\n\t\t\thandleError: (/** @type {unknown} */ error) => {\n\t\t\t\trejectEvaluation?.(error);\n\t\t\t\treturn \"ignore\";\n\t\t\t},\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) =>\n\t\t\t\terror ? reject(error) : resolve(value),\n\t\t\t);\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\tclearHostT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