opencode-swarm 7.184.11 → 7.184.13

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 (109) hide show
  1. package/.opencode/skills/swarm-ci-monitor/SKILL.md +1 -0
  2. package/.opencode/skills/swarm-pr-feedback/SKILL.md +1 -0
  3. package/.opencode/skills/swarm-pr-review/SKILL.md +21 -21
  4. package/.opencode/skills/swarm-pr-review/references/lane-output-recoverability.md +11 -0
  5. package/.opencode/skills/swarm-pr-review/references/parallel-work-example.md +20 -0
  6. package/.opencode/skills/swarm-pr-subscribe/SKILL.md +1 -0
  7. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  8. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  9. package/dist/background/delegation-lifecycle.d.ts +6 -2
  10. package/dist/background/pending-delegations.d.ts +23 -1
  11. package/dist/cli/auto-checkpoint-a2zbyh20.js +183 -0
  12. package/dist/cli/checkpoint-s444mhx5.js +51 -0
  13. package/dist/cli/{coder-settlement-6mhw6b36.js → coder-settlement-hnwwt3f0.js} +13 -11
  14. package/dist/cli/{config-doctor-tbaswv40.js → config-doctor-2qhay8ft.js} +2 -2
  15. package/dist/cli/{core-4389fcpc.js → core-567f7gbz.js} +3 -3
  16. package/dist/cli/{curation-policy-xe77n9zj.js → curation-policy-1rzheh1x.js} +6 -5
  17. package/dist/cli/{curator-asqb0cm7.js → curator-antxp3dg.js} +48 -42
  18. package/dist/cli/{curator-drift-nnge4dkk.js → curator-drift-ja4d9gq2.js} +9 -9
  19. package/dist/cli/curator-llm-factory-0a3svbcn.js +81 -0
  20. package/dist/cli/{dispatch-cv89p2y1.js → dispatch-0ejzwb45.js} +2 -1
  21. package/dist/cli/{evidence-summary-service-cdrwfdyp.js → evidence-summary-service-6ch3b0t5.js} +24 -19
  22. package/dist/cli/{gate-evidence-xbn83jeh.js → gate-evidence-zh4fpbnv.js} +8 -6
  23. package/dist/cli/guardrail-explain-pqyp8mx5.js +82 -0
  24. package/dist/cli/{guardrail-log-b6ef00v7.js → guardrail-log-99zsmp0p.js} +7 -7
  25. package/dist/cli/{guardrail-reset-77r7jfn2.js → guardrail-reset-mzs00j16.js} +48 -42
  26. package/dist/cli/hive-promoter-f3enyhkn.js +96 -0
  27. package/dist/cli/index-09wnx2ke.js +954 -0
  28. package/dist/cli/{index-kaay5kmx.js → index-0p0qwdyy.js} +2 -2
  29. package/dist/cli/{index-zz5rryxj.js → index-258a0p26.js} +7 -7
  30. package/dist/cli/{index-908zxswj.js → index-2n1ms79t.js} +44 -16
  31. package/dist/cli/{index-ejpxkrp6.js → index-2p3nzm9b.js} +1 -1
  32. package/dist/cli/index-2y9b45jj.js +24 -0
  33. package/dist/cli/{index-hk0eh9qb.js → index-4g4sr4ah.js} +1 -1
  34. package/dist/cli/{index-35cdceqf.js → index-6cjpmvpa.js} +2 -20
  35. package/dist/cli/{index-5cawm255.js → index-79y6dxa9.js} +8 -6
  36. package/dist/cli/index-7bxssqaf.js +2676 -0
  37. package/dist/cli/index-7pmbnjvj.js +11 -0
  38. package/dist/cli/{index-j4efx148.js → index-7r3pkgma.js} +5 -5
  39. package/dist/cli/{index-kg2mb1m5.js → index-7rzgdcvc.js} +2 -2
  40. package/dist/cli/{index-8gs8qkjs.js → index-7vb5rx5w.js} +1 -1
  41. package/dist/cli/{index-hamqvzqn.js → index-9nyqt3kb.js} +10 -2682
  42. package/dist/cli/{index-5njp971j.js → index-9rm7tw6y.js} +8 -8
  43. package/dist/cli/{index-c0dahh34.js → index-9y5b3nsk.js} +1 -1
  44. package/dist/cli/{index-xpcvwzdq.js → index-a96rm6zk.js} +3 -3
  45. package/dist/cli/{index-jhk62dp4.js → index-a9rfvc8j.js} +4 -4
  46. package/dist/cli/{index-xw8xdcrf.js → index-awkb5370.js} +5 -5
  47. package/dist/cli/{index-0mj7hc2z.js → index-bntwj2tp.js} +5 -5
  48. package/dist/cli/{index-aae38s4x.js → index-cftva3pa.js} +2 -11
  49. package/dist/cli/{index-hwjr3xyg.js → index-ck2hzp5b.js} +10 -38
  50. package/dist/cli/{index-e0rrj9kk.js → index-d2xdwz22.js} +9 -9
  51. package/dist/cli/{index-gnryhmak.js → index-dftztz4y.js} +1 -1
  52. package/dist/cli/{index-7k4ksbqd.js → index-djct2zsr.js} +1 -1
  53. package/dist/cli/{index-gqj1k2y6.js → index-e593fgq0.js} +2 -2
  54. package/dist/cli/{index-0ajyhjht.js → index-fxf3zhtq.js} +1 -1
  55. package/dist/cli/index-g4fs6z4e.js +37 -0
  56. package/dist/cli/{index-89nqyqxs.js → index-gz771bj7.js} +3 -3
  57. package/dist/cli/{index-tamg9rve.js → index-gzh04gxh.js} +2 -2
  58. package/dist/cli/index-hg1hqfy3.js +963 -0
  59. package/dist/cli/{index-nh5fxxc9.js → index-jtg0zsnx.js} +4 -2
  60. package/dist/cli/{index-3w96sd7p.js → index-kxm9wm5e.js} +3044 -3842
  61. package/dist/cli/{index-07fqfseh.js → index-m1pqenq9.js} +2 -2
  62. package/dist/cli/{index-be5h97z8.js → index-mfqge140.js} +1 -1
  63. package/dist/cli/{index-6z53ry5f.js → index-nt8g5952.js} +2 -2
  64. package/dist/cli/{index-cn67bp4y.js → index-pq35rmz5.js} +52 -46
  65. package/dist/cli/{index-5m1b70z3.js → index-pwcbtbhd.js} +4 -4
  66. package/dist/cli/{index-w0jbrttk.js → index-ra0z5wza.js} +3 -3
  67. package/dist/cli/{index-vx0wjfc1.js → index-sa061g64.js} +7 -7
  68. package/dist/cli/{index-7kmxy1rb.js → index-t7ck2nvk.js} +4 -4
  69. package/dist/cli/{index-ygdj73xq.js → index-tswsm3sw.js} +3 -3
  70. package/dist/cli/{index-q7q00ppx.js → index-tyzmjw2s.js} +7 -7
  71. package/dist/cli/{index-645ckyxy.js → index-v4ra6hz8.js} +55 -971
  72. package/dist/cli/{index-pbwfwc0v.js → index-vd1sd1m5.js} +48 -42
  73. package/dist/cli/{index-x1gyqgze.js → index-w6w6ny06.js} +2 -2
  74. package/dist/cli/{index-9xfxsx8y.js → index-wksedk4d.js} +1 -1
  75. package/dist/cli/{index-x119gdak.js → index-yx5z4200.js} +2 -2
  76. package/dist/cli/{index-dqpq8m9w.js → index-yydv4jfy.js} +2 -2
  77. package/dist/cli/index.js +49 -43
  78. package/dist/cli/{knowledge-escalator-8cc6jcw0.js → knowledge-escalator-6c813zv8.js} +13 -12
  79. package/dist/cli/{knowledge-events-b5g6ky4h.js → knowledge-events-9hbwedqb.js} +11 -10
  80. package/dist/cli/{knowledge-link-8tetyje0.js → knowledge-link-vvyfhhmr.js} +5 -4
  81. package/dist/cli/{knowledge-store-1w60j5xm.js → knowledge-store-8t9wy3ab.js} +6 -5
  82. package/dist/cli/{knowledge-validator-sd88rjcy.js → knowledge-validator-g61010aw.js} +8 -7
  83. package/dist/cli/{mcp-3052r65q.js → mcp-tyzj9cwy.js} +1 -1
  84. package/dist/cli/{model-preflight-m0nwfsx8.js → model-preflight-q8pnsjay.js} +48 -42
  85. package/dist/cli/{pending-delegations-5nx22evh.js → pending-delegations-8nah16wj.js} +16 -12
  86. package/dist/cli/{pr-subscriptions-kas44ty9.js → pr-subscriptions-rd3gnc3r.js} +14 -12
  87. package/dist/cli/{pr-workflow-gate-pmggnw1j.js → pr-workflow-gate-1y8by6bt.js} +56 -42
  88. package/dist/cli/{runner-ff0bj9w0.js → runner-cwmgb9rw.js} +6 -5
  89. package/dist/cli/{scan-cursor-yw12hvtc.js → scan-cursor-4s30je6f.js} +7 -6
  90. package/dist/cli/{schema-1g1y1d5q.js → schema-r3v5tb9r.js} +1 -1
  91. package/dist/cli/{scope-persistence-de472fxy.js → scope-persistence-vtz91b5n.js} +17 -15
  92. package/dist/cli/{server-1n00bga4.js → server-j1ybvgn4.js} +62 -54
  93. package/dist/cli/{skill-generator-c5wbbjqx.js → skill-generator-h27wtea0.js} +15 -14
  94. package/dist/cli/{snapshot-coordination-init-gwj594hc.js → snapshot-coordination-init-yntqf46w.js} +48 -42
  95. package/dist/cli/{speckit-checkoff-hc479v4r.js → speckit-checkoff-qxt03eh3.js} +4 -4
  96. package/dist/cli/{telemetry-39zmx4fp.js → telemetry-n6y2sjhg.js} +1 -1
  97. package/dist/cli/{workspace-snapshot-nrbvjh1c.js → workspace-snapshot-gnwak61t.js} +3 -3
  98. package/dist/cli/{worktree-collision-ownership-jvgxxnf9.js → worktree-collision-ownership-0a7jtwwe.js} +18 -16
  99. package/dist/cli/{worktree-isolation-r9hr23r8.js → worktree-isolation-4re648a3.js} +48 -42
  100. package/dist/hooks/pr-workflow-gate.d.ts +59 -1
  101. package/dist/index.js +543 -543
  102. package/dist/plan/auto-checkpoint.d.ts +56 -0
  103. package/dist/plan/manager.d.ts +8 -12
  104. package/dist/tools/dispatch-lanes.d.ts +7 -0
  105. package/dist/tools/submit-pr-review-result.d.ts +17 -0
  106. package/package.json +1 -1
  107. package/dist/cli/curator-llm-factory-1gjzcafw.js +0 -75
  108. package/dist/cli/guardrail-explain-xtyxjmyz.js +0 -76
  109. package/dist/cli/hive-promoter-dsrj2ar2.js +0 -90
