opencode-swarm 7.200.2 → 7.200.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 (82) hide show
  1. package/README.md +1 -1
  2. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  3. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  4. package/dist/cli/{attest-task-s9cpm1pa.js → attest-task-k7b87zk8.js} +29 -29
  5. package/dist/cli/{auto-checkpoint-bhtc5gjf.js → auto-checkpoint-pzsrkk2q.js} +4 -4
  6. package/dist/cli/{checkpoint-1jmfejsh.js → checkpoint-sb3f8jfv.js} +9 -9
  7. package/dist/cli/{coder-settlement-qabkaq79.js → coder-settlement-5jh2erx1.js} +6 -6
  8. package/dist/cli/{config-doctor-q4805y29.js → config-doctor-8keyw62b.js} +8 -8
  9. package/dist/cli/{core-jtmr767v.js → core-7240e0vh.js} +2 -2
  10. package/dist/cli/{curator-4tqbp1re.js → curator-1jhwv0ce.js} +29 -29
  11. package/dist/cli/{curator-drift-681mc3a2.js → curator-drift-r4yttpe9.js} +6 -6
  12. package/dist/cli/{curator-llm-factory-46bzwbzr.js → curator-llm-factory-wcv6x9pq.js} +29 -29
  13. package/dist/cli/{doctor-knowledge-receipt-phase-id-h16qsh6e.js → doctor-knowledge-receipt-phase-id-1v5fx0rk.js} +5 -5
  14. package/dist/cli/{evidence-summary-service-qr8kf99s.js → evidence-summary-service-zkbzsjbf.js} +10 -10
  15. package/dist/cli/{gate-evidence-phq4rs28.js → gate-evidence-j4jemrv7.js} +3 -3
  16. package/dist/cli/{guardrail-explain-q2eqawnk.js → guardrail-explain-g95j8z79.js} +30 -30
  17. package/dist/cli/{guardrail-log-jk30vszs.js → guardrail-log-0xjg12y1.js} +3 -3
  18. package/dist/cli/{guardrail-reset-0sfceecs.js → guardrail-reset-rgbt0zgy.js} +29 -29
  19. package/dist/cli/{hive-promoter-8v9vcd75.js → hive-promoter-f0rzkbww.js} +29 -29
  20. package/dist/cli/{index-1v277wxc.js → index-0vv7vzp8.js} +1 -1
  21. package/dist/cli/{index-wgf1780e.js → index-1j14kbak.js} +1 -1
  22. package/dist/cli/{index-56w2vy52.js → index-275w8rfx.js} +3 -3
  23. package/dist/cli/{index-h29ckdg5.js → index-2nq7h5cj.js} +4 -4
  24. package/dist/cli/{index-ab1k780s.js → index-2r6d72m6.js} +2 -2
  25. package/dist/cli/{index-gpr3j0w1.js → index-44z8mv05.js} +1 -1
  26. package/dist/cli/{index-nbg19t1b.js → index-5c6zse74.js} +4 -4
  27. package/dist/cli/{index-sv514p10.js → index-5g0nrnyd.js} +4 -4
  28. package/dist/cli/{index-yctvn9z9.js → index-5ph10kdd.js} +1 -1
  29. package/dist/cli/{index-xyvsdn07.js → index-5q3hg1pk.js} +19 -0
  30. package/dist/cli/{index-0jmt8y9r.js → index-6r93sy2k.js} +2 -2
  31. package/dist/cli/{index-b4kdms7x.js → index-7rpcbnp8.js} +1 -1
  32. package/dist/cli/{index-pktvge7a.js → index-8f7wgcpz.js} +1 -1
  33. package/dist/cli/{index-4ts6jpmj.js → index-8x90j950.js} +1 -1
  34. package/dist/cli/{index-y7khxj1g.js → index-95k0fkhp.js} +64 -64
  35. package/dist/cli/{index-bncex5hw.js → index-9cffn82s.js} +2 -2
  36. package/dist/cli/{index-048p7deh.js → index-9dbxpr2j.js} +1 -1
  37. package/dist/cli/{index-bt2h69a2.js → index-bcn30s7q.js} +6 -6
  38. package/dist/cli/{index-ngzt2xmr.js → index-bft3404e.js} +1 -1
  39. package/dist/cli/{index-yk3b7ywa.js → index-dgv5xy0b.js} +6 -6
  40. package/dist/cli/{index-f50e1pn3.js → index-dygkt0ne.js} +31 -31
  41. package/dist/cli/{index-xfkzwc4p.js → index-eac47j2q.js} +1 -1
  42. package/dist/cli/{index-vrvcn7k1.js → index-encs4mdm.js} +3 -3
  43. package/dist/cli/{index-rav29yb2.js → index-j2x2ajz7.js} +2 -2
  44. package/dist/cli/{index-43scxm6a.js → index-mff4szvk.js} +2 -2
  45. package/dist/cli/{index-gss7ch5k.js → index-pmcvznag.js} +2 -2
  46. package/dist/cli/{index-kezh6nhq.js → index-q49vqmzh.js} +2 -2
  47. package/dist/cli/{index-pvpeggb5.js → index-tmhwpzdg.js} +1 -1
  48. package/dist/cli/{index-trvn0kg0.js → index-v5nh2fhv.js} +2 -2
  49. package/dist/cli/{index-4cw3w8qm.js → index-vyb5xf36.js} +3 -3
  50. package/dist/cli/{index-1feqa2vz.js → index-x48h0zsw.js} +29 -29
  51. package/dist/cli/{index-mrq61h10.js → index-xxvman1m.js} +3 -3
  52. package/dist/cli/{index-evf5t4ba.js → index-y46b7a5g.js} +6 -6
  53. package/dist/cli/{index-bw6q2v41.js → index-yg4923ga.js} +3 -3
  54. package/dist/cli/index.js +30 -30
  55. package/dist/cli/{knowledge-escalator-53n7wa7s.js → knowledge-escalator-s25vhfrt.js} +8 -8
  56. package/dist/cli/{knowledge-events-80fw8pf6.js → knowledge-events-qd39qwy1.js} +6 -6
  57. package/dist/cli/{knowledge-store-rh1v0509.js → knowledge-store-y02hfxq9.js} +1 -1
  58. package/dist/cli/{knowledge-validator-c3926fw5.js → knowledge-validator-d7ysvdmw.js} +2 -2
  59. package/dist/cli/{mcp-r43tvhzy.js → mcp-5py3efbs.js} +1 -1
  60. package/dist/cli/{model-preflight-vx9px5ac.js → model-preflight-2zqrjnnh.js} +29 -29
  61. package/dist/cli/{pending-delegations-0vbkv5d2.js → pending-delegations-9rt59skt.js} +3 -3
  62. package/dist/cli/{pr-subscriptions-a6cm44fs.js → pr-subscriptions-q51ze9rn.js} +3 -3
  63. package/dist/cli/{pr-workflow-gate-yvgpmywz.js → pr-workflow-gate-3vj3f93g.js} +29 -29
  64. package/dist/cli/{scan-cursor-pk4h80c1.js → scan-cursor-0fr17e5q.js} +2 -2
  65. package/dist/cli/{schema-5rxfybx2.js → schema-10j951xn.js} +1 -1
  66. package/dist/cli/{scope-persistence-qzs1f91v.js → scope-persistence-jewjr6zg.js} +5 -5
  67. package/dist/cli/{server-gdewbeyb.js → server-0s65qjx7.js} +29 -29
  68. package/dist/cli/{skill-generator-xh2w2pvq.js → skill-generator-7hxqq63r.js} +9 -9
  69. package/dist/cli/{snapshot-coordination-init-jn2rh2s8.js → snapshot-coordination-init-kh4dayg5.js} +29 -29
  70. package/dist/cli/{speckit-checkoff-98zsw8c4.js → speckit-checkoff-n8s920fs.js} +3 -3
  71. package/dist/cli/{workspace-snapshot-93gzfac2.js → workspace-snapshot-veqaqrjr.js} +2 -2
  72. package/dist/cli/{worktree-collision-ownership-2xqxqp0x.js → worktree-collision-ownership-7cz0a2sr.js} +4 -4
  73. package/dist/cli/{worktree-isolation-rxpwxvw3.js → worktree-isolation-4dbza44f.js} +29 -29
  74. package/dist/hooks/utils.d.ts +15 -0
  75. package/dist/host/v2/agents-commands.d.ts +133 -7
  76. package/dist/host/v2/hooks.d.ts +16 -2
  77. package/dist/host/v2/model-apply.d.ts +16 -6
  78. package/dist/host/v2/setup.d.ts +26 -2
  79. package/dist/host/v2/types.d.ts +27 -3
  80. package/dist/index.d.ts +15 -0
  81. package/dist/index.js +73 -72
  82. package/package.json +1 -1
