opencode-swarm 7.126.1 → 7.126.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 (50) hide show
  1. package/.opencode/skills/engineering-conventions/SKILL.md +1 -1
  2. package/.opencode/skills/swarm-pr-feedback/SKILL.md +19 -5
  3. package/.opencode/skills/swarm-pr-review/SKILL.md +28 -7
  4. package/dist/background/pr-event-delivery.d.ts +1 -1
  5. package/dist/cli/{config-doctor-23jxdqwv.js → config-doctor-mfx27331.js} +2 -2
  6. package/dist/cli/{curation-policy-0t6hny6g.js → curation-policy-n944aq62.js} +2 -2
  7. package/dist/cli/{curator-g8rggzbk.js → curator-jm9ehfkg.js} +12 -12
  8. package/dist/cli/{curator-llm-factory-36psae60.js → curator-llm-factory-3cy0h9yw.js} +12 -12
  9. package/dist/cli/{guardrail-explain-6ffgrjx9.js → guardrail-explain-va0kj05m.js} +13 -13
  10. package/dist/cli/{guardrail-log-57sczn5h.js → guardrail-log-61gya05m.js} +3 -3
  11. package/dist/cli/{hive-promoter-c458rgp5.js → hive-promoter-h9c4kyv0.js} +12 -12
  12. package/dist/cli/{index-w0yztxgq.js → index-3xd9a2g7.js} +1 -1
  13. package/dist/cli/{index-y9t766sw.js → index-5n868tw8.js} +62 -46
  14. package/dist/cli/{index-x1w4cx3n.js → index-6t5sa6v0.js} +2 -2
  15. package/dist/cli/{index-k5xh81c9.js → index-7bxw3v5w.js} +3 -3
  16. package/dist/cli/{index-6j9p0c40.js → index-88dt7c9z.js} +2 -2
  17. package/dist/cli/{index-yf4kvhrn.js → index-b16153py.js} +14 -14
  18. package/dist/cli/{index-1p9z8cc4.js → index-bf76q8q7.js} +1 -1
  19. package/dist/cli/{index-vvwf9ark.js → index-c48dvb6j.js} +2 -2
  20. package/dist/cli/{index-nkhp7j16.js → index-f97dm6tz.js} +5 -5
  21. package/dist/cli/{index-abw10n3f.js → index-gf9cxvp0.js} +1 -1
  22. package/dist/cli/{index-kx3533dm.js → index-gwss5btk.js} +1 -1
  23. package/dist/cli/{index-echdpdhy.js → index-gxw20m1d.js} +1 -1
  24. package/dist/cli/{index-cnhp6c0k.js → index-nqp13m5a.js} +1 -1
  25. package/dist/cli/{index-nmyg9b7v.js → index-pb8ag9vg.js} +4 -4
  26. package/dist/cli/{index-3hkbegq2.js → index-pf3xae4s.js} +1 -1
  27. package/dist/cli/{index-c8sqc3nh.js → index-vcqwhe9d.js} +4 -0
  28. package/dist/cli/index.js +12 -12
  29. package/dist/cli/{knowledge-escalator-kd80m9vp.js → knowledge-escalator-nna0zec3.js} +3 -3
  30. package/dist/cli/{knowledge-events-j7jfwm1d.js → knowledge-events-7k82xk36.js} +1 -1
  31. package/dist/cli/{knowledge-store-1d4byc7y.js → knowledge-store-efvtng9t.js} +1 -1
  32. package/dist/cli/{knowledge-validator-63mkgt9x.js → knowledge-validator-jh93eagj.js} +4 -4
  33. package/dist/cli/{scan-cursor-qzn5jmbe.js → scan-cursor-cydz8d9q.js} +2 -2
  34. package/dist/cli/{schema-2j92wnns.js → schema-fa033pqw.js} +1 -1
  35. package/dist/cli/{skill-generator-sv6zvdvz.js → skill-generator-8v463kj7.js} +5 -5
  36. package/dist/config/bundled-skills.d.ts +3 -2
  37. package/dist/hooks/delegation-gate.d.ts +14 -2
  38. package/dist/hooks/init-orphan-recovery.d.ts +1 -1
  39. package/dist/hooks/pr-workflow-auto-wake.d.ts +31 -0
  40. package/dist/hooks/pr-workflow-gate.d.ts +19 -1
  41. package/dist/hooks/pr-workflow-response-gate.d.ts +4 -0
  42. package/dist/index.d.ts +14 -0
  43. package/dist/index.js +149 -146
  44. package/dist/tools/index.d.ts +1 -0
  45. package/dist/tools/manifest.d.ts +1 -0
  46. package/dist/tools/prepare-pr-workflow-checkout.d.ts +25 -0
  47. package/dist/tools/repo-graph/builder.d.ts +5 -4
  48. package/dist/tools/tool-metadata.d.ts +4 -0
  49. package/dist/utils/timeout.d.ts +8 -4
  50. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -7,34 +7,34 @@ import {
7
7
  getPluginLockFilePaths,
8
8
  package_default,
9
9
  resolveCommand
10
- } from "./index-y9t766sw.js";
11
- import"./index-echdpdhy.js";
12
- import"./index-w0yztxgq.js";
10
+ } from "./index-5n868tw8.js";
11
+ import"./index-gxw20m1d.js";
12
+ import"./index-3xd9a2g7.js";
13
13
  import"./index-kk1scggc.js";
