opencode-swarm 7.181.0 → 7.181.2

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 (80) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/background/stage-b-gates.d.ts +4 -0
  4. package/dist/cli/{coder-settlement-pqrfkm9d.js → coder-settlement-993vdsd2.js} +4 -4
  5. package/dist/cli/{config-doctor-bjqg57jr.js → config-doctor-nr27vfv6.js} +3 -3
  6. package/dist/cli/{core-3t3dzkrc.js → core-t3tg4397.js} +2 -2
  7. package/dist/cli/{curator-drift-gay4fx5j.js → curator-drift-hz3j3fad.js} +7 -7
  8. package/dist/cli/{curator-y8qr4xgh.js → curator-gk392717.js} +27 -27
  9. package/dist/cli/{curator-llm-factory-1wx0bd8k.js → curator-llm-factory-n01we8pa.js} +27 -27
  10. package/dist/cli/{evidence-summary-service-jeewwfpg.js → evidence-summary-service-fkvj8ct1.js} +11 -11
  11. package/dist/cli/{gate-evidence-ncnfxz7t.js → gate-evidence-1n6zffzb.js} +3 -3
  12. package/dist/cli/{guardrail-explain-cg9e3rr8.js → guardrail-explain-81jvm99e.js} +28 -28
  13. package/dist/cli/{guardrail-log-tjcnpwhv.js → guardrail-log-mw9x5j8g.js} +4 -4
  14. package/dist/cli/{guardrail-reset-ey81kcdq.js → guardrail-reset-6thsn6ad.js} +27 -27
  15. package/dist/cli/{hive-promoter-ghcynvfv.js → hive-promoter-pym6se37.js} +27 -27
  16. package/dist/cli/{index-wxjvb4vq.js → index-0h39trak.js} +1 -1
  17. package/dist/cli/{index-t8hv63wy.js → index-1wpnt86a.js} +3 -3
  18. package/dist/cli/{index-ytxgr424.js → index-2sqfrvxj.js} +2 -2
  19. package/dist/cli/{index-w872yykk.js → index-2t21pv2v.js} +5 -1
  20. package/dist/cli/{index-rqm075jf.js → index-5hxv1er2.js} +2 -2
  21. package/dist/cli/{index-t5gqdkqx.js → index-5q3xsqwm.js} +2 -2
  22. package/dist/cli/{index-gm67qky7.js → index-5v8zws0s.js} +3 -3
  23. package/dist/cli/{index-n7syegpa.js → index-5zy5k5w0.js} +16 -7
  24. package/dist/cli/{index-mkpczxy7.js → index-6x36hhd3.js} +27 -27
  25. package/dist/cli/{index-jysjhvpv.js → index-7nr9p5bd.js} +5 -5
  26. package/dist/cli/{index-886rpw6w.js → index-cr61qv27.js} +1 -1
  27. package/dist/cli/{index-6aj0ej18.js → index-dpxg347z.js} +3 -3
  28. package/dist/cli/{index-xq9gsfsc.js → index-ehvkz2zv.js} +3 -3
  29. package/dist/cli/{index-m31a2q35.js → index-ernt0wrg.js} +1234 -999
  30. package/dist/cli/{index-gez80bfr.js → index-et28q7cp.js} +2 -2
  31. package/dist/cli/{index-nhxykfyy.js → index-et7tg13p.js} +1 -1
  32. package/dist/cli/{index-pb3vrqsf.js → index-fmhd3zc8.js} +2 -2
  33. package/dist/cli/{index-1rcwsfwz.js → index-gmqf6bjj.js} +29 -29
  34. package/dist/cli/{index-pc3cw1xm.js → index-hbe56wtn.js} +3 -3
  35. package/dist/cli/{index-06f6h0fv.js → index-kzmd4gs7.js} +1 -1
  36. package/dist/cli/{index-m7havzy4.js → index-m779twtf.js} +1 -1
  37. package/dist/cli/{index-0vvpe98m.js → index-n5a9dq5s.js} +1 -1
  38. package/dist/cli/{index-ge1w25n8.js → index-pqtmzee6.js} +4 -4
  39. package/dist/cli/{index-r1cnmq4j.js → index-qw9aqays.js} +4 -4
  40. package/dist/cli/{index-y30y1rkg.js → index-t93cp2tz.js} +2 -2
  41. package/dist/cli/{index-dn0wqvv2.js → index-txx2mrsk.js} +7 -7
  42. package/dist/cli/{index-91dhg3wr.js → index-ved1325w.js} +2 -2
  43. package/dist/cli/{index-yet4r7kp.js → index-vmwmwahh.js} +3 -3
  44. package/dist/cli/{index-bv4b8tpa.js → index-vvgpgcyn.js} +10 -0
  45. package/dist/cli/{index-vmthakz0.js → index-w1ydvzef.js} +1 -1
  46. package/dist/cli/{index-s5ghg4kg.js → index-wph45kyb.js} +1 -1
  47. package/dist/cli/{index-jzg3wrx6.js → index-xz4q5vcg.js} +4 -4
  48. package/dist/cli/index.js +28 -28
  49. package/dist/cli/{knowledge-escalator-jrkx2b6j.js → knowledge-escalator-jmqbmfbf.js} +7 -7
  50. package/dist/cli/{knowledge-events-bha1zpbk.js → knowledge-events-5ksqpf4g.js} +5 -5
  51. package/dist/cli/{knowledge-store-q438tkyd.js → knowledge-store-q3yy56sc.js} +1 -1
  52. package/dist/cli/{knowledge-validator-3nx18fst.js → knowledge-validator-r5kaz53f.js} +2 -2
  53. package/dist/cli/{mcp-98693syb.js → mcp-h82hxnxr.js} +1 -1
  54. package/dist/cli/{model-preflight-61xgqwcs.js → model-preflight-5b81adsj.js} +1 -1
  55. package/dist/cli/{pending-delegations-nkpvtkz4.js → pending-delegations-e4h6vjeb.js} +5 -5
  56. package/dist/cli/{pr-subscriptions-qrvhr6jw.js → pr-subscriptions-j7hw3k6x.js} +5 -5
  57. package/dist/cli/{pr-workflow-gate-k44gdrqd.js → pr-workflow-gate-js8dcry2.js} +27 -27
  58. package/dist/cli/{scan-cursor-qjdn8kv6.js → scan-cursor-yhf58mq2.js} +2 -2
  59. package/dist/cli/{schema-pyax2tq7.js → schema-0k4st1qt.js} +2 -2
  60. package/dist/cli/{scope-persistence-dyc17kze.js → scope-persistence-bpptmh1e.js} +9 -9
  61. package/dist/cli/{server-bmzj5vt2.js → server-axnran6h.js} +27 -27
  62. package/dist/cli/{skill-generator-mp29bht6.js → skill-generator-n2w032d1.js} +8 -8
  63. package/dist/cli/{snapshot-coordination-init-azkzphpy.js → snapshot-coordination-init-kyf50x12.js} +27 -27
  64. package/dist/cli/{speckit-checkoff-1cqfakw2.js → speckit-checkoff-m4184e1x.js} +4 -4
  65. package/dist/cli/{worktree-collision-ownership-58sab2m6.js → worktree-collision-ownership-1g2414pf.js} +5 -5
  66. package/dist/cli/{worktree-isolation-9egt1ccv.js → worktree-isolation-x07f7cfp.js} +27 -27
  67. package/dist/db/qa-gate-profile.d.ts +6 -3
  68. package/dist/db/qa-gate-session-override.d.ts +72 -0
  69. package/dist/gate-evidence.d.ts +21 -0
  70. package/dist/index.js +308 -301
  71. package/dist/session/restart-reconciliation.d.ts +74 -0
  72. package/dist/state.d.ts +6 -3
  73. package/dist/tools/get-qa-gate-profile.d.ts +13 -6
  74. package/dist/tools/index.d.ts +1 -0
  75. package/dist/tools/manifest.d.ts +1 -0
  76. package/dist/tools/recover-rework-task.d.ts +5 -0
  77. package/dist/tools/tool-metadata.d.ts +4 -0
  78. package/dist/workflow/rework-recovery.d.ts +38 -0
  79. package/dist/workflow/stage-a-repair.d.ts +42 -0
  80. package/package.json +1 -1
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Owner-named restart reconciliation (issue #2668).
3
+ *
4
+ * At the rehydrate boundary, ephemeral execution authority expires by design
5
+ * (`delegationActive` and friends are reset in
6
+ * `TRANSIENT_SESSION_FIELDS`) — but the expiry must not be silent. When a
7
+ * serialized session arrives with in-flight authority, the boundary records a
8
+ * bounded, owner-named reconciliation outcome so an operator (and the
9
+ * resumed session) can tell "interrupted mid-execution, outcome UNKNOWN"
10
+ * from "was idle": absence must never read as success.
11
+ *
12
+ * Two surfaces, written together inside the rehydrate populate loop (after
13
+ * the transient reset, before the caller proceeds to the projection write):
14
+ *
15
+ * 1. The durable artifact `.swarm/session/restart-reconciliation.json` — a
16
+ * bounded list (cap {@link MAX_RESTART_RECONCILIATION_ENTRIES}, FIFO
17
+ * overflow) deduped by `(sessionId, taskId)` so a repeated restart
18
+ * refreshes the entry instead of duplicating it.
19
+ * 2. A one-shot advisory string pushed into the rehydrated session's
20
+ * `pendingAdvisoryMessages` (per-restart; the next rehydrate re-derives
21
+ * it).
22
+ *
23
+ * The record deliberately COMPOSES the shipped recovery surfaces instead of
24
+ * duplicating them: guidance points operators at `/swarm recover` (stale
25
+ * coder-settlement WALs) and `/swarm status` (uncertain provider effects),
26
+ * and the #2665 `stale`/`ambiguous`/`live_wedge` classification for
27
+ * coder settlements remains owned by those stores.
28
+ */
29
+ /** Relative to the project root's `.swarm/` directory. */
30
+ export declare const RESTART_RECONCILIATION_FILE = "session/restart-reconciliation.json";
31
+ export declare const MAX_RESTART_RECONCILIATION_ENTRIES = 50;
32
+ export type RestartReconciliationClassification = 'interrupted';
33
+ export interface RestartReconciliationEntry {
34
+ sessionId: string;
35
+ agentName: string;
36
+ /** The task the interrupted execution was driving ('(unknown)' when the snapshot carried none). */
37
+ taskId: string;
38
+ classification: RestartReconciliationClassification;
39
+ observedAt: string;
40
+ guidance: string;
41
+ }
42
+ export interface RestartReconciliationFile {
43
+ version: 1;
44
+ entries: RestartReconciliationEntry[];
45
+ }
46
+ export declare const RESTART_RECONCILIATION_GUIDANCE = "outcome UNKNOWN \u2014 do not assume success; inspect /swarm status for uncertain provider effects; /swarm recover settles stale coder-settlement WALs; a human must resolve external effects (pushed commits, published PRs) manually";
47
+ /**
48
+ * Read the reconciliation artifact fail-closed: absent, corrupt, partial, or
49
+ * oversized files read as an empty list — the boundary then re-records what
50
+ * it observes and the artifact heals on the next append.
51
+ */
52
+ export declare function readRestartReconciliation(directory: string): RestartReconciliationFile;
53
+ /**
54
+ * Append (or refresh, keyed by `(sessionId, taskId)`) a reconciliation entry
55
+ * and persist the bounded list atomically. Fail-open: a write error is
56
+ * logged and swallowed — the reconciliation record must never fail the
57
+ * rehydrate that produces it.
58
+ */
59
+ export declare function recordInterruptedExecution(directory: string, entry: {
60
+ sessionId: string;
61
+ agentName: string;
62
+ taskId: string;
63
+ observedAt?: string;
64
+ guidance?: string;
65
+ }): Promise<RestartReconciliationEntry>;
66
+ /**
67
+ * The one-shot session advisory naming the owner of the interrupted effect.
68
+ * Pushed into `pendingAdvisoryMessages` AFTER the transient-field reset so
69
+ * it survives the rehydrate that produced it.
70
+ */
71
+ export declare function buildInterruptedAdvisoryDedupeKey(entry: Pick<RestartReconciliationEntry, 'sessionId' | 'taskId'>): string;
72
+ export declare function buildInterruptedAdvisoryMessage(entry: Pick<RestartReconciliationEntry, 'sessionId' | 'agentName' | 'taskId'> & {
73
+ guidance?: string;
74
+ }): string;
package/dist/state.d.ts CHANGED
@@ -417,9 +417,12 @@ export interface AgentSessionState {
417
417
  autoProceedNudgeDone?: boolean;
418
418
  /** Session-level QA gate overrides layered on top of the spec-level profile.
419
419
  * Overrides can only enable gates (true); false values are ignored by
420
- * getEffectiveGates. Cleared on session reset. Optional for backwards
421
- * compatibility with pre-existing session state fixtures; consumers
422
- * should read via `session.qaGateSessionOverrides ?? {}`. */
420
+ * getEffectiveGates. Durable runtime policy (#2668): the authoritative copy
421
+ * lives in the project DB (qa_gate_session_override), written durable-first
422
+ * by `/swarm qa-gates override`, restored by rehydrateState, and deleted in
423
+ * lockstep with the session (end/stale-eviction/reset). Optional for
424
+ * backwards compatibility with pre-existing session state fixtures;
425
+ * consumers should read via `session.qaGateSessionOverrides ?? {}`. */
423
426
  qaGateSessionOverrides?: Partial<QaGates>;
424
427
  /** Session-scoped Full Auto flag for autonomous multi-agent oversight */
425
428
  fullAutoMode: boolean;
@@ -3,12 +3,15 @@
3
3
  *
4
4
  * Read-only: uses plan.json identity when available or an explicit exact
5
5
  * swarm/title pair before plan creation, then looks up the profile in the
6
- * per-project DB. Returns the spec-level profile gates, lock state, and profile
7
- * hash. Callers layering session overrides should combine with
8
- * `getEffectiveGates` themselves this tool intentionally returns the
9
- * persisted/locked spec-level view.
6
+ * per-project DB. Returns the spec-level profile gates, lock state, and
7
+ * profile hash, plus when the caller carries a session context (#2668)
8
+ * the session's ratchet-tighter overrides and the EFFECTIVE gates (profile
9
+ * merged with those overrides) so an agent can inspect the effective
10
+ * runtime policy after a restart. The live session's override cache is
11
+ * authoritative when present; the durable `qa_gate_session_override` row is
12
+ * the restart authority consulted when the live session is absent.
10
13
  */
11
- import type { tool } from '@opencode-ai/plugin';
14
+ import type { ToolContext, tool } from '@opencode-ai/plugin';
12
15
  import { type QaGatePlanIdentityArgs } from './qa-gate-plan-identity.js';
13
16
  export type GetQaGateProfileArgs = QaGatePlanIdentityArgs;
14
17
  interface GetQaGateProfileResult {
@@ -25,7 +28,11 @@ interface GetQaGateProfileResult {
25
28
  created_at: string;
26
29
  profile_hash: string;
27
30
  };
31
+ /** Calling session's ratchet-tighter overrides (empty when no session context or none set). */
32
+ session_overrides?: Record<string, boolean>;
33
+ /** Effective gates: profile merged with the calling session's overrides (#2668). */
34
+ effective_gates?: Record<string, boolean>;
28
35
  }
29
- export declare function executeGetQaGateProfile(args: GetQaGateProfileArgs, directory: string): Promise<GetQaGateProfileResult>;
36
+ export declare function executeGetQaGateProfile(args: GetQaGateProfileArgs, directory: string, ctx?: ToolContext): Promise<GetQaGateProfileResult>;
30
37
  export declare const get_qa_gate_profile: ReturnType<typeof tool>;
31
38
  export {};
@@ -123,6 +123,7 @@ export { executeRecordImplementationReview, record_implementation_review, } from
123
123
  export { executeRecordIssuePublication, record_issue_publication, } from './record-issue-publication';
124
124
  export { executeRecordIssueReproduction, record_issue_reproduction, } from './record-issue-reproduction';
125
125
  export { executeRecordRecurrenceSweep, record_recurrence_sweep, } from './record-recurrence-sweep';
126
+ export { executeRecoverReworkTask, recover_rework_task, } from './recover-rework-task';
126
127
  export { executeRunPrFeedbackStageA, run_pr_feedback_stage_a, } from './run-pr-feedback-stage-a';
127
128
  export { symbols } from './symbols';
128
129
  export { type SyntaxCheckFileResult, type SyntaxCheckInput, type SyntaxCheckResult, syntax_check, syntaxCheck, } from './syntax-check';
@@ -48,6 +48,7 @@ export declare const TOOL_MANIFEST: {
48
48
  submit_pr_review_result: () => ToolDefinition;
49
49
  approve_plan_critic: () => ToolDefinition;
50
50
  approve_retry_sounding_board: () => ToolDefinition;
51
+ recover_rework_task: () => ToolDefinition;
51
52
  prepare_pr_workflow_checkout: () => ToolDefinition;
52
53
  record_implementation_review: () => ToolDefinition;
53
54
  record_issue_publication: () => ToolDefinition;
@@ -0,0 +1,5 @@
1
+ import { createSwarmTool } from './create-tool.js';
2
+ export declare function executeRecoverReworkTask(args: unknown, directory: string, context?: {
3
+ sessionID?: string;
4
+ }): Promise<string>;
5
+ export declare const recover_rework_task: ReturnType<typeof createSwarmTool>;
@@ -177,6 +177,10 @@ export declare const TOOL_METADATA: {
177
177
  description: string;
178
178
  agents: "architect"[];
179
179
  };
180
+ recover_rework_task: {
181
+ description: string;
182
+ agents: "architect"[];
183
+ };
180
184
  prepare_pr_workflow_checkout: {
181
185
  description: string;
182
186
  agents: "architect"[];
@@ -0,0 +1,38 @@
1
+ export interface ReworkRecoverySummary {
2
+ taskId: string;
3
+ generation: number;
4
+ state: string;
5
+ transitionId: string;
6
+ recordedAt: string;
7
+ /**
8
+ * Whether the stage_a_repair audit event actually landed in
9
+ * `.swarm/events.jsonl`. The durable transition is authoritative regardless;
10
+ * this surfaces the best-effort append honestly instead of asserting an
11
+ * audit record that may not exist (issue #2755 review, FB-001).
12
+ */
13
+ auditEventRecorded: boolean;
14
+ }
15
+ /**
16
+ * Architect-supervised recovery from `rework_required` (issue #2755).
17
+ *
18
+ * The mechanical `stage_a_passed` transition deliberately fails closed from
19
+ * `rework_required` (`TASK_WORKFLOW_CODER_MUTATION_REQUIRED`): a genuine code
20
+ * defect must go back through the coder. But a Stage B verdict that failed
21
+ * WITHOUT a code defect (e.g. a tool-argument mistake scored as a verdict —
22
+ * sibling issue #2756) strands a task whose code is correct, reviewed, and
23
+ * green on Stage A checks, with no agent-legal exit; the only other remedy
24
+ * ever offered is the human-only `/swarm recover`, whose repair leg skips
25
+ * this state entirely.
26
+ *
27
+ * This is the audited escape hatch the #2703 precedent
28
+ * (`approve_retry_sounding_board`) established for exactly this class: it
29
+ * writes the SAME durable transition the mechanical path would have written,
30
+ * admitted ONLY by the `supervisedRecovery` flag the reducer accepts from
31
+ * `rework_required`, and records a distinguishable `stage_a_repair` audit
32
+ * event (action `rework_recovered`). Every precondition fails closed; the
33
+ * mechanical path and the `/swarm recover` auto-scan are untouched.
34
+ */
35
+ export declare function forceRecoverReworkTask(directory: string, sessionID: string, options: {
36
+ taskId: string;
37
+ reason?: string;
38
+ }): Promise<ReworkRecoverySummary>;
@@ -21,12 +21,54 @@ export interface StageARepairResult {
21
21
  results: StageARepairOutcome[];
22
22
  truncated: boolean;
23
23
  }
24
+ /**
25
+ * Appends a stage_a_repair lifecycle event to `.swarm/events.jsonl`.
26
+ * Mirrors coder-settlement's appendSettlementEvent contract: best-effort,
27
+ * never throws, appended through the canonical `appendCoreEventSync` seam
28
+ * (which owns `.swarm` creation, lock retry, and torn-tail framing — its
29
+ * single atomic append replaces the former EBUSY/EPERM one-retry), final
30
+ * failure surfaced via criticalWarn so a silently missing audit line is
31
+ * visible. Returns whether the audit line actually landed, so callers on
32
+ * supervised-write paths can surface audit honesty instead of asserting it
33
+ * (issue #2755 review: the recover_rework_task tool must not claim an audit
34
+ * record exists when the append failed).
35
+ */
36
+ export declare function appendStageARepairEvent(directory: string, payload: Record<string, unknown>): Promise<boolean>;
24
37
  export type PreCheckGreennessResult = {
25
38
  green: true;
26
39
  } | {
27
40
  green: false;
28
41
  reason: 'no_pre_check_bundles' | 'pre_check_failed_or_stale';
29
42
  };
43
+ /**
44
+ * Decides whether durable post-settlement Stage A proof exists for a wedged
45
+ * task. "Green" REQUIRES BOTH a secretscan evidence bundle whose latest entry
46
+ * is pass/approved/info with full coverage and zero findings, AND a sast_scan
47
+ * evidence bundle whose latest entry is pass/approved/info. Also requires
48
+ * every considered entry to be newer than the settlement commit when
49
+ * `settledAfterMs` is supplied (a scan taken before the coder's mutation
50
+ * proves nothing about it).
51
+ *
52
+ * Deliberately more conservative than `pre_check_batch`'s own default bar in
53
+ * two edge cases it cannot reproduce from persisted evidence alone: (1) a
54
+ * degraded-but-tolerated SAST run (Semgrep process failure with zero
55
+ * findings) persists an ordinary `verdict: 'fail'` entry structurally
56
+ * indistinguishable from a genuine failure — `failure_kind` is only present
57
+ * on the tool's transient return value, not the persisted bundle — so this
58
+ * function treats it as failing rather than risk silently waving through a
59
+ * scan that never actually completed; (2) a project running with SAST
60
+ * disabled (`sast_enabled: false`) never persists a `sast_scan` bundle at
61
+ * all, so a wedged task from such a project cannot be auto-repaired via this
62
+ * path and needs manual attention. Both are intentional fail-closed
63
+ * trade-offs for a security-relevant repair tool, not bugs — see PR #2316
64
+ * review finding ST-001/UIB-004 for why an absent-SAST-is-fine policy was
65
+ * removed in the first place.
66
+ *
67
+ * Evidence bucket names vs. entry type tags differ for SAST: the scanner
68
+ * persists its bundle under bucket `sast_scan` (see `src/tools/sast-scan.ts`)
69
+ * with individual entries tagged `type: 'sast'`.
70
+ */
71
+ export declare function hasGreenPostSettlementPreCheck(directory: string, settledAfterMs: number | null): Promise<PreCheckGreennessResult>;
30
72
  export interface StageAScanResult {
31
73
  /** One entry per enumerated task, classified in the shared #2665 vocabulary. */
32
74
  results: TaskRecoveryStatus[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.181.0",
3
+ "version": "7.181.2",
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",