@@ -6,15 +6,15 @@ import {
6
6
  WORKTREE_PROVISIONING_OWNER_LEASE_MS,
7
7
  removeWorktreeProvisioningOwner,
8
8
  scanWorktreeProvisioningOwnersForRecovery
9
- } from "./index-b4kdms7x.js";
9
+ } from "./index-7rpcbnp8.js";
10
10
  import {
11
11
  scanDelegationFallbacksForRecovery,
12
12
  scanDelegationsForRecovery
13
- } from "./index-h29ckdg5.js";
13
+ } from "./index-2nq7h5cj.js";
14
14
  import {
15
15
  scanWorktreeMergeFailuresForRecovery
16
16
  } from "./index-v3bmwmqw.js";
17
- import"./index-xyvsdn07.js";
17
+ import"./index-5q3hg1pk.js";
18
18
  import"./index-s9y49avf.js";
19
19
  import"./index-na6ph1fp.js";
20
20
  import"./index-ves1rtqt.js";
@@ -23,7 +23,7 @@ import"./index-rdm3px0g.js";
23
23
  import"./index-nzfq1ms2.js";
24
24
  import"./index-7pmbnjvj.js";
25
25
  import"./index-ypxq0x7r.js";
26
- import"./index-nbg19t1b.js";
26
+ import"./index-5c6zse74.js";
27
27
  import"./index-vzm6zre7.js";