14
14
  import"./index-4905hd2m.js";
15
15
  import"./index-134d35c1.js";
16
16
  import"./index-6n2jpz7x.js";
17
- import"./index-k5xh81c9.js";
18
- import"./index-nkhp7j16.js";
19
- import"./index-3hkbegq2.js";
17
+ import"./index-7bxw3v5w.js";
18
+ import"./index-f97dm6tz.js";
19
+ import"./index-pf3xae4s.js";
20
20
  import"./index-vxv732ex.js";
21
21
  import"./index-c8s9a3zh.js";
22
22
  import"./index-9ss2m4rs.js";
23
23
  import"./index-23zsx7dm.js";
24
- import"./index-6j9p0c40.js";
25
- import"./index-kx3533dm.js";
24
+ import"./index-88dt7c9z.js";
25
+ import"./index-gwss5btk.js";
26
26
  import"./index-rtry5xyf.js";
27
- import"./index-nmyg9b7v.js";
28
- import"./index-cnhp6c0k.js";
27
+ import"./index-pb8ag9vg.js";
28
+ import"./index-nqp13m5a.js";
29
29
  import"./index-ae75rja9.js";
30
30
  import"./index-q27bajqb.js";
31
- import"./index-abw10n3f.js";
31
+ import"./index-gf9cxvp0.js";
32
32
  import"./index-k5jrywpr.js";
33
33
  import"./index-n832052r.js";
34
34
  import {
35
35
  DEFAULT_AGENT_CONFIGS,
36
36
  init_constants
37
- } from "./index-c8sqc3nh.js";
37
+ } from "./index-vcqwhe9d.js";
38
38
  import"./index-bk5tah7q.js";
39
39
  import"./index-8fwhhayc.js";
40
40
  import"./index-q1exe2b3.js";
@@ -8,9 +8,9 @@ import {
8
8
  maybeEscalateOnViolation,
9
9
  maybeQuarantineOnContradiction,
10
10
  readRecentEscalations
11
- } from "./index-nkhp7j16.js";
12
- import"./index-nmyg9b7v.js";
13
- import"./index-cnhp6c0k.js";
11
+ } from "./index-f97dm6tz.js";
12
+ import"./index-pb8ag9vg.js";
13
+ import"./index-nqp13m5a.js";
14
14
  import"./index-ae75rja9.js";
15
15
  import"./index-q27bajqb.js";
16
16
  import"./index-bk5tah7q.js";
@@ -26,7 +26,7 @@ import {
26
26
  resolveKnowledgeCounterBaselinePath,
27
27
  resolveKnowledgeEventsPath,
28
28
  resolveLegacyApplicationLogPath
29
- } from "./index-cnhp6c0k.js";
29
+ } from "./index-nqp13m5a.js";
30
30
  import"./index-ae75rja9.js";
