@tangle-network/agent-app 0.61.3 → 0.62.0

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 (308) hide show
  1. package/dist/{DesignCanvas-L6J72JQ2.js → DesignCanvas-IQKYAEC4.js} +3 -2
  2. package/dist/{DesignCanvasEditor-QFQD63MR.js → DesignCanvasEditor-O7OCZTGC.js} +5 -4
  3. package/dist/{TimelineEditor-7KBPJQLT.js → TimelineEditor-VB2UJ34D.js} +4 -2
  4. package/dist/VaultPane-AYW7CO33.js +8 -0
  5. package/dist/agent-profiles/d1.js +1 -1
  6. package/dist/agent-profiles/index.d.ts +0 -82
  7. package/dist/agent-profiles/index.js +1 -21
  8. package/dist/agent-profiles/self-management.d.ts +0 -55
  9. package/dist/alerting/index.d.ts +1 -1
  10. package/dist/alerting/index.js +1 -3
  11. package/dist/alerting/slack.d.ts +6 -79
  12. package/dist/app-auth/drizzle.d.ts +17 -271
  13. package/dist/app-auth/drizzle.js +6 -2
  14. package/dist/app-auth/drizzle.js.map +1 -1
  15. package/dist/app-auth/index.js +3 -3
  16. package/dist/assets/types.d.ts +2 -1
  17. package/dist/assistant/AssistantPanel.d.ts +1 -1
  18. package/dist/assistant/index.js +635 -392
  19. package/dist/assistant/index.js.map +1 -1
  20. package/dist/billing/identity-locks.d.ts +5 -0
  21. package/dist/billing/index.js +1 -1
  22. package/dist/brand-extraction/index.js.map +1 -1
  23. package/dist/brand-extraction/types.d.ts +2 -1
  24. package/dist/chat-react/index.js +6 -5
  25. package/dist/chat-routes/attachment-write-safety.d.ts +4 -0
  26. package/dist/chat-routes/draft-persistence.d.ts +2 -14
  27. package/dist/chat-routes/index.d.ts +1 -0
  28. package/dist/chat-routes/index.js +853 -773
  29. package/dist/chat-routes/index.js.map +1 -1
  30. package/dist/chat-routes/sandbox-model-source.d.ts +20 -0
  31. package/dist/chat-routes/stored-attachments.d.ts +18 -0
  32. package/dist/chat-routes/turn-admission.d.ts +1 -1
  33. package/dist/chat-routes/turn-execution.d.ts +2 -2
  34. package/dist/chat-routes/turn-route-contracts.d.ts +3 -29
  35. package/dist/chat-store/core.d.ts +19 -1
  36. package/dist/chat-store/index.js.map +1 -1
  37. package/dist/chat-store/store.d.ts +3 -29
  38. package/dist/{chunk-ATQQCG4I.js → chunk-2VJLLRVV.js} +2 -2
  39. package/dist/{chunk-R4X5474U.js → chunk-52SDU43B.js} +12 -27
  40. package/dist/chunk-52SDU43B.js.map +1 -0
  41. package/dist/{chunk-MDRH3SDA.js → chunk-54YIL7WM.js} +3 -3
  42. package/dist/{chunk-6QJ3GB3A.js → chunk-5GSZGTPJ.js} +2 -2
  43. package/dist/{chunk-5IM2CLYX.js → chunk-6JEDSKFH.js} +232 -218
  44. package/dist/chunk-6JEDSKFH.js.map +1 -0
  45. package/dist/{chunk-6PRQ45QE.js → chunk-6OG4244Y.js} +1 -1
  46. package/dist/chunk-6OG4244Y.js.map +1 -0
  47. package/dist/{chunk-ZDPUC6CM.js → chunk-6ZVSMA4T.js} +3 -3
  48. package/dist/{chunk-TXUAGSFR.js → chunk-76MPX7JQ.js} +47 -1
  49. package/dist/chunk-76MPX7JQ.js.map +1 -0
  50. package/dist/{chunk-BOQ4HVVH.js → chunk-7ISHKBAD.js} +61 -52
  51. package/dist/chunk-7ISHKBAD.js.map +1 -0
  52. package/dist/chunk-7PULOECS.js +22 -0
  53. package/dist/chunk-7PULOECS.js.map +1 -0
  54. package/dist/{chunk-KJODHPWM.js → chunk-CPVGRQ43.js} +511 -339
  55. package/dist/chunk-CPVGRQ43.js.map +1 -0
  56. package/dist/{chunk-LO6VQ35O.js → chunk-CQZVJVME.js} +2 -2
  57. package/dist/{chunk-Y43PXON2.js → chunk-EFQUAWWF.js} +577 -546
  58. package/dist/chunk-EFQUAWWF.js.map +1 -0
  59. package/dist/{chunk-FPNZMIAW.js → chunk-ELX5YITO.js} +1 -1
  60. package/dist/chunk-ELX5YITO.js.map +1 -0
  61. package/dist/chunk-FGAROAUF.js +19 -0
  62. package/dist/chunk-FGAROAUF.js.map +1 -0
  63. package/dist/{chunk-HN6MZ2XL.js → chunk-FTNGGR37.js} +641 -466
  64. package/dist/chunk-FTNGGR37.js.map +1 -0
  65. package/dist/{chunk-G4F2NWZH.js → chunk-FZ3ZFVAC.js} +4 -4
  66. package/dist/{chunk-UCCSJX64.js → chunk-GIEUZBQQ.js} +1112 -644
  67. package/dist/chunk-GIEUZBQQ.js.map +1 -0
  68. package/dist/{chunk-MEKOWH5E.js → chunk-IVBREL7A.js} +785 -526
  69. package/dist/chunk-IVBREL7A.js.map +1 -0
  70. package/dist/{chunk-WSEXFTN4.js → chunk-JBXNU5WD.js} +26 -26
  71. package/dist/chunk-JBXNU5WD.js.map +1 -0
  72. package/dist/{chunk-F2VX6TTJ.js → chunk-JRCZHDRG.js} +2 -41
  73. package/dist/chunk-JRCZHDRG.js.map +1 -0
  74. package/dist/{chunk-LXYQOOXU.js → chunk-JRW6LCIA.js} +552 -302
  75. package/dist/chunk-JRW6LCIA.js.map +1 -0
  76. package/dist/{chunk-TVPH5T4F.js → chunk-KS4I7KVC.js} +16 -22
  77. package/dist/{chunk-TVPH5T4F.js.map → chunk-KS4I7KVC.js.map} +1 -1
  78. package/dist/{chunk-J2BBYVGF.js → chunk-MRZP65DZ.js} +1 -117
  79. package/dist/chunk-MRZP65DZ.js.map +1 -0
  80. package/dist/{chunk-4ZSLX3LY.js → chunk-OODZCBSM.js} +1 -1
  81. package/dist/chunk-OODZCBSM.js.map +1 -0
  82. package/dist/chunk-P4RRC4AO.js +47 -0
  83. package/dist/chunk-P4RRC4AO.js.map +1 -0
  84. package/dist/{chunk-ORQD4AUO.js → chunk-PCAY23GS.js} +1 -6
  85. package/dist/chunk-PCAY23GS.js.map +1 -0
  86. package/dist/{chunk-NMZUW6VJ.js → chunk-PEJ5OP5B.js} +3 -3
  87. package/dist/chunk-PEJ5OP5B.js.map +1 -0
  88. package/dist/{chunk-NHYRIM4I.js → chunk-PIPNDZ6H.js} +304 -194
  89. package/dist/chunk-PIPNDZ6H.js.map +1 -0
  90. package/dist/{chunk-DJIN3YUJ.js → chunk-TCJ4TMOW.js} +83 -47
  91. package/dist/{chunk-DJIN3YUJ.js.map → chunk-TCJ4TMOW.js.map} +1 -1
  92. package/dist/chunk-UHSUY6H6.js +79 -0
  93. package/dist/chunk-UHSUY6H6.js.map +1 -0
  94. package/dist/{chunk-PDD5A43Y.js → chunk-UTL6TEN6.js} +3 -3
  95. package/dist/{chunk-VJBFCNAU.js → chunk-UW2DKTEM.js} +123 -130
  96. package/dist/chunk-UW2DKTEM.js.map +1 -0
  97. package/dist/{chunk-S27DKRI6.js → chunk-VDYEVCQQ.js} +2 -2
  98. package/dist/{chunk-UFQM46NV.js → chunk-VK3F4N4U.js} +2 -2
  99. package/dist/{chunk-6ZIC6OG5.js → chunk-VYBTQK25.js} +126 -122
  100. package/dist/chunk-VYBTQK25.js.map +1 -0
  101. package/dist/{chunk-RL3Z747H.js → chunk-W2BV2XOC.js} +1491 -700
  102. package/dist/chunk-W2BV2XOC.js.map +1 -0
  103. package/dist/{chunk-FUZETA6Z.js → chunk-X6SZGQTK.js} +2 -2
  104. package/dist/{chunk-CD2LQXY6.js → chunk-XOHE6SKU.js} +14 -16
  105. package/dist/{chunk-CD2LQXY6.js.map → chunk-XOHE6SKU.js.map} +1 -1
  106. package/dist/{chunk-ZBB5KQ6B.js → chunk-Y3GO6SG3.js} +73 -66
  107. package/dist/chunk-Y3GO6SG3.js.map +1 -0
  108. package/dist/chunk-ZAMHLXNS.js +56 -0
  109. package/dist/chunk-ZAMHLXNS.js.map +1 -0
  110. package/dist/{chunk-RHFN7TUV.js → chunk-ZDHCV462.js} +47 -44
  111. package/dist/{chunk-RHFN7TUV.js.map → chunk-ZDHCV462.js.map} +1 -1
  112. package/dist/chunk-ZOS3D26Z.js +72 -0
  113. package/dist/chunk-ZOS3D26Z.js.map +1 -0
  114. package/dist/design-canvas/index.js +32 -32
  115. package/dist/design-canvas/index.js.map +1 -1
  116. package/dist/design-canvas-react/components/DesignCanvas.d.ts +1 -1
  117. package/dist/design-canvas-react/components/Workspace.d.ts +1 -1
  118. package/dist/design-canvas-react/components/glyphs.d.ts +31 -40
  119. package/dist/design-canvas-react/components/transform-math.d.ts +0 -8
  120. package/dist/design-canvas-react/components/use-workspace-keyboard.d.ts +2 -2
  121. package/dist/design-canvas-react/contracts.d.ts +2 -2
  122. package/dist/design-canvas-react/engine.js +1 -1
  123. package/dist/design-canvas-react/index.js +9 -7
  124. package/dist/design-canvas-react/index.js.map +1 -1
  125. package/dist/design-canvas-react/lazy.js +1 -1
  126. package/dist/eval/calibration.d.ts +1 -38
  127. package/dist/eval/index.d.ts +2 -4
  128. package/dist/eval/index.js +0 -84
  129. package/dist/eval/index.js.map +1 -1
  130. package/dist/harness/index.d.ts +1 -1
  131. package/dist/harness/index.js +1 -1
  132. package/dist/harness/session-selection.d.ts +2 -2
  133. package/dist/hub-approvals/index.js +1 -1
  134. package/dist/hub-approvals/result.d.ts +1 -1
  135. package/dist/hub-approvals-react/index.js +4 -4
  136. package/dist/hub-approvals-react/index.js.map +1 -1
  137. package/dist/hub-approvals-react/parts.d.ts +1 -1
  138. package/dist/launch-invariants/cli.js +4 -4
  139. package/dist/launch-invariants/index.js +3 -3
  140. package/dist/launch-invariants/testing.js +4 -4
  141. package/dist/legibility/cli.js +1 -1
  142. package/dist/legibility/index.js +1 -1
  143. package/dist/{mention-editor-B23OMFT2.js → mention-editor-4BKBMWIK.js} +83 -57
  144. package/dist/mention-editor-4BKBMWIK.js.map +1 -0
  145. package/dist/missions/index.js +144 -137
  146. package/dist/missions/index.js.map +1 -1
  147. package/dist/operator/index.js +1 -1
  148. package/dist/peer-floors/check.js +1 -1
  149. package/dist/peer-floors/cli.js +6 -14
  150. package/dist/peer-floors/cli.js.map +1 -1
  151. package/dist/peer-floors/source-entries.d.ts +6 -0
  152. package/dist/platform/index.js +10 -10
  153. package/dist/preset-cloudflare/index.js +1 -1
  154. package/dist/profile/index.d.ts +0 -1
  155. package/dist/profile/index.js +1 -422
  156. package/dist/profile/index.js.map +1 -1
  157. package/dist/profile-editor/server.d.ts +0 -1
  158. package/dist/profile-editor/server.js +0 -1
  159. package/dist/profile-editor/server.js.map +1 -1
  160. package/dist/public-consultation/index.d.ts +2 -2
  161. package/dist/public-consultation/index.js +6 -6
  162. package/dist/record/drizzle.js +156 -148
  163. package/dist/record/drizzle.js.map +1 -1
  164. package/dist/runtime/index.js +4 -4
  165. package/dist/runtime/router-turn.js +3 -3
  166. package/dist/sandbox/box-health.d.ts +1 -1
  167. package/dist/sandbox/index.js +5 -5
  168. package/dist/sequences/drizzle.js +5 -15
  169. package/dist/sequences/drizzle.js.map +1 -1
  170. package/dist/sequences/index.d.ts +1 -0
  171. package/dist/sequences/index.js +18 -14
  172. package/dist/sequences/index.js.map +1 -1
  173. package/dist/sequences/row-mapping.d.ts +7 -0
  174. package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
  175. package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
  176. package/dist/sequences-react/components/glyphs.d.ts +12 -21
  177. package/dist/sequences-react/components/index.d.ts +0 -2
  178. package/dist/sequences-react/components/interaction-math.d.ts +3 -3
  179. package/dist/sequences-react/contracts.d.ts +1 -1
  180. package/dist/sequences-react/engine/snap.d.ts +2 -2
  181. package/dist/sequences-react/index.js +4 -4
  182. package/dist/sequences-react/index.js.map +1 -1
  183. package/dist/settings-react/index.js +13 -30
  184. package/dist/settings-react/index.js.map +1 -1
  185. package/dist/settings-react/timezone-picker.d.ts +0 -6
  186. package/dist/signoff/browser-budget.d.ts +6 -1
  187. package/dist/signoff/cli.d.ts +0 -7
  188. package/dist/signoff/cli.js +1 -2
  189. package/dist/signoff/cli.js.map +1 -1
  190. package/dist/signoff/index.js +1 -1
  191. package/dist/skills/index.d.ts +1 -1
  192. package/dist/skills/index.js +5 -25
  193. package/dist/skills/marketplace.d.ts +1 -75
  194. package/dist/skills-placement/box.js +3 -4
  195. package/dist/skills-placement/box.js.map +1 -1
  196. package/dist/skills-placement/index.js +3 -4
  197. package/dist/spend/cli-args.d.ts +1 -1
  198. package/dist/spend/cli.js +3 -3
  199. package/dist/spend/cli.js.map +1 -1
  200. package/dist/spend/index.js +1 -1
  201. package/dist/stories/design-canvas/fixtures.d.ts +1 -14
  202. package/dist/stream/index.js +17 -17
  203. package/dist/studio/generation.d.ts +1 -1
  204. package/dist/studio/index.js +1 -1
  205. package/dist/studio-react/index.js +353 -184
  206. package/dist/studio-react/index.js.map +1 -1
  207. package/dist/studio-react/studio-composer.d.ts +1 -5
  208. package/dist/studio-react/studio-history-screen.d.ts +1 -1
  209. package/dist/teams/invitations-api.d.ts +3 -3
  210. package/dist/teams/invitations-api.js +74 -72
  211. package/dist/teams/invitations-api.js.map +1 -1
  212. package/dist/teams/member-sync.d.ts +2 -0
  213. package/dist/teams/members-api.d.ts +2 -2
  214. package/dist/teams/members-api.js +1 -1
  215. package/dist/teams-react/index.js +28 -45
  216. package/dist/teams-react/index.js.map +1 -1
  217. package/dist/tools/index.js +1 -1
  218. package/dist/tools/mcp-arguments.d.ts +1 -1
  219. package/dist/trace/index.d.ts +1 -18
  220. package/dist/trace/index.js +1 -36
  221. package/dist/trace/index.js.map +1 -1
  222. package/dist/trace/mission-flow.d.ts +1 -59
  223. package/dist/turn-health/index.d.ts +1 -1
  224. package/dist/turn-health/index.js +2 -2
  225. package/dist/turn-health/sink.d.ts +2 -1
  226. package/dist/turn-trace/index.js +2 -4
  227. package/dist/turn-trace/recorder.d.ts +0 -2
  228. package/dist/vault/VaultPane.d.ts +0 -20
  229. package/dist/vault/VaultPaneOperations.d.ts +318 -0
  230. package/dist/vault/index.js +2 -1
  231. package/dist/vault/index.js.map +1 -1
  232. package/dist/vault/lazy.js +1 -1
  233. package/dist/web-react/agent-profile-editor.d.ts +1 -2
  234. package/dist/web-react/agent-profile-editor.js +6 -5
  235. package/dist/web-react/chat-composer.d.ts +1 -1
  236. package/dist/web-react/durable-plan-flow.d.ts +6 -1
  237. package/dist/web-react/editor-glyphs.d.ts +12 -0
  238. package/dist/web-react/focus-navigation.d.ts +12 -0
  239. package/dist/web-react/history-controls.d.ts +37 -0
  240. package/dist/web-react/index.js +36 -34
  241. package/dist/web-react/interaction-question-card.d.ts +1 -1
  242. package/dist/web-react/record-grid-writes.d.ts +31 -0
  243. package/dist/web-react/record-grid.d.ts +1 -48
  244. package/dist/web-react/session-history-panel.d.ts +1 -9
  245. package/dist/web-react/use-document-dark.d.ts +1 -0
  246. package/dist/workspace-export/engine.d.ts +1 -6
  247. package/dist/workspace-export/index.js +198 -185
  248. package/dist/workspace-export/index.js.map +1 -1
  249. package/dist/workspace-export/routes.d.ts +1 -1
  250. package/dist/workspace-react/index.js +9 -8
  251. package/dist/workspace-react/index.js.map +1 -1
  252. package/package.json +7 -17
  253. package/dist/VaultPane-RXL3WLA2.js +0 -7
  254. package/dist/agent-profiles/reaper.d.ts +0 -31
  255. package/dist/agent-profiles/reaper.js +0 -29
  256. package/dist/agent-profiles/reaper.js.map +0 -1
  257. package/dist/chunk-4ZSLX3LY.js.map +0 -1
  258. package/dist/chunk-5IM2CLYX.js.map +0 -1
  259. package/dist/chunk-6OSJNJA2.js +0 -251
  260. package/dist/chunk-6OSJNJA2.js.map +0 -1
  261. package/dist/chunk-6PRQ45QE.js.map +0 -1
  262. package/dist/chunk-6ZIC6OG5.js.map +0 -1
  263. package/dist/chunk-BDEBQ4WO.js +0 -38
  264. package/dist/chunk-BDEBQ4WO.js.map +0 -1
  265. package/dist/chunk-BOQ4HVVH.js.map +0 -1
  266. package/dist/chunk-F2VX6TTJ.js.map +0 -1
  267. package/dist/chunk-FPNZMIAW.js.map +0 -1
  268. package/dist/chunk-HN6MZ2XL.js.map +0 -1
  269. package/dist/chunk-J2BBYVGF.js.map +0 -1
  270. package/dist/chunk-KJODHPWM.js.map +0 -1
  271. package/dist/chunk-LTWJYNEC.js +0 -100
  272. package/dist/chunk-LTWJYNEC.js.map +0 -1
  273. package/dist/chunk-LXYQOOXU.js.map +0 -1
  274. package/dist/chunk-MEKOWH5E.js.map +0 -1
  275. package/dist/chunk-NHYRIM4I.js.map +0 -1
  276. package/dist/chunk-NMZUW6VJ.js.map +0 -1
  277. package/dist/chunk-ORQD4AUO.js.map +0 -1
  278. package/dist/chunk-R4X5474U.js.map +0 -1
  279. package/dist/chunk-RL3Z747H.js.map +0 -1
  280. package/dist/chunk-TXUAGSFR.js.map +0 -1
  281. package/dist/chunk-UCCSJX64.js.map +0 -1
  282. package/dist/chunk-VJBFCNAU.js.map +0 -1
  283. package/dist/chunk-WSEXFTN4.js.map +0 -1
  284. package/dist/chunk-Y43PXON2.js.map +0 -1
  285. package/dist/chunk-ZBB5KQ6B.js.map +0 -1
  286. package/dist/eval/parity.d.ts +0 -74
  287. package/dist/mention-editor-B23OMFT2.js.map +0 -1
  288. package/dist/profile/humanizer-skill.d.ts +0 -23
  289. package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
  290. package/dist/sequences-react/components/BrandMark.d.ts +0 -10
  291. package/dist/skills/marketplace-drizzle.d.ts +0 -121
  292. package/dist/skills/marketplace-drizzle.js +0 -34
  293. package/dist/skills/marketplace-drizzle.js.map +0 -1
  294. package/dist/teams-react/components/BrandMark.d.ts +0 -10
  295. /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
  296. /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
  297. /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
  298. /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
  299. /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
  300. /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
  301. /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
  302. /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
  303. /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
  304. /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
  305. /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
  306. /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
  307. /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
  308. /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
