opencode-swarm 7.169.0 → 7.170.1

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 (71) hide show
  1. package/README.md +1 -0
  2. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  3. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  4. package/dist/agents/reviewer-directive-compliance.d.ts +23 -7
  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-fd6ba876.js → coder-settlement-g1n2dk0a.js} +3 -3
  12. package/dist/cli/{config-doctor-zeppqwwx.js → config-doctor-7v7hvdgw.js} +2 -2
  13. package/dist/cli/{core-fj1afc31.js → core-mz3rae1q.js} +1 -1
  14. package/dist/cli/{curator-llm-factory-4t773tmz.js → curator-llm-factory-xaetdtgf.js} +20 -20
  15. package/dist/cli/{curator-emftndv0.js → curator-x28dw2mf.js} +20 -20
  16. package/dist/cli/{evidence-summary-service-51b69jc3.js → evidence-summary-service-kd22mp04.js} +7 -7
  17. package/dist/cli/{gate-evidence-53s161wb.js → gate-evidence-9snb217d.js} +2 -2
  18. package/dist/cli/{guardrail-explain-mhx8gt8q.js → guardrail-explain-11zswj2c.js} +21 -21
  19. package/dist/cli/{guardrail-log-xg6hrdsq.js → guardrail-log-ykwrswvw.js} +3 -3
  20. package/dist/cli/{guardrail-reset-fgv5kt5x.js → guardrail-reset-7affkkeq.js} +20 -20
  21. package/dist/cli/{hive-promoter-41zygtgx.js → hive-promoter-sfzrcn03.js} +20 -20
  22. package/dist/cli/{index-83m0y4cj.js → index-0hjtck07.js} +3 -3
  23. package/dist/cli/{index-q1r1cfww.js → index-76qm2c2y.js} +37 -26
  24. package/dist/cli/{index-8x9keek6.js → index-8b2aqj41.js} +28 -22
  25. package/dist/cli/{index-c7kr7tnk.js → index-987ga2vy.js} +3 -3
  26. package/dist/cli/{index-yj24ny5k.js → index-9z0dc1t5.js} +1 -1
  27. package/dist/cli/{index-dd48vt27.js → index-as43fjha.js} +3 -3
  28. package/dist/cli/{index-exf0j569.js → index-bqscvndc.js} +1 -1
  29. package/dist/cli/{index-3zcds757.js → index-bswpngg6.js} +3372 -2500
  30. package/dist/cli/{index-sb1s03y9.js → index-d6q0g0nd.js} +3 -3
  31. package/dist/cli/{index-2znfa537.js → index-ensg0pt6.js} +1 -1
  32. package/dist/cli/{index-sxcfszbe.js → index-g0qsftdd.js} +1 -1
  33. package/dist/cli/{index-3bfzpzsb.js → index-hp729z5v.js} +1 -1
  34. package/dist/cli/{index-1cbjemgh.js → index-hzav6zra.js} +2 -2
  35. package/dist/cli/{index-ksybszed.js → index-knh5z9gb.js} +1 -1
  36. package/dist/cli/{index-5reh1bjz.js → index-krzb4zkx.js} +1 -1
  37. package/dist/cli/{index-76ng6vmq.js → index-q5q42mf3.js} +4 -4
  38. package/dist/cli/{index-0vgs5r39.js → index-qv1y6f8r.js} +3 -3
  39. package/dist/cli/{index-egkc2bpv.js → index-r1yqx3h9.js} +1 -1
  40. package/dist/cli/{index-e4dxf5cr.js → index-rkc1a0ym.js} +20 -20
  41. package/dist/cli/{index-s96dpjsk.js → index-rp0dpvd2.js} +2 -2
  42. package/dist/cli/{index-zapc8vj4.js → index-rwdfk03c.js} +4 -4
  43. package/dist/cli/{index-wwr67xc0.js → index-tz3jzz2t.js} +1 -1
  44. package/dist/cli/{index-55fkkjec.js → index-v5gsvtvs.js} +5 -5
  45. package/dist/cli/{index-nwv3e3kc.js → index-wc34rqj0.js} +1 -1
  46. package/dist/cli/{index-p6xsgk4r.js → index-z970hmyt.js} +2 -2
  47. package/dist/cli/index.js +25 -20
  48. package/dist/cli/{knowledge-escalator-07s44av0.js → knowledge-escalator-s0y3m4sn.js} +6 -6
  49. package/dist/cli/{knowledge-events-j2n1569p.js → knowledge-events-w7vjypwy.js} +4 -4
  50. package/dist/cli/{knowledge-store-85metj89.js → knowledge-store-bc2v557f.js} +1 -1
  51. package/dist/cli/{knowledge-validator-63k1xzcc.js → knowledge-validator-adaamxzg.js} +2 -2
  52. package/dist/cli/{pending-delegations-dckmjymn.js → pending-delegations-fzjr7p7f.js} +2 -2
  53. package/dist/cli/{pr-subscriptions-pyh73me6.js → pr-subscriptions-tfwf461r.js} +1 -1
  54. package/dist/cli/{pr-workflow-gate-k1r4rjw4.js → pr-workflow-gate-heajnnkw.js} +20 -20
  55. package/dist/cli/{scan-cursor-k6egg4n0.js → scan-cursor-512cqk7t.js} +2 -2
  56. package/dist/cli/{schema-vdrtpggt.js → schema-z9kd66wf.js} +1 -1
  57. package/dist/cli/{scope-persistence-h1mmww19.js → scope-persistence-8cpqcwg7.js} +5 -5
  58. package/dist/cli/{skill-generator-pmn6gmvk.js → skill-generator-1efdbkqh.js} +7 -7
  59. package/dist/cli/{snapshot-coordination-init-rspykgd0.js → snapshot-coordination-init-fsf8h4d3.js} +20 -20
  60. package/dist/cli/{worktree-collision-ownership-x84dzzzc.js → worktree-collision-ownership-zdpeepe4.js} +2 -2
  61. package/dist/cli/{worktree-isolation-nw9pakkx.js → worktree-isolation-zswrjstb.js} +20 -20
  62. package/dist/commands/ci.d.ts +40 -0
  63. package/dist/commands/index.d.ts +1 -0
  64. package/dist/commands/registry.d.ts +8 -0
  65. package/dist/hooks/gate-denial-tracker.d.ts +18 -14
  66. package/dist/hooks/phase-complete-directive-gate.d.ts +13 -0
  67. package/dist/hooks/phase-directives.d.ts +31 -2
  68. package/dist/hooks/reviewer-verdict-parser.d.ts +6 -1
  69. package/dist/index.js +449 -439
  70. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +48 -11
  71. package/package.json +1 -1
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) |
@@ -17,6 +17,17 @@
17
17
  import type { DirectivePriority } from '../hooks/knowledge-types.js';
