opencode-swarm 7.152.1 → 7.153.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 (121) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +10 -10
  2. package/dist/background/pending-delegations.d.ts +7 -0
  3. package/dist/cli/{capability-probe-va4kk8vg.js → capability-probe-5wa7mcp6.js} +3 -2
  4. package/dist/cli/{config-doctor-bbqmye7a.js → config-doctor-ze21qs6b.js} +3 -3
  5. package/dist/cli/{core-fh4e6ex0.js → core-qdmhh1kx.js} +2 -2
  6. package/dist/cli/{curation-policy-nem98yc9.js → curation-policy-twa6agf8.js} +7 -7
  7. package/dist/cli/{curator-909s9dvs.js → curator-hxb3wsxr.js} +32 -33
  8. package/dist/cli/curator-llm-factory-s8atmc2n.js +64 -0
  9. package/dist/cli/{evidence-summary-service-kqw4y0yr.js → evidence-summary-service-wzzym9r7.js} +15 -15
  10. package/dist/cli/{gate-evidence-ycts62pj.js → gate-evidence-f71dn9vv.js} +8 -8
  11. package/dist/cli/guardrail-explain-5kzeem4m.js +65 -0
  12. package/dist/cli/{guardrail-log-e1tmdxxa.js → guardrail-log-38jnajpa.js} +6 -6
  13. package/dist/cli/{guardrail-reset-gdnaxxvb.js → guardrail-reset-wzvtmpn2.js} +32 -33
  14. package/dist/cli/{hive-promoter-d0xydg6r.js → hive-promoter-55qcqgfx.js} +32 -33
  15. package/dist/cli/{index-x6803sxh.js → index-0tyc8kdg.js} +2 -2
  16. package/dist/cli/{index-z8s2asdk.js → index-0tzv5zg2.js} +22 -150
  17. package/dist/cli/{index-3djxegsc.js → index-1akn19mp.js} +1 -1
  18. package/dist/cli/{index-q77e475x.js → index-1dtshrzg.js} +5 -5
  19. package/dist/cli/{index-73pmnsjg.js → index-1gzdnjg9.js} +2 -2
  20. package/dist/cli/{index-4tvvh7pn.js → index-23rneydq.js} +36 -35
  21. package/dist/cli/{index-z4bg1hv8.js → index-2mqmvxac.js} +9 -2
  22. package/dist/cli/index-3cegckkq.js +239 -0
  23. package/dist/cli/{index-pvrap7xg.js → index-3ttktt56.js} +1 -1
  24. package/dist/cli/{index-85gkedsf.js → index-4fwbbad3.js} +521 -15
  25. package/dist/cli/{index-qqrdmaxq.js → index-4g0g3dqz.js} +2 -2
  26. package/dist/cli/{index-44xdtqz8.js → index-4pjkdcgc.js} +1 -1
  27. package/dist/cli/{index-29vd7v3e.js → index-6vgb5fyb.js} +1 -1
  28. package/dist/cli/{index-sg2sx2q7.js → index-6ybjrqf7.js} +13095 -9360
  29. package/dist/cli/{index-txbd25bc.js → index-891g7hbf.js} +1 -1
  30. package/dist/cli/{index-02ajc6d1.js → index-8v9sj4aq.js} +2 -2
  31. package/dist/cli/{index-z9fyd0d6.js → index-9v8d3c0k.js} +450 -48
  32. package/dist/cli/{index-26vyr198.js → index-af0cqe6n.js} +16 -16
  33. package/dist/cli/{index-ryecg2st.js → index-ajkxx2k6.js} +3 -3
  34. package/dist/cli/{index-k3d919yf.js → index-gn26q90p.js} +85 -24
  35. package/dist/cli/{index-0tfgn5x0.js → index-k10qtq71.js} +9 -9
  36. package/dist/cli/{index-xyfdmrv7.js → index-mb7b1gye.js} +3 -3
  37. package/dist/cli/{index-0q2mjxp2.js → index-meg33yyv.js} +1 -1
  38. package/dist/cli/{index-cpg98bh1.js → index-myt57pht.js} +1 -1
  39. package/dist/cli/{index-2e1294d1.js → index-n5pxkera.js} +16 -10
  40. package/dist/cli/{index-n0vc5b5t.js → index-n823qsae.js} +16 -7
  41. package/dist/cli/{index-6zkm4p7p.js → index-pk1gbqmq.js} +1 -1
  42. package/dist/cli/{index-nd8tkb3g.js → index-smqsp8hs.js} +5 -5
  43. package/dist/cli/{index-7fh82sm1.js → index-td0jz8xe.js} +6 -6
  44. package/dist/cli/{index-dn6yt0xg.js → index-tdzbm974.js} +7 -7
  45. package/dist/cli/{index-rq6aetkv.js → index-v689bmr2.js} +4 -4
  46. package/dist/cli/{index-79g6edht.js → index-x3y6zhgj.js} +1 -1
  47. package/dist/cli/{index-aw492hpn.js → index-x8vw6ap1.js} +58 -41
  48. package/dist/cli/{index-96m8ckpq.js → index-xkjrg9k4.js} +4 -4
  49. package/dist/cli/{index-mken64yj.js → index-zppxpc3y.js} +2 -2
  50. package/dist/cli/index.js +32 -33
  51. package/dist/cli/{knowledge-escalator-4egcr928.js → knowledge-escalator-w05ztgvk.js} +13 -13
  52. package/dist/cli/{knowledge-events-kdyv4jzn.js → knowledge-events-pwm9jc0m.js} +11 -11
  53. package/dist/cli/{knowledge-link-h8cwj7af.js → knowledge-link-ge0rddxw.js} +6 -6
  54. package/dist/cli/{knowledge-store-dq3cvg53.js → knowledge-store-4xv65tj2.js} +7 -7
  55. package/dist/cli/{knowledge-validator-4bhtden9.js → knowledge-validator-0ttfsca7.js} +9 -9
  56. package/dist/cli/{model-preflight-7ea00h34.js → model-preflight-b95w8wxy.js} +1 -1
  57. package/dist/cli/{pending-delegations-a2nmssr1.js → pending-delegations-nk78wx7h.js} +4 -4
  58. package/dist/cli/{pr-subscriptions-7879nq5k.js → pr-subscriptions-dq1f61ye.js} +4 -4
  59. package/dist/cli/{runner-w81n9js3.js → runner-n50w1y4w.js} +7 -7
  60. package/dist/cli/{scan-cursor-2eezv81a.js → scan-cursor-b6n15w8d.js} +8 -8
  61. package/dist/cli/{schema-v4qcqhek.js → schema-jkbfwqr2.js} +2 -2
  62. package/dist/cli/{scope-persistence-y2r227r0.js → scope-persistence-5xt2m5ep.js} +10 -10
  63. package/dist/cli/{skill-generator-hhzxvb3h.js → skill-generator-3keadpf7.js} +15 -15
  64. package/dist/cli/{telemetry-52pw5xac.js → telemetry-hh1j99za.js} +1 -1
  65. package/dist/cli/{worktree-collision-ownership-p31zm5k0.js → worktree-collision-ownership-4drcjymy.js} +15 -10
  66. package/dist/cli/{worktree-isolation-ve338ez6.js → worktree-isolation-1ymaxn4h.js} +32 -33
  67. package/dist/commands/approve-write.d.ts +1 -0
  68. package/dist/commands/index.d.ts +1 -0
  69. package/dist/commands/lanes.d.ts +25 -0
  70. package/dist/commands/registry.d.ts +7 -0
  71. package/dist/config/schema.d.ts +39 -4
  72. package/dist/consensus/contracts.d.ts +14 -0
  73. package/dist/consensus/corpus.d.ts +16 -0
  74. package/dist/hooks/delegation-gate/worktree-isolation.d.ts +50 -3
  75. package/dist/hooks/delegation-gate/worktree-provisioning-owner.d.ts +40 -2
  76. package/dist/hooks/delegation-gate/worktree-recovery-authority.d.ts +201 -0
  77. package/dist/hooks/full-auto-permission.d.ts +7 -0
  78. package/dist/hooks/guardrails/index.d.ts +2 -1
  79. package/dist/hooks/guardrails/tool-before.d.ts +4 -0
  80. package/dist/hooks/init-orphan-recovery.d.ts +5 -1
  81. package/dist/hooks/pr-workflow-gate.d.ts +12 -0
  82. package/dist/hooks/scope-guard.d.ts +1 -3
  83. package/dist/hooks/trajectory-logger.d.ts +22 -6
  84. package/dist/hooks/trajectory-step-state.d.ts +43 -2
  85. package/dist/index.js +645 -622
  86. package/dist/learning/provenance.d.ts +9 -0
  87. package/dist/observability/catalog.d.ts +6 -4
  88. package/dist/prm/index.d.ts +3 -3
  89. package/dist/prm/replay.d.ts +29 -2
  90. package/dist/prm/trajectory-store.d.ts +210 -20
  91. package/dist/sandbox/capability-probe.d.ts +40 -1
  92. package/dist/sandbox/executor.d.ts +26 -1
  93. package/dist/sandbox/linux/bubblewrap-executor.d.ts +3 -1
  94. package/dist/sandbox/macos/sandbox-exec-executor.d.ts +3 -1
  95. package/dist/sandbox/skip-state.d.ts +24 -0
  96. package/dist/sandbox/win32/native-sandbox-executor.d.ts +5 -1
  97. package/dist/security/command-classifier.d.ts +22 -0
  98. package/dist/security/protected-input-integrity.d.ts +19 -0
  99. package/dist/security/protected-path-policy.d.ts +9 -0
  100. package/dist/security/write-authority.d.ts +46 -0
  101. package/dist/services/diagnose-service.d.ts +1 -1
  102. package/dist/services/skill-generator.d.ts +2 -0
  103. package/dist/services/skill-improver.d.ts +69 -0
  104. package/dist/telemetry.d.ts +21 -1
  105. package/dist/tools/dispatch-lanes.d.ts +47 -0
  106. package/dist/tools/repo-graph/query.d.ts +2 -1
  107. package/dist/tools/repo-graph/types.d.ts +64 -0
  108. package/dist/tools/repo-graph.d.ts +1 -1
  109. package/dist/tools/skill-improve.d.ts +7 -0
  110. package/dist/utils/atomic-write.d.ts +2 -0
  111. package/dist/utils/canonical-root.d.ts +31 -0
  112. package/dist/workflow/coder-settlement.d.ts +2 -0
  113. package/dist/worktree/index.d.ts +2 -2
  114. package/dist/worktree/merge.d.ts +47 -0
  115. package/package.json +2 -1
  116. package/dist/cli/curator-llm-factory-462rysph.js +0 -65
  117. package/dist/cli/guardrail-explain-7620hasq.js +0 -66
  118. package/dist/cli/index-3g0xk6tk.js +0 -219
  119. package/dist/cli/index-fxvgaeq4.js +0 -125
  120. package/dist/cli/worktree-provisioning-owner-cve95q4f.js +0 -22
  121. package/dist/cli/{curator-drift-2h1d2fnq.js → curator-drift-h57z6tm3.js} +1 -1
