opencode-swarm 7.144.2 → 7.144.4

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/.opencode/skills/swarm-pr-review/SKILL.md +3 -1
  2. package/.opencode/skills/swarm-pr-review/references/lane-output-recoverability.md +124 -0
  3. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +2 -0
  4. package/README.md +3 -1
  5. package/dist/background/pending-delegations.d.ts +34 -0
  6. package/dist/cli/{config-doctor-7dfvxwjb.js → config-doctor-rw9zrjk6.js} +3 -3
  7. package/dist/cli/{core-dwmwdc4y.js → core-zjx9aqaf.js} +3 -3
  8. package/dist/cli/{curation-policy-pkb2eeb1.js → curation-policy-0wbrh11c.js} +5 -5
  9. package/dist/cli/curator-drift-2jbjv03a.js +1 -1
  10. package/dist/cli/{curator-w213v33y.js → curator-g54a7wv0.js} +33 -33
  11. package/dist/cli/{curator-llm-factory-rrs1q4hg.js → curator-llm-factory-xgb4pxmm.js} +33 -33
  12. package/dist/cli/{evidence-summary-service-t7n2h1he.js → evidence-summary-service-fnr5y54e.js} +14 -14
  13. package/dist/cli/{gate-evidence-xvxn603y.js → gate-evidence-2xt1x07r.js} +7 -7
  14. package/dist/cli/{guardrail-explain-v1mwsnkq.js → guardrail-explain-6wcgr9tz.js} +34 -34
  15. package/dist/cli/{guardrail-log-dn03dpz2.js → guardrail-log-5w4b9zrw.js} +4 -4
  16. package/dist/cli/{hive-promoter-asjtj7ga.js → hive-promoter-x63ehffd.js} +35 -35
  17. package/dist/cli/{index-ckrasab9.js → index-03pv47h2.js} +9 -9
  18. package/dist/cli/{index-4q9vfav6.js → index-1csyxv0f.js} +1 -1
  19. package/dist/cli/{index-s2rcz51a.js → index-1jsmmx7y.js} +66 -34
  20. package/dist/cli/{index-jsfghpy2.js → index-2m7mavaz.js} +2 -2
  21. package/dist/cli/{index-p3tnmkvc.js → index-4w5qdbk7.js} +12 -12
  22. package/dist/cli/{index-dhh2j2nd.js → index-8j0va7jp.js} +2 -2
  23. package/dist/cli/{index-y95nwsge.js → index-9qq7c18c.js} +1 -1
  24. package/dist/cli/{index-qpt8ahph.js → index-az8etqpp.js} +12 -12
  25. package/dist/cli/{index-gdd4jt6b.js → index-bt9aa01f.js} +1 -1
  26. package/dist/cli/{index-333kvewd.js → index-btmsqv7p.js} +4 -4
  27. package/dist/cli/{index-d55crzd4.js → index-cz25e8xp.js} +7 -7
  28. package/dist/cli/{index-g2ajae1z.js → index-d12jd5mn.js} +2 -2
  29. package/dist/cli/{index-tq5s07ta.js → index-dty5qgk2.js} +1 -1
  30. package/dist/cli/{index-k31en0ja.js → index-f9vvg5xb.js} +3 -3
  31. package/dist/cli/{index-k92cagmt.js → index-fqcjragy.js} +2 -2
  32. package/dist/cli/{index-jb4tchvy.js → index-h98t1m88.js} +2 -2
  33. package/dist/cli/{index-4fda8kkw.js → index-jabkn643.js} +30 -5
  34. package/dist/cli/{index-erfnw81g.js → index-mazgg5s2.js} +1 -1
  35. package/dist/cli/{index-m6wv2qdr.js → index-nckg4gxb.js} +2 -2
  36. package/dist/cli/{index-tg9fn2dy.js → index-p7cm3gtj.js} +38 -36
  37. package/dist/cli/{index-dg2w0wr4.js → index-psvxq93b.js} +3 -3
  38. package/dist/cli/{index-zr370283.js → index-pw83zgny.js} +3 -3
  39. package/dist/cli/{index-nretd4qn.js → index-q4ed1jk7.js} +1539 -963
  40. package/dist/cli/{index-hqvt3mhk.js → index-q67jb94n.js} +1 -1
  41. package/dist/cli/{index-whezv7vc.js → index-v3y3qg48.js} +1 -1
  42. package/dist/cli/{index-av0f6mm0.js → index-x6tp0hfr.js} +9 -9
  43. package/dist/cli/{index-h3z64mhz.js → index-y8j8ehc8.js} +2 -2
  44. package/dist/cli/{index-ne8cfgw5.js → index-yts89pqg.js} +4 -4
  45. package/dist/cli/{index-w7x7qxz2.js → index-ywn7vtxp.js} +1 -1
  46. package/dist/cli/{index-g1c5fgaw.js → index-z6v7kwpa.js} +4 -4
  47. package/dist/cli/{index-7ca3a6gj.js → index-zb0xcz9t.js} +10 -10
  48. package/dist/cli/index.js +34 -34
  49. package/dist/cli/{knowledge-escalator-cg19dhe5.js → knowledge-escalator-ypg14d5r.js} +13 -13
  50. package/dist/cli/{knowledge-events-yzvysaqd.js → knowledge-events-nkrym4wb.js} +11 -11
  51. package/dist/cli/{knowledge-link-fn5j3r4q.js → knowledge-link-e4qgqmpx.js} +4 -4
  52. package/dist/cli/{knowledge-store-6f77xpmm.js → knowledge-store-vh3nhtg2.js} +6 -6
  53. package/dist/cli/{knowledge-validator-4b28zdxa.js → knowledge-validator-jrxvexv6.js} +8 -8
  54. package/dist/cli/{pending-delegations-thy8g30k.js → pending-delegations-pw79c8ds.js} +3 -3
  55. package/dist/cli/{pr-subscriptions-jyav582d.js → pr-subscriptions-fk628bhc.js} +3 -3
  56. package/dist/cli/{runner-pde6b5sx.js → runner-b02sz2vx.js} +5 -5
  57. package/dist/cli/{scan-cursor-nqbb1xt6.js → scan-cursor-fp7w5jmc.js} +7 -7
  58. package/dist/cli/{schema-jj2pb6zp.js → schema-rptwqbm4.js} +2 -2
  59. package/dist/cli/{scope-persistence-63nasq0z.js → scope-persistence-0bkaxawa.js} +7 -7
  60. package/dist/cli/{skill-generator-nsymtdqm.js → skill-generator-nh8b4gjv.js} +16 -16
  61. package/dist/cli/{telemetry-xyfb5vm8.js → telemetry-cybx6cfz.js} +1 -1
  62. package/dist/cli/{worktree-collision-ownership-j6d33p49.js → worktree-collision-ownership-hqd9ypsz.js} +6 -6
  63. package/dist/cli/{worktree-isolation-g54kxw6x.js → worktree-isolation-canf3rj8.js} +33 -33
  64. package/dist/commands/index.d.ts +1 -0
  65. package/dist/commands/recover.d.ts +17 -0
  66. package/dist/commands/registry.d.ts +10 -2
  67. package/dist/commands/reset-session.d.ts +2 -0
  68. package/dist/hooks/context-budget.d.ts +4 -0
  69. package/dist/hooks/context-usage.d.ts +48 -0
  70. package/dist/hooks/pr-workflow-gate.d.ts +160 -4
  71. package/dist/index.js +556 -550
  72. package/dist/observability/catalog.d.ts +8 -6
  73. package/dist/sast/semgrep.d.ts +3 -2
  74. package/dist/telemetry.d.ts +17 -1
  75. package/dist/tools/context-status.d.ts +9 -3
  76. package/dist/tools/dispatch-lanes.d.ts +27 -2
  77. package/dist/tools/pre-check-batch.d.ts +9 -0
  78. package/dist/tools/sast-scan.d.ts +3 -0
  79. package/dist/workflow/coder-settlement.d.ts +74 -0
  80. package/package.json +1 -1
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * The event catalog (issue #2029).
3
3
  *
4
- * Exactly 42 entries, matching the `TelemetryEvent` union at
5
- * `src/telemetry.ts:15-91`. Thirty-eight predate the #2029 contract; the 39th is
4
+ * Exactly 43 entries, matching the `TelemetryEvent` union at
5
+ * `src/telemetry.ts:15-92`. Thirty-eight predate the #2029 contract; the 39th is
6
6
  * `agent_conflict_detected` (previously emitted through a force-cast past the
7
- * type system), and the 40th is `close_archive_result` (issue #2030 — the
8
- * structured close/archive result event). The 41st is the bounded diagnostic
7
+ * type system), the 40th is `close_archive_result` (issue #2030 — the
8
+ * structured close/archive result event), the 41st is the bounded diagnostic
9
9
  * projection of authoritative knowledge-receipt transitions (issue #2031).
10
- * These late additions are instances of
10
+ * The 42nd is the human-only `knowledge_maintenance` quarantine audit
11
+ * (issue #2033), and the 43rd is the aggregate `context_pruned` transcript
12
+ * mutation audit. These late additions are instances of
11
13
  * the defect class this contract exists to close: an event kind entering the
12
14
  * stream with no registration.
13
15
  *
@@ -62,7 +64,7 @@ export interface CatalogEntry {
62
64
  /**
63
65
  * Whether an event of this kind must carry `trace.parentSpanId`.
64
66
  *
65
- * `false` for all 42 entries today, and that is a truthful statement about
67
+ * `false` for all 43 entries today, and that is a truthful statement about
66
68
  * the current system rather than a placeholder: no producer supplies a
67
69
  * parent span, so `createObservation` never sets one. Setting this to `true`
68
70
  * for a kind whose producer cannot supply a parent would make every
@@ -16,13 +16,12 @@ export interface SemgrepOptions {
16
16
  timeoutMs?: number;
17
17
  /** Working directory for Semgrep execution */
18
18
  cwd?: string;
19
- /** Language identifier for --lang flag (used with useAutoConfig) */
20
- lang?: string;
21
19
  /** When true, use --config auto instead of local rulesDir (for profile-driven languages) */
22
20
  useAutoConfig?: boolean;
23
21
  /** Host/tool cancellation propagated to the shared subprocess runner. */
24
22
  abortSignal?: AbortSignal;
25
23
  }
24
+ export type SemgrepFailureKind = 'process_exit' | 'timeout' | 'cancelled' | 'output_limit' | 'spawn_error' | 'invalid_output' | 'scan_error' | 'unexpected';
26
25
  /**
27
26
  * Result from Semgrep execution
28
27
  */
@@ -33,6 +32,8 @@ export interface SemgrepResult {
33
32
  findings: SastFinding[];
34
33
  /** Error message if Semgrep failed */
35
34
  error?: string;
35
+ /** Machine-readable category for an available scanner failure. */
36
+ failure_kind?: SemgrepFailureKind;
36
37
  /** Engine label for the findings */
37
38
  engine: 'tier_a' | 'tier_a+tier_b';
38
39
  }
@@ -1,6 +1,6 @@
1
1
  import { createObservation, toLegacyTelemetryLine } from './observability/index.js';
2
2
  import type { DelegationCostFields } from './services/cost-accounting.js';
3
- export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | 'gate_parse_error' | 'reviewer_gate_decision' | 'phase_changed' | 'budget_updated' | 'model_fallback' | 'hard_limit_hit' | 'revision_limit_hit' | 'loop_detected' | 'no_op_strong_warning' | 'scope_violation' | 'qa_skip_violation' | 'heartbeat' | 'turbo_mode_changed' | 'auto_oversight_escalation' | 'environment_detected' | 'evidence_lock_acquired' | 'evidence_lock_contended' | 'evidence_lock_stale_recovered' | 'plan_ledger_cas_retry' | 'plan_md_write_failed' | 'snapshot_failed' | 'gate_denial_loop'
3
+ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | 'gate_parse_error' | 'reviewer_gate_decision' | 'phase_changed' | 'budget_updated' | 'context_pruned' | 'model_fallback' | 'hard_limit_hit' | 'revision_limit_hit' | 'loop_detected' | 'no_op_strong_warning' | 'scope_violation' | 'qa_skip_violation' | 'heartbeat' | 'turbo_mode_changed' | 'auto_oversight_escalation' | 'environment_detected' | 'evidence_lock_acquired' | 'evidence_lock_contended' | 'evidence_lock_stale_recovered' | 'plan_ledger_cas_retry' | 'plan_md_write_failed' | 'snapshot_failed' | 'gate_denial_loop'
4
4
  /**
5
5
  * Issue #2063 B5 — an ARMED execution episode reached the advisory rung:
6
6
  * `execution_stall_warn_calls` tool calls with no delegation completion, no
@@ -116,6 +116,22 @@ export declare const telemetry: {
116
116
  reviewerGateDecision(sessionId: string, taskId: string, blocked: boolean, reasonCode: ReviewerGateReasonCode, evidenceKind: ReviewerGateEvidenceKind): void;
117
117
  phaseChanged(sessionId: string, oldPhase: number, newPhase: number): void;
118
118
  budgetUpdated(sessionId: string, budgetPct: number, agentName: string): void;
119
+ contextPruned(data: {
120
+ sessionId: string;
121
+ agentName: string;
122
+ trigger: "agent_switch" | "critical_threshold";
123
+ usageSource: "provider" | "estimated";
124
+ beforeTokens: number;
125
+ afterTokens: number;
126
+ modelLimit: number;
127
+ maskedMessages: number;
128
+ maskedToolParts: number;
129
+ maskedTokensFreed: number;
130
+ prunedMessages: number;
131
+ prunedTextParts: number;
132
+ prunedToolParts: number;
133
+ prunedTokensFreed: number;
134
+ }): void;
119
135
  modelFallback(sessionId: string, agentName: string, fromModel: string, toModel: string, reason: string): void;
120
136
  hardLimitHit(sessionId: string, agentName: string, limitType: string, value: number): void;
121
137
  revisionLimitHit(sessionId: string, agentName: string): void;
@@ -2,7 +2,9 @@
2
2
  * Context Status Tool
3
3
  *
4
4
  * Read-only tool that reports current context-window headroom for the active
5
- * session. Derives messages from the runtime session context (via
5
+ * session. Returns both the measured usage and the `usageSource`
6
+ * (`provider` prompt accounting when available, otherwise `estimated`).
7
+ * Derives messages from the runtime session context (via
6
8
  * `swarmState.opencodeClient.session.messages`) and resolves thresholds from
7
9
  * the plugin config, mirroring the active `createContextBudgetHandler` hook's
8
10
  * behavior exactly — including strict `>` boundary semantics (exact threshold
@@ -12,6 +14,7 @@
12
14
  * Works whether `context_budget.enabled` is true or false.
13
15
  */
14
16
  import { loadPluginConfig } from '../config';
17
+ import { type ContextUsageSource } from '../hooks/context-usage';
15
18
  import { createSwarmTool } from './create-tool';
16
19
  /**
17
20
  * Shape of a message's info block.
@@ -47,8 +50,10 @@ export interface ContextMessage {
47
50
  * Result returned by the context_status tool.
48
51
  */
49
52
  export interface ContextStatusResult {
50
- /** Estimated tokens used across all text parts in the session */
53
+ /** Provider-accounted or estimated tokens used across the session */
51
54
  tokensUsed: number;
55
+ /** Whether usage came from provider prompt accounting or a bounded estimate */
56
+ usageSource: ContextUsageSource;
52
57
  /** Resolved model context limit in tokens */
53
58
  modelLimit: number;
54
59
  /** Ratio of tokens-used to model-limit (0.0 – 1.0+) */
@@ -101,7 +106,8 @@ declare function computeContextHeadroom(messages: ContextMessage[], warnThreshol
101
106
  *
102
107
  * No arguments required — the tool queries current state automatically.
103
108
  *
104
- * Returns JSON string with tokensUsed, modelLimit, usagePercent, thresholdCrossed, modelId, provider.
109
+ * Returns JSON with tokensUsed, usageSource, modelLimit, usagePercent,
110
+ * thresholdCrossed, modelId, and provider.
105
111
  */
106
112
  export { computeContextHeadroom };
107
113
  export declare const context_status: ReturnType<typeof createSwarmTool>;
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
- import { type BackgroundDelegationRecord } from '../background/pending-delegations.js';
2
+ import { type BackgroundDelegationRecord, type BackgroundDelegationWorkflowLaneRecovery } from '../background/pending-delegations.js';
3
3
  import { resolveExactMergeBaseAsync, resolvePrWorkflowRevisionDigestAsync } from '../background/workspace-snapshot.js';
4
- import { type PrReviewDepthTier } from '../hooks/pr-workflow-gate.js';
4
+ import { type PrReviewDepthTier, validatePrWorkflowTransportRecovery } from '../hooks/pr-workflow-gate.js';
5
5
  import { buildLaneOrientationBlock } from '../hooks/repo-graph-injection.js';
6
6
  import { createParallelDispatcher } from '../parallel/dispatcher/parallel-dispatcher.js';
7
7
  import { createSwarmTool } from './create-tool.js';
@@ -126,6 +126,12 @@ export interface DispatchLaneResult {
126
126
  output_artifact_error?: string;
127
127
  transcript_incomplete?: boolean;
128
128
  message_count?: number;
129
+ salvaged_workflow_lanes?: string[];
130
+ salvaged_workflow_lane_recoveries?: Array<{
131
+ workflow_lane: string;
132
+ kind: BackgroundDelegationWorkflowLaneRecovery['kind'];
133
+ reason: string;
134
+ }>;
129
135
  /**
130
136
  * Set to true when this lane's `output` preview was withheld because an
131
137
  * identical preview (same batch, lane, and result digest) was already
@@ -251,6 +257,11 @@ export interface SessionOps {
251
257
  data?: Array<{
252
258
  info?: {
253
259
  role?: string;
260
+ time?: {
261
+ completed?: number;
262
+ };
263
+ finish?: string;
264
+ error?: unknown;
254
265
  };
255
266
  parts?: Array<{
256
267
  type: string;
@@ -286,6 +297,7 @@ export declare const _internals: {
286
297
  createParallelDispatcher: typeof createParallelDispatcher;
287
298
  resolvePrWorkflowRevisionDigestAsync: typeof resolvePrWorkflowRevisionDigestAsync;
288
299
  resolveExactMergeBaseAsync: typeof resolveExactMergeBaseAsync;
300
+ validatePrWorkflowTransportRecovery: typeof validatePrWorkflowTransportRecovery;
289
301
  now: () => number;
290
302
  sleep: (ms: number) => Promise<void>;
291
303
  };
@@ -302,6 +314,7 @@ export declare const _test_exports: {
302
314
  formatError: typeof formatError;
303
315
  nextCollectPollInterval: typeof nextCollectPollInterval;
304
316
  promptHash: typeof promptHash;
317
+ reserveCollectionLaneCallBudgets: typeof reserveCollectionLaneCallBudgets;
305
318
  isRetryableSessionCreateFailure: typeof isRetryableSessionCreateFailure;
306
319
  DispatchLanesArgsSchema: z.ZodObject<{
307
320
  lanes: z.ZodArray<z.ZodObject<{
@@ -403,6 +416,11 @@ declare function isRetryableSessionCreateFailure(error: unknown): boolean;
403
416
  declare function extractAssistantTranscript(messages: Array<{
404
417
  info?: {
405
418
  role?: string;
419
+ time?: {
420
+ completed?: number;
421
+ };
422
+ finish?: string;
423
+ error?: unknown;
406
424
  };
407
425
  parts?: Array<{
408
426
  type: string;
@@ -412,6 +430,13 @@ declare function extractAssistantTranscript(messages: Array<{
412
430
  text: string;
413
431
  messageCount: number;
414
432
  transcriptIncomplete: boolean;
433
+ terminalAssistantProof: boolean;
434
+ };
435
+ declare function reserveCollectionLaneCallBudgets(deadline: number, remainingLaneCount: number, hasStatusCall: boolean, hasRevisionDigestCall?: boolean): {
436
+ laneBudgetMs: number;
437
+ statusBudgetMs: number;
438
+ messagesBudgetMs: number;
439
+ revisionDigestBudgetMs: number;
415
440
  };
416
441
  declare function nextCollectPollInterval(currentMs: number): number;
417
442
  declare function buildCollectResult(batchId: string, records: BackgroundDelegationRecord[], includePending: boolean, deliveryContext?: {
@@ -9,6 +9,7 @@ import { saveEvidence } from '../evidence/manager.js';
9
9
  import { runExternalTool } from '../utils/external-tool-runner';
10
10
  import type { LintResult, ResolvedLinterCommand } from './lint';
11
11
  import { detectResolvedLinter } from './lint';
12
+ import { resolveGatePreamble } from './phase-complete/gates/gate-helpers';
12
13
  import type { QualityBudgetResult } from './quality-budget';
13
14
  import { qualityBudget } from './quality-budget';
14
15
  import type { SastScanFinding, SastScanResult } from './sast-scan';
@@ -27,6 +28,8 @@ export declare const _internals: {
27
28
  runLintOnFiles: typeof runLintOnFiles;
28
29
  platform: () => NodeJS.Platform;
29
30
  serializePreCheckResult: typeof serializePreCheckResult;
31
+ resolveGatePreamble: typeof resolveGatePreamble;
32
+ runPreCheckBatch: typeof runPreCheckBatch;
30
33
  MAX_COMBINED_BYTES: number;
31
34
  };
32
35
  export interface PreCheckBatchInput {
@@ -46,6 +49,8 @@ export interface PreCheckBatchInput {
46
49
  * with capture_baseline:true.
47
50
  */
48
51
  phase?: number;
52
+ /** Effective QA-profile value derived internally by the public tool boundary. */
53
+ sast_enabled?: boolean;
49
54
  }
50
55
  export interface ToolResult<T> {
51
56
  /** Whether the tool was executed */
@@ -76,6 +81,10 @@ export interface PreCheckBatchResult {
76
81
  total_duration_ms: number;
77
82
  /** Pre-existing SAST findings on unchanged lines, requiring reviewer triage */
78
83
  sast_preexisting_findings?: SastScanFinding[];
84
+ /** Optional Semgrep exited nonzero with no findings; SAST coverage is incomplete. */
85
+ sast_degraded?: boolean;
86
+ /** SAST was intentionally disabled by the effective QA profile. */
87
+ sast_skipped?: boolean;
79
88
  }
80
89
  /**
81
90
  * Serialize the public result below the decoder's stricter byte ceiling. When
@@ -40,6 +40,8 @@ export interface SastScanResult {
40
40
  verdict: EvidenceVerdict;
41
41
  /** Validation error when the requested scan cannot safely run */
42
42
  error?: string;
43
+ /** Machine-readable failure category for gate consumers. */
44
+ failure_kind?: SastFailureKind;
43
45
  /** Array of security findings */
44
46
  findings: SastScanFinding[];
45
47
  /** Summary information */
@@ -71,6 +73,7 @@ export interface SastScanResult {
71
73
  /** True when pre_existing_findings were truncated to fit result limits */
72
74
  truncated_pre_existing?: boolean;
73
75
  }
76
+ export type SastFailureKind = 'semgrep_process_exit' | 'semgrep_timeout' | 'semgrep_cancelled' | 'semgrep_output_limit' | 'semgrep_spawn_error' | 'semgrep_invalid_output' | 'semgrep_scan_error' | 'semgrep_unexpected' | 'semgrep_unclassified' | 'coverage' | 'cancelled' | 'invalid_input';
74
77
  export interface SastScanFinding {
75
78
  rule_id: string;
76
79
  severity: 'critical' | 'high' | 'medium' | 'low';
@@ -1,6 +1,7 @@
1
1
  import type { BackgroundTaskChangeContext, BackgroundWorktreeDescriptor } from '../background/pending-delegations.js';
2
2
  import { type TaskEvidence } from '../gate-evidence.js';
3
3
  import type { MergeOperationProvenance } from '../worktree/merge.js';
4
+ import type { CoderSettlementWal } from './workflow-wal-schema.js';
4
5
  export interface CoderSettlementResult {
5
6
  evidence: TaskEvidence;
6
7
  accepted: boolean;
@@ -64,6 +65,79 @@ export declare function completeCoderSettlementCleanup(directory: string, taskId
64
65
  export declare function recoverCoderSettlement(directory: string, taskId: string): Promise<CoderSettlementResult | null>;
65
66
  export declare function releaseCoderDispatchOwnership(directory: string, taskId: string, transitionId: string): void;
66
67
  export declare function assertNoUnsettledCoderDispatch(directory: string, taskId: string): Promise<void>;
68
+ export interface CoderSettlementWalState {
69
+ taskId: string;
70
+ state: CoderSettlementWal['state'] | 'unreadable';
71
+ transitionId?: string;
72
+ processId?: number;
73
+ recordedAt?: string;
74
+ /** The in-process ownership registry still holds this dispatch (toolAfter never drained it). */
75
+ ownedInProcess: boolean;
76
+ /** A different, still-alive host process owns the dispatch. Never force-releasable from here. */
77
+ ownedByLiveForeignPid: boolean;
78
+ }
79
+ /**
80
+ * Bounded inventory of durable coder-settlement WALs for diagnostics and
81
+ * recovery surfaces (/swarm diagnose, /swarm recover, /swarm reset-session).
82
+ * Ownership predicates mirror recoverCoderSettlement's refusal guard exactly:
83
+ * `ownedInProcess` means this process's liveDispatches registry holds the
84
+ * dispatch (its completion may still be pending or was lost); a foreign live
85
+ * pid can never be released from this process by construction.
86
+ *
87
+ * `truncated` is true when the directory held more matching files than
88
+ * MAX_SETTLEMENT_WAL_SCAN — consumers MUST surface that so a wedge sorted
89
+ * past the cap is not silently invisible (issue #2268 review, PRR-011).
90
+ */
91
+ export declare function listCoderSettlementWalStates(directory: string): Promise<{
92
+ states: CoderSettlementWalState[];
93
+ truncated: boolean;
94
+ }>;
95
+ export type StaleSettlementRecoveryOutcome = {
96
+ taskId: string;
97
+ outcome: 'recovered';
98
+ accepted: boolean;
99
+ forced: boolean;
100
+ } | {
101
+ taskId: string;
102
+ outcome: 'already_terminal';
103
+ state: 'ABORTED' | 'COMMITTED';
104
+ } | {
105
+ taskId: string;
106
+ outcome: 'owned_in_process';
107
+ transitionId: string;
108
+ } | {
109
+ taskId: string;
110
+ outcome: 'owned_by_live_foreign_pid';
111
+ processId: number;
112
+ } | {
113
+ taskId: string;
114
+ outcome: 'unreadable_wal';
115
+ } | {
116
+ taskId: string;
117
+ outcome: 'error';
118
+ message: string;
119
+ };
120
+ /**
121
+ * Issue #2268: the user-facing settlement recovery entry point. Settles every
122
+ * non-terminal coder-settlement WAL via the same recoverCoderSettlement
123
+ * transition the internal sinks (update_task_status, /swarm close preflight,
124
+ * Stage-B ingestion) already use — no new states, no schema change.
125
+ *
126
+ * `force` releases THIS process's ownership registry keys before recovery.
127
+ * That is safe only as an explicit operator assertion (human-only /swarm
128
+ * recover --force, /swarm reset-session): if the dispatch was genuinely still
129
+ * in flight, its late completion will fail settlement with
130
+ * CODER_SETTLEMENT_IDEMPOTENCY_CONFLICT against the already-recovered WAL.
131
+ * A foreign live pid is NEVER forced — its dispatch lives in another process.
132
+ */
133
+ export declare function recoverStaleCoderSettlements(directory: string, options?: {
134
+ taskIds?: string[];
135
+ force?: boolean;
136
+ }): Promise<{
137
+ results: StaleSettlementRecoveryOutcome[];
138
+ truncated: boolean;
139
+ }>;
67
140
  export declare const _internals: {
68
141
  liveDispatches: Set<string>;
142
+ recoverCoderSettlement: typeof recoverCoderSettlement;
69
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.144.2",
3
+ "version": "7.144.4",
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",