@te-river/opencode-team-mode 1.6.1 → 1.7.0

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.
Files changed (201) hide show
  1. package/README.md +117 -118
  2. package/README.zh-CN.md +98 -100
  3. package/dist/agents.d.ts.map +1 -1
  4. package/dist/agents.js +89 -79
  5. package/dist/agents.js.map +1 -1
  6. package/dist/approval-gate.d.ts +8 -9
  7. package/dist/approval-gate.d.ts.map +1 -1
  8. package/dist/approval-gate.js +13 -14
  9. package/dist/approval-gate.js.map +1 -1
  10. package/dist/capabilities.d.ts +11 -37
  11. package/dist/capabilities.d.ts.map +1 -1
  12. package/dist/capabilities.js +11 -141
  13. package/dist/capabilities.js.map +1 -1
  14. package/dist/commands.js +1 -1
  15. package/dist/envprotect/hook.d.ts +12 -31
  16. package/dist/envprotect/hook.d.ts.map +1 -1
  17. package/dist/envprotect/hook.js +13 -91
  18. package/dist/envprotect/hook.js.map +1 -1
  19. package/dist/envprotect/patterns.d.ts +6 -4
  20. package/dist/envprotect/patterns.d.ts.map +1 -1
  21. package/dist/envprotect/patterns.js +6 -4
  22. package/dist/envprotect/patterns.js.map +1 -1
  23. package/dist/envprotect.d.ts +1 -1
  24. package/dist/envprotect.d.ts.map +1 -1
  25. package/dist/envprotect.js +1 -1
  26. package/dist/envprotect.js.map +1 -1
  27. package/dist/host/note.d.ts.map +1 -1
  28. package/dist/host/note.js +8 -5
  29. package/dist/host/note.js.map +1 -1
  30. package/dist/host/v2-browser-gate.d.ts +19 -1
  31. package/dist/host/v2-browser-gate.d.ts.map +1 -1
  32. package/dist/host/v2-browser-gate.js +47 -6
  33. package/dist/host/v2-browser-gate.js.map +1 -1
  34. package/dist/host/v2-capabilities.d.ts +43 -0
  35. package/dist/host/v2-capabilities.d.ts.map +1 -1
  36. package/dist/host/v2-capabilities.js +77 -1
  37. package/dist/host/v2-capabilities.js.map +1 -1
  38. package/dist/host/v2-compaction.d.ts +129 -0
  39. package/dist/host/v2-compaction.d.ts.map +1 -0
  40. package/dist/host/v2-compaction.js +346 -0
  41. package/dist/host/v2-compaction.js.map +1 -0
  42. package/dist/host/v2-default-agent.d.ts +37 -0
  43. package/dist/host/v2-default-agent.d.ts.map +1 -0
  44. package/dist/host/v2-default-agent.js +128 -0
  45. package/dist/host/v2-default-agent.js.map +1 -0
  46. package/dist/host/v2-events.d.ts +2 -0
  47. package/dist/host/v2-events.d.ts.map +1 -1
  48. package/dist/host/v2-events.js +27 -0
  49. package/dist/host/v2-events.js.map +1 -1
  50. package/dist/host/v2-guard.d.ts +178 -0
  51. package/dist/host/v2-guard.d.ts.map +1 -1
  52. package/dist/host/v2-guard.js +324 -8
  53. package/dist/host/v2-guard.js.map +1 -1
  54. package/dist/host/v2-offload.d.ts +1 -1
  55. package/dist/host/v2-offload.js +2 -2
  56. package/dist/host/v2-permissions.d.ts +45 -44
  57. package/dist/host/v2-permissions.d.ts.map +1 -1
  58. package/dist/host/v2-permissions.js +48 -49
  59. package/dist/host/v2-permissions.js.map +1 -1
  60. package/dist/host/v2-probe-chain.d.ts +93 -0
  61. package/dist/host/v2-probe-chain.d.ts.map +1 -0
  62. package/dist/host/v2-probe-chain.js +146 -0
  63. package/dist/host/v2-probe-chain.js.map +1 -0
  64. package/dist/host/v2-prune.d.ts +157 -0
  65. package/dist/host/v2-prune.d.ts.map +1 -0
  66. package/dist/host/v2-prune.js +507 -0
  67. package/dist/host/v2-prune.js.map +1 -0
  68. package/dist/host/v2-retry.d.ts +143 -0
  69. package/dist/host/v2-retry.d.ts.map +1 -0
  70. package/dist/host/v2-retry.js +315 -0
  71. package/dist/host/v2-retry.js.map +1 -0
  72. package/dist/host/v2-scope.d.ts.map +1 -1
  73. package/dist/host/v2-scope.js +14 -7
  74. package/dist/host/v2-scope.js.map +1 -1
  75. package/dist/host/v2-session-client.d.ts +62 -7
  76. package/dist/host/v2-session-client.d.ts.map +1 -1
  77. package/dist/host/v2-session-client.js +485 -26
  78. package/dist/host/v2-session-client.js.map +1 -1
  79. package/dist/host/v2-session.d.ts +72 -1
  80. package/dist/host/v2-session.d.ts.map +1 -1
  81. package/dist/host/v2-session.js +154 -10
  82. package/dist/host/v2-session.js.map +1 -1
  83. package/dist/host/v2-tool.d.ts +2 -3
  84. package/dist/host/v2-tool.d.ts.map +1 -1
  85. package/dist/host/v2-tool.js +2 -3
  86. package/dist/host/v2-tool.js.map +1 -1
  87. package/dist/host/v2-types.d.ts +25 -0
  88. package/dist/host/v2-types.d.ts.map +1 -1
  89. package/dist/host/v2.d.ts +14 -12
  90. package/dist/host/v2.d.ts.map +1 -1
  91. package/dist/host/v2.js +648 -74
  92. package/dist/host/v2.js.map +1 -1
  93. package/dist/identity.d.ts +27 -0
  94. package/dist/identity.d.ts.map +1 -0
  95. package/dist/identity.js +34 -0
  96. package/dist/identity.js.map +1 -0
  97. package/dist/index.d.ts +9 -24
  98. package/dist/index.d.ts.map +1 -1
  99. package/dist/index.js +17 -27
  100. package/dist/index.js.map +1 -1
  101. package/dist/prompts/lead.d.ts +1 -1
  102. package/dist/prompts/lead.d.ts.map +1 -1
  103. package/dist/prompts/lead.js +44 -27
  104. package/dist/prompts/lead.js.map +1 -1
  105. package/dist/prompts/shared.d.ts +2 -2
  106. package/dist/prompts/shared.d.ts.map +1 -1
  107. package/dist/prompts/shared.js +74 -57
  108. package/dist/prompts/shared.js.map +1 -1
  109. package/dist/prompts/specialists.d.ts +2 -2
  110. package/dist/prompts/specialists.d.ts.map +1 -1
  111. package/dist/prompts/specialists.js +53 -83
  112. package/dist/prompts/specialists.js.map +1 -1
  113. package/dist/tm/args-schema.d.ts +7 -32
  114. package/dist/tm/args-schema.d.ts.map +1 -1
  115. package/dist/tm/args-schema.js +12 -153
  116. package/dist/tm/args-schema.js.map +1 -1
  117. package/dist/tm/board.d.ts +10 -9
  118. package/dist/tm/board.d.ts.map +1 -1
  119. package/dist/tm/board.js +11 -10
  120. package/dist/tm/board.js.map +1 -1
  121. package/dist/tm/config-files.d.ts +81 -0
  122. package/dist/tm/config-files.d.ts.map +1 -0
  123. package/dist/tm/config-files.js +209 -0
  124. package/dist/tm/config-files.js.map +1 -0
  125. package/dist/tm/config-layers.d.ts +117 -0
  126. package/dist/tm/config-layers.d.ts.map +1 -0
  127. package/dist/tm/config-layers.js +320 -0
  128. package/dist/tm/config-layers.js.map +1 -0
  129. package/dist/tm/config.d.ts +10 -101
  130. package/dist/tm/config.d.ts.map +1 -1
  131. package/dist/tm/config.js +17 -71
  132. package/dist/tm/config.js.map +1 -1
  133. package/dist/tm/dispatch.d.ts +154 -22
  134. package/dist/tm/dispatch.d.ts.map +1 -1
  135. package/dist/tm/dispatch.js +559 -80
  136. package/dist/tm/dispatch.js.map +1 -1
  137. package/dist/tm/egress.d.ts +19 -7
  138. package/dist/tm/egress.d.ts.map +1 -1
  139. package/dist/tm/egress.js +21 -9
  140. package/dist/tm/egress.js.map +1 -1
  141. package/dist/tm/index.d.ts +23 -20
  142. package/dist/tm/index.d.ts.map +1 -1
  143. package/dist/tm/index.js +117 -116
  144. package/dist/tm/index.js.map +1 -1
  145. package/dist/tm/ledger.d.ts +9 -2
  146. package/dist/tm/ledger.d.ts.map +1 -1
  147. package/dist/tm/ledger.js +4 -1
  148. package/dist/tm/ledger.js.map +1 -1
  149. package/dist/tm/perm-ask.d.ts +3 -3
  150. package/dist/tm/perm-ask.d.ts.map +1 -1
  151. package/dist/tm/perm-ask.js +3 -3
  152. package/dist/tm/perm-ask.js.map +1 -1
  153. package/dist/tm/pipelines.d.ts +12 -11
  154. package/dist/tm/pipelines.d.ts.map +1 -1
  155. package/dist/tm/pipelines.js +40 -207
  156. package/dist/tm/pipelines.js.map +1 -1
  157. package/dist/tm/preview.d.ts +1 -1
  158. package/dist/tm/preview.js +3 -3
  159. package/dist/tm/preview.js.map +1 -1
  160. package/dist/tm/refs.d.ts +31 -4
  161. package/dist/tm/refs.d.ts.map +1 -1
  162. package/dist/tm/refs.js +48 -4
  163. package/dist/tm/refs.js.map +1 -1
  164. package/dist/tm/result.d.ts +1 -1
  165. package/dist/tm/result.d.ts.map +1 -1
  166. package/dist/tm/result.js +4 -3
  167. package/dist/tm/result.js.map +1 -1
  168. package/dist/tm/search.d.ts +2 -2
  169. package/dist/tm/search.js +7 -7
  170. package/dist/tm/search.js.map +1 -1
  171. package/dist/tm/serp-loop.d.ts +19 -7
  172. package/dist/tm/serp-loop.d.ts.map +1 -1
  173. package/dist/tm/serp-loop.js +24 -9
  174. package/dist/tm/serp-loop.js.map +1 -1
  175. package/dist/tm/stats.d.ts +31 -27
  176. package/dist/tm/stats.d.ts.map +1 -1
  177. package/dist/tm/stats.js +170 -58
  178. package/dist/tm/stats.js.map +1 -1
  179. package/dist/tm/store.d.ts +18 -5
  180. package/dist/tm/store.d.ts.map +1 -1
  181. package/dist/tm/store.js +39 -9
  182. package/dist/tm/store.js.map +1 -1
  183. package/dist/tm/tools.d.ts +7 -5
  184. package/dist/tm/tools.d.ts.map +1 -1
  185. package/dist/tm/tools.js +10 -41
  186. package/dist/tm/tools.js.map +1 -1
  187. package/dist/tm/webfetch.d.ts +1 -1
  188. package/dist/tm/webfetch.d.ts.map +1 -1
  189. package/dist/tm/webfetch.js +38 -23
  190. package/dist/tm/webfetch.js.map +1 -1
  191. package/dist/types.d.ts +40 -123
  192. package/dist/types.d.ts.map +1 -1
  193. package/dist/types.js +7 -21
  194. package/dist/types.js.map +1 -1
  195. package/docs/installation-v2.md +124 -39
  196. package/docs/installation.md +9 -0
  197. package/docs/research/browser-pane.md +5 -0
  198. package/docs/v2-port-notes.md +500 -315
  199. package/package.json +1 -1
  200. package/scripts/gen-v2-config.mjs +246 -94
  201. package/scripts/lib/fake-ctx.mjs +244 -146
