opencode-swarm 7.168.1 → 7.170.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.
Files changed (146) hide show
  1. package/.opencode/skills/swarm-pr-feedback/SKILL.md +11 -11
  2. package/README.md +1 -0
  3. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  4. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  5. package/dist/ci/evaluate.d.ts +100 -0
  6. package/dist/ci/index.d.ts +13 -0
  7. package/dist/ci/quality-checks.d.ts +58 -0
  8. package/dist/ci/report.d.ts +21 -0
  9. package/dist/ci/runtime.d.ts +81 -0
  10. package/dist/cli/{capability-probe-faqefhah.js → capability-probe-pdwwz8gs.js} +1 -1
  11. package/dist/cli/{coder-settlement-54a3d97g.js → coder-settlement-65zx1bet.js} +12 -12
  12. package/dist/cli/{config-doctor-vzp6b3ng.js → config-doctor-c30rss1c.js} +2 -2
  13. package/dist/cli/{core-yynse50x.js → core-8wkbr1tr.js} +5 -2
  14. package/dist/cli/{curation-policy-mgwv8h2k.js → curation-policy-k74qz9ms.js} +5 -5
  15. package/dist/cli/{curator-drift-k0zrnm09.js → curator-drift-3ssjr0nx.js} +5 -5
  16. package/dist/cli/curator-llm-factory-jkjqasfs.js +72 -0
  17. package/dist/cli/{curator-agdhhzqt.js → curator-pckzk1q4.js} +40 -39
  18. package/dist/cli/{dispatch-8ks9dyk5.js → dispatch-hwwj3qrb.js} +2 -2
  19. package/dist/cli/{evidence-summary-service-6mmcekr7.js → evidence-summary-service-4ydcapke.js} +17 -17
  20. package/dist/cli/{gate-evidence-xqvkqhrk.js → gate-evidence-xwqfky3m.js} +7 -7
  21. package/dist/cli/guardrail-explain-fe2veh2s.js +73 -0
  22. package/dist/cli/{guardrail-log-5wa5c77w.js → guardrail-log-z38j69bx.js} +8 -8
  23. package/dist/cli/{guardrail-reset-dh78tbcf.js → guardrail-reset-mmnzt4mz.js} +40 -39
  24. package/dist/cli/hive-promoter-68hrw1y1.js +87 -0
  25. package/dist/cli/{index-gmpmgtzn.js → index-06rbdzqn.js} +5 -5
  26. package/dist/cli/index-0hgmsyfp.js +92 -0
  27. package/dist/cli/{index-f1fps3w9.js → index-0xprxg95.js} +7 -7
  28. package/dist/cli/{index-p612v1mv.js → index-2s7dvzff.js} +200 -51
  29. package/dist/cli/{index-qthc56c4.js → index-31sqcdsd.js} +4 -4
  30. package/dist/cli/{index-y85aptep.js → index-3axdtaf0.js} +7 -7
  31. package/dist/cli/{index-9b2105n0.js → index-3eh2n3dx.js} +2 -2
  32. package/dist/cli/{index-w1dfkp1q.js → index-3p3y55xg.js} +15 -15
  33. package/dist/cli/{index-apy1qfj0.js → index-4wc5gfgm.js} +26 -4
  34. package/dist/cli/{index-d5qf7hvh.js → index-5400m33a.js} +1 -1
  35. package/dist/cli/{index-qkwtth00.js → index-59fcfpkh.js} +197 -35
  36. package/dist/cli/{index-j0bxxz9d.js → index-5bbem0ey.js} +8 -8
  37. package/dist/cli/{index-qwsh0h2g.js → index-5qt9yf5w.js} +4 -4
  38. package/dist/cli/{index-q1r1cfww.js → index-76qm2c2y.js} +37 -26
  39. package/dist/cli/{index-qhey6vc3.js → index-7h01bkm6.js} +2 -2
  40. package/dist/cli/{index-6df6wbvj.js → index-8w1mrvbd.js} +8 -8
  41. package/dist/cli/{index-8ybjqg51.js → index-9ttqbhvw.js} +1 -1
  42. package/dist/cli/{index-xhb4gryr.js → index-9xk97bcf.js} +4 -4
  43. package/dist/cli/{index-kear8gb7.js → index-b3pmzbh1.js} +2 -2
  44. package/dist/cli/{index-h439y187.js → index-bernkwgf.js} +1 -1
  45. package/dist/cli/{index-m35hybf0.js → index-bm5xrfnx.js} +1 -1
  46. package/dist/cli/{index-pyf517sz.js → index-br3mvbsa.js} +2 -2
  47. package/dist/cli/{index-4r5pmtvk.js → index-bx1wgn3a.js} +4 -4
  48. package/dist/cli/{index-nwwk3dej.js → index-cgpwjctj.js} +1 -1
  49. package/dist/cli/{index-wst6n478.js → index-dvbf6fpn.js} +1 -1
  50. package/dist/cli/{index-a8xbvsse.js → index-fgp96k3r.js} +2 -2
  51. package/dist/cli/{index-5zqakgp4.js → index-fhh02gwx.js} +3 -3
  52. package/dist/cli/{index-dfyv3xkd.js → index-gfbggp8k.js} +9 -9
  53. package/dist/cli/{index-kkmezerc.js → index-j144fgk8.js} +4831 -2776
  54. package/dist/cli/{index-xkf3672y.js → index-mjn6aqqk.js} +2 -2
  55. package/dist/cli/{index-3jmb4ppa.js → index-n0d5hrs4.js} +2 -2
  56. package/dist/cli/{index-v3xc4sde.js → index-nbdmdyke.js} +2 -1
  57. package/dist/cli/{index-z6qreakh.js → index-nprdr0sm.js} +6 -4
  58. package/dist/cli/{index-bvqqwx84.js → index-nyn01yrz.js} +2 -2
  59. package/dist/cli/{index-q8091q8b.js → index-p6fj7qz7.js} +3 -3
  60. package/dist/cli/{index-gh9ybrrs.js → index-pw00xcj0.js} +7 -7
  61. package/dist/cli/{index-bw9x8d8n.js → index-r1z8nrb6.js} +5 -5
  62. package/dist/cli/{index-2xbww1x0.js → index-ssx8087p.js} +7 -7
  63. package/dist/cli/{index-4kv1ew3q.js → index-t73888m0.js} +1 -1
  64. package/dist/cli/{index-91ww9hyr.js → index-td6xrw55.js} +1 -1
  65. package/dist/cli/{index-gp9yzr1v.js → index-xnpjwc4h.js} +1 -1
  66. package/dist/cli/{index-yt9n9zt3.js → index-xztkjj3c.js} +48 -41
  67. package/dist/cli/{index-5g6rhkn7.js → index-ye43mdfm.js} +36 -1
  68. package/dist/cli/{index-w3x1dmrf.js → index-z5vas8c3.js} +40 -39
  69. package/dist/cli/{index-chebm5h5.js → index-zw3hkzch.js} +3 -3
  70. package/dist/cli/index.js +45 -39
  71. package/dist/cli/{knowledge-escalator-135dz4eh.js → knowledge-escalator-pz2faktx.js} +13 -13
  72. package/dist/cli/{knowledge-events-27gwv47q.js → knowledge-events-s6s8qedx.js} +11 -11
  73. package/dist/cli/{knowledge-link-dr3xnwyd.js → knowledge-link-rkxfrmhm.js} +4 -4
  74. package/dist/cli/{knowledge-store-80m44bfw.js → knowledge-store-dgv3xw3h.js} +5 -5
  75. package/dist/cli/{knowledge-validator-crsfb2cc.js → knowledge-validator-22qppdyv.js} +7 -7
  76. package/dist/cli/{pending-delegations-gwgjzzkz.js → pending-delegations-4r21nf9d.js} +12 -12
  77. package/dist/cli/{pr-subscriptions-g633nhz4.js → pr-subscriptions-d52xy3zd.js} +12 -12
  78. package/dist/cli/{pr-workflow-gate-4dc5nt2e.js → pr-workflow-gate-0de81kzw.js} +40 -39
  79. package/dist/cli/{runner-k0ycgv8x.js → runner-1dwrgyyr.js} +6 -6
  80. package/dist/cli/{scan-cursor-avxjsm4w.js → scan-cursor-ahbbejab.js} +6 -6
  81. package/dist/cli/{schema-3ja77k4y.js → schema-17h2hcw9.js} +5 -1
  82. package/dist/cli/{scope-persistence-f540tc50.js → scope-persistence-gcn3zm5e.js} +14 -14
  83. package/dist/cli/{skill-generator-kcqqpg1g.js → skill-generator-hkqr5qs7.js} +15 -15
  84. package/dist/cli/{snapshot-coordination-init-e4s8bn4p.js → snapshot-coordination-init-ms36zxv6.js} +40 -39
  85. package/dist/cli/{telemetry-2wzapf11.js → telemetry-fdtaemnv.js} +1 -1
  86. package/dist/cli/{workspace-snapshot-rkgxhj9b.js → workspace-snapshot-hkz2wt1c.js} +4 -4
  87. package/dist/cli/{worktree-collision-ownership-rk9gz638.js → worktree-collision-ownership-7v7gg511.js} +18 -104
  88. package/dist/cli/{worktree-isolation-1bdzfgky.js → worktree-isolation-nanamt25.js} +40 -39
  89. package/dist/commands/ci.d.ts +40 -0
  90. package/dist/commands/destructive-purge.d.ts +85 -0
  91. package/dist/commands/index.d.ts +1 -0
  92. package/dist/commands/registry.d.ts +10 -2
  93. package/dist/commands/reset-session.d.ts +5 -1
  94. package/dist/config/constants.d.ts +4 -1
  95. package/dist/config/lane-context.d.ts +19 -0
  96. package/dist/config/schema.d.ts +77 -0
  97. package/dist/evaluation/index.d.ts +1 -0
  98. package/dist/evaluation/retrieval-quality.d.ts +116 -0
  99. package/dist/failures/invocation-failure.d.ts +23 -4
  100. package/dist/hooks/gate-denial-tracker.d.ts +18 -14
  101. package/dist/hooks/init-orphan-recovery.d.ts +7 -0
  102. package/dist/hooks/pr-workflow-gate.d.ts +8 -2
  103. package/dist/index.js +616 -608
  104. package/dist/memory/embeddings/reranker.d.ts +13 -2
  105. package/dist/memory/evaluation.d.ts +99 -0
  106. package/dist/memory/heldout-evaluation-corpus.d.ts +51 -0
  107. package/dist/memory/index.d.ts +5 -2
  108. package/dist/memory/sqlite-provider.d.ts +35 -1
  109. package/dist/memory/types.d.ts +14 -0
  110. package/dist/observability/otel-mapping.d.ts +5 -5
  111. package/dist/observability/otlp-exporter.d.ts +80 -0
  112. package/dist/parallel/lane-owners.d.ts +76 -0
  113. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +48 -11
  114. package/dist/tools/repo-graph/query.d.ts +6 -1
  115. package/dist/tools/repo-graph/types.d.ts +13 -4
  116. package/dist/utils/bun-compat.d.ts +20 -0
  117. package/dist/utils/gitignore-warning.d.ts +5 -2
  118. package/dist/worktree/base-migration.d.ts +55 -0
  119. package/dist/worktree/core.d.ts +15 -6
  120. package/dist/worktree/ownership.d.ts +66 -0
  121. package/opencode-swarm.schema.json +97 -0
  122. package/package.json +4 -2
  123. package/tests/fixtures/memory-recall-heldout/manifest.json +311 -0
  124. package/tests/fixtures/memory-recall-heldout/sources/bash.sh +1 -0
  125. package/tests/fixtures/memory-recall-heldout/sources/c.c +1 -0
  126. package/tests/fixtures/memory-recall-heldout/sources/cpp.cpp +1 -0
  127. package/tests/fixtures/memory-recall-heldout/sources/csharp.cs +1 -0
  128. package/tests/fixtures/memory-recall-heldout/sources/css.css +3 -0
  129. package/tests/fixtures/memory-recall-heldout/sources/dart.dart +1 -0
  130. package/tests/fixtures/memory-recall-heldout/sources/go.go +3 -0
  131. package/tests/fixtures/memory-recall-heldout/sources/ini.ini +2 -0
  132. package/tests/fixtures/memory-recall-heldout/sources/java.java +1 -0
  133. package/tests/fixtures/memory-recall-heldout/sources/javascript.js +3 -0
  134. package/tests/fixtures/memory-recall-heldout/sources/kotlin.kt +1 -0
  135. package/tests/fixtures/memory-recall-heldout/sources/php.php +1 -0
  136. package/tests/fixtures/memory-recall-heldout/sources/powershell.ps1 +1 -0
  137. package/tests/fixtures/memory-recall-heldout/sources/python.py +2 -0
  138. package/tests/fixtures/memory-recall-heldout/sources/regex.regex +1 -0
  139. package/tests/fixtures/memory-recall-heldout/sources/ruby.rb +3 -0
  140. package/tests/fixtures/memory-recall-heldout/sources/rust.rs +1 -0
  141. package/tests/fixtures/memory-recall-heldout/sources/swift.swift +1 -0
  142. package/tests/fixtures/memory-recall-heldout/sources/tsx.tsx +3 -0
  143. package/tests/fixtures/memory-recall-heldout/sources/typescript.ts +3 -0
  144. package/dist/cli/curator-llm-factory-ygxd6hfx.js +0 -71
  145. package/dist/cli/guardrail-explain-vjtjhgzs.js +0 -72
  146. package/dist/cli/hive-promoter-3czsx7c6.js +0 -86