@@ -555,11 +555,25 @@ export declare const GuardrailsConfigSchema: z.ZodObject<{
555
555
  execution_stall_stop_calls: z.ZodDefault<z.ZodNumber>;
556
556
  execution_stall_episode_minutes: z.ZodDefault<z.ZodNumber>;
557
557
  sandbox_macos_enabled: z.ZodOptional<z.ZodBoolean>;
558
+ sandbox: z.ZodOptional<z.ZodObject<{
559
+ mode: z.ZodDefault<z.ZodEnum<{
560
+ advisory: "advisory";
561
+ required: "required";
562
+ }>>;
563
+ require_filesystem: z.ZodDefault<z.ZodBoolean>;
564
+ require_network: z.ZodDefault<z.ZodBoolean>;
565
+ require_process: z.ZodDefault<z.ZodBoolean>;
566
+ network_mode: z.ZodDefault<z.ZodEnum<{
567
+ on: "on";
568
+ off: "off";
569
+ }>>;
570
+ network_allowlist: z.ZodDefault<z.ZodArray<z.ZodString>>;
571
+ writable_roots: z.ZodDefault<z.ZodArray<z.ZodString>>;
572
+ }, z.core.$strip>>;
558
573
  }, z.core.$strip>;
559
574
  export type GuardrailsConfig = z.infer<typeof GuardrailsConfigSchema>;
560
575
  export declare const WatchdogConfigSchema: z.ZodObject<{
561
576
  scope_guard: z.ZodDefault<z.ZodBoolean>;
562
- skip_in_turbo: z.ZodDefault<z.ZodBoolean>;
563
577
  delegation_ledger: z.ZodDefault<z.ZodBoolean>;
564
578
  }, z.core.$strip>;
565
579
  export type WatchdogConfig = z.infer<typeof WatchdogConfigSchema>;
@@ -1281,9 +1295,9 @@ export declare const WorktreeIsolationConfigSchema: z.ZodObject<{
1281
1295
  copy: "copy";
1282
1296
  }>>;
