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
@@ -3,66 +3,66 @@ import {
3
3
  getAgentSession,
4
4
  getBlockingActionCircuit,
5
5
  resetActionCircuitExternally
6
- } from "./index-an89qzd9.js";
7
- import"./index-8d90gzaz.js";
8
- import"./index-hvk3zs62.js";
9
- import"./index-9hy5q7gp.js";
10
- import"./index-p04pa9c9.js";
11
- import"./index-qkq56zyr.js";
12
- import"./index-17yszqs5.js";
6
+ } from "./index-gy55mc55.js";
7
+ import"./index-d5qf7hvh.js";
8
+ import"./index-j81kpway.js";
9
+ import"./index-3wtfrjcx.js";
10
+ import"./index-2n1v8ft1.js";
11
+ import"./index-wz258yje.js";
12
+ import"./index-ft1tnx0e.js";
13
13
  import"./index-txdagbh7.js";
14
14
  import"./index-cw912re7.js";
15
- import"./index-hrkamw9q.js";
16
- import"./index-359djbj1.js";
17
- import"./index-bw7r2b2m.js";
15
+ import"./index-jgtje76m.js";
16
+ import"./index-ty0wg9yp.js";
17
+ import"./index-x4azb6qj.js";
18
18
  import"./index-70ha9e09.js";
19
- import"./index-8hqkrd2j.js";
19
+ import"./index-bysyj3z4.js";
20
20
  import"./index-9ss2m4rs.js";
21
- import"./index-czr3jcg6.js";
21
+ import"./index-jr6tppv9.js";
22
22
  import"./index-zsrtt42s.js";
23
- import"./index-2dvk153d.js";
24
- import"./index-6chhqq2n.js";
25
- import"./index-8bdk7124.js";
23
+ import"./index-hbjax6hy.js";
24
+ import"./index-p0r5fn7y.js";
25
+ import"./index-x8cvbkjs.js";
26
26
  import"./index-b43rt5ph.js";
27
27
  import"./index-q7sjgr1y.js";
28
- import"./index-8n62bphd.js";
29
- import"./index-2rm5x9ps.js";
30
- import"./index-52jfm5s0.js";
31
- import"./index-jc9cxh90.js";
32
- import"./index-anxs69ad.js";
33
- import"./index-z6xqpmqg.js";
28
+ import"./index-c0eyq4rp.js";
29
+ import"./index-qmp4gxac.js";
30
+ import"./index-sxsyd7kf.js";
31
+ import"./index-3nww2vnx.js";
32
+ import"./index-4kwxpnf8.js";
34
33
  import"./index-p612v1mv.js";
35
- import"./index-a5w71m8f.js";
36
- import"./index-c20gf089.js";
34
+ import"./index-8nv3bc9h.js";
35
+ import"./index-c23w8t46.js";
37
36
  import"./index-rtry5xyf.js";
38
- import"./index-apxaa755.js";
37
+ import"./index-kd68b6mg.js";
39
38
  import"./index-3qf1vxtb.js";
40
39
  import"./index-n832052r.js";
41
- import"./index-8m12y79g.js";
42
- import"./index-30f4fe30.js";
43
- import"./index-2v17wb75.js";
44
- import"./index-79sr3fd1.js";
45
- import"./index-jx9f4ke1.js";
46
- import"./index-aftapk6j.js";
40
+ import"./index-7mxrqy4r.js";
41
+ import"./index-9ccxcjdm.js";
42
+ import"./index-hgphhnrp.js";
43
+ import"./index-nthqfxzz.js";
44
+ import"./index-7pp8fz4j.js";
45
+ import"./index-y3dtdn2f.js";
47
46
  import"./index-ry16d01s.js";
48
47
  import"./index-n4fzmqz8.js";
49
- import"./index-axf65x87.js";
50
- import"./index-fywshabz.js";
48
+ import"./index-fkk7x6sy.js";
49
+ import"./index-22sannyk.js";
51
50
  import"./index-ae75rja9.js";
