opencode-swarm 7.192.4 → 7.194.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.
- package/.opencode/skills/swarm-pr-review/SKILL.md +2 -2
- package/.opencode/skills/swarm-pr-review/references/verdict-settlement-contract.md +17 -0
- package/README.md +1 -1
- package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/background/pending-delegations.d.ts +8 -0
- package/dist/cli/{auto-checkpoint-1xy6dprq.js → auto-checkpoint-67dk8rjz.js} +8 -8
- package/dist/cli/{checkpoint-wvhmkgv5.js → checkpoint-jbqqyp5e.js} +15 -15
- package/dist/cli/{coder-settlement-wpkmkgcf.js → coder-settlement-a09t7mvx.js} +11 -11
- package/dist/cli/{config-doctor-xvhejh7g.js → config-doctor-dkp263xx.js} +14 -14
- package/dist/cli/{core-yzgm8pcw.js → core-stnmz1rg.js} +4 -4
- package/dist/cli/{curation-policy-yzdznz4z.js → curation-policy-8j6qn6nt.js} +4 -4
- package/dist/cli/{curator-drift-5c041yaf.js → curator-drift-d1wedyed.js} +9 -9
- package/dist/cli/curator-llm-factory-97dpqjz4.js +82 -0
- package/dist/cli/{curator-3xh6246r.js → curator-mc0wcpvw.js} +41 -41
- package/dist/cli/{doctor-knowledge-receipt-phase-id-cx6n5jtp.js → doctor-knowledge-receipt-phase-id-dfwx5jha.js} +8 -8
- package/dist/cli/{evidence-summary-service-cc139a85.js → evidence-summary-service-k1shqefr.js} +18 -18
- package/dist/cli/{gate-evidence-7azk0xbt.js → gate-evidence-vw9y4gs6.js} +6 -6
- package/dist/cli/guardrail-explain-24g3bsqw.js +83 -0
- package/dist/cli/{guardrail-log-env1h4wr.js → guardrail-log-vbeyx6nq.js} +7 -7
- package/dist/cli/{guardrail-reset-1404ymcw.js → guardrail-reset-jwtt15e3.js} +41 -41
- package/dist/cli/{hive-promoter-hap3dh02.js → hive-promoter-p9ad63mx.js} +41 -41
- package/dist/cli/{index-8zj647hc.js → index-0e318vgt.js} +1 -1
- package/dist/cli/{index-rqapvhh5.js → index-0xe19j9g.js} +1 -1
- package/dist/cli/{index-py8wpe81.js → index-1jt12p3y.js} +1 -1
- package/dist/cli/{index-bgzpw6ge.js → index-3atkcqpb.js} +1 -1
- package/dist/cli/{index-j4pxkvw3.js → index-3dpb3kps.js} +4 -4
- package/dist/cli/{index-gkr6ns9n.js → index-43v5axvm.js} +4 -4
- package/dist/cli/{index-xwxqtdwz.js → index-48h1yn6c.js} +4 -4
- package/dist/cli/{index-s68yyat0.js → index-4ftg3p9n.js} +2 -2
- package/dist/cli/{index-22ww8fjt.js → index-51dxek4p.js} +3 -3
- package/dist/cli/{index-1n7sf9gz.js → index-5rkh69f3.js} +1 -1
- package/dist/cli/{index-0e1nxkte.js → index-668npagp.js} +1 -1
- package/dist/cli/{index-g8jd3h4r.js → index-6s3ab22d.js} +2 -2
- package/dist/cli/{index-cp9h2sqb.js → index-6xppb1er.js} +1 -1
- package/dist/cli/{index-6vwnm3sm.js → index-7bfshvq1.js} +3 -3
- package/dist/cli/{index-5gy5dc2n.js → index-7njm9jk1.js} +1 -1
- package/dist/cli/{index-eaess7dm.js → index-84k9zzv1.js} +1 -1
- package/dist/cli/{index-vgktct21.js → index-9bzgea2y.js} +4 -4
- package/dist/cli/{index-jb669k7s.js → index-9kbnxb7v.js} +2 -2
- package/dist/cli/{index-c5gb6a86.js → index-9v43y7y6.js} +10 -10
- package/dist/cli/{index-zya4a544.js → index-ajkdt5b8.js} +4 -4
- package/dist/cli/{index-54p1vs33.js → index-at34nry4.js} +3 -3
- package/dist/cli/{index-rsfvxaw0.js → index-cwr69qw7.js} +7 -7
- package/dist/cli/{index-72eh47b2.js → index-d7pznffh.js} +4 -4
- package/dist/cli/{index-xpwp9hw1.js → index-dy7nztyp.js} +6 -6
- package/dist/cli/{index-g2phkwh2.js → index-ehab3z5y.js} +4 -4
- package/dist/cli/{index-6k70exke.js → index-f3ttgqak.js} +2 -2
- package/dist/cli/{index-fzqn2kk8.js → index-fd6b9f38.js} +2 -2
- package/dist/cli/{index-q47snsb2.js → index-h14wpwpa.js} +4 -4
- package/dist/cli/{index-dtet46e6.js → index-hfnyykvm.js} +5 -5
- package/dist/cli/{index-nwswxes7.js → index-hfssjyxs.js} +2 -2
- package/dist/cli/{index-2qpme44n.js → index-jrs2qh6j.js} +3 -3
- package/dist/cli/{index-s43zb23q.js → index-kp5qw5p4.js} +43 -43
- package/dist/cli/{index-myjqj3na.js → index-n5xwza76.js} +7 -7
- package/dist/cli/{index-4twjbsfw.js → index-ndec8akq.js} +1 -1
- package/dist/cli/{index-a9m7h5v0.js → index-qh93qjc2.js} +1 -1
- package/dist/cli/{index-kn16k0fv.js → index-r8mavcg6.js} +5 -5
- package/dist/cli/{index-tww9qw9z.js → index-rpnkp79f.js} +6 -6
- package/dist/cli/{index-dt4cjxbz.js → index-st80sjg7.js} +1 -1
- package/dist/cli/{index-c8fjbghs.js → index-t6aae9wq.js} +1 -1
- package/dist/cli/{index-c6wzbs0g.js → index-vfdkvvkf.js} +2 -2
- package/dist/cli/{index-mbn4vn3z.js → index-vg8sxg12.js} +1 -1
- package/dist/cli/{index-5gyq54c5.js → index-vjytfp05.js} +4591 -4125
- package/dist/cli/{index-5dws7eyb.js → index-w2vbaczx.js} +1 -1
- package/dist/cli/{index-ftatc9wj.js → index-x7qeaa9y.js} +41 -41
- package/dist/cli/{index-v6ghzghn.js → index-y3n9ry9q.js} +3 -3
- package/dist/cli/{index-qzkrcz1r.js → index-yfbk69b1.js} +6 -6
- package/dist/cli/index.js +42 -42
- package/dist/cli/{knowledge-escalator-eta167xh.js → knowledge-escalator-g6dctrae.js} +13 -13
- package/dist/cli/{knowledge-events-mz25jn9f.js → knowledge-events-acdz0x2g.js} +11 -11
- package/dist/cli/{knowledge-link-a5tvjqdt.js → knowledge-link-srnt95wh.js} +3 -3
- package/dist/cli/{knowledge-store-qd08dbws.js → knowledge-store-vxtj4m59.js} +4 -4
- package/dist/cli/{knowledge-validator-jyrsgamq.js → knowledge-validator-b545vc9t.js} +6 -6
- package/dist/cli/{mcp-4wgxc5ax.js → mcp-c3t18313.js} +1 -1
- package/dist/cli/{model-preflight-4p3x4vma.js → model-preflight-r99c08re.js} +41 -41
- package/dist/cli/{pending-delegations-7hm6xgzw.js → pending-delegations-57f3049j.js} +12 -10
- package/dist/cli/{pr-subscriptions-2y3w5pyt.js → pr-subscriptions-5jb793xe.js} +10 -10
- package/dist/cli/{pr-workflow-gate-y04z3z80.js → pr-workflow-gate-n3x25ddw.js} +47 -41
- package/dist/cli/{runner-8qybgy4n.js → runner-b2e89cp1.js} +4 -4
- package/dist/cli/{scan-cursor-2hpc6mxt.js → scan-cursor-s9mazw82.js} +5 -5
- package/dist/cli/{schema-33k1e2cv.js → schema-7czxpvwm.js} +2 -2
- package/dist/cli/{scope-persistence-y769jep8.js → scope-persistence-y0ebqyjm.js} +14 -14
- package/dist/cli/{server-199m00cz.js → server-m10e78ey.js} +41 -41
- package/dist/cli/{skill-generator-b9by3739.js → skill-generator-kzw1dcba.js} +15 -15
- package/dist/cli/{snapshot-coordination-init-wyyn8ftk.js → snapshot-coordination-init-z1aqsvn4.js} +41 -41
- package/dist/cli/{speckit-checkoff-y2ywmh9k.js → speckit-checkoff-1g3vzywn.js} +5 -5
- package/dist/cli/{workspace-snapshot-vfpnxjsp.js → workspace-snapshot-p69t9zn7.js} +3 -3
- package/dist/cli/{worktree-collision-ownership-hg0yrc5b.js → worktree-collision-ownership-d0etv08a.js} +11 -11
- package/dist/cli/{worktree-isolation-epbn1xgh.js → worktree-isolation-dj2qw13p.js} +41 -41
- package/dist/commands/registry.d.ts +2 -2
- package/dist/epic/start.d.ts +8 -5
- package/dist/hooks/injection-policy.d.ts +94 -0
- package/dist/hooks/pr-workflow-gate.d.ts +81 -5
- package/dist/host/v2/session-client.d.ts +77 -0
- package/dist/host/v2/types.d.ts +256 -11
- package/dist/index.js +495 -492
- package/dist/pr-review/finding-policy.d.ts +1 -1
- package/dist/pr-review/verdict-settlement.d.ts +182 -0
- package/dist/services/context-budget-service.d.ts +8 -1
- package/dist/tools/complete-pr-workflow.d.ts +13 -0
- package/dist/tools/pr-workflow-status.d.ts +24 -1
- package/dist/tools/write-pr-review-artifact.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-6y7wrbvk.js +0 -82
- package/dist/cli/guardrail-explain-b3y98j5b.js +0 -83
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2 session client shim — issue #3169 Phase 2.
|
|
3
|
+
*
|
|
4
|
+
* A narrow `OpencodeClient` subset implementing exactly the v1 session surface
|
|
5
|
+
* Epic's dispatch paths use (`session.create/prompt/abort/delete` plus `get`,
|
|
6
|
+
* which verified teardown requires), backed by the v2 host's `ctx.session`
|
|
7
|
+
* domain. Installed as the synthetic v1 PluginInput's `client` field by
|
|
8
|
+
* `setup.ts`, it flows through the shared init core's single client write site
|
|
9
|
+
* into `swarmState.opencodeClient` and every init-path `ctx.client` consumer —
|
|
10
|
+
* the tracking issue's Decision 2 (a client subset instead of v2 branches
|
|
11
|
+
* spread through consumers).
|
|
12
|
+
*
|
|
13
|
+
* Translation contract (per the issue §4 gap table and the Phase 0 live
|
|
14
|
+
* findings on @opencode/cli 2.0.26):
|
|
15
|
+
*
|
|
16
|
+
* - `create({body:{parentID,title}, query:{directory}})` validates placement
|
|
17
|
+
* BEFORE creating anything: v2 child sessions inherit the parent's
|
|
18
|
+
* directory and ignore the requested one (Phase 0 C1 catch), so a divergent
|
|
19
|
+
* or unverifiable placement fails closed with a typed `{data: null,
|
|
20
|
+
* error}` result — routing worktree isolation to its existing degradation
|
|
21
|
+
* path instead of silently running a "lane" session in the project root.
|
|
22
|
+
* A passing precheck mints a placeholder id; the real v2 session is
|
|
23
|
+
* created at PROMPT time, when the v1 prompt body supplies the create-time
|
|
24
|
+
* options (agent/model/permissions) the published `SessionCreateInput`
|
|
25
|
+
* expects (issue R2: one session per dispatch contains the per-session
|
|
26
|
+
* shift).
|
|
27
|
+
* - `prompt({path:{id}, body:{agent,model?,system?,tools,parts}, signal?})`
|
|
28
|
+
* emulates the v1 BLOCKING call: real create (carrying agent/model and the
|
|
29
|
+
* read-only denial map as `effect:'deny'` permissions) → one sessionID-
|
|
30
|
+
* scoped `context` hook that replaces `event.system` (fence-aware: parts
|
|
31
|
+
* carrying the `<swarm_system_directive` provenance fence survive, per
|
|
32
|
+
* #2526) and deletes denied keys from `event.tools` → `prompt` → bounded
|
|
33
|
+
* `wait` → `context()` translated into the v1 `{data:{info,parts}}`
|
|
34
|
+
* envelope so `dispatchEphemeralAgent` and `readProviderMessageError`
|
|
35
|
+
* work unchanged. A prompt addressed to a non-placeholder (real) session
|
|
36
|
+
* id takes a direct path without re-creating — the pr-event-delivery wake
|
|
37
|
+
* prompt shape.
|
|
38
|
+
* - Provider failures are EVENT-SOURCED on v2 (Phase 0 C4: no error text in
|
|
39
|
+
* `context()`), so the event pump records `session.error` /
|
|
40
|
+
* `session.execution.failed` payloads here (`recordV2SessionErrorFromEnvelope`,
|
|
41
|
+
* called pump-side beside `seedSessionIdentityFromEnvelope`) and the
|
|
42
|
+
* translation surfaces them as the v1 `info.error` shape. A failed outcome
|
|
43
|
+
* without recorded detail yields a bounded `provider.unknown` error
|
|
44
|
+
* instead of a silent empty success.
|
|
45
|
+
* - `abort` maps to `interrupt`, `delete` to `remove`, `get` to the v2 get
|
|
46
|
+
* (unresolved placeholders read as `{data: null}` — never prompted means
|
|
47
|
+
* gone, satisfying `teardownEphemeralSessionVerified`).
|
|
48
|
+
*
|
|
49
|
+
* Deferred-work marker: NONE. The unverified live-host behaviors this design
|
|
50
|
+
* rests on are recorded as deferrals in the trace (context-hook firing for
|
|
51
|
+
* plugin-created sessions, permission vocabulary honor, `context()` entry
|
|
52
|
+
* shapes, `wait` on failed prompts, `get(parent).location` availability) with
|
|
53
|
+
* the owning follow-up on #3169.
|
|
54
|
+
*
|
|
55
|
+
* C6 await convention: every `await` lives inside a `deferredV2Session*`
|
|
56
|
+
* function declaration or `const deferredV2SessionX = async (` binding — the
|
|
57
|
+
* dual-shape-parity scan's function tracker does not recognize object-literal
|
|
58
|
+
* method properties, so the client object's methods never await directly.
|
|
59
|
+
*/
|
|
60
|
+
import type { OpencodeClient } from '@opencode-ai/sdk';
|
|
61
|
+
import type { V2EventEnvelope, V2PluginContext, V2SessionPermission } from './types';
|
|
62
|
+
/**
|
|
63
|
+
* Record a `session.error` / `session.execution.failed` envelope's error
|
|
64
|
+
* payload for the shim's result translation. SYNC by contract — the event pump
|
|
65
|
+
* calls it inline in its iteration loop. Accepts the same dual payload dialect
|
|
66
|
+
* `mapV2EventToV1` accepts (live `data`, SDK `properties`).
|
|
67
|
+
*/
|
|
68
|
+
export declare function recordV2SessionErrorFromEnvelope(envelope: V2EventEnvelope): void;
|
|
69
|
+
/** Drop all shim-held state (v2 cleanup path; bounded residue documented in the trace). */
|
|
70
|
+
export declare function clearV2SessionClientState(): void;
|
|
71
|
+
/**
|
|
72
|
+
* Map a v1 read-only denial map onto v2 create-time permission entries.
|
|
73
|
+
* Fail-closed shape: only `effect: 'deny'` entries are ever produced.
|
|
74
|
+
*/
|
|
75
|
+
export declare function readOnlyToolsToV2Permissions(tools: Readonly<Record<string, false>> | undefined): V2SessionPermission[];
|
|
76
|
+
/** Feature-detect the full surface the shim requires (types.ts host-tolerance contract). */
|
|
77
|
+
export declare function createV2SessionClient(ctx: V2PluginContext): OpencodeClient | undefined;
|
package/dist/host/v2/types.d.ts
CHANGED
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vendored structural types for the OpenCode 2 plugin API.
|
|
3
3
|
*
|
|
4
|
-
* Provenance: distilled from `@opencode/plugin@2.0.
|
|
5
|
-
* `dist/promise/{plugin,registration,tool,session,command,agent,event,storage,app,options}.d.ts`
|
|
6
|
-
* and `@opencode/schema@2.0.
|
|
7
|
-
* `@opencode/
|
|
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
|
-
*
|
|
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):
|
|
18
|
+
* the members below are REQUIRED to mirror the published `SessionDomain`/`WorktreeDomain`.
|
|
19
|
+
* Since Phase 2 the session-client shim (`src/host/v2/session-client.ts`) is the call
|
|
20
|
+
* site — it feature-detects every member it consumes, including `hook` (`typeof
|
|
21
|
+
* ctx.session.create === 'function'`), and returns `undefined` when any is missing, so
|
|
22
|
+
* requiredness stays type-level only and a 2.0.2x host lacking a member must never crash
|
|
23
|
+
* the adapter.
|
|
11
24
|
*
|
|
12
25
|
* Only the surfaces this adapter consumes are typed. Unknown fields are
|
|
13
26
|
* intentionally left off; the adapter never relies on their absence.
|
|
14
|
-
* Upstream: @opencode/plugin@2.0.
|
|
27
|
+
* Upstream: @opencode/plugin@2.0.26, @opencode/schema@2.0.26 and
|
|
28
|
+
* @opencode/client@2.0.26 (MIT, sst/opencode).
|
|
15
29
|
*/
|
|
16
30
|
/** v2 `App` — host identity (dist/app.d.ts). */
|
|
17
31
|
export interface V2App {
|
|
@@ -157,15 +171,244 @@ export interface V2SessionPromptEvent {
|
|
|
157
171
|
};
|
|
158
172
|
readonly delivery?: string;
|
|
159
173
|
}
|
|
160
|
-
/**
|
|
174
|
+
/**
|
|
175
|
+
* v2 session-call input types (`@opencode/client@2.0.26` generated types, flattened —
|
|
176
|
+
* see the module header's flattening note). Only the fields with published evidence
|
|
177
|
+
* are named; the index signature keeps them structural, not exhaustive.
|
|
178
|
+
*/
|
|
179
|
+
/** `Model.Ref` (schema/model.d.ts). */
|
|
180
|
+
export interface V2ModelRef {
|
|
181
|
+
readonly id: string;
|
|
182
|
+
readonly providerID: string;
|
|
183
|
+
readonly variant?: string;
|
|
184
|
+
}
|
|
185
|
+
/** Session permission rule (schema/permission.d.ts shape on create/switch inputs). */
|
|
186
|
+
export interface V2SessionPermission {
|
|
187
|
+
readonly action: string;
|
|
188
|
+
readonly resource: string;
|
|
189
|
+
readonly effect: 'allow' | 'deny' | 'ask';
|
|
190
|
+
}
|
|
191
|
+
/** `SessionCreateInput` — all-optional in the published (Effect-generated) form. */
|
|
192
|
+
export interface V2SessionCreateInput {
|
|
193
|
+
readonly id?: string | null;
|
|
194
|
+
readonly parentID?: string | null;
|
|
195
|
+
readonly title?: string | null;
|
|
196
|
+
readonly agent?: string | null;
|
|
197
|
+
readonly model?: V2ModelRef | null;
|
|
198
|
+
readonly location?: {
|
|
199
|
+
readonly directory: string;
|
|
200
|
+
} | null;
|
|
201
|
+
readonly metadata?: Readonly<Record<string, unknown>> | null;
|
|
202
|
+
readonly permissions?: ReadonlyArray<V2SessionPermission> | null;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* `SessionPromptInput` (`@opencode/client@2.0.26` generated, flattened):
|
|
206
|
+
* `sessionID` and `text` are required; `command`/`args` are NOT members of
|
|
207
|
+
* this input (the command shape is `name` + `text` on `SessionCommandInput` —
|
|
208
|
+
* the earlier fabricated members were removed in the PR-review feedback pass).
|
|
209
|
+
* Attachment members are abbreviated structural shapes.
|
|
210
|
+
*/
|
|
211
|
+
export interface V2SessionPromptCallInput {
|
|
212
|
+
readonly sessionID: string;
|
|
213
|
+
readonly text: string;
|
|
214
|
+
readonly id?: string | null;
|
|
215
|
+
readonly files?: ReadonlyArray<{
|
|
216
|
+
readonly uri: string;
|
|
217
|
+
readonly name?: string;
|
|
218
|
+
readonly description?: string;
|
|
219
|
+
}>;
|
|
220
|
+
readonly agents?: ReadonlyArray<{
|
|
221
|
+
readonly name: string;
|
|
222
|
+
}>;
|
|
223
|
+
readonly skills?: ReadonlyArray<{
|
|
224
|
+
readonly id: string;
|
|
225
|
+
}>;
|
|
226
|
+
readonly metadata?: Readonly<Record<string, unknown>>;
|
|
227
|
+
readonly delivery?: 'steer' | 'queue' | null;
|
|
228
|
+
readonly resume?: boolean | null;
|
|
229
|
+
[key: string]: unknown;
|
|
230
|
+
}
|
|
231
|
+
/** `SessionSwitchAgentInput`. */
|
|
232
|
+
export interface V2SessionSwitchAgentInput {
|
|
233
|
+
readonly sessionID: string;
|
|
234
|
+
readonly agent: string;
|
|
235
|
+
}
|
|
236
|
+
/** `SessionSwitchModelInput`. */
|
|
237
|
+
export interface V2SessionSwitchModelInput {
|
|
238
|
+
readonly sessionID: string;
|
|
239
|
+
readonly model: V2ModelRef;
|
|
240
|
+
}
|
|
241
|
+
/** `SessionInterruptInput`. */
|
|
242
|
+
export interface V2SessionInterruptInput {
|
|
243
|
+
readonly sessionID: string;
|
|
244
|
+
readonly resume?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/** `SessionInfo` — fields with published evidence; structural, not exhaustive. */
|
|
247
|
+
export interface V2SessionInfo {
|
|
248
|
+
readonly id: string;
|
|
249
|
+
readonly parentID?: string;
|
|
250
|
+
readonly projectID: string;
|
|
251
|
+
readonly agent?: string;
|
|
252
|
+
readonly model?: V2ModelRef;
|
|
253
|
+
readonly title?: string;
|
|
254
|
+
readonly location: {
|
|
255
|
+
readonly directory: string;
|
|
256
|
+
[key: string]: unknown;
|
|
257
|
+
};
|
|
258
|
+
readonly time?: {
|
|
259
|
+
readonly created: number;
|
|
260
|
+
readonly updated: number;
|
|
261
|
+
readonly idle?: number;
|
|
262
|
+
};
|
|
263
|
+
readonly outcome?: 'succeeded' | 'failed' | 'interrupted';
|
|
264
|
+
[key: string]: unknown;
|
|
265
|
+
}
|
|
266
|
+
/** `SessionMessageInfo` union member (abbreviated; consumers read type + text). */
|
|
267
|
+
export interface V2SessionMessageInfo {
|
|
268
|
+
readonly type?: string;
|
|
269
|
+
[key: string]: unknown;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* v2 `SessionDomain` (dist/promise/session.d.ts 2.0.26): `Pick<SessionApi, "create" | "get" |
|
|
273
|
+
* "remove" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "compact" |
|
|
274
|
+
* "synthetic" | "interrupt" | "update" | "move" | "wait" | "context"> & { hook }`.
|
|
275
|
+
*
|
|
276
|
+
* `hook` names stay the 2.0.20-era three this adapter registers (context/compaction/prompt;
|
|
277
|
+
* the published SessionHooks map has grown, but the adapter only registers these).
|
|
278
|
+
*/
|
|
161
279
|
export interface V2SessionDomain {
|
|
162
280
|
readonly hook: (name: 'context' | 'compaction' | 'prompt', callback: (event: never) => Promise<void> | void) => Promise<V2Registration>;
|
|
163
|
-
readonly
|
|
281
|
+
readonly create: (input?: V2SessionCreateInput) => Promise<V2SessionInfo>;
|
|
282
|
+
readonly get: (input: {
|
|
283
|
+
readonly sessionID: string;
|
|
284
|
+
}) => Promise<V2SessionInfo>;
|
|
285
|
+
readonly remove: (input: {
|
|
286
|
+
readonly sessionID: string;
|
|
287
|
+
}) => Promise<void>;
|
|
288
|
+
readonly switchAgent: (input: V2SessionSwitchAgentInput) => Promise<void>;
|
|
289
|
+
readonly switchModel: (input: V2SessionSwitchModelInput) => Promise<void>;
|
|
290
|
+
/** Asynchronous: returns an inbox entry; pair with `wait` (issue #3169 Phase 2). */
|
|
291
|
+
readonly prompt: (input: V2SessionPromptCallInput) => Promise<unknown>;
|
|
292
|
+
readonly generate: (input: {
|
|
293
|
+
readonly sessionID: string;
|
|
294
|
+
[key: string]: unknown;
|
|
295
|
+
}) => Promise<{
|
|
164
296
|
text: string;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
|
|
297
|
+
}>;
|
|
298
|
+
readonly command: (input: {
|
|
299
|
+
readonly sessionID: string;
|
|
300
|
+
[key: string]: unknown;
|
|
301
|
+
}) => Promise<void>;
|
|
302
|
+
readonly compact: (input: {
|
|
303
|
+
readonly sessionID: string;
|
|
304
|
+
[key: string]: unknown;
|
|
305
|
+
}) => Promise<unknown>;
|
|
306
|
+
readonly synthetic: (input: {
|
|
307
|
+
readonly sessionID: string;
|
|
308
|
+
[key: string]: unknown;
|
|
168
309
|
}) => Promise<unknown>;
|
|
310
|
+
readonly interrupt: (input: V2SessionInterruptInput) => Promise<unknown>;
|
|
311
|
+
readonly update: (input: {
|
|
312
|
+
readonly sessionID: string;
|
|
313
|
+
[key: string]: unknown;
|
|
314
|
+
}) => Promise<void>;
|
|
315
|
+
readonly move: (input: {
|
|
316
|
+
readonly sessionID: string;
|
|
317
|
+
[key: string]: unknown;
|
|
318
|
+
}) => Promise<void>;
|
|
319
|
+
readonly wait: (input: {
|
|
320
|
+
readonly sessionID: string;
|
|
321
|
+
}) => Promise<void>;
|
|
322
|
+
readonly context: (input: {
|
|
323
|
+
readonly sessionID: string;
|
|
324
|
+
}) => Promise<V2SessionMessageInfo[]>;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* v2 worktree types (`@opencode/plugin@2.0.26` + `@opencode/client@2.0.26`).
|
|
328
|
+
* The host publishes TWO distinct flavors — the client `WorktreeApi` inputs
|
|
329
|
+
* (project-id keyed) and the plugin `WorktreeDefinition` callback inputs
|
|
330
|
+
* (source-directory keyed) — and they must not be merged (PR-review feedback
|
|
331
|
+
* FB-003): a caller against either flavor would compile and then fail
|
|
332
|
+
* host-side at runtime.
|
|
333
|
+
*/
|
|
334
|
+
/** Client `WorktreeListInput` / `WorktreeRefreshInput` (project-id keyed). */
|
|
335
|
+
export interface V2WorktreeProjectInput {
|
|
336
|
+
readonly projectID: string;
|
|
337
|
+
}
|
|
338
|
+
/** Client `WorktreeCreateInput`. */
|
|
339
|
+
export interface V2WorktreeCreateInput {
|
|
340
|
+
readonly projectID: string;
|
|
341
|
+
readonly from?: string;
|
|
342
|
+
readonly branch?: string;
|
|
343
|
+
readonly directory?: string;
|
|
344
|
+
readonly name?: string;
|
|
345
|
+
[key: string]: unknown;
|
|
346
|
+
}
|
|
347
|
+
/** Client `WorktreeRemoveInput`. */
|
|
348
|
+
export interface V2WorktreeRemoveInput {
|
|
349
|
+
readonly projectID: string;
|
|
350
|
+
readonly directory: string;
|
|
351
|
+
readonly force: boolean;
|
|
352
|
+
}
|
|
353
|
+
/** Client `WorktreeInfo` (create result; `directory` is the only published member). */
|
|
354
|
+
export interface V2WorktreeInfo {
|
|
355
|
+
readonly directory: string;
|
|
356
|
+
[key: string]: unknown;
|
|
357
|
+
}
|
|
358
|
+
/** Plugin `WorktreeCreateInput` (the `../worktree.js` flavor — distinct from the client's). */
|
|
359
|
+
export interface V2PluginWorktreeCreateInput {
|
|
360
|
+
readonly sourceDirectory: string;
|
|
361
|
+
readonly directory: string;
|
|
362
|
+
readonly branch?: string;
|
|
363
|
+
[key: string]: unknown;
|
|
364
|
+
}
|
|
365
|
+
/** Plugin `WorktreeRemoveInput`. */
|
|
366
|
+
export interface V2PluginWorktreeRemoveInput {
|
|
367
|
+
readonly directory: string;
|
|
368
|
+
readonly force: boolean;
|
|
369
|
+
}
|
|
370
|
+
/** Plugin `WorktreeResult` (create return). */
|
|
371
|
+
export interface V2WorktreeResult {
|
|
372
|
+
readonly directory: string;
|
|
373
|
+
[key: string]: unknown;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Plugin `WorktreeEntry` (list item). Only `directory` is published-verified
|
|
377
|
+
* here; the structural index keeps the remaining fields without inventing shapes.
|
|
378
|
+
*/
|
|
379
|
+
export interface V2WorktreeEntry extends V2WorktreeResult {
|
|
380
|
+
}
|
|
381
|
+
/** Plugin-side `WorktreeDefinition` (registers an implementation via transform). */
|
|
382
|
+
export interface V2WorktreeDefinition {
|
|
383
|
+
readonly id: string;
|
|
384
|
+
readonly create: (input: V2PluginWorktreeCreateInput, context: {
|
|
385
|
+
readonly signal: AbortSignal;
|
|
386
|
+
}) => Promise<V2WorktreeResult>;
|
|
387
|
+
readonly remove: (input: V2PluginWorktreeRemoveInput, context: {
|
|
388
|
+
readonly signal: AbortSignal;
|
|
389
|
+
}) => Promise<void>;
|
|
390
|
+
readonly list: (sourceDirectory: string, context: {
|
|
391
|
+
readonly signal: AbortSignal;
|
|
392
|
+
}) => Promise<readonly V2WorktreeEntry[]>;
|
|
393
|
+
}
|
|
394
|
+
/** v2 `WorktreeEditor` (dist/promise/worktree.d.ts). */
|
|
395
|
+
export interface V2WorktreeEditor {
|
|
396
|
+
/** Registers an implementation and selects it as the default. */
|
|
397
|
+
add(definition: V2WorktreeDefinition): void;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* v2 `WorktreeDomain` (dist/promise/worktree.d.ts 2.0.26): the client
|
|
401
|
+
* `WorktreeApi` (`list`/`create`/`remove`/`refresh`) plus `transform` and
|
|
402
|
+
* `reload`. Consumed by no Phase 1 code path; typed so Phase 2+ (issue #3169)
|
|
403
|
+
* sees the surface with the published requiredness intact.
|
|
404
|
+
*/
|
|
405
|
+
export interface V2WorktreeDomain {
|
|
406
|
+
readonly list: (input: V2WorktreeProjectInput) => Promise<readonly V2WorktreeInfo[]>;
|
|
407
|
+
readonly create: (input: V2WorktreeCreateInput) => Promise<V2WorktreeInfo>;
|
|
408
|
+
readonly remove: (input: V2WorktreeRemoveInput) => Promise<void>;
|
|
409
|
+
readonly refresh: (input: V2WorktreeProjectInput) => Promise<void>;
|
|
410
|
+
readonly reload: () => Promise<void>;
|
|
411
|
+
readonly transform: (callback: (editor: V2WorktreeEditor) => void) => Promise<V2Registration>;
|
|
169
412
|
}
|
|
170
413
|
/** v2 `CommandDefinition` / `CommandEditor` (dist/promise/command.d.ts). */
|
|
171
414
|
export interface V2CommandInvocation {
|
|
@@ -253,6 +496,8 @@ export interface V2PluginContext {
|
|
|
253
496
|
readonly session: V2SessionDomain;
|
|
254
497
|
readonly event: V2EventDomain;
|
|
255
498
|
readonly permission?: V2PermissionDomain;
|
|
499
|
+
/** Present on 2.0.26 hosts; no Phase 1 code path consumes it (issue #3169). */
|
|
500
|
+
readonly worktree?: V2WorktreeDomain;
|
|
256
501
|
readonly [key: string]: unknown;
|
|
257
502
|
}
|
|
258
503
|
/** v2 `Cleanup` — the return of `setup`. */
|