28
28
  import"./index-ae75rja9.js";
29
29
  import"./index-g57p8p1k.js";
@@ -25,53 +25,53 @@ import {
25
25
  sanitizeWorktreeTaskId,
26
26
  standardWorktreeByCallID,
27
27
  standardWorktreeSerializationSessions
28
- } from "./index-y7khxj1g.js";
28
+ } from "./index-95k0fkhp.js";
29
29
  import"./index-s3w41p1x.js";
30
- import"./index-ngzt2xmr.js";
31
- import"./index-bw6q2v41.js";
32
- import"./index-43scxm6a.js";
30
+ import"./index-bft3404e.js";
31
+ import"./index-yg4923ga.js";
32
+ import"./index-mff4szvk.js";
33
33
  import"./index-5snwc3dz.js";
34
34
  import"./index-axqyjreb.js";
35
35
  import"./index-txdagbh7.js";
36
- import"./index-bt2h69a2.js";
37
- import"./index-4ts6jpmj.js";
36
+ import"./index-bcn30s7q.js";
37
+ import"./index-8x90j950.js";
38
38
  import"./index-rdec0y3z.js";
39
- import"./index-kezh6nhq.js";
40
- import"./index-evf5t4ba.js";
41
- import"./index-mrq61h10.js";
42
- import"./index-1v277wxc.js";
43
- import"./index-wgf1780e.js";
39
+ import"./index-q49vqmzh.js";
40
+ import"./index-y46b7a5g.js";
41
+ import"./index-xxvman1m.js";
42
+ import"./index-0vv7vzp8.js";
43
+ import"./index-1j14kbak.js";
44
44
  import"./index-x5jwegqw.js";
45
- import"./index-b4kdms7x.js";
46
- import"./index-h29ckdg5.js";
45
+ import"./index-7rpcbnp8.js";
46
+ import"./index-2nq7h5cj.js";
47
47
  import"./index-pt7h91zc.js";
48
48
  import"./index-q7sjgr1y.js";
49
- import"./index-sv514p10.js";
50
- import"./index-yk3b7ywa.js";
49
+ import"./index-5g0nrnyd.js";
50
+ import"./index-dgv5xy0b.js";
51
51
  import"./index-6b295cas.js";
52
52
  import"./index-9nyqt3kb.js";
53
- import"./index-4cw3w8qm.js";
53
+ import"./index-vyb5xf36.js";
54
54
  import"./index-v3bmwmqw.js";
55
55
  import"./index-8mrentmw.js";
56
- import"./index-pktvge7a.js";
57
- import"./index-rav29yb2.js";
58
- import"./index-ab1k780s.js";
56
+ import"./index-8f7wgcpz.js";
57
+ import"./index-j2x2ajz7.js";
58
+ import"./index-2r6d72m6.js";
59
59
  import"./index-spggmr30.js";
60
- import"./index-trvn0kg0.js";
61
- import"./index-vrvcn7k1.js";
60
+ import"./index-v5nh2fhv.js";
61
+ import"./index-encs4mdm.js";
62
62
  import"./index-m9zzj4ee.js";
63
- import"./index-xyvsdn07.js";
64
- import"./index-gpr3j0w1.js";
63
+ import"./index-5q3hg1pk.js";
64
+ import"./index-44z8mv05.js";
65
65
  import"./index-v1h70r3y.js";
66
66
  import"./index-rtry5xyf.js";
67
67
  import {
68
68
  resolveWorktreeIsolationConfig
69
- } from "./index-gss7ch5k.js";
69
+ } from "./index-pmcvznag.js";
70
70
  import"./index-g22dps7x.js";
71
71
  import"./index-0725jpp7.js";
72
- import"./index-xfkzwc4p.js";
72
+ import"./index-eac47j2q.js";
73
73
  import"./index-s9y49avf.js";
74
- import"./index-bncex5hw.js";
74
+ import"./index-9cffn82s.js";
75
75
  import"./index-na6ph1fp.js";
76
76
  import"./index-ves1rtqt.js";
77
77
  import"./index-ry16d01s.js";
@@ -80,7 +80,7 @@ import"./index-nzfq1ms2.js";
80
80
  import"./index-7pmbnjvj.js";