52
- import"./index-a7rw4g4s.js";
51
+ import"./index-14z9en94.js";
52
+ import"./index-sxe3t040.js";
53
+ import"./index-19hjpqsy.js";
54
+ import"./index-bks56jbg.js";
53
55
  import"./index-7qefgq4j.js";
54
- import"./index-edm41q4j.js";
55
- import"./index-gy0nyfbw.js";
56
- import"./index-hwj25q9r.js";
56
+ import"./index-ee6ydtfe.js";
57
57
  import"./index-7g4c7s5r.js";
58
- import"./index-mg43w8p2.js";
58
+ import"./index-0a0jsbhg.js";
59
59
  import"./index-9e6fdz2h.js";
60
60
  import"./index-4rhhvd1a.js";
61
- import"./index-nb924ar6.js";
62
- import"./index-a0d4fp6r.js";
63
- import"./index-zjygnfay.js";
61
+ import"./index-e0bjbadr.js";
62
+ import"./index-0tc0pcmh.js";
64
63
  import"./index-bk5tah7q.js";
65
64
  import"./index-bpmtbmy9.js";
65
+ import"./index-zpsr8rpc.js";
66
66
  import"./index-q1r1cfww.js";
67
67
  import"./index-yzjaj53h.js";
68
68
  import"./index-zgwm4ryv.js";
@@ -0,0 +1,85 @@
1
+ // @bun
2
+ import {
3
+ _internals2 as _internals,
4
+ checkHivePromotions,
5
+ countDistinctProjects,
6
+ createHivePromoterHook,
7
+ isHiveEligible,
8
+ promoteFromSwarm,
9
+ promoteToHive
10
+ } from "./index-gy55mc55.js";
11
+ import"./index-d5qf7hvh.js";
12
+ import"./index-j81kpway.js";
13
+ import"./index-3wtfrjcx.js";
14
+ import"./index-2n1v8ft1.js";
15
+ import"./index-wz258yje.js";
16
+ import"./index-ft1tnx0e.js";
17
+ import"./index-txdagbh7.js";
18
+ import"./index-cw912re7.js";
19
+ import"./index-jgtje76m.js";
20
+ import"./index-ty0wg9yp.js";
21
+ import"./index-x4azb6qj.js";
22
+ import"./index-70ha9e09.js";
23
+ import"./index-bysyj3z4.js";
24
+ import"./index-9ss2m4rs.js";
25
+ import"./index-jr6tppv9.js";
26
+ import"./index-zsrtt42s.js";
27
+ import"./index-hbjax6hy.js";
28
+ import"./index-p0r5fn7y.js";
29
+ import"./index-x8cvbkjs.js";
30
+ import"./index-b43rt5ph.js";
31
+ import"./index-q7sjgr1y.js";
32
+ import"./index-c0eyq4rp.js";
33
+ import"./index-qmp4gxac.js";
34
+ import"./index-sxsyd7kf.js";
35
+ import"./index-3nww2vnx.js";
36
+ import"./index-4kwxpnf8.js";
37
+ import"./index-p612v1mv.js";
38
+ import"./index-8nv3bc9h.js";
39
+ import"./index-c23w8t46.js";
40
+ import"./index-rtry5xyf.js";
41
+ import"./index-kd68b6mg.js";
42
+ import"./index-3qf1vxtb.js";
43
+ import"./index-n832052r.js";
44
+ import"./index-7mxrqy4r.js";
45
+ import"./index-9ccxcjdm.js";
46
+ import"./index-hgphhnrp.js";
47
+ import"./index-nthqfxzz.js";
48
+ import"./index-7pp8fz4j.js";
49
+ import"./index-y3dtdn2f.js";
50
+ import"./index-ry16d01s.js";
51
+ import"./index-n4fzmqz8.js";
52
+ import"./index-fkk7x6sy.js";
53
+ import {
54
+ resolveHiveKnowledgePath
55
+ } from "./index-22sannyk.js";
56
+ import"./index-ae75rja9.js";
57
+ import"./index-14z9en94.js";
58
+ import"./index-sxe3t040.js";
59
+ import"./index-19hjpqsy.js";
60
+ import"./index-bks56jbg.js";
61
+ import"./index-7qefgq4j.js";
62
+ import"./index-ee6ydtfe.js";
63
+ import"./index-7g4c7s5r.js";
64
+ import"./index-0a0jsbhg.js";
65
+ import"./index-9e6fdz2h.js";
66
+ import"./index-4rhhvd1a.js";
67
+ import"./index-e0bjbadr.js";
68
+ import"./index-0tc0pcmh.js";
69
+ import"./index-bk5tah7q.js";
70
+ import"./index-bpmtbmy9.js";
71
+ import"./index-zpsr8rpc.js";
72
+ import"./index-q1r1cfww.js";
73
+ import"./index-yzjaj53h.js";
74
+ import"./index-zgwm4ryv.js";
75
+ import"./index-a76rekgs.js";
76
+ export {
77
+ resolveHiveKnowledgePath,
78
+ promoteToHive,
79
+ promoteFromSwarm,
80
+ isHiveEligible,
81
+ createHivePromoterHook,
82
+ countDistinctProjects,
83
+ checkHivePromotions,
84
+ _internals
85
+ };
@@ -14,16 +14,17 @@ import {
14
14
  PluginConfigSchema,
15
15
  init_schema,
16
16
  resolveExternalSkillsConfig
17
- } from "./index-nb924ar6.js";
18
- import {
19
- MAX_MERGE_DEPTH,
20
- deepMerge,
21
- init_merge
22
- } from "./index-zjygnfay.js";
17
+ } from "./index-e0bjbadr.js";
23
18
  import {
24
19
  exports_external,
25
20
  init_zod
26
21
  } from "./index-bpmtbmy9.js";
