@te-river/opencode-team-mode 1.5.11 → 1.5.13
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 +154 -57
- package/README.zh-CN.md +126 -47
- package/dist/agents.d.ts +5 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +37 -11
- package/dist/agents.js.map +1 -1
- package/dist/approval-gate.d.ts +54 -16
- package/dist/approval-gate.d.ts.map +1 -1
- package/dist/approval-gate.js +163 -42
- package/dist/approval-gate.js.map +1 -1
- package/dist/host-hooks.d.ts +115 -0
- package/dist/host-hooks.d.ts.map +1 -0
- package/dist/host-hooks.js +270 -0
- package/dist/host-hooks.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +68 -4
- package/dist/index.js.map +1 -1
- package/dist/prompts/lead.d.ts +1 -1
- package/dist/prompts/lead.d.ts.map +1 -1
- package/dist/prompts/lead.js +88 -6
- package/dist/prompts/lead.js.map +1 -1
- package/dist/prompts/shared.d.ts +1 -1
- package/dist/prompts/shared.d.ts.map +1 -1
- package/dist/prompts/shared.js +203 -119
- package/dist/prompts/shared.js.map +1 -1
- package/dist/prompts/specialists.d.ts +2 -2
- package/dist/prompts/specialists.d.ts.map +1 -1
- package/dist/prompts/specialists.js +73 -23
- package/dist/prompts/specialists.js.map +1 -1
- package/dist/tm/args-schema.d.ts +31 -1
- package/dist/tm/args-schema.d.ts.map +1 -1
- package/dist/tm/args-schema.js +155 -39
- package/dist/tm/args-schema.js.map +1 -1
- package/dist/tm/bash-timeout.d.ts +72 -0
- package/dist/tm/bash-timeout.d.ts.map +1 -0
- package/dist/tm/bash-timeout.js +100 -0
- package/dist/tm/bash-timeout.js.map +1 -0
- package/dist/tm/browser.d.ts +250 -20
- package/dist/tm/browser.d.ts.map +1 -1
- package/dist/tm/browser.js +1200 -143
- package/dist/tm/browser.js.map +1 -1
- package/dist/tm/config.d.ts +129 -0
- package/dist/tm/config.d.ts.map +1 -1
- package/dist/tm/config.js +117 -1
- package/dist/tm/config.js.map +1 -1
- package/dist/tm/dispatch.d.ts +95 -0
- package/dist/tm/dispatch.d.ts.map +1 -0
- package/dist/tm/dispatch.js +369 -0
- package/dist/tm/dispatch.js.map +1 -0
- package/dist/tm/index.d.ts +32 -7
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +74 -5
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/memory.d.ts +88 -10
- package/dist/tm/memory.d.ts.map +1 -1
- package/dist/tm/memory.js +881 -99
- package/dist/tm/memory.js.map +1 -1
- package/dist/tm/pipelines.d.ts +26 -3
- package/dist/tm/pipelines.d.ts.map +1 -1
- package/dist/tm/pipelines.js +167 -11
- package/dist/tm/pipelines.js.map +1 -1
- package/dist/tm/ptc/budgets.d.ts +22 -1
- package/dist/tm/ptc/budgets.d.ts.map +1 -1
- package/dist/tm/ptc/budgets.js +87 -8
- package/dist/tm/ptc/budgets.js.map +1 -1
- package/dist/tm/ptc/contract.d.ts +49 -9
- package/dist/tm/ptc/contract.d.ts.map +1 -1
- package/dist/tm/ptc/contract.js +41 -3
- package/dist/tm/ptc/contract.js.map +1 -1
- package/dist/tm/ptc/driver.d.ts +5 -2
- package/dist/tm/ptc/driver.d.ts.map +1 -1
- package/dist/tm/ptc/driver.js +47 -15
- package/dist/tm/ptc/driver.js.map +1 -1
- package/dist/tm/ptc/engines.d.ts +15 -4
- package/dist/tm/ptc/engines.d.ts.map +1 -1
- package/dist/tm/ptc/engines.js +281 -28
- package/dist/tm/ptc/engines.js.map +1 -1
- package/dist/tm/ptc/index.d.ts +4 -4
- package/dist/tm/ptc/index.d.ts.map +1 -1
- package/dist/tm/ptc/index.js +2 -2
- package/dist/tm/ptc/index.js.map +1 -1
- package/dist/tm/ptc/pscan.d.ts +20 -1
- package/dist/tm/ptc/pscan.d.ts.map +1 -1
- package/dist/tm/ptc/pscan.js +328 -14
- package/dist/tm/ptc/pscan.js.map +1 -1
- package/dist/tm/ptc/summary.d.ts.map +1 -1
- package/dist/tm/ptc/summary.js +23 -1
- package/dist/tm/ptc/summary.js.map +1 -1
- package/dist/tm/ptc/tool.d.ts +34 -3
- package/dist/tm/ptc/tool.d.ts.map +1 -1
- package/dist/tm/ptc/tool.js +117 -20
- package/dist/tm/ptc/tool.js.map +1 -1
- package/dist/tm/pty.d.ts +70 -0
- package/dist/tm/pty.d.ts.map +1 -0
- package/dist/tm/pty.js +242 -0
- package/dist/tm/pty.js.map +1 -0
- package/dist/tm/search.d.ts +128 -15
- package/dist/tm/search.d.ts.map +1 -1
- package/dist/tm/search.js +556 -47
- package/dist/tm/search.js.map +1 -1
- package/dist/tm/shell-bridge.d.ts +14 -1
- package/dist/tm/shell-bridge.d.ts.map +1 -1
- package/dist/tm/shell-bridge.js +57 -10
- package/dist/tm/shell-bridge.js.map +1 -1
- package/dist/tm/webfetch.d.ts +29 -7
- package/dist/tm/webfetch.d.ts.map +1 -1
- package/dist/tm/webfetch.js +117 -15
- package/dist/tm/webfetch.js.map +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -1
- package/docs/installation.md +216 -17
- package/package.json +5 -2
package/dist/tm/ptc/engines.js
CHANGED
|
@@ -7,18 +7,104 @@
|
|
|
7
7
|
* irrecoverably).
|
|
8
8
|
* M2 primary: WorkerEngine (worker_threads + MessagePort RPC, env:{},
|
|
9
9
|
* resourceLimits, hard `terminate()` wall-clock kill; bootstrap as a
|
|
10
|
-
* build-time string
|
|
11
|
-
*
|
|
10
|
+
* build-time string; the program body runs inside a node:vm sandbox —
|
|
11
|
+
* whitelist { tm, console, setTimeout, clearTimeout }, no node globals —
|
|
12
|
+
* with the run's timeoutMs as the in-engine script timeout).
|
|
13
|
+
* M2 fallback: InlineVmEngine (node:vm runInContext — the script timeout
|
|
12
14
|
* kills PRE-await synchronous busy-loops; a POST-await busy loop blocks the
|
|
13
15
|
* host event loop irrecoverably, documented — prefer worker/auto).
|
|
16
|
+
*
|
|
17
|
+
* C1 fix batch: BOTH vm engines now build their `tm` facade IN-CONTEXT via
|
|
18
|
+
* `vm.compileFunction` (parsingContext) and compile the context with
|
|
19
|
+
* `codeGeneration:{strings:false,wasm:false}`, so an injected facade's
|
|
20
|
+
* `.constructor` is the sandbox Function
|
|
21
|
+
* and `tm.read.constructor("return process")()` / `eval` / `new Function` THROW
|
|
22
|
+
* instead of escaping into the worker/plugin realm. A started worker that
|
|
23
|
+
* then crashes is reported as a program fault (never auto-replayed on the
|
|
24
|
+
* more-privileged inline realm) — see engines WorkerEngine error/exit handling.
|
|
14
25
|
*/
|
|
15
26
|
import * as vm from "node:vm";
|
|
16
|
-
import { PtcStopSignal } from "./contract.js";
|
|
27
|
+
import { PtcProgramError, PtcStopSignal } from "./contract.js";
|
|
28
|
+
const vmSandbox = vm;
|
|
17
29
|
/** Build the `tm` facade the program body sees (one method per bridge tool). */
|
|
18
30
|
function makeFacade(bridge) {
|
|
19
31
|
const one = (tool) => (args) => bridge.call(tool, args && typeof args === "object" ? args : {});
|
|
20
|
-
return {
|
|
32
|
+
return {
|
|
33
|
+
read: one("tm_read"),
|
|
34
|
+
grep: one("tm_grep"),
|
|
35
|
+
bash: one("tm_bash"),
|
|
36
|
+
fetch: one("tm_fetch"),
|
|
37
|
+
// T6 web bridges — always present so the program SHAPE is uniform; the
|
|
38
|
+
// bridge itself rejects the call with a clear error when the web bridge
|
|
39
|
+
// is off (TM_PTC_WEB_BRIDGE) or the caller's role denies the tool.
|
|
40
|
+
search: one("tm_search"),
|
|
41
|
+
webfetch: one("tm_webfetch"),
|
|
42
|
+
};
|
|
21
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* C1 (sandbox-escape) containment — the reason a facade is built with
|
|
46
|
+
* `vm.compileFunction` (parsingContext) instead of being injected as a host/worker-realm closure.
|
|
47
|
+
*
|
|
48
|
+
* A function injected into a `vm` context still belongs to the realm that
|
|
49
|
+
* CREATED it, so `tm.read.constructor` used to be the WORKER (or, worse, the
|
|
50
|
+
* plugin ESM) realm's `Function` — `tm.read.constructor("return process")()`
|
|
51
|
+
* escaped the sandbox outright. Compiling the facade INSIDE the context via
|
|
52
|
+
* `compileFunction`-with-parsingContext makes every injected function a SANDBOX-realm function whose
|
|
53
|
+
* `.constructor` is the sandbox `Function`; combined with
|
|
54
|
+
* `codeGeneration:{strings:false}` on the context that call throws
|
|
55
|
+
* ("Code generation from strings disallowed for this context"), and even
|
|
56
|
+
* without the throw the sandbox `Function` can only compile into the sandbox
|
|
57
|
+
* realm, where `process` / `require` do not exist.
|
|
58
|
+
*
|
|
59
|
+
* The two host callbacks the sandbox needs (`postCall` in the worker,
|
|
60
|
+
* `callBridge` inline) are passed as WRAPPER PARAMETERS, so they live in the
|
|
61
|
+
* closure — unreachable from the program (`Function.prototype.toString`
|
|
62
|
+
* shows only source, never the closed-over values). And every RPC result is
|
|
63
|
+
* JSON round-tripped IN the sandbox (`JSON.parse(JSON.stringify(raw))`) so a
|
|
64
|
+
* host/worker-realm object (whose `.constructor` would be a host Object →
|
|
65
|
+
* host Function) NEVER crosses into the program: rejected reasons are plain
|
|
66
|
+
* strings too. Dynamic `import("node:fs")` is unavailable in a `vm` context
|
|
67
|
+
* that supplies no `importModuleDynamically` callback, so it throws by default.
|
|
68
|
+
*/
|
|
69
|
+
/** The vm-wrap body (worker engine): builds { tm, console, setTimeout,
|
|
70
|
+
* clearTimeout } entirely in the sandbox realm from four host callbacks. */
|
|
71
|
+
const TM_SANDBOX_SRC = [
|
|
72
|
+
'"use strict";',
|
|
73
|
+
"function mk(tool) {",
|
|
74
|
+
" return function(args) {",
|
|
75
|
+
" return new Promise(function(resolve, reject) {",
|
|
76
|
+
// resolve normalizes the host/worker-realm result into a sandbox object.
|
|
77
|
+
" postCall(tool, args, function(raw) { resolve(JSON.parse(JSON.stringify(raw))); }, reject);",
|
|
78
|
+
" });",
|
|
79
|
+
" };",
|
|
80
|
+
"}",
|
|
81
|
+
'var tm = { read: mk("tm_read"), grep: mk("tm_grep"), bash: mk("tm_bash"), fetch: mk("tm_fetch"), search: mk("tm_search"), webfetch: mk("tm_webfetch") };',
|
|
82
|
+
"var console = { log: function() { return callLog(); }, error: function() { return callLog(); }, warn: function() { return callLog(); }, info: function() { return callLog(); }, debug: function() { return callLog(); }, trace: function() { return callLog(); } };",
|
|
83
|
+
// setTimeout/clearTimeout return a SANDBOX id and keep the worker timer
|
|
84
|
+
// handle in a closure so no worker object ever surfaces to the program.
|
|
85
|
+
"var __timers = {}; var __tid = 0;",
|
|
86
|
+
"var setTimeout = function(fn, ms) {",
|
|
87
|
+
" var id = ++__tid;",
|
|
88
|
+
" __timers[id] = callTimeout(function() { delete __timers[id]; try { fn(); } catch (e) { void e; } }, ms);",
|
|
89
|
+
" return id;",
|
|
90
|
+
"};",
|
|
91
|
+
"var clearTimeout = function(id) { var h = __timers[id]; if (h) { delete __timers[id]; callClearTimeout(h); } };",
|
|
92
|
+
"return { tm: tm, console: console, setTimeout: setTimeout, clearTimeout: clearTimeout };",
|
|
93
|
+
].join("\n");
|
|
94
|
+
/** The vm-wrap body (inline-vm engine): builds { tm } in the sandbox realm
|
|
95
|
+
* from one host `callBridge` callback (rejects hand back a string, never a
|
|
96
|
+
* host Error, so the program cannot climb `err.constructor`). */
|
|
97
|
+
const TM_INLINE_SRC = [
|
|
98
|
+
'"use strict";',
|
|
99
|
+
"function mk(tool) {",
|
|
100
|
+
" return function(args) {",
|
|
101
|
+
" return new Promise(function(resolve, reject) {",
|
|
102
|
+
" callBridge(tool, args, function(raw) { resolve(JSON.parse(JSON.stringify(raw))); }, function(msg) { reject(String(msg)); });",
|
|
103
|
+
" });",
|
|
104
|
+
" };",
|
|
105
|
+
"}",
|
|
106
|
+
'return { read: mk("tm_read"), grep: mk("tm_grep"), bash: mk("tm_bash"), fetch: mk("tm_fetch"), search: mk("tm_search"), webfetch: mk("tm_webfetch") };',
|
|
107
|
+
].join("\n");
|
|
22
108
|
export class InlineSequentialEngine {
|
|
23
109
|
name = "inline";
|
|
24
110
|
async run(program, bridge, signal) {
|
|
@@ -52,51 +138,104 @@ export class InlineSequentialEngine {
|
|
|
52
138
|
// ---------- worker engine (MessagePort RPC over worker_threads) --------------
|
|
53
139
|
export class WorkerEngine {
|
|
54
140
|
name = "worker";
|
|
55
|
-
async run(program, bridge, signal) {
|
|
141
|
+
async run(program, bridge, signal, opts) {
|
|
56
142
|
const { Worker } = await import("node:worker_threads");
|
|
57
143
|
// Build the worker bootstrap source as a regular string (ts-safe).
|
|
58
|
-
// The worker receives {program, startDeadlineMs} via its
|
|
59
|
-
// creates the tm facade, runs the program, and sends RPC
|
|
60
|
-
// back to the driver which executes them through the
|
|
144
|
+
// The worker receives {program, startDeadlineMs, timeoutMs} via its
|
|
145
|
+
// first message, creates the tm facade, runs the program, and sends RPC
|
|
146
|
+
// call requests back to the driver which executes them through the
|
|
147
|
+
// gate bridge.
|
|
148
|
+
//
|
|
149
|
+
// T2 (C1 security): the program body runs inside a node:vm context —
|
|
150
|
+
// a fresh realm with NO node globals. The C1 FIX closes the residual
|
|
151
|
+
// host-function leak the earlier comments conceded: the `tm` facade and
|
|
152
|
+
// the whitelisted intrinsics (console/setTimeout/clearTimeout) are now
|
|
153
|
+
// COMPILED INSIDE the context via `vm.compileFunction` + `parsingContext` (see TM_SANDBOX_SRC), so a
|
|
154
|
+
// facade function's `.constructor` is the sandbox Function, and the
|
|
155
|
+
// context carries `codeGeneration:{strings:false,wasm:false}` so
|
|
156
|
+
// `tm.read.constructor("return process")()` / `eval` / `new Function`
|
|
157
|
+
// all THROW instead of escaping into the worker realm. RPC results are
|
|
158
|
+
// JSON round-tripped in the sandbox and rejection reasons are strings,
|
|
159
|
+
// so no worker-realm object crosses the boundary. (node:vm is still a
|
|
160
|
+
// containment layer, not a hard boundary — staticPscan stays the first
|
|
161
|
+
// gate and terminate() the wall-clock kill — but the trivial
|
|
162
|
+
// `.constructor` escape that used to make the sandbox porous is gone.)
|
|
163
|
+
// The bootstrap itself keeps worker powers (it needs require for
|
|
164
|
+
// node:vm/worker_threads) — ONLY the program loses them.
|
|
61
165
|
const src = [
|
|
62
166
|
'"use strict";',
|
|
63
167
|
'const { parentPort } = require("node:worker_threads");',
|
|
168
|
+
'const vm = require("node:vm");',
|
|
64
169
|
"parentPort.on(" + JSON.stringify("message") + ", async function onMsg(msg) {",
|
|
65
170
|
" if (msg && msg.t === " + JSON.stringify("run") + ") {",
|
|
66
171
|
" const program = msg.program;",
|
|
67
|
-
" const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;",
|
|
68
172
|
" const callMap = new Map();",
|
|
69
173
|
" let nextId = 0;",
|
|
70
|
-
|
|
174
|
+
// The ONLY worker capability the sandbox reaches — passed to the wrapped
|
|
175
|
+
// facade as a closure parameter, so it is invisible to the program. A
|
|
176
|
+
// postMessage clone failure rejects with a STRING (never a worker Error).
|
|
177
|
+
" var postCall = function(tool, args, resolve, reject) {",
|
|
71
178
|
" const id = nextId++;",
|
|
72
179
|
" callMap.set(id, { resolve: resolve, reject: reject });",
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
180
|
+
" try { parentPort.postMessage({ t: " + JSON.stringify("call") + ", id: id, tool: tool, args: args }); }",
|
|
181
|
+
" catch (e) { callMap.delete(id); reject(String(e && e.message ? e.message : e)); }",
|
|
182
|
+
" };",
|
|
183
|
+
" var callLog = function() {};",
|
|
184
|
+
" var callTimeout = function(fn, ms) { return setTimeout(fn, ms); };",
|
|
185
|
+
" var callClearTimeout = function(h) { return clearTimeout(h); };",
|
|
186
|
+
// inner listener: RPC replies resolve pending program calls; abort
|
|
187
|
+
// rejects are STRINGS (the parent normally hard-terminates on a stop).
|
|
76
188
|
' parentPort.on("message", function(inner) {',
|
|
77
189
|
' if (inner && inner.t === "result" && callMap.has(inner.id)) {',
|
|
78
190
|
" callMap.get(inner.id).resolve(inner.r);",
|
|
79
191
|
" callMap.delete(inner.id);",
|
|
80
192
|
' } else if (inner && inner.t === "abort") {',
|
|
81
|
-
" for (const e of callMap.values()) e.reject(
|
|
193
|
+
" for (const e of callMap.values()) e.reject(String(" + JSON.stringify("ptc-stop:") + ") + String(inner.reason));",
|
|
82
194
|
" callMap.clear();",
|
|
83
195
|
" }",
|
|
84
196
|
" });",
|
|
197
|
+
// C1: null-prototype context + codeGeneration OFF, facade built in-realm.
|
|
198
|
+
" var sandbox = Object.create(null);",
|
|
199
|
+
" vm.createContext(sandbox, { codeGeneration: { strings: false, wasm: false } });",
|
|
200
|
+
" var inject = vm.compileFunction(" + JSON.stringify(TM_SANDBOX_SRC) + ", [" +
|
|
201
|
+
JSON.stringify("postCall") + ", " + JSON.stringify("callLog") + ", " +
|
|
202
|
+
JSON.stringify("callTimeout") + ", " + JSON.stringify("callClearTimeout") + "], " +
|
|
203
|
+
"{ parsingContext: sandbox });",
|
|
204
|
+
" var built = inject(postCall, callLog, callTimeout, callClearTimeout);",
|
|
205
|
+
" sandbox.tm = built.tm;",
|
|
206
|
+
" sandbox.console = built.console;",
|
|
207
|
+
" sandbox.setTimeout = built.setTimeout;",
|
|
208
|
+
" sandbox.clearTimeout = built.clearTimeout;",
|
|
209
|
+
" var vmTimeout = typeof msg.timeoutMs === " + JSON.stringify("number") + " && msg.timeoutMs > 0 ? msg.timeoutMs : 30000;",
|
|
85
210
|
" try {",
|
|
86
|
-
//
|
|
87
|
-
//
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
211
|
+
// async-IIFE wrapper (same shape as InlineVmEngine): `return` stays
|
|
212
|
+
// legal in the body, strict mode applies, and the completion value
|
|
213
|
+
// IS the program's promise. The vm timeout kills PRE-await sync
|
|
214
|
+
// busy-loops in-engine (post-await loops die via the driver-side
|
|
215
|
+
// abort → terminate()).
|
|
216
|
+
" var result = await vm.runInContext(" +
|
|
217
|
+
JSON.stringify('(async () => {\n"use strict";\n') +
|
|
218
|
+
" + program + " +
|
|
219
|
+
JSON.stringify("\n})()") +
|
|
220
|
+
", sandbox, { timeout: vmTimeout });",
|
|
91
221
|
' parentPort.postMessage({ t: "done", result: result });',
|
|
92
222
|
" } catch (err) {",
|
|
93
|
-
|
|
223
|
+
// T5: tag the fault kind — a program throw becomes kind:"program"
|
|
224
|
+
// so the parent constructs PtcProgramError (status "program-error",
|
|
225
|
+
// no auto-degrade). vm-realm Errors are not instanceof the worker
|
|
226
|
+
// realm's Error — read message/stack structurally.
|
|
227
|
+
' parentPort.postMessage({ t: "error", kind: "program", message: (err && err.message) ? String(err.message) : String(err), stack: (err && err.stack) ? String(err.stack) : undefined });',
|
|
94
228
|
" }",
|
|
95
229
|
" }",
|
|
96
230
|
"});",
|
|
97
231
|
].join("\n");
|
|
98
232
|
return new Promise((resolve, reject) => {
|
|
99
233
|
let settled = false;
|
|
234
|
+
// C1: did the worker thread actually START? A crash AFTER the thread
|
|
235
|
+
// came online is a RUNTIME fault (a started program) and must never be
|
|
236
|
+
// replayed on the inline/ESM realm; only a failure to START at all
|
|
237
|
+
// (pre-online) is an engine-init fault the driver may degrade from.
|
|
238
|
+
let online = false;
|
|
100
239
|
const w = new Worker(src, {
|
|
101
240
|
eval: true,
|
|
102
241
|
env: {},
|
|
@@ -120,7 +259,22 @@ export class WorkerEngine {
|
|
|
120
259
|
else if (msg.t === "error") {
|
|
121
260
|
settle(() => {
|
|
122
261
|
w.terminate();
|
|
123
|
-
const
|
|
262
|
+
const message = typeof msg.message === "string" ? msg.message : "worker error";
|
|
263
|
+
// A vm script-timeout text means the program blew its
|
|
264
|
+
// in-engine time budget — surface it as the run TIMEOUT so the
|
|
265
|
+
// status stays "timeout" whichever watchdog fired first.
|
|
266
|
+
if (msg.kind === "program" && /^Script execution timed out/i.test(message)) {
|
|
267
|
+
reject(new PtcStopSignal("timeout"));
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
// T5: a tagged program fault → PtcProgramError (the driver maps
|
|
271
|
+
// it to "program-error" and never auto-degrades). An untagged
|
|
272
|
+
// error stays a generic engine fault.
|
|
273
|
+
if (msg.kind === "program") {
|
|
274
|
+
reject(new PtcProgramError(message, typeof msg.stack === "string" ? msg.stack : undefined));
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const err = new Error(message);
|
|
124
278
|
if (typeof msg.stack === "string")
|
|
125
279
|
err.stack = msg.stack;
|
|
126
280
|
reject(err);
|
|
@@ -136,7 +290,18 @@ export class WorkerEngine {
|
|
|
136
290
|
w.postMessage({ t: "result", id: req.id, r });
|
|
137
291
|
}
|
|
138
292
|
})
|
|
139
|
-
.catch(() => {
|
|
293
|
+
.catch((err) => {
|
|
294
|
+
// T5 (stop-signal swallow): the gate throws PtcStopSignal on
|
|
295
|
+
// budget/time stops — it must TERMINATE the run with the stop
|
|
296
|
+
// status instead of being swallowed into a generic per-call
|
|
297
|
+
// error (zombie mode: the program kept running past the stop
|
|
298
|
+
// on "bridge call failed" replies).
|
|
299
|
+
if (err instanceof PtcStopSignal) {
|
|
300
|
+
settle(() => {
|
|
301
|
+
w.terminate().then(() => reject(err));
|
|
302
|
+
});
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
140
305
|
if (!settled) {
|
|
141
306
|
w.postMessage({
|
|
142
307
|
t: "result",
|
|
@@ -147,8 +312,39 @@ export class WorkerEngine {
|
|
|
147
312
|
});
|
|
148
313
|
}
|
|
149
314
|
});
|
|
315
|
+
w.on("online", () => {
|
|
316
|
+
online = true;
|
|
317
|
+
});
|
|
150
318
|
w.on("error", (err) => {
|
|
151
|
-
|
|
319
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
320
|
+
settle(() => {
|
|
321
|
+
if (online) {
|
|
322
|
+
// The worker thread had started and then threw at the bootstrap
|
|
323
|
+
// level — a runtime crash of a started program. Tag it as a
|
|
324
|
+
// PROGRAM fault so the driver maps to "program-error" and NEVER
|
|
325
|
+
// replays the (already-running) program on a more-privileged
|
|
326
|
+
// realm. Do NOT terminate-and-resolve; the run simply fails.
|
|
327
|
+
reject(new PtcProgramError(msg, err instanceof Error ? err.stack : undefined));
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
// The worker never came online: an engine-init fault. This is
|
|
331
|
+
// the ONLY case the auto worker→inline degrade may act on.
|
|
332
|
+
reject(err instanceof Error ? err : new Error(msg));
|
|
333
|
+
}
|
|
334
|
+
});
|
|
335
|
+
});
|
|
336
|
+
// C1: an unexpected exit while the run is still open. Post-online this
|
|
337
|
+
// is a crash (e.g. a bootstrap-level process.exit) → program-error, no
|
|
338
|
+
// replay; pre-online it is an init failure → engine-error (degradable).
|
|
339
|
+
w.on("exit", (code) => {
|
|
340
|
+
if (code === 0 || settled)
|
|
341
|
+
return;
|
|
342
|
+
settle(() => {
|
|
343
|
+
if (online)
|
|
344
|
+
reject(new PtcProgramError(`worker crashed (exit ${code})`));
|
|
345
|
+
else
|
|
346
|
+
reject(new Error(`worker failed to start (exit ${code})`));
|
|
347
|
+
});
|
|
152
348
|
});
|
|
153
349
|
// Wire signal abort → terminate the worker.
|
|
154
350
|
const onAbort = () => {
|
|
@@ -160,8 +356,14 @@ export class WorkerEngine {
|
|
|
160
356
|
onAbort();
|
|
161
357
|
else
|
|
162
358
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
163
|
-
// Send the run request
|
|
164
|
-
|
|
359
|
+
// Send the run request — timeoutMs feeds the in-engine vm script
|
|
360
|
+
// timeout (complementary to the driver-side abort→terminate).
|
|
361
|
+
w.postMessage({
|
|
362
|
+
t: "run",
|
|
363
|
+
program,
|
|
364
|
+
startDeadlineMs: opts?.startDeadlineMs ?? 0,
|
|
365
|
+
timeoutMs: opts?.timeoutMs,
|
|
366
|
+
});
|
|
165
367
|
});
|
|
166
368
|
}
|
|
167
369
|
}
|
|
@@ -175,7 +377,37 @@ export class InlineVmEngine {
|
|
|
175
377
|
this.compileTimeoutMs = compileTimeoutMs;
|
|
176
378
|
}
|
|
177
379
|
async run(program, bridge, signal) {
|
|
178
|
-
|
|
380
|
+
// C1: build the facade INSIDE the sandbox (vm.compileFunction + parsingContext) and compile the
|
|
381
|
+
// context with codeGeneration OFF. This engine runs in the PLUGIN ESM
|
|
382
|
+
// realm (historically the WORST leak: an escaped `Function` could then
|
|
383
|
+
// `import("node:fs" | "node:child_process")` → arbitrary file read incl.
|
|
384
|
+
// .env, bypassing R6/P2). Wrapping the injected functions into the
|
|
385
|
+
// sandbox realm is what closes it: `tm.read.constructor` is the sandbox
|
|
386
|
+
// Function, codeGeneration:{strings:false} blocks compiling any new
|
|
387
|
+
// string, and dynamic `import(...)` has no callback in a vm context so it
|
|
388
|
+
// throws. The plugin-realm `bridge` is passed as a WRAPPER PARAMETER
|
|
389
|
+
// (closure, unreachable from the program); RPC results are JSON
|
|
390
|
+
// round-tripped into the sandbox and rejection reasons are plain strings,
|
|
391
|
+
// so no host-realm object (with a host `.constructor`) ever crosses in.
|
|
392
|
+
const callBridge = (tool, args, resolve, reject) => {
|
|
393
|
+
let p;
|
|
394
|
+
try {
|
|
395
|
+
p = bridge.call(tool, args && typeof args === "object" ? args : {});
|
|
396
|
+
}
|
|
397
|
+
catch (e) {
|
|
398
|
+
reject(e instanceof Error ? e.message : String(e));
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
Promise.resolve(p).then((r) => resolve(r), (e) => reject(e instanceof Error ? e.message : String(e)));
|
|
402
|
+
};
|
|
403
|
+
const sandbox = Object.create(null);
|
|
404
|
+
vmSandbox.createContext(sandbox, { codeGeneration: { strings: false, wasm: false } });
|
|
405
|
+
// TM_INLINE_SRC returns the { read, grep, bash, fetch, search, webfetch }
|
|
406
|
+
// facade directly (this context carries only `tm`, no console/timers).
|
|
407
|
+
const inject = vmSandbox.compileFunction(TM_INLINE_SRC, ["callBridge"], {
|
|
408
|
+
parsingContext: sandbox,
|
|
409
|
+
});
|
|
410
|
+
sandbox.tm = inject(callBridge);
|
|
179
411
|
let abortHandler;
|
|
180
412
|
const abortP = new Promise((_, rej) => {
|
|
181
413
|
abortHandler = () => rej(new PtcStopSignal("timeout"));
|
|
@@ -189,8 +421,29 @@ export class InlineVmEngine {
|
|
|
189
421
|
// body, the `tm` facade rides the context globals, and the script's
|
|
190
422
|
// completion value IS the program's promise. The timeout kills
|
|
191
423
|
// pre-await synchronous busy-loops (see the module doc).
|
|
192
|
-
|
|
193
|
-
|
|
424
|
+
let promise;
|
|
425
|
+
try {
|
|
426
|
+
promise = vmSandbox.runInContext(`(async () => {\n"use strict";\n${program}\n})()`, sandbox, { timeout: this.compileTimeoutMs });
|
|
427
|
+
}
|
|
428
|
+
catch (err) {
|
|
429
|
+
// a SYNCHRONOUS vm throw (script timeout) is an engine-side kill —
|
|
430
|
+
// generic Error → engine-error semantics (pinned by §9j).
|
|
431
|
+
throw err;
|
|
432
|
+
}
|
|
433
|
+
try {
|
|
434
|
+
return await Promise.race([promise, abortP]);
|
|
435
|
+
}
|
|
436
|
+
catch (err) {
|
|
437
|
+
if (err instanceof PtcStopSignal)
|
|
438
|
+
throw err;
|
|
439
|
+
// T5: the program body REJECTED — tag it so the driver maps to
|
|
440
|
+
// status "program-error" instead of auto-degrading. A vm-realm
|
|
441
|
+
// Error is not instanceof the host Error — read message/stack
|
|
442
|
+
// structurally.
|
|
443
|
+
const message = err?.message;
|
|
444
|
+
const stack = err?.stack;
|
|
445
|
+
throw new PtcProgramError(typeof message === "string" && message ? message : String(err ?? "program error"), typeof stack === "string" ? stack : undefined);
|
|
446
|
+
}
|
|
194
447
|
}
|
|
195
448
|
finally {
|
|
196
449
|
if (abortHandler)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engines.js","sourceRoot":"","sources":["../../../src/tm/ptc/engines.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE7C,gFAAgF;AAChF,SAAS,UAAU,CAAC,MAAiB;IACnC,MAAM,GAAG,GACP,CAAC,IAAY,EAAE,EAAE,CACjB,CAAC,IAA6B,EAAoB,EAAE,CAClD,MAAM,CAAC,IAAI,CAAC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I,CAAC;gBACH,OAAO,GAAG,SAAS,CAAC,YAAY,CAC9B,kCAAkC,OAAO,QAAQ,EACjD,OAAO,EACP,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,CACf,CAAA;YACvB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,mEAAmE;gBACnE,0DAA0D;gBAC1D,MAAM,GAAG,CAAA;YACX,CAAC;YACD,IAAI,CAAC;gBACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;YAC9C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,aAAa;oBAAE,MAAM,GAAG,CAAA;gBAC3C,+DAA+D;gBAC/D,gEAAgE;gBAChE,8DAA8D;gBAC9D,gBAAgB;gBAChB,MAAM,OAAO,GAAI,GAAgD,EAAE,OAAO,CAAA;gBAC1E,MAAM,KAAK,GAAI,GAA8C,EAAE,KAAK,CAAA;gBACpE,MAAM,IAAI,eAAe,CACvB,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,eAAe,CAAC,EACjF,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAC9C,CAAA;YACH,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,IAAI,YAAY;gBAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QACrE,CAAC;IACH,CAAC;CACF"}
|
package/dist/tm/ptc/index.d.ts
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* gate / driver / summary / tool. This re-export keeps every historical
|
|
5
5
|
* export name stable for `dist/tm/index.js` and any deep-path importers.
|
|
6
6
|
*/
|
|
7
|
-
export type { BridgeTool, PtcBridge, PtcCallResult, PtcEngine, PtcEngineMessage, PtcEngineName, PtcErrorBody, PtcRunOutcome, PtcRpcAbort, PtcRpcRequest, PtcRpcResponse, PtcRunRequest, PtcStatus, PtcStepRecord, } from "./contract.js";
|
|
8
|
-
export { BRIDGE_ALLOW, PTC_STATUS_VALUES, PtcStopSignal, RETRYABLE_PHASES, shortRefCode, } from "./contract.js";
|
|
9
|
-
export type { PtcArgsResult, PtcBudgets, PtcCallerBudgets, PtcValidArgs } from "./budgets.js";
|
|
10
|
-
export { parsePtcArgs, PTC_LABEL_MAX, resolvePtcBudgets } from "./budgets.js";
|
|
7
|
+
export type { BridgeTool, PtcBridge, PtcCallResult, PtcEngine, PtcEngineMessage, PtcEngineName, PtcEngineRunOpts, PtcErrorBody, PtcRunOutcome, PtcRpcAbort, PtcRpcRequest, PtcRpcResponse, PtcRunRequest, PtcStatus, PtcStepRecord, } from "./contract.js";
|
|
8
|
+
export { BRIDGE_ALLOW, PTC_STATUS_VALUES, PtcProgramError, PtcStopSignal, RETRYABLE_PHASES, shortRefCode, } from "./contract.js";
|
|
9
|
+
export type { PtcArgsResult, PtcBudgets, PtcBudgetResolution, PtcCallerBudgets, PtcValidArgs } from "./budgets.js";
|
|
10
|
+
export { parsePtcArgs, PTC_LABEL_MAX, resolvePtcBudgets, resolvePtcBudgetsDetailed } from "./budgets.js";
|
|
11
11
|
export { staticPscan } from "./pscan.js";
|
|
12
12
|
export { InlineSequentialEngine, InlineVmEngine, WorkerEngine } from "./engines.js";
|
|
13
13
|
export type { GateState } from "./gate.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tm/ptc/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,YAAY,EACV,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,aAAa,EACb,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,SAAS,EACT,aAAa,GACd,MAAM,eAAe,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AkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/tm/ptc/index.js
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* gate / driver / summary / tool. This re-export keeps every historical
|
|
5
5
|
* export name stable for `dist/tm/index.js` and any deep-path importers.
|
|
6
6
|
*/
|
|
7
|
-
export { BRIDGE_ALLOW, PTC_STATUS_VALUES, PtcStopSignal, RETRYABLE_PHASES, shortRefCode, } from "./contract.js";
|
|
8
|
-
export { parsePtcArgs, PTC_LABEL_MAX, resolvePtcBudgets } from "./budgets.js";
|
|
7
|
+
export { BRIDGE_ALLOW, PTC_STATUS_VALUES, PtcProgramError, PtcStopSignal, RETRYABLE_PHASES, shortRefCode, } from "./contract.js";
|
|
8
|
+
export { parsePtcArgs, PTC_LABEL_MAX, resolvePtcBudgets, resolvePtcBudgetsDetailed } from "./budgets.js";
|
|
9
9
|
export { staticPscan } from "./pscan.js";
|
|
10
10
|
export { InlineSequentialEngine, InlineVmEngine, WorkerEngine } from "./engines.js";
|
|
11
11
|
export { createGateBridge } from "./gate.js";
|
package/dist/tm/ptc/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tm/ptc/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tm/ptc/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH,OAAO,EACL,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,YAAY,GACb,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAA;AACxG,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/tm/ptc/pscan.d.ts
CHANGED
|
@@ -2,8 +2,27 @@
|
|
|
2
2
|
* tm_ptc_run — static pre-scan: the FIRST gate. runPtc and buildPtcRunTool
|
|
3
3
|
* both reject a rejected program before any engine runs. Auxiliary guard,
|
|
4
4
|
* not a security boundary (design §3 trust model). Split out of the former
|
|
5
|
-
* monolithic ptc.ts
|
|
5
|
+
* monolithic ptc.ts.
|
|
6
|
+
*
|
|
7
|
+
* C1 fix batch: the old single-regex stripper deleted an ENTIRE template
|
|
8
|
+
* literal including its `${…}` executable interpolations, so
|
|
9
|
+
* `` `x ${process.exit(1)} y` `` was a FALSE NEGATIVE (a real escape written
|
|
10
|
+
* inside an interpolation sailed through). The scanner below is a tiny
|
|
11
|
+
* hand-written lexer that:
|
|
12
|
+
* - drops line/block comments and '…'/"…" string bodies (data, not code),
|
|
13
|
+
* - drops the LITERAL TEXT of a template but RECURSIVELY SCANS every
|
|
14
|
+
* `${…}` interpolation body (that text IS executed), and
|
|
15
|
+
* - drops regex-literal bodies, so `{ pattern: /\brequire\b/ }` (a plain
|
|
16
|
+
* DATA regex) no longer rejects the whole program.
|
|
17
|
+
* Everything is fail-CLOSED: an unterminated literal/comment/interpolation
|
|
18
|
+
* leaves its remainder in place to be scanned, so an open quote can never
|
|
19
|
+
* hide a banned token behind it.
|
|
6
20
|
*/
|
|
21
|
+
/** The program source with string / comment / template-text / regex-literal
|
|
22
|
+
* bodies removed but `${…}` interpolation bodies retained and scanned.
|
|
23
|
+
* Each removed literal becomes a single SPACE (not "") so a token split
|
|
24
|
+
* across two literals cannot re-form, and word boundaries stay intact. */
|
|
25
|
+
export declare function stripNonExecutable(program: string): string;
|
|
7
26
|
export declare function staticPscan(program: string): {
|
|
8
27
|
rejected: boolean;
|
|
9
28
|
tokens: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pscan.d.ts","sourceRoot":"","sources":["../../../src/tm/ptc/pscan.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pscan.d.ts","sourceRoot":"","sources":["../../../src/tm/ptc/pscan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAmTH;;;2EAG2E;AAC3E,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CASpF"}
|