opencode-swarm 7.192.3 → 7.193.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 (106) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +2 -2
  2. package/.opencode/skills/swarm-pr-review/references/verdict-settlement-contract.md +17 -0
  3. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  4. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  5. package/dist/cli/{auto-checkpoint-8c7hpz0z.js → auto-checkpoint-taay16xe.js} +7 -7
  6. package/dist/cli/{checkpoint-98h7ftn4.js → checkpoint-6229g3jq.js} +14 -14
  7. package/dist/cli/{coder-settlement-0nhsjfh1.js → coder-settlement-hexmmefv.js} +10 -10
  8. package/dist/cli/{config-doctor-ah661gsm.js → config-doctor-3ghvthh5.js} +13 -13
  9. package/dist/cli/{core-eyk369jx.js → core-0k7t9fw0.js} +3 -3
  10. package/dist/cli/{curation-policy-yzdznz4z.js → curation-policy-8j6qn6nt.js} +4 -4
  11. package/dist/cli/{curator-drift-k6f7mnj5.js → curator-drift-a5142x0d.js} +8 -8
  12. package/dist/cli/{curator-t9cwtz64.js → curator-kwwnkyr7.js} +40 -40
  13. package/dist/cli/curator-llm-factory-8gt3mvg9.js +82 -0
  14. package/dist/cli/{doctor-knowledge-receipt-phase-id-dwygxv2m.js → doctor-knowledge-receipt-phase-id-11nsf9tz.js} +7 -7
  15. package/dist/cli/{evidence-summary-service-b9xq092m.js → evidence-summary-service-y2ykc6ta.js} +17 -17
  16. package/dist/cli/{gate-evidence-g3qpsr62.js → gate-evidence-cd5299js.js} +5 -5
  17. package/dist/cli/guardrail-explain-hpgecr7x.js +83 -0
  18. package/dist/cli/{guardrail-log-b862hykr.js → guardrail-log-g6krx0s2.js} +6 -6
  19. package/dist/cli/{guardrail-reset-avehjarw.js → guardrail-reset-a3xv675m.js} +40 -40
  20. package/dist/cli/{hive-promoter-0zv095rz.js → hive-promoter-90svfzvs.js} +40 -40
  21. package/dist/cli/{index-8zj647hc.js → index-0e318vgt.js} +1 -1
  22. package/dist/cli/{index-04knttpn.js → index-1dx5zyss.js} +1 -1
  23. package/dist/cli/{index-cme96pja.js → index-1p24bfn2.js} +5 -5
  24. package/dist/cli/{index-bgzpw6ge.js → index-3atkcqpb.js} +1 -1
  25. package/dist/cli/{index-bxtyg46p.js → index-3xj89bf0.js} +42 -42
  26. package/dist/cli/{index-g7vd2azv.js → index-4gacy6y6.js} +2 -2
  27. package/dist/cli/{index-3bst6f3c.js → index-4mq8r4be.js} +3 -3
  28. package/dist/cli/{index-ef0tgsgj.js → index-5ev6f1gj.js} +3 -3
  29. package/dist/cli/{index-f6am4ypq.js → index-5n760fzn.js} +6 -6
  30. package/dist/cli/{index-1n7sf9gz.js → index-5rkh69f3.js} +1 -1
  31. package/dist/cli/{index-0e1nxkte.js → index-668npagp.js} +1 -1
  32. package/dist/cli/{index-fzcr2s01.js → index-6dn16dre.js} +5 -5
  33. package/dist/cli/{index-g8jd3h4r.js → index-6s3ab22d.js} +2 -2
  34. package/dist/cli/{index-5gy5dc2n.js → index-7njm9jk1.js} +1 -1
  35. package/dist/cli/{index-eaess7dm.js → index-84k9zzv1.js} +1 -1
  36. package/dist/cli/{index-5mrvx2vm.js → index-bg19b84s.js} +7 -7
  37. package/dist/cli/{index-azr0092e.js → index-bgtfvst1.js} +1 -1
  38. package/dist/cli/{index-nd4kkbjw.js → index-bkpyff61.js} +2 -2
  39. package/dist/cli/{index-4bpnf2eg.js → index-cpt38e0e.js} +30 -8
  40. package/dist/cli/{index-6a4t4p4p.js → index-cs0p582p.js} +4 -4
  41. package/dist/cli/{index-hmgx2bsy.js → index-d2emv8ap.js} +3 -3
  42. package/dist/cli/{index-aqvsxjwn.js → index-db786kn6.js} +40 -40
  43. package/dist/cli/{index-fzqn2kk8.js → index-fd6b9f38.js} +2 -2
  44. package/dist/cli/{index-31bd6hrm.js → index-he2nyr7x.js} +10 -10
  45. package/dist/cli/{index-dtet46e6.js → index-hfnyykvm.js} +5 -5
  46. package/dist/cli/{index-nwswxes7.js → index-hfssjyxs.js} +2 -2
  47. package/dist/cli/{index-5m64x65w.js → index-jx80ed6g.js} +5913 -4458
  48. package/dist/cli/{index-yc8v81ab.js → index-jxs9qnad.js} +4 -4
  49. package/dist/cli/{index-b7nb6c0p.js → index-ma71x1aa.js} +4 -4
  50. package/dist/cli/{index-4twjbsfw.js → index-ndec8akq.js} +1 -1
  51. package/dist/cli/{index-rhjzq6kw.js → index-ngk8hpc3.js} +1 -1
  52. package/dist/cli/{index-b67200rm.js → index-nktwf2xm.js} +6 -6
  53. package/dist/cli/{index-043r3t12.js → index-ntmnse4d.js} +1 -1
  54. package/dist/cli/{index-83swjsyd.js → index-nz6ehpjn.js} +3 -3
  55. package/dist/cli/{index-4e8xcgkx.js → index-prvancd0.js} +2 -2
  56. package/dist/cli/{index-a9m7h5v0.js → index-qh93qjc2.js} +1 -1
  57. package/dist/cli/{index-zdt5m9n2.js → index-r3mffz78.js} +4 -4
  58. package/dist/cli/{index-pq5962z7.js → index-rd9th57y.js} +3 -3
  59. package/dist/cli/{index-dt4cjxbz.js → index-st80sjg7.js} +1 -1
  60. package/dist/cli/{index-4g39c948.js → index-tr47q89d.js} +4 -4
  61. package/dist/cli/{index-bccf3c0h.js → index-vbp35frb.js} +2 -2
  62. package/dist/cli/{index-mbn4vn3z.js → index-vg8sxg12.js} +1 -1
  63. package/dist/cli/{index-5dws7eyb.js → index-w2vbaczx.js} +1 -1
  64. package/dist/cli/{index-fayfa263.js → index-x2phyvcv.js} +3 -3
  65. package/dist/cli/{index-8z8cj2rz.js → index-ymnathfr.js} +7 -7
  66. package/dist/cli/index.js +41 -41
  67. package/dist/cli/{knowledge-escalator-y879xx4c.js → knowledge-escalator-2d7g3hs0.js} +12 -12
  68. package/dist/cli/{knowledge-events-07vpvmmr.js → knowledge-events-hjeaevc9.js} +10 -10
  69. package/dist/cli/{knowledge-link-a5tvjqdt.js → knowledge-link-srnt95wh.js} +3 -3
  70. package/dist/cli/{knowledge-store-wae6s3ef.js → knowledge-store-g9cb2m0v.js} +4 -4
  71. package/dist/cli/{knowledge-validator-v13cjze1.js → knowledge-validator-dghf9pcj.js} +6 -6
  72. package/dist/cli/{mcp-5ns32ees.js → mcp-f5myvd7r.js} +1 -1
  73. package/dist/cli/{model-preflight-06jexzsa.js → model-preflight-4w4wd6dj.js} +40 -40
  74. package/dist/cli/{pending-delegations-8g7nne79.js → pending-delegations-adm6gf3n.js} +10 -10
  75. package/dist/cli/{pr-subscriptions-yp71fzeb.js → pr-subscriptions-n1hks854.js} +10 -10
  76. package/dist/cli/{pr-workflow-gate-rcfwt8jd.js → pr-workflow-gate-59cr6gve.js} +44 -40
  77. package/dist/cli/{runner-8qybgy4n.js → runner-b2e89cp1.js} +4 -4
  78. package/dist/cli/{scan-cursor-9xqrqgbs.js → scan-cursor-t26xmfhd.js} +5 -5
  79. package/dist/cli/{schema-qxgn4xzy.js → schema-cr120ar5.js} +1 -1
  80. package/dist/cli/{scope-persistence-9dscq6a2.js → scope-persistence-mrnz8j43.js} +13 -13
  81. package/dist/cli/{server-v1s76pa3.js → server-mwk6zn83.js} +40 -40
  82. package/dist/cli/{skill-generator-yjeam2kn.js → skill-generator-svs4k0g8.js} +14 -14
  83. package/dist/cli/{snapshot-coordination-init-jqkew1cw.js → snapshot-coordination-init-xzrahhsb.js} +40 -40
  84. package/dist/cli/{speckit-checkoff-atm1ftz7.js → speckit-checkoff-g2qrb1tn.js} +4 -4
  85. package/dist/cli/{workspace-snapshot-vfpnxjsp.js → workspace-snapshot-p69t9zn7.js} +3 -3
  86. package/dist/cli/{worktree-collision-ownership-ftg1bnx6.js → worktree-collision-ownership-d145wmpg.js} +11 -11
  87. package/dist/cli/{worktree-isolation-ttqkatgg.js → worktree-isolation-pt1rws6p.js} +40 -40
  88. package/dist/commands/registry.d.ts +1 -1
  89. package/dist/failures/provider-message-error.d.ts +2 -1
  90. package/dist/hooks/guardrails/tool-before.d.ts +19 -0
  91. package/dist/hooks/injection-policy.d.ts +94 -0
  92. package/dist/hooks/pr-workflow-gate.d.ts +52 -5
  93. package/dist/hooks/shell-executor-context.d.ts +43 -0
  94. package/dist/hooks/shell-write-detect.d.ts +44 -0
  95. package/dist/host/v2/types.d.ts +254 -11
  96. package/dist/index.js +512 -508
  97. package/dist/pr-review/finding-policy.d.ts +1 -1
  98. package/dist/pr-review/verdict-settlement.d.ts +182 -0
  99. package/dist/services/context-budget-service.d.ts +8 -1
  100. package/dist/services/pr-workflow-gh-readiness.d.ts +30 -0
  101. package/dist/tools/complete-pr-workflow.d.ts +13 -0
  102. package/dist/tools/gh-evidence.d.ts +14 -0
  103. package/dist/tools/write-pr-review-artifact.d.ts +1 -1
  104. package/package.json +1 -1
  105. package/dist/cli/curator-llm-factory-9g9p90jz.js +0 -82
  106. package/dist/cli/guardrail-explain-784a2m4p.js +0 -83
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Shared Windows-executor wrapper declaration predicates (#3145).
3
+ *
4
+ * The wrapper-detection regexes lived as four byte-identical copies
5
+ * (resolveWindowsWriteAuthority, the gate's detect() closure, and both
6
+ * explain-service branches). Byte-divergence between those copies was the
7
+ * exact defect class of review rounds 5-7 (one copy drifting flipped
8
+ * explain-vs-gate verdicts), so this module is now the single definition.
9
+ *
10
+ * Switch tolerance (PRR-002): cmd.exe accepts switches between the binary
11
+ * and /c — `cmd /d /s /c copy a b`, `cmd /q /c`, `cmd /v:on /c`. The
12
+ * previous bare-`/c` regexes let every switch form fall through the
13
+ * authority ladder to the POSIX-only reading, which has no `copy`/`move`
14
+ * vocabulary — an out-of-scope write admitted. The same tolerance applies
15
+ * to the PowerShell wrapper strips (PRR-009): `powershell -NoProfile
16
+ * -Command "…"` must unwrap for the (now-authoritative) Windows reading to
17
+ * see the payload.
18
+ */
19
+ /** Statement-position cmd /c declaration (switch-tolerant). */
20
+ export declare const CMD_WRAPPER_DECLARATION: RegExp;
21
+ /** Statement-position powershell/pwsh -Command declaration. */
22
+ export declare const PS_WRAPPER_DECLARATION: RegExp;
23
+ /** Loose powershell phrase (segment start or pipe) used by the ladder. */
24
+ export declare const PS_WRAPPER_LOOSE: RegExp;
25
+ /**
26
+ * True when the command explicitly declares a Windows executor at a
27
+ * statement boundary: a cmd /c wrapper (any switches) or a
28
+ * powershell/pwsh -Command wrapper.
29
+ */
30
+ export declare function declaresWindowsWrapper(command: string): boolean;
31
+ /** Same declaration, additionally accepting the pipe-adjacent loose form. */
32
+ export declare function declaresWindowsWrapperLoose(command: string): boolean;
33
+ /**
34
+ * Leading prefix that positions a cmd builtin (copy/move): an if-exist
35
+ * guard, a switch-tolerant `cmd … /c`, or call/start. Anchored variants of
36
+ * the cmd copy/move matchers compose this so `cmd /d /s /c copy a b` is
37
+ * detected like bare `cmd /c copy a b`.
38
+ */
39
+ export declare const CMD_BUILTIN_PREFIX: RegExp;
40
+ /** Strip pattern for a cmd /c or /k wrapper with any switches. */
41
+ export declare const CMD_STRIP_PREFIX: RegExp;
42
+ /** Strip pattern for a powershell/pwsh -Command/-c wrapper with switches. */
43
+ export declare const PS_STRIP_PREFIX: RegExp;
@@ -52,6 +52,50 @@ export interface ResolvedWriteTarget {
52
52
  */
53
53
  resolved: boolean;
54
54
  }
55
+ /**
56
+ * Issue #3099 R2 (executor context): merge a POSIX analysis with a Windows
57
+ * analysis under a declared AUTHORITY for shared constructs.
58
+ *
59
+ * Both grammars may report the same syntactic construct (e.g. a `>` redirect)
60
+ * with different path readings, because POSIX treats `\` as an escape: the
61
+ * same command yields `src\out.txt` under the Windows reading and `srcout`
62
+ * under POSIX. Only one of those describes what the real executor writes, and
63
+ * the guard cannot observe the executor — so the reading of the AUTHORITY
64
+ * grammar (the one matching the declared executor context: an explicit
65
+ * `cmd /c` / `powershell -Command` wrapper, or a PowerShell-shaped body that
66
+ * POSIX cannot execute at all) is kept, and the supplementary grammar
67
+ * contributes ONLY constructs the authority does not report at all (e.g. a
68
+ * POSIX `cp` inside a PowerShell pipeline). Lexical resemblance alone never
69
+ * discards a reading.
70
+ *
71
+ * `parseError` is carried from the POSIX analysis unchanged: it is the
72
+ * fail-closed backstop, and recomputing it over merged writes would let a
73
+ * malformed command that also writes escape it.
74
+ */
75
+ export declare function mergeWriteAnalyses(primary: WriteAnalysis, additional: WriteAnalysis, additionalIsAuthoritative?: boolean, wrapperDeclared?: boolean): WriteAnalysis;
76
+ export declare function buildDedupeKey(category: string, operator: string, path: string | null | undefined): string;
77
+ /** True when any unquoted word token is a known PowerShell cmdlet. */
78
+ export declare function isPowerShellShaped(command: string): boolean;
79
+ /**
80
+ * True only when the command is positively a read-only PowerShell pipeline.
81
+ *
82
+ * Every condition must hold and the default is fail-closed: anything not
83
+ * positively proven read-only stays subject to the parse-failure rejection.
84
+ *
85
+ * 1. no redirect, `;`, `&`, backtick or `$(` anywhere;
86
+ * 2. quoting and braces balance — a malformed command is never "read-only";
87
+ * 3. splitting on `|` respects quotes (`Select-String -Pattern 'a|b'` is one
88
+ * segment, not two);
89
+ * 4. no write-shaped token of ANY family appears as an unquoted word
90
+ * anywhere (PowerShell Verb-Noun writes, their aliases, POSIX write
91
+ * builtins, in-place editors with an edit flag);
92
+ * 5. every segment head is a known read-only cmdlet (case-insensitive);
93
+ * 6. every script-block body is POSITIVELY validated as a read-only
94
+ * expression by `isReadOnlyScriptBlockBody` — deny-by-default, so a body
95
+ * containing anything unrecognized (including write mechanisms the
96
+ * detectors cannot see) fails and the command stays blocked.
97
+ */
98
+ export declare function isPowerShellReadOnlyPipeline(command: string): boolean;
55
99
  /**
56
100
  * Detect interactive/session tools that should be denied regardless of scope.
57
101
  *
@@ -1,17 +1,29 @@
1
1
  /**
2
2
  * Vendored structural types for the OpenCode 2 plugin API.
3
3
  *
4
- * Provenance: distilled from `@opencode/plugin@2.0.20`
5
- * `dist/promise/{plugin,registration,tool,session,command,agent,event,storage,app,options}.d.ts`
6
- * and `@opencode/schema@2.0.20` `dist/{tool,agent,location}.d.ts`,
7
- * `@opencode/ai` `dist/schema/messages.d.ts` (fetched 2026-09-30, issue #3004).
4
+ * Provenance: distilled from `@opencode/plugin@2.0.26`
5
+ * `dist/promise/{plugin,registration,tool,session,worktree,command,agent,event,storage,app,options}.d.ts`
6
+ * and `@opencode/schema@2.0.26` `dist/{tool,agent,location}.d.ts`,
7
+ * `@opencode/client@2.0.26` `dist/promise/generated/{client,types}.d.ts`,
8
+ * `@opencode/ai` `dist/schema/messages.d.ts` (fetched 2026-10-09, issues #3004 / #3169).
8
9
  * Structural only — deliberately no runtime dependency on `@opencode/plugin`.
9
10
  *
10
- * Drift guard: DEFERRED to the #2910 follow-up PR (a check-host-contract v2 digest leg over this corpus, plus the dual-host CI lane); until it lands, type truth rests on this provenance pin and the live-host smoke. See docs/host/v2-hook-inventory.md for the full v1-to-v2 map.
11
+ * Flattening note: the client's Effect-generated input types express optional fields as
12
+ * `{ field: Body["field"] }` records; they are vendored here as plain optional fields of the
13
+ * same types (e.g. `SessionCreateInput` is all-optional in the published form).
14
+ *
15
+ * Drift guard: DEFERRED to the #2910 follow-up PR (a check-host-contract v2 digest leg over this corpus, plus the dual-host CI lane); until it lands, type truth rests on this provenance pin (now 2.0.26) and the live-host smoke. See docs/host/v2-hook-inventory.md for the full v1-to-v2 map.
16
+ *
17
+ * Host-tolerance contract for the session/worktree method surface (issue #3169 Phase 1):
18
+ * the members below are REQUIRED to mirror the published `SessionDomain`/`WorktreeDomain`,
19
+ * but nothing in Phase 1 calls them. Phase 2 call sites MUST feature-detect
20
+ * (`typeof ctx.session.create === 'function'`) and degrade — requiredness is type-level
21
+ * only and a 2.0.2x host lacking a member must never crash the adapter.
11
22
  *
12
23
  * Only the surfaces this adapter consumes are typed. Unknown fields are
13
24
  * intentionally left off; the adapter never relies on their absence.
14
- * Upstream: @opencode/plugin@2.0.20 and @opencode/schema@2.0.20 (MIT, sst/opencode).
25
+ * Upstream: @opencode/plugin@2.0.26, @opencode/schema@2.0.26 and
26
+ * @opencode/client@2.0.26 (MIT, sst/opencode).
15
27
  */
16
28
  /** v2 `App` — host identity (dist/app.d.ts). */
17
29
  export interface V2App {
@@ -157,15 +169,244 @@ export interface V2SessionPromptEvent {
157
169
  };
158
170
  readonly delivery?: string;
159
171
  }
160
- /** v2 `SessionDomain` (only hook used by this adapter). */
172
+ /**
173
+ * v2 session-call input types (`@opencode/client@2.0.26` generated types, flattened —
174
+ * see the module header's flattening note). Only the fields with published evidence
175
+ * are named; the index signature keeps them structural, not exhaustive.
176
+ */
177
+ /** `Model.Ref` (schema/model.d.ts). */
178
+ export interface V2ModelRef {
179
+ readonly id: string;
180
+ readonly providerID: string;
181
+ readonly variant?: string;
182
+ }
183
+ /** Session permission rule (schema/permission.d.ts shape on create/switch inputs). */
184
+ export interface V2SessionPermission {
185
+ readonly action: string;
186
+ readonly resource: string;
187
+ readonly effect: 'allow' | 'deny' | 'ask';
188
+ }
189
+ /** `SessionCreateInput` — all-optional in the published (Effect-generated) form. */
190
+ export interface V2SessionCreateInput {
191
+ readonly id?: string | null;
192
+ readonly parentID?: string | null;
193
+ readonly title?: string | null;
194
+ readonly agent?: string | null;
195
+ readonly model?: V2ModelRef | null;
196
+ readonly location?: {
197
+ readonly directory: string;
198
+ } | null;
199
+ readonly metadata?: Readonly<Record<string, unknown>> | null;
200
+ readonly permissions?: ReadonlyArray<V2SessionPermission> | null;
201
+ }
202
+ /**
203
+ * `SessionPromptInput` (`@opencode/client@2.0.26` generated, flattened):
204
+ * `sessionID` and `text` are required; `command`/`args` are NOT members of
205
+ * this input (the command shape is `name` + `text` on `SessionCommandInput` —
206
+ * the earlier fabricated members were removed in the PR-review feedback pass).
207
+ * Attachment members are abbreviated structural shapes.
208
+ */
209
+ export interface V2SessionPromptCallInput {
210
+ readonly sessionID: string;
211
+ readonly text: string;
212
+ readonly id?: string | null;
213
+ readonly files?: ReadonlyArray<{
214
+ readonly uri: string;
215
+ readonly name?: string;
216
+ readonly description?: string;
217
+ }>;
218
+ readonly agents?: ReadonlyArray<{
219
+ readonly name: string;
220
+ }>;
221
+ readonly skills?: ReadonlyArray<{
222
+ readonly id: string;
223
+ }>;
224
+ readonly metadata?: Readonly<Record<string, unknown>>;
225
+ readonly delivery?: 'steer' | 'queue' | null;
226
+ readonly resume?: boolean | null;
227
+ [key: string]: unknown;
228
+ }
229
+ /** `SessionSwitchAgentInput`. */
230
+ export interface V2SessionSwitchAgentInput {
231
+ readonly sessionID: string;
232
+ readonly agent: string;
233
+ }
234
+ /** `SessionSwitchModelInput`. */
235
+ export interface V2SessionSwitchModelInput {
236
+ readonly sessionID: string;
237
+ readonly model: V2ModelRef;
238
+ }
239
+ /** `SessionInterruptInput`. */
240
+ export interface V2SessionInterruptInput {
241
+ readonly sessionID: string;
242
+ readonly resume?: boolean;
243
+ }
244
+ /** `SessionInfo` — fields with published evidence; structural, not exhaustive. */
245
+ export interface V2SessionInfo {
246
+ readonly id: string;
247
+ readonly parentID?: string;
248
+ readonly projectID: string;
249
+ readonly agent?: string;
250
+ readonly model?: V2ModelRef;
251
+ readonly title?: string;
252
+ readonly location: {
253
+ readonly directory: string;
254
+ [key: string]: unknown;
255
+ };
256
+ readonly time?: {
257
+ readonly created: number;
258
+ readonly updated: number;
259
+ readonly idle?: number;
260
+ };
261
+ readonly outcome?: 'succeeded' | 'failed' | 'interrupted';
262
+ [key: string]: unknown;
263
+ }
264
+ /** `SessionMessageInfo` union member (abbreviated; consumers read type + text). */
265
+ export interface V2SessionMessageInfo {
266
+ readonly type?: string;
267
+ [key: string]: unknown;
268
+ }
269
+ /**
270
+ * v2 `SessionDomain` (dist/promise/session.d.ts 2.0.26): `Pick<SessionApi, "create" | "get" |
271
+ * "remove" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "compact" |
272
+ * "synthetic" | "interrupt" | "update" | "move" | "wait" | "context"> & { hook }`.
273
+ *
274
+ * `hook` names stay the 2.0.20-era three this adapter registers (context/compaction/prompt;
275
+ * the published SessionHooks map has grown, but the adapter only registers these).
276
+ */
161
277
  export interface V2SessionDomain {
162
278
  readonly hook: (name: 'context' | 'compaction' | 'prompt', callback: (event: never) => Promise<void> | void) => Promise<V2Registration>;
163
- readonly prompt?: (sessionID: string, input: {
279
+ readonly create: (input?: V2SessionCreateInput) => Promise<V2SessionInfo>;
280
+ readonly get: (input: {
281
+ readonly sessionID: string;
282
+ }) => Promise<V2SessionInfo>;
283
+ readonly remove: (input: {
284
+ readonly sessionID: string;
285
+ }) => Promise<void>;
286
+ readonly switchAgent: (input: V2SessionSwitchAgentInput) => Promise<void>;
287
+ readonly switchModel: (input: V2SessionSwitchModelInput) => Promise<void>;
288
+ /** Asynchronous: returns an inbox entry; pair with `wait` (issue #3169 Phase 2). */
289
+ readonly prompt: (input: V2SessionPromptCallInput) => Promise<unknown>;
290
+ readonly generate: (input: {
291
+ readonly sessionID: string;
292
+ [key: string]: unknown;
293
+ }) => Promise<{
164
294
  text: string;
165
- } | {
166
- command: string;
167
- args?: string;
295
+ }>;
296
+ readonly command: (input: {
297
+ readonly sessionID: string;
298
+ [key: string]: unknown;
299
+ }) => Promise<void>;
300
+ readonly compact: (input: {
301
+ readonly sessionID: string;
302
+ [key: string]: unknown;
303
+ }) => Promise<unknown>;
304
+ readonly synthetic: (input: {
305
+ readonly sessionID: string;
306
+ [key: string]: unknown;
168
307
  }) => Promise<unknown>;
308
+ readonly interrupt: (input: V2SessionInterruptInput) => Promise<unknown>;
309
+ readonly update: (input: {
310
+ readonly sessionID: string;
311
+ [key: string]: unknown;
312
+ }) => Promise<void>;
313
+ readonly move: (input: {
314
+ readonly sessionID: string;
315
+ [key: string]: unknown;
316
+ }) => Promise<void>;
317
+ readonly wait: (input: {
318
+ readonly sessionID: string;
319
+ }) => Promise<void>;
320
+ readonly context: (input: {
321
+ readonly sessionID: string;
322
+ }) => Promise<V2SessionMessageInfo[]>;
323
+ }
324
+ /**
325
+ * v2 worktree types (`@opencode/plugin@2.0.26` + `@opencode/client@2.0.26`).
326
+ * The host publishes TWO distinct flavors — the client `WorktreeApi` inputs
327
+ * (project-id keyed) and the plugin `WorktreeDefinition` callback inputs
328
+ * (source-directory keyed) — and they must not be merged (PR-review feedback
329
+ * FB-003): a caller against either flavor would compile and then fail
330
+ * host-side at runtime.
331
+ */
332
+ /** Client `WorktreeListInput` / `WorktreeRefreshInput` (project-id keyed). */
333
+ export interface V2WorktreeProjectInput {
334
+ readonly projectID: string;
335
+ }
336
+ /** Client `WorktreeCreateInput`. */
337
+ export interface V2WorktreeCreateInput {
338
+ readonly projectID: string;
339
+ readonly from?: string;
340
+ readonly branch?: string;
341
+ readonly directory?: string;
342
+ readonly name?: string;
343
+ [key: string]: unknown;
344
+ }
345
+ /** Client `WorktreeRemoveInput`. */
346
+ export interface V2WorktreeRemoveInput {
347
+ readonly projectID: string;
348
+ readonly directory: string;
349
+ readonly force: boolean;
350
+ }
351
+ /** Client `WorktreeInfo` (create result; `directory` is the only published member). */
352
+ export interface V2WorktreeInfo {
353
+ readonly directory: string;
354
+ [key: string]: unknown;
355
+ }
356
+ /** Plugin `WorktreeCreateInput` (the `../worktree.js` flavor — distinct from the client's). */
357
+ export interface V2PluginWorktreeCreateInput {
358
+ readonly sourceDirectory: string;
359
+ readonly directory: string;
360
+ readonly branch?: string;
361
+ [key: string]: unknown;
362
+ }
363
+ /** Plugin `WorktreeRemoveInput`. */
364
+ export interface V2PluginWorktreeRemoveInput {
365
+ readonly directory: string;
366
+ readonly force: boolean;
367
+ }
368
+ /** Plugin `WorktreeResult` (create return). */
369
+ export interface V2WorktreeResult {
370
+ readonly directory: string;
371
+ [key: string]: unknown;
372
+ }
373
+ /**
374
+ * Plugin `WorktreeEntry` (list item). Only `directory` is published-verified
375
+ * here; the structural index keeps the remaining fields without inventing shapes.
376
+ */
377
+ export interface V2WorktreeEntry extends V2WorktreeResult {
378
+ }
379
+ /** Plugin-side `WorktreeDefinition` (registers an implementation via transform). */
380
+ export interface V2WorktreeDefinition {
381
+ readonly id: string;
382
+ readonly create: (input: V2PluginWorktreeCreateInput, context: {
383
+ readonly signal: AbortSignal;
384
+ }) => Promise<V2WorktreeResult>;
385
+ readonly remove: (input: V2PluginWorktreeRemoveInput, context: {
386
+ readonly signal: AbortSignal;
387
+ }) => Promise<void>;
388
+ readonly list: (sourceDirectory: string, context: {
389
+ readonly signal: AbortSignal;
390
+ }) => Promise<readonly V2WorktreeEntry[]>;
391
+ }
392
+ /** v2 `WorktreeEditor` (dist/promise/worktree.d.ts). */
393
+ export interface V2WorktreeEditor {
394
+ /** Registers an implementation and selects it as the default. */
395
+ add(definition: V2WorktreeDefinition): void;
396
+ }
397
+ /**
398
+ * v2 `WorktreeDomain` (dist/promise/worktree.d.ts 2.0.26): the client
399
+ * `WorktreeApi` (`list`/`create`/`remove`/`refresh`) plus `transform` and
400
+ * `reload`. Consumed by no Phase 1 code path; typed so Phase 2+ (issue #3169)
401
+ * sees the surface with the published requiredness intact.
402
+ */
403
+ export interface V2WorktreeDomain {
404
+ readonly list: (input: V2WorktreeProjectInput) => Promise<readonly V2WorktreeInfo[]>;
405
+ readonly create: (input: V2WorktreeCreateInput) => Promise<V2WorktreeInfo>;
406
+ readonly remove: (input: V2WorktreeRemoveInput) => Promise<void>;
407
+ readonly refresh: (input: V2WorktreeProjectInput) => Promise<void>;
408
+ readonly reload: () => Promise<void>;
409
+ readonly transform: (callback: (editor: V2WorktreeEditor) => void) => Promise<V2Registration>;
169
410
  }
170
411
  /** v2 `CommandDefinition` / `CommandEditor` (dist/promise/command.d.ts). */
171
412
  export interface V2CommandInvocation {
@@ -253,6 +494,8 @@ export interface V2PluginContext {
253
494
  readonly session: V2SessionDomain;
254
495
  readonly event: V2EventDomain;
255
496
  readonly permission?: V2PermissionDomain;
497
+ /** Present on 2.0.26 hosts; no Phase 1 code path consumes it (issue #3169). */
498
+ readonly worktree?: V2WorktreeDomain;
256
499
  readonly [key: string]: unknown;
257
500
  }
258
501
  /** v2 `Cleanup` — the return of `setup`. */