@deepseek-insight/dsi 0.5.9 → 0.5.11

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 (177) hide show
  1. package/README.md +27 -60
  2. package/bin/dsi.mjs +112 -8
  3. package/build/client/_app/immutable/assets/0.B-x78bUH.css +2 -0
  4. package/build/client/_app/immutable/assets/2.DHY7FpOZ.css +1 -0
  5. package/build/client/_app/immutable/chunks/06CitLNM.js +1 -0
  6. package/build/client/_app/immutable/chunks/{CJ_zvTBg.js → 1KjP5PPV.js} +1 -1
  7. package/build/client/_app/immutable/chunks/{BAZKJuQw.js → 4BUyCMHs.js} +1 -1
  8. package/build/client/_app/immutable/chunks/{qEGLx2Wc.js → 5BuKkouu.js} +1 -1
  9. package/build/client/_app/immutable/chunks/{Cj-Zm41R.js → 5W1abxrJ.js} +1 -1
  10. package/build/client/_app/immutable/chunks/{DlLP-Tuk.js → 7Qwz4TD3.js} +1 -1
  11. package/build/client/_app/immutable/chunks/{2irkVCIh.js → B3Lta-Nn.js} +1 -1
  12. package/build/client/_app/immutable/chunks/{Dr0pcX_F.js → B5bIZjCh.js} +1 -1
  13. package/build/client/_app/immutable/chunks/{CZXl7qUb.js → BDws8KMN.js} +1 -1
  14. package/build/client/_app/immutable/chunks/{CmbEK4CY.js → BFYiBR8b.js} +1 -1
  15. package/build/client/_app/immutable/chunks/{BI4pMaIG.js → BK9wQfnJ.js} +1 -1
  16. package/build/client/_app/immutable/chunks/{Beo7Z46k.js → BKMUCRSB.js} +1 -1
  17. package/build/client/_app/immutable/chunks/{D16vkywU.js → BNCXVe_Y.js} +1 -1
  18. package/build/client/_app/immutable/chunks/{DtBGId5S.js → BO15_-NJ.js} +1 -1
  19. package/build/client/_app/immutable/chunks/{CfZ7uSQe.js → BOGXkyy3.js} +1 -1
  20. package/build/client/_app/immutable/chunks/{BhNEBkk_.js → BP1EDRMh.js} +1 -1
  21. package/build/client/_app/immutable/chunks/{Bn9NRi0R.js → BQFPW2iU.js} +1 -1
  22. package/build/client/_app/immutable/chunks/{DI6I60fv.js → BS84xqUl.js} +1 -1
  23. package/build/client/_app/immutable/chunks/BhA_Mtox.js +2 -0
  24. package/build/client/_app/immutable/chunks/{DVXVVWkX.js → BhMqa9V0.js} +1 -1
  25. package/build/client/_app/immutable/chunks/{OmE6SGvs.js → BnEcDyty.js} +1 -1
  26. package/build/client/_app/immutable/chunks/{D4gq_dik.js → BoJ5ww2X.js} +1 -1
  27. package/build/client/_app/immutable/chunks/{BnF5Jm-h.js → BtWgux0k.js} +1 -1
  28. package/build/client/_app/immutable/chunks/BuVjHIij.js +1 -0
  29. package/build/client/_app/immutable/chunks/{CA_WNCsl.js → C7xeaPF2.js} +1 -1
  30. package/build/client/_app/immutable/chunks/{GBaNblmo.js → CA7VtFsM.js} +1 -1
  31. package/build/client/_app/immutable/chunks/{9TvT6fta.js → CIZRvqf3.js} +1 -1
  32. package/build/client/_app/immutable/chunks/{DuM1hSCa.js → CKk3hDrH.js} +1 -1
  33. package/build/client/_app/immutable/chunks/CM2YlsBZ.js +1 -0
  34. package/build/client/_app/immutable/chunks/{DzVMo6mB.js → CQNMOuVz.js} +1 -1
  35. package/build/client/_app/immutable/chunks/{wFIeY1Cf.js → CVJBb63S.js} +1 -1
  36. package/build/client/_app/immutable/chunks/CWCyOfZL.js +1 -0
  37. package/build/client/_app/immutable/chunks/{Dg_UWGX7.js → CWJVj28H.js} +1 -1
  38. package/build/client/_app/immutable/chunks/{sIEmSkn6.js → CWRt23V2.js} +1 -1
  39. package/build/client/_app/immutable/chunks/{DWDfcLfy.js → CXDjw6BI.js} +1 -1
  40. package/build/client/_app/immutable/chunks/{B38Unp4-.js → CbmGLQlS.js} +1 -1
  41. package/build/client/_app/immutable/chunks/{raVGrKQy.js → CfKp2keY.js} +4 -4
  42. package/build/client/_app/immutable/chunks/{LWre5GKl.js → CfPrYC2A.js} +1 -1
  43. package/build/client/_app/immutable/chunks/{zpcgJjUg.js → CfqeI44h.js} +1 -1
  44. package/build/client/_app/immutable/chunks/{BJL7RCQE.js → CjMviqoD.js} +1 -1
  45. package/build/client/_app/immutable/chunks/CoCs8NEu.js +1 -0
  46. package/build/client/_app/immutable/chunks/Ct7xT-0E.js +1 -0
  47. package/build/client/_app/immutable/chunks/{DGarjVZC.js → CwpTIVX4.js} +1 -1
  48. package/build/client/_app/immutable/chunks/{C1JXY9b5.js → D-p2gaJO.js} +1 -1
  49. package/build/client/_app/immutable/chunks/{CWVpRRWx.js → D2Punuji.js} +1 -1
  50. package/build/client/_app/immutable/chunks/{CWKM3f5q.js → D9XozwcM.js} +1 -1
  51. package/build/client/_app/immutable/chunks/DFZg0vdm.js +8 -0
  52. package/build/client/_app/immutable/chunks/{BOfSXrr7.js → DHChdxxK.js} +1 -1
  53. package/build/client/_app/immutable/chunks/DKLs56Hm.js +1 -0
  54. package/build/client/_app/immutable/chunks/{D0I62FkS.js → DTVIMflS.js} +1 -1
  55. package/build/client/_app/immutable/chunks/{D8-5qLJg.js → DVsJyQaB.js} +1 -1
  56. package/build/client/_app/immutable/chunks/{Btk-1DaX.js → D_4vyw9k.js} +1 -1
  57. package/build/client/_app/immutable/chunks/{CPgSxomx.js → Da0rl5Rb.js} +1 -1
  58. package/build/client/_app/immutable/chunks/DemMpn7y.js +1 -0
  59. package/build/client/_app/immutable/chunks/{DPKol_4Z.js → DfxnqpU2.js} +1 -1
  60. package/build/client/_app/immutable/chunks/DnA33f7e.js +3 -0
  61. package/build/client/_app/immutable/chunks/{6GKQw8m6.js → DrLWFO8Z.js} +1 -1
  62. package/build/client/_app/immutable/chunks/{DITEY8D_.js → DtdNJetN.js} +1 -1
  63. package/build/client/_app/immutable/chunks/{DLOOos_8.js → Dufckt0T.js} +1 -1
  64. package/build/client/_app/immutable/chunks/{DAS1CLuE.js → DzNl4lTU.js} +1 -1
  65. package/build/client/_app/immutable/chunks/E-1cXrsM.js +1 -0
  66. package/build/client/_app/immutable/chunks/{Kcoq1pzq.js → FDKaBHdO.js} +1 -1
  67. package/build/client/_app/immutable/chunks/{BD8HEhdy.js → KCYBrblk.js} +5 -5
  68. package/build/client/_app/immutable/chunks/N_z8g1dA.js +1 -0
  69. package/build/client/_app/immutable/chunks/{DbcKN35_.js → NxBjh70M.js} +1 -1
  70. package/build/client/_app/immutable/chunks/{B1YSaoU7.js → T453H1uG.js} +1 -1
  71. package/build/client/_app/immutable/chunks/{DqwfDHZH.js → XM-sjL-p.js} +1 -1
  72. package/build/client/_app/immutable/chunks/{Cy8ZCjxB.js → _OxPZn8v.js} +1 -1
  73. package/build/client/_app/immutable/chunks/{DvCMcJ3P.js → dg-Ik0Xp.js} +1 -1
  74. package/build/client/_app/immutable/chunks/{Cd6K7Y8m.js → eNqKaSDb.js} +1 -1
  75. package/build/client/_app/immutable/chunks/{mVHw7KEX.js → hFCLiR2C.js} +1 -1
  76. package/build/client/_app/immutable/chunks/{Rh9cy7xg.js → pRzztTzl.js} +1 -1
  77. package/build/client/_app/immutable/chunks/{Cb1pwoev.js → qDr7l6ST.js} +1 -1
  78. package/build/client/_app/immutable/chunks/{nDMCpPkF.js → tziyL5EM.js} +1 -1
  79. package/build/client/_app/immutable/chunks/{UNxFjlik.js → wRPKccfz.js} +1 -1
  80. package/build/client/_app/immutable/entry/app.CO61_ZoK.js +2 -0
  81. package/build/client/_app/immutable/entry/start.D2897Ko1.js +1 -0
  82. package/build/client/_app/immutable/nodes/0.Cl1RKBMO.js +1 -0
  83. package/build/client/_app/immutable/nodes/1.BTAH4lX4.js +1 -0
  84. package/build/client/_app/immutable/nodes/2.BIBOCzYk.js +174 -0
  85. package/build/client/_app/version.json +1 -1
  86. package/build/env.js +2 -2
  87. package/build/handler.js +9 -9
  88. package/build/index.js +9 -9
  89. package/build/server/chunks/chunks/{app-config.svelte.js-Co9jacqT.js → app-config.svelte.js-BkhuJ9bF.js} +2 -2
  90. package/build/server/chunks/chunks/{config.js-BBYogCe7.js → config.js-D2vQdial.js} +9 -2
  91. package/build/server/chunks/chunks/{db.js-C4EPtpZT.js → db.js-Cya8uRCD.js} +2 -2
  92. package/build/server/chunks/chunks/{db2.js-BYr2lzQs.js → db2.js-CPqi0hcH.js} +2 -2
  93. package/build/server/chunks/chunks/{dsh-connection.js-D52KwDXm.js → dsh-connection.js-DlwhJZaV.js} +3 -3
  94. package/build/server/chunks/chunks/{exports.js-DMiPee3x.js → exports.js-DH_tjtdv.js} +4 -4
  95. package/build/server/chunks/chunks/git-probe.js-nfLEa58f.js +219 -0
  96. package/build/server/chunks/chunks/image-limits.js-CUdJ0f7r.js +41 -0
  97. package/build/server/chunks/chunks/{insight-config.js-BAitz0O1.js → insight-config.js-BwcV3Bct.js} +5 -159
  98. package/build/server/chunks/chunks/{internal.js-kXJJJomG.js → internal.js-CRfRCfoU.js} +6 -5
  99. package/build/server/chunks/chunks/{internal2.js-D-DAuSVh.js → internal2.js-BcS47nI-.js} +2 -2
  100. package/build/server/chunks/chunks/{image-limits.js-BMPZ55kJ.js → permission-state.js-yvwUSnug.js} +8 -41
  101. package/build/server/chunks/chunks/runtime.js-BPLc5RLR.js +854 -0
  102. package/build/server/chunks/chunks/{server.js-DoCd0fEo.js → server.js-11-pxAWV.js} +73 -2
  103. package/build/server/chunks/chunks/settings-document.js-BIwLIxnE.js +162 -0
  104. package/build/server/chunks/chunks/{shared.js-C4-Py8s_.js → shared.js-HQ0rfhm4.js} +4 -4
  105. package/build/server/chunks/chunks/{state.js-7BOeaoQB.js → state.js-BB7-MsQ0.js} +42 -10
  106. package/build/server/chunks/chunks/{utils.js-tOWCe9Wk.js → utils.js-CAdNO8Tu.js} +6 -6
  107. package/build/server/chunks/chunks/{watcher.js-CZl6B1Gm.js → watcher.js-CmpeTgh-.js} +4 -4
  108. package/build/server/chunks/entries/endpoints/api/a2a/_id_/{_server.ts.js-BiJNs-w9.js → _server.ts.js-D5AWBpBQ.js} +7 -6
  109. package/build/server/chunks/entries/endpoints/api/a2a/{_server.ts.js-DpYiPNfK.js → _server.ts.js-BZvM0qV8.js} +9 -8
  110. package/build/server/chunks/entries/endpoints/api/a2a/register/{_server.ts.js-hsrqtyai.js → _server.ts.js-CwQ8v1Gr.js} +9 -8
  111. package/build/server/chunks/entries/endpoints/api/config/{_server.ts.js-C22-pOYW.js → _server.ts.js-DRFbC3XB.js} +6 -5
  112. package/build/server/chunks/entries/endpoints/api/dsh/directory/{_server.ts.js-GB8GCnt9.js → _server.ts.js-1NUslX2J.js} +7 -6
  113. package/build/server/chunks/entries/endpoints/api/dsh/pick-directory/{_server.ts.js-1f1lp4p6.js → _server.ts.js-BaNBBHLR.js} +7 -6
  114. package/build/server/chunks/entries/endpoints/api/dsh/presets/{_server.ts.js-bQ6fWiaE.js → _server.ts.js-CW2NY_YQ.js} +7 -6
  115. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/attachment/{_server.ts.js-Dpn0vlL4.js → _server.ts.js-QA9zJsqt.js} +7 -6
  116. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/cancel/{_server.ts.js-BCKU6r0e.js → _server.ts.js-CVXZhV9H.js} +7 -6
  117. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/catalog/{_server.ts.js-B6CP7Ox-.js → _server.ts.js-Cit4Casr.js} +7 -6
  118. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/command/{_server.ts.js-CuIGYst7.js → _server.ts.js-CyjB1woG.js} +7 -6
  119. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/events/{_server.ts.js-BJk9GfEb.js → _server.ts.js-DllJ8vBI.js} +9 -7
  120. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/fork/{_server.ts.js-BRjJibko.js → _server.ts.js-BNnAmzy2.js} +7 -6
  121. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/goal/{_server.ts.js-Du0XmI7X.js → _server.ts.js-BM_jJMFG.js} +7 -6
  122. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/history/{_server.ts.js-BmxbonR_.js → _server.ts.js-qKiwUxSN.js} +7 -6
  123. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/models/{_server.ts.js-B03gh2aZ.js → _server.ts.js-CZ0zXTiV.js} +7 -6
  124. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/permission/{_server.ts.js-BO9Iy5Ki.js → _server.ts.js-3o3S3pHm.js} +7 -6
  125. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/prompt/{_server.ts.js-qr2peU-n.js → _server.ts.js-DsCnz_8J.js} +7 -6
  126. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/rename/{_server.ts.js-D4PIEynR.js → _server.ts.js-6QBc29c0.js} +7 -6
  127. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/respond/{_server.ts.js-CcBAtZWB.js → _server.ts.js-Cur_rwoa.js} +7 -6
  128. package/build/server/chunks/entries/endpoints/api/dsh/session/_sessionId_/select-model/{_server.ts.js-CE1gTwwX.js → _server.ts.js-BBRIvxEV.js} +7 -6
  129. package/build/server/chunks/entries/endpoints/api/dsh/sessions/{_server.ts.js-GugaguYO.js → _server.ts.js-HXmuGYk_.js} +7 -6
  130. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file/{_server.ts.js-D7ZCMRXo.js → _server.ts.js-BtF78EDX.js} +7 -6
  131. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file-bytes/{_server.ts.js-BeLFfBNx.js → _server.ts.js-DaxAqI2r.js} +7 -6
  132. package/build/server/chunks/entries/endpoints/api/dsh/workspace-tree/{_server.ts.js-CUMrE1yT.js → _server.ts.js-Cp3JRhml.js} +7 -6
  133. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/{_server.ts.js-CPTg8pND.js → _server.ts.js-DCHNOxOw.js} +7 -6
  134. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_workspaceId_/delete/{_server.ts.js-ikZ2NK35.js → _server.ts.js-CTCYuknC.js} +7 -6
  135. package/build/server/chunks/entries/endpoints/api/dsh/workspaces/_workspaceId_/rename/{_server.ts.js-DO-sihfI.js → _server.ts.js-B1O7CmG7.js} +7 -6
  136. package/build/server/chunks/entries/endpoints/api/prompts/_id_/{_server.ts.js-CtWIL8u1.js → _server.ts.js-CMAYot0u.js} +7 -6
  137. package/build/server/chunks/entries/endpoints/api/prompts/{_server.ts.js-CCV5F65b.js → _server.ts.js-Bk-I6Cmq.js} +7 -6
  138. package/build/server/chunks/entries/endpoints/api/prompts/use/{_server.ts.js-5zjPgL0k.js → _server.ts.js-CWdigZaS.js} +7 -6
  139. package/build/server/chunks/entries/endpoints/api/settings/{_server.ts.js-DGy6xjPE.js → _server.ts.js-BgZ3eon4.js} +6 -5
  140. package/build/server/chunks/entries/endpoints/api/workspace/file-write/_server.ts.js-CMDHM8Ts.js +109 -0
  141. package/build/server/chunks/entries/endpoints/api/workspace/git-events/_server.ts.js-DsrelTvu.js +295 -0
  142. package/build/server/chunks/entries/endpoints/api/workspace/git-file-head/_server.ts.js-Bjo1hSe3.js +87 -0
  143. package/build/server/chunks/entries/endpoints/api/workspace/git-map/_server.ts.js-kbPAnTV6.js +75 -0
  144. package/build/server/chunks/entries/endpoints/api/workspace/git-status/_server.ts.js-CGSk5JWn.js +80 -0
  145. package/build/server/chunks/entries/hooks.server.js-B7FsvqtT.js +307 -0
  146. package/build/server/chunks/entries/pages/_error.svelte.js-BVjBiEZD.js +183 -0
  147. package/build/server/chunks/entries/pages/{_page.server.ts.js-BGXwU4Ay.js → _page.server.ts.js-CNU4x-f1.js} +5 -4
  148. package/build/server/chunks/entries/pages/{_page.svelte.js-N0F4WBmN.js → _page.svelte.js-D6UC7cGf.js} +5212 -380
  149. package/build/server/chunks/{handler-DonVRS0X.js → handler-BKbAUWNh.js} +8 -8
  150. package/build/server/chunks/{index.js-BeG-TgOY.js → index.js-DNjzSibQ.js} +35 -35
  151. package/build/server/chunks/{manifest.js-CjHfy5rn.js → manifest.js-By1cjJ9N.js} +72 -44
  152. package/build/server/chunks/nodes/{0.js-DCyDo8-C.js → 0.js-BRdcKR1I.js} +3 -3
  153. package/build/server/chunks/nodes/1.js-nA42GX_X.js +9 -0
  154. package/build/server/chunks/nodes/2.js-C5a91sl7.js +26 -0
  155. package/package.json +5 -2
  156. package/build/client/_app/immutable/assets/0.DqFt8jIM.css +0 -2
  157. package/build/client/_app/immutable/assets/2.CybNpyHE.css +0 -1
  158. package/build/client/_app/immutable/chunks/Bp4uuUjI.js +0 -3
  159. package/build/client/_app/immutable/chunks/COnL3E7k.js +0 -1
  160. package/build/client/_app/immutable/chunks/CsHVnZCH.js +0 -1
  161. package/build/client/_app/immutable/chunks/D1qzYj9m.js +0 -1
  162. package/build/client/_app/immutable/chunks/DXeGLmed.js +0 -8
  163. package/build/client/_app/immutable/chunks/ESmLJICu.js +0 -1
  164. package/build/client/_app/immutable/chunks/PaZBB01u.js +0 -1
  165. package/build/client/_app/immutable/chunks/UmdltqoE.js +0 -1
  166. package/build/client/_app/immutable/chunks/Y2GhLLeG.js +0 -1
  167. package/build/client/_app/immutable/chunks/c6YVk1M6.js +0 -2
  168. package/build/client/_app/immutable/chunks/i0VQdJtv.js +0 -1
  169. package/build/client/_app/immutable/entry/app.BleekCCN.js +0 -2
  170. package/build/client/_app/immutable/entry/start.BpFQKF_D.js +0 -1
  171. package/build/client/_app/immutable/nodes/0.B_ZEZy7b.js +0 -1
  172. package/build/client/_app/immutable/nodes/1.CY-dc03C.js +0 -1
  173. package/build/client/_app/immutable/nodes/2.DbShW3bE.js +0 -69
  174. package/build/server/chunks/entries/endpoints/api/dsh/workspace-file/save/_server.ts.js-CO9iOVa4.js +0 -110
  175. package/build/server/chunks/entries/pages/_error.svelte.js-COiCqUkC.js +0 -41
  176. package/build/server/chunks/nodes/1.js-_W3O7q0J.js +0 -9
  177. package/build/server/chunks/nodes/2.js-BKYP_GxW.js +0 -24
