opencode-swarm 7.166.0 → 7.166.2

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 (107) hide show
  1. package/binaries/win32-arm64/swarm-sandbox-runner.exe +0 -0
  2. package/binaries/win32-x64/swarm-sandbox-runner.exe +0 -0
  3. package/dist/background/candidate-contract.d.ts +14 -0
  4. package/dist/background/pr-subscriptions.d.ts +33 -1
  5. package/dist/background/workspace-snapshot.d.ts +41 -0
  6. package/dist/cli/{coder-settlement-ydg2jfrk.js → coder-settlement-pv86n7n4.js} +14 -14
  7. package/dist/cli/{config-doctor-drqx6tzc.js → config-doctor-fy1aytwt.js} +5 -5
  8. package/dist/cli/{core-x6sftfwt.js → core-1d9vqbt4.js} +4 -4
  9. package/dist/cli/{curation-policy-jtzwz6bc.js → curation-policy-gnpgc3z7.js} +7 -5
  10. package/dist/cli/{curator-kg2h8jjf.js → curator-a4rbehfr.js} +40 -40
  11. package/dist/cli/{curator-drift-2vwtkegg.js → curator-drift-efmgp1v2.js} +6 -6
  12. package/dist/cli/curator-llm-factory-cwg62ynw.js +70 -0
  13. package/dist/cli/{dispatch-c7xjt7js.js → dispatch-tmb929w8.js} +3 -3
  14. package/dist/cli/{evidence-summary-service-ry5ebnmq.js → evidence-summary-service-dvp1kbm4.js} +18 -18
  15. package/dist/cli/{gate-evidence-qgeceqy8.js → gate-evidence-qf27gdfx.js} +10 -9
  16. package/dist/cli/guardrail-explain-zskpzgsr.js +71 -0
  17. package/dist/cli/guardrail-log-qhw3knjt.js +23 -0
  18. package/dist/cli/{guardrail-reset-4nmy7xas.js → guardrail-reset-84ydxdg3.js} +40 -40
  19. package/dist/cli/hive-promoter-y2daybf6.js +85 -0
  20. package/dist/cli/{index-mg43w8p2.js → index-0a0jsbhg.js} +16 -7
  21. package/dist/cli/{index-a0d4fp6r.js → index-0tc0pcmh.js} +1 -1
  22. package/dist/cli/{index-a7rw4g4s.js → index-14z9en94.js} +3 -3
  23. package/dist/cli/{index-gy0nyfbw.js → index-19hjpqsy.js} +61 -16
  24. package/dist/cli/{index-fywshabz.js → index-22sannyk.js} +7 -7
  25. package/dist/cli/{index-p04pa9c9.js → index-2n1v8ft1.js} +2 -2
  26. package/dist/cli/{index-jc9cxh90.js → index-3nww2vnx.js} +11 -11
  27. package/dist/cli/{index-9hy5q7gp.js → index-3wtfrjcx.js} +4 -4
  28. package/dist/cli/{index-anxs69ad.js → index-4kwxpnf8.js} +13 -6
  29. package/dist/cli/{index-8m12y79g.js → index-7mxrqy4r.js} +7 -7
  30. package/dist/cli/{index-jx9f4ke1.js → index-7pp8fz4j.js} +1 -1
  31. package/dist/cli/{index-a5w71m8f.js → index-8nv3bc9h.js} +4 -4
  32. package/dist/cli/{index-30f4fe30.js → index-9ccxcjdm.js} +4 -4
  33. package/dist/cli/{index-hwj25q9r.js → index-bks56jbg.js} +70 -53
  34. package/dist/cli/{index-8hqkrd2j.js → index-bysyj3z4.js} +1 -1
  35. package/dist/cli/{index-8n62bphd.js → index-c0eyq4rp.js} +4 -4
  36. package/dist/cli/{index-c20gf089.js → index-c23w8t46.js} +1 -1
  37. package/dist/cli/{index-8d90gzaz.js → index-d5qf7hvh.js} +3 -3
  38. package/dist/cli/{index-nb924ar6.js → index-e0bjbadr.js} +2 -2
  39. package/dist/cli/{index-z6xqpmqg.js → index-ee6ydtfe.js} +1 -1
  40. package/dist/cli/{index-axf65x87.js → index-fkk7x6sy.js} +5 -5
  41. package/dist/cli/{index-17yszqs5.js → index-ft1tnx0e.js} +1 -1
  42. package/dist/cli/{index-an89qzd9.js → index-gy55mc55.js} +749 -755
  43. package/dist/cli/{index-2dvk153d.js → index-hbjax6hy.js} +17 -17
  44. package/dist/cli/{index-2v17wb75.js → index-hgphhnrp.js} +2 -2
  45. package/dist/cli/{index-hvk3zs62.js → index-j81kpway.js} +1 -1
  46. package/dist/cli/{index-hrkamw9q.js → index-jgtje76m.js} +7 -7
  47. package/dist/cli/{index-czr3jcg6.js → index-jr6tppv9.js} +47 -13
  48. package/dist/cli/{index-apxaa755.js → index-kd68b6mg.js} +3 -3
  49. package/dist/cli/{index-289epdpc.js → index-nrdj94za.js} +42 -42
  50. package/dist/cli/{index-79sr3fd1.js → index-nthqfxzz.js} +2 -2
  51. package/dist/cli/{index-6chhqq2n.js → index-p0r5fn7y.js} +94 -3
  52. package/dist/cli/{index-2rm5x9ps.js → index-qmp4gxac.js} +2 -2
  53. package/dist/cli/{index-rkn17q5e.js → index-st47knj6.js} +5 -5
  54. package/dist/cli/{index-edm41q4j.js → index-sxe3t040.js} +2 -2
  55. package/dist/cli/{index-52jfm5s0.js → index-sxsyd7kf.js} +9 -9
  56. package/dist/cli/{index-359djbj1.js → index-ty0wg9yp.js} +5 -5
  57. package/dist/cli/{index-qkq56zyr.js → index-wz258yje.js} +69 -18
  58. package/dist/cli/{index-bw7r2b2m.js → index-x4azb6qj.js} +2 -2
  59. package/dist/cli/{index-8bdk7124.js → index-x8cvbkjs.js} +2 -2
  60. package/dist/cli/{index-aftapk6j.js → index-y3dtdn2f.js} +3 -3
  61. package/dist/cli/{index-4mpdy32j.js → index-ytsts0zj.js} +1 -1
  62. package/dist/cli/{index-ejf6w8vw.js → index-z1kmkh72.js} +2 -2
  63. package/dist/cli/index-zpsr8rpc.js +68 -0
  64. package/dist/cli/index.js +40 -40
  65. package/dist/cli/{knowledge-escalator-xdzmr31d.js → knowledge-escalator-aq7gzhpd.js} +15 -15
  66. package/dist/cli/{knowledge-events-1t1t0bv7.js → knowledge-events-9z5sskyv.js} +13 -13
  67. package/dist/cli/{knowledge-link-1zykfk1p.js → knowledge-link-ps2v4s18.js} +6 -4
  68. package/dist/cli/{knowledge-store-m2snb0xg.js → knowledge-store-1hzt2a0t.js} +7 -5
  69. package/dist/cli/{knowledge-validator-tf7yq2pd.js → knowledge-validator-xe1fza7c.js} +9 -7
  70. package/dist/cli/{model-preflight-3s1c0zpc.js → model-preflight-b3b5pgsc.js} +2 -2
  71. package/dist/cli/{pending-delegations-jr8hwxrz.js → pending-delegations-0nfjg7vp.js} +13 -13
  72. package/dist/cli/{pr-subscriptions-ca1xmf9r.js → pr-subscriptions-8974hwa0.js} +19 -13
  73. package/dist/cli/{pr-workflow-gate-fb1dj0zx.js → pr-workflow-gate-xgak5wvz.js} +40 -40
  74. package/dist/cli/{runner-j3acybhs.js → runner-7zqbp81n.js} +8 -5
  75. package/dist/cli/{scan-cursor-3gdvy0ym.js → scan-cursor-hc4v0c90.js} +8 -6
  76. package/dist/cli/{schema-mzb1354k.js → schema-w1hsvw1h.js} +3 -3
  77. package/dist/cli/{scope-persistence-c4n21b5n.js → scope-persistence-k17003v4.js} +17 -16
  78. package/dist/cli/{skill-generator-dvpvwt8k.js → skill-generator-tbxgpc9x.js} +17 -17
  79. package/dist/cli/{snapshot-coordination-init-g7v63zcm.js → snapshot-coordination-init-vaf34wf0.js} +40 -40
  80. package/dist/cli/{telemetry-9h1z2w9d.js → telemetry-8qn4eag5.js} +5 -1
  81. package/dist/cli/{workspace-snapshot-6z9rk7xw.js → workspace-snapshot-y85jy6gs.js} +11 -1
  82. package/dist/cli/{worktree-collision-ownership-k15qrpy9.js → worktree-collision-ownership-r3jdke7h.js} +14 -14
  83. package/dist/cli/{worktree-isolation-y7ec1pm5.js → worktree-isolation-sa1tbqff.js} +40 -40
  84. package/dist/evidence/phase-participation.d.ts +1 -1
  85. package/dist/git/pr.d.ts +4 -2
  86. package/dist/git/safe-ref.d.ts +51 -0
  87. package/dist/hooks/guardrails/execution-stall.d.ts +10 -5
  88. package/dist/hooks/hive-promoter.d.ts +28 -5
  89. package/dist/hooks/repo-graph-builder.d.ts +14 -0
  90. package/dist/hooks/system-enhancer.d.ts +21 -0
  91. package/dist/index.js +250 -248
  92. package/dist/observability/catalog.d.ts +1 -1
  93. package/dist/session/snapshot-writer.d.ts +42 -0
  94. package/dist/telemetry.d.ts +31 -1
  95. package/dist/tools/co-change-analyzer.d.ts +7 -0
  96. package/dist/tools/gh-evidence.d.ts +15 -8
  97. package/dist/tools/pkg-audit.d.ts +23 -0
  98. package/dist/utils/atomic-write.d.ts +32 -0
  99. package/dist/utils/gh-executable.d.ts +106 -0
  100. package/dist/utils/merge.d.ts +26 -0
  101. package/dist/utils/swarm-artifact-cache.d.ts +6 -0
  102. package/package.json +1 -1
  103. package/dist/cli/curator-llm-factory-7znajprp.js +0 -70
  104. package/dist/cli/guardrail-explain-jdv4n2j3.js +0 -71
  105. package/dist/cli/guardrail-log-s7c3rpde.js +0 -23
  106. package/dist/cli/hive-promoter-w5tsgttc.js +0 -85
  107. package/dist/cli/index-zjygnfay.js +0 -33
