opencode-swarm 7.107.6 → 7.109.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/clarify-spec/SKILL.md +15 -9
- package/.opencode/skills/critic-gate/SKILL.md +10 -4
- package/.opencode/skills/phase-wrap/SKILL.md +2 -2
- package/.opencode/skills/plan/SKILL.md +23 -11
- package/.opencode/skills/specify/SKILL.md +27 -9
- package/dist/cli/{capability-probe-wsjzcp48.js → capability-probe-sh9bwh39.js} +2 -1
- package/dist/cli/{config-doctor-kdq3vae4.js → config-doctor-q354tb2w.js} +2 -2
- package/dist/cli/core-vev13ej2.js +34 -0
- package/dist/cli/{curator-jpwvkpdv.js → curator-3efwdf9x.js} +25 -21
- package/dist/cli/{curator-drift-ed7p5mfy.js → curator-drift-169wgaxn.js} +4 -4
- package/dist/cli/curator-llm-factory-nttpcx4b.js +40 -0
- package/dist/cli/{dispatch-anmxxhen.js → dispatch-zr1xja4t.js} +2 -2
- package/dist/cli/{evidence-summary-service-6zsgw7x7.js → evidence-summary-service-j7jwf20f.js} +10 -8
- package/dist/cli/{gate-evidence-pgr7d942.js → gate-evidence-v6ds8rcp.js} +5 -4
- package/dist/cli/guardrail-explain-e85gbj0r.js +41 -0
- package/dist/cli/{guardrail-log-fjypsmek.js → guardrail-log-8mqqsssq.js} +4 -4
- package/dist/cli/hive-promoter-rc6z2x8f.js +48 -0
- package/dist/cli/{index-9b7qp18e.js → index-1cn967sa.js} +2 -2
- package/dist/cli/{index-h28wfp7n.js → index-1mjzvkzj.js} +29 -25
- package/dist/cli/{index-n1sptn1w.js → index-2nt4mq9n.js} +1 -1
- package/dist/cli/{index-57rthc1z.js → index-3e7jajwe.js} +2 -2
- package/dist/cli/{index-bq8kd9r9.js → index-5gnp8fyw.js} +3 -3
- package/dist/cli/index-5mkc2f9z.js +154 -0
- package/dist/cli/{index-0kxc7t16.js → index-6jng9c8t.js} +1 -1
- package/dist/cli/{index-b9v501fr.js → index-7xgqky26.js} +33 -5
- package/dist/cli/{index-4r5z8sgw.js → index-85bacexr.js} +2 -2
- package/dist/cli/{index-bpgqbwmf.js → index-9qxntjtx.js} +6 -6
- package/dist/cli/index-f1qyj61w.js +418 -0
- package/dist/cli/{index-wvxhynxq.js → index-fm7xz1ne.js} +1 -1
- package/dist/cli/{index-dfdg4ws5.js → index-fz1jgbvw.js} +6 -6
- package/dist/cli/{index-pchpahdf.js → index-h4c4rrwx.js} +20 -3
- package/dist/cli/{index-kxm3bdjh.js → index-mmny81g1.js} +6 -6
- package/dist/cli/{index-v4fcn4tr.js → index-q1exe2b3.js} +2 -198
- package/dist/cli/{index-57ymmh7h.js → index-r3j3458j.js} +4 -4
- package/dist/cli/{index-91j1sqzm.js → index-scww5b77.js} +47 -0
- package/dist/cli/{index-572t1qff.js → index-vb5t1kvs.js} +1477 -2045
- package/dist/cli/{index-3naa2ajc.js → index-vvk2g744.js} +10 -156
- package/dist/cli/{index-zej8cy0j.js → index-vx76tcxe.js} +1 -1
- package/dist/cli/{index-6h82c2h0.js → index-wfq4r95s.js} +1057 -193
- package/dist/cli/{index-xmarctsf.js → index-wg0665ft.js} +7 -7
- package/dist/cli/{index-4vsgp5a8.js → index-wj4jeavn.js} +1 -1
- package/dist/cli/index-wvrj16f0.js +206 -0
- package/dist/cli/index-x2q0gnt8.js +254 -0
- package/dist/cli/{index-xg18az81.js → index-yw8qpf51.js} +1 -1
- package/dist/cli/index.js +25 -21
- package/dist/cli/{knowledge-escalator-3sgwrgy9.js → knowledge-escalator-6v7sjprx.js} +8 -7
- package/dist/cli/{knowledge-events-kfc6xmkw.js → knowledge-events-6n3x3he2.js} +6 -5
- package/dist/cli/{knowledge-store-kyacem71.js → knowledge-store-exkw6yb1.js} +6 -5
- package/dist/cli/{knowledge-validator-ez3ws8ef.js → knowledge-validator-exymfcb9.js} +7 -6
- package/dist/cli/{pending-delegations-vfnpm8zt.js → pending-delegations-yyz3fcfn.js} +5 -4
- package/dist/cli/{pr-subscriptions-bpvazmsw.js → pr-subscriptions-vv8byxe6.js} +6 -5
- package/dist/cli/{schema-x0ekqzvs.js → schema-x17zmd03.js} +1 -1
- package/dist/cli/scope-persistence-6m5nsp1r.js +20 -0
- package/dist/cli/{skill-generator-x83re96d.js → skill-generator-mx9br4ty.js} +9 -8
- package/dist/commands/_shared/url-security.d.ts +13 -3
- package/dist/commands/close.d.ts +11 -0
- package/dist/commands/lanes.d.ts +35 -0
- package/dist/commands/registry.d.ts +9 -2
- package/dist/commands/sdd.d.ts +10 -0
- package/dist/config/schema.d.ts +102 -0
- package/dist/git/branch.d.ts +53 -7
- package/dist/git/index.d.ts +5 -1
- package/dist/git/pr.d.ts +35 -2
- package/dist/hooks/delegation-gate/worktree-isolation.d.ts +118 -2
- package/dist/hooks/delegation-gate/worktree-merge-status.d.ts +17 -0
- package/dist/hooks/init-orphan-recovery-advisory.d.ts +58 -0
- package/dist/hooks/init-orphan-recovery.d.ts +65 -0
- package/dist/index.js +452 -436
- package/dist/sandbox/executor.d.ts +11 -1
- package/dist/sandbox/linux/bubblewrap-executor.d.ts +3 -1
- package/dist/sandbox/macos/sandbox-exec-executor.d.ts +3 -1
- package/dist/sandbox/win32/native-sandbox-executor.d.ts +1 -1
- package/dist/sandbox/win32/restricted-environment-executor.d.ts +4 -1
- package/dist/sdd/effective-spec.d.ts +21 -0
- package/dist/turbo/lean/runner.d.ts +11 -20
- package/dist/turbo/lean/worktree.d.ts +9 -3
- package/dist/utils/bun-compat.d.ts +30 -0
- package/dist/worktree/core.d.ts +55 -0
- package/dist/worktree/merge.d.ts +5 -1
- package/dist/worktree/types.d.ts +38 -0
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-9y15npd5.js +0 -36
- package/dist/cli/guardrail-explain-jk0amzae.js +0 -37
- package/dist/cli/hive-promoter-j2krbdn9.js +0 -44
|
@@ -11,6 +11,14 @@ export declare class SandboxError extends Error {
|
|
|
11
11
|
readonly code: string;
|
|
12
12
|
constructor(message: string, code: string);
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Validate that a string is a valid POSIX environment variable name.
|
|
16
|
+
* POSIX env var names: [a-zA-Z_][a-zA-Z0-9_]*
|
|
17
|
+
*
|
|
18
|
+
* Used to prevent shell-injection when env var keys are interpolated into
|
|
19
|
+
* sandbox command syntax on any platform.
|
|
20
|
+
*/
|
|
21
|
+
export declare function isValidEnvKey(key: string): boolean;
|
|
14
22
|
/**
|
|
15
23
|
* Interface for platform-specific sandbox executors.
|
|
16
24
|
*/
|
|
@@ -24,10 +32,12 @@ export interface SandboxExecutor {
|
|
|
24
32
|
* @param command - The raw shell command string to execute
|
|
25
33
|
* @param scopePaths - Absolute paths the coder is allowed to write to
|
|
26
34
|
* @param tempDir - Optional temporary directory path (platform default if omitted)
|
|
35
|
+
* @param envOverrides - Optional per-call env overrides: string value sets the var, null unsets it.
|
|
36
|
+
* When omitted (undefined), no per-call env override is applied (default: undefined).
|
|
27
37
|
* @returns The wrapped command string with sandbox prefix
|
|
28
38
|
* @throws SandboxError if sandbox cannot wrap the command
|
|
29
39
|
*/
|
|
30
|
-
wrapCommand(command: string, scopePaths: string[], tempDir?: string): string;
|
|
40
|
+
wrapCommand(command: string, scopePaths: string[], tempDir?: string, envOverrides?: Record<string, string | null>): string;
|
|
31
41
|
/**
|
|
32
42
|
* Get the environment variable overrides for this sandbox.
|
|
33
43
|
* Returns a record of env vars to set/unset.
|
|
@@ -64,10 +64,12 @@ export declare class BubblewrapSandboxExecutor implements SandboxExecutor {
|
|
|
64
64
|
* @param command - Raw shell command to execute inside the sandbox
|
|
65
65
|
* @param scopePaths - Additional scope paths to bind (merged with constructor scope)
|
|
66
66
|
* @param tempDir - Optional temp directory override
|
|
67
|
+
* @param envOverrides - Optional per-call env overrides: string sets the var, null unsets it.
|
|
68
|
+
* When omitted, no per-call env override is applied.
|
|
67
69
|
* @returns A bwrap-wrapped command string ready for shell execution,
|
|
68
70
|
* or the raw command string when the sandbox is unavailable (passthrough mode)
|
|
69
71
|
*/
|
|
70
|
-
wrapCommand(command: string, scopePaths: string[], tempDir?: string): string;
|
|
72
|
+
wrapCommand(command: string, scopePaths: string[], tempDir?: string, envOverrides?: Record<string, string | null>): string;
|
|
71
73
|
/**
|
|
72
74
|
* Return environment variable overrides required for the bubblewrap sandbox.
|
|
73
75
|
*
|
|
@@ -53,10 +53,12 @@ export declare class MacOSSandboxExecutor implements SandboxExecutor {
|
|
|
53
53
|
* @param command - Raw shell command to execute inside the sandbox
|
|
54
54
|
* @param scopePaths - Additional scope paths to bind (merged with constructor scope)
|
|
55
55
|
* @param tempDir - Optional temp directory override
|
|
56
|
+
* @param envOverrides - Optional per-call env overrides: string sets the var, null unsets it.
|
|
57
|
+
* When omitted, no per-call env override is applied.
|
|
56
58
|
* @returns A sandbox-exec wrapped command string ready for shell execution,
|
|
57
59
|
* or the raw command string when the sandbox is unavailable (passthrough mode)
|
|
58
60
|
*/
|
|
59
|
-
wrapCommand(command: string, scopePaths: string[], tempDir?: string): string;
|
|
61
|
+
wrapCommand(command: string, scopePaths: string[], tempDir?: string, envOverrides?: Record<string, string | null>): string;
|
|
60
62
|
/**
|
|
61
63
|
* Return environment variable overrides required for the macOS sandbox.
|
|
62
64
|
*
|
|
@@ -37,7 +37,7 @@ export declare class NativeWindowsSandboxExecutor implements SandboxExecutor {
|
|
|
37
37
|
*
|
|
38
38
|
* When the runner is unavailable, falls back to the PowerShell wrapper.
|
|
39
39
|
*/
|
|
40
|
-
wrapCommand(command: string, scopePaths: string[], tempDir?: string): string;
|
|
40
|
+
wrapCommand(command: string, scopePaths: string[], tempDir?: string, envOverrides?: Record<string, string | null>): string;
|
|
41
41
|
private _wrapWithRunner;
|
|
42
42
|
getEnvOverrides(): Record<string, string | null>;
|
|
43
43
|
/**
|
|
@@ -73,6 +73,7 @@ export declare class WindowsSandboxExecutor implements SandboxExecutor {
|
|
|
73
73
|
* - Sets scoped temp directory (%TEMP%, %TMP%)
|
|
74
74
|
* - Restricts PATH to safe system paths only
|
|
75
75
|
* - Removes dangerous environment variables that could be used to bypass restrictions
|
|
76
|
+
* - Applies per-call envOverrides (set or unset)
|
|
76
77
|
* - Executes PowerShell-native cmdlets (filesystem cmdlets only) via Invoke-Expression,
|
|
77
78
|
* and all other commands via cmd /c inside a PowerShell script
|
|
78
79
|
*
|
|
@@ -86,12 +87,14 @@ export declare class WindowsSandboxExecutor implements SandboxExecutor {
|
|
|
86
87
|
* @param command - Raw shell command to execute inside the sandbox
|
|
87
88
|
* @param scopePaths - Additional scope paths to allow (merged with constructor scope)
|
|
88
89
|
* @param tempDir - Optional temp directory override
|
|
90
|
+
* @param envOverrides - Optional per-call env overrides: string sets the var, null unsets it.
|
|
91
|
+
* When omitted, no per-call env override is applied.
|
|
89
92
|
* @returns A PowerShell-wrapped command string ready for shell execution,
|
|
90
93
|
* or the raw command string when the sandbox is unavailable (passthrough mode)
|
|
91
94
|
* @throws {SandboxError} UNSAFE_PS_COMMAND when a PowerShell-native command body
|
|
92
95
|
* contains characters that enable command injection via Invoke-Expression
|
|
93
96
|
*/
|
|
94
|
-
wrapCommand(command: string, scopePaths: string[], tempDir?: string): string;
|
|
97
|
+
wrapCommand(command: string, scopePaths: string[], tempDir?: string, envOverrides?: Record<string, string | null>): string;
|
|
95
98
|
/**
|
|
96
99
|
* Return environment variable overrides required for the Windows sandbox.
|
|
97
100
|
*
|
|
@@ -203,6 +203,21 @@ export interface ReadEffectiveSpecOpts {
|
|
|
203
203
|
* `.specify/` a non-competing source, matching both citations.
|
|
204
204
|
*/
|
|
205
205
|
export declare function readEffectiveSpecSync(directory: string, opts?: ReadEffectiveSpecOpts): EffectiveSpec | null;
|
|
206
|
+
/**
|
|
207
|
+
* Write an SDD projection to `.swarm/spec.md`.
|
|
208
|
+
*
|
|
209
|
+
* **Overwrite enforcement (FR-004, TOCTOU-safe):**
|
|
210
|
+
* When `overwrite` is `false` (default), the write uses `O_EXCL` exclusive
|
|
211
|
+
* creation (`fs.writeFileSync(target, data, { flag: 'wx' })`). If the
|
|
212
|
+
* target already exists the kernel returns `EEXIST` and the function
|
|
213
|
+
* returns `written: false` with an `error` field — no archive, no replace.
|
|
214
|
+
* This closes the TOCTOU race at the write boundary: a native spec that
|
|
215
|
+
* appears between a pre-check and this call cannot be silently replaced.
|
|
216
|
+
*
|
|
217
|
+
* When `overwrite` is `true`, the existing archive-then-replace path runs.
|
|
218
|
+
*
|
|
219
|
+
* The `--dry-run` early-return remains untouched (before any write).
|
|
220
|
+
*/
|
|
206
221
|
export declare function writeProjectedSpecSync(directory: string, options?: {
|
|
207
222
|
changeId?: string;
|
|
208
223
|
dryRun?: boolean;
|
|
@@ -210,11 +225,17 @@ export declare function writeProjectedSpecSync(directory: string, options?: {
|
|
|
210
225
|
source?: 'openspec' | 'speckit';
|
|
211
226
|
/** Feature selector forwarded to buildSpeckitProjectionSync when source is speckit. */
|
|
212
227
|
feature?: string;
|
|
228
|
+
/**
|
|
229
|
+
* When true, archive the existing spec and overwrite.
|
|
230
|
+
* When false (default), use O_EXCL (wx flag) — refuse if target exists.
|
|
231
|
+
*/
|
|
232
|
+
overwrite?: boolean;
|
|
213
233
|
}): {
|
|
214
234
|
written: boolean;
|
|
215
235
|
projection: EffectiveSpec | null;
|
|
216
236
|
archivePath?: string;
|
|
217
237
|
path: string;
|
|
238
|
+
error?: string;
|
|
218
239
|
};
|
|
219
240
|
/**
|
|
220
241
|
* Validate Spec-Kit artifacts READ-ONLY (FR-007, task 2.3).
|
|
@@ -20,13 +20,13 @@ import type { LeanTurboConfig } from '../../config/schema';
|
|
|
20
20
|
import { loadFullAutoRunState } from '../../full-auto/state';
|
|
21
21
|
import { acquireLaneLocks, releaseLaneLocks } from '../../parallel/file-locks';
|
|
22
22
|
import { loadPlanJsonOnly } from '../../plan/manager';
|
|
23
|
-
import { hasActiveFullAuto } from '../../state';
|
|
23
|
+
import { ensureAgentSession, hasActiveFullAuto } from '../../state';
|
|
24
24
|
import { writeLaneEvidence, writePhaseEvidence } from './evidence';
|
|
25
25
|
import { attemptMergeBackFromDirty, getMergeStrategy, mergeLaneBranch, postMergeCleanup, startupOrphanRecovery } from './merge-back';
|
|
26
26
|
import { planLeanTurboLanes } from './planner';
|
|
27
27
|
import type { LeanTurboLane } from './state';
|
|
28
28
|
import { loadLeanTurboRunState, saveLeanTurboRunState } from './state';
|
|
29
|
-
import { assertCleanWorkingTree, provisionWorktree, removeWorktree } from './worktree';
|
|
29
|
+
import { assertCleanWorkingTree, provisionWorktree, removeLaneProfileFromDiskReal, removeWorktree } from './worktree';
|
|
30
30
|
/**
|
|
31
31
|
* Shape of the OpencodeClient session API used by the runner.
|
|
32
32
|
* Extracted into an interface so tests can inject a mock without
|
|
@@ -160,24 +160,6 @@ export interface LeanTurboPhaseResult {
|
|
|
160
160
|
/** Lanes whose coder completed but merge-back to primary branch failed */
|
|
161
161
|
mergeBackFailures?: MergeBackFailureInfo[];
|
|
162
162
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Orchestrates Lean Turbo lane execution.
|
|
165
|
-
*
|
|
166
|
-
* ## Usage
|
|
167
|
-
*
|
|
168
|
-
* ```ts
|
|
169
|
-
* const runner = new LeanTurboRunner({
|
|
170
|
-
* directory: projectRoot,
|
|
171
|
-
* sessionID: 'sess-abc123',
|
|
172
|
-
* opencodeClient: swarmState.opencodeClient,
|
|
173
|
-
* generatedAgentNames: swarmState.generatedAgentNames,
|
|
174
|
-
* });
|
|
175
|
-
*
|
|
176
|
-
* const result = await runner.runPhase(1);
|
|
177
|
-
* // ... monitor lanes ...
|
|
178
|
-
* await runner.cleanup();
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
163
|
export declare class LeanTurboRunner {
|
|
182
164
|
/**
|
|
183
165
|
* Test-only dependency-injection seam.
|
|
@@ -199,12 +181,15 @@ export declare class LeanTurboRunner {
|
|
|
199
181
|
laneDispatchTimeoutMs: number | undefined;
|
|
200
182
|
provisionWorktree: typeof provisionWorktree;
|
|
201
183
|
removeWorktree: typeof removeWorktree;
|
|
184
|
+
removeLaneProfileFromDisk: typeof removeLaneProfileFromDiskReal;
|
|
202
185
|
mergeLaneBranch: typeof mergeLaneBranch;
|
|
203
186
|
postMergeCleanup: typeof postMergeCleanup;
|
|
204
187
|
attemptMergeBackFromDirty: typeof attemptMergeBackFromDirty;
|
|
205
188
|
startupOrphanRecovery: typeof startupOrphanRecovery;
|
|
206
189
|
getMergeStrategy: typeof getMergeStrategy;
|
|
207
190
|
assertCleanWorkingTree: typeof assertCleanWorkingTree;
|
|
191
|
+
/** DI seam for ensureAgentSession — allows tests to intercept advisory queue writes. */
|
|
192
|
+
ensureAgentSession: typeof ensureAgentSession;
|
|
208
193
|
};
|
|
209
194
|
/**
|
|
210
195
|
* Test-only dependency-injection seam for session operations.
|
|
@@ -244,6 +229,12 @@ export declare class LeanTurboRunner {
|
|
|
244
229
|
private _stateLock;
|
|
245
230
|
/** Lean-mode configuration passed at construction. Undefined means use defaults. */
|
|
246
231
|
private readonly _leanConfig?;
|
|
232
|
+
/**
|
|
233
|
+
* FR-106: Records a pending dirty-tree downgrade so we can enumerate affected lanes
|
|
234
|
+
* after `planLeanTurboLanes` runs and push a per-lane advisory to the architect.
|
|
235
|
+
* Null when no downgrade is pending.
|
|
236
|
+
*/
|
|
237
|
+
private _pendingDowngrade;
|
|
247
238
|
constructor(options: {
|
|
248
239
|
/** Project root directory */
|
|
249
240
|
directory: string;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import type { LeanTurboConfig } from '../../config/schema';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { parseLeanLaneIndex } from '../../hooks/delegation-gate/worktree-isolation';
|
|
3
|
+
import { _internals, assertCleanWorkingTree, autoCommitDirty, checkPathBudget, cleanUntrackedFiles, isCleanWorktree, removeLaneProfileFromDiskReal, removeWorktree, shortenWorktreePath } from '../../worktree/core';
|
|
4
|
+
export { _internals, assertCleanWorkingTree, autoCommitDirty, checkPathBudget, cleanUntrackedFiles, isCleanWorktree, parseLeanLaneIndex, removeLaneProfileFromDiskReal, removeWorktree, shortenWorktreePath, };
|
|
4
5
|
export type { AutoCommitSkip, AutoCommitSuccess, CleanCheckFailure, CleanCheckSuccess, CleanFailure, CleanSuccess, ProvisionFailure, ProvisionSuccess, RemoveFailure, RemoveSuccess, } from '../../worktree/core';
|
|
5
|
-
export declare function provisionWorktree(directory: string, laneId: string, sessionId: string, config: LeanTurboConfig
|
|
6
|
+
export declare function provisionWorktree(directory: string, laneId: string, sessionId: string, config: LeanTurboConfig, scope?: {
|
|
7
|
+
taskId: string;
|
|
8
|
+
files: string[];
|
|
9
|
+
}): Promise<{
|
|
6
10
|
worktreePath: string;
|
|
7
11
|
branchName: string;
|
|
12
|
+
} | {
|
|
13
|
+
error: string;
|
|
8
14
|
}>;
|
|
@@ -67,6 +67,15 @@ export declare function bunHash(input: string | ArrayBufferView | ArrayBuffer):
|
|
|
67
67
|
export interface BunCompatSpawnOptions {
|
|
68
68
|
cwd?: string;
|
|
69
69
|
env?: Record<string, string | undefined>;
|
|
70
|
+
/**
|
|
71
|
+
* Per-call env overlay merged into the child env at spawn time.
|
|
72
|
+
* - string value: sets KEY=value on the child env
|
|
73
|
+
* - null value: deletes KEY from the child env (use to scrub inherited vars)
|
|
74
|
+
* Absent keys are inherited from the parent process.env.
|
|
75
|
+
* Used by FR-201/202 lane runtime profile to inject per-lane PORT,
|
|
76
|
+
* TMPDIR, etc., without copying process.env.
|
|
77
|
+
*/
|
|
78
|
+
envOverrides?: Record<string, string | null>;
|
|
70
79
|
stdin?: 'inherit' | 'ignore' | 'pipe';
|
|
71
80
|
stdout?: 'inherit' | 'ignore' | 'pipe';
|
|
72
81
|
stderr?: 'inherit' | 'ignore' | 'pipe';
|
|
@@ -100,6 +109,27 @@ export interface BunCompatSubprocess {
|
|
|
100
109
|
exitCode: number | null;
|
|
101
110
|
kill(signal?: NodeJS.Signals | number): void;
|
|
102
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Merges `envOverrides` into the base env (or `process.env` if no base env
|
|
114
|
+
* is given) and returns the resulting record.
|
|
115
|
+
*
|
|
116
|
+
* - `value === null` → delete the key from the result
|
|
117
|
+
* - `value !== null` → set `key = value` in the result
|
|
118
|
+
* - absent keys → inherited from base env
|
|
119
|
+
*
|
|
120
|
+
* Always returns a copy of the env — never mutates the caller's env.
|
|
121
|
+
*
|
|
122
|
+
* The distinction between "no base env provided" and "explicitly provided
|
|
123
|
+
* an empty base env" is preserved:
|
|
124
|
+
* - `baseEnv === undefined` (caller did NOT provide env):
|
|
125
|
+
* fallback to process.env, apply overrides, return `undefined` if the
|
|
126
|
+
* merged result is empty so the child inherits naturally from process.env.
|
|
127
|
+
* - `baseEnv !== undefined` (caller provided env, even if `{}`):
|
|
128
|
+
* start from a copy of baseEnv, apply overrides, return `{}` if the
|
|
129
|
+
* merged result is empty (explicit empty environment — do NOT collapse
|
|
130
|
+
* to `undefined` and re-expose the parent's env to the child).
|
|
131
|
+
*/
|
|
132
|
+
export declare function mergeEnvForChild(baseEnv: Record<string, string | undefined> | undefined, envOverrides: Record<string, string | null> | undefined): Record<string, string> | undefined;
|
|
103
133
|
export declare function bunSpawn(cmd: string[], options?: BunCompatSpawnOptions): BunCompatSubprocess;
|
|
104
134
|
export interface BunCompatSyncResult {
|
|
105
135
|
stdout: Uint8Array;
|
package/dist/worktree/core.d.ts
CHANGED
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module worktree
|
|
10
10
|
*/
|
|
11
|
+
import * as fs from 'node:fs';
|
|
12
|
+
import * as fsPromises from 'node:fs/promises';
|
|
11
13
|
import { bunSpawn } from '../utils/bun-compat';
|
|
12
14
|
import type { WorktreeHandle, WorktreeOptions, WorktreeProvisionResult } from './types';
|
|
13
15
|
/**
|
|
@@ -32,7 +34,60 @@ export declare const _internals: {
|
|
|
32
34
|
* Production implementation runs `git config core.longpaths` via runGit.
|
|
33
35
|
*/
|
|
34
36
|
getCoreLongPaths: (directory: string) => Promise<string | undefined>;
|
|
37
|
+
/** Test seam for filesystem ops used by deps_strategy copy/link (DI to avoid mock.module leaks). */
|
|
38
|
+
fs: {
|
|
39
|
+
existsSync: typeof fs.existsSync;
|
|
40
|
+
cp: typeof fsPromises.cp;
|
|
41
|
+
cpSync: typeof fs.cpSync;
|
|
42
|
+
symlinkSync: typeof fs.symlinkSync;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Test seam for scope materialization into worktree lanes (FR-102).
|
|
46
|
+
* Allows tests to inject a spy without mock.module on node:fs or scope-persistence.
|
|
47
|
+
*/
|
|
48
|
+
writeScopeToDisk: (directory: string, taskId: string, files: string[]) => Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Test seam for lane runtime profile materialization into worktree lanes (FR-201).
|
|
51
|
+
* Allows tests to inject a spy without mock.module on node:fs.
|
|
52
|
+
*/
|
|
53
|
+
writeLaneProfileToDisk: (worktreePath: string, laneIndex: number, envOverrides: Record<string, string>) => Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Test seam for lane profile removal at teardown (FR-205 SC-134).
|
|
56
|
+
* Allows tests to inject a spy without mock.module on node:fs.
|
|
57
|
+
*/
|
|
58
|
+
removeLaneProfileFromDisk: (worktreePath: string, laneIndex: number) => Promise<void>;
|
|
59
|
+
/** Test seam for removeWorktree — allows tests to intercept worktree removal calls. */
|
|
60
|
+
removeWorktree: typeof removeWorktree;
|
|
35
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* FR-201 SC-124: Writes the lane runtime profile as `.swarm/lanes/{laneIndex}.env`.
|
|
64
|
+
*
|
|
65
|
+
* The file is written in KEY=VAL format (one entry per line) so it can be
|
|
66
|
+
* sourced by shell scripts or parsed by Node.js.
|
|
67
|
+
*
|
|
68
|
+
* Defense-in-depth: failures are non-fatal. The lane can still function without
|
|
69
|
+
* the env file if the write fails (e.g. permissions), as long as the child
|
|
70
|
+
* processes get the env vars through other means.
|
|
71
|
+
*
|
|
72
|
+
* @param worktreePath - Absolute path to the lane worktree root.
|
|
73
|
+
* @param laneIndex - 0-based lane index used for filename derivation.
|
|
74
|
+
* @param envOverrides - Map of env var names to values (set) or null (unset).
|
|
75
|
+
*/
|
|
76
|
+
export declare function writeLaneProfileToDiskReal(worktreePath: string, laneIndex: number, envOverrides: Record<string, string>): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* FR-205 SC-134: Removes the lane runtime profile `.swarm/lanes/{laneIndex}.env`.
|
|
79
|
+
*
|
|
80
|
+
* Called at lane teardown to clean up the materialization created by
|
|
81
|
+
* `writeLaneProfileToDiskReal`. Removing this file prevents stale lane data
|
|
82
|
+
* from accumulating in `.swarm/lanes/` across phases.
|
|
83
|
+
*
|
|
84
|
+
* Defense-in-depth: failures are non-fatal. The lane teardown can still
|
|
85
|
+
* complete even if the env file removal fails (e.g. permissions).
|
|
86
|
+
*
|
|
87
|
+
* @param worktreePath - Absolute path to the lane worktree root.
|
|
88
|
+
* @param laneIndex - 0-based lane index used for filename derivation.
|
|
89
|
+
*/
|
|
90
|
+
export declare function removeLaneProfileFromDiskReal(worktreePath: string, laneIndex: number): Promise<void>;
|
|
36
91
|
interface PathBudgetOk {
|
|
37
92
|
ok: true;
|
|
38
93
|
}
|
package/dist/worktree/merge.d.ts
CHANGED
|
@@ -25,6 +25,10 @@ export declare const _internals: {
|
|
|
25
25
|
platform: string;
|
|
26
26
|
/** Test seam for sleep — allows tests to skip real delays. */
|
|
27
27
|
sleep: (ms: number) => Promise<void>;
|
|
28
|
+
/** Test seam for cleanupOrphanedBranches — allows tests to intercept the cleanup call. */
|
|
29
|
+
cleanupOrphanedBranches: typeof cleanupOrphanedBranches;
|
|
30
|
+
/** Test seam for startupOrphanRecovery — allows tests to intercept the recovery call. */
|
|
31
|
+
startupOrphanRecovery: typeof startupOrphanRecovery;
|
|
28
32
|
};
|
|
29
33
|
export interface MergeSuccess {
|
|
30
34
|
merged: true;
|
|
@@ -161,7 +165,7 @@ export declare function attemptMergeBackFromDirty(worktreePath: string, branchNa
|
|
|
161
165
|
/**
|
|
162
166
|
* Cleans up orphaned swarm-lane branches that do not belong to any active session.
|
|
163
167
|
*
|
|
164
|
-
* Lists all
|
|
168
|
+
* Lists all swarm-lane/ and swarm/lane/ branches, identifies orphans (branches whose
|
|
165
169
|
* session ID is not in `activeSessionIds`), force-deletes them, and prunes stale
|
|
166
170
|
* worktree metadata.
|
|
167
171
|
*
|
package/dist/worktree/types.d.ts
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
export type WorktreePurpose = 'lane' | 'session';
|
|
2
2
|
export type MergeStrategy = 'merge' | 'rebase' | 'cherry-pick';
|
|
3
3
|
export type DependencyPreparationStrategy = 'skip' | 'copy' | 'link';
|
|
4
|
+
/**
|
|
5
|
+
* FR-201: Per-lane runtime profile injected into spawned child processes.
|
|
6
|
+
*
|
|
7
|
+
* Produced at lane provisioning time and written as `.swarm/lanes/{laneIndex}.env`
|
|
8
|
+
* (KEY=VAL format, one per line) so any child process spawned inside the lane
|
|
9
|
+
* can source it to get lane-specific PORT, TMPDIR, cache redirects, etc.
|
|
10
|
+
*
|
|
11
|
+
* The profile is computed from the resolved WorktreeIsolationConfig.runtime_isolation:
|
|
12
|
+
* - PORT = (port_base ?? 0) + laneIndex * port_stride
|
|
13
|
+
* - env_overrides merged verbatim
|
|
14
|
+
* - cache_redirects mapped to env vars
|
|
15
|
+
*/
|
|
16
|
+
export interface LaneRuntimeProfile {
|
|
17
|
+
/** 0-based lane index used for port and env derivation. */
|
|
18
|
+
laneIndex: number;
|
|
19
|
+
/** Absolute path to the provisioned worktree. */
|
|
20
|
+
worktreePath: string;
|
|
21
|
+
/** Env var overrides for this lane (includes PORT after derivation). */
|
|
22
|
+
envOverrides: Record<string, string>;
|
|
23
|
+
}
|
|
4
24
|
export interface WorktreeOptions {
|
|
5
25
|
worktreeDir?: string;
|
|
6
26
|
mergeStrategy?: MergeStrategy;
|
|
@@ -11,6 +31,24 @@ export interface WorktreeOptions {
|
|
|
11
31
|
* `legacy-lane` preserves the PR #1188 Lean Turbo branch contract.
|
|
12
32
|
*/
|
|
13
33
|
branchStyle?: 'purpose' | 'legacy-lane';
|
|
34
|
+
/**
|
|
35
|
+
* Optional scope to materialize into the lane's `.swarm/scopes/scope-{taskId}.json`.
|
|
36
|
+
* Enables scope durability for worktree lanes (FR-102 / SC-105, SC-106).
|
|
37
|
+
* When provided, provisionWorktree will write the scope file into the lane
|
|
38
|
+
* after `git worktree add` so that resolveScopeWithFallbacks called with
|
|
39
|
+
* the worktree path as `directory` can recover it after plugin restart.
|
|
40
|
+
*/
|
|
41
|
+
scope?: {
|
|
42
|
+
taskId: string;
|
|
43
|
+
files: string[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* FR-201 SC-124: Optional runtime profile to materialize into the lane.
|
|
47
|
+
* When provided, provisionWorktree will write `.swarm/lanes/{laneIndex}.env`
|
|
48
|
+
* (KEY=VAL format, one per line) into the worktree root after creation,
|
|
49
|
+
* so any child process spawned inside the lane can source it.
|
|
50
|
+
*/
|
|
51
|
+
laneProfile?: LaneRuntimeProfile;
|
|
14
52
|
}
|
|
15
53
|
export interface WorktreeHandle {
|
|
16
54
|
worktreePath: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.109.0",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
createCuratorLLMDelegate
|
|
4
|
-
} from "./index-572t1qff.js";
|
|
5
|
-
import"./index-4vsgp5a8.js";
|
|
6
|
-
import"./index-c8s9a3zh.js";
|
|
7
|
-
import"./index-wvxhynxq.js";
|
|
8
|
-
import"./index-6h82c2h0.js";
|
|
9
|
-
import"./index-91j1sqzm.js";
|
|
10
|
-
import"./index-xg18az81.js";
|
|
11
|
-
import"./index-09xpycan.js";
|
|
12
|
-
import"./index-pchpahdf.js";
|
|
13
|
-
import"./index-bpgqbwmf.js";
|
|
14
|
-
import"./index-dfdg4ws5.js";
|
|
15
|
-
import"./index-bq8kd9r9.js";
|
|
16
|
-
import"./index-kxm3bdjh.js";
|
|
17
|
-
import"./index-xmarctsf.js";
|
|
18
|
-
import"./index-n1sptn1w.js";
|
|
19
|
-
import"./index-bfwt3abw.js";
|
|
20
|
-
import"./index-v4fcn4tr.js";
|
|
21
|
-
import"./index-0kxc7t16.js";
|
|
22
|
-
import"./index-9b7qp18e.js";
|
|
23
|
-
import"./index-4r5z8sgw.js";
|
|
24
|
-
import"./index-57ymmh7h.js";
|
|
25
|
-
import"./index-5e4e2hvv.js";
|
|
26
|
-
import"./index-p0arc26j.js";
|
|
27
|
-
import"./index-jtqkh8jf.js";
|
|
28
|
-
import"./index-zgwm4ryv.js";
|
|
29
|
-
import"./index-293f68mj.js";
|
|
30
|
-
import"./index-3naa2ajc.js";
|
|
31
|
-
import"./index-b9v501fr.js";
|
|
32
|
-
import"./index-vn263hqt.js";
|
|
33
|
-
import"./index-a76rekgs.js";
|
|
34
|
-
export {
|
|
35
|
-
createCuratorLLMDelegate
|
|
36
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
handleGuardrailExplain
|
|
4
|
-
} from "./index-57rthc1z.js";
|
|
5
|
-
import"./index-572t1qff.js";
|
|
6
|
-
import"./index-4vsgp5a8.js";
|
|
7
|
-
import"./index-c8s9a3zh.js";
|
|
8
|
-
import"./index-wvxhynxq.js";
|
|
9
|
-
import"./index-6h82c2h0.js";
|
|
10
|
-
import"./index-91j1sqzm.js";
|
|
11
|
-
import"./index-xg18az81.js";
|
|
12
|
-
import"./index-09xpycan.js";
|
|
13
|
-
import"./index-pchpahdf.js";
|
|
14
|
-
import"./index-bpgqbwmf.js";
|
|
15
|
-
import"./index-dfdg4ws5.js";
|
|
16
|
-
import"./index-bq8kd9r9.js";
|
|
17
|
-
import"./index-kxm3bdjh.js";
|
|
18
|
-
import"./index-xmarctsf.js";
|
|
19
|
-
import"./index-n1sptn1w.js";
|
|
20
|
-
import"./index-bfwt3abw.js";
|
|
21
|
-
import"./index-v4fcn4tr.js";
|
|
22
|
-
import"./index-0kxc7t16.js";
|
|
23
|
-
import"./index-9b7qp18e.js";
|
|
24
|
-
import"./index-4r5z8sgw.js";
|
|
25
|
-
import"./index-57ymmh7h.js";
|
|
26
|
-
import"./index-5e4e2hvv.js";
|
|
27
|
-
import"./index-p0arc26j.js";
|
|
28
|
-
import"./index-jtqkh8jf.js";
|
|
29
|
-
import"./index-zgwm4ryv.js";
|
|
30
|
-
import"./index-293f68mj.js";
|
|
31
|
-
import"./index-3naa2ajc.js";
|
|
32
|
-
import"./index-b9v501fr.js";
|
|
33
|
-
import"./index-vn263hqt.js";
|
|
34
|
-
import"./index-a76rekgs.js";
|
|
35
|
-
export {
|
|
36
|
-
handleGuardrailExplain
|
|
37
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
checkHivePromotions,
|
|
4
|
-
createHivePromoterHook,
|
|
5
|
-
isHiveEligible,
|
|
6
|
-
promoteFromSwarm,
|
|
7
|
-
promoteToHive
|
|
8
|
-
} from "./index-572t1qff.js";
|
|
9
|
-
import"./index-4vsgp5a8.js";
|
|
10
|
-
import"./index-c8s9a3zh.js";
|
|
11
|
-
import"./index-wvxhynxq.js";
|
|
12
|
-
import"./index-6h82c2h0.js";
|
|
13
|
-
import"./index-91j1sqzm.js";
|
|
14
|
-
import"./index-xg18az81.js";
|
|
15
|
-
import"./index-09xpycan.js";
|
|
16
|
-
import"./index-pchpahdf.js";
|
|
17
|
-
import"./index-bpgqbwmf.js";
|
|
18
|
-
import"./index-dfdg4ws5.js";
|
|
19
|
-
import"./index-bq8kd9r9.js";
|
|
20
|
-
import"./index-kxm3bdjh.js";
|
|
21
|
-
import"./index-xmarctsf.js";
|
|
22
|
-
import"./index-n1sptn1w.js";
|
|
23
|
-
import"./index-bfwt3abw.js";
|
|
24
|
-
import"./index-v4fcn4tr.js";
|
|
25
|
-
import"./index-0kxc7t16.js";
|
|
26
|
-
import"./index-9b7qp18e.js";
|
|
27
|
-
import"./index-4r5z8sgw.js";
|
|
28
|
-
import"./index-57ymmh7h.js";
|
|
29
|
-
import"./index-5e4e2hvv.js";
|
|
30
|
-
import"./index-p0arc26j.js";
|
|
31
|
-
import"./index-jtqkh8jf.js";
|
|
32
|
-
import"./index-zgwm4ryv.js";
|
|
33
|
-
import"./index-293f68mj.js";
|
|
34
|
-
import"./index-3naa2ajc.js";
|
|
35
|
-
import"./index-b9v501fr.js";
|
|
36
|
-
import"./index-vn263hqt.js";
|
|
37
|
-
import"./index-a76rekgs.js";
|
|
38
|
-
export {
|
|
39
|
-
promoteToHive,
|
|
40
|
-
promoteFromSwarm,
|
|
41
|
-
isHiveEligible,
|
|
42
|
-
createHivePromoterHook,
|
|
43
|
-
checkHivePromotions
|
|
44
|
-
};
|