@@ -1,11 +1,28 @@
1
1
  // src/peer-floors/check.ts
2
- import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync as readdirSync2 } from "fs";
3
- import { dirname as dirname2, join as join2 } from "path";
2
+ import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync as readdirSync3 } from "fs";
3
+ import { dirname as dirname2, join as join3 } from "path";
4
+
5
+ // src/peer-floors/source-entries.ts
6
+ import { readdirSync } from "fs";
7
+ import { join, relative, sep } from "path";
8
+ function sourceDirectoryEntries(dir, repoDir, exclude) {
9
+ let entries;
10
+ try {
11
+ entries = readdirSync(dir, { withFileTypes: true });
12
+ } catch {
13
+ return [];
14
+ }
15
+ return entries.flatMap((entry) => {
16
+ const full = join(dir, entry.name);
17
+ const rel = relative(repoDir, full).split(sep).join("/");
18
+ return exclude.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`)) ? [] : [{ entry, full, rel }];
19
+ });
20
+ }
4
21
 
5
22
  // src/peer-floors/dependency-source.ts
6
23
  import { createHash } from "crypto";
7
- import { existsSync, lstatSync, readFileSync, readdirSync, statSync } from "fs";
8
- import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "path";
24
+ import { existsSync, lstatSync, readFileSync, readdirSync as readdirSync2, statSync } from "fs";
25
+ import { basename, dirname, isAbsolute, join as join2, relative as relative2, resolve, sep as sep2 } from "path";
9
26
  var TARBALL = /\.(?:tgz|tar\.gz)$/i;
10
27
  function classifyDependencySpecifier(specifier) {
11
28
  const spec = specifier.trim();
@@ -30,8 +47,8 @@ function isReproducible(protocol) {
30
47
  function resolveLocalPathSource(args) {
31
48
  const root = resolve(args.repoDir);
32
49
  const target = isAbsolute(args.path) ? resolve(args.path) : resolve(args.fromDir, args.path);
33
- if (target !== root && !target.startsWith(root + sep)) return "outside-repo";
34
- const manifest = join(target, "package.json");
50
+ if (target !== root && !target.startsWith(root + sep2)) return "outside-repo";
51
+ const manifest = join2(target, "package.json");
35
52
  if (!existsSync(manifest) || !statSync(target).isDirectory()) return "not-a-directory";
36
53
  let declared;
37
54
  try {
@@ -57,16 +74,7 @@ var SKIP_DIRS = /* @__PURE__ */ new Set([
57
74
  "storybook-static"
58
75
  ]);
59
76
  function walkSourceTree(dir, repoDir, exclude, seen) {
60
- let entries;
61
- try {
62
- entries = readdirSync(dir, { withFileTypes: true });
63
- } catch {
64
- return;
65
- }
66
- for (const entry of entries) {
67
- const full = join(dir, entry.name);
68
- const rel = relative(repoDir, full).split(sep).join("/");
69
- if (exclude.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`))) continue;
77
+ for (const { entry, full } of sourceDirectoryEntries(dir, repoDir, exclude)) {
70
78
  if (entry.isDirectory()) {
71
79
  if (SKIP_DIRS.has(entry.name)) continue;
72
80
  walkSourceTree(full, repoDir, exclude, seen);
@@ -139,7 +147,7 @@ function scanManifest(file, repoDir) {
139
147
  return [];
140
148
  }
141
149
  const fromDir = dirname(file);
142
- const where = relative(repoDir, file).split(sep).join("/") || "package.json";
150
+ const where = relative2(repoDir, file).split(sep2).join("/") || "package.json";
143
151
  const findings = [];
144
152
  for (const field of DEP_FIELDS) {
145
153
  const block = manifest[field];
@@ -180,7 +188,7 @@ function overrideKeyName(key) {
180
188
  }
181
189
  function scanWorkspaceYaml(file, repoDir) {
182
190
  const findings = [];
183
- const where = relative(repoDir, file).split(sep).join("/");
191
+ const where = relative2(repoDir, file).split(sep2).join("/");
184
192
  for (const line of readYamlLines(readFileSync(file, "utf8"))) {
185
193
  const section = sectionOf(line);
186
194
  if (section !== "overrides" && section !== "catalog" && section !== "catalogs") continue;
@@ -199,7 +207,7 @@ function scanWorkspaceYaml(file, repoDir) {
199
207
  }
200
208
  function scanLockfile(file, repoDir) {
201
209
  const findings = [];
202
- const where = relative(repoDir, file).split(sep).join("/");
210
+ const where = relative2(repoDir, file).split(sep2).join("/");
203
211
  const fromDir = dirname(file);
204
212
  const seen = /* @__PURE__ */ new Set();
205
213
  const push = (finding) => {
@@ -255,16 +263,16 @@ function parsePackageKey(key) {
255
263
  return { name: withoutPeers.slice(0, at), reference: withoutPeers.slice(at + 1) };
256
264
  }
257
265
  function scanVirtualStore(repoDir, modulesDir) {
258
- const store = join(repoDir, modulesDir, ".pnpm");
266
+ const store = join2(repoDir, modulesDir, ".pnpm");
259
267
  if (!existsSync(store)) return [];
260
268
  const findings = [];
261
- for (const entry of readdirSync(store, { withFileTypes: true })) {
269
+ for (const entry of readdirSync2(store, { withFileTypes: true })) {
262
270
  if (!entry.isDirectory() || entry.name === modulesDir) continue;
263
271
  const protocolMatch = /^(file|link|portal|git|https?)\+/.exec(entry.name);
264
272
  if (!protocolMatch) continue;
265
273
  const protocol = protocolMatch[1];
266
274
  const encoded = entry.name.slice(protocol.length + 1);
267
- const name = installedPackageName(join(store, entry.name), modulesDir);
275
+ const name = installedPackageName(join2(store, entry.name), modulesDir);
268
276
  const where = `${modulesDir}/.pnpm/${entry.name}`;
269
277
  if (protocol === "file" || protocol === "link" || protocol === "portal") {
270
278
  const path = encoded.split("+").join("/");
@@ -293,25 +301,25 @@ function scanVirtualStore(repoDir, modulesDir) {
293
301
  return findings;
294
302
  }
295
303
  function installedPackageName(entryDir, modulesDir) {
296
- const nested = join(entryDir, modulesDir);
304
+ const nested = join2(entryDir, modulesDir);
297
305
  if (!existsSync(nested)) return null;
298
- for (const child of readdirSync(nested, { withFileTypes: true })) {
306
+ for (const child of readdirSync2(nested, { withFileTypes: true })) {
299
307
  if (child.name === ".bin" || child.isSymbolicLink()) continue;
300
308
  if (!child.isDirectory()) continue;
301
309
  if (child.name.startsWith("@")) {
302
- const scopeDir = join(nested, child.name);
303
- for (const scoped of readdirSync(scopeDir, { withFileTypes: true })) {
310
+ const scopeDir = join2(nested, child.name);
311
+ for (const scoped of readdirSync2(scopeDir, { withFileTypes: true })) {
304
312
  if (scoped.isSymbolicLink() || !scoped.isDirectory()) continue;
305
- if (existsSync(join(scopeDir, scoped.name, "package.json"))) return `${child.name}/${scoped.name}`;
313
+ if (existsSync(join2(scopeDir, scoped.name, "package.json"))) return `${child.name}/${scoped.name}`;
306
314
  }
307
315
  continue;
308
316
  }
309
- if (existsSync(join(nested, child.name, "package.json"))) return child.name;
317
+ if (existsSync(join2(nested, child.name, "package.json"))) return child.name;
310
318
  }
311
319
  return null;
312
320
  }
313
321
  function locateStoreCas(repoDir, modulesDir) {
314
- const modulesState = join(repoDir, modulesDir, ".modules.yaml");
322
+ const modulesState = join2(repoDir, modulesDir, ".modules.yaml");
315
323
  if (!existsSync(modulesState)) return [];
316
324
  let configured;
317
325
  try {
@@ -325,24 +333,24 @@ function locateStoreCas(repoDir, modulesDir) {
325
333
  const candidates = /* @__PURE__ */ new Set([root, dirname(root)]);
326
334
  for (const base of [root, dirname(root)]) {
327
335
  try {
328
- for (const entry of readdirSync(base, { withFileTypes: true })) {
329
- if (entry.isDirectory() && /^v\d+$/.test(entry.name)) candidates.add(join(base, entry.name));
336
+ for (const entry of readdirSync2(base, { withFileTypes: true })) {
337
+ if (entry.isDirectory() && /^v\d+$/.test(entry.name)) candidates.add(join2(base, entry.name));
330
338
  }
331
339
  } catch {
332
340
  }
333
341
  }
334
- return [...candidates].map((dir) => join(dir, "files")).filter((dir) => existsSync(dir));
342
+ return [...candidates].map((dir) => join2(dir, "files")).filter((dir) => existsSync(dir));
335
343
  }
336
344
  function collectFiles(dir, modulesDir, out = []) {
337
345
  let entries;
338
346
  try {
339
- entries = readdirSync(dir, { withFileTypes: true });
347
+ entries = readdirSync2(dir, { withFileTypes: true });
340
348
  } catch {
341
349
  return out;
342
350
  }
343
351
  for (const entry of entries) {
344
352
  if (entry.name === modulesDir) continue;
345
- const full = join(dir, entry.name);
353
+ const full = join2(dir, entry.name);
346
354
  if (entry.isSymbolicLink()) continue;
347
355
  if (entry.isDirectory()) collectFiles(full, modulesDir, out);
348
356
  else if (entry.isFile()) out.push(full);
@@ -351,23 +359,23 @@ function collectFiles(dir, modulesDir, out = []) {
351
359
  }
352
360
  function storeHolds(casDirs, bytes) {
353
361
  const hex = createHash("sha512").update(bytes).digest("hex");
354
- const tail = join(hex.slice(0, 2), hex.slice(2));
355
- return casDirs.some((dir) => existsSync(join(dir, tail)) || existsSync(join(dir, `${tail}-exec`)));
362
+ const tail = join2(hex.slice(0, 2), hex.slice(2));
363
+ return casDirs.some((dir) => existsSync(join2(dir, tail)) || existsSync(join2(dir, `${tail}-exec`)));
356
364
  }
357
365
  function checkInstalledIntegrity(args) {
358
- const virtualStore = join(args.repoDir, args.modulesDir, ".pnpm");
366
+ const virtualStore = join2(args.repoDir, args.modulesDir, ".pnpm");
359
367
  const casDirs = locateStoreCas(args.repoDir, args.modulesDir);
360
368
  const findings = [];
361
369
  let packagesExamined = 0;
362
370
  let filesExamined = 0;
363
371
  let filesHashed = 0;
364
372
  if (casDirs.length > 0 && existsSync(virtualStore)) {
365
- for (const entry of readdirSync(virtualStore, { withFileTypes: true })) {
373
+ for (const entry of readdirSync2(virtualStore, { withFileTypes: true })) {
366
374
  if (!entry.isDirectory() || entry.name === args.modulesDir) continue;
367
- const entryDir = join(virtualStore, entry.name);
375
+ const entryDir = join2(virtualStore, entry.name);
368
376
  const name = installedPackageName(entryDir, args.modulesDir);
369
377
  if (!name || !name.startsWith(args.scope)) continue;
370
- const packageDir = join(entryDir, args.modulesDir, name);
378
+ const packageDir = join2(entryDir, args.modulesDir, name);
371
379
  if (!existsSync(packageDir)) continue;
372
380
  const files = collectFiles(packageDir, args.modulesDir);
373
381
  if (files.length === 0) continue;
@@ -379,7 +387,7 @@ function checkInstalledIntegrity(args) {
379
387
  if (lstatSync(file).nlink > 1) continue;
380
388
  filesHashed += 1;
381
389
  if (storeHolds(casDirs, readFileSync(file))) continue;
382
- foreign.push(relative(packageDir, file).split(sep).join("/"));
390
+ foreign.push(relative2(packageDir, file).split(sep2).join("/"));
383
391
  } catch {
384
392
  }
385
393
  }
@@ -413,9 +421,9 @@ function checkDependencySources(options) {
413
421
  walkSourceTree(repoDir, repoDir, exclude, seen);
414
422
  const findings = [];
415
423
  for (const manifest of seen.manifests) findings.push(...scanManifest(manifest, repoDir));
416
- const workspaceYaml = join(repoDir, "pnpm-workspace.yaml");
424
+ const workspaceYaml = join2(repoDir, "pnpm-workspace.yaml");
417
425
  if (existsSync(workspaceYaml)) findings.push(...scanWorkspaceYaml(workspaceYaml, repoDir));
418
- const lockfile = join(repoDir, "pnpm-lock.yaml");
426
+ const lockfile = join2(repoDir, "pnpm-lock.yaml");
419
427
  const lockfileScanned = existsSync(lockfile);
420
428
  if (lockfileScanned) findings.push(...scanLockfile(lockfile, repoDir));
421
429
  for (const tarball of seen.tarballs) {
@@ -424,7 +432,7 @@ function checkDependencySources(options) {
424
432
  name: null,
425
433
  specifier: null,
426
434
  protocol: "tarball",
427
- where: relative(repoDir, tarball).split(sep).join("/"),
435
+ where: relative2(repoDir, tarball).split(sep2).join("/"),
428
436
  detail: `is a PACKED TARBALL committed into the source tree. Even when nothing points at it today, it is a build nobody can reproduce from the registry sitting one \`file:\` line away from shipping. Delete it; if ${basename(tarball)} is genuinely test data, move it under a path passed to \`--exclude\`.`
429
437
  });
430
438
  }
@@ -476,22 +484,22 @@ function formatDependencySourceReport(report) {
476
484
 
477
485
  // src/peer-floors/check.ts
478
486
  function installedPackageNames(appDir, modulesDir, scope) {
479
- const modulesRoot = join2(appDir, modulesDir);
487
+ const modulesRoot = join3(appDir, modulesDir);
480
488
  if (!existsSync2(modulesRoot)) return [];
481
489
  if (scope !== "") {
482
- const scopeDir = join2(modulesRoot, scope.slice(0, -1));
483
- return existsSync2(scopeDir) ? readdirSync2(scopeDir).sort().map((name) => `${scope}${name}`) : [];
490
+ const scopeDir = join3(modulesRoot, scope.slice(0, -1));
491
+ return existsSync2(scopeDir) ? readdirSync3(scopeDir).sort().map((name) => `${scope}${name}`) : [];
484
492
  }
485
- return readdirSync2(modulesRoot).filter((name) => !name.startsWith(".")).flatMap((name) => name.startsWith("@") ? readdirSync2(join2(modulesRoot, name)).map((child) => `${name}/${child}`) : [name]).sort();
493
+ return readdirSync3(modulesRoot).filter((name) => !name.startsWith(".")).flatMap((name) => name.startsWith("@") ? readdirSync3(join3(modulesRoot, name)).map((child) => `${name}/${child}`) : [name]).sort();
486
494
  }
487
495
  function readInstalledManifest(name, fromDir, modulesDir) {
488
496
  let dir = fromDir;
489
497
  for (; ; ) {
490
- const manifest = join2(dir, modulesDir, name, "package.json");
498
+ const manifest = join3(dir, modulesDir, name, "package.json");
491
499
  if (existsSync2(manifest)) {
492
500
  return JSON.parse(readFileSync2(manifest, "utf8"));
493
501
  }
494
- if (existsSync2(join2(dir, ".git"))) return null;
502
+ if (existsSync2(join3(dir, ".git"))) return null;
495
503
  const parent = dirname2(dir);
496
504
  if (parent === dir) return null;
497
505
  dir = parent;
@@ -559,7 +567,7 @@ function checkPeerFloors(options) {
559
567
  } = options;
560
568
  const shellManifest = options.shellManifest ?? readInstalledManifest(shell, appDir, modulesDir);
561
569
  if (!shellManifest) throw new Error(`${shell} is not installed under ${appDir}`);
562
- const appManifest = JSON.parse(readFileSync2(join2(appDir, "package.json"), "utf8"));
570
+ const appManifest = JSON.parse(readFileSync2(join3(appDir, "package.json"), "utf8"));
563
571
  const declared = {
564
572
  ...appManifest.dependencies,
565
573
  ...appManifest.devDependencies,
@@ -628,6 +636,7 @@ function formatPeerFloorReport(report, shell = report.shell) {
628
636
  }
629
637
 
630
638
  export {
639
+ sourceDirectoryEntries,
631
640
  classifyDependencySpecifier,
632
641
  resolveLocalPathSource,
633
642
  checkInstalledIntegrity,
@@ -640,4 +649,4 @@ export {
640
649
  describePeerFloorViolation,
641
650
  formatPeerFloorReport
642
651
  };
643
- //# sourceMappingURL=chunk-BOQ4HVVH.js.map
652
+ //# sourceMappingURL=chunk-7ISHKBAD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/peer-floors/check.ts","../src/peer-floors/source-entries.ts","../src/peer-floors/dependency-source.ts"],"sourcesContent":["import { existsSync, readFileSync, readdirSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\n\n/**\n * The second half of this gate lives in `./dependency-source` and ships on the\n * SAME subpath and the SAME `agent-app-peer-check` bin, because it answers the\n * question underneath this one: a floor comparison reads a version, and a\n * version is not an identity — a vendored `pnpm pack` of an unmerged branch\n * carries the same `0.45.33` a real release does.\n */\nexport * from './dependency-source'\n\n/**\n * Audit a consumer's installed tree against the peer floors this package\n * declares.\n *\n * A peer floor is not documentation — it encodes a WIRE CONTRACT, and breaking\n * one is invisible to every other gate. `pnpm` only WARNS on an unmet peer when\n * the package is also a direct dependency, and says nothing at all for an unmet\n * OPTIONAL peer, which is how most of the substrate is declared here. So a\n * product can sit below a floor with a clean install, a clean typecheck, a green\n * suite and a successful deploy, and fail only on a live wire call:\n *\n * `@tangle-network/sandbox` 0.15.0 → 0.15.1 changed the sidecar spawn body\n * from `{ command }` to `{ executable, args }`. Below the floor, every\n * `box.exec()` on a live sandbox returns 400 `Unrecognized key: \"command\"`.\n *\n * `@tangle-network/agent-interface` 0.38.0 changed MCP config values from\n * plain strings to tagged public/secret-ref objects. Below the floor, this\n * package fails at MODULE LOAD with \"does not provide an export named\n * defineAgentProfilePublicConfig\" — while `tsc` reports zero errors, because\n * the types resolve and only the runtime export is missing.\n *\n * That second shape is why this exists as its own gate: typecheck cannot see it,\n * and a suite only sees it as dozens of unrelated-looking import failures.\n */\n\n/** Installed, and inside the declared range. */\nexport type PeerFloorVerdict =\n | 'satisfied'\n /** Installed and BELOW the floor — the silent case this module exists for. */\n | 'below-floor'\n /** Not installed and never asked for. A legitimate answer for an optional peer. */\n | 'absent-unused'\n /** Declared by the app, yet no version could be read, so the floor went\n * UNCHECKED. Reported as a failure rather than a pass this did not earn. */\n | 'absent-but-declared'\n\nexport interface PeerFloorRow {\n readonly name: string\n readonly range: string\n readonly installed: string | null\n readonly verdict: PeerFloorVerdict\n}\n\nexport interface PeerFloorReport {\n readonly shell: string\n readonly shellVersion: string\n readonly rows: readonly PeerFloorRow[]\n readonly violations: readonly PeerFloorRow[]\n readonly ok: boolean\n}\n\nexport interface CheckPeerFloorsOptions {\n /** Directory of the app under audit — the one whose `package.json` and\n * installed tree are read. */\n appDir: string\n /** Package whose peer floors are the contract. Defaults to this shell. */\n shell?: string\n /** Only audit peers under this scope. Third-party peers (react, drizzle) are\n * the app's own business, not part of the Tangle wire contract. Pass `''` to\n * audit every peer. */\n scope?: string\n /** Floors to audit against, when the shell is not resolvable from `appDir` —\n * the package auditing ITSELF, which has no copy of itself in its own\n * `node_modules`. Without this a package cannot check that the contract it\n * publishes is one its own dev install satisfies. */\n shellManifest?: { version?: string; peerDependencies?: Record<string, string> }\n /** Directory name to walk for installed packages. Overridable so a test can\n * point at a committed fixture tree — `node_modules` is gitignored\n * everywhere, so a fixture using that name could not be committed, and a\n * calibration proof that is not committed is a proof that stops running. */\n modulesDir?: string\n}\n\nexport type CheckAllPeerFloorsOptions = Pick<\n CheckPeerFloorsOptions,\n 'appDir' | 'modulesDir' | 'scope'\n>\n\nfunction installedPackageNames(\n appDir: string,\n modulesDir: string,\n scope: string,\n): readonly string[] {\n const modulesRoot = join(appDir, modulesDir)\n if (!existsSync(modulesRoot)) return []\n if (scope !== '') {\n const scopeDir = join(modulesRoot, scope.slice(0, -1))\n return existsSync(scopeDir)\n ? readdirSync(scopeDir).sort().map((name) => `${scope}${name}`)\n : []\n }\n\n return readdirSync(modulesRoot)\n .filter((name) => !name.startsWith('.'))\n .flatMap((name) => name.startsWith('@')\n ? readdirSync(join(modulesRoot, name)).map((child) => `${name}/${child}`)\n : [name])\n .sort()\n}\n\n/**\n * Read a package's manifest off disk, walking `modulesDir` up from `fromDir`.\n *\n * Deliberately NOT `require.resolve('<name>/package.json')`: most of these\n * packages omit `./package.json` from their `exports` map, so that throws\n * ERR_PACKAGE_PATH_NOT_EXPORTED — and a try/catch around it reports an INSTALLED\n * package as absent, turning the whole audit into a silent no-op. Walking the\n * tree is exports-map-independent and mirrors Node's own resolution order, so\n * the version reported is the version that would actually load.\n *\n * The walk STOPS at the repository root — a directory containing `.git` — and\n * never climbs past it. Node itself would keep going, but a `node_modules`\n * above a checkout belongs to something else entirely, and letting it answer\n * silently changes the verdict: a stray `/tmp/node_modules` shadowing one\n * package produced a confident FAIL for a repo that was above every floor. A\n * check that reports the wrong tree is worse than no check.\n *\n * Returns null only when no directory for the package exists inside the repo,\n * which is the genuine not-installed case.\n */\nfunction readInstalledManifest(\n name: string,\n fromDir: string,\n modulesDir: string,\n): { version?: string; peerDependencies?: Record<string, string> } | null {\n let dir = fromDir\n for (;;) {\n const manifest = join(dir, modulesDir, name, 'package.json')\n if (existsSync(manifest)) {\n return JSON.parse(readFileSync(manifest, 'utf8')) as {\n version?: string\n peerDependencies?: Record<string, string>\n }\n }\n // Repo boundary: stop here rather than inheriting an unrelated tree.\n if (existsSync(join(dir, '.git'))) return null\n const parent = dirname(dir)\n if (parent === dir) return null\n dir = parent\n }\n}\n\n/**\n * Minimal range satisfaction for the ranges peer floors actually use:\n * `>=x <y`, `^x.y.z`, `~x.y.z`, `x.y.z`, and `*`/`x`.\n *\n * Hand-rolled rather than taking a `semver` dependency, because this package\n * ships zero runtime dependencies and a checker that forces one on every\n * consumer is a worse trade than 40 lines of comparison. Prerelease versions\n * compare by their release part — a floor is about the wire contract, and a\n * prerelease of a satisfying version speaks it.\n */\nfunction parseVersion(version: string): [number, number, number] {\n const [core] = version.split(/[-+]/)\n const parts = (core ?? '').split('.').map((p) => Number.parseInt(p, 10))\n return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0]\n}\n\nfunction compare(a: string, b: string): number {\n const va = parseVersion(a)\n const vb = parseVersion(b)\n for (let i = 0; i < 3; i += 1) {\n if (va[i]! !== vb[i]!) return va[i]! < vb[i]! ? -1 : 1\n }\n return 0\n}\n\nfunction satisfiesComparator(version: string, comparator: string): boolean {\n const trimmed = comparator.trim()\n if (!trimmed || trimmed === '*' || trimmed === 'x') return true\n const match = /^(>=|<=|>|<|=|\\^|~)?\\s*v?(.+)$/.exec(trimmed)\n if (!match) return false\n const [, op = '=', target = ''] = match\n const cmp = compare(version, target)\n switch (op) {\n case '>=': return cmp >= 0\n case '<=': return cmp <= 0\n case '>': return cmp > 0\n case '<': return cmp < 0\n case '=': return cmp === 0\n case '~': {\n // ~1.2.3 allows patch bumps; ~1.2 allows minor.\n const [major, minor] = parseVersion(target)\n const [vMajor, vMinor] = parseVersion(version)\n return cmp >= 0 && vMajor === major && vMinor === minor\n }\n case '^': {\n // A caret on a 0.x version is MINOR-locked: ^0.36.0 can never resolve to\n // 0.38.0. That is the single most common reason a floor cannot be met by\n // reinstalling, so it is modelled exactly rather than approximated.\n const [major, minor] = parseVersion(target)\n const [vMajor, vMinor] = parseVersion(version)\n if (cmp < 0) return false\n if (major > 0) return vMajor === major\n if (minor > 0) return vMajor === 0 && vMinor === minor\n return vMajor === 0 && vMinor === 0\n }\n default: return false\n }\n}\n\nexport function satisfiesRange(version: string, range: string): boolean {\n // `||` is alternation; whitespace inside an alternative is conjunction.\n return range.split('||').some((alternative) =>\n alternative.trim().split(/\\s+/).filter(Boolean).every((c) => satisfiesComparator(version, c)),\n )\n}\n\n/** Audit one app directory against the shell's declared peer floors. */\nexport function checkPeerFloors(options: CheckPeerFloorsOptions): PeerFloorReport {\n const {\n appDir,\n shell = '@tangle-network/agent-app',\n scope = '@tangle-network/',\n modulesDir = 'node_modules',\n } = options\n\n const shellManifest = options.shellManifest ?? readInstalledManifest(shell, appDir, modulesDir)\n if (!shellManifest) throw new Error(`${shell} is not installed under ${appDir}`)\n\n const appManifest = JSON.parse(readFileSync(join(appDir, 'package.json'), 'utf8')) as {\n dependencies?: Record<string, string>\n devDependencies?: Record<string, string>\n optionalDependencies?: Record<string, string>\n }\n const declared = {\n ...appManifest.dependencies,\n ...appManifest.devDependencies,\n ...appManifest.optionalDependencies,\n }\n\n const floors = Object.entries(shellManifest.peerDependencies ?? {})\n .filter(([name]) => name.startsWith(scope))\n\n const rows = floors.map(([name, range]): PeerFloorRow => {\n const installed = readInstalledManifest(name, appDir, modulesDir)?.version ?? null\n if (installed === null) {\n return { name, range, installed, verdict: declared[name] ? 'absent-but-declared' : 'absent-unused' }\n }\n return {\n name,\n range,\n installed,\n verdict: satisfiesRange(installed, range) ? 'satisfied' : 'below-floor',\n }\n })\n\n const violations = rows.filter((row) => row.verdict === 'below-floor' || row.verdict === 'absent-but-declared')\n return {\n shell,\n shellVersion: shellManifest.version ?? 'unknown',\n rows,\n violations,\n ok: violations.length === 0,\n }\n}\n\n/** Audit every installed package in `scope` that constrains another package in\n * that scope. This is the complete stack check the CLI runs for consumers. */\nexport function checkAllPeerFloors(options: CheckAllPeerFloorsOptions): readonly PeerFloorReport[] {\n const {\n appDir,\n modulesDir = 'node_modules',\n scope = '@tangle-network/',\n } = options\n const normalizedScope = scope === '' ? '' : scope.endsWith('/') ? scope : `${scope}/`\n const shells = installedPackageNames(appDir, modulesDir, normalizedScope)\n .filter((name) => {\n const manifest = readInstalledManifest(name, appDir, modulesDir)\n return Object.keys(manifest?.peerDependencies ?? {})\n .some((peer) => peer.startsWith(normalizedScope))\n })\n\n if (shells.length === 0) {\n const label = normalizedScope || 'package'\n throw new Error(`no installed ${label} package declares a ${label} peer under ${appDir}`)\n }\n\n return shells.map((shell) => checkPeerFloors({\n appDir,\n modulesDir,\n scope: normalizedScope,\n shell,\n }))\n}\n\n/** The failure message for one violating row. Split out so a caller can raise\n * it from a test and a CLI can print it identically. */\nexport function describePeerFloorViolation(row: PeerFloorRow, shellVersion: string, shell = '@tangle-network/agent-app'): string {\n if (row.verdict === 'below-floor') {\n return `PEER FLOOR VIOLATED: ${shell}@${shellVersion} requires ${row.name}@${row.range}, `\n + `but ${row.installed} is installed. A peer floor encodes a wire contract — bump the `\n + `dependency, do not widen the floor. A caret on a 0.x version is minor-locked `\n + `(^0.36.0 can never resolve to 0.38.0), so reinstalling alone will not fix this: `\n + `change the pin, in EVERY place it appears including pnpm.overrides.`\n }\n return `${row.name} is a declared dependency of this app, but no installed version could be `\n + `read, so its peer floor ${row.range} went UNCHECKED. Failing loudly rather than `\n + `reporting a pass this guard did not earn.`\n}\n\nexport function formatPeerFloorReport(report: PeerFloorReport, shell = report.shell): string {\n const width = Math.max(...report.rows.map((r) => r.name.length), 4)\n const lines = [\n `${shell}@${report.shellVersion} — peer floors`,\n '',\n ...report.rows.map((row) =>\n ` ${row.verdict === 'satisfied' ? 'ok ' : row.verdict.startsWith('absent') ? '-- ' : 'FAIL'} `\n + `${row.name.padEnd(width)} installed ${(row.installed ?? '(none)').padEnd(10)} floor ${row.range}`),\n '',\n report.ok\n ? `all ${report.rows.length} floors satisfied`\n : report.violations.map((row) => describePeerFloorViolation(row, report.shellVersion, shell)).join('\\n\\n'),\n ]\n return lines.join('\\n')\n}\n","import { readdirSync } from 'node:fs'\nimport { join, relative, sep } from 'node:path'\n\n/** Read one source directory, applying only shared path-boundary exclusions. Callers retain their own file and directory policy. */\nexport function sourceDirectoryEntries(dir: string, repoDir: string, exclude: readonly string[]) {\n let entries: import('node:fs').Dirent[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return []\n }\n return entries.flatMap(entry => {\n const full = join(dir, entry.name)\n const rel = relative(repoDir, full).split(sep).join('/')\n return exclude.some(prefix => rel === prefix || rel.startsWith(`${prefix}/`)) ? [] : [{ entry, full, rel }]\n })\n}\n","import { sourceDirectoryEntries } from './source-entries'\nimport { createHash } from 'node:crypto'\nimport { existsSync, lstatSync, readFileSync, readdirSync, statSync } from 'node:fs'\nimport { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path'\n\n/**\n * Audit where a repository's dependencies COME FROM.\n *\n * `/peer-floors` already answers \"is the installed version inside the declared\n * range\". This answers the question underneath it — \"is the installed package\n * the one the registry publishes at all\" — because a version number is not an\n * identity. Two artifacts can carry `0.45.33` and ship different APIs, and every\n * gate that reads a version reads the same number for both.\n *\n * THE MEASURED DEFECT. insurance-agent's `pnpm-workspace.yaml` carried\n *\n * overrides:\n * '@tangle-network/agent-app': file:./vendor/agent-app/tangle-network-agent-app-0.45.33.tgz\n *\n * — a 2.6 MB `pnpm pack` of an UNMERGED pull request, committed into the\n * product repo (`insurance-agent` f7d0f51 removed it). It installed cleanly,\n * typechecked green and passed sign-off while the product ran code that existed\n * in no published release. Note where it was NOT: `package.json` still read\n * `\"@tangle-network/agent-app\": \"^0.45.33\"`, a perfectly ordinary registry\n * range. A check that reads only the root manifest's `dependencies` sees\n * nothing. The override lane is the one that shipped, so the override lane —\n * `pnpm-workspace.yaml`, `pnpm.overrides`, `resolutions` — is audited first.\n *\n * The second shape is worse because nothing declares it at all: a worktree was\n * found whose installed `agent-app@0.45.29` had `dist/spend/index.d.ts`\n * replaced with a newer version's content by hand. The manifest, the lockfile\n * and the version on disk all agreed; only the bytes disagreed, and the product\n * typechecked green against an API its declared dependency does not ship. See\n * `checkInstalledIntegrity` below for exactly how much of that class is\n * catchable cheaply and exactly how much is not.\n */\n\n/** How a specifier says a dependency should be obtained. */\nexport type DependencySourceProtocol =\n /** Resolvable from the registry by anyone: `^1.2.3`, `1.2.3`, `npm:x@1`. */\n | 'registry'\n /** `workspace:` — another package in this same repo. Reviewable in one diff. */\n | 'workspace'\n /** `catalog:` — indirection into `pnpm-workspace.yaml`, which is itself audited. */\n | 'catalog'\n /** A local path. Whether it is legitimate depends on WHERE it points. */\n | 'file'\n | 'link'\n | 'portal'\n /** A path or URL ending in a packed tarball. Opaque bytes; never legitimate. */\n | 'tarball'\n /** A git ref or a remote URL that is not the registry. */\n | 'git'\n | 'remote'\n\nconst TARBALL = /\\.(?:tgz|tar\\.gz)$/i\n\n/**\n * Classify one dependency specifier by the SOURCE it names.\n *\n * Pure and exported so a consumer can reuse the vocabulary, and so the rule can\n * be tested without a filesystem. Nothing here decides legitimacy — `file:` on\n * a directory inside the repo is correct and `file:` on a tarball never is, and\n * that distinction needs the disk (`resolveLocalPathSource`).\n */\nexport function classifyDependencySpecifier(specifier: string): DependencySourceProtocol {\n const spec = specifier.trim()\n if (spec.startsWith('workspace:')) return 'workspace'\n if (spec.startsWith('catalog:')) return 'catalog'\n for (const protocol of ['file:', 'link:', 'portal:'] as const) {\n if (spec.startsWith(protocol)) {\n const path = spec.slice(protocol.length)\n if (TARBALL.test(path)) return 'tarball'\n return protocol.slice(0, -1) as 'file' | 'link' | 'portal'\n }\n }\n if (/^(?:git|git\\+ssh|git\\+https?|git\\+file|ssh):/.test(spec)) return 'git'\n if (/^(?:github|gitlab|bitbucket):/.test(spec)) return 'git'\n if (/^https?:\\/\\//.test(spec)) return TARBALL.test(spec.split(/[?#]/)[0] ?? '') ? 'tarball' : 'remote'\n // `owner/repo` and `owner/repo#ref` are npm's GitHub shorthand. A scoped\n // package name (`@scope/name`) also contains a slash, hence the leading-@ guard.\n if (/^[\\w.-]+\\/[\\w.-]+(?:#.+)?$/.test(spec) && !spec.startsWith('@')) return 'git'\n return 'registry'\n}\n\n/** A protocol that resolves from the registry, or from this repo's own sources. */\nfunction isReproducible(protocol: DependencySourceProtocol): boolean {\n return protocol === 'registry' || protocol === 'workspace' || protocol === 'catalog'\n}\n\n/**\n * The legitimate-exception rule, stated once so it is not a path allowlist.\n *\n * agent-app's own `playground/package.json` declares\n * `\"@tangle-network/agent-app\": \"file:..\"` and that is CORRECT: the playground\n * depends on the package it lives inside. The property that makes it correct is\n * not its path — it is that the dependency is satisfied by SOURCE ALREADY IN\n * THIS REPOSITORY, under version control, changing only in a diff a reviewer\n * sees. So the rule is:\n *\n * A `file:` / `link:` / `portal:` specifier is exempt when it resolves to a\n * DIRECTORY inside this repository holding a `package.json` whose `name` is\n * the dependency being declared.\n *\n * Every clause is load-bearing. A DIRECTORY, because a `.tgz` is opaque bytes\n * that no diff shows — a packed tarball is never exempt, wherever it sits.\n * INSIDE THIS REPOSITORY, because `file:../../agent-app` is a path on one\n * machine: it resolves for its author and for nobody else, and a sign-off gate\n * that installs into a clean export dies at install. NAME MATCHES, because a\n * path pointing at some other package's source is a mis-wire, not a\n * self-reference.\n */\nexport type LocalPathSource =\n /** In-repo directory whose package.json names this dependency. Legitimate. */\n | 'in-repo-source'\n /** Points outside the repository — reproducible on one machine only. */\n | 'outside-repo'\n /** Nothing there, or not a directory (a packed tarball lands here too). */\n | 'not-a-directory'\n /** An in-repo directory, but it is a different package. */\n | 'name-mismatch'\n\nexport function resolveLocalPathSource(args: {\n /** Directory of the manifest that made the declaration. */\n fromDir: string\n /** Root of the repository the declaration must stay inside. */\n repoDir: string\n /** The path part of the specifier, protocol already stripped. */\n path: string\n /** The dependency name the path is claimed to satisfy. */\n name: string\n}): LocalPathSource {\n const root = resolve(args.repoDir)\n const target = isAbsolute(args.path) ? resolve(args.path) : resolve(args.fromDir, args.path)\n if (target !== root && !target.startsWith(root + sep)) return 'outside-repo'\n const manifest = join(target, 'package.json')\n if (!existsSync(manifest) || !statSync(target).isDirectory()) return 'not-a-directory'\n let declared: string | undefined\n try {\n declared = (JSON.parse(readFileSync(manifest, 'utf8')) as { name?: string }).name\n } catch {\n return 'not-a-directory'\n }\n return declared === args.name ? 'in-repo-source' : 'name-mismatch'\n}\n\n/** Which of the five scans produced a finding. Kept on the row because the fix\n * differs: a declaration is edited, an installed tree is reinstalled. */\nexport type DependencySourceCheck =\n /** A `dependencies`-family field in some `package.json`. */\n | 'declared'\n /** `pnpm.overrides` / `resolutions` / `pnpm-workspace.yaml` — the lane that shipped. */\n | 'override'\n /** `pnpm-lock.yaml` — what actually resolved, whatever the manifests now say. */\n | 'lockfile'\n /** A packed tarball sitting in the source tree. */\n | 'vendored-tarball'\n /** The installed tree on disk. */\n | 'installed'\n\nexport interface DependencySourceFinding {\n readonly check: DependencySourceCheck\n /** Dependency name, or `null` for a stray tarball that names no dependency. */\n readonly name: string | null\n readonly specifier: string | null\n readonly protocol: DependencySourceProtocol | null\n /** Repo-relative location, with the key or line that carries it. */\n readonly where: string\n /** Why this is a finding, and what to do about it. */\n readonly detail: string\n}\n\n/**\n * What the on-disk integrity pass was able to examine — reported on EVERY run,\n * clean or not, because \"checked nothing\" and \"checked everything and found\n * nothing\" render identically otherwise. This module's own doctrine: an\n * unchecked contract is never a pass it did not earn.\n */\nexport interface InstalledIntegrityCoverage {\n /** The only basis implemented. See `checkInstalledIntegrity`'s limits. */\n readonly basis: 'store-cas'\n /** False for npm, yarn, a pruned CI cache, or a store on another machine.\n * Nothing was verified, and the report says so rather than reading clean. */\n readonly storeLocated: boolean\n readonly packagesExamined: number\n readonly filesExamined: number\n /** Files settled by reading their bytes rather than by a shared inode. */\n readonly filesHashed: number\n}\n\nexport interface DependencySourceReport {\n readonly repoDir: string\n readonly manifestsScanned: number\n readonly lockfileScanned: boolean\n readonly integrity: InstalledIntegrityCoverage\n readonly findings: readonly DependencySourceFinding[]\n readonly ok: boolean\n}\n\nexport interface CheckDependencySourcesOptions {\n /** Repository root to audit. */\n repoDir: string\n /** Scope filter for the on-disk integrity pass. `''` examines every package. */\n scope?: string\n /** Directory name holding the installed tree. Overridable so a committed\n * fixture can use `fixture_modules` — `node_modules` is gitignored\n * everywhere, and a calibration proof that is not committed stops running. */\n modulesDir?: string\n /** Repo-relative path prefixes the source-tree walk skips. The escape hatch\n * for a repo that genuinely carries a tarball as test data — and for this\n * package's own calibration fixtures, whose purpose is to CONTAIN the\n * violation. */\n exclude?: readonly string[]\n}\n\n/** Directories a source-tree walk must never descend into: build output and\n * installed packages are not declarations, and walking them turns a\n * sub-second scan into a minute. */\nconst SKIP_DIRS = new Set([\n 'node_modules', '.git', 'dist', 'build', 'out', 'coverage',\n '.wrangler', '.react-router', '.next', '.turbo', '.cache', '.worktrees', 'storybook-static',\n])\n\nfunction walkSourceTree(\n dir: string,\n repoDir: string,\n exclude: readonly string[],\n seen: { manifests: string[]; tarballs: string[] },\n): void {\n for (const { entry, full } of sourceDirectoryEntries(dir, repoDir, exclude)) {\n if (entry.isDirectory()) {\n if (SKIP_DIRS.has(entry.name)) continue\n walkSourceTree(full, repoDir, exclude, seen)\n } else if (entry.isFile()) {\n if (entry.name === 'package.json') seen.manifests.push(full)\n else if (TARBALL.test(entry.name)) seen.tarballs.push(full)\n }\n\n }\n}\n\n/* ---------------------------------------------------------------------------\n * A line reader for the two YAML files that matter.\n *\n * Deliberately not a YAML dependency: this package ships zero runtime deps and\n * forcing one on every consumer to read four block mappings is the worse trade\n * — the same call `/peer-floors` made about `semver`. The shapes read here are\n * `pnpm-workspace.yaml`'s `overrides`/`catalog`/`catalogs` and\n * `pnpm-lock.yaml`'s `overrides`/`importers`/`packages`/`snapshots`, all of\n * which pnpm emits as plain two-space block mappings of scalars.\n * ------------------------------------------------------------------------ */\n\ninterface YamlLine {\n readonly indent: number\n readonly key: string\n readonly value: string\n /** Enclosing keys, outermost first, excluding this line's own key. */\n readonly path: readonly string[]\n readonly lineNumber: number\n}\n\nfunction unquote(text: string): string {\n const t = text.trim()\n if ((t.startsWith(\"'\") && t.endsWith(\"'\")) || (t.startsWith('\"') && t.endsWith('\"'))) {\n return t.slice(1, -1)\n }\n return t\n}\n\nfunction readYamlLines(text: string): YamlLine[] {\n const out: YamlLine[] = []\n // Innermost key seen at each indent level, so a `specifier:` line can name\n // the dependency it belongs to.\n const stack: string[] = []\n text.split('\\n').forEach((raw, index) => {\n if (!raw.trim() || raw.trimStart().startsWith('#')) return\n const indent = raw.length - raw.trimStart().length\n const match = /^\\s*(?:'((?:[^']|'')*)'|\"([^\"]*)\"|([^\\s:#][^:]*?))\\s*:(?:\\s+(.*))?$/.exec(raw)\n if (!match) return\n const key = (match[1] ?? match[2] ?? match[3] ?? '').replace(/''/g, \"'\")\n // A trailing ` # comment` is a comment only outside quotes; every value pnpm\n // writes here is unquoted or fully quoted, so splitting on ` #` is exact.\n const rawValue = (match[4] ?? '').split(' #')[0] ?? ''\n const depth = Math.floor(indent / 2)\n stack.length = depth\n const path = [...stack]\n stack[depth] = key\n out.push({ indent, key, value: unquote(rawValue), path, lineNumber: index + 1 })\n })\n return out\n}\n\n/** The top-level section a nested line sits under. */\nfunction sectionOf(line: YamlLine): string | undefined {\n return line.indent === 0 ? line.key : line.path[0]\n}\n\n/* ------------------------------------------------------------------------ */\n\nconst DEP_FIELDS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'] as const\n\n/**\n * Judge one declaration and produce a finding, or `null` when it is fine.\n *\n * One function so the manifest lane, the override lane and the lockfile lane\n * cannot drift into three different opinions about the same specifier.\n */\nfunction judge(args: {\n check: DependencySourceCheck\n name: string\n specifier: string\n where: string\n fromDir: string\n repoDir: string\n}): DependencySourceFinding | null {\n const protocol = classifyDependencySpecifier(args.specifier)\n if (isReproducible(protocol)) return null\n\n const base = { check: args.check, name: args.name, specifier: args.specifier, protocol, where: args.where }\n\n if (protocol === 'tarball') {\n return {\n ...base,\n detail: 'resolves a PACKED TARBALL, not a published release. A .tgz is opaque bytes that no '\n + 'diff shows and no registry can reproduce: the version inside it can collide with a real '\n + 'release and ship a different API. Publish the change and pin the published range.',\n }\n }\n if (protocol === 'git' || protocol === 'remote') {\n return {\n ...base,\n detail: `resolves from ${protocol === 'git' ? 'a git ref' : 'a remote URL'} rather than the `\n + 'registry, so what installs depends on what that ref points at today. Publish the change '\n + 'and pin the published range.',\n }\n }\n\n const path = args.specifier.slice(args.specifier.indexOf(':') + 1)\n const source = resolveLocalPathSource({ fromDir: args.fromDir, repoDir: args.repoDir, path, name: args.name })\n if (source === 'in-repo-source') return null\n const why: Record<Exclude<LocalPathSource, 'in-repo-source'>, string> = {\n 'outside-repo': 'points OUTSIDE this repository, so it resolves on one machine and nowhere else — '\n + 'a clean checkout, a CI runner and a sign-off gate that installs into an exported tree all '\n + 'get a different answer or fail at install.',\n 'not-a-directory': 'does not resolve to a package directory in this repository. A local specifier '\n + 'is only legitimate when it points at in-repo SOURCE a reviewer sees in the diff.',\n 'name-mismatch': `resolves to an in-repo directory that declares a DIFFERENT package name, so the `\n + `dependency ${args.name} is being satisfied by something else entirely.`,\n }\n return { ...base, detail: `${why[source]} (${source})` }\n}\n\nfunction scanManifest(file: string, repoDir: string): DependencySourceFinding[] {\n let manifest: Record<string, unknown>\n try {\n manifest = JSON.parse(readFileSync(file, 'utf8')) as Record<string, unknown>\n } catch {\n return []\n }\n const fromDir = dirname(file)\n const where = relative(repoDir, file).split(sep).join('/') || 'package.json'\n const findings: DependencySourceFinding[] = []\n\n for (const field of DEP_FIELDS) {\n const block = manifest[field]\n if (!block || typeof block !== 'object') continue\n for (const [name, specifier] of Object.entries(block as Record<string, unknown>)) {\n if (typeof specifier !== 'string') continue\n const finding = judge({ check: 'declared', name, specifier, where: `${where} → ${field}`, fromDir, repoDir })\n if (finding) findings.push(finding)\n }\n }\n\n // The lane insurance's defect actually used. `resolutions` is yarn/npm's\n // spelling of the same authority; both silently outrank every range above.\n const overrideBlocks: Array<[string, unknown]> = [\n ['pnpm.overrides', (manifest.pnpm as { overrides?: unknown } | undefined)?.overrides],\n ['resolutions', manifest.resolutions],\n ]\n for (const [label, block] of overrideBlocks) {\n if (!block || typeof block !== 'object') continue\n for (const [name, specifier] of Object.entries(block as Record<string, unknown>)) {\n if (typeof specifier !== 'string') continue\n const finding = judge({\n check: 'override',\n // An override key can carry a range suffix (`foo@1 > bar`); the package\n // name is the leading segment.\n name: overrideKeyName(name),\n specifier,\n where: `${where} → ${label}['${name}']`,\n fromDir,\n repoDir,\n })\n if (finding) findings.push(finding)\n }\n }\n return findings\n}\n\n/** `@scope/pkg@^1 > dep` and `pkg@1` both name `pkg` / `@scope/pkg`. */\nfunction overrideKeyName(key: string): string {\n const head = (key.split('>').pop() ?? key).trim()\n const at = head.lastIndexOf('@')\n return at > 0 ? head.slice(0, at) : head\n}\n\nfunction scanWorkspaceYaml(file: string, repoDir: string): DependencySourceFinding[] {\n const findings: DependencySourceFinding[] = []\n const where = relative(repoDir, file).split(sep).join('/')\n for (const line of readYamlLines(readFileSync(file, 'utf8'))) {\n const section = sectionOf(line)\n if (section !== 'overrides' && section !== 'catalog' && section !== 'catalogs') continue\n if (line.indent === 0 || !line.value) continue\n const finding = judge({\n check: 'override',\n name: overrideKeyName(line.key),\n specifier: line.value,\n where: `${where}:${line.lineNumber} → ${[...line.path, line.key].join('.')}`,\n fromDir: dirname(file),\n repoDir,\n })\n if (finding) findings.push(finding)\n }\n return findings\n}\n\n/**\n * The lockfile is the only file that reports what ACTUALLY resolved. A manifest\n * can be cleaned up while `pnpm-lock.yaml` still resolves a tarball, and the\n * install follows the lockfile.\n *\n * Three shapes carry it, all present in the real insurance-agent lockfile:\n * overrides: '@tangle-network/agent-app': file:./vendor/…-0.45.33.tgz\n * importers: specifier: file:vendor/…-0.45.33.tgz\n * packages: '@tangle-network/agent-app@file:vendor/…-0.45.33.tgz':\n */\nfunction scanLockfile(file: string, repoDir: string): DependencySourceFinding[] {\n const findings: DependencySourceFinding[] = []\n const where = relative(repoDir, file).split(sep).join('/')\n const fromDir = dirname(file)\n const seen = new Set<string>()\n const push = (finding: DependencySourceFinding | null): void => {\n if (!finding) return\n const key = `${finding.name}|${finding.specifier}`\n if (seen.has(key)) return\n seen.add(key)\n findings.push(finding)\n }\n\n for (const line of readYamlLines(readFileSync(file, 'utf8'))) {\n const section = sectionOf(line)\n if (section === 'overrides' && line.indent > 0 && line.value) {\n push(judge({\n check: 'lockfile',\n name: overrideKeyName(line.key),\n specifier: line.value,\n where: `${where}:${line.lineNumber} → overrides`,\n fromDir,\n repoDir,\n }))\n continue\n }\n if (section === 'importers' && line.key === 'specifier' && line.value) {\n push(judge({\n check: 'lockfile',\n name: line.path[line.path.length - 1] ?? '(unknown)',\n specifier: line.value,\n where: `${where}:${line.lineNumber} → importers`,\n fromDir,\n repoDir,\n }))\n continue\n }\n if ((section === 'packages' || section === 'snapshots') && line.indent === 2 && !line.value) {\n const parsed = parsePackageKey(line.key)\n if (!parsed) continue\n push(judge({\n check: 'lockfile',\n name: parsed.name,\n specifier: parsed.reference,\n where: `${where}:${line.lineNumber} → ${section}`,\n fromDir,\n repoDir,\n }))\n }\n }\n return findings\n}\n\n/**\n * `'@scope/name@file:vendor/x.tgz'` → name + reference.\n *\n * The peer-suffix is stripped FIRST: a snapshot key looks like\n * `@radix-ui/react-dialog@1.1.23(@types/react@19.2.17)`, and the last `@` in\n * that string sits inside the suffix, not at the version boundary.\n */\nfunction parsePackageKey(key: string): { name: string; reference: string } | null {\n const withoutPeers = key.replace(/\\(.*\\)$/, '')\n const at = withoutPeers.lastIndexOf('@')\n if (at <= 0) return null\n return { name: withoutPeers.slice(0, at), reference: withoutPeers.slice(at + 1) }\n}\n\n/**\n * pnpm's virtual store encodes a dependency's SOURCE in the directory name:\n * a registry package is `@tangle-network+agent-app@0.45.33`, while the\n * vendored one installed as\n * `file+vendor+agent-app+tangle-network-agent-app-0.45.33.tgz`.\n *\n * This is install evidence that survives a tidied manifest and a regenerated\n * lockfile, which is why it is scanned separately rather than trusted to follow\n * from them.\n */\nfunction scanVirtualStore(\n repoDir: string,\n modulesDir: string,\n): DependencySourceFinding[] {\n const store = join(repoDir, modulesDir, '.pnpm')\n if (!existsSync(store)) return []\n const findings: DependencySourceFinding[] = []\n for (const entry of readdirSync(store, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name === modulesDir) continue\n const protocolMatch = /^(file|link|portal|git|https?)\\+/.exec(entry.name)\n if (!protocolMatch) continue\n const protocol = protocolMatch[1] as string\n // pnpm encodes `/` as `+` for the whole remainder of a path-protocol key.\n const encoded = entry.name.slice(protocol.length + 1)\n const name = installedPackageName(join(store, entry.name), modulesDir)\n const where = `${modulesDir}/.pnpm/${entry.name}`\n\n if (protocol === 'file' || protocol === 'link' || protocol === 'portal') {\n const path = encoded.split('+').join('/')\n const specifier = `${protocol}:${path}`\n const finding = judge({\n check: 'installed',\n name: name ?? path,\n specifier,\n where,\n // A virtual-store path is written relative to the install root.\n fromDir: repoDir,\n repoDir,\n })\n if (finding) findings.push(finding)\n continue\n }\n findings.push({\n check: 'installed',\n name,\n specifier: encoded.split('+++').join('://').split('+').join('/'),\n protocol: protocol === 'git' ? 'git' : 'remote',\n where,\n detail: 'is INSTALLED from a git ref or remote URL rather than the registry. The manifests may '\n + 'read clean — this is what the tree on disk actually holds. Reinstall from a published range.',\n })\n }\n return findings\n}\n\n/**\n * The package a virtual-store entry belongs to: the one REAL directory under\n * its nested module dir (its dependencies are all symlinks).\n *\n * The nested level takes `modulesDir` too, not a hardcoded `node_modules`.\n * In a real install both levels ARE `node_modules`, so nothing changes there —\n * but a COMMITTED fixture cannot carry a `node_modules` path segment at any\n * depth, because every repo gitignores that name. Hardcoding it here made this\n * module's own calibration tree un-committable, which is the failure the\n * `fixture_modules` convention exists to prevent, reintroduced one level down.\n */\nfunction installedPackageName(entryDir: string, modulesDir: string): string | null {\n const nested = join(entryDir, modulesDir)\n if (!existsSync(nested)) return null\n for (const child of readdirSync(nested, { withFileTypes: true })) {\n if (child.name === '.bin' || child.isSymbolicLink()) continue\n if (!child.isDirectory()) continue\n if (child.name.startsWith('@')) {\n const scopeDir = join(nested, child.name)\n for (const scoped of readdirSync(scopeDir, { withFileTypes: true })) {\n if (scoped.isSymbolicLink() || !scoped.isDirectory()) continue\n if (existsSync(join(scopeDir, scoped.name, 'package.json'))) return `${child.name}/${scoped.name}`\n }\n continue\n }\n if (existsSync(join(nested, child.name, 'package.json'))) return child.name\n }\n return null\n}\n\n/* ---------------------------------------------------------------------------\n * On-disk integrity — and an honest account of its ceiling.\n *\n * WHAT WAS CONSIDERED AND REJECTED. Full verification means comparing the\n * installed bytes against the PUBLISHED tarball. `pnpm-lock.yaml` records that\n * tarball's `integrity` (`sha512-…`) and nothing about its contents, and the\n * tarball is not on disk: pnpm unpacks into a content-addressed store and keeps\n * the per-file digests in an INDEX whose location and format change between\n * pnpm majors — pnpm 10 writes JSON under `store/v10/index/`, pnpm 11 writes one\n * SQLite database (measured: `~/.local/share/pnpm/store/v11/index.db`, 57 MB).\n * Reading it means a SQLite dependency plus a coupling to store internals, in a\n * package that ships zero runtime dependencies; re-fetching the tarball means\n * network access inside a gate that must run offline in seconds. So full\n * verification is NOT affordable and is not attempted.\n *\n * WHAT IS AFFORDABLE. The store is CONTENT-ADDRESSED: a file's bytes live at\n * `<store>/files/<first 2 hex>/<rest>` of their own sha512, a layout that has\n * survived v3 → v10 → v11 while the index format changed twice. So a file's\n * bytes can be asked one question with no dependency and no network — \"has this\n * store ever held these bytes?\" Bytes that came out of a package pnpm installed\n * are in there by construction. Bytes typed in afterwards are not.\n *\n * Two steps, because hashing 30,000 files per run would not be cheap:\n * 1. `nlink > 1` — the file shares an inode, so it IS a store blob. No hash.\n * This settles ~99% of files at the cost of one `lstat`.\n * 2. Everything else is hashed and looked up in the store CAS.\n *\n * THE HARD-LINK COUNT ALONE IS NOT THE SIGNAL, and believing it was is the\n * mistake this design corrects. An earlier cut reported any package holding\n * both linked and unlinked files as tampered. Measured across five real fleet\n * repos it fired once — on legal-agent's `@tangle-network/agent-interface@0.32.0`,\n * whose `dist/environment-provider.js` is `nlink == 1` — and that finding was\n * FALSE: `npm pack @tangle-network/agent-interface@0.32.0` yields the identical\n * 11-byte `export {};`. pnpm simply wrote that copy instead of linking it. A\n * 1-in-5-repos false alarm is a gate people switch off, and the CAS lookup is\n * what tells the two apart: those bytes ARE in the store.\n *\n * MEASURED after adding the lookup: 5 fleet repos, 0 findings, 0 false alarms.\n *\n * WHAT IT CANNOT CATCH, precisely — do not read a clean integrity line as more:\n * 1. A patch whose content came from ANOTHER package or version ALREADY in\n * this store. CAS membership proves \"this store has held these bytes\", not\n * \"these bytes belong to this package at this version\". The measured\n * defect — a `dist/spend/index.d.ts` overwritten with a NEWER version's\n * copy — is caught only when that newer version was never installed on the\n * machine. This is the real ceiling; closing it needs the per-file index.\n * 2. An edit that PRESERVES the inode (`> file`, `cp onto`). The link\n * survives and the STORE copy is corrupted with it, so both agree.\n * 3. A tampered store: everything resolves, everything agrees, all wrong.\n * 4. Anything at all when the store cannot be located — npm, yarn, a store on\n * another machine, a pruned CI cache. That is reported as NOT VERIFIED\n * rather than as a pass, and it is never a finding, because failing every\n * non-pnpm consumer forever is how a gate gets deleted.\n * ------------------------------------------------------------------------ */\n\n/**\n * Every content-addressed `files/` directory this install could have linked\n * from, read out of `node_modules/.modules.yaml` — pure `fs`, no `pnpm store\n * path` subprocess.\n *\n * More than one, because a long-lived machine has several store majors side by\n * side and an existing tree can be linked from an older one: measured on\n * legal-agent, `dist/index.js` resolves in `store/v10/files` while\n * `dist/environment-provider.js` resolves in `store/v10/v11/files`. Checking\n * only the configured one reports a linked file as unknown.\n */\nfunction locateStoreCas(repoDir: string, modulesDir: string): string[] {\n const modulesState = join(repoDir, modulesDir, '.modules.yaml')\n if (!existsSync(modulesState)) return []\n let configured: string | undefined\n try {\n const text = readFileSync(modulesState, 'utf8')\n // pnpm 11 writes JSON under the .yaml name; older versions write YAML.\n configured = (/\"storeDir\"\\s*:\\s*\"((?:[^\"\\\\]|\\\\.)*)\"/.exec(text)?.[1]\n ?? /^storeDir:\\s*(.+)$/m.exec(text)?.[1])?.trim()\n } catch {\n return []\n }\n if (!configured) return []\n const root = unquote(configured.replace(/\\\\\\\\/g, '\\\\'))\n const candidates = new Set<string>([root, dirname(root)])\n for (const base of [root, dirname(root)]) {\n try {\n for (const entry of readdirSync(base, { withFileTypes: true })) {\n if (entry.isDirectory() && /^v\\d+$/.test(entry.name)) candidates.add(join(base, entry.name))\n }\n } catch { /* an unreadable store is simply not a candidate */ }\n }\n return [...candidates].map((dir) => join(dir, 'files')).filter((dir) => existsSync(dir))\n}\n\nfunction collectFiles(dir: string, modulesDir: string, out: string[] = []): string[] {\n let entries: import('node:fs').Dirent[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return out\n }\n for (const entry of entries) {\n // A package's own nested `node_modules` holds pnpm-GENERATED `.bin` shims\n // and symlinks, never store content. Including it made 3 of this repo's 8\n // installed @tangle-network packages look partially replaced.\n if (entry.name === modulesDir) continue\n const full = join(dir, entry.name)\n if (entry.isSymbolicLink()) continue\n if (entry.isDirectory()) collectFiles(full, modulesDir, out)\n else if (entry.isFile()) out.push(full)\n }\n return out\n}\n\n/** Does any reachable store hold these exact bytes? `-exec` is pnpm's suffix\n * for the executable-mode copy of the same content. */\nfunction storeHolds(casDirs: readonly string[], bytes: Buffer): boolean {\n const hex = createHash('sha512').update(bytes).digest('hex')\n const tail = join(hex.slice(0, 2), hex.slice(2))\n return casDirs.some((dir) => existsSync(join(dir, tail)) || existsSync(join(dir, `${tail}-exec`)))\n}\n\n/**\n * Check each installed package under `scope` against the content-addressed\n * store it was installed from. Returns coverage alongside findings, because a\n * pass that verified nothing must not render like a pass that verified\n * everything.\n */\nexport function checkInstalledIntegrity(args: {\n repoDir: string\n modulesDir: string\n scope: string\n}): { coverage: InstalledIntegrityCoverage; findings: DependencySourceFinding[] } {\n const virtualStore = join(args.repoDir, args.modulesDir, '.pnpm')\n const casDirs = locateStoreCas(args.repoDir, args.modulesDir)\n const findings: DependencySourceFinding[] = []\n let packagesExamined = 0\n let filesExamined = 0\n let filesHashed = 0\n\n if (casDirs.length > 0 && existsSync(virtualStore)) {\n for (const entry of readdirSync(virtualStore, { withFileTypes: true })) {\n if (!entry.isDirectory() || entry.name === args.modulesDir) continue\n const entryDir = join(virtualStore, entry.name)\n const name = installedPackageName(entryDir, args.modulesDir)\n if (!name || !name.startsWith(args.scope)) continue\n const packageDir = join(entryDir, args.modulesDir, name)\n if (!existsSync(packageDir)) continue\n\n const files = collectFiles(packageDir, args.modulesDir)\n if (files.length === 0) continue\n packagesExamined += 1\n filesExamined += files.length\n\n const foreign: string[] = []\n for (const file of files) {\n try {\n // A shared inode IS a store blob — settled without reading the file.\n if (lstatSync(file).nlink > 1) continue\n filesHashed += 1\n if (storeHolds(casDirs, readFileSync(file))) continue\n foreign.push(relative(packageDir, file).split(sep).join('/'))\n } catch { /* a file that vanished mid-walk is not evidence */ }\n }\n if (foreign.length === 0) continue\n\n const shown = foreign.slice(0, 5)\n findings.push({\n check: 'installed',\n name,\n specifier: null,\n protocol: null,\n where: `${args.modulesDir}/.pnpm/${entry.name} → ${shown.join(', ')}`\n + `${foreign.length > shown.length ? ` (+${foreign.length - shown.length} more)` : ''}`,\n detail: `holds ${foreign.length} file(s) whose bytes this pnpm store has never contained — the `\n + 'shape of a package HAND-PATCHED after install. The version on disk, the manifest and the '\n + 'lockfile all still agree; only the bytes do not, which is how a product typechecks green '\n + 'against an API its declared dependency does not ship. Delete the tree and reinstall '\n + `(\\`rm -rf ${args.modulesDir} && pnpm install --frozen-lockfile\\`), then publish whatever `\n + 'change made the patch look necessary.',\n })\n }\n }\n\n return {\n coverage: {\n basis: 'store-cas',\n storeLocated: casDirs.length > 0,\n packagesExamined,\n filesExamined,\n filesHashed,\n },\n findings,\n }\n}\n\n/** Audit one repository for dependencies whose source is not the registry. */\nexport function checkDependencySources(options: CheckDependencySourcesOptions): DependencySourceReport {\n const repoDir = resolve(options.repoDir)\n const { scope = '@tangle-network/', modulesDir = 'node_modules', exclude = [] } = options\n\n const seen = { manifests: [] as string[], tarballs: [] as string[] }\n walkSourceTree(repoDir, repoDir, exclude, seen)\n\n const findings: DependencySourceFinding[] = []\n for (const manifest of seen.manifests) findings.push(...scanManifest(manifest, repoDir))\n\n const workspaceYaml = join(repoDir, 'pnpm-workspace.yaml')\n if (existsSync(workspaceYaml)) findings.push(...scanWorkspaceYaml(workspaceYaml, repoDir))\n\n const lockfile = join(repoDir, 'pnpm-lock.yaml')\n const lockfileScanned = existsSync(lockfile)\n if (lockfileScanned) findings.push(...scanLockfile(lockfile, repoDir))\n\n for (const tarball of seen.tarballs) {\n findings.push({\n check: 'vendored-tarball',\n name: null,\n specifier: null,\n protocol: 'tarball',\n where: relative(repoDir, tarball).split(sep).join('/'),\n detail: 'is a PACKED TARBALL committed into the source tree. Even when nothing points at it today, '\n + 'it is a build nobody can reproduce from the registry sitting one `file:` line away from '\n + `shipping. Delete it; if ${basename(tarball)} is genuinely test data, move it under a path `\n + 'passed to `--exclude`.',\n })\n }\n\n findings.push(...scanVirtualStore(repoDir, modulesDir))\n const integrity = checkInstalledIntegrity({ repoDir, modulesDir, scope })\n findings.push(...integrity.findings)\n\n return {\n repoDir,\n manifestsScanned: seen.manifests.length,\n lockfileScanned,\n integrity: integrity.coverage,\n findings,\n ok: findings.length === 0,\n }\n}\n\nconst CHECK_LABEL: Record<DependencySourceCheck, string> = {\n declared: 'DECLARED',\n override: 'OVERRIDE',\n lockfile: 'LOCKFILE',\n 'vendored-tarball': 'TARBALL',\n installed: 'INSTALLED',\n}\n\n/** One finding rendered as the failure a reader has to act on. */\nexport function describeDependencySourceFinding(finding: DependencySourceFinding): string {\n const subject = finding.name\n ? `${finding.name}${finding.specifier ? ` (${finding.specifier})` : ''}`\n : finding.where\n return `DEPENDENCY SOURCE: ${subject} ${finding.detail}\\n at ${finding.where}`\n}\n\nexport function formatDependencySourceReport(report: DependencySourceReport): string {\n const { integrity } = report\n // Printed on EVERY report, clean or not: \"verified nothing\" and \"verified\n // everything and found nothing\" are otherwise the same green line, which is\n // this gate's own failure class turned on itself.\n const integrityLine = integrity.storeLocated\n ? ` integrity (${integrity.basis}): ${integrity.packagesExamined} package(s), `\n + `${integrity.filesExamined} file(s), ${integrity.filesHashed} hashed against the store`\n : ` integrity (${integrity.basis}): NOT VERIFIED — no pnpm content-addressed store is reachable `\n + 'from this tree, so no installed bytes were checked against anything'\n const lines = [\n 'dependency sources',\n '',\n ` scanned ${report.manifestsScanned} manifest(s), `\n + `${report.lockfileScanned ? 'pnpm-lock.yaml' : 'no lockfile'}`,\n integrityLine,\n '',\n ]\n if (report.ok) {\n lines.push(\n integrity.storeLocated && integrity.packagesExamined > 0\n ? ' ok every declared source is the registry, and every installed byte came from the store'\n : ' ok every declared source is the registry — installed bytes UNVERIFIED (see above)',\n )\n } else {\n for (const finding of report.findings) {\n lines.push(` FAIL [${CHECK_LABEL[finding.check]}] ${describeDependencySourceFinding(finding)}`, '')\n }\n }\n return lines.join('\\n')\n}\n"],"mappings":";AAAA,SAAS,cAAAA,aAAY,gBAAAC,eAAc,eAAAC,oBAAmB;AACtD,SAAS,WAAAC,UAAS,QAAAC,aAAY;;;ACD9B,SAAS,mBAAmB;AAC5B,SAAS,MAAM,UAAU,WAAW;AAG7B,SAAS,uBAAuB,KAAa,SAAiB,SAA4B;AAC/F,MAAI;AACJ,MAAI;AACF,cAAU,YAAY,KAAK,EAAE,eAAe,KAAK,CAAC;AAAA,EACpD,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACA,SAAO,QAAQ,QAAQ,WAAS;AAC9B,UAAM,OAAO,KAAK,KAAK,MAAM,IAAI;AACjC,UAAM,MAAM,SAAS,SAAS,IAAI,EAAE,MAAM,GAAG,EAAE,KAAK,GAAG;AACvD,WAAO,QAAQ,KAAK,YAAU,QAAQ,UAAU,IAAI,WAAW,GAAG,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,MAAM,IAAI,CAAC;AAAA,EAC5G,CAAC;AACH;;;ACfA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,WAAW,cAAc,eAAAC,cAAa,gBAAgB;AAC3E,SAAS,UAAU,SAAS,YAAY,QAAAC,OAAM,YAAAC,WAAU,SAAS,OAAAC,YAAW;AAoD5E,IAAM,UAAU;AAUT,SAAS,4BAA4B,WAA6C;AACvF,QAAM,OAAO,UAAU,KAAK;AAC5B,MAAI,KAAK,WAAW,YAAY,EAAG,QAAO;AAC1C,MAAI,KAAK,WAAW,UAAU,EAAG,QAAO;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Aa,UAAU,OAAO,EAAE,CAAC,UAAU,IAAI,KAAK,EAAE;AAAA,IACvG;AAAA,IACA,OAAO,KACH,OAAO,OAAO,KAAK,MAAM,sBACzB,OAAO,WAAW,IAAI,CAAC,QAAQ,2BAA2B,KAAK,OAAO,cAAc,KAAK,CAAC,EAAE,KAAK,MAAM;AAAA,EAC7G;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":["existsSync","readFileSync","readdirSync","dirname","join","readdirSync","join","relative","sep","join","existsSync","readdirSync","readFileSync","dirname"]}
@@ -0,0 +1,22 @@
1
+ // src/web-react/brand-mark.tsx
2
+ import { lazy, Suspense } from "react";
3
+ import { jsx } from "react/jsx-runtime";
4
+ function MarkSpacer({ size = 24, className }) {
5
+ return /* @__PURE__ */ jsx("span", { "aria-hidden": true, style: { display: "inline-block", width: size, height: size }, className });
6
+ }
7
+ var LazyKnot = lazy(async () => {
8
+ try {
9
+ const mod = await import("./brand/index.js");
10
+ return { default: mod.TangleKnot };
11
+ } catch {
12
+ return { default: MarkSpacer };
13
+ }
14
+ });
15
+ function BrandMark({ size = 24, className }) {
16
+ return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(MarkSpacer, { size, className }), children: /* @__PURE__ */ jsx(LazyKnot, { size, className }) });
17
+ }
18
+
19
+ export {
20
+ BrandMark
21
+ };
22
+ //# sourceMappingURL=chunk-7PULOECS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/web-react/brand-mark.tsx"],"sourcesContent":["/**\n * Load the canonical Tangle knot only when a web surface renders it.\n * `/brand` imports the optional `@tangle-network/brand` peer, so a failed load\n * renders a fixed-size spacer instead of crashing the chat shell.\n */\n\nimport { lazy, Suspense } from 'react'\nimport type { ComponentType } from 'react'\n\ninterface BrandMarkProps {\n size?: number\n className?: string\n}\n\n/** Preserve the mark's footprint while its optional package loads or is absent. */\nfunction MarkSpacer({ size = 24, className }: BrandMarkProps) {\n return <span aria-hidden style={{ display: 'inline-block', width: size, height: size }} className={className} />\n}\n\nconst LazyKnot = lazy(async () => {\n try {\n const mod = await import('../brand')\n return { default: mod.TangleKnot as ComponentType<BrandMarkProps> }\n } catch {\n return { default: MarkSpacer as ComponentType<BrandMarkProps> }\n }\n})\n\nexport function BrandMark({ size = 24, className }: BrandMarkProps) {\n return (\n <Suspense fallback={<MarkSpacer size={size} className={className} />}>\n <LazyKnot size={size} className={className} />\n </Suspense>\n )\n}\n"],"mappings":";AAMA,SAAS,MAAM,gBAAgB;AAUtB;AADT,SAAS,WAAW,EAAE,OAAO,IAAI,UAAU,GAAmB;AAC5D,SAAO,oBAAC,UAAK,eAAW,MAAC,OAAO,EAAE,SAAS,gBAAgB,OAAO,MAAM,QAAQ,KAAK,GAAG,WAAsB;AAChH;AAEA,IAAM,WAAW,KAAK,YAAY;AAChC,MAAI;AACF,UAAM,MAAM,MAAM,OAAO,kBAAU;AACnC,WAAO,EAAE,SAAS,IAAI,WAA4C;AAAA,EACpE,QAAQ;AACN,WAAO,EAAE,SAAS,WAA4C;AAAA,EAChE;AACF,CAAC;AAEM,SAAS,UAAU,EAAE,OAAO,IAAI,UAAU,GAAmB;AAClE,SACE,oBAAC,YAAS,UAAU,oBAAC,cAAW,MAAY,WAAsB,GAChE,8BAAC,YAAS,MAAY,WAAsB,GAC9C;AAEJ;","names":[]}