@@ -929,21 +929,21 @@ Report:
929
929
 
930
930
  End with a complete ledger mapping every original item to its outcome.
931
931
 
932
- ## Aborting an unrecoverable feedback workflow (Profile A, pre-armed only)
932
+ ## Aborting or cancelling an unrecoverable feedback workflow (Profile A)
933
933
 
934
934
  If the verification bind is genuinely unreachable (the PR head cannot be
935
935
  fetched or checked out, or a compound `git fetch … && git checkout …` keeps
936
936
  being rejected — run them as TWO separate standalone commands first), call
937
937
  `abort_pr_workflow` with `mode: "PR_FEEDBACK"`, `kind: "recovery"`, and a
938
- one-line `reason` instead of looping. The tool refuses while PR workflow lanes are in flight
939
- (collect their results with `collect_lane_results` first) AND refuses once
940
- the workflow is armed for publication (`prFeedbackReadyToPublish`) after
941
- arming you MUST complete via `complete_pr_workflow` (or push the bound
942
- commit first), because aborting an armed gate would drop the immutable-
943
- commit binding and leave a half-published commit. The user can also run
944
- `/swarm abort-pr-workflow` once the wake budget suspends. Abort is a
945
- recovery tool for unbound or bound pre-publication workflows after bounded
946
- recovery is exhausted, not a gate-skip shortcut. When abort reports
947
- `checkout_restore_required`, call `prepare_pr_workflow_checkout` with
938
+ one-line `reason` while the workflow is pre-armed. Plain recovery/force aborts
939
+ refuse once publication is armed. To terminate an armed publication without
940
+ publishing, use `kind: "cancel-publication"`, `cancel_publication: true`, and a
941
+ non-empty `reason`. This records terminal `cancelled_without_publication` with
942
+ the observed remote head, never grants push authority, and then clears the gate.
943
+ Do not substitute a plain abort. To change approved content, use
944
+ `invalidate_pr_feedback_publication`; the full Stage A and ordered independent
945
+ gates must run again. A published generation is never cleared by abort; use
946
+ `complete_pr_workflow` so the actual remote branch is re-verified. When abort
947
+ reports `checkout_restore_required`, call `prepare_pr_workflow_checkout` with
948
948
  `operation: "restore"` before returning. On Profiles B/C there is no durable