31
31
  import"./index-q27bajqb.js";
32
32
  import"./index-zgwm4ryv.js";
@@ -40,7 +40,7 @@ import {
40
40
  transactKnowledge,
41
41
  transactKnowledgeWithCas,
42
42
  wordBigrams
43
- } from "./index-nmyg9b7v.js";
43
+ } from "./index-pb8ag9vg.js";
44
44
  import {
45
45
  resolveHiveDataDir
46
46
  } from "./index-ae75rja9.js";
@@ -23,11 +23,11 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-6j9p0c40.js";
27
- import"./index-kx3533dm.js";
26
+ } from "./index-88dt7c9z.js";
27
+ import"./index-gwss5btk.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-nmyg9b7v.js";
30
- import"./index-cnhp6c0k.js";
29
+ import"./index-pb8ag9vg.js";
30
+ import"./index-nqp13m5a.js";
31
31
  import"./index-ae75rja9.js";
32
32
  import"./index-q27bajqb.js";
33
33
  import"./index-bk5tah7q.js";
@@ -4,8 +4,8 @@ import {
4
4
  alreadyCuratedThisGeneration,
5
5
  claimNextScanBatch,
6
6
  getScanStatus
7
- } from "./index-3hkbegq2.js";
8
- import"./index-nmyg9b7v.js";
7
+ } from "./index-pf3xae4s.js";
8
+ import"./index-pb8ag9vg.js";
9
9
  import"./index-ae75rja9.js";
10
10
  import"./index-q27bajqb.js";
11
11
  import"./index-bk5tah7q.js";
@@ -89,7 +89,7 @@ import {
89
89
  resolveGeneratedAgentRole,
90
90
  resolveGuardrailsConfig,
91
91
  stripKnownSwarmPrefix
92
- } from "./index-c8sqc3nh.js";
92
+ } from "./index-vcqwhe9d.js";
93
93
  import"./index-bk5tah7q.js";
94
94
  import"./index-zjygnfay.js";
95
95
  import"./index-bpmtbmy9.js";
@@ -33,12 +33,12 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-k5xh81c9.js";
37
- import"./index-6j9p0c40.js";
38
- import"./index-kx3533dm.js";
36
+ } from "./index-7bxw3v5w.js";
37
+ import"./index-88dt7c9z.js";
38
+ import"./index-gwss5btk.js";
39
39
  import"./index-rtry5xyf.js";
40
- import"./index-nmyg9b7v.js";
41
- import"./index-cnhp6c0k.js";
40
+ import"./index-pb8ag9vg.js";
41
+ import"./index-nqp13m5a.js";
42
42
  import"./index-ae75rja9.js";
43
43
  import"./index-q27bajqb.js";
44
44
  import"./index-bk5tah7q.js";