@@ -9,6 +9,7 @@ description: >
9
9
  failure-type-specific fix recipes. This is the first skill in the repo that
10
10
  executes a merge — invoke it deliberately.
11
11
  disable-model-invocation: true
12
+ swarm-contract-digest: c1572cc54760
12
13
  ---
13
14
 
14
15
  # Swarm CI Monitor
@@ -12,6 +12,7 @@ description: >
12
12
  (structural pre-checks) and Stage B (reviewer + test_engineer) gates and the
13
13
  reviewer + critic closeout gate are MANDATORY for any change made as part of
14
14
  this process.
15
+ swarm-contract-digest: 143d9443a82d
15
16
  ---
16
17
 
17
18
  # Swarm PR Feedback
@@ -3,6 +3,7 @@ name: swarm-pr-review
3
3
  audience: swarm-plugin
4
4
  description: Run a graph-guided, tool-augmented PR review using context packing, parallel exploration, mandatory repository-agnostic risk-family coverage with dispatch scaled to diff size and risk, independent reviewer validation, critic challenge, and metrics writeback. Use for deep pull request review with low false-positive tolerance and high recall in any repository, on any agent harness (structured lane controller, native parallel subagents, or single-context sequential passes).
5
5
  disable-model-invocation: true
6
+ swarm-contract-digest: 96af70854748
6
7
  ---