@@ -1,13 +1,14 @@
1
- import { l as listPrompts, s as searchPrompts, c as createPrompt } from '../../../../chunks/db2.js-BYr2lzQs.js';
2
- import { j as json } from '../../../../chunks/utils.js-tOWCe9Wk.js';
3
- import '../../../../chunks/insight-config.js-BAitz0O1.js';
4
- import '../../../../chunks/config.js-BBYogCe7.js';
1
+ import { l as listPrompts, s as searchPrompts, c as createPrompt } from '../../../../chunks/db2.js-CPqi0hcH.js';
2
+ import { j as json } from '../../../../chunks/utils.js-CAdNO8Tu.js';
3
+ import '../../../../chunks/insight-config.js-BwcV3Bct.js';
4
+ import '../../../../chunks/config.js-D2vQdial.js';
5
+ import '../../../../chunks/settings-document.js-BIwLIxnE.js';
5
6
  import 'node:fs';
6
7
  import 'node:path';
7
8
  import 'node:os';
8
9
  import 'yaml';
9
10
  import 'node:sqlite';
10
- import '../../../../chunks/shared.js-C4-Py8s_.js';
11
+ import '../../../../chunks/shared.js-HQ0rfhm4.js';
11
12
  import '../../../../chunks/uneval.js-BJ9Qq2SF.js';