@@ -22,6 +22,22 @@
22
22
  * until `TM_R6_FINE_ASK=on` says otherwise. A guard that fails open because
23
23
  * we trusted an unproven hook is the opposite of this product.
24
24
  *
25
+ * 3. THE SHELL TIMEOUT CLAMP (issue #6), ported from the retired v1
26
+ * `src/tm/bash-timeout.ts`. The host's shell tool resolves
27
+ * `flags.bashDefaultTimeoutMs ?? 2 * 60 * 1e3`, and a model that passes a
28
+ * timeout at all passes 120000+ for a `Get-ChildItem` — three serialised
29
+ * probes then cost the user six minutes of dead air for a reason no model
30
+ * ever had. v1 clamped it in a composed `tool.execute.before` hook; v2
31
+ * gives the same mutable `input` to `tool.hook("execute.before")`, which is
32
+ * where `applyV2BackgroundForce` already writes, so the protection is not
33
+ * something the cut lost — it is the same lever at the same seam.
34
+ * The discipline is unchanged and load-bearing: it clamps a number the
35
+ * model ALREADY volunteered, never invents one it omitted, applies the
36
+ * probe ceiling only to a command the P3 read-only allowlist accepts,
37
+ * never rewrites the command, never widens what may run, and never throws
38
+ * into the hook — a failure there means the call goes through untouched
39
+ * and the attempt is counted.
40
+ *
25
41
  * The hook only ever makes a decision STRICTER (allow -> ask, anything -> deny on
26
42
  * a red line). It never loosens what the host or the user's own rules chose.
27
43
  */
@@ -36,8 +52,48 @@ export interface GuardDecision {
36
52
  }
37
53
  /** The address question, asked of the host's native web path. */
38
54
  export declare function webGuard(resources: readonly string[]): GuardDecision | null;
55
+ /**
56
+ * R6's FILE-PATH face. v1 enforced this in a `tool.execute.before` hook factory
57
+ * (`createEnvProtectHook`) that was deleted with the v1 personality; v2 never
58
+ * picked it up, so a Team role could read `.env` through the native `read` tool
59
+ * while the docs claimed R6 covered "the environment or an env file". The same
60
+ * classifier now rides `permission.hook("evaluate")`, whose `resources` carry the
61
+ * concrete path (live: `action:"read"` reaches evaluate with the real path).
62
+ *
63
+ * `isEnvFilePath` is the shared matcher and is already pattern-aware: it strips
64
+ * glob asterisks (so a `*.env` include is caught), cuts URL query tails, and
65
+ * refuses code identifiers like `process.env` — so an ordinary grep pattern
66
+ * (`TODO`) is never mistaken for a path. `.env.example` and friends are
67
+ * checked-in templates and pass (see `ENV_TEMPLATE_SUFFIX`).
68
+ *
69
+ * A RED LINE, not a gate: v2 cannot raise a dialog, so there is no consent path
70
+ * to name — telling the agent to "ask for approval" would be a window that never
71
+ * appears.
72
+ */
73
+ export declare function pathGuard(action: string, resources: readonly string[], mode: EnvProtectMode): GuardDecision | null;
39
74
  /** R6's env face and R2's danger face, per command line. */
40
75
  export declare function shellGuard(command: string | undefined, mode: EnvProtectMode): GuardDecision | null;
76
+ /** One running child, as the concurrency refusal renders it. */
77
+ export interface RunningChild {
78
+ sessionID: string;
79
+ agent?: string;
80
+ elapsedMs?: number;
81
+ }
82
+ /**
83
+ * The concurrency cap (#49 feature 2). `permission.evaluate` fires for
84
+ * `subagent` (measured live: `guard_actions: … subagent=16 …`), so the cap is a
85
+ * HARD gate on the same seam as the env-file / address red lines — not a prompt
86
+ * hint a model can talk itself past.
87
+ *
88
+ * When the caller's OWN running children reach the cap, the next dispatch is
89
+ * denied with a Chinese, actionable refusal that names the running ids and the
90
+ * two ways out (collect with `tm_join`, or stop with `tm_join {cancel:true}`).
91
+ *
92
+ * Pure and total: `cap <= 0` disables it (never denies), an empty running list
93
+ * never denies, and it never throws. Only ever stricter — the caller applies it
94
+ * through the same `rank` floor as every other guard.
95
+ */
96
+ export declare function concurrencyGuard(action: string, running: readonly RunningChild[], cap: number): GuardDecision | null;
41
97
  export interface GuardReport {
42
98
  seen: number;
43
99
  byAction: Record<string, number>;
@@ -50,6 +106,31 @@ export interface GuardReport {
50
106
  /** evaluations skipped because the session belongs to a non-Team agent (#22) —
51
107
  * the number that tells the user how much of this floor is not ours to hold */
52
108
  foreignSkipped: number;
109
+ /** file-path evaluations the R6 classifier flagged as an env file (read /
110
+ * write / edit / glob / grep) — the evidence that the file-path face is
111
+ * actually live, not just installed */
112
+ envFileDenied: number;
113
+ /** R6's file-path face caught at `execute.before`, where the FULL input is
114
+ * visible — the seam `permission.evaluate` cannot cover for `grep`/`glob`,
115
+ * whose resource is the PATTERN, not the search path (#58). A separate
116
+ * counter from `envFileDenied` on purpose: the two seams fail independently,
117
+ * and one number for both would hide which one went dark. */
118
+ envFileDeniedByInput: number;
119
+ /** `execute.before` file-tool calls the input guard looked at (Team only). */
120
+ envFileInputSeen: number;
121
+ /** …skipped because the session is not ours (#22). */
122
+ envFileInputForeignSkipped: number;
123
+ /** …where the guard itself threw and the call was allowed through. */
124
+ envFileInputThrew: number;
125
+ /** #49 feature 2: `subagent` evaluations the concurrency cap looked at. */
126
+ concurrencySeen: number;
127
+ /** …where the cap fired and the dispatch was denied. */
128
+ concurrencyDenied: number;
129
+ /** The largest number of the caller's running children seen at one evaluation
130
+ * — the peak the cap is measured against, so "we never hit it" is a number. */
131
+ concurrencyRunningMax: number;
132
+ /** …where the running-children read threw and the call was allowed through. */
133
+ concurrencyThrew: number;
53
134
  }
54
135
  export interface BackgroundForceReport {
55
136
  seen: number;
@@ -80,11 +161,49 @@ export declare function applyV2BackgroundForce(ctx: V2Context, opts?: {
80
161
  export declare function applyV2PermissionGuards(ctx: V2Context, opts: {
81
162
  envProtectMode: EnvProtectMode;
82
163
  scope?: TeamScope;
164
+ /** #49 feature 2: the caller's own running children, read from the plugin's
165
+ * ONE children registry. Absent = the cap is not enforced (a host with no
166
+ * registry to read must not be denied on a guess). */
167
+ runningChildren?: (callerSessionID: string) => RunningChild[];
168
+ /** The cap. `<= 0` disables it. Defaults to 0 (off) so a caller that does
169
+ * not opt in keeps the pre-#49 behaviour byte-exactly. */
170
+ maxConcurrent?: number;
171
+ /** Fired once per denial so the personality can write the `v2-concurrency`
172
+ * trajectory line — the guard owns no store. */
173
+ onConcurrencyDenied?: (info: {
174
+ caller: string;
175
+ running: RunningChild[];
176
+ cap: number;
177
+ }) => void;
83
178
  }): Promise<{
84
179
  registrations: V2Registration[];
85
180
  report: GuardReport;
86
181
  installed: boolean;
87
182
  }>;
183
+ /**
184
+ * R6's file-path face, on the seam that sees the WHOLE input (#58).
185
+ *
186
+ * `pathGuard` rides `permission.evaluate`, whose `resources` for `grep`/`glob`
187
+ * are the pattern — so the red line had a hole exactly the width of those two
188
+ * tools. `execute.before` hands us the raw args the model sent, so the search
189
+ * path (`path` / `include` / `filePath`) is visible there and the same
190
+ * `isEnvFilePath` matcher can answer.
191
+ *
192
+ * A refusal is THROWN, not returned: `execute.before` has no `effect` field, and
193
+ * silently rewriting a path the model chose is the guesswork this product
194
+ * refuses — the model has to see the refusal. Same shape as the browser gate's
195
+ * red line. An internal failure is swallowed and counted (`envFileInputThrew`),
196
+ * never thrown into the host: a guard that cannot decide must not break the call
197
+ * it is inspecting. Team-scoped through the same `scope.decide` gate as every
198
+ * other writer, and the counters land on `v2-surface` / `v2-shutdown`.
199
+ */
200
+ export declare function applyV2EnvFileInputGuard(ctx: V2Context, opts: {
201
+ envProtectMode: EnvProtectMode;
202
+ scope?: TeamScope;
203
+ report: GuardReport;
204
+ }): Promise<{
205
+ registrations: V2Registration[];
206
+ }>;
88
207
  /** Does the config still need the coarse `shell -> ask` escalation? Only while
89
208
  * the fine path is switched off; with the classifier in charge, escalating every
90
209
  * command would mask it.
@@ -98,4 +217,63 @@ export declare function applyV2PermissionGuards(ctx: V2Context, opts: {
98
217
  * An absent hook still forces coarse: no seam, no per-command judgement.
99
218
  */
100
219
  export declare function needsCoarseShellAsk(env: NodeJS.ProcessEnv, guardsInstalled: boolean): boolean;
220
+ /** Parse the model-supplied timeout defensively: the host schema wants a positive
221
+ * integer of milliseconds, but an LLM hands us `"120000"`, `120000.0`, or omits
222
+ * it entirely. Anything unreadable means "no timeout was supplied", and a
223
+ * supplied-none is NEVER turned into one by us. */
224
+ export declare function parseShellTimeout(raw: unknown): number | null;
225
+ export type ShellTimeoutVerdict = {
226
+ changed: false;
227
+ via: "none" | "already-short";
228
+ } | {
229
+ changed: true;
230
+ via: "probe" | "max";
231
+ from: number;
232
+ to: number;
233
+ };
234
+ /**
235
+ * Decide the clamped timeout for one shell call. `probeMs` / `maxMs` of 0
236
+ * disable that ceiling. `probeMs` applies ONLY to a command the P3 read-only
237
+ * allowlist already accepts; `maxMs` is the operator's explicit global cap and
238
+ * ships at 0 (off), because silently killing a build is worse than a slow one.
239
+ */
240
+ export declare function resolveShellTimeout(opts: {
241
+ command: string;
242
+ timeoutMs: number | null;
243
+ probeMs: number;
244
+ maxMs: number;
245
+ readonlyAllowed: readonly string[];
246
+ }): ShellTimeoutVerdict;
247
+ export interface ShellTimeoutReport {
248
+ seen: number;
249
+ clamped: number;
250
+ /** clamps skipped because the session is not one of ours (#22) — a build
251
+ * session's timeout is the host's business, not a plugin's */
252
+ foreignSkipped: number;
253
+ /** attempts that threw (including a classifier throw) and therefore
254
+ * left the call byte-exact — counted so "the clamp is silent" is
255
+ * distinguishable from "the clamp is broken" */
256
+ threw: number;
257
+ }
258
+ /**
259
+ * The `tool.hook("execute.before")` installation of the clamp. Returns the
260
+ * registrations plus the counters that ride `v2-surface` / `v2-shutdown`.
261
+ * `onClamp` is how the caller writes the trajectory row; a throw inside it is
262
+ * swallowed there, never here.
263
+ */
264
+ export declare function applyV2ShellTimeoutClamp(ctx: V2Context, opts: {
265
+ probeMs: number;
266
+ maxMs: number;
267
+ readonlyAllowed: readonly string[];
268
+ scope?: TeamScope;
269
+ onClamp?: (info: {
270
+ via: string;
271
+ from: number;
272
+ to: number;
273
+ sessionID?: string;
274
+ }) => void;
275
+ }): Promise<{
276
+ registrations: V2Registration[];
277
+ report: ShellTimeoutReport;
278
+ }>;
101
279
  //# sourceMappingURL=v2-guard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"v2-guard.d.ts","sourceRoot":"","sources":["../../src/host/v2-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9D,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;IAChC,OAAO,CAAC,EAAE,MAAM,CA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,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;CACnC,GAAG,mBAAmB,CAQtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf;mEAC+D;IAC/D,cAAc,EAAE,MAAM,CAAA;IACtB;;qDAEiD;IACjD,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,SAAS,EACd,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,eAAe,EAAE,SAAS,MAAM,EAAE,CAAA;IAClC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACxF,GACA,OAAO,CAAC;IAAE,aAAa,EAAE,cAAc,EAAE,CAAC;IAAC,MAAM,EAAE,kBAAkB,CAAA;CAAE,CAAC,CA8C1E"}
@@ -22,11 +22,28 @@
22
22
  * until `TM_R6_FINE_ASK=on` says otherwise. A guard that fails open because
23
23
  * we trusted an unproven hook is the opposite of this product.
24
24
  *
25
+ * 3. THE SHELL TIMEOUT CLAMP (issue #6), ported from the retired v1
26
+ * `src/tm/bash-timeout.ts`. The host's shell tool resolves
27
+ * `flags.bashDefaultTimeoutMs ?? 2 * 60 * 1e3`, and a model that passes a
28
+ * timeout at all passes 120000+ for a `Get-ChildItem` — three serialised
29
+ * probes then cost the user six minutes of dead air for a reason no model
30
+ * ever had. v1 clamped it in a composed `tool.execute.before` hook; v2
31
+ * gives the same mutable `input` to `tool.hook("execute.before")`, which is
32
+ * where `applyV2BackgroundForce` already writes, so the protection is not
33
+ * something the cut lost — it is the same lever at the same seam.
34
+ * The discipline is unchanged and load-bearing: it clamps a number the
35
+ * model ALREADY volunteered, never invents one it omitted, applies the
36
+ * probe ceiling only to a command the P3 read-only allowlist accepts,
37
+ * never rewrites the command, never widens what may run, and never throws
38
+ * into the hook — a failure there means the call goes through untouched
39
+ * and the attempt is counted.
40
+ *
25
41
  * The hook only ever makes a decision STRICTER (allow -> ask, anything -> deny on
26
42
  * a red line). It never loosens what the host or the user's own rules chose.
27
43
  */
28
44
  import { R2_DANGER_BASH_ASK_PATTERNS, R6_ENV_BASH_ASK_PATTERNS, commandMatchesAnyAskPattern, isEnvFilePath, } from "../envprotect.js";
29
45
  import { classifyHost } from "../tm/egress.js";
46
+ import { classifyReadonlyCommand } from "../tm/guard.js";
30
47
  const rank = { allow: 0, ask: 1, deny: 2 };
31
48
  /** A resource may be a full URL or a bare host; both have to be answered, since
32
49
  * the host's own tool is free to hand us either shape. */
@@ -75,6 +92,43 @@ export function webGuard(resources) {
75
92
  }
76
93
  return null;
77
94
  }
95
+ /** File tools whose path-class resources are scanned for env files. `patch` is
96
+ * deliberately absent: its resource shape has not been observed on a live host,
97
+ * and guessing at a shape is how a guard either misses or misfires. */
98
+ const PATH_GUARD_ACTIONS = new Set(["read", "write", "edit", "glob", "grep"]);
99
+ /**
100
+ * R6's FILE-PATH face. v1 enforced this in a `tool.execute.before` hook factory
101
+ * (`createEnvProtectHook`) that was deleted with the v1 personality; v2 never
102
+ * picked it up, so a Team role could read `.env` through the native `read` tool
103
+ * while the docs claimed R6 covered "the environment or an env file". The same
104
+ * classifier now rides `permission.hook("evaluate")`, whose `resources` carry the
105
+ * concrete path (live: `action:"read"` reaches evaluate with the real path).
106
+ *
107
+ * `isEnvFilePath` is the shared matcher and is already pattern-aware: it strips
108
+ * glob asterisks (so a `*.env` include is caught), cuts URL query tails, and
109
+ * refuses code identifiers like `process.env` — so an ordinary grep pattern
110
+ * (`TODO`) is never mistaken for a path. `.env.example` and friends are
111
+ * checked-in templates and pass (see `ENV_TEMPLATE_SUFFIX`).
112
+ *
113
+ * A RED LINE, not a gate: v2 cannot raise a dialog, so there is no consent path
114
+ * to name — telling the agent to "ask for approval" would be a window that never
115
+ * appears.
116
+ */
117
+ export function pathGuard(action, resources, mode) {
118
+ if (mode === "off")
119
+ return null;
120
+ if (!PATH_GUARD_ACTIONS.has(action))
121
+ return null;
122
+ for (const raw of resources) {
123
+ const text = String(raw ?? "");
124
+ if (!text)
125
+ continue;
126
+ if (isEnvFilePath(text)) {
127
+ return { effect: "deny", why: "env-file-path", message: "R6 红线:这个路径指向环境文件(.env / shell rc 家族),不授权、不弹窗。" };
128
+ }
129
+ }
130
+ return null;
131
+ }
78
132
  /** R6's env face and R2's danger face, per command line. */
79
133
  export function shellGuard(command, mode) {
80
134
  const text = String(command ?? "").trim();
@@ -88,6 +142,39 @@ export function shellGuard(command, mode) {
88
142
  }
89
143
  return null;
90
144
  }
145
+ /**
146
+ * The concurrency cap (#49 feature 2). `permission.evaluate` fires for
147
+ * `subagent` (measured live: `guard_actions: … subagent=16 …`), so the cap is a
148
+ * HARD gate on the same seam as the env-file / address red lines — not a prompt
149
+ * hint a model can talk itself past.
150
+ *
151
+ * When the caller's OWN running children reach the cap, the next dispatch is
152
+ * denied with a Chinese, actionable refusal that names the running ids and the
153
+ * two ways out (collect with `tm_join`, or stop with `tm_join {cancel:true}`).
154
+ *
155
+ * Pure and total: `cap <= 0` disables it (never denies), an empty running list
156
+ * never denies, and it never throws. Only ever stricter — the caller applies it
157
+ * through the same `rank` floor as every other guard.
158
+ */
159
+ export function concurrencyGuard(action, running, cap) {
160
+ if (action !== "subagent")
161
+ return null;
162
+ if (!Number.isFinite(cap) || cap <= 0)
163
+ return null;
164
+ if (running.length < cap)
165
+ return null;
166
+ const list = running
167
+ .map((c) => {
168
+ const secs = typeof c.elapsedMs === "number" && c.elapsedMs >= 0 ? ` 运行中 ${Math.round(c.elapsedMs / 1000)}s` : "";
169
+ return `${c.sessionID}${secs}`;
170
+ })
171
+ .join("、");
172
+ return {
173
+ effect: "deny",
174
+ why: "concurrency-cap",
175
+ message: `本会话已有 ${running.length} 个子代理在跑(上限 ${cap}):${list}。先 tm_join 收取已结算的,或 tm_join {cancel:true} 停掉不需要的,再派新的。`,
176
+ };
177
+ }
91
178
  /**
92
179
  * Every sub-agent dispatch runs in the background.
93
180
  *
@@ -131,7 +218,7 @@ export async function applyV2BackgroundForce(ctx, opts = {}) {
131
218
  return { registrations, report };
132
219
  }
133
220
  export async function applyV2PermissionGuards(ctx, opts) {
134
- const report = { seen: 0, byAction: {}, strictened: 0, denied: 0, shellMatched: 0, foreignSkipped: 0 };
221
+ const report = { seen: 0, byAction: {}, strictened: 0, denied: 0, shellMatched: 0, foreignSkipped: 0, envFileDenied: 0, envFileDeniedByInput: 0, envFileInputSeen: 0, envFileInputForeignSkipped: 0, envFileInputThrew: 0, concurrencySeen: 0, concurrencyDenied: 0, concurrencyRunningMax: 0, concurrencyThrew: 0 };
135
222
  const permission = ctx.permission;
136
223
  if (!permission || typeof permission.hook !== "function") {
137
224
  return { registrations: [], report, installed: false };
@@ -154,19 +241,51 @@ export async function applyV2PermissionGuards(ctx, opts) {
154
241
  ? webGuard(resources)
155
242
  : action === "shell"
156
243
  ? shellGuard(resources[0], opts.envProtectMode)
157
- : null;
158
- if (!decision)
244
+ : pathGuard(action, resources, opts.envProtectMode);
245
+ // #49 feature 2: the concurrency cap. `permission.evaluate` fires for
246
+ // `subagent` (measured live), so this is a hard gate on the same seam as the
247
+ // red lines. A read that throws is swallowed and counted — a throughput cap
248
+ // that fails OPEN is the honest failure mode, and it never loosens a host
249
+ // decision (the `rank` floor below still applies).
250
+ let concurrency = null;
251
+ if (action === "subagent") {
252
+ report.concurrencySeen++;
253
+ try {
254
+ const caller = String(event?.sessionID ?? "");
255
+ const running = opts.runningChildren ? opts.runningChildren(caller) : [];
256
+ if (running.length > report.concurrencyRunningMax)
257
+ report.concurrencyRunningMax = running.length;
258
+ concurrency = concurrencyGuard(action, running, opts.maxConcurrent ?? 0);
259
+ if (concurrency) {
260
+ report.concurrencyDenied++;
261
+ try {
262
+ opts.onConcurrencyDenied?.({ caller, running, cap: opts.maxConcurrent ?? 0 });
263
+ }
264
+ catch {
265
+ /* the trajectory line is an extra, never a reason to fail the call */
266
+ }
267
+ }
268
+ }
269
+ catch {
270
+ report.concurrencyThrew++;
271
+ }
272
+ }
273
+ // The stricter of the two wins; a null on either side is not a decision.
274
+ const chosen = !decision ? concurrency : !concurrency ? decision : rank[concurrency.effect] > rank[decision.effect] ? concurrency : decision;
275
+ if (!chosen)
159
276
  return;
160
277
  if (action === "shell")
161
278
  report.shellMatched++;
279
+ if (chosen.why === "env-file-path")
280
+ report.envFileDenied++;
162
281
  // Only ever stricter. A host that already decided to ask or deny keeps
163
282
  // that decision — our classifier is a floor, not an override of the user.
164
- if (rank[decision.effect] <= rank[event.effect ?? "allow"])
283
+ if (rank[chosen.effect] <= rank[event.effect ?? "allow"])
165
284
  return;
166
- event.effect = decision.effect;
167
- if (decision.message)
168
- event.message = decision.message;
169
- if (decision.effect === "deny")
285
+ event.effect = chosen.effect;
286
+ if (chosen.message)
287
+ event.message = chosen.message;
288
+ if (chosen.effect === "deny")
170
289
  report.denied++;
171
290
  else
172
291
  report.strictened++;
@@ -174,6 +293,98 @@ export async function applyV2PermissionGuards(ctx, opts) {
174
293
  ];
175
294
  return { registrations, report, installed: true };
176
295
  }