@@ -21,68 +21,68 @@ import {
21
21
  sanitizeWorktreeTaskId,
22
22
  standardWorktreeByCallID,
23
23
  standardWorktreeSerializationSessions
24
- } from "./index-an89qzd9.js";
25
- import"./index-8d90gzaz.js";
26
- import"./index-hvk3zs62.js";
27
- import"./index-9hy5q7gp.js";
28
- import"./index-p04pa9c9.js";
29
- import"./index-qkq56zyr.js";
30
- import"./index-17yszqs5.js";
24
+ } from "./index-gy55mc55.js";
25
+ import"./index-d5qf7hvh.js";
26
+ import"./index-j81kpway.js";
27
+ import"./index-3wtfrjcx.js";
28
+ import"./index-2n1v8ft1.js";
29
+ import"./index-wz258yje.js";
30
+ import"./index-ft1tnx0e.js";
31
31
  import"./index-txdagbh7.js";
32
32
  import"./index-cw912re7.js";
33
- import"./index-hrkamw9q.js";
34
- import"./index-359djbj1.js";
35
- import"./index-bw7r2b2m.js";
33
+ import"./index-jgtje76m.js";
34
+ import"./index-ty0wg9yp.js";
35
+ import"./index-x4azb6qj.js";
36
36
  import"./index-70ha9e09.js";
