opencode-swarm 7.200.1 → 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.
- 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/cli/{attest-task-sg8b5a5j.js → attest-task-k7b87zk8.js} +29 -29
- package/dist/cli/{auto-checkpoint-bywgxh27.js → auto-checkpoint-pzsrkk2q.js} +4 -4
- package/dist/cli/{checkpoint-k2092cbw.js → checkpoint-sb3f8jfv.js} +9 -9
- package/dist/cli/{coder-settlement-y0hkcngn.js → coder-settlement-5jh2erx1.js} +6 -6
- package/dist/cli/{config-doctor-0fnrwkga.js → config-doctor-8keyw62b.js} +8 -8
- package/dist/cli/{core-mfyaj8b4.js → core-7240e0vh.js} +2 -2
- package/dist/cli/{curator-1s64jkc3.js → curator-1jhwv0ce.js} +29 -29
- package/dist/cli/{curator-drift-famx6p6s.js → curator-drift-r4yttpe9.js} +6 -6
- package/dist/cli/{curator-llm-factory-vya4epq6.js → curator-llm-factory-wcv6x9pq.js} +29 -29
- package/dist/cli/{doctor-knowledge-receipt-phase-id-v4y6pbek.js → doctor-knowledge-receipt-phase-id-1v5fx0rk.js} +5 -5
- package/dist/cli/{evidence-summary-service-rd7y6yjq.js → evidence-summary-service-zkbzsjbf.js} +10 -10
- package/dist/cli/{gate-evidence-kama66h5.js → gate-evidence-j4jemrv7.js} +3 -3
- package/dist/cli/{guardrail-explain-8fkhq0cg.js → guardrail-explain-g95j8z79.js} +30 -30
- package/dist/cli/{guardrail-log-gdj19fq5.js → guardrail-log-0xjg12y1.js} +3 -3
- package/dist/cli/{guardrail-reset-bmg6czzk.js → guardrail-reset-rgbt0zgy.js} +29 -29
- package/dist/cli/{hive-promoter-ychygdgc.js → hive-promoter-f0rzkbww.js} +29 -29
- package/dist/cli/{index-1v277wxc.js → index-0vv7vzp8.js} +1 -1
- package/dist/cli/{index-wgf1780e.js → index-1j14kbak.js} +1 -1
- package/dist/cli/{index-nawp90n7.js → index-275w8rfx.js} +3 -3
- package/dist/cli/{index-0tygsk8b.js → index-2nq7h5cj.js} +4 -4
- package/dist/cli/{index-3exe6k66.js → index-2r6d72m6.js} +2 -2
- package/dist/cli/{index-sz67z90q.js → index-44z8mv05.js} +1 -1
- package/dist/cli/{index-bn3aa5q1.js → index-5c6zse74.js} +4 -4
- package/dist/cli/{index-rzkmg02a.js → index-5g0nrnyd.js} +4 -4
- package/dist/cli/{index-p6v544jn.js → index-5ph10kdd.js} +5 -3
- package/dist/cli/{index-xyvsdn07.js → index-5q3hg1pk.js} +19 -0
- package/dist/cli/{index-2w5grmmj.js → index-6r93sy2k.js} +2 -2
- package/dist/cli/{index-b4kdms7x.js → index-7rpcbnp8.js} +1 -1
- package/dist/cli/{index-3zspah3v.js → index-8f7wgcpz.js} +1 -1
- package/dist/cli/{index-z9mysg5m.js → index-8x90j950.js} +1 -1
- package/dist/cli/{index-2hnnkj64.js → index-95k0fkhp.js} +112 -67
- package/dist/cli/{index-s8eac99p.js → index-9cffn82s.js} +2 -2
- package/dist/cli/{index-b0d8ra32.js → index-9dbxpr2j.js} +1 -1
- package/dist/cli/{index-dgyddtje.js → index-bcn30s7q.js} +6 -6
- package/dist/cli/{index-qzakbjcg.js → index-bft3404e.js} +1 -1
- package/dist/cli/{index-w2bhrp6z.js → index-dgv5xy0b.js} +6 -6
- package/dist/cli/{index-2dm42tgp.js → index-dygkt0ne.js} +31 -31
- package/dist/cli/{index-2m740hyt.js → index-eac47j2q.js} +1 -1
- package/dist/cli/{index-parkaa70.js → index-encs4mdm.js} +3 -3
- package/dist/cli/{index-sva5swrs.js → index-j2x2ajz7.js} +2 -2
- package/dist/cli/{index-pe77h482.js → index-mff4szvk.js} +2 -2
- package/dist/cli/{index-51dw4bjc.js → index-pmcvznag.js} +2 -2
- package/dist/cli/{index-12h2rtdj.js → index-q49vqmzh.js} +2 -2
- package/dist/cli/{index-3020n6d9.js → index-tmhwpzdg.js} +1 -1
- package/dist/cli/{index-0ptf66x5.js → index-v5nh2fhv.js} +2 -2
- package/dist/cli/{index-vtkgg2qn.js → index-vyb5xf36.js} +3 -3
- package/dist/cli/{index-f6nrw8am.js → index-x48h0zsw.js} +29 -29
- package/dist/cli/{index-th667k1y.js → index-xxvman1m.js} +3 -3
- package/dist/cli/{index-qaqyq25k.js → index-y46b7a5g.js} +6 -6
- package/dist/cli/{index-c9g3hkjz.js → index-yg4923ga.js} +3 -3
- package/dist/cli/index.js +30 -30
- package/dist/cli/{knowledge-escalator-zxd76jna.js → knowledge-escalator-s25vhfrt.js} +8 -8
- package/dist/cli/{knowledge-events-z8h0wmaw.js → knowledge-events-qd39qwy1.js} +6 -6
- package/dist/cli/{knowledge-store-g2gm13s8.js → knowledge-store-y02hfxq9.js} +1 -1
- package/dist/cli/{knowledge-validator-2sech2sx.js → knowledge-validator-d7ysvdmw.js} +2 -2
- package/dist/cli/{mcp-t88363gj.js → mcp-5py3efbs.js} +1 -1
- package/dist/cli/{model-preflight-akj8g1m2.js → model-preflight-2zqrjnnh.js} +29 -29
- package/dist/cli/{pending-delegations-bqp6b6as.js → pending-delegations-9rt59skt.js} +3 -3
- package/dist/cli/{pr-subscriptions-wxjvkg56.js → pr-subscriptions-q51ze9rn.js} +3 -3
- package/dist/cli/{pr-workflow-gate-2wcrfa6g.js → pr-workflow-gate-3vj3f93g.js} +29 -29
- package/dist/cli/{scan-cursor-8br4x41t.js → scan-cursor-0fr17e5q.js} +2 -2
- package/dist/cli/{schema-mc419qh8.js → schema-10j951xn.js} +1 -1
- package/dist/cli/{scope-persistence-5gyjt70q.js → scope-persistence-jewjr6zg.js} +5 -5
- package/dist/cli/{server-bp247fqe.js → server-0s65qjx7.js} +29 -29
- package/dist/cli/{skill-generator-q4afafh3.js → skill-generator-7hxqq63r.js} +9 -9
- package/dist/cli/{snapshot-coordination-init-b4kmrgh7.js → snapshot-coordination-init-kh4dayg5.js} +29 -29
- package/dist/cli/{speckit-checkoff-1v02b2dt.js → speckit-checkoff-n8s920fs.js} +3 -3
- package/dist/cli/{workspace-snapshot-93gzfac2.js → workspace-snapshot-veqaqrjr.js} +2 -2
- package/dist/cli/{worktree-collision-ownership-84m9f5an.js → worktree-collision-ownership-7cz0a2sr.js} +4 -4
- package/dist/cli/{worktree-isolation-xwbszhja.js → worktree-isolation-4dbza44f.js} +29 -29
- package/dist/config/schema.d.ts +2 -0
- package/dist/full-auto/code-mode-program.d.ts +31 -0
- package/dist/full-auto/critic-tools.d.ts +18 -0
- package/dist/full-auto/policy.d.ts +17 -0
- package/dist/hooks/code-mode-wrapper.d.ts +28 -0
- package/dist/hooks/full-auto-intercept.d.ts +5 -0
- package/dist/hooks/full-auto-permission.d.ts +25 -0
- package/dist/hooks/pr-workflow-gate.d.ts +21 -1
- package/dist/hooks/utils.d.ts +15 -0
- package/dist/host/v2/agents-commands.d.ts +133 -7
- package/dist/host/v2/hook-budget.d.ts +37 -0
- package/dist/host/v2/hooks.d.ts +25 -2
- package/dist/host/v2/model-apply.d.ts +16 -6
- package/dist/host/v2/setup.d.ts +38 -0
- package/dist/host/v2/types.d.ts +27 -3
- package/dist/index.d.ts +15 -0
- package/dist/index.js +102 -98
- package/opencode-swarm.schema.json +8 -0
- package/package.json +1 -1
|
@@ -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
|
|
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, `
|
|
18
|
-
*
|
|
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
|
-
/**
|
|
50
|
-
|
|
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 {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Budget for the OpenCode 2 `tool.execute.before` guard chain (#3446).
|
|
3
|
+
*
|
|
4
|
+
* The v2 adapter wraps the whole v1 before-chain in one timeout. The chain is
|
|
5
|
+
* normally instant, but while Full-Auto is running it can contain an LLM
|
|
6
|
+
* oversight dispatch whose own deadline (`full_auto.oversight.total_timeout_ms`,
|
|
7
|
+
* default 120 s, up to 300 s) is LONGER than the fixed 60 s the adapter used.
|
|
8
|
+
* The host then reported "tool.execute.before exceeded budget" at 60 s while the
|
|
9
|
+
* critic kept running to its own deadline, and the run paused.
|
|
10
|
+
*
|
|
11
|
+
* Resolution order:
|
|
12
|
+
* 1. `full_auto.oversight.hook_timeout_ms` when set (explicit, always applies);
|
|
13
|
+
* 2. else, while a Full-Auto run is active for the session:
|
|
14
|
+
* `oversight.total_timeout_ms + 30 s` (never below the base);
|
|
15
|
+
* 3. else the 60 s base.
|
|
16
|
+
*
|
|
17
|
+
* Settings are keyed by project directory (one plugin process can host several
|
|
18
|
+
* projects, each with its own config); a call without a directory, or for an
|
|
19
|
+
* unknown one, uses the default slot, then the module defaults.
|
|
20
|
+
*/
|
|
21
|
+
export declare const V2_TOOL_BEFORE_BASE_MS = 60000;
|
|
22
|
+
export declare const V2_TOOL_BEFORE_MARGIN_MS = 30000;
|
|
23
|
+
export declare const V2_TOOL_BEFORE_MAX_MS = 900000;
|
|
24
|
+
/** Max distinct project directories retained (invariant 8: bounded state). */
|
|
25
|
+
export declare const V2_TOOL_BEFORE_BUDGET_MAX_ENTRIES = 64;
|
|
26
|
+
/**
|
|
27
|
+
* Record the relevant `full_auto.oversight` settings for a project directory
|
|
28
|
+
* (call at setup; omit `directory` to set the default slot).
|
|
29
|
+
*/
|
|
30
|
+
export declare function configureV2ToolBeforeBudget(fullAuto: unknown, directory?: string): void;
|
|
31
|
+
/** Budget, in ms, for one `tool.execute.before` chain. */
|
|
32
|
+
export declare function resolveV2ToolBeforeBudgetMs(fullAutoActive: boolean, directory?: string): number;
|
|
33
|
+
/**
|
|
34
|
+
* Restore defaults for one project directory (setup failure path), or for
|
|
35
|
+
* everything when called without an argument (test seam).
|
|
36
|
+
*/
|
|
37
|
+
export declare function resetV2ToolBeforeBudget(directory?: string): void;
|
package/dist/host/v2/hooks.d.ts
CHANGED
|
@@ -40,6 +40,15 @@ import type { V1HooksSubset, V2PluginContext, V2Registration } from './types';
|
|
|
40
40
|
/** Mirrors `isTaskToolId`'s shape (dotted SDK form OR normalized base name).
|
|
41
41
|
* Exported for the event pump's progress-event gating (issue #3401). */
|
|
42
42
|
export declare function isV2SubagentToolId(toolName: string | null | undefined): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True for the host's Code Mode wrapper (#3446): the host-owned `execute`
|
|
45
|
+
* tool whose input is a JS program. The host id is matched exactly (no
|
|
46
|
+
* namespace stripping), and the call must carry a string `code` program.
|
|
47
|
+
*/
|
|
48
|
+
export declare function isV2CodeModeWrapper(event: {
|
|
49
|
+
readonly tool: string;
|
|
50
|
+
readonly input?: unknown;
|
|
51
|
+
}): boolean;
|
|
43
52
|
/**
|
|
44
53
|
* Any recognized v2 subagent id (bare, namespace-prefixed, or dotted) is handed
|
|
45
54
|
* to the v1 chain as the bare v1 id `task`. The v1 host reports the native tool
|
|
@@ -50,7 +59,21 @@ export declare function isV2SubagentToolId(toolName: string | null | undefined):
|
|
|
50
59
|
/** Plain-object shape guard (arrays/instances rejected); exported for the
|
|
51
60
|
* event pump's progress-metadata validation (issue #3401 / PR #3402). */
|
|
52
61
|
export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
|
|
53
|
-
/**
|
|
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
|
+
*/
|
|
54
71
|
export declare function registerV2ToolHooks(ctx: V2PluginContext, hooks: V1HooksSubset, directory: string, registrations: V2Registration[]): Promise<void>;
|
|
55
|
-
/**
|
|
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
|
+
*/
|
|
56
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
|
|
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
|
|
29
|
-
*
|
|
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
|
|
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').
|
package/dist/host/v2/setup.d.ts
CHANGED
|
@@ -1,8 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `full_auto.oversight` once and size the v2 tool.execute.before budget
|
|
3
|
+
* for this project directory from it (#3446). Bounded and fail-open: on any
|
|
4
|
+
* error this project's entry is dropped and the module defaults apply (60 s
|
|
5
|
+
* base; 150 s while a Full-Auto run is active, i.e. the default 120 s
|
|
6
|
+
* oversight deadline + 30 s) and an operator-visible warning is queued,
|
|
7
|
+
* because a custom `hook_timeout_ms` / `total_timeout_ms` would not apply.
|
|
8
|
+
*/
|
|
9
|
+
declare function deferredV2ConfigureToolBeforeBudget(directory: string, loadConfig?: typeof loadPluginConfigWithMetaAsync): Promise<void>;
|
|
10
|
+
import { loadPluginConfigWithMetaAsync } from '../../config/loader';
|
|
1
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
|
+
*/
|
|
21
|
+
export declare const _internals: {
|
|
22
|
+
registrationTimeoutMs: number;
|
|
23
|
+
preflightConfigTimeoutMs: number;
|
|
24
|
+
loadConfig: typeof loadPluginConfigWithMetaAsync;
|
|
25
|
+
configureToolBeforeBudget: typeof deferredV2ConfigureToolBeforeBudget;
|
|
26
|
+
};
|
|
2
27
|
/** Dependencies injected from src/index.ts (avoids an index↔host cycle). */
|
|
3
28
|
export interface V2SetupDependencies {
|
|
4
29
|
/** The shared server-initialization wrapper (begin-interval → init core → schedule deferred → end-interval). */
|
|
5
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
|
+
}>;
|
|
6
43
|
}
|
|
7
44
|
/** Normalize a v2 agent reference (Agent.Info object or bare string) to a name. */
|
|
8
45
|
export declare function normalizeV2AgentRef(agent: unknown): string | undefined;
|
|
@@ -24,3 +61,4 @@ export declare function seedV1SessionState(sessionID: string | undefined, agentR
|
|
|
24
61
|
* be synchronous and cheap).
|
|
25
62
|
*/
|
|
26
63
|
export declare function v2ToolInputSchema(args: unknown): unknown;
|
|
64
|
+
export {};
|
package/dist/host/v2/types.d.ts
CHANGED
|
@@ -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:
|
|
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
|
-
/**
|
|
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
|
-
|
|
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;
|