22
+ import {
23
+ DangerousMergeKeyError,
24
+ MAX_MERGE_DEPTH,
25
+ deepMerge,
26
+ init_merge
27
+ } from "./index-zpsr8rpc.js";
27
28
  import {
28
29
  __esm,
29
30
  __export
@@ -503,7 +504,15 @@ function enforceGitBinaryProvenance(mergedRaw, rawUserConfig) {
503
504
  function buildConfigWithMeta(rawUserConfig, rawProjectConfig, loadedFromFile, configHadErrors) {
504
505
  let mergedRaw = rawUserConfig ?? {};
505
506
  if (rawProjectConfig) {
506
- mergedRaw = deepMerge(mergedRaw, rawProjectConfig);
507
+ try {
508
+ mergedRaw = deepMerge(mergedRaw, rawProjectConfig);
509
+ } catch (err) {
510
+ if (err instanceof DangerousMergeKeyError) {
511
+ advisoryWarn(`[opencode-swarm] \u26A0\uFE0F SECURITY: Ignoring the entire project config (.opencode/${CONFIG_FILENAME}): ` + `it carries the dangerous key "${err.key}" at "${err.path}", a prototype-pollution payload. ` + "Continuing with user-level configuration only.");
512
+ } else {
513
+ throw err;
514
+ }
515
+ }
507
516
  }
508
517
  mergedRaw = enforceGitBinaryProvenance(mergedRaw, rawUserConfig);
509
518
  if (rawFullAutoLocked(rawUserConfig) || rawFullAutoLocked(rawProjectConfig)) {
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  init_merge
4
- } from "./index-zjygnfay.js";
4
+ } from "./index-zpsr8rpc.js";
5
5
  import {
6
6
  __esm
7
7
  } from "./index-a76rekgs.js";
@@ -1,10 +1,10 @@
1
1
  // @bun
2
+ import {
3
+ atomicWriteFile
4
+ } from "./index-sxe3t040.js";
2
5
  import {
3
6
  canonicalRootKeyFresh
4
7
  } from "./index-7qefgq4j.js";
5
- import {
6
- atomicWriteFile
7
- } from "./index-edm41q4j.js";
8
8
  import {
9
9
  init_logger,
10
10
  warn
@@ -6,6 +6,21 @@ import * as path from "path";
6
6
  var MAX_CACHE_ENTRIES = 128;
7
7
  var textCache = new Map;
8
8
  var parsedCache = new Map;
9
+ var MAX_KNOWN_TO_EXIST_PATHS = 512;
10
+ var knownToExist = new Set;
11
+ function noteKnownToExist(resolvedPath) {
12
+ if (knownToExist.has(resolvedPath))
13
+ return;
14
+ knownToExist.add(resolvedPath);
15
+ if (knownToExist.size > MAX_KNOWN_TO_EXIST_PATHS) {
16
+ const oldest = knownToExist.values().next().value;
17
+ if (oldest !== undefined)
18
+ knownToExist.delete(oldest);
19
+ }
20
+ }
21
+ function wasObservedToExist(filePath) {
22
+ return knownToExist.has(path.resolve(filePath));
23
+ }
9
24
  var stats = {
10
25
  textReadCount: 0,
11
26
  textCacheHitCount: 0,
@@ -76,6 +91,7 @@ async function readCachedTextFile(filePath, directRead) {
76
91
  stats.textReadCount++;
77
92
  return directRead();
78
93
  }
94
+ noteKnownToExist(cacheKey);
79
95
  const cached = textCache.get(cacheKey);
80
96
  if (cached && sameStamp(cached, stamp)) {
81
97
  stats.textCacheHitCount++;
@@ -574,6 +590,28 @@ function assertSwarmContainedTarget(targetPath) {
574
590
  var MAX_ATOMIC_WRITE_BYTES = 256 * 1024 * 1024;
575
591
  var RENAME_RETRY_DELAYS_MS = [10, 25, 50, 100, 200];
576
592
  var RETRYABLE_RENAME_CODES = new Set(["EPERM", "EBUSY", "EACCES", "EEXIST"]);
593
+ var MAX_RECENT_WRITE_TRACKED_PATHS = 256;
594
+ var RECENT_WRITE_WINDOW_MS = 500;
595
+ var recentWriteActivity = new Map;
596
+ function noteRecentWriteActivity(resolvedTarget) {
597
+ recentWriteActivity.delete(resolvedTarget);
598
+ recentWriteActivity.set(resolvedTarget, Date.now());
599
+ while (recentWriteActivity.size > MAX_RECENT_WRITE_TRACKED_PATHS) {
600
+ const oldest = recentWriteActivity.keys().next().value;
601
+ if (oldest === undefined)
602
+ break;
603
+ recentWriteActivity.delete(oldest);
604
+ }
605
+ }
606
+ function clearRecentWriteActivity(targetPath) {
607
+ return recentWriteActivity.delete(path2.resolve(targetPath));
608
+ }
609
+ function wasRecentlyWrittenByThisProcess(targetPath, withinMs = RECENT_WRITE_WINDOW_MS) {
610
+ const last = recentWriteActivity.get(path2.resolve(targetPath));
611
+ if (last === undefined)
612
+ return false;
613
+ return Date.now() - last <= withinMs;
614
+ }
577
615
  var _internals2 = {
578
616
  randomSuffix: () => randomBytes(16).toString("hex"),
579
617
  writeSync: (fd, buffer, offset, length) => fs2.writeSync(fd, buffer, offset, length),
@@ -619,6 +657,7 @@ function writeAtomicSync(targetPath, content, options) {
619
657
  assertWellFormedTargetPath(targetPath);
620
658
  }
621
659
  const resolvedTarget = path2.resolve(targetPath);
660
+ noteRecentWriteActivity(resolvedTarget);
622
661
  const buffer = toBuffer(content);
623
662
  const maxBytes = options?.maxBytes ?? MAX_ATOMIC_WRITE_BYTES;
624
663
  if (buffer.byteLength > maxBytes) {
@@ -627,25 +666,30 @@ function writeAtomicSync(targetPath, content, options) {
627
666
  const tempPath = `${resolvedTarget}.${_internals2.randomSuffix()}.tmp`;
628
667
  fs2.mkdirSync(path2.dirname(tempPath), { recursive: true });
629
668
  try {
630
- const fd = fs2.openSync(tempPath, "wx", options?.mode);
631
669
  try {
632
- let written = 0;
633
- while (written < buffer.byteLength) {
634
- written += _internals2.writeSync(fd, buffer, written, buffer.byteLength - written);
635
- }
636
- if (options?.skipFsync !== true) {
637
- try {
638
- _internals2.fsyncSync(fd);
639
- } catch {}
670
+ const fd = fs2.openSync(tempPath, "wx", options?.mode);
671
+ try {
672
+ let written = 0;
673
+ while (written < buffer.byteLength) {
674
+ written += _internals2.writeSync(fd, buffer, written, buffer.byteLength - written);
675
+ }
676
+ if (options?.skipFsync !== true) {
677
+ try {
678
+ _internals2.fsyncSync(fd);
679
+ } catch {}
680
+ }
681
+ } finally {
682
+ fs2.closeSync(fd);
640
683
  }
684
+ renameWithRetry(tempPath, resolvedTarget);
641
685
  } finally {
642
- fs2.closeSync(fd);
686
+ try {
687
+ _internals2.unlinkSync(tempPath);
688
+ } catch {}
643
689
  }
644
- renameWithRetry(tempPath, resolvedTarget);
645
- } finally {
646
- try {
647
- _internals2.unlinkSync(tempPath);
648
- } catch {}
690
+ } catch (error) {
691
+ clearRecentWriteActivity(resolvedTarget);
692
+ throw error;
649
693
  }
650
694
  try {
651
695
  const dirFd = fs2.openSync(path2.dirname(resolvedTarget), "r");
@@ -656,6 +700,7 @@ function writeAtomicSync(targetPath, content, options) {
656
700
  }
657
701
  } catch {}
658
702
  invalidateCachedArtifact(resolvedTarget);
703
+ noteRecentWriteActivity(resolvedTarget);
659
704
  }
660
705
  async function atomicWriteSwarmFile(targetPath, content, options) {
661
706
  await new Promise((resolve3) => setImmediate(resolve3));
@@ -669,4 +714,4 @@ async function atomicWriteFileAnyRoot(targetPath, content, options) {
669
714
  writeAtomicSync(targetPath, content, { ...options, contained: false });
670
715
  }
671
716
 
672
- export { readCachedTextFile, readCachedParsedFile, invalidateCachedArtifact, resetSwarmArtifactCache, matchTempGrammar, parseTargetBasename, atomicWriteSwarmFile, atomicWriteSwarmFileSync, atomicWriteFileAnyRoot };
717
+ export { wasObservedToExist, readCachedTextFile, readCachedParsedFile, invalidateCachedArtifact, resetSwarmArtifactCache, matchTempGrammar, parseTargetBasename, RECENT_WRITE_WINDOW_MS, wasRecentlyWrittenByThisProcess, atomicWriteSwarmFile, atomicWriteSwarmFileSync, atomicWriteFileAnyRoot };
@@ -6,13 +6,13 @@ import {
6
6
  } from "./index-ae75rja9.js";
7
7
  import {
8
8
  resolveKnowledgeStoreDir
9
- } from "./index-a7rw4g4s.js";
9
+ } from "./index-14z9en94.js";
10
10
  import {
11
11
  atomicWriteFile
12
- } from "./index-edm41q4j.js";
12
+ } from "./index-sxe3t040.js";
13
13
  import {
14
14
  readCachedParsedFile
15
- } from "./index-gy0nyfbw.js";
15
+ } from "./index-19hjpqsy.js";
16
16
  import {
17
17
  require_proper_lockfile
18
18
  } from "./index-7g4c7s5r.js";
@@ -713,7 +713,7 @@ async function applyConfidenceFloorAction(directory, touched, options) {
713
713
  const {
714
714
  readAuthoritativeKnowledgeCounterRollups,
715
715
  effectiveRetrievalOutcomes
716
- } = await import("./knowledge-events-1t1t0bv7.js");
716
+ } = await import("./knowledge-events-9z5sskyv.js");
717
717
  const rollups = await readAuthoritativeKnowledgeCounterRollups(directory);
718
718
  const flagIds = new Set;
719
719
  for (const e of atFloor) {
@@ -780,11 +780,11 @@ async function applyConfidenceFloorAction(directory, touched, options) {
780
780
  });
781
781
  }
782
782
  if (action === "quarantine" && toQuarantine.length > 0) {
783
- const { quarantineEntry } = await import("./knowledge-validator-tf7yq2pd.js");
784
- const { KnowledgeConfigSchema } = await import("./schema-mzb1354k.js");
783
+ const { quarantineEntry } = await import("./knowledge-validator-xe1fza7c.js");
784
+ const { KnowledgeConfigSchema } = await import("./schema-w1hsvw1h.js");
785
785
  let config;
786
786
  try {
787
- const { loadPluginConfigWithMeta } = await import("./index-rkn17q5e.js");
787
+ const { loadPluginConfigWithMeta } = await import("./index-st47knj6.js");
788
788
  const { config: loadedConfig } = loadPluginConfigWithMeta(directory);
789
789
  config = KnowledgeConfigSchema.parse(loadedConfig.knowledge ?? {});
790
790
  } catch {
@@ -12,13 +12,13 @@ import {
12
12
  PluginConfigSchema,
13
13
  init_schema,
14
14
  stripKnownSwarmPrefix
15
- } from "./index-nb924ar6.js";
15
+ } from "./index-e0bjbadr.js";
16
16
  import {
17
17
  ALL_AGENT_NAMES,
18
18
  TOOL_NAME_SET,
19
19
  init_constants,
20
20
  init_tool_metadata
21
- } from "./index-a0d4fp6r.js";
21
+ } from "./index-0tc0pcmh.js";
22
22
  import {
23
23
  log
24
24
  } from "./index-zgwm4ryv.js";
@@ -1,36 +1,36 @@
1
1
  // @bun
2
2
  import {
3
3
  validateSwarmPath
4
- } from "./index-anxs69ad.js";
4
+ } from "./index-4kwxpnf8.js";
5
5
  import {
6
6
  observeReceiptTransition
7
- } from "./index-axf65x87.js";
7
+ } from "./index-fkk7x6sy.js";
8
8
  import {
9
9
  resolveHiveEventsPath
10
10
  } from "./index-ae75rja9.js";
11
11
  import {
12
12
  resolveKnowledgeStoreDir
13
- } from "./index-a7rw4g4s.js";
14
- import {
15
- canonicalRootKey
16
- } from "./index-7qefgq4j.js";
13
+ } from "./index-14z9en94.js";
17
14
  import {
18
15
  assertProjectRoot,
19
16
  atomicWriteFile
20
- } from "./index-edm41q4j.js";
17
+ } from "./index-sxe3t040.js";
21
18
  import {
22
19
  emit
23
- } from "./index-hwj25q9r.js";
20
+ } from "./index-bks56jbg.js";
21
+ import {
22
+ canonicalRootKey
23
+ } from "./index-7qefgq4j.js";
24
24
  import {
25
25
  require_proper_lockfile
26
26
  } from "./index-7g4c7s5r.js";
27
27
  import {
28
28
  loadPluginConfigWithMeta
29
- } from "./index-mg43w8p2.js";
29
+ } from "./index-0a0jsbhg.js";
30
30
  import {
31
31
  KnowledgeConfigSchema,
32
32
  init_schema
33
- } from "./index-nb924ar6.js";
33
+ } from "./index-e0bjbadr.js";
34
34
  import {
35
35
  init_logger,
36
36
  warn
@@ -2813,7 +2813,7 @@ async function applyKnowledgeVerdictFeedback(directory, options) {
2813
2813
  }
2814
2814
  let bumps = 0;
2815
2815
  if (deltas.length > 0) {
2816
- const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-m2snb0xg.js");
2816
+ const { bumpKnowledgeConfidenceBatch } = await import("./knowledge-store-1hzt2a0t.js");
2817
2817
  bumps = await bumpKnowledgeConfidenceBatch(directory, deltas, options?.floorOptions);
2818
2818
  }
2819
2819
  return {
@@ -1,17 +1,17 @@
1
1
  // @bun
2
2
  import {
3
3
  observeStoreHealth
4
- } from "./index-axf65x87.js";
4
+ } from "./index-fkk7x6sy.js";
5
5
  import {
6
6
  telemetry
7
- } from "./index-hwj25q9r.js";
7
+ } from "./index-bks56jbg.js";
8
8
  import {
9
9
  init_schema,
10
10
  stripKnownSwarmPrefix
11
- } from "./index-nb924ar6.js";
11
+ } from "./index-e0bjbadr.js";
12
12
  import {
13
13
  init_constants
14
- } from "./index-a0d4fp6r.js";
14
+ } from "./index-0tc0pcmh.js";
15
15
  import {
16
16
  getPathFlavor,
17
17
  init_path_identity,
@@ -1,13 +1,16 @@
1
1
  // @bun
2
- import {
3
- SwarmError
4
- } from "./index-z6xqpmqg.js";
5
2
  import {
6
3
  bunFile
7
4
  } from "./index-p612v1mv.js";
8
5
  import {
9
- readCachedTextFile
10
- } from "./index-gy0nyfbw.js";
6
+ RECENT_WRITE_WINDOW_MS,
7
+ readCachedTextFile,
8
+ wasObservedToExist,
9
+ wasRecentlyWrittenByThisProcess
10
+ } from "./index-19hjpqsy.js";
11
+ import {
12
+ SwarmError
13
+ } from "./index-ee6ydtfe.js";
11
14
  import {
12
15
  warn
13
16
  } from "./index-zgwm4ryv.js";