7
8
 
8
9
  # /swarm-pr-review
@@ -595,19 +596,8 @@ For each new commit on the remote (identified by comparing `headRefOid` /
595
596
 
596
597
  ### Example: parallel swarm superseded local fix work
597
598
 
598
- ```
599
- PARALLEL WORK CHECK (pre-fix):
600
- - Branch: copilot/fix-legacy-hive-data-migration
601
- - Local HEAD: 3c04997c fix: resolve PR #1238 review findings
602
- - Remote HEAD: 79d7ec64 fix(knowledge-migrator): harden legacy migration loop
603
- - Diverged: yes (remote is 2 commits ahead with more comprehensive fix)
604
- - New commits on remote: 2
605
- - Parallel swarm work detected: yes (different author)
606
- - Decision: abandon-use-remote
607
- - Rationale: Remote added 17 unit tests + try/catch error handling that
608
- surpassed my planned batch-rewrite. Verified by re-running the test suite:
609
- remote has 25/25 passing, my local plan would have produced 9/9.
610
- ```
599
+ See `references/parallel-work-example.md` for the worked PARALLEL WORK CHECK
600
+ transcript (remote supersession, abandon-use-remote decision).
611
601
 
612
602
  ---
613
603
 
@@ -987,6 +977,21 @@ For ANY lane that failed (either mode):
987
977
  4. **Terminal report kinds (issue #2383):** all six dimensions covered → `COMPLETE` (verdict may be APPROVE, REQUEST_CHANGES, or INCOMPLETE); at least one covered → `PARTIAL` (verdict must be REQUEST_CHANGES or INCOMPLETE; validated findings from covered dimensions remain publishable); zero covered → `NO_COVERAGE` (skip the findings ladder entirely, call `complete_pr_workflow` with `report_verdict: "INCOMPLETE"` directly — the completion returns a truthful operational report with per-dimension reasons and never claims a code-quality review). A still-live lane blocks settlement: poll, cancel explicitly with `cancel_pending`, or let the presumed-stale sweep settle it first.
988
978
  5. Under Profile A, when the bind/checkout path itself is genuinely unreachable or the workflow is publication-armed and exact publication cannot proceed, use the bounded recovery exits: `abort_pr_workflow` with `mode: "PR_REVIEW"`, `kind: "recovery"`, and a non-empty one-line `reason` for an unrecoverable unbound/bound gate, or `kind: "armed_recovery"` (issue #2383) for a publication-armed wedge — then `prepare_pr_workflow_checkout` with `operation: "restore"`. Abort remains a recovery tool for the genuinely unrecoverable, never a shortcut past a settleable coverage obligation.
989
979
 
980
+ ### PARTIAL-settlement recovery (all lanes terminal)
981
+
982
+ Base settlement requires every launched lane to be TERMINAL — settled, failed,
983
+ or explicitly cancelled — NOT full coverage. With partial coverage (at least one
984
+ dimension covered), the review proceeds instead of aborting: dispatch the FIRST
985
+ `swarm-pr-review:micro` batch with the complete 11-row `trigger_evaluation`
986
+ parameter inline on `dispatch_lanes_async` (that dispatch freezes the canonical
987
+ ledger), persist it with `write_pr_review_trigger_eval`, run the validation
988
+ lanes, then finish with `complete_pr_workflow` carrying the verdict PARTIAL
989
+ coverage allows (REQUEST_CHANGES or INCOMPLETE — never APPROVE). The
990
+ NO_COVERAGE short-circuit applies only at zero coverage. A
991
+ `write_pr_review_trigger_eval` rejection saying the canonical ledger is missing
992
+ means the first micro dispatch has not frozen it yet — supply the inline
993
+ parameter; it is not a deadlock.
994
+
990
995
  ### Contract-failure diagnosis and recovery
991
996
 
992
997
  Under Profile A, `dispatch_lanes_async` adds the authoritative
@@ -1003,14 +1008,9 @@ three independent input layers: the header schema, data-row values, and tool
1003
1008
  argument shape. A correct header does not repair an invalid severity or lane
1004
1009
  value, and correct row data does not repair malformed dispatch JSON. Benign shape defects (evidence pipes, marker rows, verdict-row pipes, a header re-emitted as a data row) are auto-repaired and recorded as salvage — never a retry reason alone; the `parse_lane_candidates` receipt discloses them as `repair_kinds`, and a `[CLEAN]` attestation discredited beside a same-lane `[CANDIDATE]` row as `clean_attestation_salvaged` + `clean_attestation_salvage_reason` (the parse SUCCEEDS and the attestation still supplies no coverage) (contract and fidelity boundaries: `references/lane-output-recoverability.md`).
1005
1010
 
1006
- Classify the incident from actual user-visible harm and the first failed
1007
- predicate, not from the number of retries or the eventual result. A successful
1008
- post-hoc fallback is recovery evidence; it does not justify the protocol
1009
- deviation or erase the original failure. Conversely, the candidate tool and
1010
- the coverage gate use a shared row parser, while the gate separately verifies
1011
- durable provenance such as batch, session, lane, role, head, digest, and
1012
- artifact identity. Parser success therefore proves row structure only; it does
1013
- not settle the durable coverage obligation.
1011
+ Classify incidents from actual user-visible harm and the first failed predicate; the shared
1012
+ row parser proves row structure only, a post-hoc fallback is recovery evidence, and the
1013
+ gate separately verifies durable provenance (see `references/lane-output-recoverability.md`).
1014
1014
 
1015
1015
  If a controller denial omits the failed predicate, expected contract, or lane
1016
1016
  identity, record that as an opacity defect and escalate it with the preserved
@@ -339,3 +339,14 @@ one bounded retry early), then disclose, and only then is `abort_pr_workflow`
339
339
  legitimate. An operator-cancelled lane does NOT qualify — `cancel_pending` is
340
340
  a controlled act by the controller; re-dispatch the family instead of
341
341
  disclosing it.
342
+
343
+ ## Incident classification and parser-vs-gate proof scope (issue #2859 relocation)
344
+
345
+ Classify the incident from actual user-visible harm and the first failed
346
+ predicate, not from the number of retries or the eventual result. A successful
347
+ post-hoc fallback is recovery evidence; it does not justify the protocol
348
+ deviation or erase the original failure. Conversely, the candidate tool and
349
+ the coverage gate use a shared row parser, while the gate separately verifies
350
+ durable provenance such as batch, session, lane, role, head, digest, and
351
+ artifact identity. Parser success therefore proves row structure only; it does
352
+ not settle the durable coverage obligation.
@@ -0,0 +1,20 @@
1
+ # Parallel-work supersession example (relocated from SKILL.md, issue #2859 F0)
2
+
3
+ ### Example: parallel swarm superseded local fix work
4
+
5
+ ```
6
+ PARALLEL WORK CHECK (pre-fix):
7
+ - Branch: copilot/fix-legacy-hive-data-migration
8
+ - Local HEAD: 3c04997c fix: resolve PR #1238 review findings
9
+ - Remote HEAD: 79d7ec64 fix(knowledge-migrator): harden legacy migration loop
10
+ - Diverged: yes (remote is 2 commits ahead with more comprehensive fix)
11
+ - New commits on remote: 2
12
+ - Parallel swarm work detected: yes (different author)
13
+ - Decision: abandon-use-remote
14
+ - Rationale: Remote added 17 unit tests + try/catch error handling that
15
+ surpassed my planned batch-rewrite. Verified by re-running the test suite:
16
+ remote has 25/25 passing, my local plan would have produced 9/9.
17
+ ```
18
+
19
+ Worked PARALLEL WORK CHECK transcript: remote supersession with an
20
+ abandon-use-remote decision.
@@ -7,6 +7,7 @@ description: >
7
7
  babysit, or autofix a PR until merge, or when a <pr-activity> wake message or
8
8
  [pr-monitor:...] advisory arrives for a subscribed PR. Owns event triage
9
9
  (fix / ask / skip), bounded-retry escalation, and terminal-state cleanup.
10
+ swarm-contract-digest: 1f679751e34e
10
11
  ---
11
12
 
12
13
  # Swarm PR Subscribe
@@ -21,8 +21,12 @@
21
21
  */
22
22
  import { type PricingConfig } from '../services/cost-accounting.js';
23
23
  import { type BackgroundDelegationRecord, type BackgroundDelegationResult, type BackgroundTerminalResult, claimTerminalResult, findByCorrelationId, findByCorrelationIdDetailed } from './pending-delegations.js';
24
- /** Terminal statuses a shared settle may establish (mirrors Task semantics). */
25
- export type DelegationTerminalStatus = 'completed' | 'error' | 'cancelled';
24
+ /**
25
+ * Terminal statuses a shared settle may establish (mirrors Task semantics).
26
+ * `'stale'` (issue #2700) admits the eventless-abandonment settles — the idle
27
+ * host flip and equivalent producers — through the same typed claim.
28
+ */
29
+ export type DelegationTerminalStatus = 'completed' | 'error' | 'cancelled' | 'stale';
26
30
  /**
27
31
  * Why `settleDelegationTerminal` returned without a fresh claim.
28
32
  *
@@ -352,7 +352,13 @@ export interface BackgroundDelegationResult {
352
352
  export interface BackgroundTerminalResult {
353
353
  /** Stable identity derived from trusted correlation + immutable result metadata. */
354
354
  eventId: string;
355
- status: 'completed' | 'error' | 'cancelled' | 'rejected';
355
+ /**
356
+ * `'stale'` (issue #2700) is the typed terminal the eventless settle paths
357
+ * (stale sweep, idle-host flip, parent-repair backfill) establish; the
358
+ * event's status always equals the durable record status it was written
359
+ * with, preserving the status-agreement invariants consumers rely on.
360
+ */
361
+ status: 'completed' | 'error' | 'cancelled' | 'rejected' | 'stale';
356
362
  recordedAt: number;
357
363
  result: BackgroundDelegationResult;
358
364
  }
@@ -644,6 +650,13 @@ export declare function appendDelegationTransition(directory: string, correlatio
644
650
  /** Test/recovery seam for replaying a persisted timestamp exactly. */
645
651
  updatedAt?: number;
646
652
  expectedCurrentStatuses?: readonly BackgroundDelegationStatus[];
653
+ /**
654
+ * Issue #2700: the typed terminal event to write atomically with a
655
+ * terminal status flip. Ignored when the record already carries a
656
+ * `terminalResult` (the first typed event can never be erased, #2045)
657
+ * or when the transition is not to a terminal status.
658
+ */
659
+ terminalResult?: BackgroundTerminalResult;
647
660
  }): Promise<BackgroundDelegationRecord | null>;
