@te-river/opencode-team-mode 1.7.2 → 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.
Files changed (165) hide show
  1. package/README.md +1009 -849
  2. package/README.zh-CN.md +906 -756
  3. package/dist/host/v2-browser-gate.d.ts +4 -1
  4. package/dist/host/v2-browser-gate.d.ts.map +1 -1
  5. package/dist/host/v2-browser-gate.js +1 -1
  6. package/dist/host/v2-browser-gate.js.map +1 -1
  7. package/dist/host/v2-capabilities.js +1 -1
  8. package/dist/host/v2-capabilities.js.map +1 -1
  9. package/dist/host/v2-guard.d.ts +3 -1
  10. package/dist/host/v2-guard.d.ts.map +1 -1
  11. package/dist/host/v2-guard.js +2 -2
  12. package/dist/host/v2-guard.js.map +1 -1
  13. package/dist/host/v2-offload.d.ts +12 -2
  14. package/dist/host/v2-offload.d.ts.map +1 -1
  15. package/dist/host/v2-offload.js +9 -9
  16. package/dist/host/v2-offload.js.map +1 -1
  17. package/dist/host/v2-probe-chain.d.ts +5 -1
  18. package/dist/host/v2-probe-chain.d.ts.map +1 -1
  19. package/dist/host/v2-probe-chain.js +4 -6
  20. package/dist/host/v2-probe-chain.js.map +1 -1
  21. package/dist/host/v2-probe.d.ts.map +1 -1
  22. package/dist/host/v2-probe.js +2 -1
  23. package/dist/host/v2-probe.js.map +1 -1
  24. package/dist/host/v2-prune.d.ts +5 -1
  25. package/dist/host/v2-prune.d.ts.map +1 -1
  26. package/dist/host/v2-prune.js +8 -14
  27. package/dist/host/v2-prune.js.map +1 -1
  28. package/dist/host/v2-retry.d.ts +9 -2
  29. package/dist/host/v2-retry.d.ts.map +1 -1
  30. package/dist/host/v2-retry.js +13 -15
  31. package/dist/host/v2-retry.js.map +1 -1
  32. package/dist/host/v2-session.d.ts +6 -2
  33. package/dist/host/v2-session.d.ts.map +1 -1
  34. package/dist/host/v2-session.js +7 -13
  35. package/dist/host/v2-session.js.map +1 -1
  36. package/dist/host/v2.d.ts +7 -2
  37. package/dist/host/v2.d.ts.map +1 -1
  38. package/dist/host/v2.js +38 -35
  39. package/dist/host/v2.js.map +1 -1
  40. package/dist/prompts/lead.d.ts +1 -1
  41. package/dist/prompts/lead.d.ts.map +1 -1
  42. package/dist/prompts/lead.js +23 -7
  43. package/dist/prompts/lead.js.map +1 -1
  44. package/dist/prompts/specialists.d.ts +1 -1
  45. package/dist/prompts/specialists.d.ts.map +1 -1
  46. package/dist/prompts/specialists.js +1 -1
  47. package/dist/tm/args-schema.d.ts +1 -1
  48. package/dist/tm/args-schema.js +6 -6
  49. package/dist/tm/args-schema.js.map +1 -1
  50. package/dist/tm/board.js +2 -2
  51. package/dist/tm/board.js.map +1 -1
  52. package/dist/tm/config-files.d.ts +41 -17
  53. package/dist/tm/config-files.d.ts.map +1 -1
  54. package/dist/tm/config-files.js +68 -73
  55. package/dist/tm/config-files.js.map +1 -1
  56. package/dist/tm/config-layers.d.ts +65 -33
  57. package/dist/tm/config-layers.d.ts.map +1 -1
  58. package/dist/tm/config-layers.js +165 -81
  59. package/dist/tm/config-layers.js.map +1 -1
  60. package/dist/tm/config-template.d.ts +32 -0
  61. package/dist/tm/config-template.d.ts.map +1 -0
  62. package/dist/tm/config-template.js +74 -0
  63. package/dist/tm/config-template.js.map +1 -0
  64. package/dist/tm/config.d.ts +115 -140
  65. package/dist/tm/config.d.ts.map +1 -1
  66. package/dist/tm/config.js +100 -200
  67. package/dist/tm/config.js.map +1 -1
  68. package/dist/tm/index.d.ts +11 -3
  69. package/dist/tm/index.d.ts.map +1 -1
  70. package/dist/tm/index.js +46 -16
  71. package/dist/tm/index.js.map +1 -1
  72. package/dist/tm/ledger.d.ts +7 -3
  73. package/dist/tm/ledger.d.ts.map +1 -1
  74. package/dist/tm/ledger.js +5 -4
  75. package/dist/tm/ledger.js.map +1 -1
  76. package/dist/tm/memory.js +3 -3
  77. package/dist/tm/pipelines.js +1 -1
  78. package/dist/tm/search.js +6 -6
  79. package/dist/tm/search.js.map +1 -1
  80. package/dist/tm/stats.js +2 -2
  81. package/dist/tm/stats.js.map +1 -1
  82. package/dist/tm/tools.js +2 -2
  83. package/dist/tm/webfetch.d.ts +5 -2
  84. package/dist/tm/webfetch.d.ts.map +1 -1
  85. package/dist/tm/webfetch.js +24 -18
  86. package/dist/tm/webfetch.js.map +1 -1
  87. package/docs/installation-v2.md +59 -38
  88. package/docs/installation.md +4 -4
  89. package/package.json +1 -1
  90. package/dist/approval-gate.d.ts +0 -205
  91. package/dist/approval-gate.d.ts.map +0 -1
  92. package/dist/approval-gate.js +0 -627
  93. package/dist/approval-gate.js.map +0 -1
  94. package/dist/host/v1.d.ts +0 -14
  95. package/dist/host/v1.d.ts.map +0 -1
  96. package/dist/host/v1.js +0 -340
  97. package/dist/host/v1.js.map +0 -1
  98. package/dist/host/v2-client.d.ts +0 -53
  99. package/dist/host/v2-client.d.ts.map +0 -1
  100. package/dist/host/v2-client.js +0 -193
  101. package/dist/host/v2-client.js.map +0 -1
  102. package/dist/host/v2-transcript.d.ts +0 -73
  103. package/dist/host/v2-transcript.d.ts.map +0 -1
  104. package/dist/host/v2-transcript.js +0 -151
  105. package/dist/host/v2-transcript.js.map +0 -1
  106. package/dist/host-hooks.d.ts +0 -126
  107. package/dist/host-hooks.d.ts.map +0 -1
  108. package/dist/host-hooks.js +0 -284
  109. package/dist/host-hooks.js.map +0 -1
  110. package/dist/tm/bash-timeout.d.ts +0 -72
  111. package/dist/tm/bash-timeout.d.ts.map +0 -1
  112. package/dist/tm/bash-timeout.js +0 -100
  113. package/dist/tm/bash-timeout.js.map +0 -1
  114. package/dist/tm/browser.d.ts +0 -642
  115. package/dist/tm/browser.d.ts.map +0 -1
  116. package/dist/tm/browser.js +0 -2836
  117. package/dist/tm/browser.js.map +0 -1
  118. package/dist/tm/ptc/budgets.d.ts +0 -59
  119. package/dist/tm/ptc/budgets.d.ts.map +0 -1
  120. package/dist/tm/ptc/budgets.js +0 -138
  121. package/dist/tm/ptc/budgets.js.map +0 -1
  122. package/dist/tm/ptc/contract.d.ts +0 -171
  123. package/dist/tm/ptc/contract.d.ts.map +0 -1
  124. package/dist/tm/ptc/contract.js +0 -85
  125. package/dist/tm/ptc/contract.js.map +0 -1
  126. package/dist/tm/ptc/driver.d.ts +0 -40
  127. package/dist/tm/ptc/driver.d.ts.map +0 -1
  128. package/dist/tm/ptc/driver.js +0 -213
  129. package/dist/tm/ptc/driver.js.map +0 -1
  130. package/dist/tm/ptc/engines.d.ts +0 -43
  131. package/dist/tm/ptc/engines.d.ts.map +0 -1
  132. package/dist/tm/ptc/engines.js +0 -454
  133. package/dist/tm/ptc/engines.js.map +0 -1
  134. package/dist/tm/ptc/gate.d.ts +0 -28
  135. package/dist/tm/ptc/gate.d.ts.map +0 -1
  136. package/dist/tm/ptc/gate.js +0 -130
  137. package/dist/tm/ptc/gate.js.map +0 -1
  138. package/dist/tm/ptc/index.d.ts +0 -19
  139. package/dist/tm/ptc/index.d.ts.map +0 -1
  140. package/dist/tm/ptc/index.js +0 -15
  141. package/dist/tm/ptc/index.js.map +0 -1
  142. package/dist/tm/ptc/pscan.d.ts +0 -30
  143. package/dist/tm/ptc/pscan.d.ts.map +0 -1
  144. package/dist/tm/ptc/pscan.js +0 -341
  145. package/dist/tm/ptc/pscan.js.map +0 -1
  146. package/dist/tm/ptc/summary.d.ts +0 -17
  147. package/dist/tm/ptc/summary.d.ts.map +0 -1
  148. package/dist/tm/ptc/summary.js +0 -134
  149. package/dist/tm/ptc/summary.js.map +0 -1
  150. package/dist/tm/ptc/tool.d.ts +0 -66
  151. package/dist/tm/ptc/tool.d.ts.map +0 -1
  152. package/dist/tm/ptc/tool.js +0 -231
  153. package/dist/tm/ptc/tool.js.map +0 -1
  154. package/dist/tm/ptc.d.ts +0 -298
  155. package/dist/tm/ptc.d.ts.map +0 -1
  156. package/dist/tm/ptc.js +0 -865
  157. package/dist/tm/ptc.js.map +0 -1
  158. package/dist/tm/pty.d.ts +0 -70
  159. package/dist/tm/pty.d.ts.map +0 -1
  160. package/dist/tm/pty.js +0 -245
  161. package/dist/tm/pty.js.map +0 -1
  162. package/dist/tool-coerce.d.ts +0 -24
  163. package/dist/tool-coerce.d.ts.map +0 -1
  164. package/dist/tool-coerce.js +0 -63
  165. package/dist/tool-coerce.js.map +0 -1
