opencode-swarm 7.167.1 → 7.168.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/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
- package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
- package/dist/agents/project-context.d.ts +12 -8
- package/dist/cli/{coder-settlement-2ye4s5xr.js → coder-settlement-a35acvj1.js} +16 -16
- package/dist/cli/{config-doctor-b0k8eyd6.js → config-doctor-9csx775x.js} +3 -3
- package/dist/cli/{core-xgzgjk8s.js → core-agk5s7dm.js} +4 -4
- package/dist/cli/{curation-policy-bvxf5pxv.js → curation-policy-mgwv8h2k.js} +7 -7
- package/dist/cli/{curator-jpvzrxcv.js → curator-2fcagjyk.js} +45 -45
- package/dist/cli/{curator-drift-20m2ab5w.js → curator-drift-k0zrnm09.js} +8 -8
- package/dist/cli/curator-llm-factory-qaxmyy46.js +71 -0
- package/dist/cli/{dispatch-tmb929w8.js → dispatch-8ks9dyk5.js} +244 -70
- package/dist/cli/{evidence-summary-service-74az43cb.js → evidence-summary-service-4s6cje60.js} +22 -22
- package/dist/cli/{explorer-zvk5kbcb.js → explorer-2cv64zfj.js} +1 -1
- package/dist/cli/{gate-evidence-f26h2gn3.js → gate-evidence-saja4dan.js} +11 -11
- package/dist/cli/guardrail-explain-z41q6sf0.js +72 -0
- package/dist/cli/{guardrail-log-pnye3xw8.js → guardrail-log-0h24spq0.js} +9 -9
- package/dist/cli/{guardrail-reset-0da7q8ap.js → guardrail-reset-cwbe47k5.js} +44 -44
- package/dist/cli/hive-promoter-esxtcvr1.js +86 -0
- package/dist/cli/{index-bv8ha57q.js → index-00zx94vn.js} +6 -6
- package/dist/cli/{index-9e6fdz2h.js → index-0mhftbpp.js} +1 -1
- package/dist/cli/{index-7qefgq4j.js → index-1xnse449.js} +11 -1
- package/dist/cli/{index-qyr17fbz.js → index-21ree67h.js} +62 -106
- package/dist/cli/{index-q265ytw6.js → index-30h1pk05.js} +4 -4
- package/dist/cli/{index-f8xk5q5j.js → index-3dywbkyr.js} +4 -4
- package/dist/cli/{index-2w0beg3s.js → index-4r5pmtvk.js} +5 -5
- package/dist/cli/{index-69y9p6dh.js → index-54w1564x.js} +2 -2
- package/dist/cli/{index-251vrmge.js → index-5zqakgp4.js} +4 -4
- package/dist/cli/{index-bzdc4b7t.js → index-64phnth4.js} +6 -6
- package/dist/cli/{index-fmzz6aw7.js → index-8f0kscpg.js} +4 -4
- package/dist/cli/{index-t8tw1bhs.js → index-8ybjqg51.js} +2 -2
- package/dist/cli/{index-9ss2m4rs.js → index-9br68j86.js} +1 -1
- package/dist/cli/{index-4rhhvd1a.js → index-a1w58b47.js} +1 -1
- package/dist/cli/{index-qd619x3r.js → index-a8xbvsse.js} +2 -2
- package/dist/cli/{index-mgc3c483.js → index-an8b5gda.js} +10 -10
- package/dist/cli/{index-9wv6a3jx.js → index-bvqqwx84.js} +2 -2
- package/dist/cli/{index-bf6zx8cq.js → index-cyenn3pf.js} +6 -2
- package/dist/cli/{index-8x4zwk0t.js → index-ddr97ram.js} +47 -47
- package/dist/cli/{index-3nm1b3t2.js → index-dfyv3xkd.js} +8 -8
- package/dist/cli/{index-87agfprq.js → index-exatbqwj.js} +13 -4
- package/dist/cli/{index-70ha9e09.js → index-fyfbpz4f.js} +1 -1
- package/dist/cli/{index-5bd84nxc.js → index-gp9yzr1v.js} +1 -1
- package/dist/cli/{index-es13aqdb.js → index-h0e2e3h1.js} +1 -1
- package/dist/cli/{index-6d4dc99f.js → index-h439y187.js} +1 -1
- package/dist/cli/{index-9bhzbwa4.js → index-j950hqmq.js} +9 -9
- package/dist/cli/{index-sahf5yz3.js → index-kear8gb7.js} +11 -6
- package/dist/cli/{index-qww0h314.js → index-m35hybf0.js} +1 -1
- package/dist/cli/{index-qtd3hrk8.js → index-mr0wn36f.js} +5 -5
- package/dist/cli/{index-zwsbegc1.js → index-nprngf8p.js} +7 -7
- package/dist/cli/{index-z5gdgdkp.js → index-nsyxj57e.js} +12 -12
- package/dist/cli/{index-1aex5zd9.js → index-nwwk3dej.js} +2 -2
- package/dist/cli/{index-75f9jj3h.js → index-pyf517sz.js} +2 -2
- package/dist/cli/{index-m3tx1q9v.js → index-qhey6vc3.js} +1 -1
- package/dist/cli/{index-qd726agw.js → index-qwsh0h2g.js} +3 -3
- package/dist/cli/{index-n4fzmqz8.js → index-rdm3px0g.js} +4 -2
- package/dist/cli/index-rxcgrgkc.js +116 -0
- package/dist/cli/{index-54vzqy47.js → index-s0d5xter.js} +6 -6
- package/dist/cli/{index-emwezg3y.js → index-seetnhpx.js} +3 -3
- package/dist/cli/{index-0tc0pcmh.js → index-sxt7fgcw.js} +38 -2
- package/dist/cli/{index-m21x1bkx.js → index-v3xc4sde.js} +11 -8
- package/dist/cli/{index-79wnzc8q.js → index-wnzxcr0z.js} +3 -3
- package/dist/cli/{index-rk10x4zr.js → index-wst6n478.js} +106 -6
- package/dist/cli/{index-hdsg7yf6.js → index-x7k3dps5.js} +4 -3
- package/dist/cli/{index-32bxwzw0.js → index-yevn4jpe.js} +92908 -90093
- package/dist/cli/index-yv76j77m.js +2008 -0
- package/dist/cli/{index-f6zgz02s.js → index-z6qreakh.js} +7 -7
- package/dist/cli/{index-eretcr6t.js → index-ze520xw1.js} +11 -11
- package/dist/cli/index.js +44 -44
- package/dist/cli/{knowledge-escalator-p2a8xh8x.js → knowledge-escalator-b2tf3sd1.js} +17 -17
- package/dist/cli/{knowledge-events-jmh28m8d.js → knowledge-events-bgs2kxe0.js} +15 -15
- package/dist/cli/{knowledge-link-w1fwqts4.js → knowledge-link-dr3xnwyd.js} +6 -6
- package/dist/cli/{knowledge-store-8gmabtsn.js → knowledge-store-stbmb1b9.js} +7 -7
- package/dist/cli/{knowledge-validator-yk579vs4.js → knowledge-validator-zykgnsag.js} +9 -9
- package/dist/cli/{model-preflight-b3b5pgsc.js → model-preflight-1ycat9jz.js} +1 -1
- package/dist/cli/{pending-delegations-nw7ph53z.js → pending-delegations-n5qavj20.js} +14 -14
- package/dist/cli/{pr-subscriptions-9815fxbc.js → pr-subscriptions-gnvmyrng.js} +14 -14
- package/dist/cli/{pr-workflow-gate-98a7b6py.js → pr-workflow-gate-cf3ybrws.js} +44 -44
- package/dist/cli/{runner-nmrjv7te.js → runner-k0ycgv8x.js} +7 -7
- package/dist/cli/{scan-cursor-6zcs0frg.js → scan-cursor-b3mcrx23.js} +10 -10
- package/dist/cli/{schema-warvhy9h.js → schema-08049cjb.js} +4 -2
- package/dist/cli/{scope-persistence-c2ck77cv.js → scope-persistence-a493gv51.js} +20 -20
- package/dist/cli/{skill-generator-jamm1cna.js → skill-generator-2qqzkdpv.js} +19 -19
- package/dist/cli/{snapshot-coordination-init-st0xsn3f.js → snapshot-coordination-init-8yt8p7q0.js} +44 -44
- package/dist/cli/{sqlite-loader-xrnf6bq8.js → sqlite-loader-amp9z7ty.js} +1 -1
- package/dist/cli/{telemetry-ce0tx41h.js → telemetry-2wzapf11.js} +2 -2
- package/dist/cli/{workspace-snapshot-0kxj2grt.js → workspace-snapshot-rkgxhj9b.js} +6 -6
- package/dist/cli/{worktree-collision-ownership-qra7r8pw.js → worktree-collision-ownership-xttafc4h.js} +17 -17
- package/dist/cli/{worktree-isolation-yr9gnf64.js → worktree-isolation-e5q5rewk.js} +45 -45
- package/dist/commands/close/align-stage.d.ts +10 -0
- package/dist/commands/close/archive-stage.d.ts +34 -0
- package/dist/commands/close/clean-stage.d.ts +2 -0
- package/dist/commands/close/constants.d.ts +122 -0
- package/dist/commands/close/context.d.ts +129 -0
- package/dist/commands/close/db-helpers.d.ts +10 -0
- package/dist/commands/close/dry-run.d.ts +12 -0
- package/dist/commands/close/finalize-stage.d.ts +44 -0
- package/dist/commands/close/fs-helpers.d.ts +17 -0
- package/dist/commands/close/internals.d.ts +55 -0
- package/dist/commands/close/orchestrator.d.ts +32 -0
- package/dist/commands/close/wiring.d.ts +2 -0
- package/dist/commands/close.d.ts +10 -402
- package/dist/commands/reset.d.ts +10 -0
- package/dist/commands/rollback.d.ts +9 -0
- package/dist/config/schema.d.ts +29 -0
- package/dist/db/project-db.d.ts +8 -0
- package/dist/db/sqlite-loader.d.ts +2 -1
- package/dist/dispatch/spawn-circuit.d.ts +121 -0
- package/dist/dispatch/token-bucket.d.ts +46 -0
- package/dist/hooks/delegation-gate/dead-lane-reclaim.d.ts +61 -0
- package/dist/hooks/delegation-gate/worktree-isolation.d.ts +22 -0
- package/dist/hooks/issue-trace.d.ts +3 -0
- package/dist/hooks/utils.d.ts +1 -1
- package/dist/index.js +811 -726
- package/dist/lang/dispatch.d.ts +6 -6
- package/dist/plan/ledger-sqlite.d.ts +226 -0
- package/dist/plan/ledger.d.ts +24 -0
- package/dist/plan/manager.d.ts +19 -0
- package/dist/retention/sweep.d.ts +2 -0
- package/dist/services/spec-drift-recovery.d.ts +2 -1
- package/dist/utils/canonical-root.d.ts +19 -0
- package/dist/utils/ephemeral-session-teardown.d.ts +55 -2
- package/opencode-swarm.schema.json +41 -0
- package/package.json +1 -1
- package/dist/cli/curator-llm-factory-zeb0pe2j.js +0 -71
- package/dist/cli/guardrail-explain-5vhveypz.js +0 -72
- package/dist/cli/hive-promoter-2vj54xc4.js +0 -86
- package/dist/cli/index-fenasyvr.js +0 -967
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Token-bucket dispatch rate limiting for native task delegations
|
|
3
|
+
* (issue #2507 / ADR 0002 G3 — reimplemented, no upstream code ported).
|
|
4
|
+
*
|
|
5
|
+
* Pacing, never denial: an empty bucket awaits until a token refills, so
|
|
6
|
+
* dispatch rate is bounded WITHOUT blocking diagnosis or recovery (only the
|
|
7
|
+
* `task` tool acquires tokens; read/diagnose/repair/rescope/abort controls
|
|
8
|
+
* never wait).
|
|
9
|
+
*
|
|
10
|
+
* Restart-state integration: the per-PROJECT bucket level and refill
|
|
11
|
+
* timestamp persist as one row in the existing `coordination_state` table
|
|
12
|
+
* under namespace `dispatch.token-bucket` (entity `project`), written when
|
|
13
|
+
* tokens are consumed. A fresh process rehydrates from that row and refills
|
|
14
|
+
* by elapsed wall time — an exhausted bucket does not grant a fresh burst
|
|
15
|
+
* after restart. Write failures fail OPEN (debug log, never break
|
|
16
|
+
* dispatch): the in-memory bucket stays authoritative for the process
|
|
17
|
+
* lifetime, and a restart after persistent write failure sees no row and
|
|
18
|
+
* grants a fresh burst (documented limitation — the limiter's purpose is
|
|
19
|
+
* runaway containment within a process).
|
|
20
|
+
*/
|
|
21
|
+
export declare const TOKEN_BUCKET_NAMESPACE = "dispatch.token-bucket";
|
|
22
|
+
export declare const TOKEN_BUCKET_ENTITY_KEY = "project";
|
|
23
|
+
/**
|
|
24
|
+
* Acquire one dispatch token, awaiting until one is available (paced, never
|
|
25
|
+
* denied). `ratePerSecond === 0` disables the limiter entirely.
|
|
26
|
+
*
|
|
27
|
+
* Persistence is debounced to the acquires that matter for restart
|
|
28
|
+
* semantics: only a PACED acquire (one that had to wait for a refill)
|
|
29
|
+
* writes the coordination row. Immediate burst consumption is
|
|
30
|
+
* reconstructible within the documented one-burst over-permission bound,
|
|
31
|
+
* and skipping those writes keeps the common fast path free of SQLite I/O
|
|
32
|
+
* (composing gates run under tight timing windows).
|
|
33
|
+
*/
|
|
34
|
+
export declare function acquireDispatchToken(input: {
|
|
35
|
+
directory: string;
|
|
36
|
+
ratePerSecond: number;
|
|
37
|
+
burstCapacity: number;
|
|
38
|
+
}): Promise<void>;
|
|
39
|
+
/** Test seam: forget all in-memory buckets (does not touch persisted rows). */
|
|
40
|
+
export declare function _resetDispatchTokenBuckets(): void;
|
|
41
|
+
export declare const _internals: {
|
|
42
|
+
now: () => number;
|
|
43
|
+
sleep: (ms: number) => Promise<void>;
|
|
44
|
+
readState: (directory: string) => import("../db/coordination-store.js").CoordinationState | null;
|
|
45
|
+
onPersistError: (err: unknown) => void;
|
|
46
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { closeProjectDb } from '../../db/project-db';
|
|
2
|
+
import { atomicWriteSwarmFileSync } from '../../utils/atomic-write';
|
|
3
|
+
import { bunSpawn } from '../../utils/bun-compat';
|
|
4
|
+
import { canonicalRootKeyFresh } from '../../utils/canonical-root';
|
|
5
|
+
import { resolveGitExecutable } from '../../utils/git-executable.js';
|
|
6
|
+
import { removeWorktree } from '../../worktree/core';
|
|
7
|
+
export interface DeadLaneReclaimEntry {
|
|
8
|
+
lanePath: string;
|
|
9
|
+
branchName: string;
|
|
10
|
+
parentSessionId: string;
|
|
11
|
+
taskId: string;
|
|
12
|
+
/** The removal error that stranded the lane (e.g. `EBUSY: ...`). */
|
|
13
|
+
reason: string;
|
|
14
|
+
recordedAt: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ReclaimDeadLanesContext {
|
|
17
|
+
/**
|
|
18
|
+
* Session ids that still own live state (#2527 interplay: a lane whose
|
|
19
|
+
* parent session is active, or whose path is protected by recovery/
|
|
20
|
+
* ownership machinery, is NOT reclaimable — it is not dead).
|
|
21
|
+
*/
|
|
22
|
+
activeSessionIds?: Iterable<string>;
|
|
23
|
+
protectedWorktreePaths?: Iterable<string>;
|
|
24
|
+
}
|
|
25
|
+
export interface ReclaimDeadLanesResult {
|
|
26
|
+
reclaimed: string[];
|
|
27
|
+
retained: Array<{
|
|
28
|
+
lanePath: string;
|
|
29
|
+
reason: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/** Record a dead lane for next-start reclaim. Dedupes by lanePath. */
|
|
33
|
+
export declare function recordDeadLaneReclaim(directory: string, entry: Omit<DeadLaneReclaimEntry, 'recordedAt'>): void;
|
|
34
|
+
/** Read-only view for diagnostics and tests. */
|
|
35
|
+
export declare function listDeadLaneReclaims(directory: string): DeadLaneReclaimEntry[];
|
|
36
|
+
declare function isLaneOwnedByActiveSession(lanePath: string, activeSessionIds: Set<string>, parentSessionId?: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Dirty-lane gate (#2508 interplay): a lane with uncommitted changes is NEVER
|
|
39
|
+
* purged without the shared confirmation primitive — fail closed. Any git
|
|
40
|
+
* error also counts as dirty: an unknowable state is not a purgeable state.
|
|
41
|
+
*/
|
|
42
|
+
declare function isLaneDirty(lanePath: string): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Reclaim every recorded dead lane whose gates pass. Runs inside the bounded,
|
|
45
|
+
* fail-open next-start init task (`runInitOrphanRecovery`), so it never throws
|
|
46
|
+
* and never blocks init: per-lane failures retain the entry for the next start.
|
|
47
|
+
*/
|
|
48
|
+
export declare function reclaimDeadLanes(directory: string, context?: ReclaimDeadLanesContext): Promise<ReclaimDeadLanesResult>;
|
|
49
|
+
declare function pathExists(target: string): Promise<boolean>;
|
|
50
|
+
export declare const _internals: {
|
|
51
|
+
removeWorktree: typeof removeWorktree;
|
|
52
|
+
closeProjectDb: typeof closeProjectDb;
|
|
53
|
+
isLaneOwnedByActiveSession: typeof isLaneOwnedByActiveSession;
|
|
54
|
+
isLaneDirty: typeof isLaneDirty;
|
|
55
|
+
pathExists: typeof pathExists;
|
|
56
|
+
bunSpawn: typeof bunSpawn;
|
|
57
|
+
resolveGitExecutable: typeof resolveGitExecutable;
|
|
58
|
+
atomicWriteSwarmFileSync: typeof atomicWriteSwarmFileSync;
|
|
59
|
+
canonicalRootKeyFresh: typeof canonicalRootKeyFresh;
|
|
60
|
+
};
|
|
61
|
+
export {};
|
|
@@ -146,6 +146,16 @@ interface SessionSerializationState {
|
|
|
146
146
|
*/
|
|
147
147
|
successfulDispatchesSince: number;
|
|
148
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Issue #2599: bounded lane session.create with deterministic late-settle
|
|
151
|
+
* handling. The create promise's outcome is captured exactly once into a
|
|
152
|
+
* derived settle-state promise — never a mutable flag read across async
|
|
153
|
+
* continuations — so a create that settles after the deadline reaches
|
|
154
|
+
* `onLateResolve` (verified teardown of the late child) under EVERY
|
|
155
|
+
* microtask interleaving, and only after the settle (or this grace bound)
|
|
156
|
+
* does the caller's lane cleanup begin.
|
|
157
|
+
*/
|
|
158
|
+
declare function createSessionWithinBudget<T>(promise: Promise<T>, label: string, onLateResolve?: (result: T) => Promise<void> | void, timeoutMs?: number): Promise<T>;
|
|
149
159
|
interface CleanupStandardWorktreeResult {
|
|
150
160
|
removedWorktree: boolean;
|
|
151
161
|
cleanedBranch: boolean;
|
|
@@ -384,6 +394,18 @@ export declare const _internals: {
|
|
|
384
394
|
preserveDirtyWorktreeAtPath: typeof preserveDirtyWorktreeAtPath;
|
|
385
395
|
/** Bounded lane session.create timeout (tests may override). */
|
|
386
396
|
worktreeSessionCreateTimeoutMs: number;
|
|
397
|
+
/**
|
|
398
|
+
* Issue #2599 AC4: bound on how long the deadline path waits for the
|
|
399
|
+
* create promise to settle before proceeding to lane cleanup. Tests
|
|
400
|
+
* override this to keep never-settling-create cases fast.
|
|
401
|
+
*/
|
|
402
|
+
worktreeSessionCreateSettleGraceMs: number;
|
|
403
|
+
/**
|
|
404
|
+
* Issue #2599: the settle-state-machine budget wrapper, exposed so tests
|
|
405
|
+
* can drive both late-settle interleavings directly with controlled
|
|
406
|
+
* promises (no racy shared flag is involved).
|
|
407
|
+
*/
|
|
408
|
+
createSessionWithinBudget: typeof createSessionWithinBudget;
|
|
387
409
|
/** FR-001a: abort entry point for in-flight dispatches. */
|
|
388
410
|
abortStandardWorktreeDispatch: typeof abortStandardWorktreeDispatch;
|
|
389
411
|
standardWorktreeByCallID: Map<string, StandardWorktreeDispatch>;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* advanced, so the next cycle recomputes and retries — a lost directive can
|
|
16
16
|
* no longer be permanently suppressed by idempotency while state advances.
|
|
17
17
|
*/
|
|
18
|
+
import { getPlanLedgerStateReadOnly } from '../plan/ledger-sqlite';
|
|
18
19
|
import { error as _logErrorImpl } from '../utils/logger.js';
|
|
19
20
|
import { isPlanCriticApproved } from './delegation-gate';
|
|
20
21
|
import { implementationReviewReceiptExists, publicationReceiptExists, readIssueReference, readPlanPhaseStatus, readSpecIssueNumber, readTraceState, recurrenceSweepReceiptExists, reproductionReceiptExists, specExists, writeTraceState } from './issue-trace-state';
|
|
@@ -30,7 +31,9 @@ export declare const _internals: {
|
|
|
30
31
|
recurrenceSweepReceiptExists: typeof recurrenceSweepReceiptExists;
|
|
31
32
|
implementationReviewReceiptExists: typeof implementationReviewReceiptExists;
|
|
32
33
|
isPlanCriticApproved: typeof isPlanCriticApproved;
|
|
34
|
+
getPlanLedgerState: typeof getPlanLedgerStateReadOnly;
|
|
33
35
|
logError: typeof _logErrorImpl;
|
|
36
|
+
boundedApprovalCheck: (directory: string, timeoutMs: number) => Promise<boolean>;
|
|
34
37
|
};
|
|
35
38
|
export declare function createIssueTraceHook(_config: unknown, directory: string, approvalTimeoutMs?: number): {
|
|
36
39
|
messagesTransform: (input: unknown, output: unknown) => Promise<void>;
|
package/dist/hooks/utils.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export declare function composeBlockingHandlers<I, O>(...fns: Array<HookHandler<
|
|
|
76
76
|
* @throws Error if the filename is invalid or attempts path traversal
|
|
77
77
|
*/
|
|
78
78
|
export declare function validateSwarmPath(directory: string, filename: string): string;
|
|
79
|
-
export declare function readSwarmFileAsync(directory: string, filename: string, cache?: Map<string, Promise<string | null
|
|
79
|
+
export declare function readSwarmFileAsync(directory: string, filename: string, cache?: Map<string, Promise<string | null>>, reader?: (resolvedPath: string) => Promise<string | null>, useArtifactCache?: boolean): Promise<string | null>;
|
|
80
80
|
/**
|
|
81
81
|
* Estimate tokens from a character count using the canonical heuristic.
|
|
82
82
|
* This is the single sanctioned numeric form (issue #2107 §1).
|