81
81
  import"./index-9rwhas09.js";
82
82
  import"./index-ypxq0x7r.js";
83
- import"./index-nbg19t1b.js";
83
+ import"./index-5c6zse74.js";
84
84
  import"./index-vzm6zre7.js";
85
85
  import"./index-ae75rja9.js";
86
86
  import"./index-g57p8p1k.js";
@@ -93,11 +93,11 @@ import"./index-ejhxgyvm.js";
93
93
  import"./index-7g4c7s5r.js";
94
94
  import"./index-epzadpmm.js";
95
95
  import"./index-3t46mez1.js";
96
- import"./index-pvpeggb5.js";
96
+ import"./index-tmhwpzdg.js";
97
97
  import"./index-sp2cxpaq.js";
98
98
  import"./index-qbxk2rn6.js";
99
99
  import"./index-zgwm4ryv.js";
100
- import"./index-yctvn9z9.js";
100
+ import"./index-5ph10kdd.js";
101
101
  import"./index-xfzkq1k4.js";
102
102
  import"./index-bk5tah7q.js";
103
103
  import"./index-gknz3bv1.js";
@@ -25,6 +25,21 @@ type HookHandler<I, O> = (input: I, output: O) => Promise<void>;
25
25
  export declare function markFailClosed<I, O>(fn: HookHandler<I, O>): HookHandler<I, O> & {
26
26
  __failClosed?: true;
27
27
  };
28
+ /**
29
+ * Read-once accessor for the swallowed-command-error registry (#3318 AC6):
30
+ * returns the recorded error message for the exact (sessionID, command) pair
31
+ * and consumes the entry, or undefined when nothing is recorded (a miss
32
+ * consumes nothing). The v2 command dispatcher is the sole designed reader.
33
+ *
34
+ * `sinceMs` (#2910 W6 / review PRR-006): when provided, a record OLDER than
35
+ * this timestamp is STALE timeout residue (a timed-out dispatch's handler
36
+ * throwing after its dispatch already returned) — it is consumed and ignored
37
+ * (undefined) so it cannot poison this dispatch. Records created at or after
38
+ * `sinceMs` are fresh failures of THIS dispatch.
39
+ */
40
+ export declare function getLastSwallowedCommandError(sessionID: string, command: string, sinceMs?: number): string | undefined;
41
+ /** Empty the swallowed-command-error registry (v2 setup cleanup / tests). */
42
+ export declare function clearSwallowedCommandErrorRegistry(): void;
28
43
  export declare function safeHook<I, O>(fn: HookHandler<I, O>): HookHandler<I, O>;
