@te-river/opencode-team-mode 1.7.1 → 1.7.3
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 +1009 -849
- package/README.zh-CN.md +906 -756
- package/dist/host/v2-browser-gate.d.ts +4 -1
- package/dist/host/v2-browser-gate.d.ts.map +1 -1
- package/dist/host/v2-browser-gate.js +1 -1
- package/dist/host/v2-browser-gate.js.map +1 -1
- package/dist/host/v2-capabilities.js +1 -1
- package/dist/host/v2-capabilities.js.map +1 -1
- package/dist/host/v2-guard.d.ts +3 -1
- package/dist/host/v2-guard.d.ts.map +1 -1
- package/dist/host/v2-guard.js +2 -2
- package/dist/host/v2-guard.js.map +1 -1
- package/dist/host/v2-offload.d.ts +12 -2
- package/dist/host/v2-offload.d.ts.map +1 -1
- package/dist/host/v2-offload.js +9 -9
- package/dist/host/v2-offload.js.map +1 -1
- package/dist/host/v2-probe-chain.d.ts +5 -1
- package/dist/host/v2-probe-chain.d.ts.map +1 -1
- package/dist/host/v2-probe-chain.js +4 -6
- package/dist/host/v2-probe-chain.js.map +1 -1
- package/dist/host/v2-probe.d.ts.map +1 -1
- package/dist/host/v2-probe.js +2 -1
- package/dist/host/v2-probe.js.map +1 -1
- package/dist/host/v2-prune.d.ts +5 -1
- package/dist/host/v2-prune.d.ts.map +1 -1
- package/dist/host/v2-prune.js +8 -14
- package/dist/host/v2-prune.js.map +1 -1
- package/dist/host/v2-retry.d.ts +9 -2
- package/dist/host/v2-retry.d.ts.map +1 -1
- package/dist/host/v2-retry.js +13 -15
- package/dist/host/v2-retry.js.map +1 -1
- package/dist/host/v2-session.d.ts +6 -2
- package/dist/host/v2-session.d.ts.map +1 -1
- package/dist/host/v2-session.js +7 -13
- package/dist/host/v2-session.js.map +1 -1
- package/dist/host/v2.d.ts +7 -2
- package/dist/host/v2.d.ts.map +1 -1
- package/dist/host/v2.js +38 -35
- package/dist/host/v2.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 +23 -7
- package/dist/prompts/lead.js.map +1 -1
- package/dist/prompts/specialists.d.ts +1 -1
- package/dist/prompts/specialists.d.ts.map +1 -1
- package/dist/prompts/specialists.js +1 -1
- package/dist/tm/args-schema.d.ts +1 -1
- package/dist/tm/args-schema.js +6 -6
- package/dist/tm/args-schema.js.map +1 -1
- package/dist/tm/board.js +2 -2
- package/dist/tm/board.js.map +1 -1
- package/dist/tm/config-files.d.ts +41 -17
- package/dist/tm/config-files.d.ts.map +1 -1
- package/dist/tm/config-files.js +68 -73
- package/dist/tm/config-files.js.map +1 -1
- package/dist/tm/config-layers.d.ts +65 -33
- package/dist/tm/config-layers.d.ts.map +1 -1
- package/dist/tm/config-layers.js +165 -81
- package/dist/tm/config-layers.js.map +1 -1
- package/dist/tm/config-template.d.ts +32 -0
- package/dist/tm/config-template.d.ts.map +1 -0
- package/dist/tm/config-template.js +74 -0
- package/dist/tm/config-template.js.map +1 -0
- package/dist/tm/config.d.ts +115 -140
- package/dist/tm/config.d.ts.map +1 -1
- package/dist/tm/config.js +100 -200
- package/dist/tm/config.js.map +1 -1
- package/dist/tm/index.d.ts +11 -3
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +46 -16
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/ledger.d.ts +7 -3
- package/dist/tm/ledger.d.ts.map +1 -1
- package/dist/tm/ledger.js +5 -4
- package/dist/tm/ledger.js.map +1 -1
- package/dist/tm/memory.js +3 -3
- package/dist/tm/pipelines.js +1 -1
- package/dist/tm/search.js +6 -6
- package/dist/tm/search.js.map +1 -1
- package/dist/tm/stats.js +2 -2
- package/dist/tm/stats.js.map +1 -1
- package/dist/tm/tools.js +2 -2
- package/dist/tm/webfetch.d.ts +5 -2
- package/dist/tm/webfetch.d.ts.map +1 -1
- package/dist/tm/webfetch.js +24 -18
- package/dist/tm/webfetch.js.map +1 -1
- package/docs/installation-v2.md +61 -38
- package/docs/installation.md +4 -4
- package/docs/v2-port-notes.md +31 -0
- package/package.json +1 -1
- package/scripts/gen-v2-config.mjs +40 -4
- package/dist/approval-gate.d.ts +0 -205
- package/dist/approval-gate.d.ts.map +0 -1
- package/dist/approval-gate.js +0 -627
- package/dist/approval-gate.js.map +0 -1
- package/dist/host/v1.d.ts +0 -14
- package/dist/host/v1.d.ts.map +0 -1
- package/dist/host/v1.js +0 -340
- package/dist/host/v1.js.map +0 -1
- package/dist/host/v2-client.d.ts +0 -53
- package/dist/host/v2-client.d.ts.map +0 -1
- package/dist/host/v2-client.js +0 -193
- package/dist/host/v2-client.js.map +0 -1
- package/dist/host/v2-transcript.d.ts +0 -73
- package/dist/host/v2-transcript.d.ts.map +0 -1
- package/dist/host/v2-transcript.js +0 -151
- package/dist/host/v2-transcript.js.map +0 -1
- package/dist/host-hooks.d.ts +0 -126
- package/dist/host-hooks.d.ts.map +0 -1
- package/dist/host-hooks.js +0 -284
- package/dist/host-hooks.js.map +0 -1
- package/dist/tm/bash-timeout.d.ts +0 -72
- package/dist/tm/bash-timeout.d.ts.map +0 -1
- package/dist/tm/bash-timeout.js +0 -100
- package/dist/tm/bash-timeout.js.map +0 -1
- package/dist/tm/browser.d.ts +0 -642
- package/dist/tm/browser.d.ts.map +0 -1
- package/dist/tm/browser.js +0 -2836
- package/dist/tm/browser.js.map +0 -1
- package/dist/tm/ptc/budgets.d.ts +0 -59
- package/dist/tm/ptc/budgets.d.ts.map +0 -1
- package/dist/tm/ptc/budgets.js +0 -138
- package/dist/tm/ptc/budgets.js.map +0 -1
- package/dist/tm/ptc/contract.d.ts +0 -171
- package/dist/tm/ptc/contract.d.ts.map +0 -1
- package/dist/tm/ptc/contract.js +0 -85
- package/dist/tm/ptc/contract.js.map +0 -1
- package/dist/tm/ptc/driver.d.ts +0 -40
- package/dist/tm/ptc/driver.d.ts.map +0 -1
- package/dist/tm/ptc/driver.js +0 -213
- package/dist/tm/ptc/driver.js.map +0 -1
- package/dist/tm/ptc/engines.d.ts +0 -43
- package/dist/tm/ptc/engines.d.ts.map +0 -1
- package/dist/tm/ptc/engines.js +0 -454
- package/dist/tm/ptc/engines.js.map +0 -1
- package/dist/tm/ptc/gate.d.ts +0 -28
- package/dist/tm/ptc/gate.d.ts.map +0 -1
- package/dist/tm/ptc/gate.js +0 -130
- package/dist/tm/ptc/gate.js.map +0 -1
- package/dist/tm/ptc/index.d.ts +0 -19
- package/dist/tm/ptc/index.d.ts.map +0 -1
- package/dist/tm/ptc/index.js +0 -15
- package/dist/tm/ptc/index.js.map +0 -1
- package/dist/tm/ptc/pscan.d.ts +0 -30
- package/dist/tm/ptc/pscan.d.ts.map +0 -1
- package/dist/tm/ptc/pscan.js +0 -341
- package/dist/tm/ptc/pscan.js.map +0 -1
- package/dist/tm/ptc/summary.d.ts +0 -17
- package/dist/tm/ptc/summary.d.ts.map +0 -1
- package/dist/tm/ptc/summary.js +0 -134
- package/dist/tm/ptc/summary.js.map +0 -1
- package/dist/tm/ptc/tool.d.ts +0 -66
- package/dist/tm/ptc/tool.d.ts.map +0 -1
- package/dist/tm/ptc/tool.js +0 -231
- package/dist/tm/ptc/tool.js.map +0 -1
- package/dist/tm/ptc.d.ts +0 -298
- package/dist/tm/ptc.d.ts.map +0 -1
- package/dist/tm/ptc.js +0 -865
- package/dist/tm/ptc.js.map +0 -1
- package/dist/tm/pty.d.ts +0 -70
- package/dist/tm/pty.d.ts.map +0 -1
- package/dist/tm/pty.js +0 -245
- package/dist/tm/pty.js.map +0 -1
- package/dist/tool-coerce.d.ts +0 -24
- package/dist/tool-coerce.d.ts.map +0 -1
- package/dist/tool-coerce.js +0 -63
- package/dist/tool-coerce.js.map +0 -1
package/dist/tm/ptc/tool.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tm_ptc_run — the bridge over the real governed pipelines + the tool
|
|
3
|
-
* definition. Governance is REUSED, never forked (D6 lock): every bridged
|
|
4
|
-
* call runs the full tm_* pipeline (P2 path scope, P3 allowlist, R6,
|
|
5
|
-
* threshold offload + handles, TTL). PTC is NOT a bypass layer.
|
|
6
|
-
* Split out of the former monolithic ptc.ts; behavior unchanged.
|
|
7
|
-
*/
|
|
8
|
-
import type { ToolDefinition, ToolResult } from "../../types.js";
|
|
9
|
-
import { type TmConfig } from "../config.js";
|
|
10
|
-
import type { RunStore } from "../store.js";
|
|
11
|
-
import { type TmAskRequest } from "../perm-ask.js";
|
|
12
|
-
import type { TmPipelines } from "../pipelines.js";
|
|
13
|
-
import type { BridgeTool, PtcBridge, PtcEngine } from "./contract.js";
|
|
14
|
-
/**
|
|
15
|
-
* Real bridge: delegate each call to the corresponding exported pipeline,
|
|
16
|
-
* `ctx` passed through untouched, and normalize the pipeline's `unknown`
|
|
17
|
-
* result into `PtcCallResult` (TmErrorBody -> ok:false; anything else -> the
|
|
18
|
-
* already-governed data). Governance is entirely the pipelines'.
|
|
19
|
-
*
|
|
20
|
-
* T6 web bridges: `web` carries the LIVE tm_search / tm_webfetch tool handles
|
|
21
|
-
* (built over the SAME secondary pipeline instance, so their step ids share
|
|
22
|
-
* the "ptc-" namespace). A bridged `tm.search()` / `tm.webfetch()` runs that
|
|
23
|
-
* tool's real execute under `ctx` — which means the host evaluates its
|
|
24
|
-
* `permission.asked` (the out-of-allowlist dialog AND the caller's own
|
|
25
|
-
* ruleset) against the CALLER'S session, so a non-web role is denied with a
|
|
26
|
-
* permission error and the denial is recorded as a failed step. When `web`
|
|
27
|
-
* is absent (TM_PTC_WEB_BRIDGE=off, or the secondary tools were not wired)
|
|
28
|
-
* the two web tools are rejected with an explicit args error.
|
|
29
|
-
*/
|
|
30
|
-
export interface PtcWebHandles {
|
|
31
|
-
tm_search: {
|
|
32
|
-
execute: (rawArgs: Record<string, unknown>, ctx: unknown) => Promise<ToolResult>;
|
|
33
|
-
};
|
|
34
|
-
tm_webfetch: {
|
|
35
|
-
execute: (rawArgs: Record<string, unknown>, ctx: unknown) => Promise<ToolResult>;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Build the OFFICIAL permission request the bridge raises for a bridged web
|
|
40
|
-
* call. The permission name is the tool itself (`tm_search` / `tm_webfetch`),
|
|
41
|
-
* so the host evaluates the CALLER'S own ruleset — exactly as a direct tool
|
|
42
|
-
* call would: `deny` for a non-web role, and for a web-granted role
|
|
43
|
-
* (lead/researcher) the default ruleset is `ask`, so each bridged web call
|
|
44
|
-
* pops a confirmation dialog (store an `allow` rule to skip it) — NOT a
|
|
45
|
-
* silent pass. The patterns carry the target host (webfetch) / engine
|
|
46
|
-
* (search) so any dialog that DOES pop is informative and no-secret.
|
|
47
|
-
*/
|
|
48
|
-
export declare function webBridgeAsk(tool: BridgeTool, args: Record<string, unknown>): TmAskRequest;
|
|
49
|
-
export declare function pipelineBridge(pipelines: TmPipelines, ctx: unknown, web?: PtcWebHandles): PtcBridge;
|
|
50
|
-
/** Build the tm_ptc_run ToolDefinition. Registered in the tool segment
|
|
51
|
-
* when the agent's whitelist grants tm_ptc_run (M3). `deps.args` is the
|
|
52
|
-
* ZodRawShape from tools.buildPtcArgsSchema() when zod is available — the
|
|
53
|
-
* descriptor fallback below keeps the tool usable without zod. */
|
|
54
|
-
export declare function buildPtcRunTool(deps: {
|
|
55
|
-
cfg: TmConfig;
|
|
56
|
-
store: RunStore;
|
|
57
|
-
nextStepId: () => string;
|
|
58
|
-
ctx: unknown;
|
|
59
|
-
accessToken: string;
|
|
60
|
-
args?: Record<string, unknown>;
|
|
61
|
-
engine?: PtcEngine;
|
|
62
|
-
pipelines?: TmPipelines;
|
|
63
|
-
bridge?: PtcBridge;
|
|
64
|
-
webTools?: PtcWebHandles;
|
|
65
|
-
}): ToolDefinition;
|
|
66
|
-
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/tm/ptc/tool.ts"],"names":[],"mappings":"AAAA;;;;;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M,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,SAAS,CAAC,EAAE,WAAW,CAAA;IACvB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,QAAQ,CAAC,EAAE,aAAa,CAAA;CACzB,GAAG,cAAc,CAyFjB"}
|
package/dist/tm/ptc/tool.js
DELETED
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tm_ptc_run — the bridge over the real governed pipelines + the tool
|
|
3
|
-
* definition. Governance is REUSED, never forked (D6 lock): every bridged
|
|
4
|
-
* call runs the full tm_* pipeline (P2 path scope, P3 allowlist, R6,
|
|
5
|
-
* threshold offload + handles, TTL). PTC is NOT a bypass layer.
|
|
6
|
-
* Split out of the former monolithic ptc.ts; behavior unchanged.
|
|
7
|
-
*/
|
|
8
|
-
import { estimateTokens, shouldOffload, shorten } from "../config.js";
|
|
9
|
-
import { detectContentType } from "../preview.js";
|
|
10
|
-
import { tmError } from "../result.js";
|
|
11
|
-
import { askRefusalNote, askUserForTarget } from "../perm-ask.js";
|
|
12
|
-
import { BRIDGE_ALLOW } from "./contract.js";
|
|
13
|
-
import { parsePtcArgs } from "./budgets.js";
|
|
14
|
-
import { staticPscan } from "./pscan.js";
|
|
15
|
-
import { runPtc } from "./driver.js";
|
|
16
|
-
import { renderPtcSummary } from "./summary.js";
|
|
17
|
-
/**
|
|
18
|
-
* Unwrap a web tool's ToolResult back into the PTC `{ok,data}`/`{ok:false,
|
|
19
|
-
* error}` shape. The governed tools return `{output}` strings; a structured
|
|
20
|
-
* error renders with result.ts's pinned `[<tool> 失败 · phase=<phase>]`
|
|
21
|
-
* (optionally ` · line=<n>`) header line — the only machine-readable marker
|
|
22
|
-
* available at this boundary, so it is the split. Anything else (inline
|
|
23
|
-
* text, an offload handle block) is an ok result; a handle's ref is already
|
|
24
|
-
* in the text for the program to feed back through tm.fetch.
|
|
25
|
-
*/
|
|
26
|
-
function unwrapToolOutput(tool, output) {
|
|
27
|
-
const m = /^\[(\S+) 失败 · phase=([a-z]+)(?: · line=(-?\d+))?\]\n/.exec(output);
|
|
28
|
-
if (m && m[1] === tool) {
|
|
29
|
-
const phase = m[2];
|
|
30
|
-
const body = { tool, phase, message: output.slice(m[0].length) };
|
|
31
|
-
if (m[3] !== undefined)
|
|
32
|
-
Object.assign(body, { line: Number(m[3]) });
|
|
33
|
-
return { ok: false, error: body };
|
|
34
|
-
}
|
|
35
|
-
return { ok: true, data: output };
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Build the OFFICIAL permission request the bridge raises for a bridged web
|
|
39
|
-
* call. The permission name is the tool itself (`tm_search` / `tm_webfetch`),
|
|
40
|
-
* so the host evaluates the CALLER'S own ruleset — exactly as a direct tool
|
|
41
|
-
* call would: `deny` for a non-web role, and for a web-granted role
|
|
42
|
-
* (lead/researcher) the default ruleset is `ask`, so each bridged web call
|
|
43
|
-
* pops a confirmation dialog (store an `allow` rule to skip it) — NOT a
|
|
44
|
-
* silent pass. The patterns carry the target host (webfetch) / engine
|
|
45
|
-
* (search) so any dialog that DOES pop is informative and no-secret.
|
|
46
|
-
*/
|
|
47
|
-
export function webBridgeAsk(tool, args) {
|
|
48
|
-
if (tool === "tm_webfetch") {
|
|
49
|
-
const url = typeof args.url === "string" ? args.url : "";
|
|
50
|
-
let host = "";
|
|
51
|
-
try {
|
|
52
|
-
host = url ? new URL(url).hostname : "";
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
host = "";
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
permission: "tm_webfetch",
|
|
59
|
-
patterns: host ? [host, url] : ["*"],
|
|
60
|
-
metadata: { tool, via: "tm_ptc_run", host },
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
const engine = typeof args.engine === "string" ? args.engine : "auto";
|
|
64
|
-
return {
|
|
65
|
-
permission: "tm_search",
|
|
66
|
-
patterns: [`engine:${engine}`],
|
|
67
|
-
metadata: { tool, via: "tm_ptc_run", engine },
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
export function pipelineBridge(pipelines, ctx, web) {
|
|
71
|
-
const pick = (tool) => tool === "tm_read"
|
|
72
|
-
? pipelines.tmRead
|
|
73
|
-
: tool === "tm_grep"
|
|
74
|
-
? pipelines.tmGrep
|
|
75
|
-
: tool === "tm_bash"
|
|
76
|
-
? pipelines.tmBash
|
|
77
|
-
: tool === "tm_fetch"
|
|
78
|
-
? pipelines.tmFetch
|
|
79
|
-
: tool === "tm_search"
|
|
80
|
-
? web?.tm_search
|
|
81
|
-
: web?.tm_webfetch;
|
|
82
|
-
return {
|
|
83
|
-
async call(tool, args) {
|
|
84
|
-
if (!BRIDGE_ALLOW.includes(tool)) {
|
|
85
|
-
return { ok: false, error: tmError(tool, "args", "工具不在桥接白名单内").error };
|
|
86
|
-
}
|
|
87
|
-
const target = pick(tool);
|
|
88
|
-
if (!target) {
|
|
89
|
-
// a web bridge the caller's role / config never enabled
|
|
90
|
-
return {
|
|
91
|
-
ok: false,
|
|
92
|
-
error: tmError(tool, "args", "web 桥未启用(TM_PTC_WEB_BRIDGE=off 或未装配)").error,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
// C2: an ACTIVE role gate for bridged web — BEFORE execute. The bridge
|
|
96
|
-
// invokes the web tool's execute() directly, BYPASSING the host tool
|
|
97
|
-
// dispatch where agents.ts's `tm_search`/`tm_webfetch` = deny would
|
|
98
|
-
// otherwise block a non-web role, and the tools' own ctx.ask only pops
|
|
99
|
-
// for OUT-of-allowlist hosts (every default engine host is seeded). So
|
|
100
|
-
// without this the web bridge was a privilege-escalation path. Raise the
|
|
101
|
-
// SAME ruleset a direct call resolves: ctx.ask with the web permission
|
|
102
|
-
// name + target host/engine. A web-granted role hits the default `ask`
|
|
103
|
-
// rule → a confirmation dialog per call (an `allow` rule skips it); a
|
|
104
|
-
// non-web role's deny rule throws → a permission error step; a
|
|
105
|
-
// rejection or a missing ask bridge is fail-CLOSED.
|
|
106
|
-
if (tool === "tm_search" || tool === "tm_webfetch") {
|
|
107
|
-
const outcome = await askUserForTarget(ctx, webBridgeAsk(tool, args ?? {}));
|
|
108
|
-
if (outcome !== "approved") {
|
|
109
|
-
return {
|
|
110
|
-
ok: false,
|
|
111
|
-
error: tmError(tool, "permission", `桥接调用 ${tool} 未获批准(web 桥只授予 lead/researcher)—— ${askRefusalNote(outcome)}`).error,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
const res = typeof target === "function"
|
|
116
|
-
? await target(args ?? {}, ctx)
|
|
117
|
-
: await target.execute(args ?? {}, ctx);
|
|
118
|
-
if (res && typeof res === "object" && "error" in res) {
|
|
119
|
-
return { ok: false, error: res.error };
|
|
120
|
-
}
|
|
121
|
-
if (tool === "tm_search" || tool === "tm_webfetch") {
|
|
122
|
-
return unwrapToolOutput(tool, String(res?.output ?? res ?? ""));
|
|
123
|
-
}
|
|
124
|
-
return { ok: true, data: res };
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
// ---------- the tool definition ----------------------------------------------
|
|
129
|
-
const PTC_RUN_DESCRIPTION = `Batch orchestration: ONE async program makes N governed tm_* calls with ZERO LLM round-trips — use it INSTEAD of chaining ≥3 tm_read / tm_grep / tm_bash calls toward the same goal (multi-file recon, bulk grep+read aggregation, cross-referencing search results). Best for READ-ONLY fan-out: reading many files, aggregating many searches, or any parallel read that would otherwise cost one LLM turn per call. Only a char-pinned aggregation summary returns to context, so ALWAYS \`return\` the aggregated value at the end of the program: unreturned inline results are discarded (offload handles stay retrievable via tm.fetch).
|
|
130
|
-
|
|
131
|
-
- Example: \`const out = []; for (const p of ["a.ts", "b.ts", "c.ts"]) { const f = await tm.read({ path: p }); if (f.ok) out.push({ p, head: String(f.data).slice(0, 400) }); } return out;\`
|
|
132
|
-
- program: an async function body. Available: \`tm.read(args)\`, \`tm.grep(args)\`, \`tm.bash(args)\`, \`tm.fetch(args)\` — same args as the tm_* four — plus the WEB bridges \`await tm.search({ query, engine? })\` and \`await tm.webfetch({ url, fields? })\` (identical args to tm_search / tm_webfetch). Each returns \`{ok:true, data}\` (data is already governed: inline text, or an offload handle you can tm.fetch again) or \`{ok:false, error:{tool,phase,line?,message}}\`. \`return\` a value; it is JSON-serialized into the summary (capped 2000 chars, oversized → handle).
|
|
133
|
-
- Web bridge gating: tm.search / tm.webfetch run the REAL web tools under YOUR calling session's ctx, so the host evaluates them against YOUR agent's ruleset — a role without a web grant gets a \`permission\` error per call (bridged web is not a way around your tool whitelist), and \`TM_PTC_WEB_BRIDGE=off\` disables both. GETs are idempotent, so a transient client/execute/store failure retries once; a permission/args error never does.
|
|
134
|
-
- budgets (optional, tighten-only; clamped to TM_PTC_* ceilings): max_calls, max_errors, timeout_ms. Hitting any budget stops the whole run (produced output is NOT lost). Floors: max_calls 1 / max_errors 1 / timeout_ms 5000 ms; the summary echoes the EFFECTIVE budgets and flags every CLAMPED field (so a silently-narrowed budget is visible, not just the final number). Errors are retried at most once and only on idempotent phases (client/execute/store).
|
|
135
|
-
- Governance is NOT bypassed: every bridged call runs the full tm_* pipeline (P2 path scope, P3 allowlist, R6, threshold offload + handles, TTL). Status is one of ok | stopped-error-budget | stopped-call-budget | timeout | engine-error | program-error (program-error = the program itself threw — no auto-degrade re-run; engine-error = engine fault — auto mode re-runs the WHOLE program on the inline engine).
|
|
136
|
-
- Programs whose EXECUTABLE structure contains require/import/process/globalThis/Deno/Bun/fs/net/child_process are rejected before execution (static pre-scan, an auxiliary guard — NOT a security boundary). The pre-scan STRIPS string / template-literal / comment bodies first, so a grep pattern or log message that merely MENTIONS one of those words is fine — you do NOT need to obfuscate them; only a real \`require(...)\` / \`process.x\` call site is caught.
|
|
137
|
-
- Engine: TM_PTC_ENGINE=auto|worker|inline (auto tries worker first; on engine failure it re-runs the WHOLE program on inline with a degraded-engine mark — bridged calls are read-only, so a re-run is safe, and the fallback starts with fresh budgets under the same wall-clock deadline).`;
|
|
138
|
-
/** Build the tm_ptc_run ToolDefinition. Registered in the tool segment
|
|
139
|
-
* when the agent's whitelist grants tm_ptc_run (M3). `deps.args` is the
|
|
140
|
-
* ZodRawShape from tools.buildPtcArgsSchema() when zod is available — the
|
|
141
|
-
* descriptor fallback below keeps the tool usable without zod. */
|
|
142
|
-
export function buildPtcRunTool(deps) {
|
|
143
|
-
const { cfg, store, nextStepId, ctx, accessToken } = deps;
|
|
144
|
-
// Per-call bridge factory. The bridge MUST bind the CALLER's execute ctx,
|
|
145
|
-
// not the assembly-time `{ directory }`: tm_search / tm_webfetch run their
|
|
146
|
-
// `ctx.ask` permission probe against the calling agent's session ruleset, so
|
|
147
|
-
// a non-web role's bridged web call is denied by the host exactly as if that
|
|
148
|
-
// agent had called the tool directly. A test-provided `deps.bridge` still
|
|
149
|
-
// wins (the §9 suite injects its own mock).
|
|
150
|
-
const makeBridge = (callCtx) => deps.bridge ??
|
|
151
|
-
(deps.pipelines ? pipelineBridge(deps.pipelines, callCtx ?? ctx, deps.webTools) : undefined);
|
|
152
|
-
const expireAt = () => Date.now() + cfg.blackboardTtlDays * 24 * 60 * 60 * 1000;
|
|
153
|
-
return {
|
|
154
|
-
description: PTC_RUN_DESCRIPTION,
|
|
155
|
-
args: deps.args ?? {
|
|
156
|
-
program: { descriptor: "program: string (required, async fn body, ≤TM_PTC_MAX_PROGRAM_CHARS)" },
|
|
157
|
-
label: { descriptor: "label: string (optional, ≤80 chars)" },
|
|
158
|
-
budgets: { descriptor: "budgets: { max_calls?, max_errors?, timeout_ms? } (optional, tighten-only)" },
|
|
159
|
-
},
|
|
160
|
-
execute: async (rawArgs, callCtx) => {
|
|
161
|
-
const parsed = parsePtcArgs(rawArgs ?? {}, cfg);
|
|
162
|
-
if (!parsed.ok) {
|
|
163
|
-
return { output: `[${parsed.error.error.tool} 失败 · phase=${parsed.error.error.phase}]\n${parsed.error.error.message}` };
|
|
164
|
-
}
|
|
165
|
-
// static pre-scan — reject programs with banned tokens in EXECUTABLE
|
|
166
|
-
// structure before any engine runs (string/comment literals are stripped
|
|
167
|
-
// first, so a grep pattern that merely MENTIONS `require` is not caught).
|
|
168
|
-
const pscan = staticPscan(parsed.args.program);
|
|
169
|
-
if (pscan.rejected) {
|
|
170
|
-
return {
|
|
171
|
-
output: `[tm_ptc_run 失败 · phase=args]\n程序包含禁止标识符(${pscan.tokens.join(", ")}),已拒绝执行。PTC 桥接仅暴露 tm.read/tm.grep/tm.bash/tm.fetch/tm.search/tm.webfetch(web 两项受 TM_PTC_WEB_BRIDGE 与角色权限门控);require/import/process 等不在桥接白名单内。`,
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
// Re-bind the bridge to THIS call's ctx (role-gated web permission).
|
|
175
|
-
const bridge = makeBridge(callCtx);
|
|
176
|
-
if (!bridge) {
|
|
177
|
-
return {
|
|
178
|
-
output: "[tm_ptc_run 失败 · phase=client]\n桥接管线未提供。",
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
// Generate a fresh parent step ID per call.
|
|
182
|
-
const parentStepId = nextStepId();
|
|
183
|
-
// Per-call offload helper: persist `text` under a PTC sub-step and
|
|
184
|
-
// render a handle block matching the four tools' visible shape.
|
|
185
|
-
const offloadBlock = (text, kind) => {
|
|
186
|
-
const tokens = estimateTokens(text);
|
|
187
|
-
try {
|
|
188
|
-
const stored = store.writeResult(`${parentStepId}.${kind}`, {
|
|
189
|
-
tool: "tm_ptc_run",
|
|
190
|
-
content: text,
|
|
191
|
-
tokens,
|
|
192
|
-
contentType: detectContentType(text),
|
|
193
|
-
preview: shorten(text, 120),
|
|
194
|
-
expireAt: expireAt(),
|
|
195
|
-
});
|
|
196
|
-
return [
|
|
197
|
-
`ref: ${stored.ref}`,
|
|
198
|
-
`access_token: ${accessToken}`,
|
|
199
|
-
`expire_at: ${stored.expireAt}`,
|
|
200
|
-
`tokens: ${tokens}`,
|
|
201
|
-
`(用 tm_fetch(ref, access_token) 取回;大载荷先试 mode:"structure")`,
|
|
202
|
-
].join("\n");
|
|
203
|
-
}
|
|
204
|
-
catch {
|
|
205
|
-
return text.slice(0, 2000);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
const outcome = await runPtc({
|
|
209
|
-
program: parsed.args.program,
|
|
210
|
-
label: parsed.args.label,
|
|
211
|
-
budgets: parsed.args.budgets,
|
|
212
|
-
parentStepId,
|
|
213
|
-
cfg,
|
|
214
|
-
store,
|
|
215
|
-
bridge,
|
|
216
|
-
...(deps.engine ? { engine: deps.engine } : {}),
|
|
217
|
-
});
|
|
218
|
-
const content = renderPtcSummary(outcome, offloadBlock);
|
|
219
|
-
// whole-summary offload if it still exceeds the threshold.
|
|
220
|
-
if (shouldOffload(estimateTokens(content), cfg.offloadThreshold)) {
|
|
221
|
-
return {
|
|
222
|
-
output: `PTC 摘要过大(≈${estimateTokens(content)} tokens),已整体卸载为句柄,短摘要随后:\n` +
|
|
223
|
-
offloadBlock(content, "rpt") +
|
|
224
|
-
`\n--- 摘要前 1200 字符 ---\n${content.slice(0, 1200)}`,
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
return { output: content };
|
|
228
|
-
},
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
//# sourceMappingURL=tool.js.map
|
package/dist/tm/ptc/tool.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../../../src/tm/ptc/tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAiB,MAAM,cAAc,CAAA;AACpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAGjD,OAAO,EAAE,OAAO,EAAgB,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAqB,MAAM,gBAAgB,CAAA;AAGpF,OAAO,EAA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AY,CAAC,CAAA;YACvD,2DAA2D;YAC3D,IAAI,aAAa,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;gBACjE,OAAO;oBACL,MAAM,EACJ,aAAa,cAAc,CAAC,OAAO,CAAC,4BAA4B;wBAChE,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC;wBAC5B,0BAA0B,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE;iBACrD,CAAA;YACH,CAAC;YACD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;QAC5B,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/tm/ptc.d.ts
DELETED
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* tm_ptc_run — programmatic batch orchestration (M1–M3 all shipped).
|
|
3
|
-
*
|
|
4
|
-
* Design: .git/opencode-team/.../ptc-run/02-architect-ptc-run-design.md §2/§3/§4/§6.
|
|
5
|
-
* M1 contract: args schema, the frozen `PtcEngine` seam, the StepGate failure
|
|
6
|
-
* governance (error / call / time budgets, ≤1 retry on idempotent phases,
|
|
7
|
-
* produced-output preservation), the five-state status enum, the char-pinned
|
|
8
|
-
* aggregation summary, composite step numbers (`sXXXX.kNN`) and the
|
|
9
|
-
* trajectory event shapes.
|
|
10
|
-
* M2 engines: WorkerEngine (worker_threads + MessagePort RPC, env:{},
|
|
11
|
-
* resourceLimits, hard `terminate()` wall-clock kill; bootstrap as a
|
|
12
|
-
* build-time string), InlineVmEngine (node:vm runInNewContext fallback —
|
|
13
|
-
* the script timeout kills pre-await synchronous busy-loops; a post-await
|
|
14
|
-
* busy loop blocks the host event loop irrecoverably, documented —
|
|
15
|
-
* prefer worker/auto), InlineSequentialEngine (M1 legacy, test-only).
|
|
16
|
-
* staticPscan is wired as
|
|
17
|
-
* the FIRST gate — banned tokens reject before any engine runs (in both
|
|
18
|
-
* runPtc and the tool execute path).
|
|
19
|
-
* M3 registration: tm/index merges tm_ptc_run into the `tools` map; since
|
|
20
|
-
* v1.5.4 ALL SIX agents carry the allow (team included — CHANGELOG 1.5.4).
|
|
21
|
-
*
|
|
22
|
-
* Engine selection: TM_PTC_ENGINE=auto (default) | worker | inline. auto
|
|
23
|
-
* runs worker-first; an engine-error re-runs the WHOLE program on
|
|
24
|
-
* InlineVmEngine (bridged calls are read-only, so a re-run is safe; the
|
|
25
|
-
* fallback starts with fresh call/error budgets under the SAME wall-clock
|
|
26
|
-
* deadline) and marks `degraded-engine` in the summary.
|
|
27
|
-
*
|
|
28
|
-
* Governance is REUSED, never forked (D6 lock): the inline bridge calls the
|
|
29
|
-
* exact four exported pipelines (`buildPipelines`), so threshold offload,
|
|
30
|
-
* P2/P3, R6 and handle/TTL semantics apply to every bridged call verbatim.
|
|
31
|
-
* PTC is NOT a bypass layer.
|
|
32
|
-
*/
|
|
33
|
-
import type { ToolDefinition } from "../types.js";
|
|
34
|
-
import { type TmConfig } from "./config.js";
|
|
35
|
-
import type { RunStore } from "./store.js";
|
|
36
|
-
import { tmError, type TmPipelines, type TmPhase } from "./tools.js";
|
|
37
|
-
/** The five PTC run statuses (design §2). */
|
|
38
|
-
export declare const PTC_STATUS_VALUES: readonly ["ok", "stopped-error-budget", "stopped-call-budget", "timeout", "engine-error"];
|
|
39
|
-
export type PtcStatus = (typeof PTC_STATUS_VALUES)[number];
|
|
40
|
-
export type BridgeTool = "tm_read" | "tm_grep" | "tm_bash" | "tm_fetch";
|
|
41
|
-
/** Bridge allow set — read-only; tm_ptc_run itself is excluded (no nesting). */
|
|
42
|
-
export declare const BRIDGE_ALLOW: readonly BridgeTool[];
|
|
43
|
-
/** Phases safe to retry once (idempotent read-only bridges; design §4.2). */
|
|
44
|
-
export declare const RETRYABLE_PHASES: readonly TmPhase[];
|
|
45
|
-
/** Error body the bridge surfaces (T1.4 shape: tool/phase/message/line?). */
|
|
46
|
-
export interface PtcErrorBody {
|
|
47
|
-
tool: string;
|
|
48
|
-
phase: TmPhase;
|
|
49
|
-
message: string;
|
|
50
|
-
line?: number;
|
|
51
|
-
}
|
|
52
|
-
/** A single bridged-call outcome (design §2 program protocol). */
|
|
53
|
-
export type PtcCallResult = {
|
|
54
|
-
ok: true;
|
|
55
|
-
data: unknown;
|
|
56
|
-
} | {
|
|
57
|
-
ok: false;
|
|
58
|
-
error: PtcErrorBody;
|
|
59
|
-
};
|
|
60
|
-
/** The bridge the engine drives — in M1 it wraps the four pipelines. */
|
|
61
|
-
export interface PtcBridge {
|
|
62
|
-
call(tool: BridgeTool, args: Record<string, unknown>): Promise<PtcCallResult>;
|
|
63
|
-
}
|
|
64
|
-
/** Parent → engine: run the program. */
|
|
65
|
-
export interface PtcRunRequest {
|
|
66
|
-
program: string;
|
|
67
|
-
/** monotonic token so a caller can correlate a call with its response. */
|
|
68
|
-
startDeadlineMs: number;
|
|
69
|
-
}
|
|
70
|
-
/** Engine → driver: a single bridged call to execute under the gate. */
|
|
71
|
-
export interface PtcRpcRequest {
|
|
72
|
-
t: "call";
|
|
73
|
-
id: number;
|
|
74
|
-
tool: BridgeTool;
|
|
75
|
-
args: Record<string, unknown>;
|
|
76
|
-
}
|
|
77
|
-
/** Driver → engine: the gated result of a call. */
|
|
78
|
-
export interface PtcRpcResponse {
|
|
79
|
-
t: "result";
|
|
80
|
-
id: number;
|
|
81
|
-
r: PtcCallResult;
|
|
82
|
-
}
|
|
83
|
-
/** Driver → engine: stop the run (budget / time hit); engine must unwind. */
|
|
84
|
-
export interface PtcRpcAbort {
|
|
85
|
-
t: "abort";
|
|
86
|
-
id: number;
|
|
87
|
-
reason: "timeout" | "error-budget" | "call-budget";
|
|
88
|
-
}
|
|
89
|
-
export type PtcEngineMessage = PtcRpcRequest | PtcRpcResponse | PtcRpcAbort;
|
|
90
|
-
export type PtcEngineName = "worker" | "inline";
|
|
91
|
-
/** The engine seam. M1 ships `InlineSequentialEngine`; M2 adds `WorkerEngine`
|
|
92
|
-
* (over MessagePort) with the SAME shape, so neither the driver nor the
|
|
93
|
-
* contract changes across milestones. */
|
|
94
|
-
export interface PtcEngine {
|
|
95
|
-
readonly name: PtcEngineName;
|
|
96
|
-
/**
|
|
97
|
-
* Run `program`, driving every bridge call through `bridge` (already
|
|
98
|
-
* gate-wrapped by the driver). Resolve with the program's return value;
|
|
99
|
-
* reject with a `PtcStopSignal` for a budget/time stop, or any other Error
|
|
100
|
-
* for an engine/program fault. `signal` lets the driver race a timeout.
|
|
101
|
-
*/
|
|
102
|
-
run(program: string, bridge: PtcBridge, signal: AbortSignal): Promise<unknown>;
|
|
103
|
-
}
|
|
104
|
-
export interface PtcBudgets {
|
|
105
|
-
maxCalls: number;
|
|
106
|
-
maxErrors: number;
|
|
107
|
-
timeoutMs: number;
|
|
108
|
-
}
|
|
109
|
-
export interface PtcCallerBudgets {
|
|
110
|
-
max_calls?: unknown;
|
|
111
|
-
max_errors?: unknown;
|
|
112
|
-
timeout_ms?: unknown;
|
|
113
|
-
}
|
|
114
|
-
export declare function resolvePtcBudgets(cfg: TmConfig, budgets: PtcCallerBudgets | undefined | null): PtcBudgets;
|
|
115
|
-
export declare const PTC_LABEL_MAX = 80;
|
|
116
|
-
export interface PtcValidArgs {
|
|
117
|
-
program: string;
|
|
118
|
-
label: string;
|
|
119
|
-
budgets: PtcBudgets;
|
|
120
|
-
}
|
|
121
|
-
export type PtcArgsResult = {
|
|
122
|
-
ok: true;
|
|
123
|
-
args: PtcValidArgs;
|
|
124
|
-
} | {
|
|
125
|
-
ok: false;
|
|
126
|
-
error: ReturnType<typeof tmError>;
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Validate + normalize tm_ptc_run args. `program` over the length cap is a
|
|
130
|
-
* hard args error (a program cannot be meaningfully truncated); `label` over
|
|
131
|
-
* 80 is truncated; `budgets` are clamped toward the env ceilings.
|
|
132
|
-
*/
|
|
133
|
-
export declare function parsePtcArgs(raw: Record<string, unknown> | undefined, cfg: TmConfig): PtcArgsResult;
|
|
134
|
-
/** Static scan of a program string — the FIRST gate: runPtc and
|
|
135
|
-
* buildPtcRunTool both reject a rejected program before any engine runs. */
|
|
136
|
-
export declare function staticPscan(program: string): {
|
|
137
|
-
rejected: boolean;
|
|
138
|
-
tokens: string[];
|
|
139
|
-
};
|
|
140
|
-
export interface PtcStepRecord {
|
|
141
|
-
n: number;
|
|
142
|
-
tool: BridgeTool;
|
|
143
|
-
ok: boolean;
|
|
144
|
-
ms: number;
|
|
145
|
-
/** ok rows: estimated tokens (inline text) or the offload handle's tokens. */
|
|
146
|
-
tokens: number;
|
|
147
|
-
/** ok rows: "inline" or a short ref code for an offloaded payload. */
|
|
148
|
-
dest: string;
|
|
149
|
-
/** ok rows: the offload ref (when the data was a handle), else null. */
|
|
150
|
-
ref?: string | null;
|
|
151
|
-
/** err rows only. */
|
|
152
|
-
phase?: TmPhase;
|
|
153
|
-
line?: number;
|
|
154
|
-
retry?: boolean;
|
|
155
|
-
message?: string;
|
|
156
|
-
errorRef?: string;
|
|
157
|
-
}
|
|
158
|
-
export interface PtcRunOutcome {
|
|
159
|
-
label: string;
|
|
160
|
-
status: PtcStatus;
|
|
161
|
-
steps: PtcStepRecord[];
|
|
162
|
-
okCount: number;
|
|
163
|
-
errCount: number;
|
|
164
|
-
retries: number;
|
|
165
|
-
calls: number;
|
|
166
|
-
ms: number;
|
|
167
|
-
engine: PtcEngineName;
|
|
168
|
-
degraded: boolean;
|
|
169
|
-
returnValue: unknown;
|
|
170
|
-
returned: boolean;
|
|
171
|
-
/** set when the program threw (status=engine-error). */
|
|
172
|
-
engineError?: PtcErrorBody;
|
|
173
|
-
parentStepId: string;
|
|
174
|
-
}
|
|
175
|
-
export declare class InlineSequentialEngine implements PtcEngine {
|
|
176
|
-
readonly name: PtcEngineName;
|
|
177
|
-
run(program: string, bridge: PtcBridge, signal: AbortSignal): Promise<unknown>;
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Worker engine — runs the program in a dedicated `worker_threads.Worker`
|
|
181
|
-
* with `env:{}` (process.env emptied), `resourceLimits`, and `terminate()`
|
|
182
|
-
* for hard timeout kills. The bootstrap source is a build-time template
|
|
183
|
-
* string constant (zero runtime file IO, zero new deps, passes tsc).
|
|
184
|
-
*
|
|
185
|
-
* Probe result (P1, %TEMP%): ALL-GREEN on Node 24 / win32 — eval bootstrap,
|
|
186
|
-
* postMessage bidirectional, terminate (9 ms), resourceLimits, env:{} all
|
|
187
|
-
* verified. Auto chain = worker-first, inline fallback.
|
|
188
|
-
*/
|
|
189
|
-
export declare class WorkerEngine implements PtcEngine {
|
|
190
|
-
readonly name: PtcEngineName;
|
|
191
|
-
run(program: string, bridge: PtcBridge, signal: AbortSignal): Promise<unknown>;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Inline-vm engine — runs the program inside `node:vm` via
|
|
195
|
-
* `runInNewContext` with a script-level execution timeout. Measured on
|
|
196
|
-
* Node 24/win32: `compileFunction`'s `timeout` does NOT interrupt a busy
|
|
197
|
-
* loop when the compiled function is invoked (the call blocks the main
|
|
198
|
-
* thread forever), while the async-IIFE + `runInNewContext` shape DOES —
|
|
199
|
-
* a synchronous busy loop before the first `await` is killed ("Script
|
|
200
|
-
* execution timed out").
|
|
201
|
-
*
|
|
202
|
-
* KNOWN RESIDUAL RISK (design §3, declared): a busy loop AFTER the first
|
|
203
|
-
* `await` runs in a microtask continuation that blocks the host event
|
|
204
|
-
* loop — no timer can fire, so NOTHING reclaims the main thread. This is
|
|
205
|
-
* inherent to any main-thread execution (InlineSequentialEngine shares
|
|
206
|
-
* it); the primary worker engine does not share it (`terminate()` runs on
|
|
207
|
-
* a separate thread) — prefer worker/auto in production.
|
|
208
|
-
*/
|
|
209
|
-
export declare class InlineVmEngine implements PtcEngine {
|
|
210
|
-
readonly name: PtcEngineName;
|
|
211
|
-
/** Script execution timeout in ms (kills pre-await synchronous
|
|
212
|
-
* busy-loops). Injectable so tests can pin the kill fast. */
|
|
213
|
-
private readonly compileTimeoutMs;
|
|
214
|
-
constructor(compileTimeoutMs?: number);
|
|
215
|
-
run(program: string, bridge: PtcBridge, signal: AbortSignal): Promise<unknown>;
|
|
216
|
-
}
|
|
217
|
-
interface GateState {
|
|
218
|
-
calls: number;
|
|
219
|
-
errors: number;
|
|
220
|
-
retries: number;
|
|
221
|
-
steps: PtcStepRecord[];
|
|
222
|
-
stopReason?: "timeout" | "error-budget" | "call-budget";
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Wrap a raw bridge with the StepGate. Every call: enforce time/call budget
|
|
226
|
-
* (throw a stop that unwinds the program), assign a composite step id
|
|
227
|
-
* `parent.kNN`, retry ≤1 on idempotent phases, record + persist errors, and
|
|
228
|
-
* trip the error budget. The gate lives ONLY here (outside the engine), per
|
|
229
|
-
* design §3 ("决策进代码").
|
|
230
|
-
*/
|
|
231
|
-
export declare function createGateBridge(raw: PtcBridge, parent: string, budgets: PtcBudgets, state: GateState, opts: {
|
|
232
|
-
now: () => number;
|
|
233
|
-
deadlineAt: number;
|
|
234
|
-
store?: RunStore;
|
|
235
|
-
trajectoryParent?: string;
|
|
236
|
-
}): PtcBridge;
|
|
237
|
-
export interface EngineSelection {
|
|
238
|
-
engine: PtcEngine;
|
|
239
|
-
/** true when the auto chain degraded from worker to inline. */
|
|
240
|
-
degraded: boolean;
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Select the PTC engine based on the TM_PTC_ENGINE mode.
|
|
244
|
-
* - "worker": WorkerEngine only (throws on failure → engine-error status).
|
|
245
|
-
* - "inline": InlineVmEngine only (vm timeout for sync busy-loops).
|
|
246
|
-
* - "auto" (default): try WorkerEngine first; on failure → InlineVmEngine
|
|
247
|
-
* with `degraded=true` (marked `degraded-engine` in the summary).
|
|
248
|
-
*
|
|
249
|
-
* Probe result (P1, %TEMP%): ALL-GREEN on Node 24/win32 — auto chain =
|
|
250
|
-
* worker-first, inline fallback. Design §3 table.
|
|
251
|
-
*/
|
|
252
|
-
export declare function selectEngine(mode: "auto" | "worker" | "inline", bridge: PtcBridge): EngineSelection;
|
|
253
|
-
export interface RunPtcOptions {
|
|
254
|
-
program: string;
|
|
255
|
-
label: string;
|
|
256
|
-
budgets: PtcBudgets;
|
|
257
|
-
parentStepId: string;
|
|
258
|
-
cfg: TmConfig;
|
|
259
|
-
store?: RunStore;
|
|
260
|
-
bridge: PtcBridge;
|
|
261
|
-
engine?: PtcEngine;
|
|
262
|
-
now?: () => number;
|
|
263
|
-
}
|
|
264
|
-
export declare function runPtc(o: RunPtcOptions): Promise<PtcRunOutcome>;
|
|
265
|
-
export declare const PTC_SUMMARY_HEADER = "PTC \u6458\u8981";
|
|
266
|
-
export declare const PTC_OK_SECTION = "-- \u6210\u529F\u5206\u90E8\uFF08\u22648 \u884C\uFF0C\u8D85\u51FA\u6574\u8868\u5378\u8F7D\uFF09";
|
|
267
|
-
export declare const PTC_OK_HEADER = " # tool ms tokens \u843D\u70B9(inline|ref \u77ED\u7801)";
|
|
268
|
-
export declare const PTC_ERR_SECTION = "-- \u9519\u8BEF\u5206\u90E8\uFF08\u5168\u91CF\u9519\u8BEF\u5DF2\u843D run store\uFF09";
|
|
269
|
-
export declare const PTC_ERR_HEADER = " # tool phase line retry message(\u622A\u65AD)";
|
|
270
|
-
export declare const PTC_RETURN_PREFIX = "\u8FD4\u56DE\u503C: ";
|
|
271
|
-
export declare const PTC_ERRORFULL_PREFIX = "\u9519\u8BEF\u5168\u6587: ";
|
|
272
|
-
/** Render the fixed-shape aggregation summary. `offload` is used to route an
|
|
273
|
-
* oversized success/error table (or return value) to a run-store handle. */
|
|
274
|
-
export declare function renderPtcSummary(o: PtcRunOutcome, offload?: (content: string, kind: string) => string): string;
|
|
275
|
-
/**
|
|
276
|
-
* Real M1 bridge: delegate each call to the corresponding exported pipeline,
|
|
277
|
-
* `ctx` passed through untouched, and normalize the pipeline's `unknown`
|
|
278
|
-
* result into `PtcCallResult` (TmErrorBody -> ok:false; anything else -> the
|
|
279
|
-
* already-governed data). Governance is entirely the pipelines'.
|
|
280
|
-
*/
|
|
281
|
-
export declare function pipelineBridge(pipelines: TmPipelines, ctx: unknown): PtcBridge;
|
|
282
|
-
/** Build the tm_ptc_run ToolDefinition. Registered in the tool segment
|
|
283
|
-
* when the agent's whitelist grants tm_ptc_run (M3). `deps.args` is the
|
|
284
|
-
* ZodRawShape from tools.buildPtcArgsSchema() when zod is available — the
|
|
285
|
-
* descriptor fallback below keeps the tool usable without zod. */
|
|
286
|
-
export declare function buildPtcRunTool(deps: {
|
|
287
|
-
cfg: TmConfig;
|
|
288
|
-
store: RunStore;
|
|
289
|
-
nextStepId: () => string;
|
|
290
|
-
ctx: unknown;
|
|
291
|
-
accessToken: string;
|
|
292
|
-
args?: Record<string, unknown>;
|
|
293
|
-
engine?: PtcEngine;
|
|
294
|
-
pipelines?: TmPipelines;
|
|
295
|
-
bridge?: PtcBridge;
|
|
296
|
-
}): ToolDefinition;
|
|
297
|
-
export {};
|
|
298
|
-
//# sourceMappingURL=ptc.d.ts.map
|
package/dist/tm/ptc.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ptc.d.ts","sourceRoot":"","sources":["../../src/tm/ptc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,aAAa,CAAA;AAC7D,OAAO,EAA0C,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAE1C,OAAO,EAAE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,OAAO,EAAE,MAAM,YAAY,CAAA;AAIpE,6CAA6C;AAC7C,eAAO,MAAM,iBAAiB,2FAMpB,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE1D,MAAM,MAAM,UAAU,GAAG,SAAS,G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