37
- import"./index-8hqkrd2j.js";
37
+ import"./index-bysyj3z4.js";
38
38
  import"./index-9ss2m4rs.js";
39
- import"./index-czr3jcg6.js";
39
+ import"./index-jr6tppv9.js";
40
40
  import"./index-zsrtt42s.js";
41
- import"./index-2dvk153d.js";
42
- import"./index-6chhqq2n.js";
43
- import"./index-8bdk7124.js";
41
+ import"./index-hbjax6hy.js";
42
+ import"./index-p0r5fn7y.js";
43
+ import"./index-x8cvbkjs.js";
44
44
  import"./index-b43rt5ph.js";
45
45
  import"./index-q7sjgr1y.js";
46
- import"./index-8n62bphd.js";
47
- import"./index-2rm5x9ps.js";
48
- import"./index-52jfm5s0.js";
49
- import"./index-jc9cxh90.js";
50
- import"./index-anxs69ad.js";
51
- import"./index-z6xqpmqg.js";
46
+ import"./index-c0eyq4rp.js";
47
+ import"./index-qmp4gxac.js";
48
+ import"./index-sxsyd7kf.js";
49
+ import"./index-3nww2vnx.js";
50
+ import"./index-4kwxpnf8.js";
52
51
  import"./index-p612v1mv.js";