29
44
  /**
30
45
  * `composeHandlers` runs handlers sequentially, wrapping EACH handler in
@@ -8,14 +8,19 @@
8
8
  * zero extraction from src/index.ts (the v1 TUI shortcut block stays
9
9
  * byte-pinned). DELTA: the lane-permission mutations the v1 hook writes into
10
10
  * the config object (applyLanePermissions) have no v2 destination here and
11
- * are dropped - external-directory lane scoping is a #2910 follow-up row in
12
- * docs/host/v2-hook-inventory.md.
11
+ * are dropped - external-directory lane scoping is tracked on #2910 (open)
12
+ * with its disclosure in docs/host/v2-hook-inventory.md row 4.
13
13
  *
14
14
  * Mappings (docs/host/v2-hook-inventory.md rows 4-5):
15
15
  * - v1 AgentConfig → v2 Agent.Info: `prompt`→`system`, `mode` preserved
16
16
  * (multi-swarm `*_architect` primary semantics — AGENTS.md invariant 11),
17
- * `model` string 'provider/model' → Model.Ref, `tools` allowlist →
18
- * per-tool allow permission rules (best-effort; see inventory).
17
+ * `model` string 'provider/model' → Model.Ref, and the v1 `permission`
18
+ * block → v2 permission rules through the HOST's own v1→v2 migration
19
+ * (normalizeV2PermissionAction + preserve-and-append merge; #2910 W2).
20
+ * The legacy `tools` allowlist branch is GONE: getAgentConfigs deletes
21
+ * `sdkConfig.tools` at the emit site (src/agents/index.ts, issue #2528),
22
+ * so nothing can ever feed it — the permission block is the only
23
+ * enforceable tool-gating channel.
19
24
  * - Entries the v1 hook marks `disable: true` (auto-select disabling the
20
25
  * `build`/`plan` built-ins) are REMOVED on the v2 agent editor.
21
26
  * - v1 command entries `{template, description}` → v2 CommandDefinition
@@ -34,18 +39,139 @@ import type { V1HooksSubset, V2AgentInfo, V2PluginContext, V2Registration } from
34
39
  export declare const _internals: {
35
40
  dispatchTimeoutMs: number;
36
41
  };
42
+ /** Fresh registration tables a rebuild source produces (#2910 W3). */
43
+ export interface V2RegistrationTables {
44
+ agentTable: Record<string, unknown>;
45
+ commandTable: Record<string, unknown>;
46
+ }
47
+ type V2ConfigRebuild = (directory: string) => Promise<V2RegistrationTables>;
48
+ /**
49
+ * Quiet gate for {@link deferredV2WarnOperator}. Writes attach to the
50
+ * CURRENTLY-RESOLVED owner's entry (ambient when no setup owner is live) —
51
+ * setup.ts's startup preflight calls this AFTER openCodeSwarmV2Setup made its
52
+ * per-instance token current, so the value lands on that instance's entry.
53
+ */
54
+ export declare function setV2OperatorQuiet(quiet: boolean): void;
55
+ /**
56
+ * Owner-scoped quiet gate (#2910 W5): writes the given owner's entry and
57
+ * makes it the current owner. `undefined` detaches the owner's quiet value
58
+ * (setup cleanup; the entry drops when it holds nothing else).
59
+ */
60
+ export declare function setV2OperatorQuietForOwner(token: string, quiet: boolean | undefined): void;
61
+ /**
62
+ * Clear the operator-warning dedup state and the ambient quiet entry (direct
63
+ * test calls). NOT part of setup cleanup anymore (review PRR-002): the dedup
64
+ * map is bounded FIFO with explicit eviction (the invariant-8 strategy) and a
65
+ * per-cleanup global clear would wipe a concurrent live instance's dedup
66
+ * state; per-owner quiet entries are unregistered only by their own
67
+ * instance's cleanup (owner isolation, #2910 W5).
68
+ */
69
+ export declare function resetV2OperatorWarningState(): void;
70
+ /**
71
+ * Release one owner's registration snapshot (#2910 W3 / review PRR-004):
72
+ * setup cleanup calls this after detaching rebuild + quiet so a torn-down
73
+ * instance's entry DROPS instead of staying immortal in `v2OwnerStates`
74
+ * (unbounded across re-setups, and a dead-but-resolvable owner shadows the
75
+ * fallback resolution for surviving instances).
76
+ */
77
+ export declare function clearV2OwnerRegistrationSnapshot(ownerToken: string): void;
78
+ /**
79
+ * Remove the ctx→owner-token binding recorded at registration (#2910 W3/W5 /
80
+ * review PRR-003): setup cleanup detaches its ctx so a later dispatch through
81
+ * a re-used host ctx object cannot resolve a torn-down instance's state.
82
+ */
83
+ export declare function clearV2CtxOwnerBinding(ctx: V2PluginContext): void;
84
+ /**
85
+ * Test-only bounded-state proof (review PRR-004): number of live owner
86
+ * entries. Production never calls this; tests assert a setup's cleanup drops
87
+ * its own entry (snapshot released) and a rejected setup leaks none.
88
+ */
89
+ export declare function countV2OwnerStatesForTests(): number;
37
90
  interface V1AgentConfigLike {
38
91
  mode?: unknown;
39
92
  prompt?: unknown;
40
93
  description?: unknown;
41
94
  model?: unknown;
42
- tools?: unknown;
43
95
  disable?: unknown;
96
+ /** v1 permission block: name -> effect ('allow'|'deny'|'ask') or { [resourceGlob]: effect }. */
97
+ permission?: unknown;
44
98
  }
99
+ /**
100
+ * Host v1→v2 permission-action normalization — the EXACT host migration
101
+ * table, captured verbatim from sst/opencode v2.0.29
102
+ * packages/core/src/v1/config/migrate.ts `normalizeAction` (local mirror:
103
+ * .agents/issue-traces/2910-v2-dual-host-plugin-port/probe-v2sdk/migrate-v2.0.29.ts):
104
+ *
105
+ * write | patch -> edit
106
+ * task -> subagent
107
+ * bash -> shell
108
+ * anything else -> VERBATIM (edit stays edit; apply_patch stays
109
+ * apply_patch — migrate.ts has NO rewrite for it; plugin tool names stay
110
+ * themselves). There is NO 'tool' catch-all anywhere in the host
111
+ * migration.
112
+ *
113
+ * Shared by the agent permission port (#2910 W2) and the permission-bridge
114
+ * assert routing (#3351 / #2910 W4).
115
+ */
116
+ export declare function normalizeV2PermissionAction(action: string): string;
45
117
  /** Map one v1 AgentConfig entry to a v2 Agent.Info. */
46
118
  export declare function mapV1AgentToV2(name: string, config: V1AgentConfigLike): V2AgentInfo;
47
119
  /** Expand a v1 TUI template for a v2 command execution. */
48
120
  export declare function expandV1Template(template: string, argumentsText: string): string;
