opencode-swarm 7.143.4 → 7.143.6

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 (53) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +5 -5
  2. package/.opencode/skills/swarm-pr-review/references/lane-output-recoverability.md +129 -0
  3. package/dist/background/pending-delegations.d.ts +42 -1
  4. package/dist/background/pr-review-trigger-contract.d.ts +17 -0
  5. package/dist/cli/{config-doctor-az6nqawx.js → config-doctor-72zp0k4x.js} +2 -2
  6. package/dist/cli/{core-a6rzajem.js → core-aj0wmbg8.js} +1 -1
  7. package/dist/cli/{curator-tbw9przg.js → curator-2gt2835v.js} +18 -18
  8. package/dist/cli/{curator-llm-factory-j42j5rcr.js → curator-llm-factory-x1vjhrnc.js} +18 -18
  9. package/dist/cli/{evidence-summary-service-3f319cst.js → evidence-summary-service-yjr0662r.js} +6 -6
  10. package/dist/cli/{gate-evidence-k2yycngf.js → gate-evidence-r3c7eqpz.js} +2 -2
  11. package/dist/cli/{guardrail-explain-tsgsw91f.js → guardrail-explain-f3zysesy.js} +19 -19
  12. package/dist/cli/{guardrail-log-70cxb3va.js → guardrail-log-eat71fnh.js} +3 -3
  13. package/dist/cli/{hive-promoter-nksqxfs4.js → hive-promoter-fyb40am9.js} +18 -18
  14. package/dist/cli/{index-19wyta2k.js → index-02nm8qhk.js} +3 -3
  15. package/dist/cli/{index-8fq18k02.js → index-0adcjpyx.js} +3 -3
  16. package/dist/cli/{index-f39n8pbr.js → index-36vry26a.js} +1 -1
  17. package/dist/cli/{index-gz3z9d64.js → index-5d8ydxae.js} +399 -77
  18. package/dist/cli/{index-8aabbfhv.js → index-6vmazy9f.js} +8 -5
  19. package/dist/cli/{index-bt47jrhx.js → index-72zhsqgy.js} +2 -2
  20. package/dist/cli/{index-z4g05zbr.js → index-7bs015gm.js} +1 -1
  21. package/dist/cli/{index-dmtq7tvd.js → index-92bm9ys3.js} +1 -1
  22. package/dist/cli/{index-td2ga37v.js → index-bbv64s17.js} +1 -1
  23. package/dist/cli/{index-mewk624g.js → index-dtf2va28.js} +20 -20
  24. package/dist/cli/{index-jmgm1npc.js → index-fn0k0vsa.js} +1 -1
  25. package/dist/cli/{index-z0j133c4.js → index-gzxz0s50.js} +1 -1
  26. package/dist/cli/{index-8qmnqd6g.js → index-hjy4txgr.js} +1 -1
  27. package/dist/cli/{index-seedt8m3.js → index-kc2x117y.js} +3 -3
  28. package/dist/cli/{index-6htwcbxh.js → index-nd1j9wkw.js} +1 -1
  29. package/dist/cli/{index-9m5gz9ea.js → index-peqmw3wr.js} +2 -2
  30. package/dist/cli/{index-gbr0jbxy.js → index-s7nb33pc.js} +1 -1
  31. package/dist/cli/{index-f3xf9dv5.js → index-scj2asek.js} +5 -5
  32. package/dist/cli/{index-c9d5y70c.js → index-w1q9yy1e.js} +3 -3
  33. package/dist/cli/{index-ja15rdzd.js → index-whyrhjsk.js} +1 -1
  34. package/dist/cli/{index-5qqyvwqw.js → index-wjk00vwk.js} +4 -4
  35. package/dist/cli/{index-v9qmhrj9.js → index-z4cv77tq.js} +2 -2
  36. package/dist/cli/index.js +18 -18
  37. package/dist/cli/{knowledge-escalator-8akk4n18.js → knowledge-escalator-ejpyrby0.js} +6 -6
  38. package/dist/cli/{knowledge-events-51qk8fq2.js → knowledge-events-yw2kydyy.js} +4 -4
  39. package/dist/cli/{knowledge-store-7rsezhav.js → knowledge-store-j6gkk62e.js} +1 -1
  40. package/dist/cli/{knowledge-validator-nq75s9et.js → knowledge-validator-xervpe5k.js} +2 -2
  41. package/dist/cli/{pending-delegations-b3pt3w5w.js → pending-delegations-19wg9j08.js} +5 -1
  42. package/dist/cli/{scan-cursor-em4vrcw6.js → scan-cursor-x7a99wmq.js} +2 -2
  43. package/dist/cli/{schema-1wmfgtm9.js → schema-z141arx9.js} +1 -1
  44. package/dist/cli/{scope-persistence-8ehnjgsg.js → scope-persistence-js90c1f4.js} +4 -4
  45. package/dist/cli/{skill-generator-3jstr1sx.js → skill-generator-t202jza0.js} +7 -7
  46. package/dist/cli/{worktree-collision-ownership-bfz3drxm.js → worktree-collision-ownership-42bb3gcb.js} +1 -1
  47. package/dist/cli/{worktree-isolation-cc3x13ng.js → worktree-isolation-fbfvxw9a.js} +18 -18
  48. package/dist/hooks/pr-workflow-gate.d.ts +135 -1
  49. package/dist/index.js +20 -18
  50. package/dist/tools/complete-pr-workflow.d.ts +3 -1
  51. package/dist/tools/pr-workflow-status.d.ts +2 -2
  52. package/dist/tools/write-pr-review-trigger-eval.d.ts +2 -1
  53. package/package.json +1 -1