53
- import"./index-a5w71m8f.js";
54
- import"./index-c20gf089.js";
52
+ import"./index-8nv3bc9h.js";
53
+ import"./index-c23w8t46.js";
55
54
  import"./index-rtry5xyf.js";
56
55
  import {
57
56
  resolveWorktreeIsolationConfig
58
- } from "./index-apxaa755.js";
57
+ } from "./index-kd68b6mg.js";
59
58
  import"./index-3qf1vxtb.js";
60
59
  import"./index-n832052r.js";
61
- import"./index-8m12y79g.js";
62
- import"./index-30f4fe30.js";
63
- import"./index-2v17wb75.js";
64
- import"./index-79sr3fd1.js";
65
- import"./index-jx9f4ke1.js";
66
- import"./index-aftapk6j.js";
60
+ import"./index-7mxrqy4r.js";
61
+ import"./index-9ccxcjdm.js";
62
+ import"./index-hgphhnrp.js";
63
+ import"./index-nthqfxzz.js";
64
+ import"./index-7pp8fz4j.js";
65
+ import"./index-y3dtdn2f.js";
67
66
  import"./index-ry16d01s.js";
68
67
  import"./index-n4fzmqz8.js";
69
- import"./index-axf65x87.js";
70
- import"./index-fywshabz.js";
68
+ import"./index-fkk7x6sy.js";
69
+ import"./index-22sannyk.js";
71
70
  import"./index-ae75rja9.js";
72
- import"./index-a7rw4g4s.js";
71
+ import"./index-14z9en94.js";
72
+ import"./index-sxe3t040.js";
73
+ import"./index-19hjpqsy.js";
74
+ import"./index-bks56jbg.js";
73
75
  import"./index-7qefgq4j.js";
74
- import"./index-edm41q4j.js";
75
- import"./index-gy0nyfbw.js";
76
- import"./index-hwj25q9r.js";
76
+ import"./index-ee6ydtfe.js";
77
77
  import"./index-7g4c7s5r.js";
78
- import"./index-mg43w8p2.js";
78
+ import"./index-0a0jsbhg.js";
79
79
  import"./index-9e6fdz2h.js";
80
80
  import"./index-4rhhvd1a.js";
81
- import"./index-nb924ar6.js";
82
- import"./index-a0d4fp6r.js";
83
- import"./index-zjygnfay.js";
81
+ import"./index-e0bjbadr.js";
82
+ import"./index-0tc0pcmh.js";
84
83
  import"./index-bk5tah7q.js";
85
84
  import"./index-bpmtbmy9.js";