@@ -1,627 +0,0 @@
1
- /**
2
- * Unified approval gate — Layer 2 (timeout auto-reject) + Layer 3 (SDK
3
- * fallback) of the R6 + R2 approval flow.
4
- *
5
- * The host only shows its official confirmation dialog for command patterns
6
- * declared `ask` in an agent's permission config (Layer 1, envprotect.ts).
7
- * When a dialog opens it SUSPENDS the tool call and waits for a human; on the
8
- * OpenCode DESKTOP that human is present, but a request can also be left
9
- * unanswered. This module owns ONE timer that watches the host permission
10
- * events and closes abandoned requests on the safe side.
11
- *
12
- * REAL host contract (1.18.29, probed live via SSE + the plugin event hook —
13
- * see gate-test report-p5):
14
- * permission.asked → properties = { id, sessionID, permission: "bash",
15
- * patterns: [<concrete command segment>, …], metadata:
16
- * { command }, always: [<host's "always" generalization
17
- * proposal>], tool: { messageID, callID } } — the props
18
- * carry NO `type` field, and the tool name sits in
19
- * `permission`. A props matching one of OUR injected
20
- * bash ask sets means the dialog is ours: audit "ask",
21
- * arm the timeout, and — for the R6 env face — mark
22
- * the session deferrable (canDefer, see below).
23
- * permission.replied → properties = { sessionID, requestID, reply } on the
24
- * wire, but the plugin-side observer has also seen it
25
- * with ONLY { sessionID }. The gate therefore cancels
26
- * EVERY pending timer of that session on a reply: an
27
- * already-approved command left on a live timer would
28
- * get a second reject after the timeout, the SDK call
29
- * would hit a dead id (4xx) and flip the gate
30
- * permanently degraded.
31
- *
32
- * Older/typed spellings (`permission.updated`, `pattern`, `permissionID`,
33
- * `response`) keep being accepted — the shipped SDK d.ts still names the
34
- * events that way, and some builds omit the reply id entirely (a short
35
- * ghost-suppression window per session then absorbs late/duplicate `asked`
36
- * replays instead of re-arming a ghost timer).
37
- *
38
- * Hard rules (HUMAN-approved):
39
- * - the plugin NEVER self-allows: `reply` is fixed to "reject". The only
40
- * way a gated command runs is a human approving the dialog;
41
- * - on `TM_ENV_PROTECT=off` the gate is not armed (the caller decides);
42
- * - deferral is SESSION-SCOPED (canDefer): only sessions registered as
43
- * carrying our injected ask set may have env reads passed through —
44
- * registration comes from an exec-role user prompt (the live-proven
45
- * `message.updated` UserMessage{role,agent,sessionID} signal, plus the
46
- * documented `chat.message` hook) or from an R6-env-classified asked
47
- * event. Stock build/plan sessions never register, so the global R6
48
- * hook keeps hard-throwing there — closing the R6 bypass the global
49
- * `isArmed()` deferral allowed;
50
- * - if the SDK reply FAILS (network/host — including the SDK's
51
- * `throwOnError:false` envelope resolving with `{ error }`), we cannot
52
- * close the dialog, so the gate flips itself permanently "degraded" —
53
- * the R6 hook stops deferring env reads and hard-throws them again
54
- * (fail-closed), and the event is audited "degraded".
55
- *
56
- * SDK surface (probed live): the host client may carry NO `permission`
57
- * namespace and NO list/create endpoint; the reply path is the top-level
58
- * `postSessionIdPermissionsPermissionId({ path: { id: sessionID,
59
- * permissionID }, body: { response } })`. `client.permission.reply` /
60
- * `client.permission.list` are still tried first so a richer host build is
61
- * supported, but when they are absent the poll fallback is a no-op (events
62
- * are the sole pending signal).
63
- */
64
- import { ENV_PROTECT_SERVICE, categorizePermission } from "./envprotect.js";
65
- import { resolveTmConfig } from "./tm/config.js";
66
- /** Default timeout, in minutes, before an unanswered dialog is auto-rejected.
67
- * 1 min (user directive) — an unanswered dialog no longer hangs for 10.
68
- * A short timer is safe because a reject that lands on an already-closed
69
- * request is benign; see `MIN_ASK_TIMEOUT_MIN` for the full rationale. */
70
- export const DEFAULT_ASK_TIMEOUT_MIN = 1;
71
- /**
72
- * Hard floor (minutes) for the auto-reject timeout. The HISTORIC 3-min
73
- * floor existed to dodge the measured ~120s `permission.replied` bus lag:
74
- * a shorter timer would fire before the cancel arrives and auto-reject a
75
- * just-approved request. That lag, though, is the HOST DELIVERING the
76
- * replied event to the plugin over the bus — NOT the host resolving the
77
- * user's click: an approval takes effect instantly host-side, so the
78
- * plugin's late reject simply targets an already-closed request id → 404.
79
- * T2's `classifyReplyFailure` maps that outcome to the benign
80
- * `already-closed` verdict (it never flips the gate to `degraded`, and the
81
- * approved command runs either way); `onReplied` records a reply landing
82
- * after the auto-reject as `late-<verdict>` for observability. With that
83
- * classification in place a short timeout no longer disables the gate, so
84
- * the floor drops to 1 minute (user directive). Trade-off: an UNANSWERED
85
- * dialog auto-rejects after 1 min — a user who stepped away re-triggers
86
- * the command. In-range values below the floor still clamp UP to it.
87
- *
88
- * This is the FALLBACK default of the floor. The live floor comes from the
89
- * P0 config knob `TM_ASK_TIMEOUT_FLOOR_MIN`
90
- * (`resolveTmConfig().askTimeoutFloorMin`, itself defaulted to 1).
91
- */
92
- export const MIN_ASK_TIMEOUT_MIN = 1;
93
- /** Poll cadence (ms) that re-scans pending permissions in case an event was
94
- * missed — only meaningful when the client exposes a list capability. */
95
- const POLL_INTERVAL_MS = 60 * 1000;
96
- /** Suppression window (ms) for late/duplicate `permission.asked` replays
97
- * after a `permission.replied` that carried NO permission id. Ghost timers
98
- * are the degraded-flip poison (dead id → 4xx → permanent degraded); the
99
- * window only sacrifices the timeout for brand-new asks of the same session
100
- * for this short period, never a self-allow. */
101
- const GHOST_ASK_WINDOW_MS = 60 * 1000;
102
- /** Cap on the closed-permission-id tombstone LRU (ids are unique, so it is
103
- * purely an anti-ghost cache + late-verdict provenance store — pruning the
104
- * oldest is sufficient). */
105
- const MAX_TOMBSTONES = 500;
106
- /**
107
- * Resolve `TM_ASK_TIMEOUT_MIN`. Unset / blank / non-numeric / <1 / >1440
108
- * (24h) fall back to the 1-minute default — a mistyped value can never
109
- * disable the timeout or make it absurdly long. Valid values below the
110
- * floor clamp UP to it — the floor is the P0 config knob
111
- * `TM_ASK_TIMEOUT_FLOOR_MIN` (`resolveTmConfig().askTimeoutFloorMin`,
112
- * default 1). The historic ~120s bus-lag reason for a 3-min floor is
113
- * obsolete: a late reject on an already-closed id is benign
114
- * `already-closed`, not a degraded flip (see `MIN_ASK_TIMEOUT_MIN`).
115
- */
116
- export function resolveAskTimeoutMs(env = process.env) {
117
- const raw = env.TM_ASK_TIMEOUT_MIN;
118
- if (typeof raw !== "string" || raw.trim() === "")
119
- return DEFAULT_ASK_TIMEOUT_MIN * 60 * 1000;
120
- const n = Number(raw.trim());
121
- if (!Number.isFinite(n))
122
- return DEFAULT_ASK_TIMEOUT_MIN * 60 * 1000;
123
- const min = Math.trunc(n);
124
- if (min < 1 || min > 1440)
125
- return DEFAULT_ASK_TIMEOUT_MIN * 60 * 1000;
126
- // Floor read from the config knob (bounded to [1,1440] by envInt) so a
127
- // stricter posture can raise it WITHOUT a source change; default is 1.
128
- const floorMin = resolveTmConfig(env).askTimeoutFloorMin;
129
- return Math.max(min, floorMin) * 60 * 1000;
130
- }
131
- /** Best-effort structured audit; a failing log endpoint never breaks the gate. */
132
- function auditAsk(client, tool, category, verdict) {
133
- try {
134
- // `app.log({...})` is a METHOD call on `app` — casting the fetched
135
- // function and invoking it plain (`(app.log as Fn)({...})`) drops the
136
- // SDK `this` exactly like the historic R6 audit bug did, silently
137
- // killing every gate audit line (pinned by the this-bound §7 mocks).
138
- const app = client?.app;
139
- if (!app || typeof app.log !== "function")
140
- return;
141
- void app.log({
142
- body: {
143
- level: "warn",
144
- service: ENV_PROTECT_SERVICE,
145
- message: `${ENV_PROTECT_SERVICE} :: ${tool} :: ${category} :: ${verdict}`,
146
- },
147
- });
148
- }
149
- catch {
150
- /* audit is best-effort */
151
- }
152
- }
153
- /**
154
- * The SDK default is `throwOnError:false` (types/sdk.gen contract): an HTTP
155
- * failure — e.g. a 4xx on an already-closed permission id — RESOLVES with an
156
- * `{ error }` envelope instead of rejecting. Unwrapping it into a throw is
157
- * what makes the Layer-3 degraded flip actually fire on the real host.
158
- */
159
- function unwrapSdkEnvelope(res) {
160
- if (res && typeof res === "object" && "error" in res) {
161
- const err = res.error;
162
- if (err) {
163
- // Carry the HTTP status ONTO the thrown error. On the real host the
164
- // status sits at `res.response.status` (NOT on the error body), and
165
- // `classifyReplyFailure` needs it to tell a benign 404 (dialog already
166
- // closed — the D4 late-reply race) from a shape-bug 400 / a transport
167
- // failure. Falls back to an error-body status, then undefined.
168
- const status = res.response?.status ??
169
- err.status;
170
- throw Object.assign(err, { status });
171
- }
172
- }
173
- return res;
174
- }
175
- /**
176
- * Non-privacy diagnostic appended to a `degraded` audit verdict: the error
177
- * CLASS name and host status code only — never message text, request params
178
- * or paths (privacy red line). Handles both thrown Errors and `{error}`
179
- * envelope bodies (`{ error: { name, status | status_code } }`); the name passes an
180
- * identifier whitelist so hostile/echoed text can never ride into the log.
181
- */
182
- function errorDiagnostic(err) {
183
- const e = err;
184
- const name = typeof e?.name === "string" && /^[A-Za-z][A-Za-z0-9_.-]{0,63}$/.test(e.name)
185
- ? e.name
186
- : "Error";
187
- const rawStatus = [e?.status, e?.statusCode, e?.status_code].find((v) => typeof v === "number" && Number.isFinite(v));
188
- return ` err=${name}${rawStatus !== undefined ? ` status=${rawStatus}` : ""}`;
189
- }
190
- /**
191
- * Classify a reply-call failure so the gate no longer flips permanently
192
- * `degraded` on a harmless close. `unwrapSdkEnvelope` has already hoisted the
193
- * HTTP status onto the thrown envelope error; a genuine `Promise.reject`
194
- * arrives as a plain Error with no status.
195
- * - `benign-closed`: 404, or a NotFound/PermissionNotFound name/_tag — the
196
- * dialog was ALREADY closed on the host (the D4 late-reply race): our
197
- * reject was a no-op, so the popup path stays trustworthy.
198
- * - `param-shape`: 400, or a BadRequest/InvalidRequest name/_tag — our
199
- * reply body/params are wrong for this host: a real integration bug.
200
- * - `transport`: everything else — a genuine Error, a 5xx, or an empty /
201
- * status-less body — we could not reach or close the dialog.
202
- * Reads only the error CLASS + status number (privacy: never message text).
203
- */
204
- export function classifyReplyFailure(err) {
205
- const e = err;
206
- const rawStatus = [e?.status, e?.statusCode, e?.status_code].find((v) => typeof v === "number" && Number.isFinite(v));
207
- const tag = `${typeof e?.name === "string" ? e.name : ""} ${typeof e?._tag === "string" ? e._tag : ""}`.trim();
208
- if (rawStatus === 404 || /NotFound|PermissionNotFound/.test(tag))
209
- return "benign-closed";
210
- if (rawStatus === 400 || /BadRequest|InvalidRequest/.test(tag))
211
- return "param-shape";
212
- return "transport";
213
- }
214
- /** A recognized human reply word -> its audit verdict; null for anything the
215
- * out-of-vocabulary path keeps silent about (used by the LATE-verdict audit
216
- * so an unknown late word can never fabricate a verdict or a `late-degraded`). */
217
- function lateVerdictWord(lower) {
218
- if (lower === "reject")
219
- return "rejected";
220
- if (lower === "always")
221
- return "allowed-always";
222
- if (lower === "once")
223
- return "allowed-once";
224
- return null;
225
- }
226
- /**
227
- * Build the reject closure. CRITICAL: every SDK endpoint is invoked as a
228
- * METHOD (`perm.reply({...})` / `c.post...({...})` — property-access call
229
- * sites keep the receiver binding). Fetching the function first
230
- * (`const post = c.post...` then `await post({...})`) drops the SDK `this`,
231
- * so EVERY outbound reply died synchronously on the real host — the timer
232
- * fired at ask+timeout yet the dialog stayed open and the gate flipped
233
- * `degraded` (same regression class as the historic app.log audit bug; the
234
- * §7 test mocks now require the binding so it can never come back).
235
- */
236
- function replyCapableFn(client) {
237
- const c = client;
238
- if (!c)
239
- return null;
240
- const perm = c.permission;
241
- if (perm && typeof perm.reply === "function") {
242
- return async (sid, pid) => {
243
- // richest host first (permission.reply), reject-only, both param shapes
244
- return unwrapSdkEnvelope(
245
- // `!` + property-access call site: binding survives, compiler stays happy
246
- await perm.reply({ path: { sessionID: sid, id: pid }, body: { response: "reject" } }));
247
- };
248
- }
249
- if (typeof c.postSessionIdPermissionsPermissionId === "function") {
250
- return async (sid, pid) => unwrapSdkEnvelope(await c.postSessionIdPermissionsPermissionId({
251
- path: { id: sid, permissionID: pid },
252
- body: { response: "reject" },
253
- }));
254
- }
255
- return null;
256
- }
257
- function listCapableFn(client) {
258
- const c = client;
259
- const perm = c?.permission;
260
- if (perm && typeof perm.list === "function") {
261
- // method call on `perm` — `this` must survive (see replyCapableFn note)
262
- return async () => await perm.list({});
263
- }
264
- return null;
265
- }
266
- /** True when the client exposes a permission-reply path at all. index.ts
267
- * arms the gate ONLY for such a client — fail-closed otherwise (no armed
268
- * auto-reject ⇒ the R6 hook keeps hard-throwing every env read). */
269
- export function hasPermissionReplyCapability(client) {
270
- return replyCapableFn(client) !== null;
271
- }
272
- /** First string-ish value among the host's several id/response spellings. */
273
- function str(...values) {
274
- for (const v of values) {
275
- if (typeof v === "string" && v.trim() !== "")
276
- return v.trim();
277
- }
278
- return undefined;
279
- }
280
- /**
281
- * Create the approval gate. It is intentionally pure about timing +
282
- * replying + session registration; the caller (index.ts) decides whether to
283
- * arm it (mode != off AND the client is reply-capable), feeds events in, and
284
- * wires `canDefer(sessionID)` into the R6 hook.
285
- */
286
- export function createApprovalGate(deps) {
287
- const { client, timeoutMs } = deps;
288
- const timers = deps.timers ?? {
289
- // unref() so a pending timeout never, on its own, keeps the host process
290
- // alive (same philosophy as the blackboard sweeper's unref'd interval)
291
- setTimeoutFn: (cb, ms) => {
292
- const t = setTimeout(cb, ms);
293
- if (typeof t?.unref === "function")
294
- t.unref();
295
- return t;
296
- },
297
- clearTimeoutFn: (h) => clearTimeout(h),
298
- };
299
- const nowMs = deps.now ?? (() => Date.now());
300
- const notify = deps.notify;
301
- const reply = replyCapableFn(client);
302
- const list = listCapableFn(client);
303
- const pending = new Map();
304
- /** Sessions known to carry our injected ask set (deferral whitelist). */
305
- const liveAsk = new Set();
306
- /** Permission ids already closed (replied / timed out): a late or
307
- * duplicated `asked` replay for one must never re-arm a ghost timer.
308
- * Upgraded from a bare Set to a small LRU map — R1#8 — so a LATE
309
- * `permission.replied` (the human's decision reaching the plugin AFTER the
310
- * timer already auto-rejected) can be audited with its real category.
311
- * Bounded at MAX_TOMBSTONES with the oldest evicted. */
312
- const closed = new Map();
313
- /** Sessions whose reply carried NO permission id → suppress fresh asks of
314
- * that session briefly (map sid → expiry ms). */
315
- const repliedNoId = new Map();
316
- /** Sessions blanket-approved for env reads ("always" on an env ask). */
317
- const envApprovedSessions = new Set();
318
- let armed = true;
319
- let degraded = false;
320
- let pollHandle = null;
321
- function remove(id) {
322
- const rec = pending.get(id);
323
- if (rec) {
324
- timers.clearTimeoutFn(rec.timer);
325
- pending.delete(id);
326
- }
327
- return rec;
328
- }
329
- function tombstone(id, sid, cat) {
330
- // LRU touch: delete+set moves the id to the newest end. Re-inserting a
331
- // known id preserves its recorded cat/sid when THIS call omits them, so a
332
- // late/duplicate reply never overwrites the real category a prior close
333
- // (fireReject / first reply) recorded.
334
- const prev = closed.get(id);
335
- closed.delete(id);
336
- closed.set(id, {
337
- sid: sid ?? prev?.sid ?? "",
338
- cat: cat ?? prev?.cat ?? "danger",
339
- at: nowMs(),
340
- });
341
- while (closed.size > MAX_TOMBSTONES) {
342
- const oldest = closed.keys().next().value;
343
- if (oldest === undefined)
344
- break;
345
- closed.delete(oldest);
346
- }
347
- }
348
- /** True while sid is inside the no-id-reply ghost window. */
349
- function ghostSuppressed(sid) {
350
- const expiry = repliedNoId.get(sid);
351
- if (expiry === undefined)
352
- return false;
353
- if (expiry <= nowMs()) {
354
- repliedNoId.delete(sid);
355
- return false;
356
- }
357
- return true;
358
- }
359
- async function fireReject(id, cat) {
360
- const rec = pending.get(id);
361
- if (!rec)
362
- return;
363
- pending.delete(id);
364
- tombstone(id, rec.sid, rec.cat);
365
- let ok = false;
366
- let errDiag = "";
367
- let failClass = null;
368
- try {
369
- if (reply) {
370
- // unwrapSdkEnvelope inside `reply` turns the SDK `{error}` envelope into a
371
- // throw (carrying the hoisted HTTP status); a rejecting transport
372
- // lands in the same catch.
373
- await reply(rec.sid, id);
374
- ok = true;
375
- }
376
- }
377
- catch (err) {
378
- ok = false;
379
- failClass = classifyReplyFailure(err);
380
- errDiag = errorDiagnostic(err);
381
- }
382
- // Classify a failed reply instead of a blanket degraded flip:
383
- // benign-closed (404 / NotFound) — the dialog was ALREADY closed on the
384
- // host (the D4 late-reply race): our reject was a harmless no-op, NOT
385
- // an integration fault, so the popup path stays trustworthy. Do NOT
386
- // flip degraded — one dead-id reject must never poison the whole gate.
387
- // param-shape (400 / BadRequest) — our reply shape is wrong for this
388
- // host: a real bug, fail closed.
389
- // transport (a real Error / 5xx / status-less body) — we could not reach
390
- // or close the dialog: fail closed (the historic behaviour).
391
- if (!ok && failClass !== "benign-closed") {
392
- // Layer 3 fallback: stop trusting the popup path; the hook reverts to
393
- // hard-throwing env reads.
394
- degraded = true;
395
- }
396
- const verdict = ok
397
- ? "timeout-rejected"
398
- : failClass === "benign-closed"
399
- ? "already-closed"
400
- : failClass === "param-shape"
401
- ? "rejected-shape-bug"
402
- : "degraded";
403
- // every failure verdict carries the non-privacy error class/status tail
404
- // (see errorDiagnostic) so a live-host failure is diagnosable from the log
405
- auditAsk(client, "bash", cat, verdict + errDiag);
406
- }
407
- function arm(id, sid, cat) {
408
- if (pending.has(id))
409
- return;
410
- const timer = timers.setTimeoutFn(() => void fireReject(id, cat), timeoutMs);
411
- pending.set(id, { sid, cat, timer });
412
- }
413
- /** Single registration funnel for both event and poll discovery. */
414
- function registerAsk(id, sid, cat) {
415
- if (!id || !sid)
416
- return;
417
- if (closed.has(id))
418
- return; // ghost replay of a closed request
419
- if (ghostSuppressed(sid))
420
- return; // replied-without-id; assume a replay
421
- if (pending.has(id))
422
- return;
423
- // The R6 ENV face is the deferral proof: only sessions whose dialogs
424
- // actually carry our injected env-ask patterns (or an exec-role
425
- // chat.message, see registerExecSession) may defer env reads. Danger
426
- // faces never register — stock hosts that ask on `rm` by default must
427
- // not gain env deferral.
428
- if (cat === "env")
429
- liveAsk.add(sid);
430
- auditAsk(client, "bash", cat, "ask");
431
- arm(id, sid, cat);
432
- }
433
- async function pollOnce() {
434
- if (!list || !armed)
435
- return;
436
- try {
437
- const res = await list();
438
- const data = Array.isArray(res) ? res : res?.data;
439
- if (Array.isArray(data)) {
440
- for (const item of data) {
441
- const props = item?.properties ?? item;
442
- const cat = categorizePermission(props);
443
- if (!cat)
444
- continue;
445
- const p = props;
446
- registerAsk(str(p.id, p.permissionID, p.requestID), str(p.sessionID), cat);
447
- }
448
- }
449
- }
450
- catch {
451
- /* poll is best-effort */
452
- }
453
- }
454
- function schedulePoll() {
455
- pollHandle = timers.setTimeoutFn(() => {
456
- void pollOnce().finally(() => {
457
- // dispose() during an in-flight poll must not re-arm a zombie chain
458
- if (armed)
459
- schedulePoll();
460
- });
461
- }, POLL_INTERVAL_MS);
462
- }
463
- /** Toasted request ids (cap-bounded) — duplicate `asked` replays for one
464
- * dialog must not spam notifications. */
465
- const notified = new Set();
466
- function onAsked(props) {
467
- // attention hook FIRST, for EVERY dialog (not just our categorized asks):
468
- // the user asked to be notified wherever a confirmation window pops
469
- const id = str(props.id, props.permissionID, props.requestID);
470
- if (notify) {
471
- if (!id || !notified.has(id)) {
472
- if (id) {
473
- notified.add(id);
474
- if (notified.size > 256) {
475
- // keep the set bounded; ids are tombstoned on reply anyway
476
- const first = notified.values().next().value;
477
- if (first !== undefined)
478
- notified.delete(first);
479
- }
480
- }
481
- try {
482
- const perm = String(props.permission ?? props.permissionID ?? "permission");
483
- const patterns = Array.isArray(props.patterns) ? props.patterns.map(String) : [];
484
- const detail = patterns.length > 0 ? patterns[0] : perm;
485
- notify(`等待你的批准:${detail}(${Math.round(timeoutMs / 60000)} 分钟无应答将自动拒绝)`);
486
- }
487
- catch {
488
- /* notification is best-effort — never break the gate */
489
- }
490
- }
491
- }
492
- if (degraded)
493
- return; // auto-reject is broken — do not open new timers
494
- const cat = categorizePermission(props);
495
- if (!cat)
496
- return; // not one of our injected bash asks → leave it to the human
497
- registerAsk(str(props.id, props.permissionID, props.requestID), str(props.sessionID), cat);
498
- }
499
- function onReplied(props) {
500
- const sid = str(props.sessionID);
501
- const id = str(props.requestID, props.permissionID, props.id);
502
- const resp = str(props.reply, props.response);
503
- // Capture prior-closed state BEFORE this reply tombstones the id: the
504
- // late-verdict audit must fire only for a reply that arrives AFTER the id
505
- // was already closed (a timeout auto-reject / an earlier reply), not for
506
- // the first-ever reply we happen to be tombstoning right now.
507
- const wasClosed = id ? closed.has(id) : false;
508
- const prec = id ? pending.get(id) : undefined;
509
- if (id)
510
- tombstone(id, sid ?? prec?.sid, prec?.cat);
511
- // Real 1.18.29 replied props identify the request via `requestID` — and
512
- // the plugin-side observer has seen builds carrying ONLY { sessionID }.
513
- // Cancel EVERY pending timer of the session either way: an approved
514
- // command left timed would fire a reject on a dead id (4xx) and flip the
515
- // gate permanently degraded.
516
- const affected = [];
517
- let removed;
518
- if (id) {
519
- removed = remove(id);
520
- if (removed)
521
- affected.push(removed);
522
- }
523
- for (const [pid, rec] of [...pending]) {
524
- if (sid && rec.sid === sid) {
525
- pending.delete(pid);
526
- timers.clearTimeoutFn(rec.timer);
527
- tombstone(pid, rec.sid, rec.cat);
528
- affected.push(rec);
529
- }
530
- }
531
- if (!id && sid)
532
- repliedNoId.set(sid, nowMs() + GHOST_ASK_WINDOW_MS);
533
- // R1#8 — LATE VERDICT OBSERVABILITY: the id was ALREADY closed (remove()
534
- // found nothing, and it was closed before this reply — `wasClosed`), yet a
535
- // real reply word rode in afterwards: the human's decision reached the
536
- // plugin past the auto-reject (the D4 race the timeout floor guards). The
537
- // reject already landed, so this is OBSERVABILITY ONLY — it never re-arms a
538
- // timer, never revives the command, and sends NO SDK reply, so it cannot
539
- // breach "the plugin only ever rejects". The category comes from the
540
- // original close, so the audit line stays well-formed with no command text.
541
- if (id && !removed && wasClosed && resp) {
542
- const entry = closed.get(id);
543
- const late = entry ? lateVerdictWord(resp.toLowerCase()) : null;
544
- if (entry && late)
545
- auditAsk(client, "bash", entry.cat, `late-${late}`);
546
- }
547
- for (const rec of affected) {
548
- if (!resp)
549
- continue; // outcome unknown: cancel silently, never invent a verdict
550
- const lower = resp.toLowerCase();
551
- const verdict = lower === "reject" ? "rejected"
552
- : lower === "always" ? "allowed-always"
553
- : lower === "once" ? "allowed-once"
554
- : "degraded"; // out-of-vocabulary word: record it honestly, not as "rejected"
555
- auditAsk(client, "bash", rec.cat, verdict);
556
- // "always" on an env-related ask → blanket-approve all env reads for
557
- // this session (the host's pattern generalization is too broad, so we
558
- // interpret "always" as a session-scoped env approval). The hook
559
- // still hard-throws env-FILE reads (CATEGORY_ENV_FILE_PATH) in an
560
- // env-approved session: files on disk never open a dialog of their
561
- // own, so no "always" verdict can have consented to them.
562
- if (verdict === "allowed-always" && sid && /^(bash-)?env/.test(rec.cat)) {
563
- envApprovedSessions.add(sid);
564
- }
565
- }
566
- }
567
- /** Global gate health: armed, not degraded, and the client can reply. */
568
- function healthy() {
569
- return armed && !degraded && reply !== null;
570
- }
571
- return {
572
- handleEvent(event) {
573
- if (!armed)
574
- return; // disposed
575
- const type = String(event?.type ?? "");
576
- const props = event?.properties;
577
- if (!props)
578
- return;
579
- // live host 1.18.29 emits `permission.asked`; the shipped d.ts spells
580
- // the same signal `permission.updated` — accept both open spellings
581
- if (type === "permission.asked" || type === "permission.updated")
582
- onAsked(props);
583
- else if (type === "permission.replied")
584
- onReplied(props);
585
- },
586
- start() {
587
- // When the host has no list endpoint (`list` is null), events are the
588
- // only pending signal, so start() is a deliberate no-op.
589
- if (!list || !armed)
590
- return;
591
- schedulePoll();
592
- },
593
- dispose() {
594
- armed = false;
595
- if (pollHandle != null)
596
- timers.clearTimeoutFn(pollHandle);
597
- pollHandle = null;
598
- for (const id of [...pending.keys()])
599
- remove(id);
600
- },
601
- isArmed() {
602
- return healthy();
603
- },
604
- canDefer(sessionID) {
605
- // bound-method-safe (no `this`): destructure-able by the R6 hook
606
- return healthy() && !!sessionID && liveAsk.has(sessionID);
607
- },
608
- hasLiveAsk(sessionID) {
609
- return sessionID ? liveAsk.has(sessionID) : false;
610
- },
611
- registerExecSession(sessionID) {
612
- if (sessionID)
613
- liveAsk.add(sessionID);
614
- },
615
- revokeExecSession(sessionID) {
616
- if (sessionID)
617
- liveAsk.delete(sessionID);
618
- },
619
- isEnvApproved(sessionID) {
620
- return !!sessionID && envApprovedSessions.has(sessionID);
621
- },
622
- pendingSize() {
623
- return pending.size;
624
- },
625
- };
626
- }
627
- //# sourceMappingURL=approval-gate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"approval-gate.js","sourceRoot":"","sources":["../src/approval-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAGH,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;2EAG2E;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAEpC;0EAC0E;AAC1E,MAAM,gBAAgB,GAAG,EAAE,GAAG,IAAI,CAAA;AAElC;;;;iDAIiD;AACjD,MAAM,mBAAmB,GAAG,EAAE,GAAG,IAAI,CAAA;AAErC;;6BAE6B;AAC7B,MAAM,cAAc,GAAG,GAAG,CAAA;AAkB1B;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAA0C,OAAO,CAAC,GAAG;IACvF,MAAM,GAAG,GAAG,GAAG,CAAC,kBAAkB,CAAA;IAClC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAA;IAC5F,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAA;IACnE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACzB,IAAI,GAAG,GAAG,CA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zD,UAAU,GAAG,IAAI,CAAA;YACjB,KAAK,MAAM,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;gBAAE,MAAM,CAAC,EAAE,CAAC,CAAA;QAClD,CAAC;QACD,OAAO;YACL,OAAO,OAAO,EAAE,CAAA;QAClB,CAAC;QACD,QAAQ,CAAC,SAAkB;YACzB,iEAAiE;YACjE,OAAO,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC3D,CAAC;QACD,UAAU,CAAC,SAAkB;YAC3B,OAAO,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;QACnD,CAAC;QACD,mBAAmB,CAAC,SAAkB;YACpC,IAAI,SAAS;gBAAE,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QACvC,CAAC;QACD,iBAAiB,CAAC,SAAkB;YAClC,IAAI,SAAS;gBAAE,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;QAC1C,CAAC;QACD,aAAa,CAAC,SAAkB;YAC9B,OAAO,CAAC,CAAC,SAAS,IAAI,mBAAmB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;QAC1D,CAAC;QACD,WAAW;YACT,OAAO,OAAO,CAAC,IAAI,CAAA;QACrB,CAAC;KACF,CAAA;AACH,CAAC"}
package/dist/host/v1.d.ts DELETED
@@ -1,14 +0,0 @@
1
- /**
2
- * The v1 personality: everything this plugin does through the OpenCode 1.18.x
3
- * `server(input, options)` hook object. Moved out of `src/index.ts` verbatim
4
- * for the v2 port (see docs plan) — no behaviour change is allowed here; a v1
5
- * host must observe byte-identical hooks, and the ~1700 assertions in
6
- * test-*.mjs are the oracle that keeps that promise.
7
- *
8
- * v1-only by construction: the single composed `tool.execute.before` slot, the
9
- * permission-event approval gate, the `{"*": "ask"}` bash escalation object,
10
- * and `tui.showToast` notification.
11
- */
12
- import type { PluginInput, Hooks } from "../types.js";
13
- export declare function createV1Personality(input: PluginInput, options?: Record<string, unknown>): Promise<Hooks>;
14
- //# sourceMappingURL=v1.d.ts.map