12
13
 
13
14
  //#region src/routes/api/prompts/+server.ts
@@ -84,4 +85,4 @@ var POST = async ({ request }) => {
84
85
  };
85
86
 
86
87
  export { GET, POST };
87
- //# sourceMappingURL=_server.ts.js-CCV5F65b.js.map
88
+ //# sourceMappingURL=_server.ts.js-Bk-I6Cmq.js.map
@@ -1,13 +1,14 @@
1
- import { i as readPromptsConfig } from '../../../../../chunks/insight-config.js-BAitz0O1.js';
2
- import { f as findPromptByText, r as recordPromptUse } from '../../../../../chunks/db2.js-BYr2lzQs.js';
3
- import { j as json } from '../../../../../chunks/utils.js-tOWCe9Wk.js';
4
- import '../../../../../chunks/config.js-BBYogCe7.js';
1
+ import { i as readPromptsConfig } from '../../../../../chunks/insight-config.js-BwcV3Bct.js';
2
+ import { f as findPromptByText, r as recordPromptUse } from '../../../../../chunks/db2.js-CPqi0hcH.js';
3
+ import { j as json } from '../../../../../chunks/utils.js-CAdNO8Tu.js';
4
+ import '../../../../../chunks/config.js-D2vQdial.js';
5
+ import '../../../../../chunks/settings-document.js-BIwLIxnE.js';
5
6
  import 'node:fs';
