@tangle-network/agent-app 0.61.4 → 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 (307) 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-L7LQRJGD.js → chunk-TCJ4TMOW.js} +37 -33
  91. package/dist/{chunk-L7LQRJGD.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/index.js +5 -5
  167. package/dist/sequences/drizzle.js +5 -15
  168. package/dist/sequences/drizzle.js.map +1 -1
  169. package/dist/sequences/index.d.ts +1 -0
  170. package/dist/sequences/index.js +18 -14
  171. package/dist/sequences/index.js.map +1 -1
  172. package/dist/sequences/row-mapping.d.ts +7 -0
  173. package/dist/sequences-react/components/TimelineEditor.d.ts +0 -40
  174. package/dist/sequences-react/components/TimelineHistory.d.ts +31 -0
  175. package/dist/sequences-react/components/glyphs.d.ts +12 -21
  176. package/dist/sequences-react/components/index.d.ts +0 -2
  177. package/dist/sequences-react/components/interaction-math.d.ts +3 -3
  178. package/dist/sequences-react/contracts.d.ts +1 -1
  179. package/dist/sequences-react/engine/snap.d.ts +2 -2
  180. package/dist/sequences-react/index.js +4 -4
  181. package/dist/sequences-react/index.js.map +1 -1
  182. package/dist/settings-react/index.js +13 -30
  183. package/dist/settings-react/index.js.map +1 -1
  184. package/dist/settings-react/timezone-picker.d.ts +0 -6
  185. package/dist/signoff/browser-budget.d.ts +6 -1
  186. package/dist/signoff/cli.d.ts +0 -7
  187. package/dist/signoff/cli.js +1 -2
  188. package/dist/signoff/cli.js.map +1 -1
  189. package/dist/signoff/index.js +1 -1
  190. package/dist/skills/index.d.ts +1 -1
  191. package/dist/skills/index.js +5 -25
  192. package/dist/skills/marketplace.d.ts +1 -75
  193. package/dist/skills-placement/box.js +3 -4
  194. package/dist/skills-placement/box.js.map +1 -1
  195. package/dist/skills-placement/index.js +3 -4
  196. package/dist/spend/cli-args.d.ts +1 -1
  197. package/dist/spend/cli.js +3 -3
  198. package/dist/spend/cli.js.map +1 -1
  199. package/dist/spend/index.js +1 -1
  200. package/dist/stories/design-canvas/fixtures.d.ts +1 -14
  201. package/dist/stream/index.js +17 -17
  202. package/dist/studio/generation.d.ts +1 -1
  203. package/dist/studio/index.js +1 -1
  204. package/dist/studio-react/index.js +353 -184
  205. package/dist/studio-react/index.js.map +1 -1
  206. package/dist/studio-react/studio-composer.d.ts +1 -5
  207. package/dist/studio-react/studio-history-screen.d.ts +1 -1
  208. package/dist/teams/invitations-api.d.ts +3 -3
  209. package/dist/teams/invitations-api.js +74 -72
  210. package/dist/teams/invitations-api.js.map +1 -1
  211. package/dist/teams/member-sync.d.ts +2 -0
  212. package/dist/teams/members-api.d.ts +2 -2
  213. package/dist/teams/members-api.js +1 -1
  214. package/dist/teams-react/index.js +28 -45
  215. package/dist/teams-react/index.js.map +1 -1
  216. package/dist/tools/index.js +1 -1
  217. package/dist/tools/mcp-arguments.d.ts +1 -1
  218. package/dist/trace/index.d.ts +1 -18
  219. package/dist/trace/index.js +1 -36
  220. package/dist/trace/index.js.map +1 -1
  221. package/dist/trace/mission-flow.d.ts +1 -59
  222. package/dist/turn-health/index.d.ts +1 -1
  223. package/dist/turn-health/index.js +2 -2
  224. package/dist/turn-health/sink.d.ts +2 -1
  225. package/dist/turn-trace/index.js +2 -4
  226. package/dist/turn-trace/recorder.d.ts +0 -2
  227. package/dist/vault/VaultPane.d.ts +0 -20
  228. package/dist/vault/VaultPaneOperations.d.ts +318 -0
  229. package/dist/vault/index.js +2 -1
  230. package/dist/vault/index.js.map +1 -1
  231. package/dist/vault/lazy.js +1 -1
  232. package/dist/web-react/agent-profile-editor.d.ts +1 -2
  233. package/dist/web-react/agent-profile-editor.js +6 -5
  234. package/dist/web-react/chat-composer.d.ts +1 -1
  235. package/dist/web-react/durable-plan-flow.d.ts +6 -1
  236. package/dist/web-react/editor-glyphs.d.ts +12 -0
  237. package/dist/web-react/focus-navigation.d.ts +12 -0
  238. package/dist/web-react/history-controls.d.ts +37 -0
  239. package/dist/web-react/index.js +36 -34
  240. package/dist/web-react/interaction-question-card.d.ts +1 -1
  241. package/dist/web-react/record-grid-writes.d.ts +31 -0
  242. package/dist/web-react/record-grid.d.ts +1 -48
  243. package/dist/web-react/session-history-panel.d.ts +1 -9
  244. package/dist/web-react/use-document-dark.d.ts +1 -0
  245. package/dist/workspace-export/engine.d.ts +1 -6
  246. package/dist/workspace-export/index.js +198 -185
  247. package/dist/workspace-export/index.js.map +1 -1
  248. package/dist/workspace-export/routes.d.ts +1 -1
  249. package/dist/workspace-react/index.js +9 -8
  250. package/dist/workspace-react/index.js.map +1 -1
  251. package/package.json +1 -11
  252. package/dist/VaultPane-RXL3WLA2.js +0 -7
  253. package/dist/agent-profiles/reaper.d.ts +0 -31
  254. package/dist/agent-profiles/reaper.js +0 -29
  255. package/dist/agent-profiles/reaper.js.map +0 -1
  256. package/dist/chunk-4ZSLX3LY.js.map +0 -1
  257. package/dist/chunk-5IM2CLYX.js.map +0 -1
  258. package/dist/chunk-6OSJNJA2.js +0 -251
  259. package/dist/chunk-6OSJNJA2.js.map +0 -1
  260. package/dist/chunk-6PRQ45QE.js.map +0 -1
  261. package/dist/chunk-6ZIC6OG5.js.map +0 -1
  262. package/dist/chunk-BDEBQ4WO.js +0 -38
  263. package/dist/chunk-BDEBQ4WO.js.map +0 -1
  264. package/dist/chunk-BOQ4HVVH.js.map +0 -1
  265. package/dist/chunk-F2VX6TTJ.js.map +0 -1
  266. package/dist/chunk-FPNZMIAW.js.map +0 -1
  267. package/dist/chunk-HN6MZ2XL.js.map +0 -1
  268. package/dist/chunk-J2BBYVGF.js.map +0 -1
  269. package/dist/chunk-KJODHPWM.js.map +0 -1
  270. package/dist/chunk-LTWJYNEC.js +0 -100
  271. package/dist/chunk-LTWJYNEC.js.map +0 -1
  272. package/dist/chunk-LXYQOOXU.js.map +0 -1
  273. package/dist/chunk-MEKOWH5E.js.map +0 -1
  274. package/dist/chunk-NHYRIM4I.js.map +0 -1
  275. package/dist/chunk-NMZUW6VJ.js.map +0 -1
  276. package/dist/chunk-ORQD4AUO.js.map +0 -1
  277. package/dist/chunk-R4X5474U.js.map +0 -1
  278. package/dist/chunk-RL3Z747H.js.map +0 -1
  279. package/dist/chunk-TXUAGSFR.js.map +0 -1
  280. package/dist/chunk-UCCSJX64.js.map +0 -1
  281. package/dist/chunk-VJBFCNAU.js.map +0 -1
  282. package/dist/chunk-WSEXFTN4.js.map +0 -1
  283. package/dist/chunk-Y43PXON2.js.map +0 -1
  284. package/dist/chunk-ZBB5KQ6B.js.map +0 -1
  285. package/dist/eval/parity.d.ts +0 -74
  286. package/dist/mention-editor-B23OMFT2.js.map +0 -1
  287. package/dist/profile/humanizer-skill.d.ts +0 -23
  288. package/dist/profile/humanizer-skill.vendored.d.ts +0 -4
  289. package/dist/sequences-react/components/BrandMark.d.ts +0 -10
  290. package/dist/skills/marketplace-drizzle.d.ts +0 -121
  291. package/dist/skills/marketplace-drizzle.js +0 -34
  292. package/dist/skills/marketplace-drizzle.js.map +0 -1
  293. package/dist/teams-react/components/BrandMark.d.ts +0 -10
  294. /package/dist/{DesignCanvas-L6J72JQ2.js.map → DesignCanvas-IQKYAEC4.js.map} +0 -0
  295. /package/dist/{DesignCanvasEditor-QFQD63MR.js.map → DesignCanvasEditor-O7OCZTGC.js.map} +0 -0
  296. /package/dist/{TimelineEditor-7KBPJQLT.js.map → TimelineEditor-VB2UJ34D.js.map} +0 -0
  297. /package/dist/{VaultPane-RXL3WLA2.js.map → VaultPane-AYW7CO33.js.map} +0 -0
  298. /package/dist/{chunk-ATQQCG4I.js.map → chunk-2VJLLRVV.js.map} +0 -0
  299. /package/dist/{chunk-MDRH3SDA.js.map → chunk-54YIL7WM.js.map} +0 -0
  300. /package/dist/{chunk-6QJ3GB3A.js.map → chunk-5GSZGTPJ.js.map} +0 -0
  301. /package/dist/{chunk-ZDPUC6CM.js.map → chunk-6ZVSMA4T.js.map} +0 -0
  302. /package/dist/{chunk-LO6VQ35O.js.map → chunk-CQZVJVME.js.map} +0 -0
  303. /package/dist/{chunk-G4F2NWZH.js.map → chunk-FZ3ZFVAC.js.map} +0 -0
  304. /package/dist/{chunk-PDD5A43Y.js.map → chunk-UTL6TEN6.js.map} +0 -0
  305. /package/dist/{chunk-S27DKRI6.js.map → chunk-VDYEVCQQ.js.map} +0 -0
  306. /package/dist/{chunk-UFQM46NV.js.map → chunk-VK3F4N4U.js.map} +0 -0
  307. /package/dist/{chunk-FUZETA6Z.js.map → chunk-X6SZGQTK.js.map} +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/peer-floors/check.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 { 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 let entries: import('node:fs').Dirent[]\n try {\n entries = readdirSync(dir, { withFileTypes: true })\n } catch {\n return\n }\n for (const entry of entries) {\n const full = join(dir, entry.name)\n const rel = relative(repoDir, full).split(sep).join('/')\n if (exclude.some((prefix) => rel === prefix || rel.startsWith(`${prefix}/`))) continue\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 * 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,kBAAkB;AAC3B,SAAS,YAAY,WAAW,cAAc,aAAa,gBAAgB;AAC3E,SAAS,UAAU,SAAS,YAAY,MAAM,UAAU,SAAS,WAAW;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;AACxC,aAAW,YAAY,CAAC,SAAS,SAAS,SAAS,GAAY;AAC7D,QAAI,KAAK,WAAW,QAAQ,GAAG;AAC7B,YAAM,OAAO,KAAK,MAAM,SAAS,MAAM;AACvC,UAAI,QAAQ,KAAK,IAAI,EAAG,QAAO;AAC/B,aAAO,SAAS,MAAM,GAAG,EAAE;AAAA,IAC7B;AAAA,EACF;AACA,MAAI,+CAA+C,KAAK,IAAI,EAAG,QAAO;AACtE,MAAI,gCAAgC,KAAK,IAAI,EAAG,QAAO;AACvD,MAAI,eAAe,KAAK,IAAI,EAAG,QAAO,QAAQ,KAAK,KAAK,MAAM,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,YAAY;AAG9F,MAAI,6BAA6B,KAAK,IAAI,KAAK,CAAC,KAAK,WAAW,GAAG,EAAG,QAAO;AAC7E,SAAO;AACT;AAGA,SAAS,eAAe,UAA6C;AACnE,SAAO,aAAa,cAAc,aAAa,eAAe,aAAa;AAC7E;AAkCO,SAAS,uBAAuB,MASnB;AAClB,QAAM,OAAO,QAAQ,KAAK,OAAO;AACjC,QAAM,SAAS,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M,EAAE;AAAA,EAC1F;AAEA,SAAO,OAAO,IAAI,CAAC,UAAU,gBAAgB;AAAA,IAC3C;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,EACF,CAAC,CAAC;AACJ;AAIO,SAAS,2BAA2B,KAAmB,cAAsB,QAAQ,6BAAqC;AAC/H,MAAI,IAAI,YAAY,eAAe;AACjC,WAAO,wBAAwB,KAAK,IAAI,YAAY,aAAa,IAAI,IAAI,IAAI,IAAI,KAAK,SAC3E,IAAI,SAAS;AAAA,EAI1B;AACA,SAAO,GAAG,IAAI,IAAI,oGACa,IAAI,KAAK;AAE1C;AAEO,SAAS,sBAAsB,QAAyB,QAAQ,OAAO,OAAe;AAC3F,QAAM,QAAQ,KAAK,IAAI,GAAG,OAAO,KAAK,IAAI,CAAC,MAAM,EAAE,KAAK,MAAM,GAAG,CAAC;AAClE,QAAM,QAAQ;AAAA,IACZ,GAAG,KAAK,IAAI,OAAO,YAAY;AAAA,IAC/B;AAAA,IACA,GAAG,OAAO,KAAK,IAAI,CAAC,QAClB,KAAK,IAAI,YAAY,cAAc,SAAS,IAAI,QAAQ,WAAW,QAAQ,IAAI,SAAS,MAAM,IACzF,IAAI,KAAK,OAAO,KAAK,CAAC,gBAAgB,IAAI,aAAa,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","join","existsSync","readdirSync","readFileSync","dirname"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/alerting/slack.ts"],"sourcesContent":["/**\n * `/alerting` — post an operational alert to Slack, and say honestly when it\n * did not arrive.\n *\n * WHY THIS EXISTS: on 2026-08-06 an audit of every Slack credential the org\n * held found three of four dead — the fleet incoming webhook 404ing\n * (`no_service`), a second company webhook likewise, and the bot token\n * answering `account_inactive`. One ops webhook was still live. Nobody knew\n * which was which until each was tested by hand, and that is the actual\n * problem: the credentials were indistinguishable from where the code stood.\n *\n * This failure has already been paid for once, with numbers: in\n * `agent-container`, a revoked webhook let the CI healthcheck sit dead for\n * 18 days — 2,567 consecutive failures, 27 successes, zero alerts — because\n * fifteen call sites across six workflows posted with no body inspection and\n * then asserted delivery. That repo fixed the reporting (its `post-slack.sh`\n * confirms 2xx AND Slack's literal `ok` body, and fails closed otherwise) and\n * that half of the lesson is theirs, adopted here.\n *\n * What their fix cannot do, and this module can, is answer the question BEFORE\n * an alert needs to fire. A fail-closed post still only discovers a dead\n * credential at the moment a page is lost. That is the second half.\n *\n * Two design consequences, and they are the whole module:\n *\n * 1. **A bot token and `chat.postMessage` is the preferred transport; an\n * incoming webhook is supported because one is usually what you already\n * have.** A token reaches every channel (a webhook is bolted to one), is\n * revocable and rotatable in place, and — the part that matters — is\n * VERIFIABLE: `auth.test` answers whether the credential is alive without\n * posting anything, which is what lets `/preflight` fail a deploy on a dead\n * alerting channel instead of discovering it during an incident. A webhook\n * can only be tested by posting to it, which is why the three dead\n * credentials above went unnoticed. A token is never fallen back FROM: if\n * one is configured and dead, delivering over a webhook instead would hide\n * the very condition worth reporting.\n *\n * 2. **Slack answers `ok:false` under HTTP 200.** `invalid_auth`,\n * `channel_not_found` and `not_in_channel` all arrive as a successful\n * response with a failure inside it, so a status check reads a dead channel\n * as a delivered page. The body is always parsed, and the outcome\n * distinguishes a MISSING credential (configuration absent — not an\n * incident) from a DEAD one (the alerting channel itself is broken — the\n * loudest thing this module can report). A summary that calls those two the\n * same thing is the defect wearing a different hat.\n *\n * The caller decides what to do with a non-delivery; this module never throws\n * on one, because an alerting path that can take down the thing it reports on\n * is worse than the outage it was watching for. It is also never the only\n * channel: a durable record (an issue, an audit row) is the caller's job, and\n * that is what survives the credential going dead again.\n *\n * Server-only: holds a bot token. This subpath must never reach a browser\n * bundle.\n */\n\nconst SLACK_API = 'https://slack.com/api'\nconst DEFAULT_TIMEOUT_MS = 10_000\nconst DEFAULT_ATTEMPTS = 3\n\n/**\n * Why an alert did not reach Slack. The split is by what a human must DO about\n * it, since that is the only distinction a caller can act on.\n */\nexport type SlackFailureReason =\n /** No token or no channel configured. Configuration is absent, nothing is broken. */\n | 'not-configured'\n /**\n * The token is dead — revoked, or its app removed from the workspace. No\n * alert will EVER arrive until a human mints a new one. This is itself an\n * incident and the caller should escalate it on a channel that does not\n * depend on Slack.\n */\n | 'credential'\n /**\n * The credential is alive but cannot post HERE: the channel is wrong,\n * archived, or the bot was never invited to it. One human action fixes it.\n */\n | 'channel'\n /** Slack asked us to slow down. Transient; the alert is worth retrying. */\n | 'rate-limited'\n /** The request never got an answer — network, DNS, timeout. Transient. */\n | 'transport'\n /** Slack refused for some other reason; `detail` carries its error code. */\n | 'api'\n\n/** An alert that did not arrive, and why. Named because the classifiers only ever produce this half. */\nexport interface SlackAlertFailure {\n delivered: false\n reason: SlackFailureReason\n /** One line naming what is wrong and what fixes it. Safe to log; carries no token. */\n detail: string\n}\n\n/** What one `postSlackAlert` call did. Never a bare boolean — the caller pages differently per reason. */\nexport type SlackAlertOutcome =\n | {\n delivered: true\n /** The channel id Slack resolved (not necessarily the name that was passed). */\n channel: string\n /** Slack's message timestamp — the message's identity, for a later thread reply. */\n ts: string\n }\n | SlackAlertFailure\n\n/** Define configuration options for posting an alert message to a Slack channel */\nexport interface SlackAlertOptions {\n /**\n * Slack bot token (`xoxb-…`) with `chat:write`. The PREFERRED transport,\n * because it is the only one whose liveness can be checked before an alert\n * needs it. An empty or absent value is `not-configured`, never an error — a\n * product that has not adopted Slack yet must not fail its alerting path.\n */\n token?: string | undefined\n /**\n * Channel to post to: a name (`#infra-alerts`) or an id (`C01234567`). The\n * bot must be a member; Slack answers `not_in_channel` otherwise. Required\n * with `token`, meaningless with `webhookUrl` (a webhook carries its own\n * channel, fixed when it was created).\n */\n channel?: string | undefined\n /**\n * Slack incoming-webhook URL, used only when no `token` is configured.\n *\n * It works and it needs no setup, which is why it is supported — but it\n * cannot be verified without posting, cannot be pointed at a second channel,\n * and gives back an error token instead of a code. Two of the three webhooks\n * this org has held were found revoked. Treat it as the transport you have,\n * not the one you want.\n *\n * When a `token` is also configured this is IGNORED rather than used as a\n * fallback: a dead token must surface as the incident it is, and quietly\n * succeeding over a second transport is how the last outage stayed invisible.\n */\n webhookUrl?: string | undefined\n /** Message body as Slack mrkdwn. Newlines are preserved. */\n text: string\n /**\n * Attempts for a TRANSIENT failure (429 / 5xx / transport). Default 3. A\n * dead credential or a wrong channel is never retried — the answer will not\n * change, and retrying an auth failure is how a token gets rate-limited.\n */\n attempts?: number\n /** Per-request deadline. Default 10s. */\n timeoutMs?: number\n /** Injection seam for tests; defaults to global `fetch`. */\n fetchImpl?: typeof fetch\n /** Injection seam for tests; defaults to a real delay between retries. */\n sleepImpl?: (ms: number) => Promise<void>\n}\n\n/** Slack error codes that mean the CREDENTIAL is dead, not the request. */\nconst CREDENTIAL_ERRORS = new Set([\n 'invalid_auth',\n 'not_authed',\n 'account_inactive',\n 'token_revoked',\n 'token_expired',\n 'no_permission',\n 'missing_scope',\n 'ekm_access_denied',\n])\n\n/** Slack error codes that mean the credential is fine but this CHANNEL is not reachable. */\nconst CHANNEL_ERRORS = new Set([\n 'channel_not_found',\n 'not_in_channel',\n 'is_archived',\n 'restricted_action',\n 'restricted_action_read_only_channel',\n])\n\nfunction remedyFor(reason: SlackFailureReason, error: string, channel: string): string {\n switch (reason) {\n case 'credential':\n return (\n `Slack rejected the bot token (${error}) — no alert can arrive until a human mints a new one. ` +\n 'Reinstall the Slack app and update SLACK_BOT_TOKEN wherever it is stored.'\n )\n case 'channel':\n return (\n `Slack accepted the token but refused ${channel} (${error}) — ` +\n `invite the bot to ${channel}, or correct the channel name.`\n )\n default:\n return `Slack refused the post (${error}).`\n }\n}\n\nfunction classifySlackError(error: string, channel: string): SlackAlertFailure {\n const reason: SlackFailureReason = CREDENTIAL_ERRORS.has(error)\n ? 'credential'\n : CHANNEL_ERRORS.has(error)\n ? 'channel'\n : 'api'\n return { delivered: false, reason, detail: remedyFor(reason, error, channel) }\n}\n\n/** Slack's `Retry-After` is in SECONDS. Bounded so a hostile header cannot park the caller. */\nfunction retryDelayMs(response: Response, attempt: number): number {\n const header = Number(response.headers.get('retry-after'))\n if (Number.isFinite(header) && header > 0) return Math.min(header * 1000, 30_000)\n return Math.min(500 * 2 ** (attempt - 1), 8_000)\n}\n\nconst defaultSleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms))\n\n/**\n * Post one alert to a Slack channel.\n *\n * Never throws and never retries a failure whose answer cannot change. The\n * returned outcome is the whole result — a caller that ignores it has an\n * alerting path it cannot prove works, which is the failure this module was\n * written for.\n */\nexport async function postSlackAlert(options: SlackAlertOptions): Promise<SlackAlertOutcome> {\n const token = options.token?.trim()\n const channel = options.channel?.trim()\n const webhookUrl = options.webhookUrl?.trim()\n\n if (!token && !webhookUrl) {\n return {\n delivered: false,\n reason: 'not-configured',\n detail:\n 'no Slack credential configured — set SLACK_BOT_TOKEN (preferred, verifiable) ' +\n 'or SLACK_WEBHOOK_URL to route alerts to Slack',\n }\n }\n if (token && !channel) {\n return {\n delivered: false,\n reason: 'not-configured',\n detail: 'a Slack bot token is set but no channel is — set the alert channel (e.g. #infra-alerts)',\n }\n }\n\n const fetchImpl = options.fetchImpl ?? fetch\n const sleep = options.sleepImpl ?? defaultSleep\n const attempts = Math.max(1, options.attempts ?? DEFAULT_ATTEMPTS)\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS\n\n // A token is never fallen back FROM. If one is configured and dead, that is\n // the incident, and delivering over a webhook instead would hide exactly the\n // condition this module exists to surface.\n const transport: SlackTransport = token\n ? { kind: 'token', token, channel: channel as string }\n : { kind: 'webhook', url: webhookUrl as string }\n\n let lastTransient: SlackAlertFailure = {\n delivered: false,\n reason: 'transport',\n detail: 'Slack was never reached',\n }\n\n for (let attempt = 1; attempt <= attempts; attempt += 1) {\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), timeoutMs)\n let response: Response\n try {\n response = await fetchImpl(requestUrl(transport), {\n method: 'POST',\n headers: requestHeaders(transport),\n body: JSON.stringify(requestBody(transport, options.text)),\n signal: controller.signal,\n })\n } catch (error) {\n lastTransient = {\n delivered: false,\n reason: 'transport',\n detail: `could not reach Slack: ${error instanceof Error ? error.message : String(error)}`,\n }\n if (attempt < attempts) await sleep(Math.min(500 * 2 ** (attempt - 1), 8_000))\n continue\n } finally {\n clearTimeout(timer)\n }\n\n if (response.status === 429 || response.status >= 500) {\n lastTransient = {\n delivered: false,\n reason: response.status === 429 ? 'rate-limited' : 'transport',\n detail: `Slack returned ${response.status}`,\n }\n if (attempt < attempts) await sleep(retryDelayMs(response, attempt))\n continue\n }\n\n // Everything below is a settled answer. BOTH transports put the verdict in\n // the BODY under a 200 — the API as `{\"ok\":false,\"error\":…}`, a webhook as\n // an error token where the literal `ok` should be — so a status check alone\n // reads a revoked credential as a delivered page. That misreading is why\n // this module exists.\n return transport.kind === 'token'\n ? await settleTokenResponse(response, transport.channel)\n : await settleWebhookResponse(response)\n }\n\n return lastTransient\n}\n\ntype SlackTransport =\n | { kind: 'token'; token: string; channel: string }\n | { kind: 'webhook'; url: string }\n\nfunction requestUrl(transport: SlackTransport): string {\n return transport.kind === 'token' ? `${SLACK_API}/chat.postMessage` : transport.url\n}\n\nfunction requestHeaders(transport: SlackTransport): Record<string, string> {\n const headers: Record<string, string> = { 'Content-Type': 'application/json; charset=utf-8' }\n // The token rides a header, never a query string: a URL is logged by proxies\n // and retained in error messages; a header is not. (A webhook URL IS the\n // credential and has no such option — one more reason to prefer a token.)\n if (transport.kind === 'token') headers.Authorization = `Bearer ${transport.token}`\n return headers\n}\n\nfunction requestBody(transport: SlackTransport, text: string): Record<string, string> {\n // A webhook carries its own channel, fixed when it was created; naming one\n // here would be ignored at best and rejected at worst.\n return transport.kind === 'token' ? { channel: transport.channel, text } : { text }\n}\n\nasync function settleTokenResponse(\n response: Response,\n channel: string,\n): Promise<SlackAlertOutcome> {\n let body: { ok?: boolean; error?: string; channel?: string; ts?: string }\n try {\n body = (await response.json()) as typeof body\n } catch {\n return {\n delivered: false,\n reason: 'api',\n detail: `Slack returned ${response.status} with an unreadable body`,\n }\n }\n if (body.ok === true) {\n return { delivered: true, channel: body.channel ?? channel, ts: body.ts ?? '' }\n }\n return classifySlackError(body.error ?? `http_${response.status}`, channel)\n}\n\n/**\n * A webhook confirms delivery with a 2xx AND the literal three-byte body `ok`.\n * A revoked one answers `no_service` / `no_team`, sometimes under a 200. Both\n * halves are required: this is the shape `agent-container` proved against a\n * stand-in webhook, where a healthy, a revoked and a deleted webhook produced\n * byte-identical output under a status-only check.\n */\nasync function settleWebhookResponse(response: Response): Promise<SlackAlertOutcome> {\n const body = (await response.text().catch(() => '')).trim()\n if (response.ok && body === 'ok') {\n // A webhook reports neither the channel it posted to nor a message id.\n return { delivered: true, channel: '(webhook)', ts: '' }\n }\n const error = body || `http_${response.status}`\n const reason: SlackFailureReason = WEBHOOK_CREDENTIAL_ERRORS.has(error)\n ? 'credential'\n : WEBHOOK_CHANNEL_ERRORS.has(error)\n ? 'channel'\n : 'api'\n return {\n delivered: false,\n reason,\n detail:\n reason === 'credential'\n ? `the Slack webhook is revoked (${error}) — no alert can arrive until a human mints a new one. ` +\n 'Prefer replacing it with a bot token, whose liveness can be checked before an alert needs it.'\n : reason === 'channel'\n ? `Slack refused the webhook's channel (${error}) — the channel was archived, or the app lost access.`\n : `Slack refused the webhook post (${error}).`,\n }\n}\n\n/** Webhook error tokens that mean the webhook itself is gone. */\nconst WEBHOOK_CREDENTIAL_ERRORS = new Set(['no_service', 'no_team', 'invalid_token'])\n\n/** Webhook error tokens that mean the webhook is valid but its channel is not usable. */\nconst WEBHOOK_CHANNEL_ERRORS = new Set(['channel_not_found', 'channel_is_archived', 'action_prohibited'])\n\n/** Define configuration options for verifying that a Slack bot token is live */\nexport interface SlackCredentialCheckOptions {\n token: string | undefined\n /** Per-request deadline. Default 10s. */\n timeoutMs?: number\n /** Injection seam for tests; defaults to global `fetch`. */\n fetchImpl?: typeof fetch\n}\n\n/** What `checkSlackCredential` concluded. `team`/`botId` are present only when live. */\nexport type SlackCredentialVerdict =\n | { live: true; team: string; botId: string }\n | { live: false; reason: SlackFailureReason; detail: string }\n\n/**\n * Ask Slack whether the bot token is alive, WITHOUT posting anything.\n *\n * This is the check that was missing. An incoming webhook offers no equivalent\n * — the only way to test one is to post to it — which is how a revoked webhook\n * sat in a repo secret for months looking configured. Wire it into `/preflight`\n * so a dead alerting channel fails a deploy rather than an incident.\n */\nexport async function checkSlackCredential(\n options: SlackCredentialCheckOptions,\n): Promise<SlackCredentialVerdict> {\n const token = options.token?.trim()\n if (!token) {\n return {\n live: false,\n reason: 'not-configured',\n detail: 'no Slack bot token configured — set SLACK_BOT_TOKEN',\n }\n }\n const fetchImpl = options.fetchImpl ?? fetch\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? DEFAULT_TIMEOUT_MS)\n try {\n const response = await fetchImpl(`${SLACK_API}/auth.test`, {\n method: 'POST',\n headers: { Authorization: `Bearer ${token}` },\n signal: controller.signal,\n })\n const body = (await response.json()) as {\n ok?: boolean\n error?: string\n team?: string\n bot_id?: string\n }\n if (body.ok === true) {\n return { live: true, team: body.team ?? 'unknown', botId: body.bot_id ?? 'unknown' }\n }\n const outcome = classifySlackError(body.error ?? `http_${response.status}`, '(auth.test)')\n // `classifySlackError` is shaped for a post; auth.test only ever answers\n // about the credential, so a non-credential code here still means the\n // token cannot be used.\n return {\n live: false,\n reason: outcome.reason === 'channel' ? 'credential' : outcome.reason,\n detail: outcome.detail,\n }\n } catch (error) {\n return {\n live: false,\n reason: 'transport',\n detail: `could not reach Slack: ${error instanceof Error ? error.message : String(error)}`,\n }\n } finally {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,MACN,QAAQ,QAAQ,WAAW,YAAY,eAAe,QAAQ;AAAA,MAC9D,QAAQ,QAAQ;AAAA,IAClB;AAAA,EACF,SAAS,OAAO;AACd,WAAO;AAAA,MACL,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ,0BAA0B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,IAC1F;AAAA,EACF,UAAE;AACA,iBAAa,KAAK;AAAA,EACpB;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/harness/index.ts","../src/harness/session-selection.ts","../src/harness/presets.ts"],"sourcesContent":["/**\n * Coding-agent harness selection, model compatibility, and the session lock.\n *\n * Known identities are not a deployment's available runners. Products supply\n * server-owned availability to resolveSessionHarness. Historical session IDs\n * remain intact when their runner is unavailable; a harness change requires an\n * explicit transfer, not a fallback or a rewritten session lock.\n *\n * Model compatibility is owned by @tangle-network/agent-interface. The shell\n * owns session selection; the consumer owns storage and deployment policy.\n */\n\nimport {\n harnessProviders,\n harnessSupportsModel,\n harnessTypeSchema,\n modelProvider,\n preferredHarnessForModel,\n snapHarnessToModel as aiSnapHarnessToModel,\n snapModelToHarness as aiSnapModelToHarness,\n type HarnessType,\n} from '@tangle-network/agent-interface'\nimport {\n selectSessionHarness,\n type HarnessAvailability as SelectionAvailability,\n type SessionHarnessSelection,\n type SessionHarnessSelectionInput,\n} from './session-selection'\n\nexport { HarnessSelectionError } from './session-selection'\n\n/** Canonical identities that have no direct Sandbox backend. */\nconst NON_BACKEND_HARNESSES = ['gemini'] as const satisfies readonly HarnessType[]\nconst nonBackendHarnesses = new Set<string>(NON_BACKEND_HARNESSES)\n\n/** A recognized coding-agent backend, not a promise that it is installed. */\nexport type Harness = Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]>\n\n/**\n * Recognized backend identities, including IDs needed by historical sessions.\n * Use deployment availability, not membership here, to offer or admit new runs.\n */\nexport const KNOWN_HARNESSES: readonly Harness[] = [\n ...harnessTypeSchema.options.filter(\n (harness): harness is Exclude<HarnessType, (typeof NON_BACKEND_HARNESSES)[number]> =>\n !nonBackendHarnesses.has(harness),\n ),\n]\n\n/** Default for an absent choice; never a replacement for an invalid explicit ID. */\nexport const DEFAULT_HARNESS: Harness = 'opencode'\nconst HARNESS_SET: ReadonlySet<string> = new Set(KNOWN_HARNESSES)\n\n/** Determine whether a value is a recognized identity, independently of availability. */\nexport function isHarness(value: unknown): value is Harness {\n return typeof value === 'string' && HARNESS_SET.has(value)\n}\n\n/** Display/config convenience only. Never use coercion to admit an execution or restore a lock. */\nexport function coerceHarness(value: unknown, fallback: Harness = DEFAULT_HARNESS): Harness {\n return isHarness(value) ? value : fallback\n}\n\n/** Server-owned start and resume sets. Existing-only entries are draining. */\nexport type HarnessAvailability = SelectionAvailability<Harness>\n\n/** A saved lock, explicit choice, workspace default, and optional deployment availability. */\nexport type ResolveSessionHarnessInput = SessionHarnessSelectionInput<Harness>\n\n/** The selected identity and the existing session-lock/swap-attempt result. */\nexport type ResolvedSessionHarness = SessionHarnessSelection<Harness>\n\n/**\n * Resolve requested → workspaceDefault → fallback only for a genuinely new session.\n * A non-null saved identity always takes the lock path. Unknown/retired identities\n * and invalid explicit requests throw HarnessSelectionError instead of falling back.\n * A known different request still reports swapAttempted while preserving the lock.\n * The caller must reject that attempt before execution, as in the existing contract.\n */\nexport function resolveSessionHarness(input: ResolveSessionHarnessInput = {}): ResolvedSessionHarness {\n return selectSessionHarness(input, KNOWN_HARNESSES, DEFAULT_HARNESS)\n}\n\n/**\n * An app's harness configuration, read from its deploy configuration (for example the env vars\n * `AGENT_HARNESS` and `AGENT_HARNESS_WORKSPACES`), so no product hard-codes `backend.type`.\n */\nexport interface HarnessConfig {\n /** The app default for new sessions. Unset or blank means {@link DEFAULT_HARNESS}. */\n default?: string\n /** Per-workspace choices: a JSON object mapping a workspace id to a harness. */\n workspaces?: string\n}\n\nfunction configHarness(value: unknown, where: string): Harness {\n if (!isHarness(value)) throw new Error(`${where} names an unknown harness: ${String(value)}`)\n return value\n}\n\n/**\n * The harness a workspace's new sessions start on: its own choice, else the app default, else\n * {@link DEFAULT_HARNESS}. Pass the result to {@link resolveSessionHarness} as `workspaceDefault`\n * so a session that already ran keeps its harness. A value naming an unknown harness throws:\n * a configuration typo must fail loudly, never run a different harness than the one configured.\n */\nexport function configuredHarness(config: HarnessConfig, workspaceId?: string): Harness {\n const appDefault = config.default?.trim()\n ? configHarness(config.default.trim(), 'The harness default') : DEFAULT_HARNESS\n const raw = config.workspaces?.trim()\n if (!raw) return appDefault\n let choices: unknown\n try {\n choices = JSON.parse(raw)\n } catch {\n throw new Error('The per-workspace harness configuration is not JSON')\n }\n if (!choices || typeof choices !== 'object' || Array.isArray(choices)) {\n throw new Error('The per-workspace harness configuration must map workspace ids to harnesses')\n }\n // Every entry is checked, not only the caller's, so one bad entry fails every workspace's\n // first turn after the deploy instead of hiding until that workspace sends a message.\n const parsed = new Map(Object.entries(choices).map(([id, value]) =>\n [id, configHarness(value, `The harness for workspace ${id}`)]))\n return (workspaceId === undefined ? undefined : parsed.get(workspaceId)) ?? appDefault\n}\n\n/** Harness-model compatibility is delegated to the Interface owner. */\nexport { modelProvider }\n\n/** A resolved model and the transport provider that will execute it. */\nexport interface HarnessModelSelection {\n model: string\n provider?: string\n}\n\n/** Provider-less ids (sentinels like \"default\", or a session's own config) are\n * compatible everywhere — every harness honors its own configuration. */\nexport function isModelCompatibleWithHarness(harness: Harness, modelId: string): boolean {\n return harnessSupportsModel(harness, modelId)\n}\n\n/** Keep `modelId` when the harness can run it; else the harness's best compatible\n * catalog id (preferred patterns in order, highest version). When nothing in the\n * catalog fits, return the original so the caller sees the incompatibility. */\nexport function snapModelToHarness(harness: Harness, modelId: string, canonicalIds: readonly string[]): string {\n return aiSnapModelToHarness(harness, modelId, canonicalIds)\n}\n\n/** Keep the harness when it can run `modelId`; else the model's native harness\n * (anthropic → claude-code, openai → codex, moonshot → kimi-code), falling back to opencode. */\nexport function snapHarnessToModel(harness: Harness, modelId: string): Harness {\n const snapped = aiSnapHarnessToModel(harness, modelId)\n if (!isHarness(snapped)) {\n throw new Error(\n `Harness \"${harness}\" snapped to \"${snapped}\" for model \"${modelId}\", which this platform has no backend for.`,\n )\n }\n return snapped\n}\n\n/** Fail-loud server guard: throw when a harness is asked to run a model it can't.\n * A resolved model tuple supplies provider evidence when its id is unqualified.\n * Call before dispatching a sandbox turn so a bypassed UI cannot reach the\n * sidecar with an incompatible or unproven pair. */\nexport function assertHarnessModelCompatible(\n harness: Harness,\n selection: string | HarnessModelSelection,\n): void {\n const modelId = typeof selection === 'string' ? selection : selection.model\n const transportProvider = typeof selection === 'string' ? undefined : selection.provider\n const providers = harnessProviders(harness)\n const provider = modelProvider(modelId) ?? transportProvider ?? null\n // An omitted/default model is deliberately left to the harness. Once a\n // caller names a model, however, a vendor-locked harness must have provider\n // evidence. Interface owns which harnesses are locked: since 5.7 Claude Code\n // and Codex run any Router-served model, and kimi-code stays Moonshot-only.\n const isDefaultSentinel = modelId.trim() === '' || modelId.trim() === 'default'\n const compatible = isDefaultSentinel\n || providers === null\n || (provider !== null && providers.includes(provider))\n if (!compatible) {\n const native = preferredHarnessForModel(modelId)\n const providerDescription = provider ?? 'unqualified'\n throw new Error(\n `Harness \"${harness}\" cannot run model \"${modelId}\" (provider \"${providerDescription}\"). ` +\n `Use ${native ?? 'a router-backed harness (opencode)'} or an allowed model.`,\n )\n }\n}\n\n// Profile-support facts remain here until the materializer supplies its owned descriptor.\n// Do not confuse these facts with deployment availability.\n\n/** What a harness can express, for profile assembly. */\nexport interface HarnessCapabilities {\n /** Lower profile.subagents into native cwd files; false means materialization refuses them. */\n subagents: boolean\n /** How profile.mcp reaches the harness. */\n mcp: 'native' | 'config-file' | 'extension' | 'none'\n /** Whether tool controls are checked before MCP tools register. */\n toolControls: 'startup' | 'runtime'\n /** cwd-relative skill directory, or null when skills must be inlined. */\n skillsDir: string | null\n}\n\nconst HARNESS_CAPABILITIES: Record<Harness, HarnessCapabilities> = {\n 'claude-code': { subagents: true, mcp: 'native', toolControls: 'runtime', skillsDir: '.claude/skills' },\n nanoclaw: { subagents: true, mcp: 'native', toolControls: 'runtime', skillsDir: '.claude/skills' },\n opencode: { subagents: true, mcp: 'config-file', toolControls: 'runtime', skillsDir: '.opencode/skills' },\n codex: { subagents: true, mcp: 'config-file', toolControls: 'runtime', skillsDir: '.codex/skills' },\n 'kimi-code': { subagents: false, mcp: 'config-file', toolControls: 'runtime', skillsDir: '.kimi/skills' },\n pi: { subagents: false, mcp: 'extension', toolControls: 'startup', skillsDir: '.pi/skills' },\n prime: { subagents: true, mcp: 'native', toolControls: 'runtime', skillsDir: '.prime/agent/skills' },\n hermes: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n openclaw: { subagents: false, mcp: 'config-file', toolControls: 'runtime', skillsDir: 'skills' },\n acp: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n amp: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n 'factory-droids': { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n forge: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n cursor: { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n 'cli-base': { subagents: false, mcp: 'native', toolControls: 'runtime', skillsDir: null },\n}\n\n/** Profile-support facts, independent of whether this deployment enables the harness. */\nexport function harnessCapabilities(harness: Harness): HarnessCapabilities {\n const caps = HARNESS_CAPABILITIES[harness]\n if (!caps) throw new Error(`harnessCapabilities: no capability facts for \"${harness}\"`)\n return caps\n}\n\n// ── Session presets ────────────────────────────────────────────────────────\n//\n// Named (model, harness, effort) pins applied with catalog coherence through\n// the snap helpers above. The contract is semantics; the visual surface stays\n// with the picker canon.\nexport {\n applySessionPreset,\n createInMemorySessionPresetStore,\n validateSessionPreset,\n type AppliedSessionPreset,\n type SessionPreset,\n type SessionPresetCatalogContext,\n type SessionPresetStore,\n} from './presets'\n","/** Pure session admission. Harness identity is not deployment availability. */\nexport interface HarnessAvailability<H extends string> {\n /** Server-owned selection for new sessions. An empty list disables all starts. */\n readonly newSessions: readonly H[]\n /** Includes draining harnesses. Omission uses newSessions, never all known IDs. */\n readonly existingSessions?: readonly H[]\n}\n\nexport interface SessionHarnessSelectionInput<H extends string> {\n sessionHarness?: unknown\n requested?: unknown\n workspaceDefault?: unknown\n fallback?: H\n /** Omit only when the caller deliberately admits every known harness. */\n availability?: HarnessAvailability<H>\n}\n\nexport interface SessionHarnessSelection<H extends string> {\n harness: H\n locked: boolean\n swapAttempted: boolean\n}\n\ntype SelectionSource = 'session' | 'requested' | 'workspace' | 'fallback'\n\n/** An admission failure, never permission to retry on another harness. */\nexport class HarnessSelectionError extends Error {\n readonly code: 'harness_unknown' | 'harness_unavailable'\n readonly harness: string | null\n readonly source: SelectionSource\n\n constructor(\n code: 'harness_unknown' | 'harness_unavailable',\n value: unknown,\n source: SelectionSource,\n ) {\n const harness = typeof value === 'string' ? value : null\n super(`${code}: ${source} harness ${harness === null ? '<invalid>' : JSON.stringify(harness)}`)\n this.name = 'HarnessSelectionError'\n this.code = code\n this.harness = harness\n this.source = source\n }\n}\n\n/**\n * Null/undefined mean no choice. Every other value is an explicit choice and must\n * validate. A retired or unrecognized saved identity must never become a new session.\n * Availability is supplied by the authenticated server, not by a request body.\n */\nexport function selectSessionHarness<H extends string>(\n input: SessionHarnessSelectionInput<H>,\n knownHarnesses: readonly H[],\n defaultHarness: H,\n): SessionHarnessSelection<H> {\n const known = new Set<string>(knownHarnesses)\n const resolve = (value: unknown, source: SelectionSource): H => {\n if (typeof value !== 'string' || !known.has(value)) {\n throw new HarnessSelectionError('harness_unknown', value, source)\n }\n return value as H\n }\n const admit = (harness: H, source: SelectionSource, existing: boolean): void => {\n if (input.availability === undefined) return\n const allowed = existing\n ? input.availability.existingSessions ?? input.availability.newSessions\n : input.availability.newSessions\n if (!allowed.includes(harness)) {\n throw new HarnessSelectionError('harness_unavailable', harness, source)\n }\n }\n\n if (input.sessionHarness !== undefined && input.sessionHarness !== null) {\n const harness = resolve(input.sessionHarness, 'session')\n admit(harness, 'session', true)\n // A known different request remains a swap attempt; it is not executed. An\n // invalid request is refused rather than being misreported as no swap.\n const requested = input.requested === undefined || input.requested === null\n ? undefined : resolve(input.requested, 'requested')\n return { harness, locked: true, swapAttempted: requested !== undefined && requested !== harness }\n }\n\n const source: SelectionSource = input.requested !== undefined && input.requested !== null\n ? 'requested'\n : input.workspaceDefault !== undefined && input.workspaceDefault !== null\n ? 'workspace' : 'fallback'\n const value = source === 'requested' ? input.requested\n : source === 'workspace' ? input.workspaceDefault : input.fallback ?? defaultHarness\n const harness = resolve(value, source)\n admit(harness, source, false)\n return { harness, locked: false, swapAttempted: false }\n}\n","/**\n * Session presets — named (model, harness, effort) combinations a user pins\n * and applies in one action, beside the canonical session controls\n * (`/web-react`'s `AgentSessionControls`).\n *\n * The CONTRACT is coherence, not storage: a preset stores exact catalog ids,\n * and APPLYING it resolves through the harness module's snap helpers so the\n * result is never an invalid combination — if the catalog moved under a\n * pinned preset (model renamed, harness retired), apply snaps to the\n * harness's best compatible catalog option (or the model's native harness)\n * exactly like a manual picker change would, and reports what changed.\n * A preset naming a model the catalog no longer carries is REFUSED at\n * apply time, never silently substituted: a different model is a different\n * decision-maker.\n *\n * Storage is a port: products persist presets wherever they keep workspace\n * state (D1, KV, localStorage). The default store is in-memory for tests\n * and single-instance products — the same shape the self-mount verb uses.\n */\nimport { snapHarnessToModel, snapModelToHarness, type Harness } from './index'\n\n/** A pinned session configuration. `id` is the product's stable key. */\nexport interface SessionPreset {\n readonly id: string\n /** User-facing label; trimmed, non-empty, ≤ 60 chars. */\n readonly name: string\n /** Canonical catalog model id (\"provider/model\"). */\n readonly model: string\n /** Optional pinned harness; omitted = follow the model's native harness. */\n readonly harness?: Harness\n /** Optional pinned reasoning effort (the picker canon's effort levels). */\n readonly effort?: string\n}\n\n/** What applying a preset actually set, with every snap named. */\nexport interface AppliedSessionPreset {\n readonly model: string\n readonly harness: Harness\n readonly effort?: string\n /** Non-empty when the catalog moved under the pinned preset. */\n readonly snapped: ReadonlyArray<'model' | 'harness'>\n}\n\nexport interface SessionPresetCatalogContext {\n /** The catalog's canonical model ids. */\n readonly canonicalIds: readonly string[]\n}\n\n/** Validate one preset at save time: label budget, canonical model id, no\n * unknown fields smuggled in. Throws with the preset's name in the message. */\nexport function validateSessionPreset(preset: SessionPreset): SessionPreset {\n const name = preset.name.trim()\n if (!name) throw new Error('a session preset needs a name')\n if (name.length > 60) {\n throw new Error(`session preset \"${name.slice(0, 30)}…\" exceeds the 60-character name budget`)\n }\n if (!preset.model.trim()) throw new Error(`session preset \"${name}\" pins no model`)\n const allowed = new Set(['id', 'name', 'model', 'harness', 'effort'])\n for (const key of Object.keys(preset)) {\n if (!allowed.has(key)) throw new Error(`session preset \"${name}\" carries an unknown field \"${key}\"`)\n }\n return { ...preset, name }\n}\n\n/** Apply a preset with catalog coherence. Refused (thrown) when the pinned\n * model is gone from the catalog — never silently another model. */\nexport function applySessionPreset(\n preset: SessionPreset,\n context: SessionPresetCatalogContext,\n): AppliedSessionPreset {\n if (!context.canonicalIds.includes(preset.model)) {\n throw new Error(\n `session preset \"${preset.name}\" pins model \"${preset.model}\", which the catalog no longer carries — `\n + `delete or re-pin the preset (a different model is a different decision-maker)`,\n )\n }\n const snapped: Array<'model' | 'harness'> = []\n const pinnedHarness = preset.harness ?? snapHarnessToModel('opencode', preset.model)\n let model = preset.model\n let harness = pinnedHarness\n // The same two-way coherence the manual pickers enforce, in the preset's\n // own order: the pinned harness snaps the model if incompatible, then the\n // (possibly snapped) model snaps the harness back if it moved families.\n const harnessCompatibleModel = snapModelToHarness(harness, model, context.canonicalIds)\n if (harnessCompatibleModel !== model) {\n model = harnessCompatibleModel\n snapped.push('model')\n }\n const modelNativeHarness = snapHarnessToModel(harness, model)\n if (modelNativeHarness !== harness) {\n harness = modelNativeHarness\n snapped.push('harness')\n }\n return {\n model,\n harness,\n ...(preset.effort !== undefined ? { effort: preset.effort } : {}),\n snapped,\n }\n}\n\n/** Durable preset storage port. Products own persistence; the default is\n * non-durable for tests and single-instance products. */\nexport interface SessionPresetStore {\n list(): Promise<readonly SessionPreset[]>\n save(preset: SessionPreset): Promise<void>\n remove(id: string): Promise<void>\n}\n\nexport function createInMemorySessionPresetStore(): SessionPresetStore {\n const state = new Map<string, SessionPreset>()\n return {\n async list() { return [...state.values()].sort((a, b) => a.name.localeCompare(b.name)) },\n async save(preset) { state.set(preset.id, validateSessionPreset(preset)) },\n async remove(id) { state.delete(id) },\n }\n}\n\n/**\n * The composer/controls integration seam: presets render beside the canonical\n * pickers (picker-canon geometry) and apply through {@link applySessionPreset};\n * saving captures the CURRENT picker selection verbatim. The visual surface is\n * deliberately not owned here — the picker canon and the product's design\n * tokens define it; this module guarantees the semantics underneath.\n */\n"],"mappings":";AAYA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,sBAAsB;AAAA,EACtB,sBAAsB;AAAA,OAEjB;;;ACKA,IAAM,wBAAN,cAAoC,MAAM;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,MACA,OACA,QACA;AACA,UAAM,UAAU,OAAO,UAAU,WAAW,QAAQ;AACpD,UAAM,GAAG,IAAI,KAAK,MAAM,YAAY,YAAY,OAAO,cAAc,KAAK,UAAU,OAAO,CAAC,EAAE;AAC9F,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,SAAS;AAAA,EAChB;AACF;AAOO,SAAS,qBACd,OACA,gBACA,gBAC4B;AAC5B,QAAM,QAAQ,IAAI,IAAY,cAAc;AAC5C,QAAM,UAAU,CAACA,QAAgBC,YAA+B;AAC9D,QAAI,OAAOD,WAAU,YAAY,CAAC,MAAM,IAAIA,MAAK,GAAG;AAClD,YAAM,IAAI,sBAAsB,mBAAmBA,QAAOC,OAAM;AAAA,IAClE;AACA,WAAOD;AA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