648
661
  export type PublishPrReviewResultReceiptOutcome = {
649
662
  status: 'recorded';
@@ -698,6 +711,15 @@ export interface BuildBackgroundCompletionEventIdInput {
698
711
  }
699
712
  /** Build the stable inbox/terminal identity without timestamps or process state. */
700
713
  export declare function buildBackgroundCompletionEventId(input: BuildBackgroundCompletionEventIdInput): string;
714
+ /**
715
+ * Build the typed terminal event for a settle path that establishes a terminal
716
+ * disposition outside the interactive claim (issue #2700): the stale sweep's
717
+ * under-lock flip, the generic transition writer's derivation, and the
718
+ * parent-repair publish backfill all construct their event here so every
719
+ * producer emits the byte-identical shape the claim path would have written —
720
+ * same eventId identity material, same status-equals-record guarantee.
721
+ */
722
+ export declare function buildTypedDelegationTerminal(record: Pick<BackgroundDelegationRecord, 'correlationId' | 'jobId'>, status: BackgroundTerminalResult['status'], result: BackgroundDelegationResult, now: number): BackgroundTerminalResult;
701
723
  export type TerminalClaimDisposition = 'claimed' | 'resume_settlement' | 'retry_ingestion' | 'preserved' | 'consumed' | 'duplicate';
702
724
  export interface TerminalClaim {
703
725
  disposition: TerminalClaimDisposition;
@@ -0,0 +1,183 @@
1
+ // @bun
2
+ import"./index-e593fgq0.js";
3
+ import"./index-frcemc0b.js";
4
+ import"./index-0725jpp7.js";
5
+ import {
6
+ derivePlanIdentityHash
7
+ } from "./index-7pmbnjvj.js";
8
+ import"./index-gx2vp8gx.js";
9
+ import {
10
+ loadPluginConfigWithMeta
11
+ } from "./index-djct2zsr.js";
12
+ import {
13
+ init_git_executable,
14
+ resolveGitExecutable
15
+ } from "./index-zxdawwc7.js";
16
+ import"./index-2p3nzm9b.js";
17
+ import"./index-48jvqqfa.js";
18
+ import"./index-bk5tah7q.js";
19
+ import"./index-gknz3bv1.js";
20
+ import"./index-zpsr8rpc.js";
21
+ import"./index-zgwm4ryv.js";
22
+ import {
23
+ __require
24
+ } from "./index-a76rekgs.js";
25
+
26
+ // src/plan/auto-checkpoint.ts
27
+ import * as child_process from "child_process";
28
+ import * as fs from "fs";
29
+ import * as path from "path";
30
+ init_git_executable();
31
+ var DEFAULT_AUTO_CHECKPOINT_THRESHOLD = 3;
32
+ var MAX_LABEL_GENERATIONS = 20;
33
+ var GIT_PROBE_TIMEOUT_MS = 1e4;
34
+ function countCompletedTasks(plan) {
35
+ return plan.phases.reduce((total, phase) => total + phase.tasks.filter((task) => task.status === "completed").length, 0);
36
+ }
37
+ function buildAutoCheckpointLabel(plan, completedCount, generation = 1) {
38
+ const identity = derivePlanIdentityHash(plan).slice(0, 12);
39
+ const base = `auto-task-checkpoint-${identity}-${String(completedCount).padStart(3, "0")}`;
40
+ return generation <= 1 ? base : `${base}-g${generation}`;
41
+ }
42
+ function evaluateAutoCheckpoint(input) {
43
+ const { plan, completedCount, enabled } = input;
44
+ const threshold = Number.isInteger(input.threshold) && input.threshold >= 1 ? input.threshold : DEFAULT_AUTO_CHECKPOINT_THRESHOLD;
45
+ if (enabled === false) {
46
+ return {
47
+ shouldSave: false,
48
+ completedCount,
49
+ threshold,
50
+ skipReason: "disabled"
51
+ };
52
+ }
53
+ if (completedCount <= 0 || completedCount % threshold !== 0) {
54
+ return {
55
+ shouldSave: false,
56
+ completedCount,
57
+ threshold,
58
+ skipReason: "below_threshold"
59
+ };
60
+ }
61
+ return {
62
+ shouldSave: true,
63
+ completedCount,
64
+ threshold,
65
+ label: buildAutoCheckpointLabel(plan, completedCount)
66
+ };
67
+ }
68
+ function resolveHead(directory) {
69
+ let result;
70
+ try {
71
+ result = child_process.spawnSync(resolveGitExecutable(), ["rev-parse", "HEAD"], {
72
+ cwd: directory,
73
+ encoding: "utf-8",
74
+ timeout: GIT_PROBE_TIMEOUT_MS,
75
+ stdio: ["ignore", "pipe", "pipe"],
76
+ windowsHide: true
77
+ });
78
+ } catch {
79
+ return null;
80
+ }
81
+ if (result.error || result.status !== 0)
82
+ return null;
83
+ const sha = (result.stdout ?? "").trim();
84
+ return /^[0-9a-f]{40}$/i.test(sha) ? sha : null;
85
+ }
86
+ function readCheckpointEntries(directory) {
87
+ try {
88
+ const logPath = path.join(directory, ".swarm", "checkpoints.json");
89
+ if (!fs.existsSync(logPath))
90
+ return [];
91
+ const parsed = JSON.parse(fs.readFileSync(logPath, "utf-8"));
92
+ if (!Array.isArray(parsed.checkpoints))
93
+ return [];
94
+ return parsed.checkpoints.filter((entry) => typeof entry?.label === "string" && typeof entry?.sha === "string").map((entry) => ({ label: entry.label, sha: entry.sha }));
95
+ } catch {
96
+ return [];
97
+ }
98
+ }
99
+ async function maybeSaveAutoCheckpoint(directory, plan) {
100
+ let enabled = true;
101
+ let threshold = DEFAULT_AUTO_CHECKPOINT_THRESHOLD;
102
+ try {
103
+ const { config } = loadPluginConfigWithMeta(directory);
104
+ if (config.checkpoint?.enabled === false) {
105
+ enabled = false;
106
+ }
107
+ if (config.checkpoint?.auto_checkpoint_threshold !== undefined) {
108
+ threshold = config.checkpoint.auto_checkpoint_threshold;
109
+ }
110
+ } catch {}
111
+ const completedCount = countCompletedTasks(plan);
112
+ const decision = evaluateAutoCheckpoint({
113
+ plan,
114
+ completedCount,
115
+ threshold,
116
+ enabled
117
+ });
118
+ if (!decision.shouldSave || !decision.label) {
119
+ return { ...decision, saved: false };
120
+ }
121
+ const head = resolveHead(directory);
122
+ if (head === null) {
123
+ return {
124
+ ...decision,
125
+ shouldSave: false,
126
+ saved: false,
127
+ skipReason: "no_restorable_head"
128
+ };
129
+ }
130
+ const existing = readCheckpointEntries(directory);
131
+ const baseLabel = decision.label;
132
+ const sameFamily = existing.filter((entry) => parseLabelGeneration(baseLabel, entry.label) !== null);
133
+ if (sameFamily.some((entry) => entry.sha === head)) {
134
+ return { ...decision, saved: true, skipReason: "already_current" };
135
+ }
136
+ const taken = new Set(existing.map((entry) => entry.label));
137
+ let generation = 1;
138
+ let label = baseLabel;
139
+ while (taken.has(label)) {
140
+ generation += 1;
141
+ if (generation > MAX_LABEL_GENERATIONS) {
142
+ return {
143
+ ...decision,
144
+ saved: false,
145
+ warning: `auto-checkpoint label generations exhausted for ${baseLabel}`
146
+ };
147
+ }
148
+ label = buildAutoCheckpointLabel(plan, completedCount, generation);
149
+ }
150
+ const { saveCheckpointRecord } = await import("./checkpoint-s444mhx5.js");
151
+ const result = await saveCheckpointRecord(label, directory);
152
+ if (result.success) {
153
+ return { ...decision, label, saved: true };
154
+ }
155
+ const afterSave = readCheckpointEntries(directory);
156
+ if (afterSave.some((entry) => entry.sha === head && parseLabelGeneration(baseLabel, entry.label) !== null)) {
157
+ return { ...decision, label, saved: true, skipReason: "already_current" };
158
+ }
159
+ return {
160
+ ...decision,
161
+ label,
162
+ saved: false,
163
+ warning: result.warning ?? result.error
164
+ };
165
+ }
166
+ function parseLabelGeneration(baseLabel, label) {
167
+ if (label === baseLabel)
168
+ return 1;
169
+ if (!label.startsWith(baseLabel))
170
+ return null;
171
+ const match = /^-g(\d{1,3})$/.exec(label.slice(baseLabel.length));
172
+ if (!match)
173
+ return null;
174
+ const generation = Number(match[1]);
175
+ return generation >= 2 && generation <= MAX_LABEL_GENERATIONS ? generation : null;
176
+ }
177
+ export {
178
+ maybeSaveAutoCheckpoint,
179
+ evaluateAutoCheckpoint,
180
+ countCompletedTasks,
181
+ buildAutoCheckpointLabel,
182
+ DEFAULT_AUTO_CHECKPOINT_THRESHOLD
183
+ };
@@ -0,0 +1,51 @@
1
+ // @bun
2
+ import {
3
+ _internals,
4
+ checkpoint,
5
+ saveCheckpointRecord
6
+ } from "./index-hg1hqfy3.js";
7
+ import"./index-v4ra6hz8.js";
8
+ import"./index-6b295cas.js";
9
+ import"./index-9nyqt3kb.js";
10
+ import"./index-9y5b3nsk.js";
11
+ import"./index-zsrtt42s.js";
12
+ import"./index-0p0qwdyy.js";
13
+ import"./index-g4fs6z4e.js";
14
+ import"./index-dftztz4y.js";
15
+ import"./index-2s7dvzff.js";
16
+ import"./index-e593fgq0.js";
17
+ import"./index-frcemc0b.js";
18
+ import"./index-0725jpp7.js";
19
+ import"./index-d2xdwz22.js";
20
+ import"./index-7rzgdcvc.js";
21
+ import"./index-cftva3pa.js";
22
+ import"./index-pwcbtbhd.js";
23
+ import"./index-ry16d01s.js";
24
+ import"./index-rdm3px0g.js";
25
+ import"./index-7pmbnjvj.js";
26
+ import"./index-yx5z4200.js";
27
+ import"./index-6cjpmvpa.js";
28
+ import"./index-t7hmqgjy.js";
29
+ import"./index-w6w6ny06.js";
30
+ import"./index-mc72pk74.js";
31
+ import"./index-c1ggtmpm.js";
32
+ import"./index-ejhxgyvm.js";
33
+ import"./index-7g4c7s5r.js";
34
+ import"./index-bntwj2tp.js";
35
+ import"./index-gx2vp8gx.js";
36
+ import"./index-djct2zsr.js";
37
+ import"./index-zxdawwc7.js";
38
+ import"./index-2p3nzm9b.js";
39
+ import"./index-48jvqqfa.js";
40
+ import"./index-bk5tah7q.js";
41
+ import"./index-gknz3bv1.js";
42
+ import"./index-zpsr8rpc.js";
43
+ import"./index-wvghb3x6.js";
44
+ import"./index-9rwhas09.js";
45
+ import"./index-zgwm4ryv.js";
46
+ import"./index-a76rekgs.js";
47
+ export {
48
+ saveCheckpointRecord,
49
+ checkpoint,
50
+ _internals
51
+ };
@@ -14,23 +14,25 @@ import {
14
14
  releaseCoderDispatchOwnership,
15
15
  settleCoderDispatch,
16
16
  transferCoderSettlementToBackground
17
- } from "./index-vx0wjfc1.js";
18
- import"./index-07fqfseh.js";
19
- import"./index-dqpq8m9w.js";
20
- import"./index-hwjr3xyg.js";
21
- import"./index-xpcvwzdq.js";
22
- import"./index-gnryhmak.js";
17
+ } from "./index-sa061g64.js";
18
+ import"./index-m1pqenq9.js";
19
+ import"./index-yydv4jfy.js";
20
+ import"./index-ck2hzp5b.js";
21
+ import"./index-a96rm6zk.js";
22
+ import"./index-g4fs6z4e.js";
23
+ import"./index-dftztz4y.js";
23
24
  import"./index-2s7dvzff.js";
24
- import"./index-kg2mb1m5.js";
25
- import"./index-x119gdak.js";
26
- import"./index-35cdceqf.js";
25
+ import"./index-7rzgdcvc.js";
26
+ import"./index-yx5z4200.js";
27
+ import"./index-2y9b45jj.js";
28
+ import"./index-6cjpmvpa.js";
27
29
  import"./index-t7hmqgjy.js";
28
- import"./index-x1gyqgze.js";
30
+ import"./index-w6w6ny06.js";
29
31
  import"./index-mc72pk74.js";
30
32
  import"./index-c1ggtmpm.js";
31
33
  import"./index-ejhxgyvm.js";
32
34
  import"./index-7g4c7s5r.js";
33
- import"./index-0mj7hc2z.js";
35
+ import"./index-bntwj2tp.js";
34
36
  import"./index-zxdawwc7.js";
35
37
  import"./index-48jvqqfa.js";
36
38
  import"./index-gknz3bv1.js";
@@ -16,11 +16,11 @@ import {
16
16
  shouldRunOnStartup,
17
17
  writeBackupArtifact,
18
18
  writeDoctorArtifact
19
- } from "./index-8gs8qkjs.js";
19
+ } from "./index-7vb5rx5w.js";
20
20
  import"./index-6b295cas.js";