@@ -144,8 +147,9 @@ async function readSwarmFileAsync(directory, filename, cache) {
144
147
  const ENOENT_RETRY_DELAY_MS = 10;
145
148
  const maxAttempts = 6;
146
149
  for (let attempt = 0;attempt < maxAttempts; attempt++) {
150
+ let resolvedPath = "";
147
151
  try {
148
- const resolvedPath = _internals.validateSwarmPath(directory, filename);
152
+ resolvedPath = _internals.validateSwarmPath(directory, filename);
149
153
  return await _internals.readCachedTextFile(resolvedPath, async () => {
150
154
  const file = bunFile(resolvedPath);
151
155
  return await file.text();
@@ -153,6 +157,9 @@ async function readSwarmFileAsync(directory, filename, cache) {
153
157
  } catch (err) {
154
158
  const code = err?.code;
155
159
  if (code === "ENOENT") {
160
+ const retryWorthy = resolvedPath !== "" && (wasRecentlyWrittenByThisProcess(resolvedPath, RECENT_WRITE_WINDOW_MS) || wasObservedToExist(resolvedPath));
161
+ if (!retryWorthy)
162
+ return null;
156
163
  if (attempt >= ENOENT_MAX_ATTEMPTS - 1)
157
164
  return null;
158
165
  await new Promise((resolve2) => setTimeout(resolve2, ENOENT_RETRY_DELAY_MS));
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  computePlanStructureHash
4
- } from "./index-30f4fe30.js";
4
+ } from "./index-9ccxcjdm.js";
5
5
  import {
6
6
  appendCoreEventSync
7
- } from "./index-2v17wb75.js";
7
+ } from "./index-hgphhnrp.js";
8
8
  import {
9
9
  deleteCoordinationState,
10
10
  derivePlanId,
@@ -13,27 +13,27 @@ import {
13
13
  transitionCoordinationState,
14
14
  transitionCoordinationStateWithinTransaction,
15
15
  withCoordinationTransaction
16
- } from "./index-jx9f4ke1.js";
16
+ } from "./index-7pp8fz4j.js";
17
17
  import {
18
18
  getProjectDb
19
- } from "./index-aftapk6j.js";
19
+ } from "./index-y3dtdn2f.js";
20
20
  import {
21
21
  canonicalExistingFilesystemPath,
22
22
  legacyCanonicalExistingFilesystemPath
23
23
  } from "./index-ry16d01s.js";
24
24
  import {
25
25
  assertProjectRoot
26
- } from "./index-edm41q4j.js";
26
+ } from "./index-sxe3t040.js";
27
27
  import {
28
28
  atomicWriteSwarmFile,
29
29
  atomicWriteSwarmFileSync
30
- } from "./index-gy0nyfbw.js";
30
+ } from "./index-19hjpqsy.js";
31
31
  import {
32
32
  require_proper_lockfile
33
33
  } from "./index-7g4c7s5r.js";
34
34
  import {
35
35
  PlanSchema
36
- } from "./index-mg43w8p2.js";
36
+ } from "./index-0a0jsbhg.js";
37
37
  import {
38
38
  init_path_identity,
39
39
  unsafePathTextReason
@@ -4,7 +4,7 @@ import {
4
4
  getProjectDb,
5
5
  projectDbExists,
6
6
  withImmediateTransaction
7
- } from "./index-aftapk6j.js";
7
+ } from "./index-y3dtdn2f.js";
8
8
 