85
+ import"./index-zpsr8rpc.js";
86
86
  import"./index-q1r1cfww.js";
87
87
  import"./index-yzjaj53h.js";
88
88
  import"./index-zgwm4ryv.js";
@@ -40,5 +40,5 @@ export declare function completeBackgroundPhaseParticipation(input: {
40
40
  record: BackgroundDelegationRecord;
41
41
  resultText: string;
42
42
  }): Promise<boolean>;
43
- export declare function readPhaseParticipation(directory: string, plan: Plan, phase: number, role: string): ParticipationReadResult;
43
+ export declare function readPhaseParticipation(directory: string, plan: Plan, phase: number, role: string): Promise<ParticipationReadResult>;
44
44
  export declare function resetPhaseParticipationForTests(): void;
package/dist/git/pr.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import * as child_process from 'node:child_process';
2
- import { resolveGhBinary } from '../tools/gh-evidence.js';
2
+ import { resolveGhExecutable } from '../utils/gh-executable.js';
3
+ import { resolveGitExecutable } from '../utils/git-executable.js';
3
4
  import { readLaneEnvFileFromDiskSync } from './branch.js';
4
5
  export declare const GIT_TIMEOUT_MS = 30000;
5
6
  /**
@@ -71,7 +72,8 @@ export declare const _internals: {
71
72
  spawnSync: typeof __spawnSyncSeam.spawnSync;
72
73
  readLaneEnvFileFromDiskSync: typeof readLaneEnvFileFromDiskSync;
73
74
  getMergeGroupRun: typeof getMergeGroupRun;
74
- resolveGhBinary: typeof resolveGhBinary;
75
+ resolveGhExecutable: typeof resolveGhExecutable;
76
+ resolveGitExecutable: typeof resolveGitExecutable;
75
77
  };
76
78
  /**
77
79
  * Check if gh CLI is available
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Fail-closed guard for git ref arguments (issue #2476 AC3, source issue
3
+ * #2265).
4
+ *
5
+ * Defect class: a repository- or caller-derived ref interpolated into a git
6
+ * argv position can BEGIN WITH A DASH and be parsed by git as an OPTION. A
7
+ * hostile remote can advertise `refs/heads/--evil` (`git update-ref` bypasses
8
+ * `check-ref-format`; a plain `git clone` propagates it), so `git checkout
9
+ * --evil` exits 129 with "unknown option" and a branch literally named
10
+ * `--force` makes `git checkout --force` SILENTLY DESTRUCTIVE.
11
+ *
12
+ * Guard placement is per-command, settled empirically against git 2.x (see
13
+ * `.agents/issue-traces/2476-harden-trust-boundaries/02-reproduction.md` R3):
14
+ *
15
+ * - `branch -d -- <name>` and `push <remote> -- <refspec>` accept a literal
16
+ * `--` end-of-options separator with IDENTICAL semantics for benign names
17
+ * and fail-closed behavior for hostile ones — those sinks insert `--`.
18
+ * - `checkout`, `checkout -b <new> <start>`, `rev-parse --verify`,
19
+ * `rev-parse --abbrev-ref <b>@{upstream}`, `reset --hard`, `log <range>`,
20
+ * `diff <base> HEAD`, and `branch --merged <target>` REGRESS benign
21
+ * behavior when a leading `--` is inserted (pathspec/malformed-object
22
+ * errors) — those sinks use this validation guard instead.
23
+ *
24
+ * The predicate is deliberately minimal — NOT the full check-ref-format
25
+ * grammar — so `origin/main`, `HEAD`, `feature/x`, SHAs, and each side of an
26
+ * `a..b` range all pass while any dash-leading side is rejected. This mirrors
27
+ * the in-repo validator family (`isSafeGitRef` in ci-simulate.ts,
28
+ * `isSafeGitRevisionToken` in workspace-snapshot.ts, `isSafeGitRefToken` in
29
+ * pr-workflow-gate.ts), which this module centralizes for the src/git sinks.
30
+ */
31
+ /** Typed, fail-closed rejection of an option-injectable git ref. */
32
+ export declare class UnsafeGitRefError extends Error {
33
+ readonly ref: string;
34
+ readonly context: string;
35
+ constructor(ref: string, context: string);
36
+ }
37
+ /**
38
+ * True when `value` is safe to interpolate into a git argv ref position:
39
+ * non-empty, and no `..`-separated side starts with "-". Empty/odd `..`
40
+ * sides are deliberately NOT rejected here (a name like `../../x` is not an
41
+ * option-injection risk; git itself rejects it as an invalid ref, and the
42
+ * pre-existing adversarial contract in tests/unit/git/branch.adversarial
43
+ * pins pass-through for those shapes) — only dash-leading sides are.
44
+ */
45
+ export declare function isSafeGitRefArg(value: string): boolean;
46
+ /**
47
+ * Fail-closed form of {@link isSafeGitRefArg}: returns `value` unchanged when
48
+ * safe, throws {@link UnsafeGitRefError} otherwise. `context` names the
49
+ * caller/sink so the error is actionable (e.g. "createBranch checkout").
50
+ */
51
+ export declare function assertSafeGitRefArg(value: string, context: string): string;
@@ -92,7 +92,7 @@
92
92
  * escalates to the STOP directive.