949
949
  gate to abort: report the blocker to the user and stop.
package/README.md CHANGED
@@ -1159,6 +1159,7 @@ Control how tool outputs are summarized for LLM context.
1159
1159
  | `/swarm pr-review <pr-url\|owner/repo#N\|N> [--council] [instructions...]` | Structured deep PR review with parallel lanes, reviewer confirmation, and critic challenge |
1160
1160
  | `/swarm pr-feedback [<pr-url\|owner/repo#N\|N>] [instructions...]` | Ingest and close known PR feedback (review comments, CI failures, conflicts) without a fresh review |
1161
1161
  | `/swarm ci-monitor <pr-url\|owner/repo#N\|N>` | Drive an already-reviewed, approved PR to green and merged (monitor CI, fix, merge; max 5 fix cycles) |
1162
+ | `/swarm ci` `[--timeout-ms <n>] [--json]` | Advisory headless CI: read-only gate/evidence evaluation with machine exit codes (also `bunx opencode-swarm ci`; see docs/ci.md) |
1162
1163
  | `/swarm pr subscribe <pr-url\|owner/repo#N\|N>` | Subscribe current session to PR monitoring (session-scoped); requires `pr_monitor.enabled: true` |
1163
1164
  | `/swarm pr unsubscribe <pr-url\|owner/repo#N\|N>` | Remove session's subscription to a PR |