21
21
  import"./index-ry16d01s.js";
22
22
  import"./index-c1ggtmpm.js";
23
- import"./index-ejpxkrp6.js";
23
+ import"./index-2p3nzm9b.js";
24
24
  import"./index-48jvqqfa.js";
25
25
  import"./index-bk5tah7q.js";
26
26
  import"./index-gknz3bv1.js";
@@ -14,12 +14,12 @@ import {
14
14
  resolveWorktreeBaseDir,
15
15
  shortenWorktreePath,
16
16
  writeLaneProfileToDiskReal
17
- } from "./index-xpcvwzdq.js";
18
- import"./index-gnryhmak.js";
17
+ } from "./index-a96rm6zk.js";
18
+ import"./index-dftztz4y.js";
19
19
  import"./index-2s7dvzff.js";
20
20
  import"./index-mc72pk74.js";
21
21
  import"./index-c1ggtmpm.js";
22
- import"./index-0mj7hc2z.js";
22
+ import"./index-bntwj2tp.js";
23
23
  import"./index-zxdawwc7.js";
24
24
  import"./index-48jvqqfa.js";
25
25
  import"./index-zpsr8rpc.js";
@@ -5,18 +5,19 @@ import {
5
5
  authorizeCuration,
6
6
  buildConfigFingerprintInput,
7
7
  readCohortConfigFingerprint
8
- } from "./index-0ajyhjht.js";
8
+ } from "./index-fxf3zhtq.js";
9
9
  import"./index-rtry5xyf.js";