93
93
  */
94
94
  import type { BackgroundWorkspaceSnapshot } from '../../background/pending-delegations.js';
95
- import { captureWorkspaceSnapshot, changedFilesSinceSnapshot } from '../../background/workspace-snapshot.js';
95
+ import { captureWorkspaceSnapshotAsync, changedFilesSinceSnapshotAsync } from '../../background/workspace-snapshot.js';
96
96
  /** Default advisory rung (mirrors `guardrails.execution_stall_warn_calls`). */
97
97
  export declare const DEFAULT_EXECUTION_STALL_WARN_CALLS = 30;
98
98
  /** Default hard rung (mirrors `guardrails.execution_stall_stop_calls`). */
@@ -251,6 +251,9 @@ export declare function enforceExecutionStallDenial(params: {
251
251
  * `tool.execute.after`. Records progress events, arms on a successful
252
252
  * `update_task_status(in_progress)`, and runs the periodic workspace probe.
253
253
  * NEVER throws.
254
+ *
255
+ * Async (issue #2472 W7): the workspace captures route through the async
256
+ * snapshot twin, so callers (guardrails' `toolAfter`) must await it.
254
257
  */
255
258
  export declare function recordExecutionStallToolAfter(params: {
256
259
  sessionID: string;
@@ -260,18 +263,20 @@ export declare function recordExecutionStallToolAfter(params: {
260
263
  output: unknown;
261
264
  directory: string;
262
265
  options?: ExecutionStallOptions;
263
- }): void;
266
+ }): Promise<void>;
264
267
  /**
265
268
  * Test/DI seam (AGENTS.md invariant 7). `now` is the fake-clock seam the
266
269
  * idleness-lapse tests drive; the two workspace functions are indirected so a
267
270
  * test never spawns git, and `readPlanOpenTaskState` so a test can drive the
268
271
  * disarm edge without a plan fixture (the disarm tests exercise the REAL reader
269
- * against a real `.swarm/plan.json` as well).
272
+ * against a real `.swarm/plan.json` as well). The capture seam carries the
273
+ * ASYNC twin (issue #2472 W7) — hook paths must never reach the sync
274
+ * spawn-based capture.
270
275
  */
271
276
  export declare const _internals: {
272
277
  now: () => number;
273
- captureWorkspaceSnapshot: typeof captureWorkspaceSnapshot;
274
- changedFilesSinceSnapshot: typeof changedFilesSinceSnapshot;
278
+ captureWorkspaceSnapshotAsync: typeof captureWorkspaceSnapshotAsync;
279
+ changedFilesSinceSnapshotAsync: typeof changedFilesSinceSnapshotAsync;
275
280
  ensureArchitectSession: typeof ensureArchitectSession;
276
281
  readPlanOpenTaskState: typeof readPlanOpenTaskState;
277
282
  };
@@ -21,7 +21,7 @@
21
21
  * This module is NOT imported on the plugin-init path (invariant 1): promotion
22
22
  * runs only on the lazy `/swarm promote`, close, curate, and postmortem paths.
23
23
  */
24
- import { resolveCohortId } from '../knowledge/cohort-identity.js';
24
+ import type { CohortIdentity } from '../knowledge/cohort-identity.js';
25
25
  import { authorizeCuration } from '../knowledge/curation-policy.js';
26
26
  import { appendCuratorRecommendation, readCuratorSummary } from './curator.js';
27
27
  import { transactHiveStore } from './hive-transaction.js';
@@ -65,19 +65,21 @@ export declare function countDistinctProjects(confirmedBy: ProjectConfirmationRe
65
65
  * new canonical-cohort confirmations. Returns a summary for curator state.
66
66
  *
67
67
  * `directory` is required (#1847) to resolve the canonical cohort identity
68
- * (#1846) for cross-project distinctness.
68
+ * (#1846) for cross-project distinctness. `sessionID` (#2472 W2) is optional:
69
+ * when present, cohort resolution reuses the session's cached cohort id (see
70
+ * the `_internals.resolveCohortId` default).
69
71
  *
70
72
  * @note The 'hive-fast-track' tag is privileged — it bypasses the 3-phase
71
73
  * confirmation requirement inside the eligibility_route gate. It should only
72
74
  * be set by authorized tooling (inferTags() never produces it automatically).
73
75
  */
74
- export declare function checkHivePromotions(swarmEntries: SwarmKnowledgeEntry[], config: KnowledgeConfig, directory: string): Promise<HivePromotionSummary>;
76
+ export declare function checkHivePromotions(swarmEntries: SwarmKnowledgeEntry[], config: KnowledgeConfig, directory: string, sessionID?: string): Promise<HivePromotionSummary>;
75
77
  export declare const _internals: {
76
78
  readSwarmEntries: (directory: string) => Promise<SwarmKnowledgeEntry[]>;
77
79
  checkHivePromotions: typeof checkHivePromotions;
78
80
  readCuratorSummary: typeof readCuratorSummary;
79
81
  appendCuratorRecommendation: typeof appendCuratorRecommendation;
80
- resolveCohortId: typeof resolveCohortId;
82
+ resolveCohortId: (directory: string, sessionID?: string) => Promise<CohortIdentity>;
81
83
  transactHiveStore: typeof transactHiveStore;
82
84
  validateLesson: typeof validateLesson;
83
85
  authorizeCuration: typeof authorizeCuration;
@@ -146,10 +148,31 @@ export declare const _internals: {
146
148
  synonym_map_max_pairs: number;
147
149
  } | undefined;
148
150
  };
151
+ /** #2472 W2 cadence clock (PRR-021 DI seam, invariant 7): the promotion
152
+ * cadence floor reads time through this seam so tests can advance the
153
+ * 60s floor deterministically without real sleeping or raw wall-clock
154
+ * polling. Everything else (entry timestamps, audit timestamps) stays on
155
+ * `new Date().toISOString()` — only the cadence decision is time-driven
156
+ * control flow. */
157
+ now: () => number;
158
+ /** Test-only: clears the #2472 W2 hook-gating state (per-directory cadence
159
+ * map + curator-migration guard). Production code never calls this; it
160
+ * exists so test files sharing one Bun process start from a clean slate. */
161
+ resetPromoterGatingState: () => void;
149
162
  };
150
163
  /**
151
164
  * Create a hook that promotes swarm entries to the hive.
152
- * The hook fires unconditionally - the caller decides when to invoke it.
165
+ *
166
+ * #2472 W2 gating — the hook self-gates instead of running unconditionally:
167
+ * 1. Write-class tools only (`PROMOTER_WRITE_TOOL_NAMES`): a read-only tool
168
+ * call returns before even the swarm-store read.
169
+ * 2. Empty-candidates gate: when no swarm entry has ACTIVE status the hook
170
+ * returns BEFORE cohort resolution, evidence loading, the hive
171
+ * transaction, and the curator-summary read. The one-time legacy
172
+ * curator-summary migration read stays reachable — at most once per
173
+ * directory per process (critic Round 2 item 1).
174
+ * 3. Cadence floor: a second qualifying invocation inside
175
+ * `PROMOTION_CADENCE_FLOOR_MS` returns before the promotion body.
153
176
  */
154
177
  export declare function createHivePromoterHook(directory: string, config: KnowledgeConfig): (input: unknown, output: unknown) => Promise<void>;
155
178
  /** Options for manual promotion (override semantics, #1847 §4). */
@@ -14,6 +14,14 @@
14
14
  * the async builder, yields to the event loop before doing any work, and
15
15
  * exposes the init promise so `toolAfter` can serialize incremental
16
16
  * updates after the initial scan completes.
17
+ *
18
+ * Issue #2472 (REPOGRAPH-1): `toolAfter` runs its entire cheap synchronous
19
+ * filter chain (enabled flag, write-tool membership, path extraction and
20
+ * validation, exclude-dir scoping) BEFORE awaiting the init promise, so a
21
+ * non-write tool call settles immediately even while the startup scan is
22
+ * pending — only write tools that will actually mutate the graph wait for
23
+ * the scan. The startup scan itself is bounded by an overall wall-clock
24
+ * budget (STARTUP_SCAN_BUDGET_MS) that resolves fail-open on timeout.
17
25
  */
18
26
  import { type BuildWorkspaceGraphOptions, type RepoGraph } from '../tools/repo-graph';
19
27
  import { type FreshnessOptions, type FreshnessProbe } from '../tools/repo-graph/freshness';
@@ -51,6 +59,12 @@ export interface RepoGraphBuilderOptions {
51
59
  maxFiles?: number;
52
60
  walkBudgetMs?: number;
53
61
  excludeDirs?: readonly string[];
62
+ /**
63
+ * Overall wall-clock budget (ms) for the startup scan (issue #2472).
64
+ * Defaults to STARTUP_SCAN_BUDGET_MS. Additive DI/test knob so the
65
+ * fail-open timeout path can be exercised without waiting 30 s.
66
+ */
67
+ scanBudgetMs?: number;
54
68
  }
55
69
  /**
56
70
  * Rebase a realpath'd file onto the lexical workspace root so the incremental
@@ -40,6 +40,27 @@ declare function maybeAppendSpecDriftAdvisory(output: {
40
40
  * Returns null if no valid retrospective found.
41
41
  */
42
42
  export declare function buildRetroInjection(directory: string, currentPhaseNumber: number, currentPlanTitle?: string): Promise<string | null>;
43
+ /**
44
+ * #2472 W4 (PR #2588 bot finding 7): dispose fence for a project root's
45
+ * deferred maintenance scans. Called best-effort from the plugin's
46
+ * `dispose` so a scheduled-but-not-yet-fired (or in-flight) doc-index /
47
+ * dark-matter background task cannot fire into — or keep writing `.swarm`
48
+ * artifacts for — a project whose plugin instance is being torn down.
49
+ *
50
+ * (i) Future scheduling for `directory` is suppressed: the resolved root
51
+ * is added to `cancelledDeferredScanDirs`, and
52
+ * `scheduleDeferredMaintenanceScans` is a no-op for cancelled roots.
53
+ * (ii) Any already-scheduled or in-flight task for `directory` aborts:
54
+ * the root's deferred-scan generation is bumped, and every task
55
+ * captured the pre-bump value and re-checks it before its first
56
+ * statement and before each major scan step, so even a long-running
57
+ * dark-matter git scan stops before its next write.
58
+ *
59
+ * A NEW system-enhancer instance created for the same directory (plugin
60
+ * re-init — the restart-safe lifecycle of issue #2472) removes the
61
+ * cancellation marker, so fresh instances schedule scans normally again.
62
+ */
63
+ export declare function cancelDeferredMaintenanceScans(directory: string): void;
43
64
  /**
44
65
  * Creates the experimental.chat.system.transform hook for system enhancement.
45
66
  */