@@ -20,52 +20,52 @@ import {
20
20
  sanitizeWorktreeTaskId,
21
21
  standardWorktreeByCallID,
22
22
  standardWorktreeSerializationSessions
23
- } from "./index-gz3z9d64.js";
24
- import"./index-6htwcbxh.js";
25
- import"./index-ja15rdzd.js";
26
- import"./index-c9d5y70c.js";
23
+ } from "./index-5d8ydxae.js";
24
+ import"./index-nd1j9wkw.js";
25
+ import"./index-whyrhjsk.js";
26
+ import"./index-w1q9yy1e.js";
27
27
  import"./index-134d35c1.js";
28
28
  import"./index-b6e016tv.js";
29
29
  import"./index-4q9vfav6.js";
30
30
  import"./index-k92cagmt.js";
31
31
  import"./index-y8552snf.js";
32
- import"./index-dmtq7tvd.js";
32
+ import"./index-92bm9ys3.js";
33
33
  import"./index-xmzmeknp.js";
34
34
  import"./index-c8s9a3zh.js";
35
35
  import"./index-9ss2m4rs.js";
36
- import"./index-td2ga37v.js";
36
+ import"./index-bbv64s17.js";
37
37
  import"./index-74hpm6sh.js";
38
- import"./index-19wyta2k.js";
39
- import"./index-f3xf9dv5.js";
40
- import"./index-v9qmhrj9.js";
41
- import"./index-8qmnqd6g.js";
38
+ import"./index-02nm8qhk.js";
39
+ import"./index-scj2asek.js";
40
+ import"./index-z4cv77tq.js";
41
+ import"./index-hjy4txgr.js";
42
42
  import"./index-556ja8an.js";
43
43
  import"./index-gdd4jt6b.js";
44
44
  import"./index-zsrtt42s.js";
45
45
  import"./index-k3cxyk66.js";
46
- import"./index-8aabbfhv.js";
47
- import"./index-gbr0jbxy.js";
46
+ import"./index-6vmazy9f.js";
47
+ import"./index-s7nb33pc.js";
48
48
  import"./index-8fwhhayc.js";
49
49
  import"./index-q1exe2b3.js";
50
50
  import"./index-7sy3aa9m.js";
51
51
  import"./index-4905hd2m.js";
52
- import"./index-8fq18k02.js";
52
+ import"./index-0adcjpyx.js";
53
53
  import {
54
54
  resolveWorktreeIsolationConfig
55
- } from "./index-9m5gz9ea.js";
55
+ } from "./index-peqmw3wr.js";
56
56
  import"./index-gprxjmm7.js";
57
57
  import"./index-n832052r.js";
58
- import"./index-f39n8pbr.js";
59
- import"./index-z4g05zbr.js";
58
+ import"./index-36vry26a.js";
59
+ import"./index-7bs015gm.js";
60
60
  import"./index-rn0eq85g.js";
