@te-river/opencode-team-mode 1.5.12 → 1.5.14
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 +30 -6
- package/README.zh-CN.md +28 -4
- package/dist/agents.d.ts +5 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +24 -2
- package/dist/agents.js.map +1 -1
- package/dist/capabilities.d.ts +66 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +165 -0
- package/dist/capabilities.js.map +1 -0
- 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 +103 -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 +71 -8
- 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 +51 -2
- package/dist/prompts/shared.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 +38 -17
- package/dist/prompts/specialists.js.map +1 -1
- package/dist/tm/args-schema.d.ts +7 -1
- package/dist/tm/args-schema.d.ts.map +1 -1
- package/dist/tm/args-schema.js +9 -3
- 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 +91 -5
- package/dist/tm/browser.d.ts.map +1 -1
- package/dist/tm/browser.js +564 -89
- package/dist/tm/browser.js.map +1 -1
- package/dist/tm/cache.d.ts +68 -0
- package/dist/tm/cache.d.ts.map +1 -0
- package/dist/tm/cache.js +157 -0
- package/dist/tm/cache.js.map +1 -0
- package/dist/tm/config.d.ts +87 -0
- package/dist/tm/config.d.ts.map +1 -1
- package/dist/tm/config.js +66 -0
- package/dist/tm/config.js.map +1 -1
- package/dist/tm/dispatch.d.ts +123 -0
- package/dist/tm/dispatch.d.ts.map +1 -0
- package/dist/tm/dispatch.js +476 -0
- package/dist/tm/dispatch.js.map +1 -0
- package/dist/tm/dupe-guard.d.ts +58 -0
- package/dist/tm/dupe-guard.d.ts.map +1 -0
- package/dist/tm/dupe-guard.js +105 -0
- package/dist/tm/dupe-guard.js.map +1 -0
- package/dist/tm/index.d.ts +32 -4
- package/dist/tm/index.d.ts.map +1 -1
- package/dist/tm/index.js +58 -5
- package/dist/tm/index.js.map +1 -1
- package/dist/tm/perm-ask.d.ts +1 -0
- package/dist/tm/perm-ask.d.ts.map +1 -1
- package/dist/tm/perm-ask.js +15 -1
- package/dist/tm/perm-ask.js.map +1 -1
- package/dist/tm/pipelines.d.ts.map +1 -1
- package/dist/tm/pipelines.js +11 -0
- package/dist/tm/pipelines.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 +56 -7
- package/dist/tm/search.d.ts.map +1 -1
- package/dist/tm/search.js +195 -41
- package/dist/tm/search.js.map +1 -1
- package/dist/tm/stats.d.ts +117 -0
- package/dist/tm/stats.d.ts.map +1 -0
- package/dist/tm/stats.js +296 -0
- package/dist/tm/stats.js.map +1 -0
- package/dist/tm/webfetch.d.ts +23 -0
- package/dist/tm/webfetch.d.ts.map +1 -1
- package/dist/tm/webfetch.js +97 -8
- 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 +2 -2
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-hook leverage beyond the tool surface (2026-09-18 audit follow-up).
|
|
3
|
+
*
|
|
4
|
+
* Everything here rides an ALREADY-PUBLISHED plugin hook — no host source is
|
|
5
|
+
* touched — and each knob is independently switchable, because this host's
|
|
6
|
+
* d.ts has promised surfaces the runtime never delivered (`permission.ask`
|
|
7
|
+
* is declared and never fires on 1.18.29/30). So: pure decisions in one
|
|
8
|
+
* place, adapters that never throw and never mutate unless the payload has
|
|
9
|
+
* the exact shape we verified.
|
|
10
|
+
*
|
|
11
|
+
* The four hooks implemented here:
|
|
12
|
+
* - `tool.definition` → append OUR discipline to a built-in
|
|
13
|
+
* tool's OWN description, where the model decides (a bash timeout rule
|
|
14
|
+
* buried in a system prompt loses to one printed next to the parameter);
|
|
15
|
+
* - `chat.params` → per-agent sampling overrides
|
|
16
|
+
* (off by default: "all agents at 0.2" is a documented project
|
|
17
|
+
* invariant, so changing it is the user's call, not ours);
|
|
18
|
+
* - `experimental.session.compacting`
|
|
19
|
+
* + `experimental.compaction.autocontinue` → keep the reply skeleton and
|
|
20
|
+
* the handle rules ALIVE across a compaction, instead of letting the
|
|
21
|
+
* summarizer invent its own contract;
|
|
22
|
+
* - `shell.env` → NO_COLOR/TERM=dumb for every child
|
|
23
|
+
* shell (ANSI escapes in npm/cargo/pytest output are pure context
|
|
24
|
+
* tokens), plus an explicit operator passthrough.
|
|
25
|
+
*
|
|
26
|
+
* Deliberately NOT here: `experimental.chat.messages.transform`. Rewriting
|
|
27
|
+
* the outgoing message array means guessing the live shape of tool results
|
|
28
|
+
* at that layer; a wrong guess silently deletes the evidence the EVIDENCE
|
|
29
|
+
* line depends on. It needs a live host probe first, not a plausible patch.
|
|
30
|
+
*/
|
|
31
|
+
export declare const HOOK_ENV_DEFAULTS: {
|
|
32
|
+
readonly toolHints: "on";
|
|
33
|
+
readonly agentTemperature: "off";
|
|
34
|
+
readonly compactionContext: "on";
|
|
35
|
+
readonly compactionAutoContinue: "on";
|
|
36
|
+
readonly shellNoColor: "on";
|
|
37
|
+
};
|
|
38
|
+
type EnvLike = Record<string, string | undefined>;
|
|
39
|
+
/** The on/off switches the plugin entry needs before building adapters. */
|
|
40
|
+
export declare function hookSwitches(env?: EnvLike): {
|
|
41
|
+
toolHints: boolean;
|
|
42
|
+
compactionContext: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Footers appended to a built-in tool's description, keyed by tool id.
|
|
46
|
+
* Short, imperative, and about THIS plugin's guarantees — the point is that
|
|
47
|
+
* the model reads it at the call site, not thousands of tokens earlier.
|
|
48
|
+
*/
|
|
49
|
+
export declare const TOOL_HINTS: Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* The `tool.definition` adapter. Returns true when it appended (so the
|
|
52
|
+
* caller can log it). Idempotent: a re-issued description that already
|
|
53
|
+
* carries the marker is left byte-exact, and the host description is never
|
|
54
|
+
* replaced — only extended.
|
|
55
|
+
*/
|
|
56
|
+
export declare function applyToolDefinition(input: unknown, output: unknown, enabled?: boolean): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Sampling per role, ONLY when the operator opts in. architect is the one
|
|
59
|
+
* role whose job (design alternatives) genuinely suffers at 0.2; the
|
|
60
|
+
* mechanical roles stay cold — a specialist that hallucinates a file path
|
|
61
|
+
* costs the whole team a round.
|
|
62
|
+
*/
|
|
63
|
+
export declare const AGENT_TEMPERATURES: Record<string, number>;
|
|
64
|
+
/**
|
|
65
|
+
* `TM_AGENT_TEMPERATURE` = off | on | `agent=value;agent=value`.
|
|
66
|
+
* Returns the temperature to force, or null to leave the host's value alone.
|
|
67
|
+
* A malformed table resolves to null rather than half-applying garbage.
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveAgentTemperature(agent: unknown, env?: EnvLike): number | null;
|
|
70
|
+
/** The `chat.params` adapter: only `temperature` is touched, and only when
|
|
71
|
+
* this agent has an override. */
|
|
72
|
+
export declare function applyChatParams(input: unknown, output: unknown, env?: EnvLike): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Context lines handed to the host's compaction summarizer
|
|
75
|
+
* (`experimental.session.compacting` → `output.context[]`). We ADD to the
|
|
76
|
+
* default prompt and never replace it: setting `output.prompt` would void
|
|
77
|
+
* whatever the host itself learns to preserve, and the summarizer would stop
|
|
78
|
+
* being the host's.
|
|
79
|
+
*
|
|
80
|
+
* Each line corresponds to a thing that, once summarized away, cannot be
|
|
81
|
+
* re-derived without spending a round to rediscover it:
|
|
82
|
+
* - the reply skeleton — prose instead of STATUS:/CHANGES/… makes the
|
|
83
|
+
* lead's machine check fail for the rest of the session;
|
|
84
|
+
* - offload handles (ref/access_token/expire_at) — they are the ONLY
|
|
85
|
+
* window onto a payload that never entered context;
|
|
86
|
+
* - child session ids from tm_dispatch — an uncollected dispatch is
|
|
87
|
+
* running work, and after a summary it looks indistinguishably like done
|
|
88
|
+
* work;
|
|
89
|
+
* - provenance (file:line / URL + confidence) — without it a finding
|
|
90
|
+
* degrades into model memory, the one thing this project refuses;
|
|
91
|
+
* - the todo list and board paths — the state lives there, not in chat.
|
|
92
|
+
*/
|
|
93
|
+
export declare const COMPACTION_CONTEXT: string[];
|
|
94
|
+
/** The `experimental.session.compacting` adapter — additive, idempotent. */
|
|
95
|
+
export declare function applySessionCompacting(output: unknown, enabled?: boolean): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* `experimental.compaction.autocontinue`. Left ALONE by default: the host
|
|
98
|
+
* resuming after a summary is what keeps a long pipeline moving, and
|
|
99
|
+
* stopping mid-flight without being asked is a worse surprise than a
|
|
100
|
+
* continued one. `TM_COMPACTION_AUTOCONTINUE=off` opts out — then the run
|
|
101
|
+
* pauses for the user to re-read state before anything touches files again.
|
|
102
|
+
*/
|
|
103
|
+
export declare function applyCompactionAutoContinue(output: unknown, env?: EnvLike): boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Environment for every child shell. NO_COLOR/TERM=dumb is a token saving
|
|
106
|
+
* with no functional cost (an agent reading a progress bar reads nothing),
|
|
107
|
+
* and `TM_SHELL_ENV` is the explicit operator passthrough (`K=V;K2=V2`) —
|
|
108
|
+
* deliberately allowlisted rather than forwarding process env, so this hook
|
|
109
|
+
* can never become a side channel for secrets into a sub-agent's shell.
|
|
110
|
+
*/
|
|
111
|
+
export declare function resolveShellEnv(env?: EnvLike): Record<string, string>;
|
|
112
|
+
/** The `shell.env` adapter. Never deletes an existing key the host set. */
|
|
113
|
+
export declare function applyShellEnv(output: unknown, env?: EnvLike): boolean;
|
|
114
|
+
export {};
|
|
115
|
+
//# sourceMappingURL=host-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-hooks.d.ts","sourceRoot":"","sources":["../src/host-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAA;AAEV,KAAK,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAOjD,2EAA2E;AAC3E,wBAAgB,YAAY,CAAC,GAAG,GAAE,OAAqB,GAAG;IAAE,SAAS,EAAE,OAAO,CAAC;IAAC,iBAAiB,EAAE,OAAO,CAAA;CAAE,CAK3G;AAID;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK7C,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,OAAO,EACf,OAAO,UAAO,GACb,OAAO,CAeT;AAID;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAOrD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,GAAE,OAAqB,GAAG,MAAM,GAAG,IAAI,CAkBjG;AAED;kCACkC;AAClC,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAE,OAAqB,GAAG,OAAO,CAWpG;AAID;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,UAM9B,CAAA;AAED,4EAA4E;AAC5E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,UAAO,GAAG,OAAO,CAkB/E;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAE,OAAqB,GAAG,OAAO,CAUhG;AAID;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,GAAE,OAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgBlF;AAED,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,GAAE,OAAqB,GAAG,OAAO,CAkBlF"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host-hook leverage beyond the tool surface (2026-09-18 audit follow-up).
|
|
3
|
+
*
|
|
4
|
+
* Everything here rides an ALREADY-PUBLISHED plugin hook — no host source is
|
|
5
|
+
* touched — and each knob is independently switchable, because this host's
|
|
6
|
+
* d.ts has promised surfaces the runtime never delivered (`permission.ask`
|
|
7
|
+
* is declared and never fires on 1.18.29/30). So: pure decisions in one
|
|
8
|
+
* place, adapters that never throw and never mutate unless the payload has
|
|
9
|
+
* the exact shape we verified.
|
|
10
|
+
*
|
|
11
|
+
* The four hooks implemented here:
|
|
12
|
+
* - `tool.definition` → append OUR discipline to a built-in
|
|
13
|
+
* tool's OWN description, where the model decides (a bash timeout rule
|
|
14
|
+
* buried in a system prompt loses to one printed next to the parameter);
|
|
15
|
+
* - `chat.params` → per-agent sampling overrides
|
|
16
|
+
* (off by default: "all agents at 0.2" is a documented project
|
|
17
|
+
* invariant, so changing it is the user's call, not ours);
|
|
18
|
+
* - `experimental.session.compacting`
|
|
19
|
+
* + `experimental.compaction.autocontinue` → keep the reply skeleton and
|
|
20
|
+
* the handle rules ALIVE across a compaction, instead of letting the
|
|
21
|
+
* summarizer invent its own contract;
|
|
22
|
+
* - `shell.env` → NO_COLOR/TERM=dumb for every child
|
|
23
|
+
* shell (ANSI escapes in npm/cargo/pytest output are pure context
|
|
24
|
+
* tokens), plus an explicit operator passthrough.
|
|
25
|
+
*
|
|
26
|
+
* Deliberately NOT here: `experimental.chat.messages.transform`. Rewriting
|
|
27
|
+
* the outgoing message array means guessing the live shape of tool results
|
|
28
|
+
* at that layer; a wrong guess silently deletes the evidence the EVIDENCE
|
|
29
|
+
* line depends on. It needs a live host probe first, not a plausible patch.
|
|
30
|
+
*/
|
|
31
|
+
export const HOOK_ENV_DEFAULTS = {
|
|
32
|
+
toolHints: "on",
|
|
33
|
+
agentTemperature: "off",
|
|
34
|
+
compactionContext: "on",
|
|
35
|
+
compactionAutoContinue: "on",
|
|
36
|
+
shellNoColor: "on",
|
|
37
|
+
};
|
|
38
|
+
const isOn = (raw, def) => {
|
|
39
|
+
const v = String(raw ?? "").trim().toLowerCase();
|
|
40
|
+
if (v === "")
|
|
41
|
+
return def === "on";
|
|
42
|
+
return !(v === "off" || v === "0" || v === "false" || v === "no");
|
|
43
|
+
};
|
|
44
|
+
/** The on/off switches the plugin entry needs before building adapters. */
|
|
45
|
+
export function hookSwitches(env = process.env) {
|
|
46
|
+
return {
|
|
47
|
+
toolHints: isOn(env.TM_TOOL_HINTS, HOOK_ENV_DEFAULTS.toolHints),
|
|
48
|
+
compactionContext: isOn(env.TM_COMPACTION_CONTEXT, HOOK_ENV_DEFAULTS.compactionContext),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/* ---------- tool.definition ---------- */
|
|
52
|
+
/**
|
|
53
|
+
* Footers appended to a built-in tool's description, keyed by tool id.
|
|
54
|
+
* Short, imperative, and about THIS plugin's guarantees — the point is that
|
|
55
|
+
* the model reads it at the call site, not thousands of tokens earlier.
|
|
56
|
+
*/
|
|
57
|
+
export const TOOL_HINTS = {
|
|
58
|
+
bash: "\n\n[OpenCode TeamMode] Time discipline: leave `timeout` out unless this step is genuinely slow — the default kill is 120 s and a bigger number only lengthens the silence, a read-only probe (ls/grep/rg/cat/Get-ChildItem) is never a 120-second command (values above the probe ceiling are clamped before the command runs). Independent steps do NOT belong chained with `;` into one call — separate calls, or one tm_ptc_run program.",
|
|
59
|
+
task: "\n\n[OpenCode TeamMode] This blocks your session until the child returns. For independent work that must overlap your own, prefer tm_dispatch (returns at once) + tm_join (collect) and keep the brief self-contained.",
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* The `tool.definition` adapter. Returns true when it appended (so the
|
|
63
|
+
* caller can log it). Idempotent: a re-issued description that already
|
|
64
|
+
* carries the marker is left byte-exact, and the host description is never
|
|
65
|
+
* replaced — only extended.
|
|
66
|
+
*/
|
|
67
|
+
export function applyToolDefinition(input, output, enabled = true) {
|
|
68
|
+
if (!enabled)
|
|
69
|
+
return false;
|
|
70
|
+
try {
|
|
71
|
+
const toolID = String(input?.toolID ?? "").trim().toLowerCase();
|
|
72
|
+
const key = Object.keys(TOOL_HINTS).find((k) => toolID === k || toolID.endsWith(`:${k}`) || toolID.endsWith(`/${k}`));
|
|
73
|
+
if (!key)
|
|
74
|
+
return false;
|
|
75
|
+
const out = output;
|
|
76
|
+
if (!out || typeof out.description !== "string")
|
|
77
|
+
return false;
|
|
78
|
+
const marker = "[OpenCode TeamMode]";
|
|
79
|
+
if (out.description.includes(marker))
|
|
80
|
+
return false;
|
|
81
|
+
out.description = out.description + TOOL_HINTS[key];
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/* ---------- chat.params ---------- */
|
|
89
|
+
/**
|
|
90
|
+
* Sampling per role, ONLY when the operator opts in. architect is the one
|
|
91
|
+
* role whose job (design alternatives) genuinely suffers at 0.2; the
|
|
92
|
+
* mechanical roles stay cold — a specialist that hallucinates a file path
|
|
93
|
+
* costs the whole team a round.
|
|
94
|
+
*/
|
|
95
|
+
export const AGENT_TEMPERATURES = {
|
|
96
|
+
architect: 0.35,
|
|
97
|
+
researcher: 0.3,
|
|
98
|
+
team: 0.2,
|
|
99
|
+
implementer: 0.2,
|
|
100
|
+
reviewer: 0.1,
|
|
101
|
+
tester: 0.2,
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* `TM_AGENT_TEMPERATURE` = off | on | `agent=value;agent=value`.
|
|
105
|
+
* Returns the temperature to force, or null to leave the host's value alone.
|
|
106
|
+
* A malformed table resolves to null rather than half-applying garbage.
|
|
107
|
+
*/
|
|
108
|
+
export function resolveAgentTemperature(agent, env = process.env) {
|
|
109
|
+
const raw = String(env.TM_AGENT_TEMPERATURE ?? HOOK_ENV_DEFAULTS.agentTemperature).trim().toLowerCase();
|
|
110
|
+
if (raw === "" || raw === HOOK_ENV_DEFAULTS.agentTemperature)
|
|
111
|
+
return null;
|
|
112
|
+
const name = String(agent ?? "").trim().toLowerCase();
|
|
113
|
+
if (!name)
|
|
114
|
+
return null;
|
|
115
|
+
if (raw === "on" || raw === "true" || raw === "1") {
|
|
116
|
+
const t = AGENT_TEMPERATURES[name];
|
|
117
|
+
return typeof t === "number" ? t : null;
|
|
118
|
+
}
|
|
119
|
+
const table = {};
|
|
120
|
+
for (const part of raw.split(/[;,]/)) {
|
|
121
|
+
const m = /^\s*([a-z0-9_-]{1,24})\s*=\s*(\d+(?:\.\d+)?)\s*$/.exec(part);
|
|
122
|
+
if (!m)
|
|
123
|
+
return null;
|
|
124
|
+
const value = Number(m[2]);
|
|
125
|
+
if (!Number.isFinite(value) || value < 0 || value > 2)
|
|
126
|
+
return null;
|
|
127
|
+
table[m[1]] = value;
|
|
128
|
+
}
|
|
129
|
+
return typeof table[name] === "number" ? table[name] : null;
|
|
130
|
+
}
|
|
131
|
+
/** The `chat.params` adapter: only `temperature` is touched, and only when
|
|
132
|
+
* this agent has an override. */
|
|
133
|
+
export function applyChatParams(input, output, env = process.env) {
|
|
134
|
+
try {
|
|
135
|
+
const t = resolveAgentTemperature(input?.agent, env);
|
|
136
|
+
if (t === null)
|
|
137
|
+
return false;
|
|
138
|
+
const out = output;
|
|
139
|
+
if (!out || typeof out.temperature !== "number")
|
|
140
|
+
return false;
|
|
141
|
+
out.temperature = t;
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/* ---------- compaction ---------- */
|
|
149
|
+
/**
|
|
150
|
+
* Context lines handed to the host's compaction summarizer
|
|
151
|
+
* (`experimental.session.compacting` → `output.context[]`). We ADD to the
|
|
152
|
+
* default prompt and never replace it: setting `output.prompt` would void
|
|
153
|
+
* whatever the host itself learns to preserve, and the summarizer would stop
|
|
154
|
+
* being the host's.
|
|
155
|
+
*
|
|
156
|
+
* Each line corresponds to a thing that, once summarized away, cannot be
|
|
157
|
+
* re-derived without spending a round to rediscover it:
|
|
158
|
+
* - the reply skeleton — prose instead of STATUS:/CHANGES/… makes the
|
|
159
|
+
* lead's machine check fail for the rest of the session;
|
|
160
|
+
* - offload handles (ref/access_token/expire_at) — they are the ONLY
|
|
161
|
+
* window onto a payload that never entered context;
|
|
162
|
+
* - child session ids from tm_dispatch — an uncollected dispatch is
|
|
163
|
+
* running work, and after a summary it looks indistinguishably like done
|
|
164
|
+
* work;
|
|
165
|
+
* - provenance (file:line / URL + confidence) — without it a finding
|
|
166
|
+
* degrades into model memory, the one thing this project refuses;
|
|
167
|
+
* - the todo list and board paths — the state lives there, not in chat.
|
|
168
|
+
*/
|
|
169
|
+
export const COMPACTION_CONTEXT = [
|
|
170
|
+
"OpenCode TeamMode contract survives compaction: every specialist reply keeps the STATUS / CHANGES / FINDINGS / EVIDENCE / HANDOFF skeleton and the lead machine-checks it — never summarize a reply into prose without those keys.",
|
|
171
|
+
"Offloaded payloads are addressed by handle (ref + access_token + expire_at) from tm_* results. Carry the handles forward VERBATIM; never re-run a tool to rediscover a payload a handle already names.",
|
|
172
|
+
"Async dispatches (tm_dispatch) and their child session ids must survive: an uncollected child is still-running work, not finished work.",
|
|
173
|
+
"Every finding keeps its source (file:line or URL) and confidence tag after compaction, otherwise it is unverifiable memory.",
|
|
174
|
+
"The todo list and the blackboard files are the state, not the transcript: keep task items and board paths, drop chit-chat and raw command echo.",
|
|
175
|
+
];
|
|
176
|
+
/** The `experimental.session.compacting` adapter — additive, idempotent. */
|
|
177
|
+
export function applySessionCompacting(output, enabled = true) {
|
|
178
|
+
if (!enabled)
|
|
179
|
+
return false;
|
|
180
|
+
try {
|
|
181
|
+
const out = output;
|
|
182
|
+
if (!out)
|
|
183
|
+
return false;
|
|
184
|
+
if (!Array.isArray(out.context))
|
|
185
|
+
out.context = [];
|
|
186
|
+
const list = out.context;
|
|
187
|
+
let added = 0;
|
|
188
|
+
for (const line of COMPACTION_CONTEXT) {
|
|
189
|
+
if (!list.includes(line)) {
|
|
190
|
+
list.push(line);
|
|
191
|
+
added++;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return added > 0;
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* `experimental.compaction.autocontinue`. Left ALONE by default: the host
|
|
202
|
+
* resuming after a summary is what keeps a long pipeline moving, and
|
|
203
|
+
* stopping mid-flight without being asked is a worse surprise than a
|
|
204
|
+
* continued one. `TM_COMPACTION_AUTOCONTINUE=off` opts out — then the run
|
|
205
|
+
* pauses for the user to re-read state before anything touches files again.
|
|
206
|
+
*/
|
|
207
|
+
export function applyCompactionAutoContinue(output, env = process.env) {
|
|
208
|
+
try {
|
|
209
|
+
if (isOn(env.TM_COMPACTION_AUTOCONTINUE, HOOK_ENV_DEFAULTS.compactionAutoContinue))
|
|
210
|
+
return false;
|
|
211
|
+
const out = output;
|
|
212
|
+
if (!out || typeof out.enabled !== "boolean")
|
|
213
|
+
return false;
|
|
214
|
+
out.enabled = false;
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
217
|
+
catch {
|
|
218
|
+
return false;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/* ---------- shell.env ---------- */
|
|
222
|
+
/**
|
|
223
|
+
* Environment for every child shell. NO_COLOR/TERM=dumb is a token saving
|
|
224
|
+
* with no functional cost (an agent reading a progress bar reads nothing),
|
|
225
|
+
* and `TM_SHELL_ENV` is the explicit operator passthrough (`K=V;K2=V2`) —
|
|
226
|
+
* deliberately allowlisted rather than forwarding process env, so this hook
|
|
227
|
+
* can never become a side channel for secrets into a sub-agent's shell.
|
|
228
|
+
*/
|
|
229
|
+
export function resolveShellEnv(env = process.env) {
|
|
230
|
+
const out = {};
|
|
231
|
+
if (isOn(env.TM_SHELL_NO_COLOR, HOOK_ENV_DEFAULTS.shellNoColor)) {
|
|
232
|
+
out.NO_COLOR = "1";
|
|
233
|
+
out.CLANG_COLOR_MODE = "never";
|
|
234
|
+
out.TERM = "dumb";
|
|
235
|
+
}
|
|
236
|
+
const raw = String(env.TM_SHELL_ENV ?? "").trim();
|
|
237
|
+
if (raw) {
|
|
238
|
+
for (const part of raw.split(/[;]/)) {
|
|
239
|
+
const m = /^\s*([A-Za-z_][A-Za-z0-9_]{0,40})\s*=\s*(.*)$/.exec(part);
|
|
240
|
+
if (!m)
|
|
241
|
+
continue;
|
|
242
|
+
out[m[1]] = m[2].replace(/\s+$/, "");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return out;
|
|
246
|
+
}
|
|
247
|
+
/** The `shell.env` adapter. Never deletes an existing key the host set. */
|
|
248
|
+
export function applyShellEnv(output, env = process.env) {
|
|
249
|
+
try {
|
|
250
|
+
const patch = resolveShellEnv(env);
|
|
251
|
+
const out = output;
|
|
252
|
+
if (!out || Object.keys(patch).length === 0)
|
|
253
|
+
return false;
|
|
254
|
+
if (!out.env || typeof out.env !== "object")
|
|
255
|
+
out.env = {};
|
|
256
|
+
const target = out.env;
|
|
257
|
+
let added = 0;
|
|
258
|
+
for (const [k, v] of Object.entries(patch)) {
|
|
259
|
+
if (target[k] === undefined) {
|
|
260
|
+
target[k] = v;
|
|
261
|
+
added++;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
return added > 0;
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=host-hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-hooks.js","sourceRoot":"","sources":["../src/host-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,IAAI;IACf,gBAAgB,EAAE,KAAK;IACvB,iBAAiB,EAAE,IAAI;IACvB,sBAAsB,EAAE,IAAI;IAC5B,YAAY,EAAE,IAAI;CACV,CAAA;AAGV,MAAM,IAAI,GAAG,CAAC,GAAuB,EAAE,GAAW,EAAW,EAAE;IAC7D,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IAChD,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,GAAG,KAAK,IAAI,CAAA;IACjC,OAAO,CAAC,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,CAAA;AACnE,CAAC,CAAA;AAED,2EAA2E;AAC3E,MAAM,UAAU,YAAY,CAAC,MAAe,OAAO,CAAC,GAAG;IACrD,OAAO;QACL,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,SAAS,CAAC;QAC/D,iBAAiB,EAAE,IAAI,C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AC;YAC3C,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;gBAC5B,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;gBACb,KAAK,EAAE,CAAA;YACT,CAAC;QACH,CAAC;QACD,OAAO,KAAK,GAAG,CAAC,CAAA;IAClB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA8C,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,cAAc,EAA8C,MAAM,YAAY,CAAA;AAoD5F,QAAA,MAAM,MAAM,EAAE,cA4Sb,CAAA;AAED,eAAe,MAAM,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,10 @@ import { startBlackboardMaintenance, resolveTtlMs, DEFAULT_TTL_DAYS, } from "./b
|
|
|
34
34
|
import { createEnvProtectHook, parseExtraDeny, resolveEnvProtectMode, bashAskPatterns, } from "./envprotect.js";
|
|
35
35
|
import { createApprovalGate, resolveAskTimeoutMs, hasPermissionReplyCapability, } from "./approval-gate.js";
|
|
36
36
|
import { createTmTools } from "./tm/index.js";
|
|
37
|
+
import { createBashTimeoutHook } from "./tm/bash-timeout.js";
|
|
38
|
+
import { createCapabilityProbe } from "./capabilities.js";
|
|
39
|
+
import { setAskBridgeObserver } from "./tm/perm-ask.js";
|
|
40
|
+
import { applyToolDefinition, applyChatParams, applySessionCompacting, applyCompactionAutoContinue, applyShellEnv, hookSwitches, } from "./host-hooks.js";
|
|
37
41
|
/** Runtime addendum to the team prompt: concrete board + TTL (hybrid mode). */
|
|
38
42
|
function blackboardNote(root, ttlDays) {
|
|
39
43
|
return [
|
|
@@ -131,9 +135,63 @@ const plugin = {
|
|
|
131
135
|
// The R6 mode/extra resolved above are passed in so the tm_* pipelines
|
|
132
136
|
// share the SAME interception source as the built-in tools (anti-backdoor:
|
|
133
137
|
// the global hook ALSO aliases tm_* onto read/grep/bash — see envprotect).
|
|
138
|
+
// ---------- host-capability probe (see src/capabilities.ts) ----------
|
|
139
|
+
// The plugin's features degrade quietly when a host surface disappears;
|
|
140
|
+
// this records what is actually present and says so once, at startup,
|
|
141
|
+
// instead of letting an OpenCode upgrade surface as an agent working
|
|
142
|
+
// around something the user never agreed to lose.
|
|
143
|
+
let capabilityProbe = null;
|
|
134
144
|
const tmRuntime = await createTmTools(input, {
|
|
135
145
|
mode: envProtectMode,
|
|
136
146
|
extra: envProtectExtra,
|
|
147
|
+
notify: notifyAsk,
|
|
148
|
+
// The capability probe is built from the tm runtime (it needs the run
|
|
149
|
+
// store to log into), and tm_stats needs the probe back — a declaration
|
|
150
|
+
// before construction breaks the cycle without weakening either side.
|
|
151
|
+
capabilities: () => capabilityProbe?.snapshot() ?? [],
|
|
152
|
+
// A tm_dispatch child is registered the moment it is created (the
|
|
153
|
+
// message.updated route below re-confirms it): an exec-role sub-agent
|
|
154
|
+
// whose session were NOT registered would hard-throw its own protected
|
|
155
|
+
// reads instead of opening the dialog.
|
|
156
|
+
onChildSession: (sessionID, agent) => {
|
|
157
|
+
if (approvalGate && injectedExecAgents.has(agent))
|
|
158
|
+
approvalGate.registerExecSession(sessionID);
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
// ---------- host-hook switches (TM_TOOL_HINTS / TM_COMPACTION_*) ------
|
|
162
|
+
const hostSwitches = hookSwitches(process.env);
|
|
163
|
+
capabilityProbe = createCapabilityProbe({
|
|
164
|
+
client: input?.client,
|
|
165
|
+
hasShellBridge: typeof input?.$ === "function",
|
|
166
|
+
hasPermissionReply: hasPermissionReplyCapability(input?.client),
|
|
167
|
+
trajectory: (event) => tmRuntime.pipelines.store.appendTrajectory(event),
|
|
168
|
+
notify: notifyAsk,
|
|
169
|
+
});
|
|
170
|
+
// ctx.ask is only observable from inside a tool call — perm-ask reports
|
|
171
|
+
// every lookup it makes, which is how this row ever reaches 已验证.
|
|
172
|
+
setAskBridgeObserver((present) => capabilityProbe?.observeAskBridge(present));
|
|
173
|
+
// Startup report: one trajectory line always, one toast ONLY when a
|
|
174
|
+
// required surface is gone (a missing 待观察 row is not an alarm).
|
|
175
|
+
capabilityProbe.report();
|
|
176
|
+
// ---------- bash timeout clamp (issue #6, see tm/bash-timeout.ts) ------
|
|
177
|
+
const bashTimeoutHook = createBashTimeoutHook({
|
|
178
|
+
probeMs: tmRuntime.config.bashTimeoutProbeMs,
|
|
179
|
+
maxMs: tmRuntime.config.bashTimeoutMaxMs,
|
|
180
|
+
readonlyAllowed: tmRuntime.config.bashReadonlyAllowed,
|
|
181
|
+
onClamp: (info) => {
|
|
182
|
+
try {
|
|
183
|
+
tmRuntime.pipelines.store.appendTrajectory({
|
|
184
|
+
tool: "bash",
|
|
185
|
+
step_id: "timeout-clamp",
|
|
186
|
+
event: info.via,
|
|
187
|
+
from_ms: info.from,
|
|
188
|
+
to_ms: info.to,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
/* observability only */
|
|
193
|
+
}
|
|
194
|
+
},
|
|
137
195
|
});
|
|
138
196
|
return {
|
|
139
197
|
// ---------- v1 config hook: inject agents & commands ----------
|
|
@@ -182,9 +240,49 @@ const plugin = {
|
|
|
182
240
|
}
|
|
183
241
|
},
|
|
184
242
|
// ---------- R6: block the model's env-var read paths in code ----------
|
|
185
|
-
|
|
243
|
+
// ONE hook, two independent jobs (the host calls the single
|
|
244
|
+
// `tool.execute.before` slot per plugin): first clamp a wasteful
|
|
245
|
+
// model-set bash timeout, then run the R6 interception. The clamp
|
|
246
|
+
// runs BEFORE R6 so a blocked call is never also a slow one.
|
|
247
|
+
"tool.execute.before": async (input, output) => {
|
|
248
|
+
capabilityProbe?.observeHook("tool.execute.before");
|
|
249
|
+
bashTimeoutHook(input, output);
|
|
250
|
+
await envProtectHook(input, output);
|
|
251
|
+
},
|
|
252
|
+
// ---------- host-hook leverage beyond the tool surface (audit #2) ----
|
|
253
|
+
// Every one of these rides a published hook and mutates ONLY the
|
|
254
|
+
// fields whose shape is verified; each is independently switchable,
|
|
255
|
+
// because this host's d.ts has shipped surfaces the runtime never
|
|
256
|
+
// fires (permission.ask), so adapters must fail soft, not assume.
|
|
257
|
+
// The `observeHook` calls are that "not assume" made observable: a row
|
|
258
|
+
// stays 待观察 until the host actually calls the hook, and tm_stats
|
|
259
|
+
// reports it either way.
|
|
260
|
+
"tool.definition": (input, output) => {
|
|
261
|
+
capabilityProbe?.observeHook("tool.definition");
|
|
262
|
+
applyToolDefinition(input, output, hostSwitches.toolHints);
|
|
263
|
+
},
|
|
264
|
+
"chat.params": (input, output) => {
|
|
265
|
+
capabilityProbe?.observeHook("chat.params");
|
|
266
|
+
applyChatParams(input, output, process.env);
|
|
267
|
+
},
|
|
268
|
+
"experimental.session.compacting": (input, output) => {
|
|
269
|
+
capabilityProbe?.observeHook("session.compacting");
|
|
270
|
+
applySessionCompacting(output, hostSwitches.compactionContext);
|
|
271
|
+
},
|
|
272
|
+
"experimental.compaction.autocontinue": (input, output) => {
|
|
273
|
+
capabilityProbe?.observeHook("compaction.autocontinue");
|
|
274
|
+
applyCompactionAutoContinue(output, process.env);
|
|
275
|
+
},
|
|
276
|
+
"shell.env": (input, output) => {
|
|
277
|
+
capabilityProbe?.observeHook("shell.env");
|
|
278
|
+
applyShellEnv(output, process.env);
|
|
279
|
+
},
|
|
186
280
|
// ---------- unified approval gate: watch the host permission dialog ---
|
|
187
281
|
event: ({ event }) => {
|
|
282
|
+
capabilityProbe?.observeEvent(event?.type ?? "");
|
|
283
|
+
// Async dispatch bookkeeping runs FIRST and independently of R6:
|
|
284
|
+
// session.idle / .error are what tell the lead its children settled.
|
|
285
|
+
tmRuntime.observeDispatchEvent(event);
|
|
188
286
|
if (!approvalGate)
|
|
189
287
|
return;
|
|
190
288
|
// Pre-tool session registration: the live host emits message.updated
|
|
@@ -232,10 +330,11 @@ const plugin = {
|
|
|
232
330
|
}
|
|
233
331
|
}
|
|
234
332
|
},
|
|
235
|
-
dispose: () => {
|
|
333
|
+
dispose: async () => {
|
|
236
334
|
approvalGate?.dispose();
|
|
237
|
-
// tm_browser owns a browser child process — kill it on teardown
|
|
238
|
-
|
|
335
|
+
// tm_browser owns a browser child process — kill it on teardown and
|
|
336
|
+
// WAIT, or the process can exit with the window still on screen.
|
|
337
|
+
await tmRuntime.dispose();
|
|
239
338
|
},
|
|
240
339
|
// ---------- JIT layer-2: tm_read / tm_grep / tm_bash / tm_fetch ----------
|
|
241
340
|
tool: tmRuntime.tools,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,GACjB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;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