9
9
  // src/db/coordination-store.ts
10
10
  import { createHash } from "crypto";
@@ -1,7 +1,7 @@
1
1
  // @bun
2
2
  import {
3
3
  authorizeCuration
4
- } from "./index-c20gf089.js";
4
+ } from "./index-c23w8t46.js";
5
5
  import {
6
6
  findNearDuplicate,
7
7
  inferTags,
@@ -9,13 +9,13 @@ import {
9
9
  resolveSwarmKnowledgePath,
10
10
  resolveSwarmRejectedPath,
11
11
  transactKnowledge
12
- } from "./index-fywshabz.js";
12
+ } from "./index-22sannyk.js";
13
13
  import {
14
14
  resolveKnowledgeStoreDir
15
- } from "./index-a7rw4g4s.js";
15
+ } from "./index-14z9en94.js";
16
16
  import {
17
17
  atomicWriteFile
18
- } from "./index-edm41q4j.js";
18
+ } from "./index-sxe3t040.js";
19
19
  import {
20
20
  require_proper_lockfile
21
21
  } from "./index-7g4c7s5r.js";
@@ -2,20 +2,20 @@
2
2
  import {
3
3
  derivePlanId,
4
4
  derivePlanIdentityHash
5
- } from "./index-jx9f4ke1.js";
5
+ } from "./index-7pp8fz4j.js";
6
6
  import {
7
7
  assertProjectRoot,
8
8
  withEvidenceLock
9
- } from "./index-edm41q4j.js";
9
+ } from "./index-sxe3t040.js";
10
10
  import {
11
11
  emit
12
- } from "./index-hwj25q9r.js";
12
+ } from "./index-bks56jbg.js";
13
13
  import {
14
14
  ExecutionProfileSchema,
15
15
  PlanSchema,
16
16
  TaskStatusSchema,
17
17
  init_loader
18
- } from "./index-mg43w8p2.js";
18
+ } from "./index-0a0jsbhg.js";
19
19
  import {
20
20
  criticalWarn,
21
21
  init_logger,