10
10
  import"./index-vzm6zre7.js";
11
- import"./index-hk0eh9qb.js";
12
- import"./index-35cdceqf.js";
11
+ import"./index-4g4sr4ah.js";
12
+ import"./index-2y9b45jj.js";
13
+ import"./index-6cjpmvpa.js";
13
14
  import"./index-t7hmqgjy.js";
14
- import"./index-x1gyqgze.js";
15
+ import"./index-w6w6ny06.js";
15
16
  import"./index-mc72pk74.js";
16
17
  import"./index-c1ggtmpm.js";
17
18
  import"./index-ejhxgyvm.js";
18
19
  import"./index-7g4c7s5r.js";
19
- import"./index-0mj7hc2z.js";
20
+ import"./index-bntwj2tp.js";
20
21
  import"./index-gknz3bv1.js";
21
22
  import"./index-zpsr8rpc.js";
22
23
  import"./index-zgwm4ryv.js";
@@ -14,67 +14,73 @@ import {
14
14
  runCuratorInit,
15
15
  runCuratorPhase,
16
16
  writeCuratorSummary
17
- } from "./index-3w96sd7p.js";
18
- import"./index-w0jbrttk.js";
19
- import"./index-hamqvzqn.js";
20
- import"./index-be5h97z8.js";
21
- import"./index-89nqyqxs.js";
22
- import"./index-8gs8qkjs.js";
23
- import"./index-645ckyxy.js";
24
- import"./index-nh5fxxc9.js";
17
+ } from "./index-kxm9wm5e.js";
18
+ import"./index-ra0z5wza.js";
19
+ import"./index-7vb5rx5w.js";
20
+ import"./index-09wnx2ke.js";
21
+ import"./index-7bxssqaf.js";
22
+ import"./index-mfqge140.js";
23
+ import"./index-jtg0zsnx.js";
25
24
  import"./index-txdagbh7.js";