49
- /** Register agents + commands via the synthetic config-hook run. */
50
- export declare function registerV2AgentsAndCommands(ctx: V2PluginContext, hooks: V1HooksSubset, directory: string, registrations: V2Registration[]): Promise<void>;
121
+ /**
122
+ * Strip one leading `/swarm` (or bare `swarm`) token from a command
123
+ * invocation's raw prompt text (#3318 AC7). The v2 host hands the command's
124
+ * OWN prompt surface text to `execute` — on some hosts that text still
125
+ * carries the leading command token, which the registry handler would then
126
+ * double (`/swarm /swarm status` → "Command not found"). Exactly ONE token
127
+ * equal to `/swarm` or `swarm` is dropped, and only when followed by
128
+ * whitespace or end-of-text; every other shape (near-misses like
129
+ * `swarmish`, other commands, bare arguments) passes through unchanged.
130
+ */
131
+ export declare function normalizeV2CommandArguments(text: string): string;
132
+ /**
133
+ * Register agents + commands via the synthetic config-hook run.
134
+ *
135
+ * `ownerToken` (#2910 W3/W5 / review PRR-003): the setup instance's token —
136
+ * binds the ctx (WeakMap) to that instance and stores the registration
137
+ * snapshot on ITS entry, so a dispatch-driven refresh through this ctx
138
+ * resolves this instance's rebuild source and snapshot even after a newer
139
+ * setup registered later. Omitted (direct/test calls): the ambient
140
+ * current-owner resolution, unchanged from the pre-PRR-003 contract.
141
+ */
142
+ export declare function registerV2AgentsAndCommands(ctx: V2PluginContext, hooks: V1HooksSubset, directory: string, registrations: V2Registration[], ownerToken?: string): Promise<void>;
143
+ /**
144
+ * Register the AMBIENT owner's config rebuild source (#2910 W3, frozen C5
145
+ * surface): the current-truth table builder a config-writing command path
146
+ * installs. `undefined` detaches it. Setup instances register through
147
+ * {@link registerV2ConfigRebuildSourceForOwner} under their own token.
148
+ */
149
+ export declare function registerV2ConfigRebuildSource(rebuild: V2ConfigRebuild | undefined): void;
150
+ /**
151
+ * Owner-scoped rebuild-source registration (#2910 W3/W5): attaches the given
152
+ * owner token's rebuild source and makes it the current owner; `undefined`
153
+ * detaches only that owner's source (setup cleanup — a concurrent live
154
+ * instance's entry is never touched).
155
+ */
156
+ export declare function registerV2ConfigRebuildSourceForOwner(token: string, rebuild: V2ConfigRebuild | undefined): void;
157
+ /**
158
+ * Refresh the v2 registration tables from the REGISTERED rebuild source
159
+ * (#2910 W3 / frozen C5). `hooks.config` is deliberately NOT re-consulted —
160
+ * the production closure is stale by construction (captured at setup time);
161
+ * the rebuild source is the only current-truth channel. No source or a
162
+ * rejecting source: deferred warning, no reloads, no throw. Unchanged
163
+ * tables: no reloads (idempotent refresh). Changed tables: the snapshot
164
+ * holder is updated FIRST (so the host's post-reload re-run of the
165
+ * registered transforms replays the fresh tables), then feature-detected
166
+ * `ctx.agent.reload()` + `ctx.command.reload()` fire; a failed reload marks
167
+ * its domain dirty for the next refresh.
168
+ *
169
+ * #2910 W3/W5 / review PRR-003: the OWNING instance is resolved through the
170
+ * dispatching ctx's bound owner token (`ownerTokenByCtx`, recorded by
171
+ * registerV2AgentsAndCommands under the setup instance's token), falling
172
+ * back to the ambient current-owner chain when the ctx was never bound
173
+ * (direct/test calls — the frozen C5 arms). Rebuild source, snapshot and the
174
+ * quiet gate all resolve through the SAME token.
175
+ */
176
+ export declare function deferredV2RefreshRegistrations(ctx: V2PluginContext, hooks: V1HooksSubset, directory: string, registrations?: V2Registration[]): Promise<void>;
51
177
  export {};
