@deepseek-insight/dsi 0.5.5

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 (285) hide show
  1. package/LICENSE +204 -0
  2. package/README.md +98 -0
  3. package/bin/dsi.mjs +147 -0
  4. package/build/client/_app/immutable/assets/0.DqFt8jIM.css +2 -0
  5. package/build/client/_app/immutable/assets/2.YlW45hiM.css +1 -0
  6. package/build/client/_app/immutable/assets/codicon.Brq4_Ui5.ttf +0 -0
  7. package/build/client/_app/immutable/assets/editor.jjEx9u7D.css +1 -0
  8. package/build/client/_app/immutable/assets/settings-monaco.C1CMdMvw.css +1 -0
  9. package/build/client/_app/immutable/chunks/-g7BcI22.js +4 -0
  10. package/build/client/_app/immutable/chunks/08VXUWAP.js +1 -0
  11. package/build/client/_app/immutable/chunks/2irkVCIh.js +10 -0
  12. package/build/client/_app/immutable/chunks/43DmfD33.js +1 -0
  13. package/build/client/_app/immutable/chunks/6GKQw8m6.js +99 -0
  14. package/build/client/_app/immutable/chunks/6RTg0lbw.js +1 -0
  15. package/build/client/_app/immutable/chunks/9TvT6fta.js +120 -0
  16. package/build/client/_app/immutable/chunks/B1YSaoU7.js +96 -0
  17. package/build/client/_app/immutable/chunks/B2J2w5EN.js +1 -0
  18. package/build/client/_app/immutable/chunks/B5-_aFwp.js +2 -0
  19. package/build/client/_app/immutable/chunks/B8-Q2PIv.js +1 -0
  20. package/build/client/_app/immutable/chunks/B8J7ngcE.js +1 -0
  21. package/build/client/_app/immutable/chunks/B9JPFI3C.js +2 -0
  22. package/build/client/_app/immutable/chunks/BAZKJuQw.js +1 -0
  23. package/build/client/_app/immutable/chunks/BBKpNcUe.js +1 -0
  24. package/build/client/_app/immutable/chunks/BEEn4gHE.js +1 -0
  25. package/build/client/_app/immutable/chunks/BEtHBSE6.js +1 -0
  26. package/build/client/_app/immutable/chunks/BFoDCU3G.js +1 -0
  27. package/build/client/_app/immutable/chunks/BHtPwB2y.js +847 -0
  28. package/build/client/_app/immutable/chunks/BI-MrBd-.js +1 -0
  29. package/build/client/_app/immutable/chunks/BI4pMaIG.js +1 -0
  30. package/build/client/_app/immutable/chunks/BJL7RCQE.js +4 -0
  31. package/build/client/_app/immutable/chunks/BKxtCVv1.js +1 -0
  32. package/build/client/_app/immutable/chunks/BOfSXrr7.js +1 -0
  33. package/build/client/_app/immutable/chunks/BOotOW0E.js +1 -0
  34. package/build/client/_app/immutable/chunks/BTzV9O1M.js +3 -0
  35. package/build/client/_app/immutable/chunks/BW-FRVGs.js +1 -0
  36. package/build/client/_app/immutable/chunks/BWPQTe0t.js +1 -0
  37. package/build/client/_app/immutable/chunks/BYgofb2h.js +1 -0
  38. package/build/client/_app/immutable/chunks/Ba7i2nA0.js +1 -0
  39. package/build/client/_app/immutable/chunks/Bb19NAkg.js +1 -0
  40. package/build/client/_app/immutable/chunks/Bc_sGQ0U.js +1 -0
  41. package/build/client/_app/immutable/chunks/BeGwcela.js +1 -0
  42. package/build/client/_app/immutable/chunks/BeZqd5lB.js +1 -0
  43. package/build/client/_app/immutable/chunks/Beo7Z46k.js +7 -0
  44. package/build/client/_app/immutable/chunks/BhNEBkk_.js +39 -0
  45. package/build/client/_app/immutable/chunks/BifhSqXX.js +1 -0
  46. package/build/client/_app/immutable/chunks/Bjy-W4x2.js +81 -0
  47. package/build/client/_app/immutable/chunks/BlltJnm0.js +1 -0
  48. package/build/client/_app/immutable/chunks/Bn9NRi0R.js +168 -0
  49. package/build/client/_app/immutable/chunks/BnF5Jm-h.js +1 -0
  50. package/build/client/_app/immutable/chunks/Bp4uuUjI.js +3 -0
  51. package/build/client/_app/immutable/chunks/BrTsmS-o.js +57 -0
  52. package/build/client/_app/immutable/chunks/Bri6UV-V.js +1 -0
  53. package/build/client/_app/immutable/chunks/Btk-1DaX.js +1 -0
  54. package/build/client/_app/immutable/chunks/BwWrilGY.js +1 -0
  55. package/build/client/_app/immutable/chunks/Bxkupp3x.js +1 -0
  56. package/build/client/_app/immutable/chunks/Bz4Y3fRF.js +1 -0
  57. package/build/client/_app/immutable/chunks/C-OQMol4.js +1 -0
  58. package/build/client/_app/immutable/chunks/C-y9NEjX.js +1 -0
  59. package/build/client/_app/immutable/chunks/C1JXY9b5.js +30 -0
  60. package/build/client/_app/immutable/chunks/C2x7inlt.js +321 -0
  61. package/build/client/_app/immutable/chunks/C531GsRP.js +2 -0
  62. package/build/client/_app/immutable/chunks/C5TAQhFO.js +1 -0
  63. package/build/client/_app/immutable/chunks/C5_-GSwl.js +1 -0
  64. package/build/client/_app/immutable/chunks/C6lv30UQ.js +1 -0
  65. package/build/client/_app/immutable/chunks/C7h46wYY.js +1 -0
  66. package/build/client/_app/immutable/chunks/C8Ef5oNN.js +1 -0
  67. package/build/client/_app/immutable/chunks/CA_WNCsl.js +41 -0
  68. package/build/client/_app/immutable/chunks/CC2rA5mh.js +1 -0
  69. package/build/client/_app/immutable/chunks/CHdTS7qa.js +15 -0
  70. package/build/client/_app/immutable/chunks/CIPQ_RoX.js +1 -0
  71. package/build/client/_app/immutable/chunks/CJ_zvTBg.js +72 -0
  72. package/build/client/_app/immutable/chunks/CPEyWost.js +1 -0
  73. package/build/client/_app/immutable/chunks/CPgSxomx.js +1 -0
  74. package/build/client/_app/immutable/chunks/CRfGWb83.js +1 -0
  75. package/build/client/_app/immutable/chunks/CTgm3pse.js +1 -0
  76. package/build/client/_app/immutable/chunks/CVaqCwHa.js +1 -0
  77. package/build/client/_app/immutable/chunks/CWKM3f5q.js +1 -0
  78. package/build/client/_app/immutable/chunks/CWVpRRWx.js +162 -0
  79. package/build/client/_app/immutable/chunks/CXMH3UgJ.js +257 -0
  80. package/build/client/_app/immutable/chunks/CZ-RNlot.js +1 -0
  81. package/build/client/_app/immutable/chunks/CZXl7qUb.js +70 -0
  82. package/build/client/_app/immutable/chunks/C_N-eONP.js +1 -0
  83. package/build/client/_app/immutable/chunks/Cb1pwoev.js +1 -0
  84. package/build/client/_app/immutable/chunks/CcL1k2On.js +11 -0
  85. package/build/client/_app/immutable/chunks/CcWV7GYH.js +1 -0
  86. package/build/client/_app/immutable/chunks/CcwsVR0C.js +1 -0
  87. package/build/client/_app/immutable/chunks/Cd6K7Y8m.js +1 -0
  88. package/build/client/_app/immutable/chunks/CfSJPG6W.js +1 -0
  89. package/build/client/_app/immutable/chunks/CfZ7uSQe.js +38 -0
  90. package/build/client/_app/immutable/chunks/Cimd5fb3.js +1 -0
  91. package/build/client/_app/immutable/chunks/Cj-Zm41R.js +36 -0
  92. package/build/client/_app/immutable/chunks/CjZ_QSbm.js +1 -0
  93. package/build/client/_app/immutable/chunks/CkrcOjFY.js +1 -0
  94. package/build/client/_app/immutable/chunks/ClamHrr6.js +1 -0
  95. package/build/client/_app/immutable/chunks/Cm7r79vr.js +1 -0
  96. package/build/client/_app/immutable/chunks/CmbEK4CY.js +84 -0
  97. package/build/client/_app/immutable/chunks/CmvnEPtD.js +7 -0
  98. package/build/client/_app/immutable/chunks/CopQ2nXW.js +1 -0
  99. package/build/client/_app/immutable/chunks/CpzslTdj.js +1 -0
  100. package/build/client/_app/immutable/chunks/CsHVnZCH.js +1 -0
  101. package/build/client/_app/immutable/chunks/CsQS60Ue.js +1 -0
  102. package/build/client/_app/immutable/chunks/CuRJVwEq.js +1 -0
  103. package/build/client/_app/immutable/chunks/D-oSqn_W.js +1 -0
  104. package/build/client/_app/immutable/chunks/D-ptJ9y-.js +1 -0
  105. package/build/client/_app/immutable/chunks/D05T4iGw.js +1 -0
  106. package/build/client/_app/immutable/chunks/D0I62FkS.js +1 -0
  107. package/build/client/_app/immutable/chunks/D16vkywU.js +1 -0
  108. package/build/client/_app/immutable/chunks/D1qzYj9m.js +1 -0
  109. package/build/client/_app/immutable/chunks/D3hlyOfw.js +1 -0
  110. package/build/client/_app/immutable/chunks/D4gq_dik.js +1 -0
  111. package/build/client/_app/immutable/chunks/D7fX-3xy.js +1 -0
  112. package/build/client/_app/immutable/chunks/D8-5qLJg.js +231 -0
  113. package/build/client/_app/immutable/chunks/D8hlhfM3.js +1 -0
  114. package/build/client/_app/immutable/chunks/DAS1CLuE.js +24 -0
  115. package/build/client/_app/immutable/chunks/DGarjVZC.js +1 -0
  116. package/build/client/_app/immutable/chunks/DGd2pJF5.js +1 -0
  117. package/build/client/_app/immutable/chunks/DHpiXF5c.js +1 -0
  118. package/build/client/_app/immutable/chunks/DHwB1DNv.js +161 -0
  119. package/build/client/_app/immutable/chunks/DIMkf-bt.js +3 -0
  120. package/build/client/_app/immutable/chunks/DISqw1ZD.js +1 -0
  121. package/build/client/_app/immutable/chunks/DITEY8D_.js +62 -0
  122. package/build/client/_app/immutable/chunks/DL0yNkAA.js +1 -0
  123. package/build/client/_app/immutable/chunks/DL1Hc2zs.js +1 -0
  124. package/build/client/_app/immutable/chunks/DLOOos_8.js +292 -0
  125. package/build/client/_app/immutable/chunks/DMUM7wLl.js +1 -0
  126. package/build/client/_app/immutable/chunks/DPKol_4Z.js +139 -0
  127. package/build/client/_app/immutable/chunks/DS17s2tU.js +1 -0
  128. package/build/client/_app/immutable/chunks/DT7zqm-g.js +1 -0
  129. package/build/client/_app/immutable/chunks/DTj74zXo.js +1 -0
  130. package/build/client/_app/immutable/chunks/DV3o63ZY.js +1 -0
  131. package/build/client/_app/immutable/chunks/DVXVVWkX.js +129 -0
  132. package/build/client/_app/immutable/chunks/DWDfcLfy.js +206 -0
  133. package/build/client/_app/immutable/chunks/DXeGLmed.js +8 -0
  134. package/build/client/_app/immutable/chunks/DYqsupvX.js +1 -0
  135. package/build/client/_app/immutable/chunks/DZ6u0Z-K.js +1 -0
  136. package/build/client/_app/immutable/chunks/DZFCIeNp.js +1 -0
  137. package/build/client/_app/immutable/chunks/D_Lu-MrJ.js +1 -0
  138. package/build/client/_app/immutable/chunks/DauUninz.js +1 -0
  139. package/build/client/_app/immutable/chunks/DbInun42.js +1 -0
  140. package/build/client/_app/immutable/chunks/DbcKN35_.js +3 -0
  141. package/build/client/_app/immutable/chunks/DcZe4Woe.js +1 -0
  142. package/build/client/_app/immutable/chunks/DdL9SqIa.js +1 -0
  143. package/build/client/_app/immutable/chunks/De2hgUGE.js +1 -0
  144. package/build/client/_app/immutable/chunks/DezsRK8O.js +1 -0
  145. package/build/client/_app/immutable/chunks/Dg_UWGX7.js +24 -0
  146. package/build/client/_app/immutable/chunks/Dj2t5yNg.js +1 -0
  147. package/build/client/_app/immutable/chunks/DkqhCAOL.js +1 -0
  148. package/build/client/_app/immutable/chunks/DlQrSOw4.js +7 -0
  149. package/build/client/_app/immutable/chunks/DmHpPYUd.js +1 -0
  150. package/build/client/_app/immutable/chunks/Dmn-tsie.js +1 -0
  151. package/build/client/_app/immutable/chunks/DpFanUEy.js +298 -0
  152. package/build/client/_app/immutable/chunks/DqwfDHZH.js +89 -0
  153. package/build/client/_app/immutable/chunks/Dr0pcX_F.js +1 -0
  154. package/build/client/_app/immutable/chunks/DrH0SRf2.js +1 -0
  155. package/build/client/_app/immutable/chunks/DsF7k-Jl.js +1 -0
  156. package/build/client/_app/immutable/chunks/DtBGId5S.js +2 -0
  157. package/build/client/_app/immutable/chunks/DuM1hSCa.js +1 -0
  158. package/build/client/_app/immutable/chunks/Du_ODUAO.js +1 -0
  159. package/build/client/_app/immutable/chunks/DvCMcJ3P.js +1 -0
  160. package/build/client/_app/immutable/chunks/Dy-Kn_BL.js +1 -0
  161. package/build/client/_app/immutable/chunks/DzVMo6mB.js +62 -0
  162. package/build/client/_app/immutable/chunks/ESmLJICu.js +1 -0
  163. package/build/client/_app/immutable/chunks/FvmIjYaQ.js +1 -0
  164. package/build/client/_app/immutable/chunks/GBaNblmo.js +1 -0
  165. package/build/client/_app/immutable/chunks/HclGiUj8.js +1 -0
  166. package/build/client/_app/immutable/chunks/Ju5jF6hy.js +1 -0
  167. package/build/client/_app/immutable/chunks/KythIMN8.js +1 -0
  168. package/build/client/_app/immutable/chunks/LWre5GKl.js +40 -0
  169. package/build/client/_app/immutable/chunks/NEE52Syq.js +1 -0
  170. package/build/client/_app/immutable/chunks/No6lfiAw.js +1 -0
  171. package/build/client/_app/immutable/chunks/OmE6SGvs.js +106 -0
  172. package/build/client/_app/immutable/chunks/P_ok0Z_j.js +2 -0
  173. package/build/client/_app/immutable/chunks/PaZBB01u.js +1 -0
  174. package/build/client/_app/immutable/chunks/Rh9cy7xg.js +2 -0
  175. package/build/client/_app/immutable/chunks/SOo6toE5.js +1 -0
  176. package/build/client/_app/immutable/chunks/TNLUqJaC.js +1 -0
  177. package/build/client/_app/immutable/chunks/UNxFjlik.js +1 -0
  178. package/build/client/_app/immutable/chunks/UmdltqoE.js +1 -0
  179. package/build/client/_app/immutable/chunks/Z5eAx3Zn.js +1 -0
  180. package/build/client/_app/immutable/chunks/bTuwJoIa.js +1 -0
  181. package/build/client/_app/immutable/chunks/fmXr3nnJ.js +1 -0
  182. package/build/client/_app/immutable/chunks/fybaL0A-.js +1 -0
  183. package/build/client/_app/immutable/chunks/gp-XZpBa.js +3 -0
  184. package/build/client/_app/immutable/chunks/h-p5ZdY8.js +1 -0
  185. package/build/client/_app/immutable/chunks/hxYEUgOo.js +1 -0
  186. package/build/client/_app/immutable/chunks/i0VQdJtv.js +1 -0
  187. package/build/client/_app/immutable/chunks/i0X4ZdIN.js +1 -0
  188. package/build/client/_app/immutable/chunks/mVHw7KEX.js +7 -0
  189. package/build/client/_app/immutable/chunks/nDMCpPkF.js +1 -0
  190. package/build/client/_app/immutable/chunks/nr791fC2.js +1 -0
  191. package/build/client/_app/immutable/chunks/onAF5SnQ.js +1 -0
  192. package/build/client/_app/immutable/chunks/oz_6vUea.js +1 -0
  193. package/build/client/_app/immutable/chunks/qEGLx2Wc.js +78 -0
  194. package/build/client/_app/immutable/chunks/raVGrKQy.js +44 -0
  195. package/build/client/_app/immutable/chunks/sBoK_t0W.js +1 -0
  196. package/build/client/_app/immutable/chunks/sIEmSkn6.js +34 -0
  197. package/build/client/_app/immutable/chunks/wFIeY1Cf.js +88 -0
  198. package/build/client/_app/immutable/chunks/xihTtKlq.js +1 -0
  199. package/build/client/_app/immutable/chunks/zpcgJjUg.js +127 -0
  200. package/build/client/_app/immutable/entry/app.B2QxMn0t.js +2 -0
  201. package/build/client/_app/immutable/entry/start.BR3A4iFi.js +1 -0
  202. package/build/client/_app/immutable/nodes/0.B_ZEZy7b.js +1 -0
  203. package/build/client/_app/immutable/nodes/1.By3Gd2cs.js +1 -0
  204. package/build/client/_app/immutable/nodes/2.1TAwiWw1.js +69 -0
  205. package/build/client/_app/immutable/workers/css.worker-DRH2OcAG.js +93 -0
  206. package/build/client/_app/immutable/workers/html.worker-DQLddT9h.js +506 -0
  207. package/build/client/_app/immutable/workers/json.worker-D_Dqrls5.js +62 -0
  208. package/build/client/_app/immutable/workers/settings-editor-worker-D9zwrD0f.js +30 -0
  209. package/build/client/_app/immutable/workers/ts.worker-DkYoA6bF.js +67738 -0
  210. package/build/client/_app/immutable/workers/yaml.worker-BTGFEDOA.js +449 -0
  211. package/build/client/_app/version.json +1 -0
  212. package/build/client/favicon.svg +7 -0
  213. package/build/env.js +70 -0
  214. package/build/handler.js +23 -0
  215. package/build/index.js +146 -0
  216. package/build/server/chunks/chunks/a2a-protocol.js-C77mVg2Q.js +52 -0
  217. package/build/server/chunks/chunks/app-config.svelte.js-Co9jacqT.js +52 -0
  218. package/build/server/chunks/chunks/config.js-BBYogCe7.js +123 -0
  219. package/build/server/chunks/chunks/db.js-DcmO3JAx.js +120 -0
  220. package/build/server/chunks/chunks/db2.js-DBltVUGg.js +717 -0
  221. package/build/server/chunks/chunks/dsh-connection.js-DwihVtk_.js +1957 -0
  222. package/build/server/chunks/chunks/dsh-events.js-BtDxaV6Q.js +706 -0
  223. package/build/server/chunks/chunks/env.js-l0sNRNKZ.js +2 -0
  224. package/build/server/chunks/chunks/exports.js-DMiPee3x.js +263 -0
  225. package/build/server/chunks/chunks/goal-projection.js-0_34t60K.js +44 -0
  226. package/build/server/chunks/chunks/image-limits.js-BMPZ55kJ.js +186 -0
  227. package/build/server/chunks/chunks/insight-config.js-CfMPTA6Z.js +352 -0
  228. package/build/server/chunks/chunks/internal.js-CQzEjdyk.js +747 -0
  229. package/build/server/chunks/chunks/internal2.js-D-DAuSVh.js +22 -0
  230. package/build/server/chunks/chunks/server.js-DoCd0fEo.js +4104 -0
  231. package/build/server/chunks/chunks/shared.js-C4-Py8s_.js +775 -0
  232. package/build/server/chunks/chunks/state.js-CpmOS0a2.js +114 -0
  233. package/build/server/chunks/chunks/uneval.js-BJ9Qq2SF.js +488 -0
  234. package/build/server/chunks/chunks/utils.js-tOWCe9Wk.js +933 -0
  235. package/build/server/chunks/chunks/watcher.js-BelxjMOP.js +473 -0
  236. package/build/server/chunks/entries/endpoints/api/a2a/_id_/_server.ts.js-B4HUNFZv.js +37 -0
  237. package/build/server/chunks/entries/endpoints/api/a2a/_server.ts.js-JDV_oqbX.js +61 -0
  238. package/build/server/chunks/entries/endpoints/api/a2a/register/_server.ts.js-Dxwc-7-5.js +99 -0
  239. package/build/server/chunks/entries/endpoints/api/config/_server.ts.js-D8i35bGH.js +35 -0
  240. package/build/server/chunks/entries/endpoints/api/dsh/directory/_server.ts.js-CeBU1G85.js +43 -0
  241. package/build/server/chunks/entries/endpoints/api/dsh/pick-directory/_server.ts.js-CyrVUxv3.js +36 -0
  242. package/build/server/chunks/entries/endpoints/api/dsh/presets/_server.ts.js-qeO_1htT.js +33 -0
  243. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/attachment/_server.ts.js-DnHffohz.js +44 -0
  244. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/cancel/_server.ts.js-fm6MFyjP.js +33 -0
  245. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/catalog/_server.ts.js-wJ9V_Ue7.js +42 -0
  246. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/command/_server.ts.js-o83L4GUY.js +85 -0
  247. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/events/_server.ts.js-DLCHSC1M.js +212 -0
  248. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/fork/_server.ts.js-Ca6NU9HO.js +58 -0
  249. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/goal/_server.ts.js-RteR85vn.js +138 -0
  250. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/history/_server.ts.js-CEKDkK7v.js +55 -0
  251. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/models/_server.ts.js-D7ziyW3d.js +35 -0
  252. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/permission/_server.ts.js-DbkD4JZb.js +92 -0
  253. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/prompt/_server.ts.js-eOLNlf1-.js +94 -0
  254. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/rename/_server.ts.js-txQRocK9.js +57 -0
  255. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/respond/_server.ts.js-D3WGYzkE.js +69 -0
  256. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/select-model/_server.ts.js-g2GtvLTs.js +69 -0
  257. package/build/server/chunks/entries/endpoints/api/dsh/sessions/_server.ts.js-17yKojU_.js +85 -0
  258. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file/_server.ts.js-D16pEhvd.js +99 -0
  259. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file/save/_server.ts.js-BXpZNLK8.js +110 -0
  260. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file-bytes/_server.ts.js-hBlyjq-x.js +113 -0
  261. package/build/server/chunks/entries/endpoints/api/dsh/workspace-tree/_server.ts.js-KWRnsAkm.js +59 -0
  262. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_server.ts.js-DzNvvCxK.js +55 -0
  263. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_workspaceId_/delete/_server.ts.js-MK5925CY.js +45 -0
  264. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_workspaceId_/rename/_server.ts.js-w3Mo0nf7.js +63 -0
  265. package/build/server/chunks/entries/endpoints/api/prompts/_id_/_server.ts.js-CInfjM-i.js +64 -0
  266. package/build/server/chunks/entries/endpoints/api/prompts/_server.ts.js-C1lqP1OV.js +87 -0
  267. package/build/server/chunks/entries/endpoints/api/prompts/use/_server.ts.js-B36YMKMt.js +54 -0
  268. package/build/server/chunks/entries/endpoints/api/settings/_server.ts.js-CHvHNzeB.js +101 -0
  269. package/build/server/chunks/entries/pages/_error.svelte.js-BE3-BWDd.js +41 -0
  270. package/build/server/chunks/entries/pages/_layout.svelte.js-EFiihTdF.js +18 -0
  271. package/build/server/chunks/entries/pages/_layout.ts.js-CNSo-Z1U.js +22 -0
  272. package/build/server/chunks/entries/pages/_page.server.ts.js-Bk8UuUXA.js +85 -0
  273. package/build/server/chunks/entries/pages/_page.svelte.js-CfmKQYLK.js +13883 -0
  274. package/build/server/chunks/handler-BshnD4Y4.js +1735 -0
  275. package/build/server/chunks/index.js-I_pMeIwQ.js +3864 -0
  276. package/build/server/chunks/manifest.js-DwhpAk_y.js +273 -0
  277. package/build/server/chunks/nodes/0.js-DCyDo8-C.js +12 -0
  278. package/build/server/chunks/nodes/1.js-Dx7z_VWN.js +9 -0
  279. package/build/server/chunks/nodes/2.js-CLw9pxho.js +24 -0
  280. package/build/shims.js +33 -0
  281. package/package.json +65 -0
  282. package/template/.dsi/a2a.sqlite +0 -0
  283. package/template/.dsi/config.json +42 -0
  284. package/template/.dsi/prompts.sqlite +0 -0
  285. package/template/.dsi/settings.yaml +33 -0