6
7
  import 'node:path';
7
8
  import 'node:os';
8
9
  import 'yaml';
9
10
  import 'node:sqlite';
10
- import '../../../../../chunks/shared.js-C4-Py8s_.js';
11
+ import '../../../../../chunks/shared.js-HQ0rfhm4.js';
11
12
  import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
12
13
 
13
14
  //#region src/routes/api/prompts/use/+server.ts
@@ -51,4 +52,4 @@ var POST = async ({ request }) => {
51
52
  };
52
53
 
53
54
  export { POST };
54
- //# sourceMappingURL=_server.ts.js-5zjPgL0k.js.map
55
+ //# sourceMappingURL=_server.ts.js-CWdigZaS.js.map
@@ -1,11 +1,12 @@
1
- import { j as readSettingsDocument, s as saveSettingsDocument, S as SettingsParseError, k as DEFAULT_DSH_PRESET_ENGLISH, l as DEFAULT_SERVER_CONFIG, m as DEFAULT_PROMPTS_CONFIG, n as DEFAULT_SIDEBAR_CONFIG, o as DEFAULT_PANEL_CONFIG, p as DEFAULT_A2A_CONFIG, q as DEFAULT_HOME_CONFIG, t as DEFAULT_CONVERSATION_CONFIG, u as DEFAULT_CHAT_CONFIG } from '../../../../chunks/insight-config.js-BAitz0O1.js';
2
- import { j as json } from '../../../../chunks/utils.js-tOWCe9Wk.js';
1
+ import { r as readSettingsDocument, s as saveSettingsDocument, S as SettingsParseError } from '../../../../chunks/settings-document.js-BIwLIxnE.js';
2
+ import { j as DEFAULT_DSH_PRESET_ENGLISH, k as DEFAULT_SERVER_CONFIG, l as DEFAULT_PROMPTS_CONFIG, m as DEFAULT_SIDEBAR_CONFIG, n as DEFAULT_PANEL_CONFIG, o as DEFAULT_A2A_CONFIG, p as DEFAULT_HOME_CONFIG, q as DEFAULT_CONVERSATION_CONFIG, s as DEFAULT_CHAT_CONFIG } from '../../../../chunks/insight-config.js-BwcV3Bct.js';
3
+ import { j as json } from '../../../../chunks/utils.js-CAdNO8Tu.js';
3
4
  import { stringify } from 'yaml';