26
- import"./index-c0dahh34.js";
27
- import"./index-6b295cas.js";
28
- import"./index-jhk62dp4.js";
29
- import"./index-xw8xdcrf.js";
30
- import"./index-tamg9rve.js";
25
+ import"./index-gzh04gxh.js";
31
26
  import"./index-rdec0y3z.js";
32
- import"./index-q7q00ppx.js";
27
+ import"./index-gz771bj7.js";
28
+ import"./index-sa061g64.js";
29
+ import"./index-a9rfvc8j.js";
30
+ import"./index-awkb5370.js";
31
+ import"./index-m1pqenq9.js";
32
+ import"./index-tyzmjw2s.js";
33
33
  import"./index-cjapb4hy.js";
34
- import"./index-zsrtt42s.js";
35
- import"./index-vx0wjfc1.js";
36
- import"./index-07fqfseh.js";
37
- import"./index-dqpq8m9w.js";
34
+ import"./index-yydv4jfy.js";
38
35
  import"./index-pt7h91zc.js";
39
36
  import"./index-q7sjgr1y.js";
40
- import"./index-kaay5kmx.js";
41
- import"./index-hwjr3xyg.js";
42
- import"./index-xpcvwzdq.js";
43
- import"./index-908zxswj.js";
44
- import"./index-5njp971j.js";
45
- import"./index-gnryhmak.js";
37
+ import"./index-hg1hqfy3.js";
38
+ import"./index-v4ra6hz8.js";
39
+ import"./index-6b295cas.js";
40
+ import"./index-9nyqt3kb.js";
41
+ import"./index-9y5b3nsk.js";
42
+ import"./index-zsrtt42s.js";
43
+ import"./index-0p0qwdyy.js";
44
+ import"./index-ck2hzp5b.js";
45
+ import"./index-a96rm6zk.js";
46
+ import"./index-g4fs6z4e.js";
47
+ import"./index-2n1ms79t.js";
48
+ import"./index-9rm7tw6y.js";
49
+ import"./index-dftztz4y.js";
46
50
  import"./index-2s7dvzff.js";