61
61
  import"./index-4rhhvd1a.js";
62
62
  import"./index-jqsfsqbx.js";
63
63
  import"./index-z6xqpmqg.js";
64
64
  import"./index-zjygnfay.js";
65
- import"./index-z0j133c4.js";
65
+ import"./index-gzxz0s50.js";
66
66
  import"./index-tq5s07ta.js";
67
67
  import"./index-rtry5xyf.js";
68
- import"./index-5qqyvwqw.js";
68
+ import"./index-wjk00vwk.js";
69
69
  import"./index-ae75rja9.js";
70
70
  import"./index-w7x7qxz2.js";
71
71
  import"./index-erfnw81g.js";
@@ -1,4 +1,5 @@
1
1
  import * as fsp from 'node:fs/promises';
2
+ import { z } from 'zod';
2
3
  import { type CandidateSeverity, type RowFormatFamily } from '../background/candidate-contract.js';
3
4
  import { type LaneOutputArtifact } from '../background/lane-output-store.js';
4
5
  import { type BackgroundDelegationRecord, type BackgroundDelegationResult, findByBatchId } from '../background/pending-delegations.js';
@@ -326,6 +327,12 @@ export interface PrWorkflowGateState {
326
327
  prFeedbackTargetUrl?: string;
327
328
  prFeedbackReviewHandoff?: PrFeedbackReviewHandoffRecord;
328
329
  prFeedbackInventory?: string[];
330
+ /**
331
+ * Append-only audit ledger of entries added to `prFeedbackInventory` after
332
+ * its first declaration (issue #2242 R3). Bounded by
333
+ * {@link MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS}; never pruned.
334
+ */
335
+ prFeedbackInventoryAmendments?: PrFeedbackInventoryAmendmentRecord[];
329
336
  prFeedbackVerifications?: PrFeedbackVerificationRecord[];
330
337
  /**
331
338
  * Item -> lane bindings of verification batches the capacity GC dropped
@@ -352,6 +359,28 @@ export interface PrWorkflowGateState {
352
359
  prFeedbackRebindCount?: number;
353
360
  prFeedbackScopes?: PrFeedbackScopeDeclarationRecord[];
354
361
  }
362
+ /**
363
+ * Bound on the PR_FEEDBACK inventory-amendment audit ledger (issue #2242 R3).
364
+ *
365
+ * `declarePrFeedbackInventory` is agent-callable and each call can append, so
366
+ * this array would otherwise grow without limit on durable state. It is an
367
+ * integrity ledger, not a reclaimable cache: unlike `prFeedbackVerifications`
368
+ * (which `prunePrFeedbackVerificationsForCapacity` compacts), pruning it would
369
+ * destroy the audit trail, so the cap fails closed on further amendments
370
+ * instead.
371
+ */
372
+ export declare const MAX_PR_FEEDBACK_INVENTORY_AMENDMENTS = 128;
373
+ /**
374
+ * One appended PR_FEEDBACK inventory entry (issue #2242 R3). `batch` groups the
375
+ * entries appended by a single `declarePrFeedbackInventory` call so an auditor
376
+ * can tell "two items found in one pass" from "two separate late discoveries".
377
+ */
378
+ declare const PrFeedbackInventoryAmendmentRecordSchema: z.ZodObject<{
379
+ entry: z.ZodString;
380
+ amendedAt: z.ZodString;
381
+ batch: z.ZodNumber;
382
+ }, z.core.$strict>;
383
+ export type PrFeedbackInventoryAmendmentRecord = z.infer<typeof PrFeedbackInventoryAmendmentRecordSchema>;
355
384
  export declare function activatePrWorkflow(directory: string, sessionID: string, mode: PrWorkflowMode, options?: {
356
385
  prHeadSha?: string;
357
386
  requireCheckoutPreflight?: boolean;
@@ -376,7 +405,42 @@ export declare function withPrWorkflowCheckoutPreparationLock<T>(directory: stri
376
405
  * activatePrWorkflow/persistState call.
377
406
  */
378
407
  export declare function withInactivePrWorkflowCheckoutRestoreLock<T>(directory: string, sessionID: string, action: () => Promise<T>): Promise<T>;
379
- export declare function clearPrWorkflowGateState(directory: string, sessionID: string, expectedRevision?: number): Promise<void>;
408
+ export declare function clearPrWorkflowGateState(directory: string, sessionID: string, expectedRevision?: number, options?: {
409
+ allowSalvagedRead?: boolean;
410
+ }): Promise<void>;
411
+ export interface PrWorkflowStaleLaneSettlement {
412
+ /** Lanes still genuinely in flight (fresh `updatedAt`). These still block. */
413
+ openLaneIds: string[];
414
+ openLanes: number;
415
+ /** Lanes stale past the horizon, treated as settled with disclosure. */
416
+ presumedStaleLaneIds: string[];
417
+ /** Operator-facing disclosure; `undefined` when nothing was presumed stale. */
418
+ disclosure?: string;
419
+ }
420
+ /**
421
+ * Resolve the open-lane predicate shared by `abortPrWorkflow`, the
422
+ * PR_REVIEW→PR_FEEDBACK transition, and `completePrWorkflow` (issue #2242 R2,
423
+ * wedge W-4).
424
+ *
425
+ * A lane whose delegation record has not advanced its `updatedAt` within
426
+ * `PR_WORKFLOW_STALE_LANE_TIMEOUT_MS` is **presumed stale** and settles with
427
+ * disclosure instead of blocking forever. The background process backing a lane
428
+ * can die without ever writing a terminal snapshot, and these three predicates
429
+ * are exactly the exits an operator reaches for when nothing else can proceed —
430
+ * previously the abort escape hatch was refused by the same check it exists to
431
+ * resolve, leaving the workflow with no exit through any tool.
432
+ *
433
+ * Deliberate ordering — this is the reachability invariant, do not "simplify"
434
+ * it: staleness is decided by the **in-memory filter below**, and
435
+ * `sweepStaleDelegations` runs only afterwards as a best-effort durability
436
+ * complement. That sweep swallows lock timeouts and returns 0
437
+ * (`pending-delegations.ts`), so making reachability depend on it would let a
438
+ * contended store lock re-create the exact wedge this removes.
439
+ *
440
+ * A lane with a RECENT `updatedAt` still blocks: a re-verification that CAN run
441
+ * and reports "still progressing" contradicts settlement and fails closed.
442
+ */
443
+ export declare function settlePresumedStalePrWorkflowLanes(directory: string, sessionID: string): Promise<PrWorkflowStaleLaneSettlement>;
380
444
  /**
381
445
  * Abort an active PR workflow gate without reaching terminal completion.
382
446
  *
@@ -414,6 +478,11 @@ export declare function abortPrWorkflow(directory: string, sessionID: string, op
414
478
  mode: PrWorkflowMode;
415
479
  prHeadSha?: string;
416
480
  openLanes: number;
481
+ presumedStaleLanes?: string[];
482
+ presumedStaleDisclosure?: string;
483
+ stateSalvaged?: boolean;
484
+ stateSalvageDisclosure?: string;
485
+ casEscapeDisclosure?: string;
417
486
  }>;
418
487
  /** Bind an active PR workflow to one immutable PR head. */
419
488
  export declare function bindPrWorkflowHead(directory: string, sessionID: string, prHeadSha: string): Promise<PrWorkflowGateState>;
@@ -563,6 +632,12 @@ export declare const _test_exports: {
563
632
  withPrWorkflowCheckoutMutationLock: typeof withPrWorkflowCheckoutMutationLock;
564
633
  resetTrackedStateCache: () => void;
565
634
  beforeTerminalClear: (() => Promise<void>) | undefined;
635
+ /**
636
+ * Interleave point between the durable `pr_workflow_aborted` append and the
637
+ * CAS-guarded clear, so a test can simulate the concurrent mutation that
638
+ * makes the clear throw after the audit record is already on disk (FB-008).
639
+ */
640
+ beforeAbortClear: (() => Promise<void>) | undefined;
566
641
  beforePrFeedbackTransitionLock: (() => Promise<void>) | undefined;
567
642
  beforePrFeedbackTrackingSwitch: (() => Promise<void>) | undefined;
568
643
  afterPrFeedbackTrackingSwitch: (() => Promise<void>) | undefined;
@@ -880,6 +955,65 @@ export declare class PrWorkflowCheckoutMutationTimeoutError extends Error {
880
955
  /** Serialize project-wide checkout mutations before any session state lock. */
881
956
  export declare function withPrWorkflowCheckoutMutationLock<T>(directory: string, action: () => Promise<T>): Promise<T>;
882
957
  declare function isProcessAlive(pid: number): boolean;
958
+ /**
959
+ * Upper bound on the length of ONE quoted schema issue.
960
+ *
961
+ * The issue-COUNT cap alone is not a bound on disclosure size: zod folds every
962
+ * unrecognized key of a single strict object into ONE `unrecognized_keys` issue
963
+ * whose message inlines all of them, so one oversized key in a nested strict
964
+ * child (e.g. `checkoutRecovery`) yields a single 80,000-char message that the
965
+ * count cap does nothing about. The disclosure is written durably to
966
+ * `.swarm/events.jsonl` and surfaced verbatim in `pr_workflow_status`, so an
967
+ * attacker-influenced or partially-written state file could otherwise flood the
968
+ * audit sink and the operator's console. Matches the ellipsis-marker style of
969
+ * `MAX_LANE_VALIDATION_VALUE_CHARS` — this is operator prose, so the truncation
970
+ * must be visible rather than silent.
971
+ */
972
+ export declare const MAX_SALVAGED_SCHEMA_ERROR_CHARS = 240;
973
+ /** Result of one recovery-only gate-state read. */
974
+ export interface PrWorkflowGateRecoveryRead {
975
+ /** Schema-valid state, or the salvaged projection when `salvaged`. */
976
+ state: PrWorkflowGateState;
977
+ /** true when the durable bytes failed schema validation and were salvaged. */
978
+ salvaged: boolean;
979
+ /** `path: message` per schema issue; empty unless `salvaged`. */
980
+ schemaErrors: string[];
981
+ /** Loud operator-facing disclosure; present only when `salvaged`. */
982
+ disclosure?: string;
983
+ /** false when `revision` could not be salvaged — the CAS escape is required. */
984
+ revisionSalvageable: boolean;
985
+ /**
986
+ * true when a `prFeedbackReadyToPublish` key is present in the raw bytes but
987
+ * is itself unreadable. Callers MUST treat this as armed: silently dropping
988
+ * an unreadable armed marker would turn "corrupt that one record" into a way
989
+ * to bypass the armed-abort refusal — a forgery-class relaxation, not an
990
+ * availability one.
991
+ */
992
+ armedShapeUnreadable: boolean;
993
+ }
994
+ /**
995
+ * Recovery-only gate-state reader (issue #2242 R4, wedge W-5).
996
+ *
997
+ * Used by `abortPrWorkflow` and `pr_workflow_status` ONLY. The general reader
998
+ * (`readPrWorkflowGateStateFromDisk`) is deliberately unchanged, so no write,
999
+ * completion, or verification path can ever act on a salvaged projection.
1000
+ *
1001
+ * Policy, mirroring the file-wide "unavailability degrades with disclosure;
1002
+ * contradiction fails closed" invariant:
1003
+ * - **Unparseable bytes fail everywhere**, recovery included. There is nothing
1004
+ * to salvage and guessing would be fabrication.
1005
+ * - **Schema-validation failure on parseable JSON** salvages the fields abort
1006
+ * actually reads — `{sessionID, mode, prHeadSha}` plus `revision`,
1007
+ * `prFeedbackReadyToPublish` and `checkoutRecovery` when each is
1008
+ * individually well-formed — with a loud disclosure naming the schema
1009
+ * errors. Everything else is dropped rather than guessed.
1010
+ * - **Identity is not salvageable ⇒ nothing is.** Without a readable
1011
+ * `sessionID` and `mode` there is no provable subject to act on, so the
1012
+ * original `is invalid` failure stands.
1013
+ *
1014
+ * A salvaged view is never written to the tracked-state cache.
1015
+ */
1016
+ export declare function readPrWorkflowGateStateForRecovery(directory: string, sessionID: string): Promise<PrWorkflowGateRecoveryRead | null>;
883
1017
  declare function workflowGateStateLockRelativePath(sessionID: string): string;
884
1018
  declare function workflowGateStateRelativePath(sessionID: string): string;
885
1019
  export declare function prWorkflowSessionFileStem(sessionID: string): string;