@@ -59,7 +59,21 @@ export declare function isV2CodeModeWrapper(event: {
59
59
  /** Plain-object shape guard (arrays/instances rejected); exported for the
60
60
  * event pump's progress-metadata validation (issue #3401 / PR #3402). */
61
61
  export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
62
- /** Register the tool hooks (execute.before/after). */
62
+ /**
63
+ * Register the tool hooks (execute.before/after).
64
+ *
65
+ * #3352: BOTH registrations of the pair are attempted independently — a
66
+ * rejection of the first never skips its sibling. Each failure records a
67
+ * deferred warning naming the hook + error; the function resolves when at
68
+ * least one registration landed and rejects only if both failed (setup's
69
+ * runRegistration wrapper isolates that rejection with its own warning).
70
+ */
63
71
  export declare function registerV2ToolHooks(ctx: V2PluginContext, hooks: V1HooksSubset, directory: string, registrations: V2Registration[]): Promise<void>;
64
- /** Register the compaction + prompt session hooks. */
72
+ /**
73
+ * Register the compaction + prompt session hooks.
74
+ *
75
+ * #3352: same pair-independence contract as registerV2ToolHooks — a
76
+ * rejecting 'compaction' registration still attempts 'prompt', each failure
77
+ * warns, and only a double failure rejects.
78
+ */
65
79
  export declare function registerV2SessionHooks(ctx: V2PluginContext, hooks: V1HooksSubset, directory: string, registrations: V2Registration[]): Promise<void>;
@@ -17,19 +17,29 @@
17
17
  *
18
18
  * Everything here is fail-open: with no registered surface (v1 hosts, or a v2
19
19
  * host without the agent domain) the apply is a logged no-op.
20
+ *
21
+ * #3352 / #2910 W5: the surface is OWNER-TOKEN-KEYED (see the registry
22
+ * comment below) — setup.ts passes its per-instance token on register and on
23
+ * owner-scoped clear, so concurrent live setups own disjoint surfaces.
20
24
  */
21
25
  import type { V2PluginContext } from './types';
22
26
  /**
23
27
  * Remember the v2 agent transform surface for later model rewrites. Called
24
- * once from setup after agent registration; cleared on cleanup.
28
+ * once from setup after agent registration (with the setup's owner token);
29
+ * a no-argument call registers the legacy '__default__' owner. Cleared on
30
+ * cleanup via `clearV2AgentTransformSurface(token)`.
25
31
  */
26
- export declare function registerV2AgentTransformSurface(ctx: V2PluginContext): void;
32
+ export declare function registerV2AgentTransformSurface(ctx: V2PluginContext, token?: string): void;
27
33
  /**
28
- * Drop the registered surface and dispose every held apply registration
29
- * (v2 cleanup). Best-effort: disposal failure is logged, never thrown.
34
+ * Drop a registered surface and dispose every held apply registration.
35
+ * WITH token: clears/disposes ONLY that owner's surface + held registrations
36
+ * (v2 setup cleanup — a concurrent live instance is untouched). WITHOUT
37
+ * token: LEGACY ADMINISTRATIVE clear-all (kept for the pre-W5 test seams
38
+ * model-apply-3022 / setup-wiring-3022 / review-followup-3029). Best-effort:
39
+ * disposal failure is logged, never thrown.
30
40
  */
31
- export declare function clearV2AgentTransformSurface(): void;
32
- /** True when a v2 apply surface is registered (test/diagnostic seam). */
41
+ export declare function clearV2AgentTransformSurface(token?: string): void;
42
+ /** True when any live owner carries a v2 apply surface (test/diagnostic seam). */
33
43
  export declare function hasV2AgentTransformSurface(): boolean;
34
44
  /**
35
45
  * Rewrite one registered agent's model to `modelString` ('provider/model').
@@ -7,15 +7,39 @@
7
7
  * because a custom `hook_timeout_ms` / `total_timeout_ms` would not apply.
8
8
  */
9
9
  declare function deferredV2ConfigureToolBeforeBudget(directory: string, loadConfig?: typeof loadPluginConfigWithMetaAsync): Promise<void>;
10
+ import { loadPluginConfigWithMetaAsync } from '../../config/loader';
11
+ import type { V1HooksSubset, V2PluginContext } from './types';
12
+ /**
13
+ * Test seam (#3350 AC4 declared seam, frozen checks
14
+ * setup-registration-budget-fakeclock-3327 / setup-preflight-timeout-3327):
15
+ * the registration-stage budget, the preflight config budget, the preflight
16
+ * loader and the deferred tool.execute.before budget configurator are read
17
+ * through this object AT CALL TIME so tests can pin them without patching
18
+ * global timers (AGENTS.md invariant 7; precedent: PRR-002 dispatchTimeoutMs
19
+ * in agents-commands.ts). Production never mutates it.
20
+ */
10
21
  export declare const _internals: {
22
+ registrationTimeoutMs: number;
23
+ preflightConfigTimeoutMs: number;
24
+ loadConfig: typeof loadPluginConfigWithMetaAsync;
11
25
  configureToolBeforeBudget: typeof deferredV2ConfigureToolBeforeBudget;
12
26
  };
13
- import { loadPluginConfigWithMetaAsync } from '../../config/loader';
14
- import type { V1HooksSubset, V2PluginContext } from './types';
15
27
  /** Dependencies injected from src/index.ts (avoids an index↔host cycle). */
16
28
  export interface V2SetupDependencies {
17
29
  /** The shared server-initialization wrapper (begin-interval → init core → schedule deferred → end-interval). */
18
30
  runInit: (input: unknown) => Promise<V1HooksSubset>;
31
+ /**
32
+ * Fresh registration-table builder (#2910 W3): a FRESH config read plus
33
+ * `getAgentConfigs` + the shared command-table builder — no
34
+ * side-effecting init re-run. Registered as this setup instance's config
35
+ * rebuild source so a successful `config doctor --fix` dispatch can
36
+ * refresh the registration tables. `undefined` -> the adapter registers
37
+ * no rebuild source (registration refresh stays a no-op).
38
+ */
39
+ buildV2RegistrationTables?: (directory: string) => Promise<{
40
+ agentTable: Record<string, unknown>;
41
+ commandTable: Record<string, unknown>;
42
+ }>;
19
43
  }
20
44
  /** Normalize a v2 agent reference (Agent.Info object or bare string) to a name. */
21
45
  export declare function normalizeV2AgentRef(agent: unknown): string | undefined;
@@ -12,7 +12,7 @@
12
12
  * `{ field: Body["field"] }` records; they are vendored here as plain optional fields of the
13
13
  * same types (e.g. `SessionCreateInput` is all-optional in the published form).
14
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.
15
+ * Drift guard: SHIPPED with the #2910 dual-host work — the check-host-contract-v2 digest leg and the dual-host CI lane landed, and the weekly digest plus the vendored-pin freshness detector (scripts/drift-check.ts, reading this header's pin) now guard this corpus. See docs/host/v2-hook-inventory.md for the full v1-to-v2 map.
16
16
  *
17
17
  * Host-tolerance contract for the session/worktree method surface (issue #3169):
18
18
  * the members below are REQUIRED to mirror the published `SessionDomain`/`WorktreeDomain`.
@@ -475,9 +475,33 @@ export interface V2EventEnvelope {
475
475
  export interface V2EventDomain {
476
476
  readonly subscribe?: (...args: unknown[]) => AsyncIterable<V2EventEnvelope> | Promise<AsyncIterable<V2EventEnvelope>>;
477
477
  }
478
- /** v2 `PermissionDomain` (only used for the v1 ask() bridge, best-effort). */
478
+ /**
479
+ * v2 `PermissionDomain` (only used for the v1 ask() bridge, best-effort).
480
+ * `assert` is documented in `@opencode/plugin@2.0.29`
481
+ * `dist/promise/permission.d.ts` and ABSENT at the 2.0.26 vendored pin —
482
+ * feature-detected (`typeof === 'function'`) at the call site
483
+ * (src/host/v2/tools.ts buildPermissionBridge, #3351).
484
+ */
479
485
  export interface V2PermissionDomain {
480
- readonly reply?: (input: unknown) => Promise<unknown>;
486
+ /**
487
+ * Ask-side permission assertion (2.0.29+): input
488
+ * `{ sessionID: string; agent: string; action: string; resources: string[] }`;
489
+ * a resolution grants the request, a rejection denies it.
490
+ */
491
+ assert?: (input: {
492
+ sessionID: string;
493
+ agent: string;
494
+ action: string;
495
+ resources: string[];
496
+ }) => Promise<unknown>;
497
+ /**
498
+ * Answer-side RPC `{ requestID, reply, message }` — the host's channel for
499
+ * ANSWERING a permission request, not for raising one. The bridge never
500
+ * interprets a resolved reply value as a grant (fail-closed; #3351
501
+ * decision — grant shapes stay uninterpreted pending live-host
502
+ * observation).
503
+ */
504
+ reply?: (input: unknown) => Promise<unknown>;
481
505
  readonly list?: () => Promise<unknown[]>;
482
506
  readonly hook?: (name: 'evaluate', callback: (input: unknown) => Promise<void> | void) => Promise<V2Registration>;
483
507
  }
package/dist/index.d.ts CHANGED
@@ -83,6 +83,21 @@ type PendingCostCorrection = {
83
83
  version: number;
84
84
  currentFields: DelegationCostFields;
85
85
  };
86
+ /**
87
+ * Fresh registration-table builder for the v2 host path (#2910 W3 / AC5).
88
+ * Injected into `openCodeSwarmV2Setup` as the per-instance config rebuild
89
+ * source: a FRESH config read through the async loader (never the init-time
90
+ * closure), the same release-aware auto-review resolution, project context
91
+ * and lane-permission application the v1 init path feeds
92
+ * `getAgentConfigs`, and the SAME shared table builder — no
93
+ * side-effecting init re-run (no snapshot / repo-graph / bundled-skill
94
+ * work). Invoked only from the user-triggered registration refresh, never
95
+ * from plugin init.
96
+ */
97
+ export declare function buildV2RegistrationTables(directory: string): Promise<{
98
+ agentTable: Record<string, unknown>;
99
+ commandTable: Record<string, unknown>;
100
+ }>;
86
101
  declare const _default: {
87
102
  id: "opencode-swarm";
88
103
  server: Plugin;