@@ -21,8 +21,9 @@ declare function copyBundledDirectoryBoundedAsync(sourceDir: string, destDir: st
21
21
  * tree so architect MODE dispatch never collides with repository-owned skills
22
22
  * that happen to use the same slug.
23
23
  *
24
- * Async, bounded, and fail-open: safe to `await withTimeout(...)` on the
25
- * plugin-init path (AGENTS.md Invariant 1). Runs at plugin init so the
24
+ * Async, bounded, and fail-open: register `withTimeout(...)` in the
25
+ * wrapper-owned post-resolution task queue on the plugin-init path
26
+ * (AGENTS.md Invariant 1). Runs at plugin init so the
26
27
  * architect's very first auto-entered mode (e.g. SPECIFY on a fresh project) can
27
28
  * load its SKILL.md without a manual `/swarm` command or session restart; the
28
29
  * command path calls it again as a backstop for pre-existing projects.
@@ -269,6 +269,17 @@ interface MessageWithParts {
269
269
  */
270
270
  export declare function isPlanCriticApproved(directory: string): Promise<boolean>;
271
271
  declare function resolveDelegatedPlanTaskId(args: Record<string, unknown>, knownPlanTaskIds?: ReadonlySet<string>): string | null;
272
+ /**
273
+ * Builds a cause-specific diagnostic for `prepareCoderScope`'s SCOPE_NOT_DECLARED
274
+ * throw when `resolveDelegatedPlanTaskId` returns null. Re-runs extraction with
275
+ * diagnostics enabled so the architect can self-correct in one turn instead of
276
+ * guessing. Issue #1914 Defect 2.
277
+ *
278
+ * Only invoked on the null-resolution failure path — does not affect happy-path
279
+ * latency, and does NOT handle plan-task-shaped-but-unknown ids (those are
280
+ * rejected by the membership gate in prepareCoderScope with their own message).
281
+ */
282
+ declare function describeCoderScopeFailure(args: Record<string, unknown>, planTaskIds: ReadonlySet<string>): string;
272
283
  /**
273
284
  * Parses structured per-task verdict lines from agent dispatch output.
274
285
  *
@@ -299,8 +310,8 @@ declare function buildParallelExecutionGuidance(directory: string | undefined, s
299
310
  declare function resolveEvidenceTaskId(args: Record<string, unknown> | undefined, session: AgentSessionState, directory: string): Promise<string | null>;
300
311
  /**
301
312
  * _internals export for testing — do not use in production code.
302
- * Exposes resolveEvidenceTaskId, resolveDelegatedPlanTaskId, and
303
- * buildParallelExecutionGuidance for unit testing.
313
+ * Exposes resolveEvidenceTaskId, resolveDelegatedPlanTaskId,
314
+ * describeCoderScopeFailure, and buildParallelExecutionGuidance for unit testing.
304
315
  *
305
316
  * Worktree operation entries (provisionWorktree, removeWorktree, etc.) proxy
306
317
  * to delegation-gate/worktree-isolation._internals via getters/setters so
@@ -309,6 +320,7 @@ declare function resolveEvidenceTaskId(args: Record<string, unknown> | undefined
309
320
  export declare const _internals: {
310
321
  resolveEvidenceTaskId: typeof resolveEvidenceTaskId;
311
322
  resolveDelegatedPlanTaskId: typeof resolveDelegatedPlanTaskId;
323
+ describeCoderScopeFailure: typeof describeCoderScopeFailure;
312
324
  parsePerTaskVerdicts: typeof parsePerTaskVerdicts;
313
325
  buildParallelExecutionGuidance: typeof buildParallelExecutionGuidance;
314
326
  loadPlanJsonOnly: typeof loadPlanJsonOnly;
@@ -6,7 +6,7 @@
6
6
  * - Calls cleanupOrphanedBranches(ctx.directory, []) at plugin init (no sessions active → all swarm-lane branches are orphans)
7
7
  * - Writes results to `<directory>/.swarm/advisories/init-orphan-recovery.json`
8
8
  * - Is wrapped in `withTimeout` so it never blocks plugin init
9
- * - Runs via `queueMicrotask` off the `server()` resolution path (precedent: repoGraphHook.init)
9
+ * - Runs from the wrapper-owned post-resolution queue after `server()` can settle (precedent: repoGraphHook.init)
10
10
  *
11
11
  * This module intentionally lives in `src/hooks/` so that `src/index.ts` can import
12
12
  * it without matching the forbidden `worktree/` or `merge-back/` patterns.
@@ -0,0 +1,31 @@
1
+ import { readPrWorkflowGateState } from './pr-workflow-gate.js';
2
+ export declare const _internals: {
3
+ readPrWorkflowGateState: typeof readPrWorkflowGateState;
4
+ };
5
+ /** Bound module state: every entry is keyed by project plus parent session. */
6
+ export declare const MAX_TRACKED_PR_WORKFLOW_WAKE_STATES = 200;
7
+ export declare const PLUGIN_WAKE_MARKER_TTL_MS = 60000;
8
+ type PausePhase = 'awaiting-idle' | 'paused' | 'resuming';
9
+ export interface PrWorkflowAutoWakeDecision {
10
+ sessionID?: string;
11
+ suppressWake: boolean;
12
+ }
13
+ /** Mark a plugin-authored prompt until its synthetic user event is observed. */
14
+ export declare function markPrWorkflowPluginWake(directory: string, sessionID: string): string;
15
+ /** Remove a marker only when the host definitively rejected the prompt. */
16
+ export declare function cancelPrWorkflowPluginWake(directory: string, sessionID: string, messageID: string): void;
17
+ export declare function isPrWorkflowAutoWakeSuppressed(directory: string, sessionID: string): boolean;
18
+ export declare function clearPrWorkflowAutoWakeState(directory: string, sessionID: string): void;
19
+ /**
20
+ * Observe host events that distinguish a user interruption from an ordinary
21
+ * idle boundary. The durable workflow gate remains intact; only automatic
22
+ * prompts pause. A later real user turn re-enables wakes after that turn's
23
+ * idle boundary.
24
+ */
25
+ export declare function observePrWorkflowAutoWakeEvent(directory: string, rawEvent: unknown): Promise<PrWorkflowAutoWakeDecision>;
26
+ export declare const _test_exports: {
27
+ reset(): void;
28
+ getPausePhase(directory: string, sessionID: string): PausePhase | undefined;
29
+ getPluginWakeMarkerCount(directory: string, sessionID: string, now?: number): number;
30
+ };
31
+ export {};
@@ -1,3 +1,4 @@
1
+ import * as fsp from 'node:fs/promises';
1
2
  import { resolveCommitCountSince, resolveCurrentGitHead, resolveCurrentUpstreamPushTarget, resolveCurrentUpstreamRemoteRef, resolveExactRemoteBranchHead, resolveIsExactSingleChildCommit, resolveIsWorkingTreeClean, resolvePrWorkflowRevisionDigest, resolveRemoteRefsContainingHead } from '../background/workspace-snapshot.js';
2
3
  export declare const PR_REVIEW_BASE_DIMENSION_IDS: readonly ["intent-architecture", "correctness-state", "tests-falsifiability", "security-trust", "reliability-performance", "compatibility-delivery"];
3
4
  export declare const PR_REVIEW_REQUIRED_MICRO_LANE_IDS: readonly ["auth-identity-secrets", "untrusted-input-boundaries", "subprocess-platform", "concurrency-state", "dependencies-build-release", "api-schema-migrations", "test-infrastructure", "ui-accessibility-i18n", "privacy-observability", "generated-provenance", "unclassified-risk"];
@@ -137,6 +138,15 @@ export declare function activatePrWorkflow(directory: string, sessionID: string,
137
138
  prHeadSha?: string;
138
139
  }): Promise<PrWorkflowGateState>;
139
140
  export declare function readPrWorkflowGateState(directory: string, sessionID: string): Promise<PrWorkflowGateState | null>;
141
+ /**
142
+ * Serialize a pre-bind checkout-preservation controller with every terminal
143
+ * PR-workflow transition for the raw parent session. The caller's action may
144
+ * perform the fixed Git preservation command while holding this lock; abort,
145
+ * bind, and a same-session reactivation cannot clear or replace the gate until
146
+ * it settles. The state passed to the action is schema-validated durable state,
147
+ * never a caller-supplied projection.
148
+ */
149
+ export declare function withPrWorkflowCheckoutPreparationLock<T>(directory: string, sessionID: string, action: (state: PrWorkflowGateState) => Promise<T>): Promise<T>;
140
150
  export declare function clearPrWorkflowGateState(directory: string, sessionID: string, expectedRevision?: number): Promise<void>;
141
151
  /**
142
152
  * Abort an active PR workflow gate without reaching terminal completion.
@@ -181,7 +191,7 @@ export declare function bindPrReviewBase(directory: string, sessionID: string, o
181
191
  /** Prove that caller-provided PR identity equals the actual checked-out commit. */
182
192
  export declare function assertCurrentCheckoutHead(directory: string, expectedHead: string): string;
183
193
  /** Prove that every PR-review lane reads the immutable checked-out PR tree. */
184
- export declare function assertPrReviewCleanCheckout(directory: string): void;
194
+ export declare function assertPrReviewCleanCheckout(directory: string, mode?: PrWorkflowMode): void;
185
195
  export declare function enforcePrWorkflowDispatchLanesAsync(directory: string, sessionID: string, toolName: string): Promise<PrWorkflowGateState | null>;
186
196
  export declare function enforcePrReviewBaseDimensions(directory: string, sessionID: string, lanes: readonly PrWorkflowLaneSpec[], options: {
187
197
  batchId: string;
@@ -268,6 +278,7 @@ export declare const _test_exports: {
268
278
  resolveRemoteRefsContainingHead: typeof resolveRemoteRefsContainingHead;
269
279
  parseCriticVerdict: typeof parseCriticVerdict;
270
280
  isProcessAlive: typeof isProcessAlive;
281
+ rename: typeof fsp.rename;
271
282
  nowMs: () => number;
272
283
  };
273
284
  /** Require at least one real discovery row or a lane-bound CLEAN attestation. */
@@ -279,4 +290,11 @@ declare function parseCriticVerdict(text: string, itemId: string, reviewerSeveri
279
290
  declare function isProcessAlive(pid: number): boolean;
280
291
  declare function workflowGateStateLockRelativePath(sessionID: string): string;
281
292
  declare function workflowGateStateRelativePath(sessionID: string): string;
293
+ export declare function prWorkflowSessionFileStem(sessionID: string): string;
294
+ /**
295
+ * Write a PR-workflow artifact with the gate's Windows-safe atomic persistence
296
+ * contract. Checkout-preparation receipts must survive the same transient
297
+ * rename contention as canonical gate state.
298
+ */
299
+ export declare function writePrWorkflowAtomicJson(filePath: string, value: unknown): Promise<void>;
282
300
  export {};
@@ -1,3 +1,7 @@
1
+ import { readPrWorkflowGateState } from './pr-workflow-gate.js';
2
+ export declare const _internals: {
3
+ readPrWorkflowGateState: typeof readPrWorkflowGateState;
4
+ };
1
5
  /**
2
6
  * Maximum number of consecutive unproductive auto-resumes per gated session
3
7
  * before the response gate suspends further wakes. "Unproductive" means the
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Plugin } from '@opencode-ai/plugin';
2
+ import { createRepoGraphBuilderHook } from './hooks';
2
3
  /**
3
4
  * FIFO-cap a session-keyed Map to at most `max` entries, evicting oldest first.
4
5
  * Values tracked by these maps are plain data (timestamps/usage snapshots), never
@@ -6,6 +7,19 @@ import type { Plugin } from '@opencode-ai/plugin';
6
7
  * unit testing of the cap invariant; used by the heartbeat throttle path below.
7
8
  */
8
9
  export declare function capSessionMap<K, V>(map: Map<K, V>, max: number): void;
10
+ type PostResolutionTask = () => void | Promise<void>;
11
+ /**
12
+ * Start detached initialization work only after the plugin manifest promise can
13
+ * settle. A microtask queued from inside `initializeOpenCodeSwarm` is not truly
14
+ * deferred when that function still has later awaits: the microtask can start
15
+ * expensive filesystem work while `server()` remains unresolved (issue #704).
16
+ */
17
+ declare function schedulePostResolutionTasks(tasks: readonly PostResolutionTask[]): void;
18
+ export declare function overrideIndexInternalsForTest(overrides: {
19
+ createRepoGraphBuilderHook?: typeof createRepoGraphBuilderHook;
20
+ schedulePostResolutionTasks?: typeof schedulePostResolutionTasks;
21
+ }): () => void;
22
+ export declare function schedulePostResolutionTasksForTest(tasks: readonly PostResolutionTask[]): void;
9
23
  declare const _default: {
10
24
  id: "opencode-swarm";
11
25
  server: Plugin;