18
18
  /** Marker tag wrapping the per-phase "directives to verify" block. */
19
19
  export declare const DIRECTIVES_TO_VERIFY_TAG = "<directives_to_verify>";
20
+ /**
21
+ * Hard character ceiling for the rendered compliance block (issue #2628,
22
+ * mirroring the #2045 delegate-block bound). The effective budget is
23
+ * `min(inject_char_budget ?? DIRECTIVE_COMPLIANCE_DEFAULT_CHAR_BUDGET,
24
+ * DIRECTIVE_COMPLIANCE_HARD_CHAR_CAP)`; overflow drops NON-critical entries
25
+ * only — critical obligations are always rendered (see below), so a phase's
26
+ * blocking set can never be hidden from the one agent that resolves it.
27
+ */
28
+ export declare const DIRECTIVE_COMPLIANCE_HARD_CHAR_CAP = 24000;
29
+ /** Default budget when the caller has no configured injection budget. */
30
+ export declare const DIRECTIVE_COMPLIANCE_DEFAULT_CHAR_BUDGET = 24000;
20
31
  /** A directive the reviewer must produce a verdict for. */
21
32
  export interface DirectiveToVerify {
22
33
  /** Exact retrieval membership this verdict must close. */
@@ -26,7 +37,7 @@ export interface DirectiveToVerify {
26
37
  session_id: string;
27
38
  cohort_id?: string;
28
39
  source_link_id?: string;
29
- prior_terminal_outcome?: 'violated';
40
+ prior_terminal_outcome?: 'violated' | 'contradicted';
30
41
  prior_terminal_event_id?: string;
31
42
  priority: DirectivePriority;
32
43
  lesson?: string;
@@ -34,20 +45,25 @@ export interface DirectiveToVerify {
34
45
  }
35
46
  /**
36
47
  * Static spec embedded in the reviewer system prompt. Documents the mandatory
37
- * DIRECTIVE_COMPLIANCE output section and its verdict grammar.
48
+ * DIRECTIVE_COMPLIANCE output section and its verdict grammar. Since #2628 the
49
+ * shown set carries at most one obligation per entry, so "every listed pair"
50
+ * is the whole contract — pair identity is still copied exactly.
38
51
  */
39
- export declare const DIRECTIVE_COMPLIANCE_OUTPUT_SPEC = "DIRECTIVE_COMPLIANCE: one line per retrieval membership shown during this phase. Copy the encoded trace_id and entry_id tokens exactly from the DIRECTIVES TO VERIFY block. Use exactly one of:\n VERIFIED:<trace_id>:<entry_id> evidence=<file:line | predicate_passed>\n VIOLATED:<trace_id>:<entry_id> evidence=<file:line | failing_predicate>\n N/A:<trace_id>:<entry_id> reason=<why it does not apply to this change>\nEvery listed trace_id + entry_id pair MUST appear exactly once. The same entry_id may appear under more than one trace_id and requires one verdict per pair. If a directive carries a verification_predicate, you MUST run it and report predicate_passed / failing_predicate as the evidence. Omitting a listed CRITICAL pair is itself a VIOLATED verdict.";
52
+ export declare const DIRECTIVE_COMPLIANCE_OUTPUT_SPEC = "DIRECTIVE_COMPLIANCE: one line per listed obligation. Copy the encoded trace_id and entry_id tokens exactly from the DIRECTIVES TO VERIFY block. Use exactly one of:\n VERIFIED:<trace_id>:<entry_id> evidence=<file:line | predicate_passed>\n VIOLATED:<trace_id>:<entry_id> evidence=<file:line | failing_predicate>\n N/A:<trace_id>:<entry_id> reason=<why it does not apply to this change>\nEvery listed trace_id + entry_id pair MUST appear exactly once in your verdicts. If a directive carries a verification_predicate, you MUST run it and report predicate_passed / failing_predicate as the evidence. Omitting a listed CRITICAL pair is itself a VIOLATED verdict.";
40
53
  /** Encode arbitrary correlation identifiers into one delimiter-safe token. */
41
54
  export declare function encodeDirectiveCorrelationId(value: string): string;
42
55
  /** Decode one correlation token, rejecting malformed or unbounded values. */
43
56
  export declare function decodeDirectiveCorrelationId(token: string): string | null;
44
57
  /**
45
58
  * Render the per-phase "DIRECTIVES TO VERIFY" block injected into the reviewer's
46
- * delegation prompt. Deterministic (sorted by priority then entry + trace).
47
- * Returns null
48
- * when there is nothing to verify (no block emitted).
59
+ * delegation prompt. Deterministic (sorted by priority then entry + trace) and
60
+ * bounded (issue #2628): non-critical entries that no longer fit the effective
61
+ * budget are dropped lowest-priority-first with a count note; CRITICAL entries
62
+ * are always rendered — even beyond the budget, with a distinct overflow notice
63
+ * — because hiding one would permanently block the phase-complete gate. Returns
64
+ * null when there is nothing to verify (no block emitted).
49
65
  */
50
- export declare function buildDirectiveComplianceBlock(directives: DirectiveToVerify[]): string | null;
66
+ export declare function buildDirectiveComplianceBlock(directives: DirectiveToVerify[], charBudget?: number): string | null;
51
67
  /**
52
68
  * Recover the directives a reviewer was asked to verify by parsing a
53
69
  * `<directives_to_verify>` block back out of its delegation prompt. Used by the
@@ -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,11 +13,11 @@ import {
13
13
  releaseCoderDispatchOwnership,
14
14
  settleCoderDispatch,
15
15
  transferCoderSettlementToBackground
16
- } from "./index-sb1s03y9.js";
16
+ } from "./index-d6q0g0nd.js";
17
17
  import"./index-fhh02gwx.js";
18
18
  import"./index-nyn01yrz.js";
19
- import"./index-sxcfszbe.js";
20
- import"./index-wwr67xc0.js";
19
+ import"./index-g0qsftdd.js";
20
+ import"./index-tz3jzz2t.js";
21
21
  import"./index-b3pmzbh1.js";
22
22
  import"./index-2s7dvzff.js";
23
23
  import"./index-fgp96k3r.js";
@@ -14,11 +14,11 @@ import {
14
14
  shouldRunOnStartup,
15
15
  writeBackupArtifact,
16
16
  writeDoctorArtifact
17
- } from "./index-egkc2bpv.js";
17
+ } from "./index-r1yqx3h9.js";
18
18
  import"./index-cw912re7.js";
19
19
  import"./index-ry16d01s.js";
20
20
  import"./index-ee6ydtfe.js";
21
- import"./index-yj24ny5k.js";
21
+ import"./index-9z0dc1t5.js";
22
22
  import"./index-sxt7fgcw.js";
23
23
  import"./index-bk5tah7q.js";
24
24
  import"./index-bpmtbmy9.js";
@@ -14,7 +14,7 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-wwr67xc0.js";
17
+ } from "./index-tz3jzz2t.js";
18
18
  import"./index-b3pmzbh1.js";
19
19
  import"./index-2s7dvzff.js";
20
20
  import"./index-nbdmdyke.js";
@@ -1,43 +1,43 @@
1
1
  // @bun
2
2
  import {
3
3
  createCuratorLLMDelegate
4
- } from "./index-3zcds757.js";
4
+ } from "./index-bswpngg6.js";
5
5
  import"./index-5400m33a.js";
6
6
  import"./index-7h01bkm6.js";
7
- import"./index-5reh1bjz.js";
7
+ import"./index-krzb4zkx.js";
8
8
  import"./index-cgpwjctj.js";
9
- import"./index-egkc2bpv.js";
10
- import"./index-zapc8vj4.js";
9
+ import"./index-r1yqx3h9.js";
10
+ import"./index-rwdfk03c.js";
11
11
  import"./index-xnpjwc4h.js";
12
12
  import"./index-txdagbh7.js";
13
13
  import"./index-9br68j86.js";
14
14
  import"./index-cw912re7.js";
15
- import"./index-c7kr7tnk.js";
16
- import"./index-55fkkjec.js";
17
- import"./index-nwv3e3kc.js";
15
+ import"./index-987ga2vy.js";
16
+ import"./index-v5gsvtvs.js";
17
+ import"./index-wc34rqj0.js";
18
18
  import"./index-fyfbpz4f.js";
19
19
  import"./index-gfbggp8k.js";
20
20
  import"./index-0hgmsyfp.js";
21
21
  import"./index-zsrtt42s.js";
22
- import"./index-sb1s03y9.js";
22
+ import"./index-d6q0g0nd.js";
23
23
  import"./index-fhh02gwx.js";
24
24
  import"./index-nyn01yrz.js";
25
25
  import"./index-b43rt5ph.js";
26
26
  import"./index-q7sjgr1y.js";
27
- import"./index-sxcfszbe.js";
28
- import"./index-wwr67xc0.js";
29
- import"./index-ksybszed.js";
30
- import"./index-0vgs5r39.js";
27
+ import"./index-g0qsftdd.js";
28
+ import"./index-tz3jzz2t.js";
29
+ import"./index-knh5z9gb.js";
30
+ import"./index-qv1y6f8r.js";
31
31
  import"./index-b3pmzbh1.js";
32
32
  import"./index-2s7dvzff.js";
33
- import"./index-2znfa537.js";
33
+ import"./index-ensg0pt6.js";
34
34
  import"./index-bm5xrfnx.js";
35
35
  import"./index-rtry5xyf.js";
36
- import"./index-s96dpjsk.js";
36
+ import"./index-rp0dpvd2.js";
37
37
  import"./index-3qf1vxtb.js";
38
38
  import"./index-n832052r.js";
39
- import"./index-p6xsgk4r.js";
40
- import"./index-83m0y4cj.js";
39
+ import"./index-z970hmyt.js";
40
+ import"./index-0hjtck07.js";
41
41
  import"./index-fgp96k3r.js";
42
42
  import"./index-br3mvbsa.js";
43
43
  import"./index-bernkwgf.js";
@@ -45,7 +45,7 @@ import"./index-dvbf6fpn.js";
45
45
  import"./index-rdm3px0g.js";
46
46
  import"./index-ry16d01s.js";
47
47
  import"./index-5qt9yf5w.js";
48
- import"./index-76ng6vmq.js";
48
+ import"./index-q5q42mf3.js";
49
49
  import"./index-vzm6zre7.js";
50
50
  import"./index-ae75rja9.js";
51
51
  import"./index-9ttqbhvw.js";
@@ -55,15 +55,15 @@ import"./index-nprdr0sm.js";
55
55
  import"./index-nbdmdyke.js";
56
56
  import"./index-1xnse449.js";
57
57
  import"./index-ee6ydtfe.js";
58
- import"./index-3bfzpzsb.js";
58
+ import"./index-hp729z5v.js";
59
59
  import"./index-0mhftbpp.js";
60
60
  import"./index-a1w58b47.js";
61
- import"./index-yj24ny5k.js";
61
+ import"./index-9z0dc1t5.js";
62
62
  import"./index-sxt7fgcw.js";
63
63
  import"./index-bk5tah7q.js";
64
64
  import"./index-bpmtbmy9.js";
65
65
  import"./index-zpsr8rpc.js";
66
- import"./index-q1r1cfww.js";
66
+ import"./index-76qm2c2y.js";
67
67
  import"./index-yzjaj53h.js";
68
68
  import"./index-zgwm4ryv.js";
69
69
  import"./index-a76rekgs.js";
@@ -14,43 +14,43 @@ import {
14
14
  runCuratorInit,
15
15
  runCuratorPhase,
16
16
  writeCuratorSummary
17
- } from "./index-3zcds757.js";
17
+ } from "./index-bswpngg6.js";
18
18
  import"./index-5400m33a.js";
19
19
  import"./index-7h01bkm6.js";
20
- import"./index-5reh1bjz.js";
20
+ import"./index-krzb4zkx.js";
21
21
  import"./index-cgpwjctj.js";
22
- import"./index-egkc2bpv.js";
23
- import"./index-zapc8vj4.js";
22
+ import"./index-r1yqx3h9.js";
23
+ import"./index-rwdfk03c.js";
24
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-c7kr7tnk.js";
29
- import"./index-55fkkjec.js";
30
- import"./index-nwv3e3kc.js";
28
+ import"./index-987ga2vy.js";
29
+ import"./index-v5gsvtvs.js";
30
+ import"./index-wc34rqj0.js";
31
31
  import"./index-fyfbpz4f.js";
32
32
  import"./index-gfbggp8k.js";
33
33
  import"./index-0hgmsyfp.js";
34
34
  import"./index-zsrtt42s.js";
35
- import"./index-sb1s03y9.js";
35
+ import"./index-d6q0g0nd.js";
36
36
  import"./index-fhh02gwx.js";
37
37
  import"./index-nyn01yrz.js";
38
38
  import"./index-b43rt5ph.js";
39
39
  import"./index-q7sjgr1y.js";
40
- import"./index-sxcfszbe.js";
41
- import"./index-wwr67xc0.js";
42
- import"./index-ksybszed.js";
43
- import"./index-0vgs5r39.js";
40
+ import"./index-g0qsftdd.js";
41
+ import"./index-tz3jzz2t.js";
42
+ import"./index-knh5z9gb.js";
43
+ import"./index-qv1y6f8r.js";
44
44
  import"./index-b3pmzbh1.js";
45
45
  import"./index-2s7dvzff.js";
46
- import"./index-2znfa537.js";
46
+ import"./index-ensg0pt6.js";
47
47
  import"./index-bm5xrfnx.js";
48
48
  import"./index-rtry5xyf.js";
49
- import"./index-s96dpjsk.js";
49
+ import"./index-rp0dpvd2.js";
50
50
  import"./index-3qf1vxtb.js";
51
51
  import"./index-n832052r.js";
52
- import"./index-p6xsgk4r.js";
53
- import"./index-83m0y4cj.js";
52
+ import"./index-z970hmyt.js";
53
+ import"./index-0hjtck07.js";
54
54
  import"./index-fgp96k3r.js";
55
55
  import"./index-br3mvbsa.js";
56
56
  import"./index-bernkwgf.js";
@@ -58,7 +58,7 @@ import"./index-dvbf6fpn.js";
58
58
  import"./index-rdm3px0g.js";
59
59
  import"./index-ry16d01s.js";
60
60
  import"./index-5qt9yf5w.js";
61
- import"./index-76ng6vmq.js";
61
+ import"./index-q5q42mf3.js";
62
62
  import"./index-vzm6zre7.js";
63
63
  import"./index-ae75rja9.js";
64
64
  import"./index-9ttqbhvw.js";
@@ -68,15 +68,15 @@ import"./index-nprdr0sm.js";
68
68
  import"./index-nbdmdyke.js";
69
69
  import"./index-1xnse449.js";
70
70
  import"./index-ee6ydtfe.js";
71
- import"./index-3bfzpzsb.js";
71
+ import"./index-hp729z5v.js";
72
72
  import"./index-0mhftbpp.js";
73
73
  import"./index-a1w58b47.js";
74
- import"./index-yj24ny5k.js";
74
+ import"./index-9z0dc1t5.js";
75
75
  import"./index-sxt7fgcw.js";
76
76
  import"./index-bk5tah7q.js";
77
77
  import"./index-bpmtbmy9.js";
78
78
  import"./index-zpsr8rpc.js";
79
- import"./index-q1r1cfww.js";
79
+ import"./index-76qm2c2y.js";
80
80
  import"./index-yzjaj53h.js";
81
81
  import"./index-zgwm4ryv.js";
82
82
  import"./index-a76rekgs.js";
@@ -6,19 +6,19 @@ import {
6
6
  loadPlanJsonOnly,
7
7
  mergeDurableGateEntriesFromEvidence,
8
8
  readDurableGateEvidence
9
- } from "./index-zapc8vj4.js";
9
+ } from "./index-rwdfk03c.js";
10
10
  import"./index-xnpjwc4h.js";
11
11
  import"./index-txdagbh7.js";
12
12
  import"./index-9br68j86.js";
13
13
  import"./index-cw912re7.js";
14
14
  import"./index-zsrtt42s.js";
15
- import"./index-sxcfszbe.js";
16
- import"./index-wwr67xc0.js";
15
+ import"./index-g0qsftdd.js";
16
+ import"./index-tz3jzz2t.js";
17
17
  import"./index-b3pmzbh1.js";
18
18
  import"./index-2s7dvzff.js";
19
19
  import"./index-3qf1vxtb.js";
20
20
  import"./index-n832052r.js";
21
- import"./index-83m0y4cj.js";
21
+ import"./index-0hjtck07.js";
22
22
  import"./index-fgp96k3r.js";
23
23
  import"./index-bernkwgf.js";
24
24
  import"./index-dvbf6fpn.js";
@@ -31,15 +31,15 @@ import"./index-nprdr0sm.js";
31
31
  import"./index-nbdmdyke.js";
32
32
  import"./index-1xnse449.js";
33
33
  import"./index-ee6ydtfe.js";
34
- import"./index-3bfzpzsb.js";
34
+ import"./index-hp729z5v.js";
35
35
  import"./index-0mhftbpp.js";
36
36
  import"./index-a1w58b47.js";
37
- import"./index-yj24ny5k.js";
37
+ import"./index-9z0dc1t5.js";
38
38
  import"./index-sxt7fgcw.js";
39
39
  import"./index-bk5tah7q.js";
40
40
  import"./index-bpmtbmy9.js";
41
41
  import"./index-zpsr8rpc.js";
42
- import"./index-q1r1cfww.js";
42
+ import"./index-76qm2c2y.js";
43
43
  import"./index-yzjaj53h.js";
44
44
  import {
45
45
  log
@@ -21,8 +21,8 @@ import {
21
21
  reduceTaskWorkflowSnapshot,
22
22
  transitionTaskWorkflowEvidence,
23
23
  withTaskEvidenceTransaction
24
- } from "./index-sxcfszbe.js";
25
- import"./index-wwr67xc0.js";
24
+ } from "./index-g0qsftdd.js";
25
+ import"./index-tz3jzz2t.js";
26
26
  import"./index-b3pmzbh1.js";
27
27
  import"./index-2s7dvzff.js";
28
28
  import"./index-bx1wgn3a.js";