@@ -0,0 +1,473 @@
1
+ import { c as readA2aConfig } from './insight-config.js-CfMPTA6Z.js';
2
+ import { i as insertWaiting, o as openA2aDb, s as settleRow, p as pruneTerminalBefore, l as listWaiting } from './db.js-DcmO3JAx.js';
3
+ import { g as getDshConnection } from './dsh-connection.js-DwihVtk_.js';
4
+ import { a as entryForEvent, h as historyToEvents } from './dsh-events.js-BtDxaV6Q.js';
5
+
6
+ //#region src/lib/server/a2a/matcher.ts
7
+ /**
8
+ * Classify a completed reply text against a delegation signature id.
9
+ *
10
+ * Tier 1 'exact' — the trimmed reply ENDS WITH `_a2a_:<id>;` (the
11
+ * instructed echo). "Trimmed" tolerates trailing
12
+ * whitespace AND trailing code fences (Task 2.2-T:
13
+ * "whitespace/code-fence around suffix → exact after
14
+ * trim" — LLMs close their fences after echoing).
15
+ * Tier 2 'attributed' — `_a2a_:<id>` appears anywhere in the text
16
+ * (echoed but not terminal — partial compliance).
17
+ * Tier 3 'none' — the signature is absent: watermark-crossed only;
18
+ * the watcher records replied_approx (certainty-
19
+ * named; never a confident claim).
20
+ *
21
+ * Case-tolerant on the `_a2a_` marker and the id (the composer may be
22
+ * typed in any case; ids are lowercase-canonical at mint/parse).
23
+ */
24
+ function classifyReply(replyText, id) {
25
+ const text = replyText.toLowerCase();
26
+ const needle = `_a2a_:${id.toLowerCase()}`;
27
+ let tail = text.trimEnd();
28
+ for (let i = 0; i < 3 && tail.endsWith("```"); i++) tail = tail.slice(0, -3).trimEnd();
29
+ if (tail.endsWith(needle + ";")) return "exact";
30
+ if (text.includes(needle)) return "attributed";
31
+ return "none";
32
+ }
33
+ //#endregion
34
+ //#region src/lib/server/a2a/watcher.ts
35
+ /**
36
+ * a2a-watcher (2026-08-25) — the two-lane delegation watcher: a cheap
37
+ * batched LIST every fastPollMs (ONE session.list per tick for ALL
38
+ * waiting targets), and a LEDGER read (history tail) only when a gate
39
+ * opens — a completed new turn. Zero model calls by construction: the
40
+ * watcher only READS spine rows and the ledger; any prompt/RPC that runs
41
+ * a model is outside these paths (3.1-T spy-asserts the absence).
42
+ *
43
+ * SEQ lane (2026-08-25 bug fix): live hosts ship no `sessionStats.turns`
44
+ * and their list projection's updatedAt/running never move on replies —
45
+ * the LIST gate is structurally dead there (probe-verified). Rows with a
46
+ * captured `watermark_seq` (the target ledger's newest event seq at
47
+ * send, from the register route) are probed on a throttled second lane:
48
+ * one history read per DISTINCT target per A2A_SEQ_PROBE_MS window; the
49
+ * newest assistant/message past the watermark settles the row at its
50
+ * true tier. Zero model calls still hold — history is a read.
51
+ *
52
+ * SPAN capture (2026-08-25 RCA #2, live a2a-30b51db8): a turn is N
53
+ * assistant bubbles (narration before tool calls + one final digest),
54
+ * but the delivered protocol line binds only the END — so `reply_text`
55
+ * holding just the newest message froze everything the target narrated
56
+ * on the way. Settle now stores the JOINED text of every assistant
57
+ * message in the exchange's span. The span anchor is the delivered
58
+ * prompt itself (the user message carrying `_a2a_:<id>;` — unique per
59
+ * delegation), NOT the register-time watermark: registration can land
60
+ * seconds after the prompt, by which time the target has already
61
+ * narrated past it. A LATER delegation's prompt bounds the span, so
62
+ * stacked mentions never swallow each other's replies. Classification
63
+ * is unchanged — the end-signature tier contract (ADR §4) still rules.
64
+ *
65
+ * ADR: dev/architectural-decission/2026-08-26 - The a2a Signature —
66
+ * Correlation IDs and the Delegation Ledger.md §5 (two-lane
67
+ * detection contract) + The Mention Watcher ADR (detection half).
68
+ * Spec: dev/specs/2026-08-25 - DSI a2a Signature and Delegation Ledger
69
+ * (PRD "Watcher sequence", tier map; Tasks 3.1/3.1-T).
70
+ *
71
+ * Module boundary (PRD communication map): watcher imports dsh-connection
72
+ * only — NEVER dsh-rpc directly; the matcher is pure; the db owns writes.
73
+ * Lifecycle: module-level singleton; registerWatch() ensures started;
74
+ * ticker stops at zero waiting; boot sweep resumes.
75
+ *
76
+ * Config sync (W4 4.1): readA2aConfig() is applied ONCE at boot, before
77
+ * the first sweep — runtime edits take effect on the next dev-server
78
+ * restart (the no-cache reader contract). Test fakes inject timings
79
+ * through configureWatcher; they run in files whose DSI_CONFIG_PATH is
80
+ * pinned to a tmp void, so the boot sync never clobbers them.
81
+ */
82
+ /** LIST-lane cadence — one batched session.list per tick (default 1s). */
83
+ var A2A_FAST_POLL_MS = 1e3;
84
+ /** Deadline for a reply before honest `timeout` (default 10 min). */
85
+ var A2A_WATCH_TIMEOUT_MS = 6e5;
86
+ /**
87
+ * SEQ-lane probe cadence (2026-08-25 bug fix): when the host ships no
88
+ * `sessionStats.turns` AND its list projection's updatedAt/running never
89
+ * move on replies (probe-verified live), the LIST gate is structurally
90
+ * dead — the target LEDGER's event seq is the only signal that moves.
91
+ * One history read per DISTINCT waiting target per window; zero model
92
+ * calls still hold (history is a read).
93
+ */
94
+ var A2A_SEQ_PROBE_MS = 5e3;
95
+ /**
96
+ * SEQ-lane quiescence (2026-08-25 RCA follow-up, risk 1 — mid-turn latch):
97
+ * the live host's `running` is inert, so the seq lane cannot ask "is the
98
+ * target done?". Instead it watches the tail itself: a settle is allowed
99
+ * only when the target's newest event seq has been UNCHANGED for this
100
+ * long. A turn still writing keeps moving the tail and resets the clock —
101
+ * the fragment-early settle (a2a-0e657adf) becomes impossible.
102
+ */
103
+ var A2A_QUIESCENCE_MS = 3e3;
104
+ /** Assemble one event's entry text via the shipped reader, or null. */
105
+ function entryText(h) {
106
+ const entry = entryForEvent(historyToEvents([h])[0]);
107
+ if (entry === null) return null;
108
+ if (entry.kind !== "assistant-message" && entry.kind !== "user-message") return null;
109
+ return typeof entry.text === "string" && entry.text !== "" ? entry.text : null;
110
+ }
111
+ /**
112
+ * Seq of the LAST user message carrying THIS exchange's signature — the
113
+ * delivered protocol line makes every delegation's prompt uniquely
114
+ * findable in the page (SPAN anchor #1). Null when the prompt is off the
115
+ * tail page or the sender carried no signature.
116
+ */
117
+ function promptAnchorSeq(page, id) {
118
+ let found = null;
119
+ for (const h of page.events) {
120
+ if (h.event.type !== "user/message") continue;
121
+ const text = entryText(h);
122
+ if (text === null) continue;
123
+ if (text.includes(`_a2a_:${id};`)) found = h.event.seq;
124
+ }
125
+ return found;
126
+ }
127
+ /**
128
+ * Seq of the first prompt of any LATER delegation (any `_a2a_:` marker)
129
+ * after `start` — the span's upper bound, so stacked mentions on one
130
+ * target never swallow each other's replies. Null when none follows.
131
+ */
132
+ function nextDelegationSeq(page, start) {
133
+ for (const h of page.events) {
134
+ if (h.event.seq <= start) continue;
135
+ if (h.event.type !== "user/message") continue;
136
+ const text = entryText(h);
137
+ if (text !== null && text.includes("_a2a_:a2a-")) return h.event.seq;
138
+ }
139
+ return null;
140
+ }
141
+ /**
142
+ * Newest finalized assistant bubble from a history tail page, or null —
143
+ * the LEGACY shape (pre-span): one message, no join. Kept as the
144
+ * no-anchor fallback so a page without resolvable anchors never
145
+ * over-captures history from before this exchange.
146
+ */
147
+ function extractLatestAssistantText(page) {
148
+ for (let i = page.events.length - 1; i >= 0; i--) {
149
+ const h = page.events[i];
150
+ if (h.event.type !== "assistant/message") continue;
151
+ const text = entryText(h);
152
+ if (text === null) continue;
153
+ const turn = h.event.data?.turn;
154
+ return {
155
+ text,
156
+ turn: typeof turn === "number" ? turn : -1
157
+ };
158
+ }
159
+ return null;
160
+ }
161
+ /**
162
+ * The exchange's full span (SPAN capture, 2026-08-25 RCA #2): every
163
+ * non-empty assistant message after the anchor, JOINED with blank lines
164
+ * — narration before tool calls included, empty tool-call bubbles
165
+ * dropped, `turn` from the newest contributing message.
166
+ *
167
+ * Anchor precedence: (1) the delivered prompt's own signature line —
168
+ * robust to late registration, which is exactly when a register-time
169
+ * watermark strands early narration below it; (2) the register-time seq
170
+ * watermark; (3) neither resolvable → legacy newest-only, never a
171
+ * whole-page guess. When (1) applies, the next delegation's prompt
172
+ * bounds the span (stacked mentions stay separate).
173
+ */
174
+ function extractReplySpan(page, id, fallbackSeq) {
175
+ const prompt = promptAnchorSeq(page, id);
176
+ const anchor = prompt ?? fallbackSeq;
177
+ if (anchor === null) {
178
+ const latest = extractLatestAssistantText(page);
179
+ return latest === null ? null : {
180
+ ...latest,
181
+ anchorSeq: -1
182
+ };
183
+ }
184
+ const bound = prompt === null ? null : nextDelegationSeq(page, prompt);
185
+ const parts = [];
186
+ for (const h of page.events) {
187
+ const seq = h.event.seq;
188
+ if (seq <= anchor) continue;
189
+ if (bound !== null && seq >= bound) break;
190
+ if (h.event.type !== "assistant/message") continue;
191
+ const text = entryText(h);
192
+ if (text === null) continue;
193
+ const turn = h.event.data?.turn;
194
+ parts.push({
195
+ text,
196
+ turn: typeof turn === "number" ? turn : -1
197
+ });
198
+ }
199
+ if (parts.length === 0) return null;
200
+ const last = parts[parts.length - 1];
201
+ return {
202
+ text: parts.map((p) => p.text).join("\n\n"),
203
+ turn: last.turn,
204
+ anchorSeq: anchor
205
+ };
206
+ }
207
+ /** exact→replied_exact · attributed→replied · none→replied_approx. */
208
+ var TIER_TO_STATE = {
209
+ exact: "replied_exact",
210
+ attributed: "replied",
211
+ none: "replied_approx"
212
+ };
213
+ /** Degrade-lane note (PRD risk 2: host drops sessionStats.turns). */
214
+ var TURNS_UNAVAILABLE = "turns unavailable — settled on updatedAt edge";
215
+ /** SEQ-lane degrade note — the list projection never moved (2026-08-25). */
216
+ var TURNS_UNAVAILABLE_SEQ = "turns unavailable — settled on ledger seq watermark";
217
+ var timer = null;
218
+ var pollMs = A2A_FAST_POLL_MS;
219
+ var timeoutMs = A2A_WATCH_TIMEOUT_MS;
220
+ var retentionDays = 90;
221
+ var probeWindowMs = A2A_SEQ_PROBE_MS;
222
+ var quiescenceMs = A2A_QUIESCENCE_MS;
223
+ var dshSurface;
224
+ var ticking = false;
225
+ var listCalls = 0;
226
+ var bootSwept = false;
227
+ /** SEQ lane throttle — target → last probe wall-clock (ms). */
228
+ var lastSeqProbe = /* @__PURE__ */ new Map();
229
+ /** SEQ lane quiescence — target → the tail seq first seen UNCHANGED, and when. */
230
+ var tailQuietSince = /* @__PURE__ */ new Map();
231
+ /**
232
+ * Config wiring (W4) — validated upstream by $lib/config gates; applied
233
+ * live: a fastPollMs change re-arms the ticker at the new cadence.
234
+ */
235
+ function configureWatcher(opts) {
236
+ if (opts.fastPollMs !== void 0) pollMs = opts.fastPollMs;
237
+ if (opts.watchTimeoutMs !== void 0) timeoutMs = opts.watchTimeoutMs;
238
+ if (opts.retentionDays !== void 0) retentionDays = opts.retentionDays;
239
+ if (opts.probeWindowMs !== void 0) probeWindowMs = opts.probeWindowMs;
240
+ if (opts.quiescenceMs !== void 0) quiescenceMs = opts.quiescenceMs;
241
+ if (opts.dsh !== void 0) dshSurface = opts.dsh;
242
+ if (timer !== null) {
243
+ clearInterval(timer);
244
+ timer = null;
245
+ if (pollMs > 0) armTicker();
246
+ }
247
+ }
248
+ /** Resolve the active DSH surface (injected fake or the real singleton). */
249
+ function surface() {
250
+ return dshSurface ?? getDshConnection();
251
+ }
252
+ /** Arm the interval (only when there is something to watch). */
253
+ function armTicker() {
254
+ if (timer !== null) return;
255
+ if (pollMs <= 0) return;
256
+ if (listWaiting().length === 0) return;
257
+ timer = setInterval(() => {
258
+ tick();
259
+ }, pollMs);
260
+ }
261
+ /**
262
+ * Ensure the watcher runs: boot sweep (once) + arm the ticker if rows
263
+ * are waiting. Idempotent — registerWatch and routes both call this.
264
+ */
265
+ function ensureStarted() {
266
+ if (!bootSwept) {
267
+ syncConfigFromInsight();
268
+ sweepOnBoot();
269
+ }
270
+ armTicker();
271
+ }
272
+ /**
273
+ * One-shot config sync at boot (W4 4.1): the file reader is the truth;
274
+ * explicit configureWatcher values always win (tests, future callers).
275
+ * Reads with NO path argument so the env seam (DSI_CONFIG_PATH) rules.
276
+ */
277
+ function syncConfigFromInsight() {
278
+ const cfg = readA2aConfig();
279
+ if (pollMs === 1e3) pollMs = cfg.fastPollMs;
280
+ if (timeoutMs === 6e5) timeoutMs = cfg.watchTimeoutMs;
281
+ if (retentionDays === 90) retentionDays = cfg.retentionDays;
282
+ }
283
+ /** Stop when nothing is left to watch (the only stop site — same module). */
284
+ function stopTickerIfIdle() {
285
+ if (timer !== null && listWaiting().length === 0) {
286
+ clearInterval(timer);
287
+ timer = null;
288
+ }
289
+ }
290
+ /**
291
+ * ONE tick = ONE batched session.list for ALL waiting targets, then the
292
+ * per-row gate; gate-open rows read the LEDGER once and settle at their
293
+ * tier. Timeout/gone are watcher-native (checked before any history read).
294
+ */
295
+ async function tick() {
296
+ if (ticking) return;
297
+ ticking = true;
298
+ try {
299
+ const waiting = listWaiting();
300
+ if (waiting.length === 0) {
301
+ stopTickerIfIdle();
302
+ return;
303
+ }
304
+ listCalls++;
305
+ const list = await surface().listSessions();
306
+ const spine = /* @__PURE__ */ new Map();
307
+ for (const row of list.items) spine.set(row.sessionId, row);
308
+ const ledgers = /* @__PURE__ */ new Map();
309
+ const seqLedgers = /* @__PURE__ */ new Map();
310
+ const now = Date.now();
311
+ for (const row of waiting) {
312
+ const target = spine.get(row.toSession);
313
+ if (target === void 0) {
314
+ settleRow({
315
+ id: row.id,
316
+ state: "gone",
317
+ error: `target ${row.toSession} left the spine`
318
+ });
319
+ continue;
320
+ }
321
+ if (now - row.sentAt >= timeoutMs) {
322
+ settleRow({
323
+ id: row.id,
324
+ state: "timeout",
325
+ error: `no reply within ${timeoutMs}ms`
326
+ });
327
+ continue;
328
+ }
329
+ if (gateOpen(row, target)) {
330
+ const group = ledgers.get(row.toSession);
331
+ if (group === void 0) ledgers.set(row.toSession, {
332
+ rows: [row],
333
+ target
334
+ });
335
+ else group.rows.push(row);
336
+ continue;
337
+ }
338
+ if (row.watermarkSeq !== null && now - (lastSeqProbe.get(row.toSession) ?? 0) >= probeWindowMs) {
339
+ const group = seqLedgers.get(row.toSession);
340
+ if (group === void 0) seqLedgers.set(row.toSession, {
341
+ rows: [row],
342
+ target
343
+ });
344
+ else group.rows.push(row);
345
+ }
346
+ }
347
+ for (const [sessionId, group] of ledgers) await settleViaHistory(sessionId, group.rows, group.target);
348
+ for (const [sessionId, group] of seqLedgers) {
349
+ lastSeqProbe.set(sessionId, now);
350
+ await settleViaSeqWatermark(sessionId, group.rows, group.target);
351
+ }
352
+ stopTickerIfIdle();
353
+ } catch {} finally {
354
+ ticking = false;
355
+ }
356
+ }
357
+ /**
358
+ * The gate: a NEW completed turn since the watermark, and not mid-run.
359
+ * turns null → degrade lane (updatedAt edge + running false), flagged
360
+ * `turns_unavailable` on settle.
361
+ */
362
+ function gateOpen(row, target) {
363
+ if (target.turns !== null) return target.turns > row.watermarkTurn && target.running === false;
364
+ return target.updatedAt > row.sentAt && target.running === false;
365
+ }
366
+ /**
367
+ * LEDGER lane: one history tail read for the target → per-row tier
368
+ * classification → single settle UPDATE each. A turn whose text carries
369
+ * the id for ANY waiting row settles that row (page-level per-row match).
370
+ */
371
+ async function settleViaHistory(sessionId, rows, target) {
372
+ let page;
373
+ try {
374
+ page = await surface().history(sessionId);
375
+ } catch {
376
+ return;
377
+ }
378
+ for (const row of rows) {
379
+ const span = extractReplySpan(page, row.id, row.watermarkSeq);
380
+ if (span === null) {
381
+ settleRow({
382
+ id: row.id,
383
+ state: "replied_approx",
384
+ error: "turn completed without assistant text"
385
+ });
386
+ continue;
387
+ }
388
+ const tier = classifyReply(span.text, row.id);
389
+ settleRow({
390
+ id: row.id,
391
+ state: TIER_TO_STATE[tier],
392
+ replyText: span.text,
393
+ replyTurn: span.turn,
394
+ ...target.turns === null ? { error: TURNS_UNAVAILABLE } : {}
395
+ });
396
+ }
397
+ }
398
+ /**
399
+ * SEQ lane (2026-08-25 fix): one history read per DISTINCT target per
400
+ * probe window; per row, the NEWEST finalized assistant message whose
401
+ * event seq exceeds the row's captured seq watermark is the reply.
402
+ *
403
+ * Quiescence gate (RCA follow-up, risk 1): the live host's `running` is
404
+ * inert, so "is the target done?" is answered by the tail itself — settle
405
+ * only when the target's newest event seq has been UNCHANGED for
406
+ * quiescenceMs. A turn still writing keeps moving the tail (every probe
407
+ * that sees a new tail records it and returns without settling); the
408
+ * first-ever probe also just records. Silence-then-settle means the
409
+ * FINAL message is the newest past the watermark — the fragment-early
410
+ * settle is impossible. Rows whose reply hasn't landed stay waiting; the
411
+ * deadline lane owns them if it never does.
412
+ */
413
+ async function settleViaSeqWatermark(sessionId, rows, target) {
414
+ let page;
415
+ try {
416
+ page = await surface().history(sessionId);
417
+ } catch {
418
+ return;
419
+ }
420
+ const tailSeq = page.events.length > 0 ? page.events[page.events.length - 1].event.seq : -1;
421
+ const quiet = tailQuietSince.get(sessionId);
422
+ const now = Date.now();
423
+ if (quiet === void 0 || quiet.seq !== tailSeq) {
424
+ tailQuietSince.set(sessionId, {
425
+ seq: tailSeq,
426
+ at: now
427
+ });
428
+ return;
429
+ }
430
+ if (now - quiet.at < quiescenceMs) return;
431
+ const degrade = target.turns === null ? { error: TURNS_UNAVAILABLE_SEQ } : {};
432
+ for (const row of rows) {
433
+ const span = extractReplySpan(page, row.id, row.watermarkSeq);
434
+ if (span === null) continue;
435
+ const tier = classifyReply(span.text, row.id);
436
+ settleRow({
437
+ id: row.id,
438
+ state: TIER_TO_STATE[tier],
439
+ replyText: span.text,
440
+ replyTurn: span.turn,
441
+ ...degrade
442
+ });
443
+ }
444
+ }
445
+ /**
446
+ * Sweep on boot (dev-server restart mid-watch): expire stale waiting rows
447
+ * past the deadline, prune terminal rows past retention, resume the
448
+ * ticker if waiting rows remain. Runs once per process before the first
449
+ * tick (ensureStarted guards with bootSwept).
450
+ */
451
+ function sweepOnBoot() {
452
+ bootSwept = true;
453
+ const db = openA2aDb();
454
+ const now = Date.now();
455
+ const stale = db.prepare(`SELECT id FROM a2a_exchange WHERE state = 'waiting' AND sent_at + ? <= ?`).all(timeoutMs, now);
456
+ for (const r of stale) settleRow({
457
+ id: r.id,
458
+ state: "timeout",
459
+ error: `no reply within ${timeoutMs}ms (boot sweep)`
460
+ }, db);
461
+ pruneTerminalBefore(now - retentionDays * 24 * 60 * 60 * 1e3, db);
462
+ }
463
+ /**
464
+ * Register a watch (INSERT waiting) and ensure the watcher runs. The
465
+ * registration route (3.2) calls this server-side at send.
466
+ */
467
+ function registerWatch(row) {
468
+ insertWaiting(row);
469
+ ensureStarted();
470
+ }
471
+
472
+ export { configureWatcher as c, ensureStarted as e, registerWatch as r };
473
+ //# sourceMappingURL=watcher.js-BelxjMOP.js.map
@@ -0,0 +1,37 @@
1
+ import { g as getRow } from '../../../../../chunks/db.js-DcmO3JAx.js';
2
+ import { j as json } from '../../../../../chunks/utils.js-tOWCe9Wk.js';
3
+ import '../../../../../chunks/insight-config.js-CfMPTA6Z.js';
4
+ import '../../../../../chunks/config.js-BBYogCe7.js';
5
+ import 'node:fs';
6
+ import 'node:path';
7
+ import 'node:os';
8
+ import 'yaml';
9
+ import 'node:sqlite';
10
+ import '../../../../../chunks/shared.js-C4-Py8s_.js';
11
+ import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
12
+
13
+ //#region src/routes/api/a2a/[id]/+server.ts
14
+ /**
15
+ * /api/a2a/[id] (2026-08-25) — one ledger row (debug-friendly single
16
+ * lookup; the chip join uses the list route).
17
+ *
18
+ * Spec: dev/specs/2026-08-25 - DSI a2a Signature and Delegation Ledger
19
+ * (PRD communication map; Tasks 3.2/3.2-T). 404 on unknown id.
20
+ */
21
+ var GET = ({ params }) => {
22
+ const row = getRow(params.id);
23
+ if (row === null) return json({
24
+ ok: false,
25
+ error: {
26
+ code: "not-found",
27
+ message: `no a2a exchange ${params.id}`
28
+ }
29
+ }, { status: 404 });
30
+ return json({
31
+ ok: true,
32
+ row
33
+ });
34
+ };
35
+
36
+ export { GET };
37
+ //# sourceMappingURL=_server.ts.js-B4HUNFZv.js.map
@@ -0,0 +1,61 @@
1
+ import { a as listRecent } from '../../../../chunks/db.js-DcmO3JAx.js';
2
+ import { e as ensureStarted } from '../../../../chunks/watcher.js-BelxjMOP.js';
3
+ import { j as json } from '../../../../chunks/utils.js-tOWCe9Wk.js';
4
+ import '../../../../chunks/insight-config.js-CfMPTA6Z.js';
5
+ import '../../../../chunks/config.js-BBYogCe7.js';
6
+ import 'node:fs';
7
+ import 'node:path';
8
+ import 'node:os';
9
+ import 'yaml';
10
+ import 'node:sqlite';
11
+ import '../../../../chunks/dsh-connection.js-DwihVtk_.js';
12
+ import '../../../../chunks/dsh-events.js-BtDxaV6Q.js';
13
+ import '../../../../chunks/shared.js-C4-Py8s_.js';
14
+ import '../../../../chunks/uneval.js-BJ9Qq2SF.js';
15
+
16
+ //#region src/routes/api/a2a/+server.ts
17
+ /**
18
+ * /api/a2a (2026-08-25) — the a2a read surface: recent ledger rows for the
19
+ * sender-panel chip join (W4), newest first, optional from-filter.
20
+ *
21
+ * Spec: dev/specs/2026-08-25 - DSI a2a Signature and Delegation Ledger
22
+ * (PRD communication map "routes → browser"; Tasks 3.2/3.2-T).
23
+ *
24
+ * Read-only: browser code never imports $lib/server (BC-2) — this JSON
25
+ * route is its only window onto the ledger. Never exposes the DB path.
26
+ *
27
+ * Boot re-arm (2026-08-25 RCA follow-up, risk 2): a dev-server restart
28
+ * mid-watch left waiting rows with a dead ticker until the next register.
29
+ * The browser chip already polls this route on the spine's 5s cadence —
30
+ * the idempotent ensureStarted() below means any open page revives the
31
+ * watcher within one cadence (and the once-per-process boot sweep expires
32
+ * stale rows honestly). The route stays read-only in the DB sense: it
33
+ * never writes rows itself.
34
+ */
35
+ var MAX_LIMIT = 100;
36
+ var DEFAULT_LIMIT = 20;
37
+ var GET = ({ url }) => {
38
+ ensureStarted();
39
+ const from = url.searchParams.get("from") ?? void 0;
40
+ const rawLimit = url.searchParams.get("limit");
41
+ let limit = DEFAULT_LIMIT;
42
+ if (rawLimit !== null) {
43
+ const parsed = Number.parseInt(rawLimit, 10);
44
+ if (Number.isNaN(parsed) || parsed < 1) return json({
45
+ ok: false,
46
+ error: {
47
+ code: "bad-limit",
48
+ message: "limit must be a positive integer"
49
+ }
50
+ }, { status: 400 });
51
+ limit = Math.min(parsed, MAX_LIMIT);
52
+ }
53
+ const rows = listRecent(limit, from);
54
+ return json({
55
+ ok: true,
56
+ rows
57
+ });
58
+ };
59
+
60
+ export { GET };
61
+ //# sourceMappingURL=_server.ts.js-JDV_oqbX.js.map
@@ -0,0 +1,99 @@
1
+ import { c as readA2aConfig } from '../../../../../chunks/insight-config.js-CfMPTA6Z.js';
2
+ import { g as getDshConnection } from '../../../../../chunks/dsh-connection.js-DwihVtk_.js';
3
+ import { c as configureWatcher, r as registerWatch } from '../../../../../chunks/watcher.js-BelxjMOP.js';
4
+ import { m as mintA2aId } from '../../../../../chunks/a2a-protocol.js-C77mVg2Q.js';
5
+ import { j as json } from '../../../../../chunks/utils.js-tOWCe9Wk.js';
6
+ import '../../../../../chunks/config.js-BBYogCe7.js';
7
+ import 'node:fs';
8
+ import 'node:path';
9
+ import 'node:os';
10
+ import 'yaml';
11
+ import '../../../../../chunks/db.js-DcmO3JAx.js';
12
+ import 'node:sqlite';
13
+ import '../../../../../chunks/dsh-events.js-BtDxaV6Q.js';
14
+ import '../../../../../chunks/shared.js-C4-Py8s_.js';
15
+ import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
16
+
17
+ //#region src/routes/api/a2a/register/+server.ts
18
+ /**
19
+ * /api/a2a/register (2026-08-25) — record one delegation at send: INSERT
20
+ * the waiting row (server mints the id when absent) and ensure the
21
+ * watcher runs. The composer (runMention, 3.3) calls this AFTER the
22
+ * prompt receipt — prompt first, register second (order is the contract).
23
+ *
24
+ * ADR: dev/architectural-decission/2026-08-26 - The a2a Signature —
25
+ * Correlation IDs and the Delegation Ledger.md §6 (INSERT-at-send).
26
+ * Spec: dev/specs/2026-08-25 - DSI a2a Signature and Delegation Ledger
27
+ * (Tasks 3.2/3.2-T; PRD communication map "composer → server").
28
+ */
29
+ /** Strict body validation — honest 400s, never silent guesses. */
30
+ function readBody(raw) {
31
+ if (raw === null || typeof raw !== "object") return { error: "body must be an object" };
32
+ const b = raw;
33
+ if (typeof b.from !== "string" || b.from === "") return { error: "\"from\" must be a non-empty string" };
34
+ if (typeof b.to !== "string" || b.to === "") return { error: "\"to\" must be a non-empty string" };
35
+ if (typeof b.message !== "string" || b.message === "") return { error: "\"message\" must be a non-empty string" };
36
+ if (typeof b.watermark !== "number" || !Number.isInteger(b.watermark)) return { error: "\"watermark\" must be an integer" };
37
+ if (b.id !== void 0 && (typeof b.id !== "string" || b.id === "")) return { error: "\"id\" must be a non-empty string when present" };
38
+ return {
39
+ from: b.from,
40
+ to: b.to,
41
+ message: b.message,
42
+ watermark: b.watermark,
43
+ ...b.id !== void 0 ? { id: b.id } : {}
44
+ };
45
+ }
46
+ var POST = async ({ request }) => {
47
+ let raw;
48
+ try {
49
+ raw = await request.json();
50
+ } catch {
51
+ return json({
52
+ ok: false,
53
+ error: {
54
+ code: "bad-json",
55
+ message: "request body is not valid JSON"
56
+ }
57
+ }, { status: 400 });
58
+ }
59
+ const parsed = readBody(raw);
60
+ if ("error" in parsed) return json({
61
+ ok: false,
62
+ error: {
63
+ code: "bad-body",
64
+ message: parsed.error
65
+ }
66
+ }, { status: 400 });
67
+ const id = parsed.id ?? mintA2aId();
68
+ try {
69
+ const cfg = readA2aConfig();
70
+ configureWatcher({
71
+ fastPollMs: cfg.fastPollMs,
72
+ watchTimeoutMs: cfg.watchTimeoutMs,
73
+ retentionDays: cfg.retentionDays
74
+ });
75
+ } catch {}
76
+ let watermarkSeq = null;
77
+ if (parsed.watermark < 0) try {
78
+ const events = (await getDshConnection().history(parsed.to)).events ?? [];
79
+ watermarkSeq = events.length > 0 ? events[events.length - 1].event.seq : -1;
80
+ } catch {
81
+ watermarkSeq = null;
82
+ }
83
+ registerWatch({
84
+ id,
85
+ fromSession: parsed.from,
86
+ toSession: parsed.to,
87
+ message: parsed.message,
88
+ watermarkTurn: parsed.watermark,
89
+ watermarkSeq,
90
+ sentAt: Date.now()
91
+ });
92
+ return json({
93
+ ok: true,
94
+ id
95
+ });
96
+ };
97
+
98
+ export { POST };
99
+ //# sourceMappingURL=_server.ts.js-Dxwc-7-5.js.map