1283
1297
  lane_permissions: z.ZodDefault<z.ZodEnum<{
1298
+ off: "off";
1284
1299
  scoped_allow: "scoped_allow";
1285
1300
  deny: "deny";
1286
- off: "off";
1287
1301
  }>>;
1288
1302
  serialization_release_after_dispatches: z.ZodDefault<z.ZodNumber>;
1289
1303
  serialization_release_after_ms: z.ZodDefault<z.ZodNumber>;
@@ -1742,6 +1756,13 @@ export interface PrReviewResilienceConfig {
1742
1756
  correlated_failure_threshold: number;
1743
1757
  max_retry_attempts_after_initial: number;
1744
1758
  }
1759
+ /**
1760
+ * Issue #2381: staged PR-review resilience defaults OFF while the #2380 repair
1761
+ * program is incomplete. Tier M/L base waves therefore use the legacy one-wave
1762
+ * dispatch unless a project explicitly opts in with `enabled: true`, which
1763
+ * remains fully honored. The tracker re-enables this by default only after its
1764
+ * host/OS/depth validation matrix is green.
1765
+ */
1745
1766
  export declare const DEFAULT_PR_REVIEW_RESILIENCE_CONFIG: PrReviewResilienceConfig;
1746
1767
  export declare const PrReviewResilienceConfigSchema: z.ZodObject<{
1747
1768
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -1960,10 +1981,24 @@ export declare const PluginConfigSchema: z.ZodObject<{
1960
1981
  execution_stall_stop_calls: z.ZodDefault<z.ZodNumber>;
1961
1982
  execution_stall_episode_minutes: z.ZodDefault<z.ZodNumber>;
1962
1983
  sandbox_macos_enabled: z.ZodOptional<z.ZodBoolean>;
1984
+ sandbox: z.ZodOptional<z.ZodObject<{
1985
+ mode: z.ZodDefault<z.ZodEnum<{
1986
+ advisory: "advisory";
1987
+ required: "required";
1988
+ }>>;
1989
+ require_filesystem: z.ZodDefault<z.ZodBoolean>;
1990
+ require_network: z.ZodDefault<z.ZodBoolean>;
1991
+ require_process: z.ZodDefault<z.ZodBoolean>;
1992
+ network_mode: z.ZodDefault<z.ZodEnum<{
1993
+ on: "on";
1994
+ off: "off";
1995
+ }>>;
1996
+ network_allowlist: z.ZodDefault<z.ZodArray<z.ZodString>>;
1997
+ writable_roots: z.ZodDefault<z.ZodArray<z.ZodString>>;
1998
+ }, z.core.$strip>>;
1963
1999
  }, z.core.$strip>>;
1964
2000
  watchdog: z.ZodOptional<z.ZodObject<{
1965
2001
  scope_guard: z.ZodDefault<z.ZodBoolean>;
1966
- skip_in_turbo: z.ZodDefault<z.ZodBoolean>;
1967
2002
  delegation_ledger: z.ZodDefault<z.ZodBoolean>;
1968
2003
  }, z.core.$strip>>;
1969
2004
  self_review: z.ZodOptional<z.ZodObject<{
@@ -2594,9 +2629,9 @@ export declare const PluginConfigSchema: z.ZodObject<{
2594
2629
  copy: "copy";
2595
2630
  }>>;
2596
2631
  lane_permissions: z.ZodDefault<z.ZodEnum<{
2632
+ off: "off";
2597
2633
  scoped_allow: "scoped_allow";
2598
2634
  deny: "deny";
2599
- off: "off";
2600
2635
  }>>;
2601
2636
  serialization_release_after_dispatches: z.ZodDefault<z.ZodNumber>;
2602
2637
  serialization_release_after_ms: z.ZodDefault<z.ZodNumber>;
@@ -12,6 +12,7 @@
12
12
  * without forcing consumers to read Zod inference to learn the shape.
13
13
  */
14
14
  import { z } from 'zod';
15
+ import type { WriteAuthorityOrigin } from '../security/write-authority.js';
15
16
  /** Upper bound on any single reference list. Keeps a report bounded on disk. */
16
17
  export declare const MAX_CONSENSUS_REFS = 200;
17
18
  /**
@@ -234,6 +235,7 @@ export interface ProposedSkillChangeProvenance {
234
235
  writeOrigin: {
235
236
  sessionId?: string;
236
237
  agentRole?: string;
238
+ authority?: WriteAuthorityOrigin;
237
239
  producedAt: string;
238
240
  };
239
241
  }
@@ -258,6 +260,12 @@ export declare const ProposedSkillChangeSchema: z.ZodObject<{
258
260
  writeOrigin: z.ZodObject<{
259
261
  sessionId: z.ZodOptional<z.ZodString>;
260
262
  agentRole: z.ZodOptional<z.ZodString>;
263
+ authority: z.ZodOptional<z.ZodEnum<{
264
+ critic_approved: "critic_approved";
265
+ autonomous: "autonomous";
266
+ optimizer_proposed: "optimizer_proposed";
267
+ human_approved: "human_approved";
268
+ }>>;
261
269
  producedAt: z.ZodISODateTime;
262
270
  }, z.core.$strict>;
263
271
  }, z.core.$strict>;
@@ -420,6 +428,12 @@ export declare const ConsensusReportV1Schema: z.ZodObject<{
420
428
  writeOrigin: z.ZodObject<{
421
429
  sessionId: z.ZodOptional<z.ZodString>;
422
430
  agentRole: z.ZodOptional<z.ZodString>;
431
+ authority: z.ZodOptional<z.ZodEnum<{
432
+ critic_approved: "critic_approved";
433
+ autonomous: "autonomous";
434
+ optimizer_proposed: "optimizer_proposed";
435
+ human_approved: "human_approved";
436
+ }>>;
423
437
  producedAt: z.ZodISODateTime;
424
438
  }, z.core.$strict>;
425
439
  }, z.core.$strict>;
@@ -81,6 +81,7 @@ import { type GateAuditReadSummary } from '../evaluation/store.js';
81
81
  import { type LoadEvidenceResult } from '../evidence/manager.js';
82
82
  import type { RetrievalOutcome } from '../hooks/knowledge-types.js';
83
83
  import { readSkillUsageEntries, type readSkillUsageEntriesWithCoverage } from '../hooks/skill-usage-log.js';
84
+ import { type TrajectoryReadWithCoverage } from '../prm/trajectory-store.js';
84
85
  import type { TrajectoryEntry } from '../prm/types.js';
85
86
  import type { ConsensusCorpusHash, ConsensusSourceKind } from './contracts.js';
86
87
  /**
@@ -129,6 +130,21 @@ export interface CorpusReaders {
129
130
  readTaskTrajectory: (directory: string, taskId: string) => Promise<TrajectoryEntry[]>;
130
131
  listTrajectorySessions: (directory: string) => Promise<string[]>;
131
132
  readTrajectory: (sessionId: string, directory: string) => Promise<TrajectoryEntry[]>;
133
+ /**
134
+ * Additive coverage seam (issue #2041 Required 4), mirroring
135
+ * `readSkillUsageEntriesWithCoverage` above: optional, deliberately NOT
136
+ * part of `defaultReaders()`, and injecting it overrides BOTH the entries
137
+ * and the coverage verdict so an injected fixture stays coherent.
138
+ *
139
+ * Without it, entries keep coming from `readTrajectory` (injected fixtures
140
+ * keep working) and the default coverage verdict comes from the session's
141
+ * persisted checkpoint (`readTrajectoryCheckpoint`) — the same
142
+ * manifest-only precedent the skill-usage source uses. The default path's
143
+ * known limit mirrors that precedent too: it discloses compaction eviction
144
+ * (`droppedEntries`) but not a single read that hit the tail-window byte
145
+ * cap, which for a within-budget store is unreachable.
146
+ */
147
+ readTrajectoryWithCoverage?: (sessionId: string, directory: string) => Promise<TrajectoryReadWithCoverage>;
132
148
  readSkillUsageEntries: typeof readSkillUsageEntries;
133
149
  /**
134
150
  * Additive coverage seam (issue #2038 §7). Optional, and deliberately NOT
@@ -13,9 +13,12 @@ import { tryAcquireLock } from '../../parallel/file-locks';
13
13
  import { bunSpawn } from '../../utils/bun-compat';
14
14
  import { resolveGitExecutable } from '../../utils/git-executable.js';
15
15
  import type { WorktreeHandle } from '../../worktree';
16
- import { attemptMergeBackFromDirty, cleanupOrphanedBranches, postMergeCleanup, provisionWorktree, pruneStaleWorktreeMetadata, removeWorktree, startupOrphanRecovery } from '../../worktree';
17
- import type { DirtyMergeOptions, MergeOperationProvenance } from '../../worktree/merge';
16
+ import { attemptMergeBackFromDirty, cleanupOrphanedBranches, postMergeCleanup, provisionWorktree, pruneStaleWorktreeMetadata, recoverMergeBackFromImmutableCoordinates, removeWorktree, startupOrphanRecovery } from '../../worktree';
17
+ import type { DirtyMergeOptions, ImmutableMergeRecoveryCoordinates, MergeOperationProvenance } from '../../worktree/merge';
18
+ import type { WorktreeProvisioningOwnerRemovalIdentity } from './worktree-provisioning-owner';
18
19
  import { recordWorktreeProvisioningOwner, removeWorktreeProvisioningOwner } from './worktree-provisioning-owner';
20
+ import type { WorktreeRecoveryImmutableIdentityInput } from './worktree-recovery-authority';
21
+ import { claimWorktreeRecoveryAuthority, finalizeWorktreeRecoveryAuthority, lookupWorktreeRecoveryAuthoritiesByTask, publishWorktreeRecoveryAuthority, releaseWorktreeRecoveryClaim, renewWorktreeRecoveryClaim, replayWorktreeRecoveryClaimJournal } from './worktree-recovery-authority';
19
22
  /**
20
23
  * FR-201: Per-lane runtime profile injected into spawned child processes.
21
24
  *
@@ -59,8 +62,23 @@ export interface StandardWorktreeDispatch {
59
62
  parentSessionID: string;
60
63
  taskId: string;
61
64
  planTaskId?: string;
65
+ reservationId?: string;
66
+ generation?: number;
67
+ provisioningOwner?: WorktreeProvisioningOwnerRemovalIdentity;
68
+ canonicalBranch?: string;
69
+ canonicalPath?: string;
62
70
  handle: WorktreeHandle;
63
71
  mergeStrategy: 'merge' | 'rebase' | 'cherry-pick';
72
+ recoveryClaim?: {
73
+ authorityDigest: string;
74
+ claimRevision: number;
75
+ rawToken: string;
76
+ coordinates?: ImmutableMergeRecoveryCoordinates;
77
+ settlement?: {
78
+ sourceCommitOrder: string[];
79
+ rewrittenCommitOrder: string[];
80
+ };
81
+ };
64
82
  /** FR-201: 0-based lane index for runtime profile derivation. */
65
83
  laneIndex: number;
66
84
  /** Configured worktree-dir override, so cleanup trusts the same base. */
@@ -102,6 +120,9 @@ export interface AwaitingMergeRecord {
102
120
  parentSessionID: string;
103
121
  taskId: string;
104
122
  planTaskId?: string;
123
+ /** Exact durable launch identity threaded from the delegation gate. */
124
+ reservationId?: string;
125
+ generation?: number;
105
126
  branch: string;
106
127
  worktreePath: string;
107
128
  mergeStrategy: 'merge' | 'rebase' | 'cherry-pick';
@@ -125,6 +146,11 @@ interface SessionSerializationState {
125
146
  */
126
147
  successfulDispatchesSince: number;
127
148
  }
149
+ interface CleanupStandardWorktreeResult {
150
+ removedWorktree: boolean;
151
+ cleanedBranch: boolean;
152
+ preservedRecoveryLane: boolean;
153
+ }
128
154
  export declare function getStandardWorktreeDegradationReason(sessionID: string): {
129
155
  reason: string;
130
156
  at: number;
@@ -187,6 +213,13 @@ declare function inspectStandardWorktreeCollisionOwnership(identity: {
187
213
  branchName: string;
188
214
  worktreePath: string;
189
215
  }): Promise<import("./worktree-collision-ownership").StandardWorktreeCollisionOwnership>;
216
+ declare function buildWorktreeRecoveryPublishIdentity(input: {
217
+ directory: string;
218
+ dispatch: StandardWorktreeDispatch;
219
+ taskId: string;
220
+ provenance: MergeOperationProvenance;
221
+ conflictFiles?: string[];
222
+ }): Promise<WorktreeRecoveryImmutableIdentityInput | undefined>;
190
223
  export declare function precreateStandardWorktreeSession(args: {
191
224
  config: PluginConfig;
192
225
  directory: string;
@@ -194,6 +227,9 @@ export declare function precreateStandardWorktreeSession(args: {
194
227
  callID: string;
195
228
  taskId: string;
196
229
  planTaskId?: string;
230
+ /** Exact durable launch identity threaded from the delegation gate. */
231
+ reservationId?: string;
232
+ generation?: number;
197
233
  description?: string;
198
234
  outputArgs: Record<string, unknown>;
199
235
  /** Scope to materialize into the lane for durability across restart (FR-102). */
@@ -264,7 +300,7 @@ export declare function preserveDirtyWorktreeAtPath(worktreePath: string, branch
264
300
  * @param directory - The project root (required for git worktree/branch commands).
265
301
  * @param worktree_dir - Configured worktree-dir override.
266
302
  */
267
- export declare function cleanupStandardWorktreeForCallId(callID: string, reason: 'success' | 'denied' | 'cancelled', directory: string, worktree_dir?: string): Promise<void>;
303
+ export declare function cleanupStandardWorktreeForCallId(callID: string, reason: 'success' | 'denied' | 'cancelled', directory: string, worktree_dir?: string): Promise<CleanupStandardWorktreeResult>;
268
304
  /**
269
305
  * FR-001a: Abort an in-flight standard worktree dispatch.
270
306
  *
@@ -310,6 +346,7 @@ export declare const _internals: {
310
346
  provisionWorktree: typeof provisionWorktree;
311
347
  removeWorktree: typeof removeWorktree;
312
348
  attemptMergeBackFromDirty: typeof attemptMergeBackFromDirty;
349
+ recoverMergeBackFromImmutableCoordinates: typeof recoverMergeBackFromImmutableCoordinates;
313
350
  postMergeCleanup: typeof postMergeCleanup;
314
351
  pruneStaleWorktreeMetadata: typeof pruneStaleWorktreeMetadata;
315
352
  /** FR-201: read lane runtime profile from disk for spawn injection. */
@@ -335,8 +372,18 @@ export declare const _internals: {
335
372
  tryAcquireWorktreeLifecycleLock: typeof tryAcquireLock;
336
373
  recordWorktreeProvisioningOwner: typeof recordWorktreeProvisioningOwner;
337
374
  removeWorktreeProvisioningOwner: typeof removeWorktreeProvisioningOwner;
375
+ lookupWorktreeRecoveryAuthoritiesByTask: typeof lookupWorktreeRecoveryAuthoritiesByTask;
376
+ claimWorktreeRecoveryAuthority: typeof claimWorktreeRecoveryAuthority;
377
+ renewWorktreeRecoveryClaim: typeof renewWorktreeRecoveryClaim;
378
+ releaseWorktreeRecoveryClaim: typeof releaseWorktreeRecoveryClaim;
379
+ finalizeWorktreeRecoveryAuthority: typeof finalizeWorktreeRecoveryAuthority;
380
+ publishWorktreeRecoveryAuthority: typeof publishWorktreeRecoveryAuthority;
381
+ replayWorktreeRecoveryClaimJournal: typeof replayWorktreeRecoveryClaimJournal;
382
+ buildWorktreeRecoveryPublishIdentity: typeof buildWorktreeRecoveryPublishIdentity;
338
383
  /** FR-001b SC-004: path-based dirty worktree preservation for stale-lane fallback. */
339
384
  preserveDirtyWorktreeAtPath: typeof preserveDirtyWorktreeAtPath;
385
+ /** Bounded lane session.create timeout (tests may override). */
386
+ worktreeSessionCreateTimeoutMs: number;
340
387
  /** FR-001a: abort entry point for in-flight dispatches. */
341
388
  abortStandardWorktreeDispatch: typeof abortStandardWorktreeDispatch;
342
389
  standardWorktreeByCallID: Map<string, StandardWorktreeDispatch>;
@@ -5,15 +5,36 @@
5
5
  */
6
6
  export declare const WORKTREE_PROVISIONING_OWNER_LEASE_MS: number;
7
7
  export declare const WORKTREE_LIFECYCLE_LOCK_FILE = ".swarm/locks/init-orphan-recovery.lock";
8
+ export declare const WORKTREE_PROVISIONING_LIFECYCLE_STATES: readonly ["OWNER_PUBLISHED", "OWNER_REMOVED"];
9
+ export type WorktreeProvisioningLifecycleState = (typeof WORKTREE_PROVISIONING_LIFECYCLE_STATES)[number];
8
10
  export interface WorktreeProvisioningOwner {
9
- schemaVersion: 1 | 2;
11
+ schemaVersion: 1 | 2 | 3;
10
12
  callID: string;
11
13
  parentSessionId: string;
12
14
  worktreeSessionId: string;
13
15
  /** Added in v2 so restart collision checks can identify the exact lane. */
14
16
  taskId?: string;
17
+ /** Added in v3 so restart recovery can correlate the exact reservation. */
18
+ reservationId?: string;
19
+ /** Added in v3 so restart recovery can fence same-task retries. */
20
+ generation?: number;
21
+ /** Added in v3 so crash recovery can corroborate the exact lane ref. */
22
+ branchName?: string;
15
23
  createdAt: number;
16
24
  }
25
+ export type WorktreeProvisioningOwnerRemovalIdentity = Pick<WorktreeProvisioningOwner, 'reservationId' | 'generation' | 'branchName'>;
26
+ export interface WorktreeProvisioningLifecycleEntry {
27
+ schemaVersion: 1;
28
+ state: WorktreeProvisioningLifecycleState;
29
+ callID: string;
30
+ parentSessionId: string;
31
+ worktreeSessionId: string;
32
+ taskId?: string;
33
+ reservationId?: string;
34
+ generation?: number;
35
+ branchName?: string;
36
+ recordedAt: number;
37
+ }
17
38
  export type WorktreeProvisioningOwnerScan = {
18
39
  status: 'ok';
19
40
  owners: WorktreeProvisioningOwner[];
@@ -21,6 +42,16 @@ export type WorktreeProvisioningOwnerScan = {
21
42
  status: 'uncertain';
22
43
  reason: string;
23
44
  };
45
+ export type WorktreeProvisioningLifecycleJournalScan = {
46
+ status: 'ok';
47
+ entries: WorktreeProvisioningLifecycleEntry[];
48
+ } | {
49
+ status: 'uncertain';
50
+ reason: string;
51
+ };
52
+ declare function ownerPath(directory: string, callID: string): string;
53
+ declare function journalPath(directory: string): string;
54
+ declare function readOwner(directory: string, callID: string): WorktreeProvisioningOwner | null;
24
55
  /**
25
56
  * Publish a provisional owner before a standard worktree can be created.
26
57
  * Callers hold the shared orphan-recovery lifecycle lock during this atomic
@@ -28,9 +59,16 @@ export type WorktreeProvisioningOwnerScan = {
28
59
  */
29
60
  export declare function recordWorktreeProvisioningOwner(directory: string, input: Omit<WorktreeProvisioningOwner, 'schemaVersion' | 'createdAt'>): WorktreeProvisioningOwner;
30
61
  /** Remove a provisional owner only after durable ownership or cleanup exists. */
31
- export declare function removeWorktreeProvisioningOwner(directory: string, callID: string): boolean;
62
+ export declare function removeWorktreeProvisioningOwner(directory: string, callID: string, expected?: WorktreeProvisioningOwnerRemovalIdentity): boolean;
32
63
  /**
33
64
  * Strict recovery scan. Anything except ENOENT is uncertainty because omitting
34
65
  * one marker could allow destructive cleanup to race a live worktree.
35
66
  */
36
67
  export declare function scanWorktreeProvisioningOwnersForRecovery(directory: string): WorktreeProvisioningOwnerScan;
68
+ export declare function scanWorktreeProvisioningLifecycleJournalForRecovery(directory: string): WorktreeProvisioningLifecycleJournalScan;
69
+ export declare const _internals: {
70
+ getOwnerPath: typeof ownerPath;
71
+ getJournalPath: typeof journalPath;
72
+ readOwner: typeof readOwner;
73
+ };
74
+ export {};
@@ -0,0 +1,201 @@
1
+ export declare const WORKTREE_RECOVERY_MUTATOR_NAMES: readonly ["publish", "claim", "renew", "release", "finalize", "replay"];
2
+ export type WorktreeRecoveryMutatorName = (typeof WORKTREE_RECOVERY_MUTATOR_NAMES)[number];
3
+ export type WorktreeRecoveryStrategy = 'merge' | 'rebase' | 'cherry-pick';
4
+ export type WorktreeRecoveryStatus = 'preserved' | 'claimed' | 'released' | 'finalized';
5
+ export type WorktreeRecoveryJournalState = 'PREPARED' | 'COMMITTED' | 'CLAIM_RENEWED' | 'ABORTED' | 'RELEASED' | 'FINALIZED';
6
+ export interface WorktreeRecoveryImmutableIdentityInput {
7
+ originalCallID: string;
8
+ parentSessionId: string;
9
+ taskId: string;
10
+ reservationId: string;
11
+ generation: number;
12
+ canonicalBranch: string;
13
+ canonicalPath: string;
14
+ laneBranch: string;
15
+ lanePath: string;
16
+ expectedPrimaryHead: string;
17
+ sourceBaseOid: string;
18
+ sourceHeadOid: string;
19
+ targetHeadOid: string;
20
+ strategy: WorktreeRecoveryStrategy;
21
+ declaredConflictFiles?: string[];
22
+ }
23
+ export interface WorktreeRecoveryImmutableIdentity extends WorktreeRecoveryImmutableIdentityInput {
24
+ createdAt: number;
25
+ }
26
+ export interface WorktreeRecoveryClaimState {
27
+ claimantCallID: string;
28
+ claimantSessionId: string;
29
+ childSessionId: string;
30
+ claimRevision: number;
31
+ attempt: number;
32
+ leaseExpiresAt: number;
33
+ claimTokenDigest: string;
34
+ claimedAt: number;
35
+ }
36
+ export interface WorktreeRecoveryAuthorityRecord {
37
+ schemaVersion: 2;
38
+ authorityDigest: string;
39
+ immutable: WorktreeRecoveryImmutableIdentity;
40
+ status: WorktreeRecoveryStatus;
41
+ claim?: WorktreeRecoveryClaimState;
42
+ claimCursor?: {
43
+ lastClaimRevision: number;
44
+ lastAttempt: number;
45
+ };
46
+ finalizedAt?: number;
47
+ settlement?: {
48
+ sourceCommitOrder: string[];
49
+ rewrittenCommitOrder: string[];
50
+ };
51
+ }
52
+ interface WorktreeRecoveryStore {
53
+ schemaVersion: 2;
54
+ authorities: WorktreeRecoveryAuthorityRecord[];
55
+ index: {
56
+ bySessionTask: Record<string, string[]>;
57
+ };
58
+ }
59
+ export interface WorktreeRecoveryClaimJournalEntry {
60
+ schemaVersion: 1;
61
+ authorityDigest: string;
62
+ state: WorktreeRecoveryJournalState;
63
+ claimantCallID: string;
64
+ claimantSessionId: string;
65
+ childSessionId?: string;
66
+ claimRevision: number;
67
+ attempt: number;
68
+ leaseExpiresAt: number;
69
+ claimTokenDigest: string;
70
+ preparedAt: number;
71
+ credentialInstalledAt?: number;
72
+ committedAt?: number;
73
+ abortedAt?: number;
74
+ reason?: string;
75
+ }
76
+ interface WorktreeRecoveryClaimJournal {
77
+ schemaVersion: 1;
78
+ entries: WorktreeRecoveryClaimJournalEntry[];
79
+ }
80
+ interface WorktreeRecoveryCredential {
81
+ schemaVersion: 1;
82
+ authorityDigest: string;
83
+ claimantCallID: string;
84
+ claimantSessionId: string;
85
+ childSessionId: string;
86
+ claimRevision: number;
87
+ rawToken: string;
88
+ leaseExpiresAt: number;
89
+ createdAt: number;
90
+ }
91
+ type ScanStatus = 'ok' | 'unsupported-legacy' | 'uncertain';
92
+ export type WorktreeRecoveryScanResult = {
93
+ status: 'ok';
94
+ authorities: WorktreeRecoveryAuthorityRecord[];
95
+ } | {
96
+ status: 'unsupported-legacy';
97
+ reason: string;
98
+ } | {
99
+ status: 'uncertain';
100
+ reason: string;
101
+ };
102
+ export type WorktreeRecoveryLookupResult = {
103
+ status: 'ok';
104
+ authorities: WorktreeRecoveryAuthorityRecord[];
105
+ } | {
106
+ status: Exclude<ScanStatus, 'ok'>;
107
+ reason: string;
108
+ };
109
+ type BaseMutationFailureCode = 'not_found' | 'busy' | 'stale_claim' | 'retry_cap_exceeded' | 'revalidation_required' | 'revalidation_failed' | 'unsupported_legacy' | 'uncertain_store' | 'finalized';
110
+ type BaseMutationFailure = {
111
+ ok: false;
112
+ code: BaseMutationFailureCode;
113
+ reason: string;
114
+ };
115
+ export type PublishWorktreeRecoveryAuthorityResult = {
116
+ ok: true;
117
+ authority: WorktreeRecoveryAuthorityRecord;
118
+ } | BaseMutationFailure;
119
+ export type ClaimWorktreeRecoveryAuthorityResult = {
120
+ ok: true;
121
+ authority: WorktreeRecoveryAuthorityRecord;
122
+ rawToken: string;
123
+ credentialPath: string;
124
+ } | BaseMutationFailure;
125
+ export type MutateWorktreeRecoveryClaimResult = {
126
+ ok: true;
127
+ authority: WorktreeRecoveryAuthorityRecord;
128
+ } | BaseMutationFailure;
129
+ export interface ClaimWorktreeRecoveryAuthorityRequest {
130
+ authorityDigest: string;
131
+ claimantCallID: string;
132
+ claimantSessionId: string;
133
+ now?: number;
134
+ leaseMs: number;
135
+ maxAttempts?: number;
136
+ createChildSession: () => string | Promise<string>;
137
+ revalidateExpiredClaim?: (args: {
138
+ authority: WorktreeRecoveryAuthorityRecord;
139
+ previousClaim: WorktreeRecoveryClaimState;
140
+ }) => {
141
+ ok: true;
142
+ } | {
143
+ ok: false;
144
+ reason: string;
145
+ } | Promise<{
146
+ ok: true;
147
+ } | {
148
+ ok: false;
149
+ reason: string;
150
+ }>;
151
+ }
152
+ interface ExactClaimMutationRequest {
153
+ authorityDigest: string;
154
+ claimantCallID: string;
155
+ claimRevision: number;
156
+ rawToken: string;
157
+ now?: number;
158
+ }
159
+ export interface FinalizeWorktreeRecoveryAuthorityRequest extends ExactClaimMutationRequest {
160
+ settlement?: {
161
+ sourceCommitOrder: string[];
162
+ rewrittenCommitOrder: string[];
163
+ };
164
+ }
165
+ export interface ReplayPreparedClaimOptions {
166
+ onAbortPreparedClaim?: (entry: WorktreeRecoveryClaimJournalEntry) => void;
167
+ }
168
+ export interface ReplayPreparedClaimOutcome {
169
+ authorityDigest: string;
170
+ outcome: 'aborted_prepared_claim' | 'removed_uncommitted_credential' | 'committed_claim_stable' | 'released_orphaned_committed_claim' | 'repaired_terminal_claim' | 'uncertain_committed_without_authority' | 'noop';
171
+ }
172
+ declare function storePath(directory: string): string;
173
+ declare function journalPath(directory: string): string;
174
+ declare function credentialPath(directory: string, authorityDigest: string): string;
175
+ declare function acquireAuthorityLock(directory: string): (() => void) | undefined;
176
+ export declare function publishWorktreeRecoveryAuthority(directory: string, input: WorktreeRecoveryImmutableIdentityInput): PublishWorktreeRecoveryAuthorityResult;
177
+ export declare function scanWorktreeRecoveryAuthoritiesForRecovery(directory: string): WorktreeRecoveryScanResult;
178
+ export declare function lookupWorktreeRecoveryAuthoritiesByTask(directory: string, query: {
179
+ parentSessionId: string;
180
+ taskId: string;
181
+ }): WorktreeRecoveryLookupResult;
182
+ export declare function claimWorktreeRecoveryAuthority(directory: string, request: ClaimWorktreeRecoveryAuthorityRequest): Promise<ClaimWorktreeRecoveryAuthorityResult>;
183
+ export declare function renewWorktreeRecoveryClaim(directory: string, request: ExactClaimMutationRequest & {
184
+ leaseMs: number;
185
+ }): MutateWorktreeRecoveryClaimResult;
186
+ export declare function releaseWorktreeRecoveryClaim(directory: string, request: ExactClaimMutationRequest): MutateWorktreeRecoveryClaimResult;
187
+ export declare function finalizeWorktreeRecoveryAuthority(directory: string, request: FinalizeWorktreeRecoveryAuthorityRequest): MutateWorktreeRecoveryClaimResult;
188
+ export declare function replayWorktreeRecoveryClaimJournal(directory: string, options?: ReplayPreparedClaimOptions): ReplayPreparedClaimOutcome[];
189
+ export declare const _internals: {
190
+ generateRawToken: () => string;
191
+ writeRecoveryStore: (targetPath: string, store: WorktreeRecoveryStore, _phase: "publish" | "claim-commit" | "claim-renew" | "claim-release" | "claim-finalize") => void;
192
+ writeClaimJournal: (targetPath: string, journal: WorktreeRecoveryClaimJournal) => void;
193
+ writeCredentialFile: (targetPath: string, credential: WorktreeRecoveryCredential) => void;
194
+ getRecoveryStorePath: typeof storePath;
195
+ getClaimJournalPath: typeof journalPath;
196
+ getCredentialPath: typeof credentialPath;
197
+ acquireAuthorityLock: typeof acquireAuthorityLock;
198
+ readClaimJournal(directory: string): WorktreeRecoveryClaimJournal;
199
+ resetForTest(): void;
200
+ };
201
+ export {};
@@ -24,6 +24,13 @@
24
24
  * or terminate per `full_auto.denials.on_limit`.
25
25
  */
26
26
  import type { PluginConfig } from '../config';
27
+ import { assessSandboxEnforcement } from '../sandbox/executor';
28
+ import { clearSandboxWrapOutcome, readSandboxWrapOutcome } from '../sandbox/skip-state';
29
+ export declare const _internals: {
30
+ assessSandboxEnforcement: typeof assessSandboxEnforcement;
31
+ readSandboxWrapOutcome: typeof readSandboxWrapOutcome;
32
+ clearSandboxWrapOutcome: typeof clearSandboxWrapOutcome;
33
+ };
27
34
  export interface FullAutoPermissionHookOptions {
28
35
  config: PluginConfig;
29
36
  directory: string;
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { extractSwarmIdFromAgentName, getSwarmAgents, resolveFallbackModel } from '../../agents/index';
10
10
  import { type AuthorityConfig, type GuardrailsConfig } from '../../config/schema';
11
- import { getExecutor } from '../../sandbox/executor';
11
+ import { assessSandboxEnforcement, getExecutor } from '../../sandbox/executor';
12
12
  import { dcCheckJunctionCreation } from './destructive-command';
13
13
  import { getMostRecentAssistantText, getProviderFailureFingerprint, isTransientProviderFailureText } from './messages-transform';
14
14
  export declare const _internals: {
@@ -21,6 +21,7 @@ export declare const _internals: {
21
21
  dcCheckJunctionCreation: typeof dcCheckJunctionCreation;
22
22
  extractErrorSignal: typeof extractErrorSignal;
23
23
  getSandboxExecutor: typeof getExecutor;
24
+ assessSandboxEnforcement: typeof assessSandboxEnforcement;
24
25
  /** Test-only compatibility for legacy direct-after hook tests. */
25
26
  allowUncorrelatedGateReceipts: boolean;
26
27
  MAX_PENDING_GATE_RECEIPTS_PER_SESSION: number;
@@ -38,6 +38,8 @@ export interface ToolBeforeContext {
38
38
  worktreeBaseDirOverrides?: string[];
39
39
  /** Sandbox executor getter seam for tests and platform-specific overrides. */
40
40
  getSandboxExecutor: typeof import('../../sandbox/executor').getExecutor;
41
+ /** Sandbox capability assessment seam for deterministic cross-platform tests. */
42
+ assessSandboxEnforcement: typeof import('../../sandbox/executor').assessSandboxEnforcement;
41
43
  /** Hold exact child-write provenance until the matching after-hook succeeds. */
42
44
  rememberReviewerScopeWrite?: (input: {
43
45
  callID: string;
@@ -49,6 +51,8 @@ export interface ToolBeforeContext {
49
51
  /** Snapshot an exact authorized write for success-only lease renewal. */
50
52
  rememberScopeLeaseCandidate?: (input: ScopeLeaseCandidateInput) => void;
51
53
  }
54
+ /** @internal test seam */
55
+ export declare function _resetSandboxUnavailableWarningState(): void;
52
56
  /**
53
57
  * Creates a toolBefore handler with the given shared context.
54
58
  *
@@ -21,7 +21,8 @@ import { isLocked, listActiveLocks, tryAcquireLock } from '../parallel/file-lock
21
21
  import { removeWorktree } from '../worktree/core';
22
22
  import { scanRegisteredWorktreeLiveness } from '../worktree/merge';
23
23
  import { scanWorktreeMergeFailuresForRecovery } from './delegation-gate/worktree-merge-status';
24
- import { removeWorktreeProvisioningOwner, scanWorktreeProvisioningOwnersForRecovery } from './delegation-gate/worktree-provisioning-owner';
24
+ import { removeWorktreeProvisioningOwner, scanWorktreeProvisioningLifecycleJournalForRecovery, scanWorktreeProvisioningOwnersForRecovery } from './delegation-gate/worktree-provisioning-owner';
25
+ import { replayWorktreeRecoveryClaimJournal, scanWorktreeRecoveryAuthoritiesForRecovery } from './delegation-gate/worktree-recovery-authority';
25
26
  type OwnershipTagSessionScan = {
26
27
  status: 'ok';
27
28
  sessionIds: string[];
@@ -51,7 +52,10 @@ export declare const _internals: {
51
52
  recordDelegationRecoveryObservation: typeof recordDelegationRecoveryObservation;
52
53
  scanDelegationFallbacksForRecovery: typeof scanDelegationFallbacksForRecovery;
53
54
  scanWorktreeMergeFailuresForRecovery: typeof scanWorktreeMergeFailuresForRecovery;
55
+ scanWorktreeRecoveryAuthoritiesForRecovery: typeof scanWorktreeRecoveryAuthoritiesForRecovery;
56
+ replayWorktreeRecoveryClaimJournal: typeof replayWorktreeRecoveryClaimJournal;
54
57
  scanWorktreeProvisioningOwnersForRecovery: typeof scanWorktreeProvisioningOwnersForRecovery;
58
+ scanWorktreeProvisioningLifecycleJournalForRecovery: typeof scanWorktreeProvisioningLifecycleJournalForRecovery;
55
59
  scanRegisteredWorktreeLiveness: typeof scanRegisteredWorktreeLiveness;
56
60
  removeWorktreeProvisioningOwner: typeof removeWorktreeProvisioningOwner;
57
61
  };
@@ -784,6 +784,8 @@ export declare class PrReviewResilienceRetryExhaustedError extends Error {
784
784
  readonly code: "PR_REVIEW_RESILIENCE_RETRY_EXHAUSTED";
785
785
  constructor(message: string);
786
786
  }
787
+ declare function snapshotPrReviewResiliencePolicy(policy?: PrReviewResilienceConfig): PrReviewResiliencePolicyRecord;
788
+ declare function effectivePrReviewResiliencePolicy(state: PrWorkflowGateState, requestedPolicy?: PrReviewResilienceConfig): PrReviewResiliencePolicyRecord;
787
789
  declare function classifyTerminalFailureSignature(record: BackgroundDelegationRecord): string | null;
788
790
  interface EnforcePrReviewBaseDimensionsOptions {
789
791
  batchId: string;
@@ -969,6 +971,16 @@ export declare const _test_exports: {
969
971
  * shortening the threshold, not by waiting minutes.
970
972
  */
971
973
  pendingLaneLivenessThresholdMs: number;
974
+ /**
975
+ * Issue #2381: exposed so the staged-resilience DEFAULT can be pinned
976
+ * directly. This resolution path is reached whenever a gate state carries no
977
+ * recorded policy and no policy is supplied, and it previously hardcoded
978
+ * `enabled: true`; the default flip is only real if this agrees with
979
+ * `DEFAULT_PR_REVIEW_RESILIENCE_CONFIG`. Pure functions of their arguments,
980
+ * so `_test_exports` is the right seam (no `mock.module` needed).
981
+ */
982
+ effectivePrReviewResiliencePolicy: typeof effectivePrReviewResiliencePolicy;
983
+ snapshotPrReviewResiliencePolicy: typeof snapshotPrReviewResiliencePolicy;
972
984
  resolveCurrentGitHead: typeof resolveCurrentGitHead;
973
985
  resolveCurrentGitHeadAsync: typeof resolveCurrentGitHeadAsync;
974
986
  resolveCurrentUpstreamPushTarget: typeof resolveCurrentUpstreamPushTarget;
@@ -19,12 +19,10 @@ import { resolveWriteTargets } from './write-target-resolver';
19
19
  export interface ScopeGuardConfig {
20
20
  /** Whether scope guard is enabled (default: true) */
21
21
  enabled: boolean;
22
- /** Whether to skip in turbo mode (default: false — NOT skippable by design) */
23
- skip_in_turbo: boolean;
24
22
  }
25
23
  /**
26
24
  * Creates the scope-guard hook that blocks out-of-scope writes.
27
- * @param config - ScopeGuardConfig (enabled, skip_in_turbo)
25
+ * @param config - ScopeGuardConfig. Scope enforcement is never skipped in Turbo.
28
26
  * @param fallbackDirectory - The plugin-root directory (`ctx.directory`). Used
29
27
  * ONLY as the fallback for sessions with no recorded workspace root. Issue
30
28
  * #2002: this hook is constructed once per plugin instance and serves every