47
- import"./index-7kmxy1rb.js";
48
- import"./index-0ajyhjht.js";
51
+ import"./index-t7ck2nvk.js";
52
+ import"./index-fxf3zhtq.js";
49
53
  import"./index-rtry5xyf.js";
50
- import"./index-gqj1k2y6.js";
54
+ import"./index-e593fgq0.js";
51
55
  import"./index-frcemc0b.js";
52
56
  import"./index-0725jpp7.js";
53
- import"./index-5cawm255.js";
54
- import"./index-e0rrj9kk.js";
55
- import"./index-kg2mb1m5.js";
56
- import"./index-j4efx148.js";
57
- import"./index-aae38s4x.js";
58
- import"./index-5m1b70z3.js";
59
- import"./index-rdm3px0g.js";
57
+ import"./index-79y6dxa9.js";
58
+ import"./index-d2xdwz22.js";
59
+ import"./index-7rzgdcvc.js";
60
+ import"./index-7r3pkgma.js";
61
+ import"./index-cftva3pa.js";
62
+ import"./index-pwcbtbhd.js";
60
63
  import"./index-ry16d01s.js";
61
- import"./index-x119gdak.js";
62
- import"./index-zz5rryxj.js";
64
+ import"./index-rdm3px0g.js";
65
+ import"./index-7pmbnjvj.js";
66
+ import"./index-yx5z4200.js";
67
+ import"./index-258a0p26.js";
63
68
  import"./index-vzm6zre7.js";
64
69
  import"./index-ae75rja9.js";
65
- import"./index-hk0eh9qb.js";
66
- import"./index-35cdceqf.js";
70
+ import"./index-4g4sr4ah.js";
71
+ import"./index-2y9b45jj.js";
72
+ import"./index-6cjpmvpa.js";
67
73
  import"./index-t7hmqgjy.js";
68
- import"./index-x1gyqgze.js";
74
+ import"./index-w6w6ny06.js";
69
75
  import"./index-mc72pk74.js";
70
76
  import"./index-c1ggtmpm.js";
71
77
  import"./index-ejhxgyvm.js";
72
78
  import"./index-7g4c7s5r.js";
73
- import"./index-0mj7hc2z.js";
79
+ import"./index-bntwj2tp.js";
74
80
  import"./index-gx2vp8gx.js";
75
- import"./index-7k4ksbqd.js";
81
+ import"./index-djct2zsr.js";
76
82
  import"./index-zxdawwc7.js";
77
- import"./index-ejpxkrp6.js";
83
+ import"./index-2p3nzm9b.js";
78
84
  import"./index-48jvqqfa.js";
79
85
  import"./index-bk5tah7q.js";
80
86
  import"./index-gknz3bv1.js";