4
- import '../../../../chunks/config.js-BBYogCe7.js';
5
+ import '../../../../chunks/config.js-D2vQdial.js';
5
6
  import 'node:fs';
6
7
  import 'node:path';
7
8
  import 'node:os';
8
- import '../../../../chunks/shared.js-C4-Py8s_.js';
9
+ import '../../../../chunks/shared.js-HQ0rfhm4.js';
9
10
  import '../../../../chunks/uneval.js-BJ9Qq2SF.js';
10
11
 
11
12
  //#region src/routes/api/settings/+server.ts
@@ -98,4 +99,4 @@ var PUT = async ({ url, request }) => {
98
99
  };
99
100
 
100
101
  export { GET, PUT };
101
- //# sourceMappingURL=_server.ts.js-DGy6xjPE.js.map
102
+ //# sourceMappingURL=_server.ts.js-BgZ3eon4.js.map
@@ -0,0 +1,109 @@
1
+ import { s as statusFor, m as mapRpcFailure } from '../../../../../chunks/dsh-connection.js-DlwhJZaV.js';
2
+ import { g as gitGateEnabled, i as isInsideRoot } from '../../../../../chunks/git-probe.js-nfLEa58f.js';
3
+ import { j as json } from '../../../../../chunks/utils.js-CAdNO8Tu.js';
4
+ import { promises } from 'node:fs';
5
+ import * as nodePath from 'node:path';
6
+ import '../../../../../chunks/config.js-D2vQdial.js';
7
+ import '../../../../../chunks/insight-config.js-BwcV3Bct.js';
8
+ import '../../../../../chunks/settings-document.js-BIwLIxnE.js';
9
+ import 'node:os';
10
+ import 'yaml';
11
+ import '../../../../../chunks/dsh-events.js-BtDxaV6Q.js';
12
+ import '../../../../../chunks/permission-state.js-yvwUSnug.js';
13
+ import 'node:child_process';
14
+ import '../../../../../chunks/shared.js-HQ0rfhm4.js';
15
+ import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
16
+
17
+ //#region src/routes/api/workspace/file-write/+server.ts
18
+ /**
19
+ * api-workspace — POST /api/workspace/file-write
20
+ *
21
+ * The File Eye's direct save (ADR The File Eye 2026-09-12, D4): on a
22
+ * full-access desk the DSI server writes the bytes ITSELF — fresh gate,
23
+ * realpath containment of the target inside the workspace root, then
24
+ * fs.writeFile. The written receipt IS proof of effect (unlike the
25
+ * retired delegated turn). Every refusal happens BEFORE the filesystem
26
+ * is touched.
27
+ */
28
+ var POST = async ({ request }) => {
29
+ let body;
30
+ try {
31
+ body = await request.json();
32
+ } catch {
33
+ return json({
34
+ ok: false,
35
+ error: {
36
+ code: "bad-json",
37
+ message: "request body is not valid JSON"
38
+ }
39
+ }, { status: 400 });
40
+ }
41
+ const { sessionId, root, path, content } = body ?? {};
42
+ if (typeof sessionId !== "string" || sessionId.trim().length === 0) return json({
43
+ ok: false,
44
+ error: {
45
+ code: "bad-session",
46
+ message: "sessionId is required"
47
+ }
48
+ }, { status: 400 });
49
+ if (typeof root !== "string" || root.trim().length === 0) return json({
50
+ ok: false,
51
+ error: {
52
+ code: "bad-root",
53
+ message: "root is required"
54
+ }
55
+ }, { status: 400 });
56
+ if (typeof path !== "string" || path.length === 0) return json({
57
+ ok: false,
58
+ error: {
59
+ code: "bad-path",
60
+ message: "path is required"
61
+ }
62
+ }, { status: 400 });
63
+ if (typeof content !== "string") return json({
64
+ ok: false,
65
+ error: {
66
+ code: "bad-content",
67
+ message: "content must be a string"
68
+ }
69
+ }, { status: 400 });
70
+ let enabled;
71
+ try {
72
+ enabled = await gitGateEnabled(sessionId);
73
+ } catch (err) {
74
+ return json(mapRpcFailure(err), { status: statusFor(err) });
75
+ }
76
+ if (!enabled) return json({
77
+ ok: false,
78
+ error: {
79
+ code: "gate-closed",
80
+ message: "the desk does not permit direct writes"
81
+ }
82
+ }, { status: 403 });
83
+ const absolute = nodePath.join(root, ...path.split("/").filter((p) => p.length > 0));
84
+ if (!await isInsideRoot(root, absolute)) return json({
85
+ ok: false,
86
+ error: {
87
+ code: "outside-workspace",
88
+ message: "the file path is not inside the workspace root"
89
+ }
90
+ }, { status: 403 });
91
+ try {
92
+ await promises.writeFile(absolute, content, "utf8");
93
+ return json({
94
+ ok: true,
95
+ written: true
96
+ });
97
+ } catch (err) {
98
+ return json({
99
+ ok: false,
100
+ error: {
101
+ code: "write-failed",
102
+ message: err instanceof Error ? err.message : "write failed"
103
+ }
104
+ }, { status: 500 });
105
+ }
106
+ };
107
+
108
+ export { POST };
109
+ //# sourceMappingURL=_server.ts.js-CMDHM8Ts.js.map
@@ -0,0 +1,295 @@
1
+ import { s as statusFor, m as mapRpcFailure } from '../../../../../chunks/dsh-connection.js-DlwhJZaV.js';
2
+ import { g as gitGateEnabled, i as isInsideRoot, a as gitStatus, p as parsePorcelainStatus } from '../../../../../chunks/git-probe.js-nfLEa58f.js';
3
+ import { j as json } from '../../../../../chunks/utils.js-CAdNO8Tu.js';
4
+ import { watch } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { execFileSync } from 'node:child_process';
7
+ import '../../../../../chunks/config.js-D2vQdial.js';
8
+ import '../../../../../chunks/insight-config.js-BwcV3Bct.js';
9
+ import '../../../../../chunks/settings-document.js-BIwLIxnE.js';
10
+ import 'node:os';
11
+ import 'yaml';
12
+ import '../../../../../chunks/dsh-events.js-BtDxaV6Q.js';
13
+ import '../../../../../chunks/permission-state.js-yvwUSnug.js';
14
+ import '../../../../../chunks/shared.js-HQ0rfhm4.js';
15
+ import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
16
+
17
+ /** Module-level registry — the DSI server is a long-lived Node process
18
+ * (adapter-node), so this state persists across requests (ADR fact 8). */
19
+ var registry = /* @__PURE__ */ new Map();
20
+ function workspaceOf(workspaceKey) {
21
+ let ws = registry.get(workspaceKey);
22
+ if (!ws) {
23
+ ws = {
24
+ generation: 0,
25
+ watchers: /* @__PURE__ */ new Map(),
26
+ listeners: /* @__PURE__ */ new Set()
27
+ };
28
+ registry.set(workspaceKey, ws);
29
+ }
30
+ return ws;
31
+ }
32
+ /** Current generation for a workspace (0 before the first ring). */
33
+ function getGeneration(workspaceKey) {
34
+ return registry.get(workspaceKey)?.generation ?? 0;
35
+ }
36
+ /** Subscribe to generation bumps for one workspace. Returns an unsubscribe. */
37
+ function onGeneration(workspaceKey, cb) {
38
+ const ws = workspaceOf(workspaceKey);
39
+ ws.listeners.add(cb);
40
+ return () => ws.listeners.delete(cb);
41
+ }
42
+ function bump(workspaceKey) {
43
+ const ws = registry.get(workspaceKey);
44
+ if (!ws) return;
45
+ ws.generation += 1;
46
+ for (const cb of ws.listeners) try {
47
+ cb(ws.generation);
48
+ } catch {}
49
+ }
50
+ function scheduleRing(workspaceKey, entry) {
51
+ if (entry.timer !== null) clearTimeout(entry.timer);
52
+ entry.timer = setTimeout(async () => {
53
+ entry.timer = null;
54
+ let snapshot = null;
55
+ try {
56
+ const status = await gitStatus(entry.repo);
57
+ snapshot = JSON.stringify(status.files);
58
+ } catch {
59
+ snapshot = null;
60
+ }
61
+ if (snapshot === null || snapshot === entry.lastStatus) return;
62
+ entry.lastStatus = snapshot;
63
+ entry.rootEventPending = false;
64
+ let open = false;
65
+ try {
66
+ open = await entry.gateCheck();
67
+ } catch {
68
+ open = false;
69
+ }
70
+ if (open) bump(workspaceKey);
71
+ else try {
72
+ entry.onGateClosed();
73
+ } catch {}
74
+ }, 300);
75
+ }
76
+ /**
77
+ * Acquire one claim on a repo's index watcher for a workspace. The watcher
78
+ * is created on the FIRST acquire and torn down when the last lease is
79
+ * released (ADR D5). gateCheck is re-resolved on every ring — never cached.
80
+ */
81
+ function acquireWatch(opts) {
82
+ const ws = workspaceOf(opts.workspaceKey);
83
+ let entry = ws.watchers.get(opts.repo);
84
+ if (!entry) {
85
+ let watcher;
86
+ try {
87
+ watcher = watch(join(opts.repo, ".git"), () => {
88
+ scheduleRing(opts.workspaceKey, fresh);
89
+ });
90
+ } catch {
91
+ const dead = {
92
+ watcher: { close: () => void 0 },
93
+ rootWatcher: null,
94
+ refcount: 0,
95
+ repo: opts.repo,
96
+ gateCheck: opts.gateCheck,
97
+ onGateClosed: opts.onGateClosed ?? (() => void 0),
98
+ timer: null,
99
+ lastStatus: null,
100
+ rootEventPending: false
101
+ };
102
+ entry = dead;
103
+ ws.watchers.set(opts.repo, entry);
104
+ entry.refcount += 1;
105
+ let alreadyReleased = false;
106
+ return { release: async () => {
107
+ if (alreadyReleased) return;
108
+ alreadyReleased = true;
109
+ await releaseWatcher(opts.workspaceKey, dead);
110
+ } };
111
+ }
112
+ const fresh = {
113
+ watcher,
114
+ rootWatcher: null,
115
+ refcount: 0,
116
+ repo: opts.repo,
117
+ gateCheck: opts.gateCheck,
118
+ onGateClosed: opts.onGateClosed ?? (() => void 0),
119
+ timer: null,
120
+ lastStatus: statusSnapshotSync(opts.repo),
121
+ rootEventPending: false
122
+ };
123
+ entry = fresh;
124
+ watcher.on("error", () => {
125
+ releaseWatcher(opts.workspaceKey, fresh);
126
+ });
127
+ let rootWatcher = null;
128
+ try {
129
+ rootWatcher = watch(opts.repo, (kind, name) => {
130
+ const n = name === null ? "" : String(name);
131
+ if (n === ".git" || n.startsWith(".git")) return;
132
+ fresh.rootEventPending = true;
133
+ scheduleRing(opts.workspaceKey, fresh);
134
+ });
135
+ } catch {
136
+ rootWatcher = null;
137
+ }
138
+ fresh.rootWatcher = rootWatcher;
139
+ watcher.on("error", () => {
140
+ releaseWatcher(opts.workspaceKey, fresh);
141
+ });
142
+ ws.watchers.set(opts.repo, entry);
143
+ }
144
+ entry.refcount += 1;
145
+ let released = false;
146
+ return { release: async () => {
147
+ if (released) return;
148
+ released = true;
149
+ await releaseWatcher(opts.workspaceKey, entry);
150
+ } };
151
+ }
152
+ async function releaseWatcher(workspaceKey, entry) {
153
+ const ws = registry.get(workspaceKey);
154
+ if (!ws) return;
155
+ if (ws.watchers.get(entry.repo) !== entry) return;
156
+ entry.refcount -= 1;
157
+ if (entry.refcount > 0) return;
158
+ ws.watchers.delete(entry.repo);
159
+ if (entry.timer !== null) clearTimeout(entry.timer);
160
+ entry.timer = null;
161
+ try {
162
+ await entry.watcher.close();
163
+ } catch {}
164
+ if (entry.rootWatcher !== null) try {
165
+ entry.rootWatcher.close();
166
+ } catch {}
167
+ if (ws.watchers.size === 0 && ws.listeners.size === 0) registry.delete(workspaceKey);
168
+ }
169
+ /** SYNC baseline seed (Index Pulse): a null lastStatus makes the first
170
+ * verified ring bump even when NOTHING changed (FSEvents setup ghosts
171
+ * made that a real flake). Reading porcelain synchronously at acquire
172
+ * costs one bounded git child per watcher CREATION (not per ring) and
173
+ * removes the race an async seed provably has. */
174
+ function statusSnapshotSync(repo) {
175
+ try {
176
+ const out = execFileSync("git", [
177
+ "-C",
178
+ repo,
179
+ "status",
180
+ "--porcelain=v1",
181
+ "-z"
182
+ ], {
183
+ timeout: 1e4,
184
+ maxBuffer: 4194304
185
+ });
186
+ return JSON.stringify(parsePorcelainStatus(out.toString()).files);
187
+ } catch {
188
+ return null;
189
+ }
190
+ }
191
+ //#endregion
192
+ //#region src/routes/api/workspace/git-events/+server.ts
193
+ /**
194
+ * api-workspace — GET /api/workspace/git-events?sessionId=…&root=…&repo=…(&repo=…)
195
+ *
196
+ * The Index Pulse's SSE stream (ADR 2026-09-13, D3/D5): one server-sent
197
+ * events channel per explorer panel. The gate is resolved at connect —
198
+ * closed means the plain git-status JSON contract ({ ok:true,
199
+ * enabled:false }), NOT a stream. Open, the stream speaks two events:
200
+ * `generation` (a per-workspace monotonic integer, one per debounced ring)
201
+ * and `enabled:false` (the gate died mid-stream; the panel degrades to
202
+ * today's manual-Refresh world). TRUTH NEVER RIDES THIS STREAM — the panel
203
+ * refetches rows through the unchanged gated git-status route. Watchers
204
+ * are refcounted per workspace; the last client's disconnect closes them.
205
+ */
206
+ var GET = async ({ url, request }) => {
207
+ const sessionId = url.searchParams.get("sessionId");
208
+ const root = url.searchParams.get("root");
209
+ const repos = url.searchParams.getAll("repo").filter((r) => r.trim().length > 0);
210
+ if (sessionId === null || sessionId.trim().length === 0 || root === null || root.trim().length === 0 || repos.length === 0) return json({
211
+ ok: false,
212
+ error: {
213
+ code: "bad-params",
214
+ message: "sessionId, root and at least one repo are required"
215
+ }
216
+ }, { status: 400 });
217
+ let enabled;
218
+ try {
219
+ enabled = await gitGateEnabled(sessionId);
220
+ } catch (err) {
221
+ return json(mapRpcFailure(err), { status: statusFor(err) });
222
+ }
223
+ if (!enabled) return json({
224
+ ok: true,
225
+ enabled: false
226
+ });
227
+ for (const repo of repos) if (!await isInsideRoot(root, repo)) return json({
228
+ ok: false,
229
+ error: {
230
+ code: "outside-workspace",
231
+ message: "the repo path is not inside the workspace root"
232
+ }
233
+ }, { status: 403 });
234
+ const encoder = new TextEncoder();
235
+ const workspaceKey = root;
236
+ let cleanup = () => void 0;
237
+ const stream = new ReadableStream({
238
+ start(controller) {
239
+ let closed = false;
240
+ const send = (event, data) => {
241
+ if (closed) return;
242
+ try {
243
+ controller.enqueue(encoder.encode("event: " + event + "\ndata: " + data + "\n\n"));
244
+ } catch {
245
+ closed = true;
246
+ }
247
+ };
248
+ send("generation", String(getGeneration(workspaceKey)));
249
+ const leases = repos.map((repo) => acquireWatch({
250
+ workspaceKey,
251
+ repo,
252
+ gateCheck: () => gitGateEnabled(sessionId),
253
+ onGateClosed: () => {
254
+ send("enabled", "false");
255
+ finish();
256
+ }
257
+ }));
258
+ const unsubscribe = onGeneration(workspaceKey, (generation) => {
259
+ send("generation", String(generation));
260
+ });
261
+ const ping = setInterval(() => {
262
+ if (closed) return;
263
+ try {
264
+ controller.enqueue(encoder.encode(": ping\n\n"));
265
+ } catch {
266
+ closed = true;
267
+ }
268
+ }, 25e3);
269
+ function finish() {
270
+ if (closed) return;
271
+ closed = true;
272
+ clearInterval(ping);
273
+ unsubscribe();
274
+ for (const lease of leases) lease.release();
275
+ try {
276
+ controller.close();
277
+ } catch {}
278
+ }
279
+ cleanup = finish;
280
+ request.signal.addEventListener("abort", finish);
281
+ },
282
+ cancel() {
283
+ cleanup();
284
+ }
285
+ });
286
+ return new Response(stream, { headers: {
287
+ "content-type": "text/event-stream; charset=utf-8",
288
+ "cache-control": "no-cache",
289
+ connection: "keep-alive",
290
+ "x-accel-buffering": "no"
291
+ } });
292
+ };
293
+
294
+ export { GET };
295
+ //# sourceMappingURL=_server.ts.js-DsrelTvu.js.map
@@ -0,0 +1,87 @@
1
+ import { s as statusFor, m as mapRpcFailure } from '../../../../../chunks/dsh-connection.js-DlwhJZaV.js';
2
+ import { g as gitGateEnabled, r as resolveEnclosingRepo, i as isInsideRoot, b as gitFileHead, G as GitUnavailableError } from '../../../../../chunks/git-probe.js-nfLEa58f.js';
3
+ import { j as json } from '../../../../../chunks/utils.js-CAdNO8Tu.js';
4
+ import '../../../../../chunks/config.js-D2vQdial.js';
5
+ import '../../../../../chunks/insight-config.js-BwcV3Bct.js';
6
+ import '../../../../../chunks/settings-document.js-BIwLIxnE.js';
7
+ import 'node:fs';
8
+ import 'node:path';
9
+ import 'node:os';
10
+ import 'yaml';
11
+ import '../../../../../chunks/dsh-events.js-BtDxaV6Q.js';
12
+ import '../../../../../chunks/permission-state.js-yvwUSnug.js';
13
+ import 'node:child_process';
14
+ import '../../../../../chunks/shared.js-HQ0rfhm4.js';
15
+ import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
16
+
17
+ //#region src/routes/api/workspace/git-file-head/+server.ts
18
+ /**
19
+ * api-workspace — GET /api/workspace/git-file-head?sessionId=…&root=…&path=…
20
+ *
21
+ * The File Eye's "before" side (ADR The File Eye 2026-09-12, D2): the
22
+ * DSI server resolves the file's enclosing repo and runs a READ-ONLY
23
+ * git show HEAD:<rel>, gated exactly like git-status. head is null when
24
+ * git has no version of the path (untracked / newly added) — the honest
25
+ * no-before-version, never an error. Containment over realpaths.
26
+ */
27
+ var GET = async ({ url }) => {
28
+ const sessionId = url.searchParams.get("sessionId");
29
+ const root = url.searchParams.get("root");
30
+ const path = url.searchParams.get("path");
31
+ if (sessionId === null || sessionId.trim().length === 0 || root === null || root.trim().length === 0 || path === null || path.trim().length === 0) return json({
32
+ ok: false,
33
+ error: {
34
+ code: "bad-params",
35
+ message: "sessionId, root and path are required"
36
+ }
37
+ }, { status: 400 });
38
+ let enabled;
39
+ try {
40
+ enabled = await gitGateEnabled(sessionId);
41
+ } catch (err) {
42
+ return json(mapRpcFailure(err), { status: statusFor(err) });
43
+ }
44
+ if (!enabled) return json({
45
+ ok: true,
46
+ enabled: false
47
+ });
48
+ const enclosing = await resolveEnclosingRepo(root, path);
49
+ if (enclosing === null) return json({
50
+ ok: false,
51
+ error: {
52
+ code: "no-repo",
53
+ message: "no git repo encloses this path"
54
+ }
55
+ }, { status: 404 });
56
+ if (!await isInsideRoot(root, enclosing.repo)) return json({
57
+ ok: false,
58
+ error: {
59
+ code: "outside-workspace",
60
+ message: "the repo path is not inside the workspace root"
61
+ }
62
+ }, { status: 403 });
63
+ try {
64
+ const head = await gitFileHead(enclosing.repo, enclosing.rel);
65
+ return json({
66
+ ok: true,
67
+ enabled: true,
68
+ head
69
+ });
70
+ } catch (err) {
71
+ if (err instanceof GitUnavailableError) return json({
72
+ ok: false,
73
+ code: "git-unavailable",
74
+ message: err.message
75
+ });
76
+ return json({
77
+ ok: false,
78
+ error: {
79
+ code: "head-failed",
80
+ message: err instanceof Error ? err.message : "head read failed"
81
+ }
82
+ }, { status: statusFor(err) });
83
+ }
84
+ };
85
+
86
+ export { GET };
87
+ //# sourceMappingURL=_server.ts.js-Bjo1hSe3.js.map
@@ -0,0 +1,75 @@
1
+ import { s as statusFor, m as mapRpcFailure } from '../../../../../chunks/dsh-connection.js-DlwhJZaV.js';
2
+ import { g as gitGateEnabled, d as detectRepos } from '../../../../../chunks/git-probe.js-nfLEa58f.js';
3
+ import { j as json } from '../../../../../chunks/utils.js-CAdNO8Tu.js';
4
+ import '../../../../../chunks/config.js-D2vQdial.js';
5
+ import '../../../../../chunks/insight-config.js-BwcV3Bct.js';
6
+ import '../../../../../chunks/settings-document.js-BIwLIxnE.js';
7
+ import 'node:fs';
8
+ import 'node:path';
9
+ import 'node:os';
10
+ import 'yaml';
11
+ import '../../../../../chunks/dsh-events.js-BtDxaV6Q.js';
12
+ import '../../../../../chunks/permission-state.js-yvwUSnug.js';
13
+ import 'node:child_process';
14
+ import '../../../../../chunks/shared.js-HQ0rfhm4.js';
15
+ import '../../../../../chunks/uneval.js-BJ9Qq2SF.js';
16
+
17
+ //#region src/routes/api/workspace/git-map/+server.ts
18
+ /**
19
+ * api-workspace — GET /api/workspace/git-map?sessionId=…&dir=…
20
+ *
21
+ * Per-level repo flags for the workspace explorer (Git Eye ADR 2026-09-12,
22
+ * D1/D3): which immediate child directories host a .git entry, and whether
23
+ * the level itself does. Detection lives in $lib/server/git-probe and is
24
+ * GATED (ADR D2): unless the owning session's sandbox mode is
25
+ * danger-full-access, the route answers { ok:true, enabled:false } and
26
+ * touches the filesystem for NOTHING. Errors keep the explorer's honest
27
+ * failure face: a vanished directory is 404 not-found, a forbidden one 403,
28
+ * anything else the shared status mapping.
29
+ */
30
+ function errnoStatus(err) {
31
+ const code = err?.code;
32
+ if (code === "ENOENT") return 404;
33
+ if (code === "EACCES" || code === "EPERM") return 403;
34
+ return statusFor(err);
35
+ }
36
+ var GET = async ({ url }) => {
37
+ const sessionId = url.searchParams.get("sessionId");
38
+ const dir = url.searchParams.get("dir");
39
+ if (sessionId === null || sessionId.trim().length === 0 || dir === null || dir.trim().length === 0) return json({
40
+ ok: false,
41
+ error: {
42
+ code: "bad-params",
43
+ message: "sessionId and dir are required"
44
+ }
45
+ }, { status: 400 });
46
+ let enabled;
47
+ try {
48
+ enabled = await gitGateEnabled(sessionId);
49
+ } catch (err) {
50
+ return json(mapRpcFailure(err), { status: statusFor(err) });
51
+ }
52
+ if (!enabled) return json({
53
+ ok: true,
54
+ enabled: false
55
+ });
56
+ try {
57
+ const map = await detectRepos(dir);
58
+ return json({
59
+ ok: true,
60
+ enabled: true,
61
+ ...map
62
+ });
63
+ } catch (err) {
64
+ return json({
65
+ ok: false,
66
+ error: {
67
+ code: "probe-failed",
68
+ message: err instanceof Error ? err.message : "probe failed"
69
+ }
70
+ }, { status: errnoStatus(err) });
71
+ }
72
+ };
73
+
74
+ export { GET };
75
+ //# sourceMappingURL=_server.ts.js-kbPAnTV6.js.map