296
+ /**
297
+ * The path-class fields each native file tool can carry in its `execute.before`
298
+ * `input`. This is the seam `permission.evaluate` cannot cover: the host's own
299
+ * docs say `grep`'s resource is "the requested pattern, not the search path",
300
+ * and `glob`'s is the pattern too — so a `grep SECRET in .env` reaches
301
+ * `evaluate` with `resources:["SECRET"]` and the env-file path is never seen
302
+ * (#58, measured on 2.0.24: `read .env` denied, `grep` in `.env` succeeded).
303
+ *
304
+ * `grep`'s `pattern` is deliberately ABSENT: it is a REGEX, not a path, and
305
+ * `isEnvFilePath` on a regex misfires (a search for `\.env` is not a read of
306
+ * `.env`). `glob`'s `pattern` IS a path glob, so it is checked. `include` is
307
+ * the host's own filter field and is checked wherever it appears.
308
+ */
309
+ const ENV_FILE_INPUT_FIELDS = {
310
+ read: ["filePath", "path"],
311
+ write: ["filePath", "path"],
312
+ edit: ["filePath", "path"],
313
+ glob: ["pattern", "path", "include"],
314
+ grep: ["path", "include"],
315
+ };
316
+ /**
317
+ * R6's file-path face, on the seam that sees the WHOLE input (#58).
318
+ *
319
+ * `pathGuard` rides `permission.evaluate`, whose `resources` for `grep`/`glob`
320
+ * are the pattern — so the red line had a hole exactly the width of those two
321
+ * tools. `execute.before` hands us the raw args the model sent, so the search
322
+ * path (`path` / `include` / `filePath`) is visible there and the same
323
+ * `isEnvFilePath` matcher can answer.
324
+ *
325
+ * A refusal is THROWN, not returned: `execute.before` has no `effect` field, and
326
+ * silently rewriting a path the model chose is the guesswork this product
327
+ * refuses — the model has to see the refusal. Same shape as the browser gate's
328
+ * red line. An internal failure is swallowed and counted (`envFileInputThrew`),
329
+ * never thrown into the host: a guard that cannot decide must not break the call
330
+ * it is inspecting. Team-scoped through the same `scope.decide` gate as every
331
+ * other writer, and the counters land on `v2-surface` / `v2-shutdown`.
332
+ */
333
+ export async function applyV2EnvFileInputGuard(ctx, opts) {
334
+ const report = opts.report;
335
+ const tool = ctx.tool;
336
+ if (!tool || typeof tool.hook !== "function")
337
+ return { registrations: [] };
338
+ if (opts.envProtectMode === "off")
339
+ return { registrations: [] };
340
+ let registrations;
341
+ try {
342
+ registrations = [
343
+ await tool.hook("execute.before", (event) => {
344
+ let refusal = null;
345
+ try {
346
+ const name = String(event?.tool ?? "");
347
+ const fields = ENV_FILE_INPUT_FIELDS[name];
348
+ if (!fields)
349
+ return;
350
+ report.envFileInputSeen++;
351
+ if (opts.scope && opts.scope.count(opts.scope.decide(event)) !== "ours") {
352
+ report.envFileInputForeignSkipped++;
353
+ return;
354
+ }
355
+ const input = event.input;
356
+ if (!input || typeof input !== "object" || Array.isArray(input))
357
+ return;
358
+ for (const field of fields) {
359
+ const value = input[field];
360
+ if (typeof value !== "string" || !value.trim())
361
+ continue;
362
+ if (isEnvFilePath(value)) {
363
+ refusal = `R6 红线:${name} 的 ${field} 指向环境文件(.env / shell rc 家族),不授权、不弹窗。`;
364
+ break;
365
+ }
366
+ }
367
+ }
368
+ catch {
369
+ // A guard that cannot decide must not break the call it is inspecting:
370
+ // leave the args exactly as the model wrote them and count it.
371
+ report.envFileInputThrew++;
372
+ return;
373
+ }
374
+ if (!refusal)
375
+ return;
376
+ report.envFileDeniedByInput++;
377
+ throw new Error(refusal);
378
+ }),
379
+ ];
380
+ }
381
+ catch {
382
+ // No hook seam (an older host, or a ctx without `tool.hook`): the input face
383
+ // is simply absent, and the counters say so rather than throwing into boot.
384
+ return { registrations: [] };
385
+ }
386
+ return { registrations };
387
+ }
177
388
  /** Does the config still need the coarse `shell -> ask` escalation? Only while
178
389
  * the fine path is switched off; with the classifier in charge, escalating every
179
390
  * command would mask it.
@@ -196,4 +407,109 @@ export function needsCoarseShellAsk(env, guardsInstalled) {
196
407
  return true;
197
408
  return false;
198
409
  }
410
+ // ---------- 3. the shell timeout clamp (issue #6, ported from v1) ----------
411
+ /** The host's tool id on v2 is `shell`; v1 spelled it `bash`, and a namespaced
412
+ * delivery (`opencode:shell`, `local/shell`) is the same tool. Anything else —
413
+ * including the Code Mode `execute` program that calls shell inside it — is not
414
+ * ours to rewrite. */
415
+ function isShellTool(raw) {
416
+ const text = String(raw ?? "").trim().toLowerCase();
417
+ if (!text)
418
+ return false;
419
+ const last = text.slice(Math.max(text.lastIndexOf(":"), text.lastIndexOf("/")) + 1);
420
+ return last === "shell" || last === "bash";
421
+ }
422
+ /** Parse the model-supplied timeout defensively: the host schema wants a positive
423
+ * integer of milliseconds, but an LLM hands us `"120000"`, `120000.0`, or omits
424
+ * it entirely. Anything unreadable means "no timeout was supplied", and a
425
+ * supplied-none is NEVER turned into one by us. */
426
+ export function parseShellTimeout(raw) {
427
+ if (typeof raw === "number" && Number.isFinite(raw) && raw > 0)
428
+ return Math.trunc(raw);
429
+ if (typeof raw === "string") {
430
+ const n = Number(raw.trim());
431
+ if (Number.isFinite(n) && n > 0)
432
+ return Math.trunc(n);
433
+ }
434
+ return null;
435
+ }
436
+ /**
437
+ * Decide the clamped timeout for one shell call. `probeMs` / `maxMs` of 0
438
+ * disable that ceiling. `probeMs` applies ONLY to a command the P3 read-only
439
+ * allowlist already accepts; `maxMs` is the operator's explicit global cap and
440
+ * ships at 0 (off), because silently killing a build is worse than a slow one.
441
+ */
442
+ export function resolveShellTimeout(opts) {
443
+ const t = opts.timeoutMs;
444
+ if (t === null)
445
+ return { changed: false, via: "none" };
446
+ const probe = opts.probeMs > 0 && classifyReadonlyCommand(opts.command, opts.readonlyAllowed).ok;
447
+ if (probe && t > opts.probeMs)
448
+ return { changed: true, via: "probe", from: t, to: opts.probeMs };
449
+ if (opts.maxMs > 0 && t > opts.maxMs)
450
+ return { changed: true, via: "max", from: t, to: opts.maxMs };
451
+ if (!probe && opts.maxMs === 0)
452
+ return { changed: false, via: "none" };
453
+ return { changed: false, via: "already-short" };
454
+ }
455
+ /**
456
+ * The `tool.hook("execute.before")` installation of the clamp. Returns the
457
+ * registrations plus the counters that ride `v2-surface` / `v2-shutdown`.
458
+ * `onClamp` is how the caller writes the trajectory row; a throw inside it is
459
+ * swallowed there, never here.
460
+ */
461
+ export async function applyV2ShellTimeoutClamp(ctx, opts) {
462
+ const report = { seen: 0, clamped: 0, foreignSkipped: 0, threw: 0 };
463
+ const tool = ctx.tool;
464
+ if (!tool || typeof tool.hook !== "function")
465
+ return { registrations: [], report };
466
+ let registrations;
467
+ try {
468
+ registrations = [
469
+ await tool.hook("execute.before", (event) => {
470
+ try {
471
+ if (!isShellTool(event?.tool))
472
+ return;
473
+ report.seen++;
474
+ if (opts.scope && opts.scope.count(opts.scope.decide(event)) !== "ours") {
475
+ report.foreignSkipped++;
476
+ return;
477
+ }
478
+ const input = event.input;
479
+ if (!input || typeof input !== "object" || Array.isArray(input))
480
+ return;
481
+ const command = typeof input.command === "string" ? input.command : "";
482
+ if (!command)
483
+ return;
484
+ const verdict = resolveShellTimeout({
485
+ command,
486
+ timeoutMs: parseShellTimeout(input.timeout),
487
+ probeMs: opts.probeMs,
488
+ maxMs: opts.maxMs,
489
+ readonlyAllowed: opts.readonlyAllowed,
490
+ });
491
+ if (!verdict.changed)
492
+ return;
493
+ // Only the number the model volunteered. `input.command` is never
494
+ // touched, and nothing is added to the object.
495
+ input.timeout = verdict.to;
496
+ report.clamped++;
497
+ const sessionID = typeof event.sessionID === "string" ? event.sessionID : undefined;
498
+ opts.onClamp?.({ via: verdict.via, from: verdict.from, to: verdict.to, sessionID });
499
+ }
500
+ catch {
501
+ // A clamp that cannot decide must not break the call it is trying to
502
+ // speed up: leave the args exactly as the model wrote them and count it.
503
+ report.threw++;
504
+ }
505
+ }),
506
+ ];
507
+ }
508
+ catch {
509
+ // No hook seam (an older host, or a ctx without `tool.hook`): the clamp is
510
+ // simply absent, and the counters say so rather than throwing into boot.
511
+ return { registrations: [], report };
512
+ }
513
+ return { registrations, report };
514
+ }
199
515
  //# sourceMappingURL=v2-guard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"v2-guard.js","sourceRoot":"","sources":["../../src/host/v2-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,aAAa,GAEd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAW9C,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAW,CAAA;AAEnD;2DA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