1164
1165
  | `/swarm pr status` | List active PR subscriptions for current session with relative timestamps (the `bunx opencode-swarm run pr status` CLI has no session context, so it lists subscriptions across all sessions) |
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Host-decoupled advisory gate evaluation (issue #2497).
3
+ *
4
+ * Composes the EXISTING authoritative readers — never a reimplementation —
5
+ * to answer "did this checked-out repo's swarm work satisfy its gates?" with
6
+ * honest per-check dispositions (pass / fail / no_data / corrupt / error per
7
+ * the #2470 tri-state evidence semantics; "no data" is NEVER a pass).
8
+ *
9
+ * Read classes (empirically verified against the repo's readers):
10
+ * - Direct file reads on the evaluated directory: `loadPlanJsonOnly`
11
+ * (pure parse), `readTaskEvidenceState` / `deriveRequiredGates` /
12
+ * `hasPassedAllGates` (pure `.swarm/evidence` reads), `loadEvidence` /
13
+ * `listEvidenceTaskIds` (pure bundle reads), and the shared
14
+ * evidence-quality computation in `src/ci/quality-checks.ts`.
15
+ * - Shadow-copy reads: `isPlanCriticApproved` and
16
+ * `getProfileLookupForIdentity` are mediated by the ledger/profile SQLite
17
+ * store; opening it creates WAL sidecars (and may run the legacy-jsonl
18
+ * import), which would MUTATE the evaluated repo. They therefore run
19
+ * against a discarded temp copy of `.swarm/` so the advisory run is
20
+ * strictly read-only for the repo (frozen check C7). The copy is bounded
21
+ * and removed in cleanup.
22
+ *
23
+ * Host-decoupling contract: no host client handle, no live plugin session
24
+ * state, no subprocess, no config load — a scrubbed CI environment
25
+ * (env -i, no TTY, no opencode binary) is the supported operating mode.
26
+ */
27
+ import { type QaGates } from '../db/qa-gate-profile.js';
28
+ /** Workflow snapshot states that count as terminal success for a task.
29
+ * Derived from WORKFLOW_STATE_RANK in src/gate-evidence.ts, where
30
+ * 'complete' (8) and 'closed' (7) are the only terminal-success ranks; any
31
+ * other state (rework_required, reviewer_run, coder_delegated, ...) means
32
+ * the task is not demonstrably finished and must not pass vacuously. */
33
+ export declare const TERMINAL_SUCCESS_STATES: readonly ["complete", "closed"];
34
+ /** Upper bound for the `.swarm/` shadow copy. A repo whose durable state is
35
+ * larger than this skips the DB-mediated reads (reported as not_evaluable)
36
+ * rather than copying unbounded data into a temp dir. */
37
+ export declare const MAX_SHADOW_COPY_BYTES: number;
38
+ export type AdvisoryCiGateStatus = 'pass' | 'fail' | 'no_data' | 'corrupt' | 'error';
39
+ export interface AdvisoryCiGateRow {
40
+ name: string;
41
+ status: AdvisoryCiGateStatus;
42
+ detail?: string;
43
+ }
44
+ export interface AdvisoryCiTaskEntry {
45
+ task_id: string;
46
+ evidence_state: 'valid' | 'missing' | 'corrupt' | 'error';
47
+ required_gates: string[];
48
+ missing_gates: string[];
49
+ workflow_state?: string;
50
+ satisfied: boolean;
51
+ }
52
+ export interface AdvisoryCiReport {
53
+ version: 1;
54
+ verdict: 'pass' | 'fail';
55
+ /** Evaluation exits come from the runtime; `cancelled`/`deadline`/`error`
56
+ * are emitted by the command layer when evaluation never completed, so
57
+ * every `version: 1` payload shares one shape regardless of exit code. */
58
+ exit_reason: 'all_gates_passed' | 'plan_missing' | 'plan_corrupt' | 'no_tasks' | 'gate_violations' | 'cancelled' | 'deadline' | 'error';
59
+ gates: AdvisoryCiGateRow[];
60
+ tasks: AdvisoryCiTaskEntry[];
61
+ plan: {
62
+ present: boolean;
63
+ title?: string;
64
+ swarm?: string;
65
+ task_count: number;
66
+ };
67
+ environment: {
68
+ mode: 'advisory';
69
+ tty: boolean;
70
+ host: 'none';
71
+ };
72
+ gate_profile: 'default' | 'profile';
73
+ effective_gates: QaGates;
74
+ /** Enabled gates that have no durable whole-plan reader are listed here
75
+ * rather than silently omitted or vacuously passed. */
76
+ not_evaluated: Array<{
77
+ name: string;
78
+ reason: string;
79
+ }>;
80
+ /** Checks that cannot be evaluated headless (live plugin state). */
81
+ not_evaluable: Array<{
82
+ name: string;
83
+ reason: string;
84
+ }>;
85
+ counts: {
86
+ pass: number;
87
+ fail: number;
88
+ no_data: number;
89
+ corrupt: number;
90
+ error: number;
91
+ };
92
+ }
93
+ export interface EvaluateAdvisoryCiOptions {
94
+ directory: string;
95
+ /** Captured once before any output; the report channel is stdout. */
96
+ tty: boolean;
97
+ journal?: (type: string, detail?: string) => void;
98
+ registerCleanup?: (fn: () => void) => void;
99
+ }
100
+ export declare function evaluateAdvisoryCi(options: EvaluateAdvisoryCiOptions): Promise<AdvisoryCiReport>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Public surface of the host-decoupled advisory CI runtime (issue #2497).
3
+ *
4
+ * Single import point for downstream consumers — the composite GitHub
5
+ * Action (#2498) and the read-only MCP verification surface (#2499) — and
6
+ * for the `swarm ci` command handler (src/commands/ci.ts). Everything the
7
+ * runtime exposes is re-exported here; nothing under src/ci/ is meant to be
8
+ * imported by path from outside this directory.
9
+ */
10
+ export { type AdvisoryCiGateRow, type AdvisoryCiGateStatus, type AdvisoryCiReport, type AdvisoryCiTaskEntry, type EvaluateAdvisoryCiOptions, evaluateAdvisoryCi, MAX_SHADOW_COPY_BYTES, TERMINAL_SUCCESS_STATES, } from './evaluate.js';
11
+ export { CI_QUALITY_THRESHOLDS, computeEvidenceQualitySummary, type EvidenceQualitySummary, } from './quality-checks.js';
12
+ export { renderFullReport, renderJsonBlock, renderMarkdownReport, SWARM_CI_JSON_CLOSE, SWARM_CI_JSON_OPEN, } from './report.js';
13
+ export { type CiEvaluateContext, type CiRunEvent, type CiRunOutcome, type CiRunResult, type CiRuntimeOptions, MAX_CI_JOURNAL_EVENTS, runAdvisoryCiRuntime, } from './runtime.js';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Shared evidence-quality computation (issue #2497, plan D2).
3
+ *
4
+ * Extracted verbatim from `src/commands/benchmark.ts` (the cumulative
5
+ * evidence aggregation loop) so the plugin surface
6
+ * (`/swarm benchmark --ci-gate`) and the host-decoupled advisory surface
7
+ * (`swarm ci`) evaluate evidence-derived quality signals through ONE
8
+ * implementation. `benchmark.ts` consumes `computeEvidenceQualitySummary`
9
+ * directly; the advisory evaluator additionally maps "no evidence data" to
10
+ * an honest `no_data` disposition instead of benchmark's
11
+ * pass-on-no-evidence semantics (which are preserved here byte-for-byte for
12
+ * the benchmark path).
13
+ *
14
+ * Host-decoupling contract: filesystem-only reads (evidence bundles under
15
+ * `.swarm/evidence/`); no host client, no session state.
16
+ */
17
+ /** CI threshold constants (unchanged values, moved from benchmark.ts so both
18
+ * consumers share one definition). */
19
+ export declare const CI_QUALITY_THRESHOLDS: {
20
+ readonly review_pass_rate: 70;
21
+ readonly test_pass_rate: 80;
22
+ readonly max_agent_error_rate: 20;
23
+ readonly max_hard_limit_hits: 1;
24
+ readonly max_complexity_delta: 5;
25
+ readonly max_public_api_delta: 10;
26
+ readonly max_duplication_ratio: 5;
27
+ readonly min_test_to_code_ratio: 30;
28
+ };
29
+ export interface EvidenceQualitySummary {
30
+ reviewPassRate: number | null;
31
+ testPassRate: number | null;
32
+ totalReviews: number;
33
+ testsPassed: number;
34
+ testsFailed: number;
35
+ additions: number;
36
+ deletions: number;
37
+ qualityMetrics: {
38
+ complexityDelta: number;
39
+ publicApiDelta: number;
40
+ duplicationRatio: number;
41
+ testToCodeRatio: number;
42
+ thresholds: {
43
+ maxComplexityDelta: number;
44
+ maxPublicApiDelta: number;
45
+ maxDuplicationRatio: number;
46
+ minTestToCodeRatio: number;
47
+ };
48
+ hasEvidence: boolean;
49
+ };
50
+ }
51
+ /**
52
+ * Aggregate review/test/diff/quality-budget signals across every evidence
53
+ * bundle under `.swarm/evidence/`. Behavior-identical to the loop that used
54
+ * to live inline in `handleBenchmarkCommand` (same rounding, same warn()
55
+ * side effects on corrupt/unknown entries) so benchmark output stays
56
+ * byte-compatible after the extraction.
57
+ */
58
+ export declare function computeEvidenceQualitySummary(directory: string): Promise<EvidenceQualitySummary>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Markdown + JSON rendering for `swarm ci` (issue #2497).
3
+ *
4
+ * Output contract (frozen checks C2/C4):
5
+ * - default output: a Markdown report with per-gate/per-task tables plus a
6
+ * fenced machine block — `[SWARM_CI_JSON]` … `[/SWARM_CI_JSON]` — holding
7
+ * the pretty-printed report JSON (mirrors the `[BENCHMARK_JSON]`
8
+ * precedent);
9
+ * - `--json`: the machine block only.
10
+ *
11
+ * Diagnostics embed bounded, lossy-safe excerpts: evidence paths are ASCII,
12
+ * and any corrupt-evidence excerpt passes through Node's UTF-8 replacement
13
+ * decoding, so unparseable bytes degrade to U+FFFD rather than throwing.
14
+ */
15
+ import type { AdvisoryCiReport } from './evaluate.js';
16
+ export declare const SWARM_CI_JSON_OPEN = "[SWARM_CI_JSON]";
17
+ export declare const SWARM_CI_JSON_CLOSE = "[/SWARM_CI_JSON]";
18
+ export declare function renderJsonBlock(report: AdvisoryCiReport): string;
19
+ export declare function renderMarkdownReport(report: AdvisoryCiReport): string;
20
+ /** Full default output: Markdown report + machine block. */
21
+ export declare function renderFullReport(report: AdvisoryCiReport): string;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Host-decoupled bounded advisory-CI runtime (issue #2497).
3
+ *
4
+ * This module is the execution harness for `swarm ci`: it owns the five
5
+ * bounded-execution obligations the issue names — bounded startup, bounded
6
+ * evaluation ("health wait" for the run's own progress), cancellation,
7
+ * bounded event streaming, and cleanup — while the evaluation itself lives
8
+ * in `src/ci/evaluate.ts` and only ever composes the existing authoritative
9
+ * readers.
10
+ *
11
+ * Host-decoupling contract (frozen check C1 / ratchet
12
+ * tests/unit/ci/host-decoupling-ratchet.test.ts): this module and its
13
+ * siblings under `src/ci/` must never read the OpenCode host
14
+ * client handle or the plugin's live in-process session state.
15
+ * Advisory evaluation spawns no subprocess and opens no host connection;
16
+ * if a later phase needs one, `runExternalTool`
17
+ * (src/utils/external-tool-runner.ts) is the designated bounded supervisor —
18
+ * do not add supervisor code here without a production caller.
19
+ *
20
+ * SQLite note (AGENTS.md invariant 2 / #1873): this runtime must not open
21
+ * `.swarm/swarm.db` itself. DB-mediated reads (gate profiles, plan-critic
22
+ * snapshots) route through the existing readers in `src/db/qa-gate-profile.ts`
23
+ * and `src/hooks/delegation-gate.ts`, executed against a discarded shadow
24
+ * copy of `.swarm/` managed by `src/ci/evaluate.ts` so the evaluated repo is
25
+ * never mutated (frozen check C7).
26
+ */
27
+ import type { AdvisoryCiReport } from './evaluate.js';
28
+ /** Bounded run-journal cap. One event per stage/task/check — not per log
29
+ * line — so 200 covers large plans while still bounding memory. Mirrors the
30
+ * named-cap pattern of MAX_PENDING_ADVISORIES (src/utils/advisory-queue.ts). */
31
+ export declare const MAX_CI_JOURNAL_EVENTS = 200;
32
+ /** Terminal outcome vocabulary for an advisory CI run. */
33
+ export type CiRunOutcome = 'pass' | 'violations' | 'cancelled' | 'deadline' | 'error';
34
+ export interface CiRunEvent {
35
+ seq: number;
36
+ type: string;
37
+ detail?: string;
38
+ }
39
+ /** Context handed to the evaluation callback. */
40
+ export interface CiEvaluateContext {
41
+ /** Append a bounded journal event. */
42
+ journal: (type: string, detail?: string) => void;
43
+ /** Register a cleanup callback; all callbacks run exactly once in the
44
+ * runtime's finally block (even on cancel/deadline/error). */
45
+ registerCleanup: (fn: () => void) => void;
46
+ /** Trips when the caller aborts (SIGINT/SIGTERM at the CLI layer). */
47
+ signal: AbortSignal;
48
+ /** Milliseconds remaining until the overall deadline (monotonic-ish;
49
+ * recomputed per stage). */
50
+ remainingMs: () => number;
51
+ }
52
+ export interface CiRuntimeOptions {
53
+ directory: string;
54
+ /** Overall deadline for the whole run. Default 300s; clamps to >=1ms. */
55
+ deadlineMs?: number;
56
+ /** Caller-owned abort source (CLI wires SIGINT/SIGTERM). */
57
+ signal?: AbortSignal;
58
+ /** The evaluation to run under the harness. */
59
+ evaluate: (ctx: CiEvaluateContext) => Promise<AdvisoryCiReport>;
60
+ }
61
+ export interface CiRunResult {
62
+ outcome: CiRunOutcome;
63
+ /** Present for 'pass' and 'violations'; absent for cancel/deadline/error. */
64
+ report?: AdvisoryCiReport;
65
+ journal: CiRunEvent[];
66
+ /** Events dropped because the journal cap was exceeded. */
67
+ journalTruncated: number;
68
+ /** True when every registered cleanup callback has run. */
69
+ cleanupRan: boolean;
70
+ /** Error detail for 'error'/'deadline'/'cancelled' outcomes. */
71
+ detail?: string;
72
+ }
73
+ /**
74
+ * Run one advisory evaluation under bounded-execution semantics.
75
+ *
76
+ * Bounds: every stage is raced against both the caller's abort signal and
77
+ * the overall deadline; the journal is capped; cleanup callbacks run exactly
78
+ * once in `finally`. The evaluation callback receives the context above and
79
+ * must not outlive the runtime (cleanup disposes its resources).
80
+ */
81
+ export declare function runAdvisoryCiRuntime(options: CiRuntimeOptions): Promise<CiRunResult>;
@@ -8,7 +8,7 @@ import {
8
8
  isBubblewrapAvailable,
9
9
  isSandboxExecAvailable,
10
10
  isWindowsSandboxAvailable
11
- } from "./index-q1r1cfww.js";
11
+ } from "./index-76qm2c2y.js";
12
12
  import"./index-yzjaj53h.js";
13
13
  import"./index-zgwm4ryv.js";
14
14
  import"./index-a76rekgs.js";
@@ -13,19 +13,19 @@ import {
13
13
  releaseCoderDispatchOwnership,
14
14
  settleCoderDispatch,
15
15
  transferCoderSettlementToBackground
16
- } from "./index-j0bxxz9d.js";
17
- import"./index-5zqakgp4.js";
18
- import"./index-bvqqwx84.js";
19
- import"./index-gmpmgtzn.js";
20
- import"./index-qkwtth00.js";
21
- import"./index-kear8gb7.js";
22
- import"./index-p612v1mv.js";
23
- import"./index-a8xbvsse.js";
24
- import"./index-qwsh0h2g.js";
25
- import"./index-4r5pmtvk.js";
16
+ } from "./index-5bbem0ey.js";
17
+ import"./index-fhh02gwx.js";
18
+ import"./index-nyn01yrz.js";
19
+ import"./index-06rbdzqn.js";
20
+ import"./index-59fcfpkh.js";
21
+ import"./index-b3pmzbh1.js";
22
+ import"./index-2s7dvzff.js";
23
+ import"./index-fgp96k3r.js";
24
+ import"./index-5qt9yf5w.js";
25
+ import"./index-bx1wgn3a.js";
26
26
  import"./index-7g4c7s5r.js";
27
- import"./index-v3xc4sde.js";
28
- import"./index-z6qreakh.js";
27
+ import"./index-nprdr0sm.js";
28
+ import"./index-nbdmdyke.js";
29
29
  import"./index-1xnse449.js";
30
30
  import"./index-ee6ydtfe.js";
31
31
  import"./index-0mhftbpp.js";
@@ -14,11 +14,11 @@ import {
14
14
  shouldRunOnStartup,
15
15
  writeBackupArtifact,
16
16
  writeDoctorArtifact
17
- } from "./index-5g6rhkn7.js";
17
+ } from "./index-ye43mdfm.js";
18
18
  import"./index-cw912re7.js";
19
19
  import"./index-ry16d01s.js";
20
20
  import"./index-ee6ydtfe.js";
21
- import"./index-apy1qfj0.js";
21
+ import"./index-4wc5gfgm.js";
22
22
  import"./index-sxt7fgcw.js";
23
23
  import"./index-bk5tah7q.js";
24
24
  import"./index-bpmtbmy9.js";
@@ -14,8 +14,11 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-qkwtth00.js";
18
- import"./index-p612v1mv.js";
17
+ } from "./index-59fcfpkh.js";
18
+ import"./index-b3pmzbh1.js";
19
+ import"./index-2s7dvzff.js";
20
+ import"./index-nbdmdyke.js";
21
+ import"./index-1xnse449.js";
19
22
  import"./index-ee6ydtfe.js";
20
23
  import"./index-0mhftbpp.js";
21
24
  import"./index-a1w58b47.js";
@@ -5,14 +5,14 @@ import {
5
5
  authorizeCuration,
6
6
  buildConfigFingerprintInput,
7
7
  readCohortConfigFingerprint
8
- } from "./index-m35hybf0.js";
8
+ } from "./index-bm5xrfnx.js";
9
9
  import"./index-rtry5xyf.js";
10
10
  import"./index-vzm6zre7.js";
11
- import"./index-8ybjqg51.js";
12
- import"./index-4r5pmtvk.js";
11
+ import"./index-9ttqbhvw.js";
12
+ import"./index-bx1wgn3a.js";
13
13
  import"./index-7g4c7s5r.js";
14
- import"./index-v3xc4sde.js";
15
- import"./index-z6qreakh.js";
14
+ import"./index-nprdr0sm.js";
15
+ import"./index-nbdmdyke.js";
16
16
  import"./index-1xnse449.js";
17
17
  import"./index-ee6ydtfe.js";
18
18
  import"./index-bpmtbmy9.js";
@@ -4,23 +4,23 @@ import {
4
4
  getGlobalEventBus,
5
5
  getGroupCommitWriter,
6
6
  importLegacyJsonFiles
7
- } from "./index-nwwk3dej.js";
7
+ } from "./index-cgpwjctj.js";
8
8
  import {
9
9
  readEffectiveSpecSync
10
10
  } from "./index-9br68j86.js";
11
11
  import {
12
12
  readSwarmFileAsync
13
- } from "./index-kear8gb7.js";
14
- import"./index-p612v1mv.js";
13
+ } from "./index-b3pmzbh1.js";
14
+ import"./index-2s7dvzff.js";
15
15
  import"./index-n832052r.js";
16
16
  import {
17
17
  DURABILITY_CLASSES,
18
18
  getProjectDb,
19
19
  projectDbExists
20
- } from "./index-wst6n478.js";
20
+ } from "./index-dvbf6fpn.js";
21
21
  import"./index-rdm3px0g.js";
22
22
  import"./index-ry16d01s.js";
23
- import"./index-v3xc4sde.js";
23
+ import"./index-nbdmdyke.js";
24
24
  import"./index-1xnse449.js";
25
25
  import"./index-ee6ydtfe.js";
26
26
  import"./index-a1w58b47.js";
@@ -0,0 +1,72 @@
1
+ // @bun
2
+ import {
3
+ createCuratorLLMDelegate
4
+ } from "./index-j144fgk8.js";
5
+ import"./index-5400m33a.js";
6
+ import"./index-7h01bkm6.js";
7
+ import"./index-zw3hkzch.js";
8
+ import"./index-cgpwjctj.js";
9
+ import"./index-ye43mdfm.js";
10
+ import"./index-3p3y55xg.js";
11
+ import"./index-xnpjwc4h.js";
12
+ import"./index-txdagbh7.js";
13
+ import"./index-9br68j86.js";
14
+ import"./index-cw912re7.js";
15
+ import"./index-9xk97bcf.js";
16
+ import"./index-r1z8nrb6.js";
17
+ import"./index-3eh2n3dx.js";
18
+ import"./index-fyfbpz4f.js";
19
+ import"./index-gfbggp8k.js";
20
+ import"./index-0hgmsyfp.js";
21
+ import"./index-zsrtt42s.js";
22
+ import"./index-5bbem0ey.js";
23
+ import"./index-fhh02gwx.js";
24
+ import"./index-nyn01yrz.js";
25
+ import"./index-b43rt5ph.js";
26
+ import"./index-q7sjgr1y.js";
27
+ import"./index-06rbdzqn.js";
28
+ import"./index-59fcfpkh.js";
29
+ import"./index-0xprxg95.js";
30
+ import"./index-8w1mrvbd.js";
31
+ import"./index-b3pmzbh1.js";
32
+ import"./index-2s7dvzff.js";
33
+ import"./index-31sqcdsd.js";
34
+ import"./index-bm5xrfnx.js";
35
+ import"./index-rtry5xyf.js";
36
+ import"./index-mjn6aqqk.js";
37
+ import"./index-3qf1vxtb.js";
38
+ import"./index-n832052r.js";
39
+ import"./index-3axdtaf0.js";
40
+ import"./index-pw00xcj0.js";
41
+ import"./index-fgp96k3r.js";
42
+ import"./index-br3mvbsa.js";
43
+ import"./index-bernkwgf.js";
44
+ import"./index-dvbf6fpn.js";
45
+ import"./index-rdm3px0g.js";
46
+ import"./index-ry16d01s.js";
47
+ import"./index-5qt9yf5w.js";
48
+ import"./index-ssx8087p.js";
49
+ import"./index-vzm6zre7.js";
50
+ import"./index-ae75rja9.js";
51
+ import"./index-9ttqbhvw.js";
52
+ import"./index-bx1wgn3a.js";
53
+ import"./index-7g4c7s5r.js";
54
+ import"./index-nprdr0sm.js";
55
+ import"./index-nbdmdyke.js";
56
+ import"./index-1xnse449.js";
57
+ import"./index-ee6ydtfe.js";
58
+ import"./index-td6xrw55.js";
59
+ import"./index-0mhftbpp.js";
60
+ import"./index-a1w58b47.js";
61
+ import"./index-4wc5gfgm.js";
62
+ import"./index-sxt7fgcw.js";
63
+ import"./index-bk5tah7q.js";
64
+ import"./index-bpmtbmy9.js";
65
+ import"./index-zpsr8rpc.js";
66
+ import"./index-76qm2c2y.js";
67
+ import"./index-yzjaj53h.js";
68
+ import"./index-zgwm4ryv.js";
69
+ import"./index-a76rekgs.js";
70
+ export {
71
+ createCuratorLLMDelegate
72
+ };
@@ -14,68 +14,69 @@ import {
14
14
  runCuratorInit,
15
15
  runCuratorPhase,
16
16
  writeCuratorSummary
17
- } from "./index-kkmezerc.js";
18
- import"./index-d5qf7hvh.js";
19
- import"./index-qhey6vc3.js";
20
- import"./index-chebm5h5.js";
21
- import"./index-nwwk3dej.js";
22
- import"./index-5g6rhkn7.js";
23
- import"./index-w1dfkp1q.js";
24
- import"./index-gp9yzr1v.js";
17
+ } from "./index-j144fgk8.js";
18
+ import"./index-5400m33a.js";
19
+ import"./index-7h01bkm6.js";
20
+ import"./index-zw3hkzch.js";
21
+ import"./index-cgpwjctj.js";
22
+ import"./index-ye43mdfm.js";
23
+ import"./index-3p3y55xg.js";
24
+ import"./index-xnpjwc4h.js";
25
25
  import"./index-txdagbh7.js";
26
26
  import"./index-9br68j86.js";
27
27
  import"./index-cw912re7.js";
28
- import"./index-xhb4gryr.js";
29
- import"./index-bw9x8d8n.js";
30
- import"./index-9b2105n0.js";
28
+ import"./index-9xk97bcf.js";
29
+ import"./index-r1z8nrb6.js";
30
+ import"./index-3eh2n3dx.js";
31
31
  import"./index-fyfbpz4f.js";
32
- import"./index-dfyv3xkd.js";
32
+ import"./index-gfbggp8k.js";
33
+ import"./index-0hgmsyfp.js";
33
34
  import"./index-zsrtt42s.js";
34
- import"./index-j0bxxz9d.js";
35
- import"./index-5zqakgp4.js";
36
- import"./index-bvqqwx84.js";
35
+ import"./index-5bbem0ey.js";
36
+ import"./index-fhh02gwx.js";
37
+ import"./index-nyn01yrz.js";
37
38
  import"./index-b43rt5ph.js";
38
39
  import"./index-q7sjgr1y.js";
39
- import"./index-gmpmgtzn.js";
40
- import"./index-qkwtth00.js";
41
- import"./index-f1fps3w9.js";
42
- import"./index-6df6wbvj.js";
43
- import"./index-kear8gb7.js";
44
- import"./index-p612v1mv.js";
45
- import"./index-qthc56c4.js";
46
- import"./index-m35hybf0.js";
40
+ import"./index-06rbdzqn.js";
41
+ import"./index-59fcfpkh.js";
42
+ import"./index-0xprxg95.js";
43
+ import"./index-8w1mrvbd.js";
44
+ import"./index-b3pmzbh1.js";
45
+ import"./index-2s7dvzff.js";
46
+ import"./index-31sqcdsd.js";
47
+ import"./index-bm5xrfnx.js";
47
48
  import"./index-rtry5xyf.js";
48
- import"./index-xkf3672y.js";
49
+ import"./index-mjn6aqqk.js";
49
50
  import"./index-3qf1vxtb.js";
50
51
  import"./index-n832052r.js";
51
- import"./index-y85aptep.js";
52
- import"./index-gh9ybrrs.js";
53
- import"./index-a8xbvsse.js";
54
- import"./index-pyf517sz.js";
55
- import"./index-h439y187.js";
56
- import"./index-wst6n478.js";
52
+ import"./index-3axdtaf0.js";
53
+ import"./index-pw00xcj0.js";
54
+ import"./index-fgp96k3r.js";
55
+ import"./index-br3mvbsa.js";
56
+ import"./index-bernkwgf.js";
57
+ import"./index-dvbf6fpn.js";
57
58
  import"./index-rdm3px0g.js";
58
59
  import"./index-ry16d01s.js";
59
- import"./index-qwsh0h2g.js";
60
- import"./index-2xbww1x0.js";
60
+ import"./index-5qt9yf5w.js";
61
+ import"./index-ssx8087p.js";
61
62
  import"./index-vzm6zre7.js";
62
63
  import"./index-ae75rja9.js";
63
- import"./index-8ybjqg51.js";
64
- import"./index-4r5pmtvk.js";
64
+ import"./index-9ttqbhvw.js";
65
+ import"./index-bx1wgn3a.js";
65
66
  import"./index-7g4c7s5r.js";
66
- import"./index-v3xc4sde.js";
67
- import"./index-z6qreakh.js";
67
+ import"./index-nprdr0sm.js";
68
+ import"./index-nbdmdyke.js";
68
69
  import"./index-1xnse449.js";
69
70
  import"./index-ee6ydtfe.js";
70
- import"./index-91ww9hyr.js";
71
+ import"./index-td6xrw55.js";
71
72
  import"./index-0mhftbpp.js";
72
73
  import"./index-a1w58b47.js";
73
- import"./index-apy1qfj0.js";
74
+ import"./index-4wc5gfgm.js";
74
75
  import"./index-sxt7fgcw.js";
75
76
  import"./index-bk5tah7q.js";
76
77
  import"./index-bpmtbmy9.js";
77
78
  import"./index-zpsr8rpc.js";
78
- import"./index-q1r1cfww.js";
79
+ import"./index-76qm2c2y.js";
79
80
  import"./index-yzjaj53h.js";
80
81
  import"./index-zgwm4ryv.js";
81
82
  import"./index-a76rekgs.js";
@@ -11,8 +11,8 @@ import {
11
11
  defaultTestFilesFor,
12
12
  detectProjectLanguages,
13
13
  tokenizeCommand
14
- } from "./index-d5qf7hvh.js";
15
- import"./index-p612v1mv.js";
14
+ } from "./index-5400m33a.js";
15
+ import"./index-2s7dvzff.js";
16
16
  import {
17
17
  canonicalRootKeyFreshAsync,
18
18
  canonicalRootKeyLexical