agentroam-runtime-darwin-arm64 0.2.0-preview.37 → 0.2.0-preview.39

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 (203) hide show
  1. package/manifest.json +2 -2
  2. package/package.json +1 -1
  3. package/runtime/.next/BUILD_ID +1 -1
  4. package/runtime/.next/app-build-manifest.json +14 -14
  5. package/runtime/.next/app-path-routes-manifest.json +1 -1
  6. package/runtime/.next/build-manifest.json +6 -6
  7. package/runtime/.next/prerender-manifest.json +1 -1
  8. package/runtime/.next/react-loadable-manifest.json +12 -4
  9. package/runtime/.next/required-server-files.json +1 -1
  10. package/runtime/.next/routes-manifest.json +1 -1
  11. package/runtime/.next/server/app/_not-found/page.js +1 -1
  12. package/runtime/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/runtime/.next/server/app/_not-found.html +1 -1
  14. package/runtime/.next/server/app/_not-found.rsc +1 -1
  15. package/runtime/.next/server/app/api/agent/abort/route.js +1 -1
  16. package/runtime/.next/server/app/api/agent/answer/route.js +1 -1
  17. package/runtime/.next/server/app/api/agent/harness/status/route.js +1 -1
  18. package/runtime/.next/server/app/api/agent/model/route.js +1 -1
  19. package/runtime/.next/server/app/api/agent/models/route.js +1 -1
  20. package/runtime/.next/server/app/api/agent/run/route.js +3 -3
  21. package/runtime/.next/server/app/api/agent/runtime-health/route.js +1 -1
  22. package/runtime/.next/server/app/api/agent/steer/route.js +1 -1
  23. package/runtime/.next/server/app/api/agent/stream/route.js +3 -3
  24. package/runtime/.next/server/app/api/agent-workspaces/[workspaceId]/sessions/route.js +1 -1
  25. package/runtime/.next/server/app/api/agent-workspaces/route.js +1 -1
  26. package/runtime/.next/server/app/api/auth/verify/route.js +1 -1
  27. package/runtime/.next/server/app/api/business/route.js +1 -1
  28. package/runtime/.next/server/app/api/client-logs/route.js +1 -1
  29. package/runtime/.next/server/app/api/flow/v1/catalog/route.js +1 -1
  30. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/cancel/route.js +1 -1
  31. package/runtime/.next/server/app/api/flow/v1/runs/[runId]/events/route.js +2 -2
  32. package/runtime/.next/server/app/api/flow/v1/runs/route.js +1 -1
  33. package/runtime/.next/server/app/api/flow-studio/config/route.js +1 -1
  34. package/runtime/.next/server/app/api/mcp/connect/route.js +1 -1
  35. package/runtime/.next/server/app/api/mcp/disconnect/route.js +1 -1
  36. package/runtime/.next/server/app/api/mcp/servers/route.js +1 -1
  37. package/runtime/.next/server/app/api/memory/[key]/route.js +1 -1
  38. package/runtime/.next/server/app/api/memory/route.js +1 -1
  39. package/runtime/.next/server/app/api/plugins/load/route.js +1 -1
  40. package/runtime/.next/server/app/api/projects/[id]/route.js +1 -1
  41. package/runtime/.next/server/app/api/projects/check/route.js +1 -1
  42. package/runtime/.next/server/app/api/projects/directories/route.js +1 -1
  43. package/runtime/.next/server/app/api/projects/roots/route.js +1 -1
  44. package/runtime/.next/server/app/api/projects/route.js +1 -1
  45. package/runtime/.next/server/app/api/push/subscribe/route.js +2 -2
  46. package/runtime/.next/server/app/api/push/unsubscribe/route.js +2 -2
  47. package/runtime/.next/server/app/api/push/vapid/route.js +2 -2
  48. package/runtime/.next/server/app/api/push/vapid.body +1 -1
  49. package/runtime/.next/server/app/api/remote-tools/register/route.js +1 -1
  50. package/runtime/.next/server/app/api/sessions/[id]/changes/route.js +2 -2
  51. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js +1 -1
  52. package/runtime/.next/server/app/api/sessions/[id]/fork/route.js.nft.json +1 -1
  53. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js +1 -0
  54. package/runtime/.next/server/app/api/sessions/[id]/fork-at/route.js.nft.json +1 -0
  55. package/runtime/.next/server/app/api/sessions/[id]/goals/route.js +1 -1
  56. package/runtime/.next/server/app/api/sessions/[id]/handoff/route.js +1 -1
  57. package/runtime/.next/server/app/api/sessions/[id]/query-index/route.js +1 -1
  58. package/runtime/.next/server/app/api/sessions/[id]/release/route.js +1 -1
  59. package/runtime/.next/server/app/api/sessions/[id]/route.js +1 -1
  60. package/runtime/.next/server/app/api/sessions/[id]/thread-goal/route.js +1 -1
  61. package/runtime/.next/server/app/api/sessions/[id]/tool-result/route.js +1 -1
  62. package/runtime/.next/server/app/api/sessions/route.js +1 -1
  63. package/runtime/.next/server/app/api/settings/route.js +1 -1
  64. package/runtime/.next/server/app/api/skills/route.js +1 -1
  65. package/runtime/.next/server/app/api/tool-policies/[policyId]/route.js +1 -1
  66. package/runtime/.next/server/app/api/tool-policies/route.js +1 -1
  67. package/runtime/.next/server/app/api/tools/route.js +1 -1
  68. package/runtime/.next/server/app/api/update/check/route.js +1 -1
  69. package/runtime/.next/server/app/api/update/install/route.js +1 -1
  70. package/runtime/.next/server/app/api/update/status/route.js +1 -1
  71. package/runtime/.next/server/app/api/web-auth/login/route.js +1 -1
  72. package/runtime/.next/server/app/api/web-auth/logout/route.js +1 -1
  73. package/runtime/.next/server/app/api/web-auth/revoke-all/route.js +1 -1
  74. package/runtime/.next/server/app/api/web-auth/setup/route.js +1 -1
  75. package/runtime/.next/server/app/api/web-auth/status/route.js +1 -1
  76. package/runtime/.next/server/app/api/web-console/bootstrap/route.js +1 -1
  77. package/runtime/.next/server/app/api/web-console/device-state/route.js +1 -1
  78. package/runtime/.next/server/app/api/web-console/history/route.js +1 -1
  79. package/runtime/.next/server/app/api/web-console/preferences/route.js +1 -1
  80. package/runtime/.next/server/app/web/page.js +2 -2
  81. package/runtime/.next/server/app/web/page_client-reference-manifest.js +1 -1
  82. package/runtime/.next/server/app-paths-manifest.json +20 -19
  83. package/runtime/.next/server/chunks/1322.js +72 -69
  84. package/runtime/.next/server/chunks/1773.js +38 -38
  85. package/runtime/.next/server/chunks/2293.js +1 -1
  86. package/runtime/.next/server/chunks/366.js +1 -0
  87. package/runtime/.next/server/chunks/5303.js +1 -1
  88. package/runtime/.next/server/chunks/8532.js +1 -1
  89. package/runtime/.next/server/middleware-build-manifest.js +1 -1
  90. package/runtime/.next/server/middleware-react-loadable-manifest.js +1 -1
  91. package/runtime/.next/server/pages/404.html +1 -1
  92. package/runtime/.next/server/pages/500.html +1 -1
  93. package/runtime/.next/server/server-reference-manifest.json +1 -1
  94. package/runtime/.next/static/chunks/326.567dcaf52a3fbf80.js +1 -0
  95. package/runtime/.next/static/chunks/693-41d7c8e27a8513d1.js +1 -0
  96. package/runtime/.next/static/chunks/784.1394d774230a5516.js +1 -0
  97. package/runtime/.next/static/chunks/834.801325c7f934eee6.js +1 -0
  98. package/runtime/.next/static/chunks/940.56137a61c838fa42.js +1 -0
  99. package/runtime/.next/static/chunks/95.ff2ef92ac2b1c909.js +1 -0
  100. package/runtime/.next/static/chunks/app/web/{error-7bdc841dab0f7345.js → error-f69dbd3718cb2107.js} +1 -1
  101. package/runtime/.next/static/chunks/app/web/layout-e0dd41d18df8ee9e.js +1 -0
  102. package/runtime/.next/static/chunks/app/web/page-f9926cbf4c1badd4.js +1 -0
  103. package/runtime/.next/static/chunks/{main-app-851d67ddcf02e2c2.js → main-app-d527fa0b25a0c755.js} +1 -1
  104. package/runtime/.next/static/chunks/webpack-d4e32619d2ce6d30.js +1 -0
  105. package/runtime/.next/static/css/e87416656ec8a57e.css +1 -0
  106. package/runtime/lib/remote-control/helper-manager.mjs +4 -1
  107. package/runtime/lib/remote-control/remote-authorization.mjs +21 -7
  108. package/runtime/native/AgentRoam Remote Desktop.app/Contents/MacOS/agentroam-remote-desktop +0 -0
  109. package/runtime/node_modules/.package-lock.json +11 -11
  110. package/runtime/node_modules/@agent/core/dist/index.js +123 -9
  111. package/runtime/node_modules/@agent/native-runtime/dist/index.js +141 -35
  112. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +77 -76
  113. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +48 -48
  114. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-2haqfy07.mjs +33 -0
  115. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-a92dt75k.mjs +40 -0
  116. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +17 -17
  117. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +19 -25
  118. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +23 -29
  119. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/package.json +12 -12
  120. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +53 -53
  121. package/runtime/package-lock.json +35 -35
  122. package/runtime/server.js +1 -1
  123. package/runtime/webapp/dist/assets/App-COIcZZvf.js +487 -0
  124. package/runtime/webapp/dist/assets/{App-CMOzoP5A.css → App-iUeP1CBo.css} +1 -1
  125. package/runtime/webapp/dist/assets/{abnfDiagram-VCTEODGH-CEAlrV9-.js → abnfDiagram-VCTEODGH-d4urtMQU.js} +1 -1
  126. package/runtime/webapp/dist/assets/{arc-CGetF_lO.js → arc-DiQEpEJQ.js} +1 -1
  127. package/runtime/webapp/dist/assets/{architectureDiagram-5GKGNRK7-BVksDtm9.js → architectureDiagram-5GKGNRK7-CWYKGqND.js} +1 -1
  128. package/runtime/webapp/dist/assets/{blockDiagram-I7D4REHJ-BvCo3epW.js → blockDiagram-I7D4REHJ-J2I0b5Zn.js} +1 -1
  129. package/runtime/webapp/dist/assets/{c4Diagram-7LVT6UL2-DwUEj82r.js → c4Diagram-7LVT6UL2-C-0xWeN3.js} +1 -1
  130. package/runtime/webapp/dist/assets/channel-B6S3kcST.js +1 -0
  131. package/runtime/webapp/dist/assets/{chunk-2Q5K7J3B-BQmtZUl-.js → chunk-2Q5K7J3B-CqodmK6L.js} +1 -1
  132. package/runtime/webapp/dist/assets/{chunk-5VM5RSS4-BXDY0cCC.js → chunk-5VM5RSS4-DClUnQcr.js} +1 -1
  133. package/runtime/webapp/dist/assets/{chunk-F27PBJKO-BPhfHsOp.js → chunk-F27PBJKO-CpaDg7Bg.js} +1 -1
  134. package/runtime/webapp/dist/assets/{chunk-IMKFNOWR-Dw-LyvaC.js → chunk-IMKFNOWR-CTIf9EjK.js} +1 -1
  135. package/runtime/webapp/dist/assets/{chunk-JWPE2WC7-Cdi61XTf.js → chunk-JWPE2WC7-DKalSWMm.js} +1 -1
  136. package/runtime/webapp/dist/assets/{chunk-POPQ4Y6H-eqgC5BfH.js → chunk-POPQ4Y6H-69MmeyRW.js} +1 -1
  137. package/runtime/webapp/dist/assets/{chunk-SVP7TREG-Dyzqf0xA.js → chunk-SVP7TREG-DCXWXzhU.js} +1 -1
  138. package/runtime/webapp/dist/assets/{chunk-TICWLB2K-DMy_FAyQ.js → chunk-TICWLB2K-B5nbTEng.js} +1 -1
  139. package/runtime/webapp/dist/assets/{chunk-XXDRQBXY-Dc3ya8KM.js → chunk-XXDRQBXY-DsJvkUuN.js} +1 -1
  140. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-CyUA2YaV.js +1 -0
  141. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-CyUA2YaV.js +1 -0
  142. package/runtime/webapp/dist/assets/codeSyntax-DJH88FPL.js +5 -0
  143. package/runtime/webapp/dist/assets/{cose-bilkent-JH36ORCC-8SpbJGQ_.js → cose-bilkent-JH36ORCC-BamzQ_e_.js} +1 -1
  144. package/runtime/webapp/dist/assets/{cynefin-OW5HDTMX-DZ8NcP4L.js → cynefin-OW5HDTMX-BI_j1tbW.js} +1 -1
  145. package/runtime/webapp/dist/assets/{cynefinDiagram-5FMLGOSQ-C-g805uS.js → cynefinDiagram-5FMLGOSQ-DuxMrVM2.js} +1 -1
  146. package/runtime/webapp/dist/assets/{dagre-GXQ25YYZ-Cr8OiP_4.js → dagre-GXQ25YYZ-Y9_ne36w.js} +1 -1
  147. package/runtime/webapp/dist/assets/{diagram-S7CK7UJ4-Be71Foqh.js → diagram-S7CK7UJ4-DIIjO29m.js} +1 -1
  148. package/runtime/webapp/dist/assets/{diagram-UQ7AKVKN-CeDsu1RS.js → diagram-UQ7AKVKN-C4m2VMIy.js} +1 -1
  149. package/runtime/webapp/dist/assets/{diagram-VSXAHHWV-CObfkAwP.js → diagram-VSXAHHWV-Cw5aPZ0o.js} +1 -1
  150. package/runtime/webapp/dist/assets/{diagram-VX7I27RA-B6lAuke7.js → diagram-VX7I27RA-W8nmVcOl.js} +1 -1
  151. package/runtime/webapp/dist/assets/{diagram-Z3DM3KII-8oGhKMeq.js → diagram-Z3DM3KII-TksnHlQo.js} +1 -1
  152. package/runtime/webapp/dist/assets/{ebnfDiagram-PWID7BFC-DmiqrULj.js → ebnfDiagram-PWID7BFC-B3WM1b4a.js} +1 -1
  153. package/runtime/webapp/dist/assets/{erDiagram-RLTQ6QDP-BB_7Zdd4.js → erDiagram-RLTQ6QDP-BWctPuya.js} +1 -1
  154. package/runtime/webapp/dist/assets/{flowDiagram-HODETNUW-DbuKFxoO.js → flowDiagram-HODETNUW-BG5RMrLN.js} +1 -1
  155. package/runtime/webapp/dist/assets/{ganttDiagram-EL5Y4UJY-DAM3Gwd_.js → ganttDiagram-EL5Y4UJY-CPcR7Kn_.js} +1 -1
  156. package/runtime/webapp/dist/assets/{gitGraphDiagram-WWUBYQGX-Ci91dL5m.js → gitGraphDiagram-WWUBYQGX-Sg6KChEd.js} +1 -1
  157. package/runtime/webapp/dist/assets/{index-NmsboYZi.css → index-CtJgsVah.css} +1 -1
  158. package/runtime/webapp/dist/assets/{index-ZpxfzUdy.js → index-tQnPGo1_.js} +4 -4
  159. package/runtime/webapp/dist/assets/{infoDiagram-27XIBGKW-D717Ys7n.js → infoDiagram-27XIBGKW-BvrtvnrY.js} +1 -1
  160. package/runtime/webapp/dist/assets/{ishikawaDiagram-5VMMS53U-BF6gmyPX.js → ishikawaDiagram-5VMMS53U-Bz-dZQLJ.js} +1 -1
  161. package/runtime/webapp/dist/assets/{journeyDiagram-3NMN7TZE-B6ZY-IXx.js → journeyDiagram-3NMN7TZE-Cb4s9jRE.js} +1 -1
  162. package/runtime/webapp/dist/assets/{kanban-definition-UXKFOSKX-DH3FR2sI.js → kanban-definition-UXKFOSKX-IjMPUHg9.js} +1 -1
  163. package/runtime/webapp/dist/assets/{layout-BOnxGXiM.js → layout-DHjqr0PJ.js} +1 -1
  164. package/runtime/webapp/dist/assets/{linear-M6pkDoQ3.js → linear-COctZkFy.js} +1 -1
  165. package/runtime/webapp/dist/assets/{mermaid.core-DxK9Epxh.js → mermaid.core-BnonXfHT.js} +5 -5
  166. package/runtime/webapp/dist/assets/{mindmap-definition-YA3MSWOX-DpZ-X_Vf.js → mindmap-definition-YA3MSWOX-hxBlXJJE.js} +1 -1
  167. package/runtime/webapp/dist/assets/{pegDiagram-XKGWAZYB-ZxLpbtO1.js → pegDiagram-XKGWAZYB-D6KJ8Ftm.js} +1 -1
  168. package/runtime/webapp/dist/assets/{pieDiagram-E7YTZNPT-B26_pDmg.js → pieDiagram-E7YTZNPT-BzKWZmHN.js} +1 -1
  169. package/runtime/webapp/dist/assets/{quadrantDiagram-AXDQQJYC-C-qB9cbX.js → quadrantDiagram-AXDQQJYC-ZhiPKt96.js} +1 -1
  170. package/runtime/webapp/dist/assets/{railroadDiagram-O6MQD6OU-C54V-8Ku.js → railroadDiagram-O6MQD6OU-BtKhiOPG.js} +1 -1
  171. package/runtime/webapp/dist/assets/{requirementDiagram-BXWQKSXE-CaMYVKMk.js → requirementDiagram-BXWQKSXE-OFr_TA8V.js} +1 -1
  172. package/runtime/webapp/dist/assets/{sankeyDiagram-P5KCCOFB-DsrVKW_h.js → sankeyDiagram-P5KCCOFB-qNTDFxAX.js} +1 -1
  173. package/runtime/webapp/dist/assets/{sequenceDiagram-WJ2MYXX4-C5ImABz1.js → sequenceDiagram-WJ2MYXX4-B7s5-R4s.js} +1 -1
  174. package/runtime/webapp/dist/assets/{sizeCapture-INFHLROL-wM9HJhkr.js → sizeCapture-INFHLROL-DdFabbN6.js} +1 -1
  175. package/runtime/webapp/dist/assets/{stateDiagram-D77RDMKH-BY8hQ5ro.js → stateDiagram-D77RDMKH-CmAN4pX7.js} +1 -1
  176. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-DsxpCqde.js +1 -0
  177. package/runtime/webapp/dist/assets/{swimlanes-42K2YHIH-OsTKRKJW.js → swimlanes-42K2YHIH-BQlIJAhf.js} +1 -1
  178. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-tji3GZVz.js +8 -0
  179. package/runtime/webapp/dist/assets/{timeline-definition-24CTP7MA-DqyQVkVW.js → timeline-definition-24CTP7MA--Y1zJ9mc.js} +1 -1
  180. package/runtime/webapp/dist/assets/{vennDiagram-4TSXK5OY-Di3KXYdD.js → vennDiagram-4TSXK5OY-CUn6FScx.js} +1 -1
  181. package/runtime/webapp/dist/assets/{wardleyDiagram-VM6X3IG4-CnJpZdMd.js → wardleyDiagram-VM6X3IG4-Bbz-WBd5.js} +1 -1
  182. package/runtime/webapp/dist/assets/{web-BMb61xwV.js → web-DzBEnE5q.js} +1 -1
  183. package/runtime/webapp/dist/assets/{web-eq1eso0Y.js → web-harvpkJj.js} +1 -1
  184. package/runtime/webapp/dist/assets/{xychartDiagram-S5SC5T6Z-frC_Dy5B.js → xychartDiagram-S5SC5T6Z-RA9edGdQ.js} +1 -1
  185. package/runtime/webapp/dist/index.html +2 -2
  186. package/runtime/ws-server.mjs +5 -5
  187. package/runtime/.next/static/chunks/221.80fc551c3d6118e2.js +0 -1
  188. package/runtime/.next/static/chunks/326.c10c95f947d32ecb.js +0 -1
  189. package/runtime/.next/static/chunks/750-1766abd7e24fd1d6.js +0 -1
  190. package/runtime/.next/static/chunks/942.1dec0ce762e131a5.js +0 -1
  191. package/runtime/.next/static/chunks/app/web/layout-e5b1780d2961e7c0.js +0 -1
  192. package/runtime/.next/static/chunks/app/web/page-f5171cee114f2892.js +0 -1
  193. package/runtime/.next/static/chunks/webpack-3ff471b94db6b1b2.js +0 -1
  194. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-reghh1vn.mjs +0 -33
  195. package/runtime/node_modules/@anthropic-ai/claude-agent-sdk/core-tm6xdb2r.mjs +0 -40
  196. package/runtime/webapp/dist/assets/App-DQ5fJODJ.js +0 -476
  197. package/runtime/webapp/dist/assets/channel-BjAaNinW.js +0 -1
  198. package/runtime/webapp/dist/assets/classDiagram-ZZMXUADV-BA6foNu5.js +0 -1
  199. package/runtime/webapp/dist/assets/classDiagram-v2-VYDZK3BY-BA6foNu5.js +0 -1
  200. package/runtime/webapp/dist/assets/stateDiagram-v2-MP3YSRHH-D7wp4Sey.js +0 -1
  201. package/runtime/webapp/dist/assets/swimlanesDiagram-VR7AAH4N-Dq79H5La.js +0 -8
  202. /package/runtime/.next/static/{ENg3PaHjA_727MHwcEIkE → BmUH3xLHQfGkG3yzEK37i}/_buildManifest.js +0 -0
  203. /package/runtime/.next/static/{ENg3PaHjA_727MHwcEIkE → BmUH3xLHQfGkG3yzEK37i}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=2166,e.ids=[2166],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},2534:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>d,routeModule:()=>l,serverHooks:()=>m,staticGenerationAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{POST:()=>p});var o=t(7786),n=t(5042),u=t(2184),i=t(1890),a=t(7519);function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}async function p(e){let r;try{r=await e.json()}catch{return i.NextResponse.json({error:"Invalid JSON"},{status:400})}let t=function(e){if(!c(e))return{success:!1,error:"Request body must be an object"};if("string"!=typeof e.projectId||0===e.projectId.length)return{success:!1,error:"projectId is required"};if(!Array.isArray(e.tools)||0===e.tools.length)return{success:!1,error:"tools must contain at least one tool"};let r=[];for(let o of e.tools){var t,s;if(!c(o))return{success:!1,error:"tool must be an object"};if("string"!=typeof o.scheme||0===o.scheme.length)return{success:!1,error:"tool.scheme is required"};if("string"!=typeof o.purpose||0===o.purpose.length)return{success:!1,error:"tool.purpose is required"};if("string"!=typeof o.url)return{success:!1,error:"tool.url is required"};try{new URL(o.url)}catch{return{success:!1,error:"tool.url must be a valid URL"}}if(void 0!==o.method&&"POST"!==o.method)return{success:!1,error:"tool.method must be POST"};let e=void 0===o.headers?{}:c(t=o.headers)&&Object.values(t).every(e=>"string"==typeof e)?t:null,n=void 0===o.inputSchema?{}:o.inputSchema,u=void 0===o.outputSchema?{}:o.outputSchema,i=void 0===o.examples?[]:Array.isArray(s=o.examples)&&s.every(c)?s:null,a=void 0===o.auth?{}:o.auth;if(!e)return{success:!1,error:"tool.headers must be a string record"};if(!c(n))return{success:!1,error:"tool.inputSchema must be an object"};if(!c(u))return{success:!1,error:"tool.outputSchema must be an object"};if(!i)return{success:!1,error:"tool.examples must be an array of objects"};if(!c(a))return{success:!1,error:"tool.auth must be an object"};r.push({scheme:o.scheme,purpose:o.purpose,url:o.url,method:"POST",headers:e,inputSchema:n,outputSchema:u,examples:i,auth:a})}return{success:!0,data:{projectId:e.projectId,tools:r}}}(r);if(!t.success)return i.NextResponse.json({error:t.error},{status:400});if(!function(e,r){let t=e.headers.get("authorization");if([process.env.AGENT_REMOTE_TOOLS_REGISTER_TOKEN,process.env.AGENT_SDK_REGISTRATION_TOKEN].filter(e=>!!e).some(e=>t===`Bearer ${e}`))return!0;let s=process.env.AGENT_SDK_TOKEN;return!!s&&t===`Bearer ${s}`&&function(e,r){var t;let s;if(!process.env.AGENT_PROJECT_ID)return!1;let o=e.headers.get("origin");if(!o)return!1;try{s=new URL(o).origin}catch{return!1}let n=(t=r.projectId,process.env.AGENT_PROJECT_ID&&t===process.env.AGENT_PROJECT_ID?process.env.AGENT_SDK_ALLOWED_ORIGIN??process.env.AGENT_BROWSER_ORIGIN??null:null);if(n)try{if(new URL(n).origin!==s)return!1}catch{return!1}else if(process.env.AGENT_PROJECT_ID)return!1;return r.tools.every(e=>{try{return new URL(e.url).origin===s}catch{return!1}})}(e,r)}(e,t.data))return i.NextResponse.json({error:"UNAUTHORIZED"},{status:401});let s=a.agentHost.registerRemoteTools(t.data.projectId,t.data.tools);return i.NextResponse.json({ok:!0,tools:s.map(e=>({scheme:e.scheme,purpose:e.purpose}))})}let l=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/remote-tools/register/route",pathname:"/api/remote-tools/register",filename:"route",bundlePath:"app/api/remote-tools/register/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-37/customer-agent/packages/server/app/api/remote-tools/register/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:d,staticGenerationAsyncStorage:h,serverHooks:m}=l,f="/api/remote-tools/register/route";function g(){return(0,u.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:h})}},1489:(e,r,t)=>{t.d(r,{N:()=>a});var s=t(1322),o=t(6279),n=t(785);class u{constructor(){this.tasks=new s.vo4((0,n.kO)()),this.scheduler=new o.ST(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:r}=await t.e(7519).then(t.bind(t,7519)),{getCustomerGoalCoordinator:s}=await Promise.all([t.e(7519),t.e(732)]).then(t.bind(t,732)),o=e.sessionId;o&&await r.getSessionStore().get(o)||(o=(await r.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:o})),await s().enqueue(o,e.prompt)}call(e,r){let t=String(r[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof r[0]||"string"!=typeof r[1]||!r[1].trim())throw Error("cron and prompt required");let e=r[2]&&"object"==typeof r[2]?r[2]:{};return this.tasks.create({cron:r[0],prompt:r[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(t);case"cronResume":return this.tasks.resume(t);case"cronDelete":return this.tasks.delete(t);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let i=globalThis;function a(){return i.__sharedCronService??=new u}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,6244,1322,1773,4621,7519],()=>t(2534));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=2166,e.ids=[2166],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},8829:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>f,patchFetch:()=>g,requestAsyncStorage:()=>d,routeModule:()=>l,serverHooks:()=>m,staticGenerationAsyncStorage:()=>h});var s={};t.r(s),t.d(s,{POST:()=>p});var o=t(7786),n=t(5042),u=t(2184),i=t(1890),a=t(7519);function c(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}async function p(e){let r;try{r=await e.json()}catch{return i.NextResponse.json({error:"Invalid JSON"},{status:400})}let t=function(e){if(!c(e))return{success:!1,error:"Request body must be an object"};if("string"!=typeof e.projectId||0===e.projectId.length)return{success:!1,error:"projectId is required"};if(!Array.isArray(e.tools)||0===e.tools.length)return{success:!1,error:"tools must contain at least one tool"};let r=[];for(let o of e.tools){var t,s;if(!c(o))return{success:!1,error:"tool must be an object"};if("string"!=typeof o.scheme||0===o.scheme.length)return{success:!1,error:"tool.scheme is required"};if("string"!=typeof o.purpose||0===o.purpose.length)return{success:!1,error:"tool.purpose is required"};if("string"!=typeof o.url)return{success:!1,error:"tool.url is required"};try{new URL(o.url)}catch{return{success:!1,error:"tool.url must be a valid URL"}}if(void 0!==o.method&&"POST"!==o.method)return{success:!1,error:"tool.method must be POST"};let e=void 0===o.headers?{}:c(t=o.headers)&&Object.values(t).every(e=>"string"==typeof e)?t:null,n=void 0===o.inputSchema?{}:o.inputSchema,u=void 0===o.outputSchema?{}:o.outputSchema,i=void 0===o.examples?[]:Array.isArray(s=o.examples)&&s.every(c)?s:null,a=void 0===o.auth?{}:o.auth;if(!e)return{success:!1,error:"tool.headers must be a string record"};if(!c(n))return{success:!1,error:"tool.inputSchema must be an object"};if(!c(u))return{success:!1,error:"tool.outputSchema must be an object"};if(!i)return{success:!1,error:"tool.examples must be an array of objects"};if(!c(a))return{success:!1,error:"tool.auth must be an object"};r.push({scheme:o.scheme,purpose:o.purpose,url:o.url,method:"POST",headers:e,inputSchema:n,outputSchema:u,examples:i,auth:a})}return{success:!0,data:{projectId:e.projectId,tools:r}}}(r);if(!t.success)return i.NextResponse.json({error:t.error},{status:400});if(!function(e,r){let t=e.headers.get("authorization");if([process.env.AGENT_REMOTE_TOOLS_REGISTER_TOKEN,process.env.AGENT_SDK_REGISTRATION_TOKEN].filter(e=>!!e).some(e=>t===`Bearer ${e}`))return!0;let s=process.env.AGENT_SDK_TOKEN;return!!s&&t===`Bearer ${s}`&&function(e,r){var t;let s;if(!process.env.AGENT_PROJECT_ID)return!1;let o=e.headers.get("origin");if(!o)return!1;try{s=new URL(o).origin}catch{return!1}let n=(t=r.projectId,process.env.AGENT_PROJECT_ID&&t===process.env.AGENT_PROJECT_ID?process.env.AGENT_SDK_ALLOWED_ORIGIN??process.env.AGENT_BROWSER_ORIGIN??null:null);if(n)try{if(new URL(n).origin!==s)return!1}catch{return!1}else if(process.env.AGENT_PROJECT_ID)return!1;return r.tools.every(e=>{try{return new URL(e.url).origin===s}catch{return!1}})}(e,r)}(e,t.data))return i.NextResponse.json({error:"UNAUTHORIZED"},{status:401});let s=a.agentHost.registerRemoteTools(t.data.projectId,t.data.tools);return i.NextResponse.json({ok:!0,tools:s.map(e=>({scheme:e.scheme,purpose:e.purpose}))})}let l=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/remote-tools/register/route",pathname:"/api/remote-tools/register",filename:"route",bundlePath:"app/api/remote-tools/register/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/remote-tools/register/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:d,staticGenerationAsyncStorage:h,serverHooks:m}=l,f="/api/remote-tools/register/route";function g(){return(0,u.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:h})}},1489:(e,r,t)=>{t.d(r,{N:()=>a});var s=t(1322),o=t(6279),n=t(785);class u{constructor(){this.tasks=new s.vo4((0,n.kO)()),this.scheduler=new o.ST(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:r}=await t.e(7519).then(t.bind(t,7519)),{getCustomerGoalCoordinator:s}=await Promise.all([t.e(7519),t.e(732)]).then(t.bind(t,732)),o=e.sessionId;o&&await r.getSessionStore().get(o)||(o=(await r.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:o})),await s().enqueue(o,e.prompt)}call(e,r){let t=String(r[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof r[0]||"string"!=typeof r[1]||!r[1].trim())throw Error("cron and prompt required");let e=r[2]&&"object"==typeof r[2]?r[2]:{};return this.tasks.create({cron:r[0],prompt:r[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(t);case"cronResume":return this.tasks.resume(t);case"cronDelete":return this.tasks.delete(t);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let i=globalThis;function a(){return i.__sharedCronService??=new u}}};var r=require("../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,6244,1322,1773,4621,7519],()=>t(8829));module.exports=s})();
@@ -1,8 +1,8 @@
1
- "use strict";(()=>{var e={};e.id=8917,e.ids=[8917],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},7034:(e,t,i)=>{i.r(t),i.d(t,{originalPathname:()=>eD,patchFetch:()=>ex,requestAsyncStorage:()=>eI,routeModule:()=>eR,serverHooks:()=>eN,staticGenerationAsyncStorage:()=>eT});var s={};i.r(s),i.d(s,{GET:()=>eP,dynamic:()=>ey,runtime:()=>ev});var r=i(7786),n=i(5042),a=i(2184),o=i(1322),h=i(785),l=i(1614),d=i(5673),c=i(7561),u=i(3977),p=i(9411),m=i(4492);let f={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},_={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:f.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:256};Object.freeze(_);let w="READDIRP_RECURSIVE_ERROR",g=new Set(["ENOENT","EPERM","EACCES","ELOOP",w]),E=[f.DIR_TYPE,f.EVERYTHING_TYPE,f.FILE_DIR_TYPE,f.FILE_TYPE],y=new Set([f.DIR_TYPE,f.EVERYTHING_TYPE,f.FILE_DIR_TYPE]),v=new Set([f.EVERYTHING_TYPE,f.FILE_DIR_TYPE,f.FILE_TYPE]),b=e=>g.has(e.code),P="win32"===process.platform,R=e=>!0,I=e=>{if(void 0===e)return R;if("function"==typeof e)return e;if("string"==typeof e){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return R};class T extends m.Readable{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;_relStart;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark??_.highWaterMark});let t={..._,...e},i=t.root??_.root,s=t.type??_.type;this._fileFilter=I(t.fileFilter),this._directoryFilter=I(t.directoryFilter);let r=t.lstat?u.lstat:u.stat;P?this._stat=e=>r(e,{bigint:!0}):this._stat=r,this._maxDepth=null!=t.depth&&Number.isSafeInteger(t.depth)?t.depth:_.depth,this._wantsDir=y.has(s),this._wantsFile=v.has(s),this._wantsEverything=s===f.EVERYTHING_TYPE,this._root=(0,p.resolve)(i),this._relStart=this._root.endsWith(p.sep)?this._root.length:this._root.length+1,this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent};let n={path:this._root,depth:1};n.pending=this._exploreDir(this._root,1),this.parents=[n],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,i=t&&t.files;if(i&&i.length>0){let{path:s,depth:r}=t,n=i.splice(0,e).map(e=>this._formatEntry(e,s));for(let t of this._isDirent?n:await Promise.all(n)){if(!t)continue;if(this.destroyed)return;let i=this._getEntryType(t);"string"!=typeof i&&(i=await i),"directory"===i&&this._directoryFilter(t)?(r<=this._maxDepth&&this.parents.push({path:t.fullPath,depth:r+1}),this._wantsDir&&(this.push(t),e--)):("file"===i||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}let t=e.pending??this._exploreDir(e.path,e.depth),i=this.parents[this.parents.length-1];if(i&&!i.pending&&(i.pending=this._exploreDir(i.path,i.depth)),this.parent=await t,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let i;try{i=await (0,u.readdir)(e,this._rdOptions)}catch(e){this._onError(e)}return{files:i,depth:t,path:e}}_formatEntry(e,t){let i=this._isDirent?e.name:e,s=(0,p.join)(t,i),r={path:s.slice(this._relStart),fullPath:s,basename:i};return this._isDirent?(r.dirent=e,r):this._stat(s).then(e=>(r.stats=e,r),e=>{this._onError(e)})}_onError(e){b(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}_getEntryType(e){if(!e||!(this._statsProp in e))return"";let t=e[this._statsProp];return t.isFile()?"file":t.isDirectory()?"directory":t.isSymbolicLink()?this._getSymlinkEntryType(e):""}async _getSymlinkEntryType(e){let t=e.fullPath;try{let e=await (0,u.realpath)(t),i=await (0,u.lstat)(e);if(i.isFile())return"file";if(i.isDirectory()){let i=e.length;if(t.startsWith(e)&&t[i]===p.sep){let i=Error(`Circular symlink detected: "${t}" points to "${e}"`);return i.code=w,this._onError(i),""}return"directory"}}catch(e){this._onError(e)}return""}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}var N=i(612);let D=()=>{},x=process.platform,A="win32"===x,O="darwin"===x,S="linux"===x,C="freebsd"===x,k="OS400"===(0,N.type)(),M={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},W={lstat:u.lstat,stat:u.stat},F="listeners",L="errHandlers",j="rawEmitters",U=[F,L,j],q=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),z=e=>q.has(p.extname(e).slice(1).toLowerCase()),G=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},H=(e,t,i)=>{let s=e[t];s instanceof Set||(e[t]=s=new Set([s])),s.add(i)},V=e=>t=>{let i=e[t];i instanceof Set?i.clear():delete e[t]},Y=(e,t,i)=>{let s=e[t];s instanceof Set?s.delete(i):s===i&&delete e[t]},$=e=>e instanceof Set?0===e.size:!e,B=new Map;function X(e,t,i,s,r){try{return(0,c.watch)(e,{persistent:t.persistent},(t,s)=>{i(e),r(t,s,{watchedPath:e}),s&&e!==s&&K(p.resolve(e,s),F,p.join(e,s))})}catch(e){s(e);return}}let K=(e,t,i,s,r)=>{let n=B.get(e);n&&G(n[t],e=>{e(i,s,r)})},Q=(e,t,i,s)=>{let r;let{listener:n,errHandler:a,rawEmitter:o}=s,h=B.get(t);if(!i.persistent){if(!(r=X(e,i,n,a,o)))return;return r.close.bind(r)}if(h)H(h,F,n),H(h,L,a),H(h,j,o);else{if(!(r=X(e,i,K.bind(null,t,F),a,K.bind(null,t,j))))return;r.on(M.ERROR,async i=>{let s=K.bind(null,t,L);if(h&&(h.watcherUnusable=!0),A&&"EPERM"===i.code)try{let t=await (0,u.open)(e,"r");await t.close(),s(i)}catch(e){}else s(i)}),h={listeners:n,errHandlers:a,rawEmitters:o,watcher:r},B.set(t,h)}return()=>{Y(h,F,n),Y(h,L,a),Y(h,j,o),$(h.listeners)&&(h.watcher.close(),B.delete(t),U.forEach(V(h)),h.watcher=void 0,Object.freeze(h))}},J=new Map,Z=(e,t,i,s)=>{let{listener:r,rawEmitter:n}=s,a=J.get(t),o=a&&a.options;return o&&(o.persistent<i.persistent||o.interval>i.interval)&&((0,c.unwatchFile)(t),a=void 0),a?(H(a,F,r),H(a,j,n)):(a={listeners:r,rawEmitters:n,options:i,watcher:(0,c.watchFile)(t,i,(i,s)=>{G(a.rawEmitters,e=>{e(M.CHANGE,t,{curr:i,prev:s})});let r=i.mtimeMs;(i.size!==s.size||r>s.mtimeMs||0===r)&&G(a.listeners,t=>t(e,i))})},J.set(t,a)),()=>{Y(a,F,r),Y(a,j,n),$(a.listeners)&&(J.delete(t),(0,c.unwatchFile)(t),a.options=a.watcher=void 0,Object.freeze(a))}};class ee{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let i;let s=this.fsw.options,r=p.dirname(e),n=p.basename(e);this.fsw._getWatchedDir(r).add(n);let a=p.resolve(e),o={persistent:s.persistent};if(t||(t=D),s.usePolling){let r=s.interval!==s.binaryInterval;o.interval=r&&z(n)?s.binaryInterval:s.interval,i=Z(e,a,o,{listener:t,rawEmitter:this.fsw._emitRaw})}else i=Q(e,a,o,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return i}_handleFile(e,t,i){if(this.fsw.closed)return;let s=p.dirname(e),r=p.basename(e),n=this.fsw._getWatchedDir(s),a=t;if(n.has(r))return;let o=async(t,i)=>{if(this.fsw._throttle("watch",e,5)){if(i&&0!==i.mtimeMs){if(n.has(r)){let t=i.atimeMs,s=i.mtimeMs;(!t||t<=s||s!==a.mtimeMs)&&this.fsw._emit(M.CHANGE,e,i),a=i}}else try{let i=await (0,u.stat)(e);if(this.fsw.closed)return;let s=i.atimeMs,r=i.mtimeMs;if((!s||s<=r||r!==a.mtimeMs)&&this.fsw._emit(M.CHANGE,e,i),(O||S||C)&&a.ino!==i.ino){this.fsw._closeFile(t),a=i;let s=this._watchWithNodeFs(e,o);s&&this.fsw._addPathCloser(t,s)}else a=i}catch(e){this.fsw._remove(s,r)}}},h=this._watchWithNodeFs(e,o);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(M.ADD,e,0))return;this.fsw._emit(M.ADD,e,t)}return h}async _handleSymlink(e,t,i,s){if(this.fsw.closed)return;let r=e.fullPath,n=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){let t;this.fsw._incrReadyCount();try{t=await (0,u.realpath)(i)}catch(e){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return n.has(s)?this.fsw._symlinkPaths.get(r)!==t&&(this.fsw._symlinkPaths.set(r,t),this.fsw._emit(M.CHANGE,i,e.stats)):(n.add(s),this.fsw._symlinkPaths.set(r,t),this.fsw._emit(M.ADD,i,e.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(e,t,i,s,r,n,a){e=p.join(e,"");let o=s?`${e}:${s}`:e;if(!(a=this.fsw._throttle("readdir",o,1e3)))return;let h=this.fsw._getWatchedDir(i.path),l=new Set,d=this.fsw._readdirp(e,{fileFilter:e=>i.filterPath(e),directoryFilter:e=>i.filterDir(e)});if(d)return d.on("data",async a=>{if(this.fsw.closed){d=void 0;return}let o=a.path,c=p.join(e,o);if(l.add(o),!(a.stats.isSymbolicLink()&&await this._handleSymlink(a,e,c,o))){if(this.fsw.closed){d=void 0;return}o!==s&&(s||h.has(o))||(this.fsw._incrReadyCount(),c=p.join(r,p.relative(r,c)),this._addToNodeFs(c,t,i,n+1))}}).on(M.ERROR,this._boundHandleError),new Promise((t,o)=>{if(!d)return o();d.once("end",()=>{if(this.fsw.closed){d=void 0;return}let o=!!a&&a.clear();t(void 0),h.getChildren().filter(t=>t!==e&&!l.has(t)).forEach(t=>{this.fsw._remove(e,t)}),d=void 0,o&&this._handleRead(e,!1,i,s,r,n,a)})})}async _handleDir(e,t,i,s,r,n,a){let o,h;let l=this.fsw._getWatchedDir(p.dirname(e)),d=l.has(p.basename(e));i&&this.fsw.options.ignoreInitial||r||d||this.fsw._emit(M.ADD_DIR,e,t),l.add(p.basename(e)),this.fsw._getWatchedDir(e);let c=this.fsw.options.depth;if((null==c||s<=c)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(e,i,n,r,e,s,o),this.fsw.closed))return;h=this._watchWithNodeFs(e,(t,i)=>{i&&0===i.mtimeMs||this._handleRead(t,!1,n,r,e,s,o)})}return h}async _addToNodeFs(e,t,i,s,r){let n=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return n(),!1;let a=this.fsw._getWatchHelpers(e);i&&(a.filterPath=e=>i.filterPath(e),a.filterDir=e=>i.filterDir(e));try{let i;let o=await W[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,o))return n(),!1;let h=this.fsw.options.followSymlinks;if(o.isDirectory()){let n=p.resolve(e),l=h?await (0,u.realpath)(e):e;if(this.fsw.closed||(i=await this._handleDir(a.watchPath,o,t,s,r,a,l),this.fsw.closed))return;n!==l&&void 0!==l&&this.fsw._symlinkPaths.set(n,l)}else if(o.isSymbolicLink()){let r=h?await (0,u.realpath)(e):e;if(this.fsw.closed)return;let n=p.dirname(a.watchPath);if(this.fsw._getWatchedDir(n).add(a.watchPath),this.fsw._emit(M.ADD,a.watchPath,o),i=await this._handleDir(n,o,t,s,e,a,r),this.fsw.closed)return;void 0!==r&&this.fsw._symlinkPaths.set(p.resolve(e),r)}else i=this._handleFile(a.watchPath,o,t);return n(),i&&this.fsw._addPathCloser(e,i),!1}catch(t){if(this.fsw._handleError(t))return n(),e}}}let et=/\\/g,ei=/\/\//g,es=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,er=/^\.[/\\]/;function en(e){return Array.isArray(e)?e:[e]}let ea=e=>"object"==typeof e&&null!==e&&!(e instanceof RegExp);function eo(e,t,i){let s=function(e){if("string"!=typeof e)throw Error("string expected");e=(e=p.normalize(e)).replace(/\\/g,"/");let t=!1;return e.startsWith("//")&&(t=!0),e=e.replace(ei,"/"),t&&(e="/"+e),e}(t);for(let t=0;t<e.length;t++)if((0,e[t])(s,i))return!0;return!1}let eh=e=>{let t=en(e).flat();if(!t.every(e=>"string"==typeof e))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(ed)},el=e=>{let t=e.replace(et,"/"),i=!1;return t.startsWith("//")&&(i=!0),t=t.replace(ei,"/"),i&&(t="/"+t),t},ed=e=>el(p.normalize(el(e))),ec=(e="")=>t=>"string"==typeof t?ed(p.isAbsolute(t)?t:p.join(e,t)):t,eu=(e,t)=>p.isAbsolute(e)?e:p.join(t,e),ep=Object.freeze(new Set);class em{path;_removeWatcher;items;constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&"."!==e&&".."!==e&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let i=this.path;try{await (0,u.readdir)(i)}catch(e){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=D,this.items=ep,Object.freeze(this)}}class ef{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(e,t,i){this.fsw=i;let s=e;this.path=e=e.replace(er,""),this.watchPath=s,this.fullWatchPath=p.resolve(s),this.dirParts=[],this.dirParts.forEach(e=>{e.length>1&&e.pop()}),this.followSymlinks=t,this.statMethod=t?"stat":"lstat"}entryPath(e){return p.join(this.watchPath,p.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let i=this.entryPath(e);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}}class e_ extends d.EventEmitter{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?en(e.ignored):en([]),awaitWriteFinish:!0===t?i:"object"==typeof t&&{...i,...t}};k&&(s.usePolling=!0),void 0===s.atomic&&(s.atomic=!s.usePolling);let r=process.env.CHOKIDAR_USEPOLLING;if(void 0!==r){let e=r.toLowerCase();"false"===e||"0"===e?s.usePolling=!1:"true"===e||"1"===e?s.usePolling=!0:s.usePolling=!!e}let n=process.env.CHOKIDAR_INTERVAL;n&&(s.interval=Number.parseInt(n,10));let a=0;this._emitReady=()=>{++a>=this._readyCount&&(this._emitReady=D,this._readyEmitted=!0,process.nextTick(()=>this.emit(M.READY)))},this._emitRaw=(...e)=>this.emit(M.RAW,...e),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new ee(this),Object.freeze(s)}_addIgnoredPath(e){if(ea(e)){for(let t of this._ignoredPaths)if(ea(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),"string"==typeof e)for(let t of this._ignoredPaths)ea(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(e,t,i){let{cwd:s}=this.options;this.closed=!1,this._closePromise=void 0;let r=eh(e);return s&&(r=r.map(e=>eu(e,s))),r.forEach(e=>{this._removeIgnoredPath(e)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=r.length,Promise.all(r.map(async e=>{let s=await this._nodeFsHandler._addToNodeFs(e,!i,void 0,0,t);return s&&this._emitReady(),s})).then(e=>{this.closed||e.forEach(e=>{e&&this.add(p.dirname(e),p.basename(t||e))})}),this}unwatch(e){if(this.closed)return this;let t=eh(e),{cwd:i}=this.options;return t.forEach(e=>{p.isAbsolute(e)||this._closers.has(e)||(i&&(e=p.join(i,e)),e=p.resolve(e)),this._closePath(e),this._addIgnoredPath(e),this._watched.has(e)&&this._addIgnoredPath({path:e,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(t=>{let i=t();i instanceof Promise&&e.push(i)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,i)=>{e[(this.options.cwd?p.relative(this.options.cwd,i):i)||"."]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(e,...t),e!==M.ERROR&&this.emit(M.ALL,e,...t)}async _emit(e,t,i){let s;if(this.closed)return;let r=this.options;A&&(t=p.normalize(t)),r.cwd&&(t=p.relative(r.cwd,t));let n=[t];null!=i&&n.push(i);let a=r.awaitWriteFinish;if(a&&(s=this._pendingWrites.get(t)))return s.lastChange=new Date,this;if(r.atomic){if(e===M.UNLINK)return this._pendingUnlinks.set(t,[e,...n]),setTimeout(()=>{this._pendingUnlinks.forEach((e,t)=>{this.emit(...e),this.emit(M.ALL,...e),this._pendingUnlinks.delete(t)})},"number"==typeof r.atomic?r.atomic:100),this;e===M.ADD&&this._pendingUnlinks.has(t)&&(e=M.CHANGE,this._pendingUnlinks.delete(t))}if(a&&(e===M.ADD||e===M.CHANGE)&&this._readyEmitted)return this._awaitWriteFinish(t,a.stabilityThreshold,e,(t,i)=>{t?(e=M.ERROR,n[0]=t,this.emitWithAll(e,n)):i&&(n.length>1?n[1]=i:n.push(i),this.emitWithAll(e,n))}),this;if(e===M.CHANGE&&!this._throttle(M.CHANGE,t,50))return this;if(r.alwaysStat&&void 0===i&&(e===M.ADD||e===M.ADD_DIR||e===M.CHANGE)){let e;let i=r.cwd?p.join(r.cwd,t):t;try{e=await (0,u.stat)(i)}catch(e){}if(!e||this.closed)return;n.push(e)}return this.emitWithAll(e,n),this}_handleError(e){let t=e&&e.code;return e&&"ENOENT"!==t&&"ENOTDIR"!==t&&(!this.options.ignorePermissionErrors||"EPERM"!==t&&"EACCES"!==t)&&this.emit(M.ERROR,e),e||this.closed}_throttle(e,t,i){let s;this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw Error("invalid throttle");let n=r.get(t);if(n)return n.count++,!1;let a=()=>{let e=r.get(t),i=e?e.count:0;return r.delete(t),clearTimeout(s),e&&clearTimeout(e.timeoutObject),i},o={timeoutObject:s=setTimeout(a,i),clear:a,count:0};return r.set(t,o),o}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,i,s){let r;let n=this.options.awaitWriteFinish;if("object"!=typeof n)return;let a=n.pollInterval,o=e;this.options.cwd&&!p.isAbsolute(e)&&(o=p.join(this.options.cwd,e));let h=new Date,l=this._pendingWrites;l.has(e)||(l.set(e,{lastChange:h,cancelWait:()=>(l.delete(e),clearTimeout(r),i)}),r=setTimeout(function i(n){(0,c.stat)(o,(o,h)=>{if(o||!l.has(e)){o&&"ENOENT"!==o.code&&s(o);return}let d=Number(new Date);n&&h.size!==n.size&&(l.get(e).lastChange=d),d-l.get(e).lastChange>=t?(l.delete(e),s(void 0,h)):r=setTimeout(i,a,h)})},a))}_isIgnored(e,t){if(this.options.atomic&&es.test(e))return!0;if(!this._userIgnored){let{cwd:e}=this.options,t=(this.options.ignored||[]).map(ec(e)),i=[...[...this._ignoredPaths].map(ec(e)),...t];this._userIgnored=function(e,t){if(null==e)throw TypeError("anymatch: specify first argument");let i=en(e).map(e=>"function"==typeof e?e:"string"==typeof e?t=>e===t:e instanceof RegExp?t=>e.test(t):"object"==typeof e&&null!==e?t=>{if(e.path===t)return!0;if(e.recursive){let i=p.relative(e.path,t);return!!i&&!i.startsWith("..")&&!p.isAbsolute(i)}return!1}:()=>!1);return null==t?(e,t)=>eo(i,e,t):eo(i,t)}(i,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new ef(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=p.resolve(e);return this._watched.has(t)||this._watched.set(t,new em(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){return!!this.options.ignorePermissionErrors||!!(256&Number(e.mode))}_remove(e,t,i){let s=p.join(e,t),r=p.resolve(s);if(i=null!=i?i:this._watched.has(s)||this._watched.has(r),!this._throttle("remove",s,100))return;i||1!==this._watched.size||this.add(e,t,!0),this._getWatchedDir(s).getChildren().forEach(e=>this._remove(s,e));let n=this._getWatchedDir(e),a=n.has(t);n.remove(t),this._symlinkPaths.has(r)&&this._symlinkPaths.delete(r);let o=s;if(this.options.cwd&&(o=p.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(o)&&this._pendingWrites.get(o).cancelWait()===M.ADD)return;this._watched.delete(s),this._watched.delete(r);let h=i?M.UNLINK_DIR:M.UNLINK;a&&!this._isIgnored(s)&&this._emit(h,s),this._closePath(s)}_closePath(e){this._closeFile(e);let t=p.dirname(e);this._getWatchedDir(t).remove(p.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(e=>e()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let i=this._closers.get(e);i||(i=[],this._closers.set(e,i)),i.push(t)}_readdirp(e,t){if(this.closed)return;let i=function(e,t={}){let i=t.entryType||t.type;if("both"===i&&(i=f.FILE_DIR_TYPE),e){if("string"!=typeof e)throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(i&&!E.includes(i))throw Error(`readdirp: Invalid type passed. Use one of ${E.join(", ")}`)}else throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");let s={...t,root:e};return i&&(s.type=i),new T(s)}(e,{type:M.ALL,alwaysStat:!0,lstat:!0,...t,depth:0});return this._streams.add(i),i.once("close",()=>{i=void 0}),i.once("end",()=>{i&&(this._streams.delete(i),i=void 0)}),i}}let ew=e=>(function(e,t={}){let i=new e_(t);return i.add(e),i})(e,{ignoreInitial:!0,persistent:!0});class eg{constructor(e=ew,t=150){this.watchFile=e,this.debounceMs=t,this.entries=new Map}subscribe(e,t,i){let s=`${e}\0${t}`,r=this.entries.get(s);if(!r){let e=this.watchFile(t);r={watcher:e,subscribers:new Set,revision:0,debounceTimer:null},e.on("add",()=>this.schedule(r)),e.on("change",()=>this.schedule(r)),this.entries.set(s,r)}r.subscribers.add(i);let n=!0;return()=>{if(!n)return;n=!1;let e=this.entries.get(s);e&&(e.subscribers.delete(i),0===e.subscribers.size&&this.releaseEntry(s,e))}}async dispose(){let e=[...this.entries.entries()];this.entries.clear(),await Promise.all(e.map(async([,e])=>{e.debounceTimer&&clearTimeout(e.debounceTimer),await e.watcher.close()}))}schedule(e){e.debounceTimer&&clearTimeout(e.debounceTimer),e.debounceTimer=setTimeout(()=>{e.debounceTimer=null,e.revision+=1;let t={type:"session_history_changed",revision:e.revision};for(let i of e.subscribers)try{i(t)}catch{}},this.debounceMs)}releaseEntry(e,t){this.entries.get(e)===t&&this.entries.delete(e),t.debounceTimer&&clearTimeout(t.debounceTimer),t.debounceTimer=null,t.watcher.close()}}let eE=globalThis,ey="force-dynamic",ev="nodejs",eb=new TextEncoder;async function eP(e,{params:t}){if(!(0,l.V_)(t.id))return function(e,t){let i=(0,o.N8n)((0,h.kO)()).db.prepare(`SELECT updated, status,
1
+ "use strict";(()=>{var e={};e.id=8917,e.ids=[8917],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},17:(e,t,i)=>{i.r(t),i.d(t,{originalPathname:()=>eD,patchFetch:()=>ex,requestAsyncStorage:()=>eI,routeModule:()=>eR,serverHooks:()=>eN,staticGenerationAsyncStorage:()=>eT});var s={};i.r(s),i.d(s,{GET:()=>eP,dynamic:()=>ey,runtime:()=>ev});var r=i(7786),n=i(5042),a=i(2184),o=i(1322),h=i(785),l=i(1614),d=i(5673),c=i(7561),u=i(3977),p=i(9411),m=i(4492);let f={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},_={root:".",fileFilter:e=>!0,directoryFilter:e=>!0,type:f.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:256};Object.freeze(_);let w="READDIRP_RECURSIVE_ERROR",g=new Set(["ENOENT","EPERM","EACCES","ELOOP",w]),E=[f.DIR_TYPE,f.EVERYTHING_TYPE,f.FILE_DIR_TYPE,f.FILE_TYPE],y=new Set([f.DIR_TYPE,f.EVERYTHING_TYPE,f.FILE_DIR_TYPE]),v=new Set([f.EVERYTHING_TYPE,f.FILE_DIR_TYPE,f.FILE_TYPE]),b=e=>g.has(e.code),P="win32"===process.platform,R=e=>!0,I=e=>{if(void 0===e)return R;if("function"==typeof e)return e;if("string"==typeof e){let t=e.trim();return e=>e.basename===t}if(Array.isArray(e)){let t=e.map(e=>e.trim());return e=>t.some(t=>e.basename===t)}return R};class T extends m.Readable{parents;reading;parent;_stat;_maxDepth;_wantsDir;_wantsFile;_wantsEverything;_root;_isDirent;_statsProp;_rdOptions;_fileFilter;_directoryFilter;_relStart;constructor(e={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:e.highWaterMark??_.highWaterMark});let t={..._,...e},i=t.root??_.root,s=t.type??_.type;this._fileFilter=I(t.fileFilter),this._directoryFilter=I(t.directoryFilter);let r=t.lstat?u.lstat:u.stat;P?this._stat=e=>r(e,{bigint:!0}):this._stat=r,this._maxDepth=null!=t.depth&&Number.isSafeInteger(t.depth)?t.depth:_.depth,this._wantsDir=y.has(s),this._wantsFile=v.has(s),this._wantsEverything=s===f.EVERYTHING_TYPE,this._root=(0,p.resolve)(i),this._relStart=this._root.endsWith(p.sep)?this._root.length:this._root.length+1,this._isDirent=!t.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent};let n={path:this._root,depth:1};n.pending=this._exploreDir(this._root,1),this.parents=[n],this.reading=!1,this.parent=void 0}async _read(e){if(!this.reading){this.reading=!0;try{for(;!this.destroyed&&e>0;){let t=this.parent,i=t&&t.files;if(i&&i.length>0){let{path:s,depth:r}=t,n=i.splice(0,e).map(e=>this._formatEntry(e,s));for(let t of this._isDirent?n:await Promise.all(n)){if(!t)continue;if(this.destroyed)return;let i=this._getEntryType(t);"string"!=typeof i&&(i=await i),"directory"===i&&this._directoryFilter(t)?(r<=this._maxDepth&&this.parents.push({path:t.fullPath,depth:r+1}),this._wantsDir&&(this.push(t),e--)):("file"===i||this._includeAsFile(t))&&this._fileFilter(t)&&this._wantsFile&&(this.push(t),e--)}}else{let e=this.parents.pop();if(!e){this.push(null);break}let t=e.pending??this._exploreDir(e.path,e.depth),i=this.parents[this.parents.length-1];if(i&&!i.pending&&(i.pending=this._exploreDir(i.path,i.depth)),this.parent=await t,this.destroyed)return}}}catch(e){this.destroy(e)}finally{this.reading=!1}}}async _exploreDir(e,t){let i;try{i=await (0,u.readdir)(e,this._rdOptions)}catch(e){this._onError(e)}return{files:i,depth:t,path:e}}_formatEntry(e,t){let i=this._isDirent?e.name:e,s=(0,p.join)(t,i),r={path:s.slice(this._relStart),fullPath:s,basename:i};return this._isDirent?(r.dirent=e,r):this._stat(s).then(e=>(r.stats=e,r),e=>{this._onError(e)})}_onError(e){b(e)&&!this.destroyed?this.emit("warn",e):this.destroy(e)}_getEntryType(e){if(!e||!(this._statsProp in e))return"";let t=e[this._statsProp];return t.isFile()?"file":t.isDirectory()?"directory":t.isSymbolicLink()?this._getSymlinkEntryType(e):""}async _getSymlinkEntryType(e){let t=e.fullPath;try{let e=await (0,u.realpath)(t),i=await (0,u.lstat)(e);if(i.isFile())return"file";if(i.isDirectory()){let i=e.length;if(t.startsWith(e)&&t[i]===p.sep){let i=Error(`Circular symlink detected: "${t}" points to "${e}"`);return i.code=w,this._onError(i),""}return"directory"}}catch(e){this._onError(e)}return""}_includeAsFile(e){let t=e&&e[this._statsProp];return t&&this._wantsEverything&&!t.isDirectory()}}var N=i(612);let D=()=>{},x=process.platform,A="win32"===x,O="darwin"===x,S="linux"===x,k="freebsd"===x,C="OS400"===(0,N.type)(),M={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},W={lstat:u.lstat,stat:u.stat},F="listeners",L="errHandlers",j="rawEmitters",U=[F,L,j],q=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),z=e=>q.has(p.extname(e).slice(1).toLowerCase()),G=(e,t)=>{e instanceof Set?e.forEach(t):t(e)},H=(e,t,i)=>{let s=e[t];s instanceof Set||(e[t]=s=new Set([s])),s.add(i)},V=e=>t=>{let i=e[t];i instanceof Set?i.clear():delete e[t]},Y=(e,t,i)=>{let s=e[t];s instanceof Set?s.delete(i):s===i&&delete e[t]},$=e=>e instanceof Set?0===e.size:!e,B=new Map;function X(e,t,i,s,r){try{return(0,c.watch)(e,{persistent:t.persistent},(t,s)=>{i(e),r(t,s,{watchedPath:e}),s&&e!==s&&K(p.resolve(e,s),F,p.join(e,s))})}catch(e){s(e);return}}let K=(e,t,i,s,r)=>{let n=B.get(e);n&&G(n[t],e=>{e(i,s,r)})},Q=(e,t,i,s)=>{let r;let{listener:n,errHandler:a,rawEmitter:o}=s,h=B.get(t);if(!i.persistent){if(!(r=X(e,i,n,a,o)))return;return r.close.bind(r)}if(h)H(h,F,n),H(h,L,a),H(h,j,o);else{if(!(r=X(e,i,K.bind(null,t,F),a,K.bind(null,t,j))))return;r.on(M.ERROR,async i=>{let s=K.bind(null,t,L);if(h&&(h.watcherUnusable=!0),A&&"EPERM"===i.code)try{let t=await (0,u.open)(e,"r");await t.close(),s(i)}catch(e){}else s(i)}),h={listeners:n,errHandlers:a,rawEmitters:o,watcher:r},B.set(t,h)}return()=>{Y(h,F,n),Y(h,L,a),Y(h,j,o),$(h.listeners)&&(h.watcher.close(),B.delete(t),U.forEach(V(h)),h.watcher=void 0,Object.freeze(h))}},J=new Map,Z=(e,t,i,s)=>{let{listener:r,rawEmitter:n}=s,a=J.get(t),o=a&&a.options;return o&&(o.persistent<i.persistent||o.interval>i.interval)&&((0,c.unwatchFile)(t),a=void 0),a?(H(a,F,r),H(a,j,n)):(a={listeners:r,rawEmitters:n,options:i,watcher:(0,c.watchFile)(t,i,(i,s)=>{G(a.rawEmitters,e=>{e(M.CHANGE,t,{curr:i,prev:s})});let r=i.mtimeMs;(i.size!==s.size||r>s.mtimeMs||0===r)&&G(a.listeners,t=>t(e,i))})},J.set(t,a)),()=>{Y(a,F,r),Y(a,j,n),$(a.listeners)&&(J.delete(t),(0,c.unwatchFile)(t),a.options=a.watcher=void 0,Object.freeze(a))}};class ee{fsw;_boundHandleError;constructor(e){this.fsw=e,this._boundHandleError=t=>e._handleError(t)}_watchWithNodeFs(e,t){let i;let s=this.fsw.options,r=p.dirname(e),n=p.basename(e);this.fsw._getWatchedDir(r).add(n);let a=p.resolve(e),o={persistent:s.persistent};if(t||(t=D),s.usePolling){let r=s.interval!==s.binaryInterval;o.interval=r&&z(n)?s.binaryInterval:s.interval,i=Z(e,a,o,{listener:t,rawEmitter:this.fsw._emitRaw})}else i=Q(e,a,o,{listener:t,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return i}_handleFile(e,t,i){if(this.fsw.closed)return;let s=p.dirname(e),r=p.basename(e),n=this.fsw._getWatchedDir(s),a=t;if(n.has(r))return;let o=async(t,i)=>{if(this.fsw._throttle("watch",e,5)){if(i&&0!==i.mtimeMs){if(n.has(r)){let t=i.atimeMs,s=i.mtimeMs;(!t||t<=s||s!==a.mtimeMs)&&this.fsw._emit(M.CHANGE,e,i),a=i}}else try{let i=await (0,u.stat)(e);if(this.fsw.closed)return;let s=i.atimeMs,r=i.mtimeMs;if((!s||s<=r||r!==a.mtimeMs)&&this.fsw._emit(M.CHANGE,e,i),(O||S||k)&&a.ino!==i.ino){this.fsw._closeFile(t),a=i;let s=this._watchWithNodeFs(e,o);s&&this.fsw._addPathCloser(t,s)}else a=i}catch(e){this.fsw._remove(s,r)}}},h=this._watchWithNodeFs(e,o);if(!(i&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(e)){if(!this.fsw._throttle(M.ADD,e,0))return;this.fsw._emit(M.ADD,e,t)}return h}async _handleSymlink(e,t,i,s){if(this.fsw.closed)return;let r=e.fullPath,n=this.fsw._getWatchedDir(t);if(!this.fsw.options.followSymlinks){let t;this.fsw._incrReadyCount();try{t=await (0,u.realpath)(i)}catch(e){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;return n.has(s)?this.fsw._symlinkPaths.get(r)!==t&&(this.fsw._symlinkPaths.set(r,t),this.fsw._emit(M.CHANGE,i,e.stats)):(n.add(s),this.fsw._symlinkPaths.set(r,t),this.fsw._emit(M.ADD,i,e.stats)),this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(r))return!0;this.fsw._symlinkPaths.set(r,!0)}_handleRead(e,t,i,s,r,n,a){e=p.join(e,"");let o=s?`${e}:${s}`:e;if(!(a=this.fsw._throttle("readdir",o,1e3)))return;let h=this.fsw._getWatchedDir(i.path),l=new Set,d=this.fsw._readdirp(e,{fileFilter:e=>i.filterPath(e),directoryFilter:e=>i.filterDir(e)});if(d)return d.on("data",async a=>{if(this.fsw.closed){d=void 0;return}let o=a.path,c=p.join(e,o);if(l.add(o),!(a.stats.isSymbolicLink()&&await this._handleSymlink(a,e,c,o))){if(this.fsw.closed){d=void 0;return}o!==s&&(s||h.has(o))||(this.fsw._incrReadyCount(),c=p.join(r,p.relative(r,c)),this._addToNodeFs(c,t,i,n+1))}}).on(M.ERROR,this._boundHandleError),new Promise((t,o)=>{if(!d)return o();d.once("end",()=>{if(this.fsw.closed){d=void 0;return}let o=!!a&&a.clear();t(void 0),h.getChildren().filter(t=>t!==e&&!l.has(t)).forEach(t=>{this.fsw._remove(e,t)}),d=void 0,o&&this._handleRead(e,!1,i,s,r,n,a)})})}async _handleDir(e,t,i,s,r,n,a){let o,h;let l=this.fsw._getWatchedDir(p.dirname(e)),d=l.has(p.basename(e));i&&this.fsw.options.ignoreInitial||r||d||this.fsw._emit(M.ADD_DIR,e,t),l.add(p.basename(e)),this.fsw._getWatchedDir(e);let c=this.fsw.options.depth;if((null==c||s<=c)&&!this.fsw._symlinkPaths.has(a)){if(!r&&(await this._handleRead(e,i,n,r,e,s,o),this.fsw.closed))return;h=this._watchWithNodeFs(e,(t,i)=>{i&&0===i.mtimeMs||this._handleRead(t,!1,n,r,e,s,o)})}return h}async _addToNodeFs(e,t,i,s,r){let n=this.fsw._emitReady;if(this.fsw._isIgnored(e)||this.fsw.closed)return n(),!1;let a=this.fsw._getWatchHelpers(e);i&&(a.filterPath=e=>i.filterPath(e),a.filterDir=e=>i.filterDir(e));try{let i;let o=await W[a.statMethod](a.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored(a.watchPath,o))return n(),!1;let h=this.fsw.options.followSymlinks;if(o.isDirectory()){let n=p.resolve(e),l=h?await (0,u.realpath)(e):e;if(this.fsw.closed||(i=await this._handleDir(a.watchPath,o,t,s,r,a,l),this.fsw.closed))return;n!==l&&void 0!==l&&this.fsw._symlinkPaths.set(n,l)}else if(o.isSymbolicLink()){let r=h?await (0,u.realpath)(e):e;if(this.fsw.closed)return;let n=p.dirname(a.watchPath);if(this.fsw._getWatchedDir(n).add(a.watchPath),this.fsw._emit(M.ADD,a.watchPath,o),i=await this._handleDir(n,o,t,s,e,a,r),this.fsw.closed)return;void 0!==r&&this.fsw._symlinkPaths.set(p.resolve(e),r)}else i=this._handleFile(a.watchPath,o,t);return n(),i&&this.fsw._addPathCloser(e,i),!1}catch(t){if(this.fsw._handleError(t))return n(),e}}}let et=/\\/g,ei=/\/\//g,es=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,er=/^\.[/\\]/;function en(e){return Array.isArray(e)?e:[e]}let ea=e=>"object"==typeof e&&null!==e&&!(e instanceof RegExp);function eo(e,t,i){let s=function(e){if("string"!=typeof e)throw Error("string expected");e=(e=p.normalize(e)).replace(/\\/g,"/");let t=!1;return e.startsWith("//")&&(t=!0),e=e.replace(ei,"/"),t&&(e="/"+e),e}(t);for(let t=0;t<e.length;t++)if((0,e[t])(s,i))return!0;return!1}let eh=e=>{let t=en(e).flat();if(!t.every(e=>"string"==typeof e))throw TypeError(`Non-string provided as watch path: ${t}`);return t.map(ed)},el=e=>{let t=e.replace(et,"/"),i=!1;return t.startsWith("//")&&(i=!0),t=t.replace(ei,"/"),i&&(t="/"+t),t},ed=e=>el(p.normalize(el(e))),ec=(e="")=>t=>"string"==typeof t?ed(p.isAbsolute(t)?t:p.join(e,t)):t,eu=(e,t)=>p.isAbsolute(e)?e:p.join(t,e),ep=Object.freeze(new Set);class em{path;_removeWatcher;items;constructor(e,t){this.path=e,this._removeWatcher=t,this.items=new Set}add(e){let{items:t}=this;t&&"."!==e&&".."!==e&&t.add(e)}async remove(e){let{items:t}=this;if(!t||(t.delete(e),t.size>0))return;let i=this.path;try{await (0,u.readdir)(i)}catch(e){this._removeWatcher&&this._removeWatcher(p.dirname(i),p.basename(i))}}has(e){let{items:t}=this;if(t)return t.has(e)}getChildren(){let{items:e}=this;return e?[...e.values()]:[]}dispose(){this.items.clear(),this.path="",this._removeWatcher=D,this.items=ep,Object.freeze(this)}}class ef{fsw;path;watchPath;fullWatchPath;dirParts;followSymlinks;statMethod;constructor(e,t,i){this.fsw=i;let s=e;this.path=e=e.replace(er,""),this.watchPath=s,this.fullWatchPath=p.resolve(s),this.dirParts=[],this.dirParts.forEach(e=>{e.length>1&&e.pop()}),this.followSymlinks=t,this.statMethod=t?"stat":"lstat"}entryPath(e){return p.join(this.watchPath,p.relative(this.watchPath,e.fullPath))}filterPath(e){let{stats:t}=e;if(t&&t.isSymbolicLink())return this.filterDir(e);let i=this.entryPath(e);return this.fsw._isntIgnored(i,t)&&this.fsw._hasReadPermissions(t)}filterDir(e){return this.fsw._isntIgnored(this.entryPath(e),e.stats)}}class e_ extends d.EventEmitter{closed;options;_closers;_ignoredPaths;_throttled;_streams;_symlinkPaths;_watched;_pendingWrites;_pendingUnlinks;_readyCount;_emitReady;_closePromise;_userIgnored;_readyEmitted;_emitRaw;_boundRemove;_nodeFsHandler;constructor(e={}){super(),this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let t=e.awaitWriteFinish,i={stabilityThreshold:2e3,pollInterval:100},s={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...e,ignored:e.ignored?en(e.ignored):en([]),awaitWriteFinish:!0===t?i:"object"==typeof t&&{...i,...t}};C&&(s.usePolling=!0),void 0===s.atomic&&(s.atomic=!s.usePolling);let r=process.env.CHOKIDAR_USEPOLLING;if(void 0!==r){let e=r.toLowerCase();"false"===e||"0"===e?s.usePolling=!1:"true"===e||"1"===e?s.usePolling=!0:s.usePolling=!!e}let n=process.env.CHOKIDAR_INTERVAL;n&&(s.interval=Number.parseInt(n,10));let a=0;this._emitReady=()=>{++a>=this._readyCount&&(this._emitReady=D,this._readyEmitted=!0,process.nextTick(()=>this.emit(M.READY)))},this._emitRaw=(...e)=>this.emit(M.RAW,...e),this._boundRemove=this._remove.bind(this),this.options=s,this._nodeFsHandler=new ee(this),Object.freeze(s)}_addIgnoredPath(e){if(ea(e)){for(let t of this._ignoredPaths)if(ea(t)&&t.path===e.path&&t.recursive===e.recursive)return}this._ignoredPaths.add(e)}_removeIgnoredPath(e){if(this._ignoredPaths.delete(e),"string"==typeof e)for(let t of this._ignoredPaths)ea(t)&&t.path===e&&this._ignoredPaths.delete(t)}add(e,t,i){let{cwd:s}=this.options;this.closed=!1,this._closePromise=void 0;let r=eh(e);return s&&(r=r.map(e=>eu(e,s))),r.forEach(e=>{this._removeIgnoredPath(e)}),this._userIgnored=void 0,this._readyCount||(this._readyCount=0),this._readyCount+=r.length,Promise.all(r.map(async e=>{let s=await this._nodeFsHandler._addToNodeFs(e,!i,void 0,0,t);return s&&this._emitReady(),s})).then(e=>{this.closed||e.forEach(e=>{e&&this.add(p.dirname(e),p.basename(t||e))})}),this}unwatch(e){if(this.closed)return this;let t=eh(e),{cwd:i}=this.options;return t.forEach(e=>{p.isAbsolute(e)||this._closers.has(e)||(i&&(e=p.join(i,e)),e=p.resolve(e)),this._closePath(e),this._addIgnoredPath(e),this._watched.has(e)&&this._addIgnoredPath({path:e,recursive:!0}),this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let e=[];return this._closers.forEach(t=>t.forEach(t=>{let i=t();i instanceof Promise&&e.push(i)})),this._streams.forEach(e=>e.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach(e=>e.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=e.length?Promise.all(e).then(()=>void 0):Promise.resolve(),this._closePromise}getWatched(){let e={};return this._watched.forEach((t,i)=>{e[(this.options.cwd?p.relative(this.options.cwd,i):i)||"."]=t.getChildren().sort()}),e}emitWithAll(e,t){this.emit(e,...t),e!==M.ERROR&&this.emit(M.ALL,e,...t)}async _emit(e,t,i){let s;if(this.closed)return;let r=this.options;A&&(t=p.normalize(t)),r.cwd&&(t=p.relative(r.cwd,t));let n=[t];null!=i&&n.push(i);let a=r.awaitWriteFinish;if(a&&(s=this._pendingWrites.get(t)))return s.lastChange=new Date,this;if(r.atomic){if(e===M.UNLINK)return this._pendingUnlinks.set(t,[e,...n]),setTimeout(()=>{this._pendingUnlinks.forEach((e,t)=>{this.emit(...e),this.emit(M.ALL,...e),this._pendingUnlinks.delete(t)})},"number"==typeof r.atomic?r.atomic:100),this;e===M.ADD&&this._pendingUnlinks.has(t)&&(e=M.CHANGE,this._pendingUnlinks.delete(t))}if(a&&(e===M.ADD||e===M.CHANGE)&&this._readyEmitted)return this._awaitWriteFinish(t,a.stabilityThreshold,e,(t,i)=>{t?(e=M.ERROR,n[0]=t,this.emitWithAll(e,n)):i&&(n.length>1?n[1]=i:n.push(i),this.emitWithAll(e,n))}),this;if(e===M.CHANGE&&!this._throttle(M.CHANGE,t,50))return this;if(r.alwaysStat&&void 0===i&&(e===M.ADD||e===M.ADD_DIR||e===M.CHANGE)){let e;let i=r.cwd?p.join(r.cwd,t):t;try{e=await (0,u.stat)(i)}catch(e){}if(!e||this.closed)return;n.push(e)}return this.emitWithAll(e,n),this}_handleError(e){let t=e&&e.code;return e&&"ENOENT"!==t&&"ENOTDIR"!==t&&(!this.options.ignorePermissionErrors||"EPERM"!==t&&"EACCES"!==t)&&this.emit(M.ERROR,e),e||this.closed}_throttle(e,t,i){let s;this._throttled.has(e)||this._throttled.set(e,new Map);let r=this._throttled.get(e);if(!r)throw Error("invalid throttle");let n=r.get(t);if(n)return n.count++,!1;let a=()=>{let e=r.get(t),i=e?e.count:0;return r.delete(t),clearTimeout(s),e&&clearTimeout(e.timeoutObject),i},o={timeoutObject:s=setTimeout(a,i),clear:a,count:0};return r.set(t,o),o}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(e,t,i,s){let r;let n=this.options.awaitWriteFinish;if("object"!=typeof n)return;let a=n.pollInterval,o=e;this.options.cwd&&!p.isAbsolute(e)&&(o=p.join(this.options.cwd,e));let h=new Date,l=this._pendingWrites;l.has(e)||(l.set(e,{lastChange:h,cancelWait:()=>(l.delete(e),clearTimeout(r),i)}),r=setTimeout(function i(n){(0,c.stat)(o,(o,h)=>{if(o||!l.has(e)){o&&"ENOENT"!==o.code&&s(o);return}let d=Number(new Date);n&&h.size!==n.size&&(l.get(e).lastChange=d),d-l.get(e).lastChange>=t?(l.delete(e),s(void 0,h)):r=setTimeout(i,a,h)})},a))}_isIgnored(e,t){if(this.options.atomic&&es.test(e))return!0;if(!this._userIgnored){let{cwd:e}=this.options,t=(this.options.ignored||[]).map(ec(e)),i=[...[...this._ignoredPaths].map(ec(e)),...t];this._userIgnored=function(e,t){if(null==e)throw TypeError("anymatch: specify first argument");let i=en(e).map(e=>"function"==typeof e?e:"string"==typeof e?t=>e===t:e instanceof RegExp?t=>e.test(t):"object"==typeof e&&null!==e?t=>{if(e.path===t)return!0;if(e.recursive){let i=p.relative(e.path,t);return!!i&&!i.startsWith("..")&&!p.isAbsolute(i)}return!1}:()=>!1);return null==t?(e,t)=>eo(i,e,t):eo(i,t)}(i,void 0)}return this._userIgnored(e,t)}_isntIgnored(e,t){return!this._isIgnored(e,t)}_getWatchHelpers(e){return new ef(e,this.options.followSymlinks,this)}_getWatchedDir(e){let t=p.resolve(e);return this._watched.has(t)||this._watched.set(t,new em(t,this._boundRemove)),this._watched.get(t)}_hasReadPermissions(e){return!!this.options.ignorePermissionErrors||!!(256&Number(e.mode))}_remove(e,t,i){let s=p.join(e,t),r=p.resolve(s);if(i=null!=i?i:this._watched.has(s)||this._watched.has(r),!this._throttle("remove",s,100))return;i||1!==this._watched.size||this.add(e,t,!0),this._getWatchedDir(s).getChildren().forEach(e=>this._remove(s,e));let n=this._getWatchedDir(e),a=n.has(t);n.remove(t),this._symlinkPaths.has(r)&&this._symlinkPaths.delete(r);let o=s;if(this.options.cwd&&(o=p.relative(this.options.cwd,s)),this.options.awaitWriteFinish&&this._pendingWrites.has(o)&&this._pendingWrites.get(o).cancelWait()===M.ADD)return;this._watched.delete(s),this._watched.delete(r);let h=i?M.UNLINK_DIR:M.UNLINK;a&&!this._isIgnored(s)&&this._emit(h,s),this._closePath(s)}_closePath(e){this._closeFile(e);let t=p.dirname(e);this._getWatchedDir(t).remove(p.basename(e))}_closeFile(e){let t=this._closers.get(e);t&&(t.forEach(e=>e()),this._closers.delete(e))}_addPathCloser(e,t){if(!t)return;let i=this._closers.get(e);i||(i=[],this._closers.set(e,i)),i.push(t)}_readdirp(e,t){if(this.closed)return;let i=function(e,t={}){let i=t.entryType||t.type;if("both"===i&&(i=f.FILE_DIR_TYPE),e){if("string"!=typeof e)throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");if(i&&!E.includes(i))throw Error(`readdirp: Invalid type passed. Use one of ${E.join(", ")}`)}else throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");let s={...t,root:e};return i&&(s.type=i),new T(s)}(e,{type:M.ALL,alwaysStat:!0,lstat:!0,...t,depth:0});return this._streams.add(i),i.once("close",()=>{i=void 0}),i.once("end",()=>{i&&(this._streams.delete(i),i=void 0)}),i}}let ew=e=>(function(e,t={}){let i=new e_(t);return i.add(e),i})(e,{ignoreInitial:!0,persistent:!0});class eg{constructor(e=ew,t=150){this.watchFile=e,this.debounceMs=t,this.entries=new Map}subscribe(e,t,i){let s=`${e}\0${t}`,r=this.entries.get(s);if(!r){let e=this.watchFile(t);r={watcher:e,subscribers:new Set,revision:0,debounceTimer:null},e.on("add",()=>this.schedule(r)),e.on("change",()=>this.schedule(r)),this.entries.set(s,r)}r.subscribers.add(i);let n=!0;return()=>{if(!n)return;n=!1;let e=this.entries.get(s);e&&(e.subscribers.delete(i),0===e.subscribers.size&&this.releaseEntry(s,e))}}async dispose(){let e=[...this.entries.entries()];this.entries.clear(),await Promise.all(e.map(async([,e])=>{e.debounceTimer&&clearTimeout(e.debounceTimer),await e.watcher.close()}))}schedule(e){e.debounceTimer&&clearTimeout(e.debounceTimer),e.debounceTimer=setTimeout(()=>{e.debounceTimer=null,e.revision+=1;let t={type:"session_history_changed",revision:e.revision};for(let i of e.subscribers)try{i(t)}catch{}},this.debounceMs)}releaseEntry(e,t){this.entries.get(e)===t&&this.entries.delete(e),t.debounceTimer&&clearTimeout(t.debounceTimer),t.debounceTimer=null,t.watcher.close()}}let eE=globalThis,ey="force-dynamic",ev="nodejs",eb=new TextEncoder;async function eP(e,{params:t}){if(!(0,l.V_)(t.id))return function(e,t){let i=(0,o.N8n)((0,h.kO)()).db.prepare(`SELECT updated, status,
2
2
  (SELECT MAX(id) FROM events WHERE session_id = sessions.id) AS eventId,
3
3
  (SELECT MAX(id) FROM messages WHERE session_id = sessions.id) AS messageId
4
4
  FROM sessions WHERE id = ?`),s=JSON.stringify(i.get(t));if(void 0===s)return Response.json({error:"Session not found"},{status:404});let r=()=>{};return new Response(new ReadableStream({start(n){let a=!1,o=new TextEncoder,h=setInterval(()=>{if(!a)try{let e=JSON.stringify(i.get(t));e!==s?(s=e,n.enqueue(o.encode(`data: ${JSON.stringify({type:"session_history_changed",revision:Date.now()})}
5
5
 
6
6
  `))):n.enqueue(o.encode(": keep-alive\n\n"))}catch{r();try{n.close()}catch{}}},1e3);r=()=>{a||(a=!0,clearInterval(h),e.signal.removeEventListener("abort",r))},e.signal.addEventListener("abort",r,{once:!0}),e.signal.aborted?r():n.enqueue(o.encode(": connected\n\n"))},cancel(){r()}}),{headers:{"Content-Type":"text/event-stream","Cache-Control":"no-cache, no-transform","X-Accel-Buffering":"no"}})}(e,t.id);try{let i=await (0,l.NL)().getSessionWatchPath(t.id);if(!i)return Response.json({error:"Native session transcript is unavailable"},{status:404});let s=()=>void 0,r=new ReadableStream({start(r){let n=!1,a=(eE.__nativeSessionChangeMonitor||(eE.__nativeSessionChangeMonitor=new eg),eE.__nativeSessionChangeMonitor).subscribe(t.id,i,e=>{n||r.enqueue(eb.encode(`data: ${JSON.stringify(e)}
7
7
 
8
- `))}),o=setInterval(()=>{n||r.enqueue(eb.encode(": keep-alive\n\n"))},15e3);s=()=>{n||(n=!0,clearInterval(o),a(),e.signal.removeEventListener("abort",s))},e.signal.addEventListener("abort",s,{once:!0}),r.enqueue(eb.encode(": connected\n\n"))},cancel(){s()}});return new Response(r,{headers:{"Cache-Control":"no-cache, no-transform",Connection:"keep-alive","Content-Type":"text/event-stream; charset=utf-8","X-Accel-Buffering":"no"}})}catch(e){return Response.json({error:e instanceof Error?e.message:"Internal error"},{status:(0,l.WW)(e)})}}let eR=new r.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/changes/route",pathname:"/api/sessions/[id]/changes",filename:"route",bundlePath:"app/api/sessions/[id]/changes/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-37/customer-agent/packages/server/app/api/sessions/[id]/changes/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:eI,staticGenerationAsyncStorage:eT,serverHooks:eN}=eR,eD="/api/sessions/[id]/changes/route";function ex(){return(0,a.patchFetch)({serverHooks:eN,staticGenerationAsyncStorage:eT})}},7786:(e,t,i)=>{e.exports=i(517)},535:(e,t,i)=>{i.d(t,{L:()=>a});var s=i(1322),r=i(785);let n=!1;function a(){let e=(0,s.Qfc)();if(e)return e;let t=(0,s.qZ_)({dir:(0,r.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return n||(n=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},1614:(e,t,i)=>{i.d(t,{NL:()=>g,V_:()=>b,WW:()=>P});var s=i(7561),r=i(612),n=i(9411),a=i(7718),o=i(1322);function h(e){if(!e.trim())return!1;try{return(0,s.accessSync)(e,s.constants.X_OK),!0}catch{return!1}}function l(e){try{return(0,o.wyD)((0,a.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function d(e){let t=[],i=process.env[e.environmentVariable]?.trim();if(i){let s=h(i);t.push({source:"pin",path:i,executable:s,version:s?l(i):void 0,error:s?void 0:`${e.environmentVariable} "${i}" is not executable`})}let s=function(e){for(let t of(process.env.PATH??"").split(n.delimiter).filter(Boolean)){let i=(0,n.resolve)(t,e);if(h(i))return i}}(e.name);return s&&s!==i&&t.push({source:"path",path:s,executable:!0,version:l(s)}),(0,o.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var c=i(535),u=i(6279),p=i(785);let m=globalThis;class f{constructor(e,t=async()=>[],i=process.platform){this.runtime=e,this.listProjects=t,this.platform=i,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,i){if(!this.runtime.importWorkspace)throw new u.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,i)}async listWorkspaceSessions(e,t,i){let s=await this.runtime.listWorkspaceSessions(e,t,i);if(i?.cursor)return s;let r=new Set(s.data.map(e=>e.id)),n=s.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),_(e,t)):e});for(let i of this.pendingCreations.values())i.agentType!==e||i.projectId!==t||r.has(i.id)||n.unshift(i);return{...s,data:n}}async list(e){let[t,i]=await Promise.all([this.runtime.list(),this.listProjects()]);return v(this.withPendingCreations(t).map(e=>E(e,i,this.platform)),e)}async refresh(e){let[t,i]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return v(this.withPendingCreations(t).map(e=>E(e,i,this.platform)),e)}async create(e){let t=E(await this.runtime.create(e),await this.listProjects(),this.platform),i=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(i.id,i),i}async fork(e){if(!b(e))throw new u.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let t=E(await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(t.id,t),t}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let i;try{i=await this.runtime.get(e,t)}catch(s){let i=this.pendingCreations.get(e);if(!i)throw s;return t?{...i,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...i,messages:[],events:[]}}return E(i,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:s}=await Promise.resolve().then(i.bind(i,1322));return s(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,i,s,r){return this.runtime.run(e,t,i,s,r)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new u.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,i,s="web",r){if(!this.runtime.startRun)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,i,s,r)}async subscribe(e,t,i){if(!this.runtime.subscribe)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,i)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,i,s="web"){if(!this.runtime.enqueueGoal)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,i,s)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,i="web"){if(!this.runtime.enqueueMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,i)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,i,s){if(!this.runtime.updateMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,i,s)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,i=e.map(e=>{t.add(e.id);let i=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),i?_(e,i):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...i]}}function _(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function w(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function g(){if(!m.__nativeRuntimeService){!function(){let e=[(0,n.join)((0,r.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(n.delimiter),i=e.filter(e=>(0,s.existsSync)(e)&&!t.includes(e));i.length>0&&(process.env.PATH=[...t,...i].join(n.delimiter))}();let e=new o.XWE((0,p.kO)());m.__nativeRuntimeService=new f((0,u.v6)({runtimeFactory:e=>{let t=d({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:o.hix}),i=d({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,w("AGENT_CODEX_RUNTIME_ERROR",t),w("AGENT_OPENCODE_RUNTIME_ERROR",i),(0,c.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:i.executable??null,opencodeDetail:i.detail}),(0,u.WH)(t.executable??"codex",e,i.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function E(e,t,i=process.platform){let{projectId:s,...r}=e;if(!e.cwd)return r;let a=y(e.cwd,i),o="win32"===i?n.win32.sep:n.sep,h=t.filter(e=>e.description).map(e=>({project:e,path:y(e.description,i)})).filter(({path:e})=>a===e||a.startsWith(`${e}${o}`)).sort((e,t)=>t.path.length-e.path.length)[0];return h?{...r,projectId:h.project.id}:r}function y(e,t=process.platform){if("win32"!==t)return(0,n.resolve)(e);let i=n.win32.resolve(e),s=n.win32.parse(i).root;return(i.length>s.length?i.replace(/[\\/]+$/,""):i).toLowerCase()}function v(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function b(e){try{return"customer-agent"!==(0,u.Vu)(e).agentType}catch{return!1}}function P(e){if(e instanceof u.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var i=e=>t(t.s=e),s=t.X(0,[8375,6244,1322,1773],()=>i(7034));module.exports=s})();
8
+ `))}),o=setInterval(()=>{n||r.enqueue(eb.encode(": keep-alive\n\n"))},15e3);s=()=>{n||(n=!0,clearInterval(o),a(),e.signal.removeEventListener("abort",s))},e.signal.addEventListener("abort",s,{once:!0}),r.enqueue(eb.encode(": connected\n\n"))},cancel(){s()}});return new Response(r,{headers:{"Cache-Control":"no-cache, no-transform",Connection:"keep-alive","Content-Type":"text/event-stream; charset=utf-8","X-Accel-Buffering":"no"}})}catch(e){return Response.json({error:e instanceof Error?e.message:"Internal error"},{status:(0,l.WW)(e)})}}let eR=new r.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/changes/route",pathname:"/api/sessions/[id]/changes",filename:"route",bundlePath:"app/api/sessions/[id]/changes/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/sessions/[id]/changes/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:eI,staticGenerationAsyncStorage:eT,serverHooks:eN}=eR,eD="/api/sessions/[id]/changes/route";function ex(){return(0,a.patchFetch)({serverHooks:eN,staticGenerationAsyncStorage:eT})}},7786:(e,t,i)=>{e.exports=i(517)},535:(e,t,i)=>{i.d(t,{L:()=>a});var s=i(1322),r=i(785);let n=!1;function a(){let e=(0,s.Qfc)();if(e)return e;let t=(0,s.qZ_)({dir:(0,r.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return n||(n=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},1614:(e,t,i)=>{i.d(t,{NL:()=>g,V_:()=>b,WW:()=>P});var s=i(7561),r=i(612),n=i(9411),a=i(7718),o=i(1322);function h(e){if(!e.trim())return!1;try{return(0,s.accessSync)(e,s.constants.X_OK),!0}catch{return!1}}function l(e){try{return(0,o.wyD)((0,a.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function d(e){let t=[],i=process.env[e.environmentVariable]?.trim();if(i){let s=h(i);t.push({source:"pin",path:i,executable:s,version:s?l(i):void 0,error:s?void 0:`${e.environmentVariable} "${i}" is not executable`})}let s=function(e){for(let t of(process.env.PATH??"").split(n.delimiter).filter(Boolean)){let i=(0,n.resolve)(t,e);if(h(i))return i}}(e.name);return s&&s!==i&&t.push({source:"path",path:s,executable:!0,version:l(s)}),(0,o.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var c=i(535),u=i(6279),p=i(785);let m=globalThis;class f{constructor(e,t=async()=>[],i=process.platform){this.runtime=e,this.listProjects=t,this.platform=i,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,i){if(!this.runtime.importWorkspace)throw new u.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,i)}async listWorkspaceSessions(e,t,i){let s=await this.runtime.listWorkspaceSessions(e,t,i);if(i?.cursor)return s;let r=new Set(s.data.map(e=>e.id)),n=s.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),_(e,t)):e});for(let i of this.pendingCreations.values())i.agentType!==e||i.projectId!==t||r.has(i.id)||n.unshift(i);return{...s,data:n}}async list(e){let[t,i]=await Promise.all([this.runtime.list(),this.listProjects()]);return v(this.withPendingCreations(t).map(e=>E(e,i,this.platform)),e)}async refresh(e){let[t,i]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return v(this.withPendingCreations(t).map(e=>E(e,i,this.platform)),e)}async create(e){let t=E(await this.runtime.create(e),await this.listProjects(),this.platform),i=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(i.id,i),i}async fork(e,t){if(!b(e))throw new u.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let i=E(t?await this.runtime.fork(e,t):await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(i.id,i),i}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let i;try{i=await this.runtime.get(e,t)}catch(s){let i=this.pendingCreations.get(e);if(!i)throw s;return t?{...i,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...i,messages:[],events:[]}}return E(i,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:s}=await Promise.resolve().then(i.bind(i,1322));return s(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,i,s,r){return this.runtime.run(e,t,i,s,r)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new u.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,i,s="web",r){if(!this.runtime.startRun)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,i,s,r)}async subscribe(e,t,i){if(!this.runtime.subscribe)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,i)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new u.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,i,s="web"){if(!this.runtime.enqueueGoal)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,i,s)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new u.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,i="web"){if(!this.runtime.enqueueMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,i)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,i,s){if(!this.runtime.updateMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,i,s)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new u.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,i=e.map(e=>{t.add(e.id);let i=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),i?_(e,i):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...i]}}function _(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function w(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function g(){if(!m.__nativeRuntimeService){!function(){let e=[(0,n.join)((0,r.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(n.delimiter),i=e.filter(e=>(0,s.existsSync)(e)&&!t.includes(e));i.length>0&&(process.env.PATH=[...t,...i].join(n.delimiter))}();let e=new o.XWE((0,p.kO)());m.__nativeRuntimeService=new f((0,u.v6)({runtimeFactory:e=>{let t=d({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:o.hix}),i=d({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,w("AGENT_CODEX_RUNTIME_ERROR",t),w("AGENT_OPENCODE_RUNTIME_ERROR",i),(0,c.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:i.executable??null,opencodeDetail:i.detail}),(0,u.WH)(t.executable??"codex",e,i.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function E(e,t,i=process.platform){let{projectId:s,...r}=e;if(!e.cwd)return r;let a=y(e.cwd,i),o="win32"===i?n.win32.sep:n.sep,h=t.filter(e=>e.description).map(e=>({project:e,path:y(e.description,i)})).filter(({path:e})=>a===e||a.startsWith(`${e}${o}`)).sort((e,t)=>t.path.length-e.path.length)[0];return h?{...r,projectId:h.project.id}:r}function y(e,t=process.platform){if("win32"!==t)return(0,n.resolve)(e);let i=n.win32.resolve(e),s=n.win32.parse(i).root;return(i.length>s.length?i.replace(/[\\/]+$/,""):i).toLowerCase()}function v(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function b(e){try{return"customer-agent"!==(0,u.Vu)(e).agentType}catch{return!1}}function P(e){if(e instanceof u.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var i=e=>t(t.s=e),s=t.X(0,[8375,6244,1322,1773],()=>i(17));module.exports=s})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=6939,e.ids=[6939],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},895:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>f,requestAsyncStorage:()=>p,routeModule:()=>c,serverHooks:()=>h,staticGenerationAsyncStorage:()=>d});var i={};r.r(i),r.d(i,{POST:()=>l});var s=r(7786),n=r(5042),o=r(2184),a=r(1890),u=r(1614);async function l(e,{params:t}){try{let e=await (0,u.NL)().fork(t.id);return a.NextResponse.json(e,{status:201})}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Internal error"},{status:(0,u.WW)(e)})}}let c=new s.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/fork/route",pathname:"/api/sessions/[id]/fork",filename:"route",bundlePath:"app/api/sessions/[id]/fork/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-37/customer-agent/packages/server/app/api/sessions/[id]/fork/route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:p,staticGenerationAsyncStorage:d,serverHooks:h}=c,m="/api/sessions/[id]/fork/route";function f(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:d})}},535:(e,t,r)=>{r.d(t,{L:()=>o});var i=r(1322),s=r(785);let n=!1;function o(){let e=(0,i.Qfc)();if(e)return e;let t=(0,i.qZ_)({dir:(0,s.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return n||(n=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},1614:(e,t,r)=>{r.d(t,{NL:()=>O,V_:()=>P,WW:()=>_});var i=r(7561),s=r(612),n=r(9411),o=r(7718),a=r(1322);function u(e){if(!e.trim())return!1;try{return(0,i.accessSync)(e,i.constants.X_OK),!0}catch{return!1}}function l(e){try{return(0,a.wyD)((0,o.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function c(e){let t=[],r=process.env[e.environmentVariable]?.trim();if(r){let i=u(r);t.push({source:"pin",path:r,executable:i,version:i?l(r):void 0,error:i?void 0:`${e.environmentVariable} "${r}" is not executable`})}let i=function(e){for(let t of(process.env.PATH??"").split(n.delimiter).filter(Boolean)){let r=(0,n.resolve)(t,e);if(u(r))return r}}(e.name);return i&&i!==r&&t.push({source:"path",path:i,executable:!0,version:l(i)}),(0,a.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var p=r(535),d=r(6279),h=r(785);let m=globalThis;class f{constructor(e,t=async()=>[],r=process.platform){this.runtime=e,this.listProjects=t,this.platform=r,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,r){if(!this.runtime.importWorkspace)throw new d.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,r)}async listWorkspaceSessions(e,t,r){let i=await this.runtime.listWorkspaceSessions(e,t,r);if(r?.cursor)return i;let s=new Set(i.data.map(e=>e.id)),n=i.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),w(e,t)):e});for(let r of this.pendingCreations.values())r.agentType!==e||r.projectId!==t||s.has(r.id)||n.unshift(r);return{...i,data:n}}async list(e){let[t,r]=await Promise.all([this.runtime.list(),this.listProjects()]);return E(this.withPendingCreations(t).map(e=>v(e,r,this.platform)),e)}async refresh(e){let[t,r]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return E(this.withPendingCreations(t).map(e=>v(e,r,this.platform)),e)}async create(e){let t=v(await this.runtime.create(e),await this.listProjects(),this.platform),r=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(r.id,r),r}async fork(e){if(!P(e))throw new d.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let t=v(await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(t.id,t),t}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let r;try{r=await this.runtime.get(e,t)}catch(i){let r=this.pendingCreations.get(e);if(!r)throw i;return t?{...r,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...r,messages:[],events:[]}}return v(r,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:i}=await Promise.resolve().then(r.bind(r,1322));return i(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,r,i,s){return this.runtime.run(e,t,r,i,s)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new d.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,r,i="web",s){if(!this.runtime.startRun)throw new d.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,r,i,s)}async subscribe(e,t,r){if(!this.runtime.subscribe)throw new d.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,r)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new d.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new d.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new d.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new d.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,r,i="web"){if(!this.runtime.enqueueGoal)throw new d.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,r,i)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new d.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new d.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,r="web"){if(!this.runtime.enqueueMessage)throw new d.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,r)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new d.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,r,i){if(!this.runtime.updateMessage)throw new d.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,r,i)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new d.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new d.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,r=e.map(e=>{t.add(e.id);let r=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),r?w(e,r):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...r]}}function w(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function g(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function O(){if(!m.__nativeRuntimeService){!function(){let e=[(0,n.join)((0,s.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(n.delimiter),r=e.filter(e=>(0,i.existsSync)(e)&&!t.includes(e));r.length>0&&(process.env.PATH=[...t,...r].join(n.delimiter))}();let e=new a.XWE((0,h.kO)());m.__nativeRuntimeService=new f((0,d.v6)({runtimeFactory:e=>{let t=c({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:a.hix}),r=c({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,g("AGENT_CODEX_RUNTIME_ERROR",t),g("AGENT_OPENCODE_RUNTIME_ERROR",r),(0,p.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:r.executable??null,opencodeDetail:r.detail}),(0,d.WH)(t.executable??"codex",e,r.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function v(e,t,r=process.platform){let{projectId:i,...s}=e;if(!e.cwd)return s;let o=N(e.cwd,r),a="win32"===r?n.win32.sep:n.sep,u=t.filter(e=>e.description).map(e=>({project:e,path:N(e.description,r)})).filter(({path:e})=>o===e||o.startsWith(`${e}${a}`)).sort((e,t)=>t.path.length-e.path.length)[0];return u?{...s,projectId:u.project.id}:s}function N(e,t=process.platform){if("win32"!==t)return(0,n.resolve)(e);let r=n.win32.resolve(e),i=n.win32.parse(r).root;return(r.length>i.length?r.replace(/[\\/]+$/,""):r).toLowerCase()}function E(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function P(e){try{return"customer-agent"!==(0,d.Vu)(e).agentType}catch{return!1}}function _(e){if(e instanceof d.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[8375,6703,6244,1322,1773],()=>r(895));module.exports=i})();
1
+ "use strict";(()=>{var e={};e.id=6939,e.ids=[6939],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},4490:(e,r,o)=>{o.r(r),o.d(r,{originalPathname:()=>x,patchFetch:()=>q,requestAsyncStorage:()=>u,routeModule:()=>n,serverHooks:()=>a,staticGenerationAsyncStorage:()=>d});var s=o(7786),t=o(5042),i=o(2184),p=o(555);let n=new s.AppRouteRouteModule({definition:{kind:t.x.APP_ROUTE,page:"/api/sessions/[id]/fork/route",pathname:"/api/sessions/[id]/fork",filename:"route",bundlePath:"app/api/sessions/[id]/fork/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/sessions/[id]/fork/route.ts",nextConfigOutput:"standalone",userland:p}),{requestAsyncStorage:u,staticGenerationAsyncStorage:d,serverHooks:a}=n,x="/api/sessions/[id]/fork/route";function q(){return(0,i.patchFetch)({serverHooks:a,staticGenerationAsyncStorage:d})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var o=e=>r(r.s=e),s=r.X(0,[8375,6703,6244,1322,1773,4621,7519,366],()=>o(4490));module.exports=s})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../../../../node_modules/.bun/@anthropic-ai+claude-agent-sdk@0.3.259+35e45c978e9f7cc7/node_modules/@anthropic-ai/claude-agent-sdk/package.json","../../../../../../../../../node_modules/.bun/@anthropic-ai+claude-agent-sdk@0.3.259+35e45c978e9f7cc7/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/binding.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/database.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/index.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/explain.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/function.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/table.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/util.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/package.json","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/darwin-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/darwin-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linux-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linux-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linuxmusl-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linuxmusl-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/win32-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/win32-x64.node","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/async-local-storage.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/server/lib/trace/constants.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/package.json","../../../../../../../../../package.json","../../../../../../../../core/package.json","../../../../../../../../native-runtime/package.json","../../../../../../../node_modules/@anthropic-ai/claude-agent-sdk","../../../../../../../node_modules/better-sqlite3","../../../../../../../node_modules/next","../../../../../../../package.json","../../../../../../package.json","../../../../../chunks/1322.js","../../../../../chunks/1773.js","../../../../../chunks/6244.js","../../../../../chunks/6703.js","../../../../../chunks/8375.js","../../../../../webpack-runtime.js"]}
1
+ {"version":1,"files":["../../../../../../../../../node_modules/.bun/@anthropic-ai+claude-agent-sdk@0.3.259+35e45c978e9f7cc7/node_modules/@anthropic-ai/claude-agent-sdk/package.json","../../../../../../../../../node_modules/.bun/@anthropic-ai+claude-agent-sdk@0.3.259+35e45c978e9f7cc7/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/binding.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/database.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/index.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/explain.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/function.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/table.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/util.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/package.json","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/darwin-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/darwin-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linux-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linux-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linuxmusl-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linuxmusl-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/win32-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/win32-x64.node","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/async-local-storage.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/server/lib/trace/constants.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/package.json","../../../../../../../../../package.json","../../../../../../../../computer-use/package.json","../../../../../../../../core/package.json","../../../../../../../../native-runtime/package.json","../../../../../../../node_modules/@anthropic-ai/claude-agent-sdk","../../../../../../../node_modules/better-sqlite3","../../../../../../../node_modules/next","../../../../../../../package.json","../../../../../../package.json","../../../../../chunks/1322.js","../../../../../chunks/1773.js","../../../../../chunks/366.js","../../../../../chunks/4621.js","../../../../../chunks/6244.js","../../../../../chunks/6703.js","../../../../../chunks/732.js","../../../../../chunks/7519.js","../../../../../chunks/8375.js","../../../../../webpack-runtime.js"]}
@@ -0,0 +1 @@
1
+ "use strict";(()=>{var e={};e.id=1904,e.ids=[1904],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},2011:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>q,patchFetch:()=>c,requestAsyncStorage:()=>a,routeModule:()=>u,serverHooks:()=>x,staticGenerationAsyncStorage:()=>d});var o={};t.r(o),t.d(o,{POST:()=>n.POST});var s=t(7786),i=t(5042),p=t(2184),n=t(555);let u=new s.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/sessions/[id]/fork-at/route",pathname:"/api/sessions/[id]/fork-at",filename:"route",bundlePath:"app/api/sessions/[id]/fork-at/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/sessions/[id]/fork-at/route.ts",nextConfigOutput:"standalone",userland:o}),{requestAsyncStorage:a,staticGenerationAsyncStorage:d,serverHooks:x}=u,q="/api/sessions/[id]/fork-at/route";function c(){return(0,p.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:d})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),o=r.X(0,[8375,6703,6244,1322,1773,4621,7519,366],()=>t(2011));module.exports=o})();
@@ -0,0 +1 @@
1
+ {"version":1,"files":["../../../../../../../../../node_modules/.bun/@anthropic-ai+claude-agent-sdk@0.3.259+35e45c978e9f7cc7/node_modules/@anthropic-ai/claude-agent-sdk/package.json","../../../../../../../../../node_modules/.bun/@anthropic-ai+claude-agent-sdk@0.3.259+35e45c978e9f7cc7/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/binding.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/database.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/index.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/explain.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/function.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/table.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/lib/util.js","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/package.json","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/darwin-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/darwin-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linux-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linux-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linuxmusl-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/linuxmusl-x64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/win32-arm64.node","../../../../../../../../../node_modules/.bun/better-sqlite3@13.0.3/node_modules/better-sqlite3/prebuilds/win32-x64.node","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/async-local-storage.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/server/lib/trace/constants.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../../../../node_modules/.bun/next@14.2.35+6dbf9a050bc9aadb/node_modules/next/package.json","../../../../../../../../../package.json","../../../../../../../../computer-use/package.json","../../../../../../../../core/package.json","../../../../../../../../native-runtime/package.json","../../../../../../../node_modules/@anthropic-ai/claude-agent-sdk","../../../../../../../node_modules/better-sqlite3","../../../../../../../node_modules/next","../../../../../../../package.json","../../../../../../package.json","../../../../../chunks/1322.js","../../../../../chunks/1773.js","../../../../../chunks/366.js","../../../../../chunks/4621.js","../../../../../chunks/6244.js","../../../../../chunks/6703.js","../../../../../chunks/732.js","../../../../../chunks/7519.js","../../../../../chunks/8375.js","../../../../../webpack-runtime.js"]}
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=5937,e.ids=[5937,732],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},1018:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>N,patchFetch:()=>I,requestAsyncStorage:()=>f,routeModule:()=>w,serverHooks:()=>v,staticGenerationAsyncStorage:()=>y});var s={};r.r(s),r.d(s,{DELETE:()=>p,GET:()=>l,PATCH:()=>h,POST:()=>c});var i=r(7786),n=r(5042),a=r(2184),o=r(1890),u=r(732),d=r(1614);async function l(e,{params:t}){try{let e=(0,d.V_)(t.id)?await (0,d.NL)().getGoals(t.id,"web"):await (0,u.getCustomerGoalCoordinator)().get(t.id);return o.NextResponse.json(e)}catch(e){return g(e)}}async function c(e,{params:t}){try{let r=await e.json();if("string"!=typeof r.objective||!r.objective.trim())return o.NextResponse.json({error:"objective is required"},{status:400});if((0,d.V_)(t.id)){let e="message"===r.kind?await (0,d.NL)().enqueueMessage(t.id,{sourceMessageId:"string"==typeof r.sourceMessageId?r.sourceMessageId:crypto.randomUUID(),content:r.objective,messagePayload:m(r.messagePayload)},"web"):await (0,d.NL)().enqueueGoal(t.id,r.objective,"string"==typeof r.sourceMessageId?r.sourceMessageId:void 0,"web");return o.NextResponse.json(e)}if("message"===r.kind)return o.NextResponse.json({state:await (0,u.getCustomerGoalCoordinator)().enqueueMessage(t.id,r.objective,"string"==typeof r.sourceMessageId?r.sourceMessageId:crypto.randomUUID(),m(r.messagePayload))});let s=await (0,u.getCustomerGoalCoordinator)().enqueue(t.id,r.objective,"string"==typeof r.sourceMessageId?r.sourceMessageId:void 0);return o.NextResponse.json({state:s})}catch(e){return g(e)}}async function h(e,{params:t}){try{let r=await e.json();if("message"===r.kind&&"string"==typeof r.messageId){if("string"!=typeof r.objective||!r.objective.trim())return o.NextResponse.json({error:"objective is required"},{status:400});if(!(0,d.V_)(t.id))return o.NextResponse.json(await (0,u.getCustomerGoalCoordinator)().updateMessage(t.id,r.messageId,r.objective,m(r.messagePayload)));return o.NextResponse.json(await (0,d.NL)().updateMessage(t.id,r.messageId,r.objective,m(r.messagePayload)))}if(!Array.isArray(r.orderedIds)||!r.orderedIds.every(e=>"string"==typeof e))return o.NextResponse.json({error:"orderedIds must be a string array"},{status:400});let s=(0,d.V_)(t.id)?"message"===r.kind?await (0,d.NL)().reorderMessages(t.id,r.orderedIds):await (0,d.NL)().reorderGoals(t.id,r.orderedIds):await (0,u.getCustomerGoalCoordinator)().reorder(t.id,r.orderedIds,"message"===r.kind);return o.NextResponse.json(s)}catch(e){return g(e)}}async function p(e,{params:t}){try{let r=new URL(e.url),s=r.searchParams.get("goalId");if(!s)return o.NextResponse.json({error:"goalId is required"},{status:400});let i=(0,d.V_)(t.id)?"message"===r.searchParams.get("kind")?await (0,d.NL)().cancelMessage(t.id,s):await (0,d.NL)().cancelGoal(t.id,s):await (0,u.getCustomerGoalCoordinator)().cancel(t.id,s);return o.NextResponse.json(i)}catch(e){return g(e)}}function m(e){if(!e||"object"!=typeof e)return;let t=Array.isArray(e.images)&&e.images.every(e=>"string"==typeof e)?e.images:void 0,r=Array.isArray(e.agentIds)&&e.agentIds.every(e=>"string"==typeof e)?e.agentIds:void 0;return{...t?.length?{images:t}:{},...r?.length?{agentIds:r}:{},..."string"==typeof e.agentName&&e.agentName?{agentName:e.agentName}:{}}}function g(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Goal operation failed"},{status:(0,d.WW)(e)})}let w=new i.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/goals/route",pathname:"/api/sessions/[id]/goals",filename:"route",bundlePath:"app/api/sessions/[id]/goals/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-37/customer-agent/packages/server/app/api/sessions/[id]/goals/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:f,staticGenerationAsyncStorage:y,serverHooks:v}=w,N="/api/sessions/[id]/goals/route";function I(){return(0,a.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:y})}},732:(e,t,r)=>{r.d(t,{getCustomerGoalCoordinator:()=>d,U:()=>l});var s=r(1322),i=r(7519);class n{constructor(e,t,r,s,i,n){this.store=e,this.busy=t,this.run=r,this.abort=s,this.steerRun=i,this.persist=n,this.tails=new Map,this.draining=new Set}async get(e,t=!0){let r=(0,s.E0T)((await this.require(e)).metadata);return t&&this.resume(e),r}async enqueue(e,t,r){let i=await this.mutate(e,i=>(0,s.WfK)(i,{id:crypto.randomUUID(),sessionId:e,objective:t,sourceMessageId:r,now:Date.now()}));return this.resume(e),i}async enqueueMessage(e,t,r,i){let n=await this.mutate(e,n=>[n.active,...n.queued,...n.history].some(e=>e?.sourceMessageId===r)?n:(0,s.InG)(n,{id:crypto.randomUUID(),sessionId:e,objective:t,sourceMessageId:r,messagePayload:i,now:Date.now(),activate:!1}));return this.resume(e),n}reorder(e,t,r=!1){return this.mutate(e,e=>r?(0,s.h1F)(e,t):(0,s.ZC9)(e,t))}updateMessage(e,t,r,i){return this.mutate(e,e=>(0,s.Wog)(e,t,r,i))}async cancel(e,t){let r=await this.mutate(e,r=>(r.active?.id===t&&this.draining.has(e)&&this.abort(e),(0,s.LJm)(r,t,Date.now())));return this.resume(e),r}async steer(e,t){return this.mutate(e,async r=>{let i=r.queued.find(e=>e.id===t&&"message"===e.kind);if(!i||!this.busy(e))throw Error("没有可引导的运行或排队消息");if(!await this.steerRun(e,i.objective))throw Error("运行已结束,请继续排队");return(0,s.LJm)(r,t,Date.now())})}resume(e){this.draining.has(e)||(this.draining.add(e),this.drain(e).catch(e=>console.error("Customer queue failed",e)).finally(()=>this.draining.delete(e)))}async drain(e){for(;;){let t;let r=await this.get(e,!1);if(!r.active&&!r.queued.length)return;if(this.busy(e)){await new Promise(e=>setTimeout(e,100));continue}let i=(await this.mutate(e,e=>(0,s.s_d)(e,Date.now()))).active;if(!i)continue;let n="failed";try{n=await this.run(e,i)}catch(e){if(e?.code==="SESSION_ALREADY_RUNNING")continue;t=e instanceof Error?e.message:String(e)}await this.mutate(e,e=>e.active?.id===i.id?(0,s.JXc)(e,n,Date.now(),t):e)}}async require(e){let t=await this.store.get(e);if(!t)throw Error("Session not found");return t}async mutate(e,t){let r=(this.tails.get(e)??Promise.resolve()).catch(()=>{}).then(async()=>{let r=await this.require(e),i=await t((0,s.E0T)(r.metadata));if(this.persist)this.persist(e,i);else{let t=await this.require(e);await this.store.update(e,{metadata:(0,s.eC7)(t.metadata,i)})}return i});this.tails.set(e,r);try{return await r}finally{this.tails.get(e)===r&&this.tails.delete(e)}}}var a=r(785);let o=globalThis,u=new Set;function d(){return o.__sharedCustomerQueue??=new n(i.agentHost.getSessionStore(),e=>i.agentHost.isSessionRunning(e),async(e,t)=>{u.add(e);try{return await i.agentHost.startRun(t.objective,e,t.messagePayload?.images,{agentIds:t.messagePayload?.agentIds}).completion,(await i.agentHost.getSessionStore().get(e))?.status==="completed"?"completed":"failed"}finally{u.delete(e)}},e=>{u.has(e)&&i.agentHost.abort(e)},(e,t)=>i.agentHost.steer(t,e),(e,t)=>{(0,s.N8n)((0,a.kO)()).db.prepare("UPDATE sessions SET metadata = json_set(metadata, '$.goalState', json(?)), updated = ? WHERE id = ?").run(JSON.stringify(t),new Date().toISOString(),e)})}function l(){for(let e of(0,s.N8n)((0,a.kO)()).db.prepare("SELECT id FROM sessions WHERE json_extract(metadata, '$.goalState.active') IS NOT NULL OR json_array_length(metadata, '$.goalState.queued') > 0").all())d().resume(e.id)}},1614:(e,t,r)=>{r.d(t,{NL:()=>y,V_:()=>b,WW:()=>E});var s=r(7561),i=r(612),n=r(9411),a=r(7718),o=r(1322);function u(e){if(!e.trim())return!1;try{return(0,s.accessSync)(e,s.constants.X_OK),!0}catch{return!1}}function d(e){try{return(0,o.wyD)((0,a.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function l(e){let t=[],r=process.env[e.environmentVariable]?.trim();if(r){let s=u(r);t.push({source:"pin",path:r,executable:s,version:s?d(r):void 0,error:s?void 0:`${e.environmentVariable} "${r}" is not executable`})}let s=function(e){for(let t of(process.env.PATH??"").split(n.delimiter).filter(Boolean)){let r=(0,n.resolve)(t,e);if(u(r))return r}}(e.name);return s&&s!==r&&t.push({source:"path",path:s,executable:!0,version:d(s)}),(0,o.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var c=r(535),h=r(6279),p=r(785);let m=globalThis;class g{constructor(e,t=async()=>[],r=process.platform){this.runtime=e,this.listProjects=t,this.platform=r,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,r){if(!this.runtime.importWorkspace)throw new h.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,r)}async listWorkspaceSessions(e,t,r){let s=await this.runtime.listWorkspaceSessions(e,t,r);if(r?.cursor)return s;let i=new Set(s.data.map(e=>e.id)),n=s.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),w(e,t)):e});for(let r of this.pendingCreations.values())r.agentType!==e||r.projectId!==t||i.has(r.id)||n.unshift(r);return{...s,data:n}}async list(e){let[t,r]=await Promise.all([this.runtime.list(),this.listProjects()]);return I(this.withPendingCreations(t).map(e=>v(e,r,this.platform)),e)}async refresh(e){let[t,r]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return I(this.withPendingCreations(t).map(e=>v(e,r,this.platform)),e)}async create(e){let t=v(await this.runtime.create(e),await this.listProjects(),this.platform),r=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(r.id,r),r}async fork(e){if(!b(e))throw new h.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let t=v(await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(t.id,t),t}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let r;try{r=await this.runtime.get(e,t)}catch(s){let r=this.pendingCreations.get(e);if(!r)throw s;return t?{...r,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...r,messages:[],events:[]}}return v(r,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:s}=await Promise.resolve().then(r.bind(r,1322));return s(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,r,s,i){return this.runtime.run(e,t,r,s,i)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new h.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,r,s="web",i){if(!this.runtime.startRun)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,r,s,i)}async subscribe(e,t,r){if(!this.runtime.subscribe)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,r)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,r,s="web"){if(!this.runtime.enqueueGoal)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,r,s)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,r="web"){if(!this.runtime.enqueueMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,r)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,r,s){if(!this.runtime.updateMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,r,s)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,r=e.map(e=>{t.add(e.id);let r=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),r?w(e,r):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...r]}}function w(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function f(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function y(){if(!m.__nativeRuntimeService){!function(){let e=[(0,n.join)((0,i.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(n.delimiter),r=e.filter(e=>(0,s.existsSync)(e)&&!t.includes(e));r.length>0&&(process.env.PATH=[...t,...r].join(n.delimiter))}();let e=new o.XWE((0,p.kO)());m.__nativeRuntimeService=new g((0,h.v6)({runtimeFactory:e=>{let t=l({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:o.hix}),r=l({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,f("AGENT_CODEX_RUNTIME_ERROR",t),f("AGENT_OPENCODE_RUNTIME_ERROR",r),(0,c.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:r.executable??null,opencodeDetail:r.detail}),(0,h.WH)(t.executable??"codex",e,r.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function v(e,t,r=process.platform){let{projectId:s,...i}=e;if(!e.cwd)return i;let a=N(e.cwd,r),o="win32"===r?n.win32.sep:n.sep,u=t.filter(e=>e.description).map(e=>({project:e,path:N(e.description,r)})).filter(({path:e})=>a===e||a.startsWith(`${e}${o}`)).sort((e,t)=>t.path.length-e.path.length)[0];return u?{...i,projectId:u.project.id}:i}function N(e,t=process.platform){if("win32"!==t)return(0,n.resolve)(e);let r=n.win32.resolve(e),s=n.win32.parse(r).root;return(r.length>s.length?r.replace(/[\\/]+$/,""):r).toLowerCase()}function I(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function b(e){try{return"customer-agent"!==(0,h.Vu)(e).agentType}catch{return!1}}function E(e){if(e instanceof h.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}},1489:(e,t,r)=>{r.d(t,{N:()=>u});var s=r(1322),i=r(6279),n=r(785);class a{constructor(){this.tasks=new s.vo4((0,n.kO)()),this.scheduler=new i.ST(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await r.e(7519).then(r.bind(r,7519)),{getCustomerGoalCoordinator:s}=await Promise.all([r.e(7519),r.e(732)]).then(r.bind(r,732)),i=e.sessionId;i&&await t.getSessionStore().get(i)||(i=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:i})),await s().enqueue(i,e.prompt)}call(e,t){let r=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(r);case"cronResume":return this.tasks.resume(r);case"cronDelete":return this.tasks.delete(r);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let o=globalThis;function u(){return o.__sharedCronService??=new a}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8375,6703,6244,1322,1773,4621,7519],()=>r(1018));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=5937,e.ids=[5937,732],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},5900:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>N,patchFetch:()=>I,requestAsyncStorage:()=>f,routeModule:()=>w,serverHooks:()=>v,staticGenerationAsyncStorage:()=>y});var s={};r.r(s),r.d(s,{DELETE:()=>p,GET:()=>l,PATCH:()=>h,POST:()=>c});var i=r(7786),n=r(5042),a=r(2184),o=r(1890),u=r(732),d=r(1614);async function l(e,{params:t}){try{let e=(0,d.V_)(t.id)?await (0,d.NL)().getGoals(t.id,"web"):await (0,u.getCustomerGoalCoordinator)().get(t.id);return o.NextResponse.json(e)}catch(e){return g(e)}}async function c(e,{params:t}){try{let r=await e.json();if("string"!=typeof r.objective||!r.objective.trim())return o.NextResponse.json({error:"objective is required"},{status:400});if((0,d.V_)(t.id)){let e="message"===r.kind?await (0,d.NL)().enqueueMessage(t.id,{sourceMessageId:"string"==typeof r.sourceMessageId?r.sourceMessageId:crypto.randomUUID(),content:r.objective,messagePayload:m(r.messagePayload)},"web"):await (0,d.NL)().enqueueGoal(t.id,r.objective,"string"==typeof r.sourceMessageId?r.sourceMessageId:void 0,"web");return o.NextResponse.json(e)}if("message"===r.kind)return o.NextResponse.json({state:await (0,u.getCustomerGoalCoordinator)().enqueueMessage(t.id,r.objective,"string"==typeof r.sourceMessageId?r.sourceMessageId:crypto.randomUUID(),m(r.messagePayload))});let s=await (0,u.getCustomerGoalCoordinator)().enqueue(t.id,r.objective,"string"==typeof r.sourceMessageId?r.sourceMessageId:void 0);return o.NextResponse.json({state:s})}catch(e){return g(e)}}async function h(e,{params:t}){try{let r=await e.json();if("message"===r.kind&&"string"==typeof r.messageId){if("string"!=typeof r.objective||!r.objective.trim())return o.NextResponse.json({error:"objective is required"},{status:400});if(!(0,d.V_)(t.id))return o.NextResponse.json(await (0,u.getCustomerGoalCoordinator)().updateMessage(t.id,r.messageId,r.objective,m(r.messagePayload)));return o.NextResponse.json(await (0,d.NL)().updateMessage(t.id,r.messageId,r.objective,m(r.messagePayload)))}if(!Array.isArray(r.orderedIds)||!r.orderedIds.every(e=>"string"==typeof e))return o.NextResponse.json({error:"orderedIds must be a string array"},{status:400});let s=(0,d.V_)(t.id)?"message"===r.kind?await (0,d.NL)().reorderMessages(t.id,r.orderedIds):await (0,d.NL)().reorderGoals(t.id,r.orderedIds):await (0,u.getCustomerGoalCoordinator)().reorder(t.id,r.orderedIds,"message"===r.kind);return o.NextResponse.json(s)}catch(e){return g(e)}}async function p(e,{params:t}){try{let r=new URL(e.url),s=r.searchParams.get("goalId");if(!s)return o.NextResponse.json({error:"goalId is required"},{status:400});let i=(0,d.V_)(t.id)?"message"===r.searchParams.get("kind")?await (0,d.NL)().cancelMessage(t.id,s):await (0,d.NL)().cancelGoal(t.id,s):await (0,u.getCustomerGoalCoordinator)().cancel(t.id,s);return o.NextResponse.json(i)}catch(e){return g(e)}}function m(e){if(!e||"object"!=typeof e)return;let t=Array.isArray(e.images)&&e.images.every(e=>"string"==typeof e)?e.images:void 0,r=Array.isArray(e.agentIds)&&e.agentIds.every(e=>"string"==typeof e)?e.agentIds:void 0;return{...t?.length?{images:t}:{},...r?.length?{agentIds:r}:{},..."string"==typeof e.agentName&&e.agentName?{agentName:e.agentName}:{}}}function g(e){return o.NextResponse.json({error:e instanceof Error?e.message:"Goal operation failed"},{status:(0,d.WW)(e)})}let w=new i.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/goals/route",pathname:"/api/sessions/[id]/goals",filename:"route",bundlePath:"app/api/sessions/[id]/goals/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/sessions/[id]/goals/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:f,staticGenerationAsyncStorage:y,serverHooks:v}=w,N="/api/sessions/[id]/goals/route";function I(){return(0,a.patchFetch)({serverHooks:v,staticGenerationAsyncStorage:y})}},732:(e,t,r)=>{r.d(t,{getCustomerGoalCoordinator:()=>d,U:()=>l});var s=r(1322),i=r(7519);class n{constructor(e,t,r,s,i,n){this.store=e,this.busy=t,this.run=r,this.abort=s,this.steerRun=i,this.persist=n,this.tails=new Map,this.draining=new Set}async get(e,t=!0){let r=(0,s.E0T)((await this.require(e)).metadata);return t&&this.resume(e),r}async enqueue(e,t,r){let i=await this.mutate(e,i=>(0,s.WfK)(i,{id:crypto.randomUUID(),sessionId:e,objective:t,sourceMessageId:r,now:Date.now()}));return this.resume(e),i}async enqueueMessage(e,t,r,i){let n=await this.mutate(e,n=>[n.active,...n.queued,...n.history].some(e=>e?.sourceMessageId===r)?n:(0,s.InG)(n,{id:crypto.randomUUID(),sessionId:e,objective:t,sourceMessageId:r,messagePayload:i,now:Date.now(),activate:!1}));return this.resume(e),n}reorder(e,t,r=!1){return this.mutate(e,e=>r?(0,s.h1F)(e,t):(0,s.ZC9)(e,t))}updateMessage(e,t,r,i){return this.mutate(e,e=>(0,s.Wog)(e,t,r,i))}async cancel(e,t){let r=await this.mutate(e,r=>(r.active?.id===t&&this.draining.has(e)&&this.abort(e),(0,s.LJm)(r,t,Date.now())));return this.resume(e),r}async steer(e,t){return this.mutate(e,async r=>{let i=r.queued.find(e=>e.id===t&&"message"===e.kind);if(!i||!this.busy(e))throw Error("没有可引导的运行或排队消息");if(!await this.steerRun(e,i.objective))throw Error("运行已结束,请继续排队");return(0,s.LJm)(r,t,Date.now())})}resume(e){this.draining.has(e)||(this.draining.add(e),this.drain(e).catch(e=>console.error("Customer queue failed",e)).finally(()=>this.draining.delete(e)))}async drain(e){for(;;){let t;let r=await this.get(e,!1);if(!r.active&&!r.queued.length)return;if(this.busy(e)){await new Promise(e=>setTimeout(e,100));continue}let i=(await this.mutate(e,e=>(0,s.s_d)(e,Date.now()))).active;if(!i)continue;let n="failed";try{n=await this.run(e,i)}catch(e){if(e?.code==="SESSION_ALREADY_RUNNING")continue;t=e instanceof Error?e.message:String(e)}await this.mutate(e,e=>e.active?.id===i.id?(0,s.JXc)(e,n,Date.now(),t):e)}}async require(e){let t=await this.store.get(e);if(!t)throw Error("Session not found");return t}async mutate(e,t){let r=(this.tails.get(e)??Promise.resolve()).catch(()=>{}).then(async()=>{let r=await this.require(e),i=await t((0,s.E0T)(r.metadata));if(this.persist)this.persist(e,i);else{let t=await this.require(e);await this.store.update(e,{metadata:(0,s.eC7)(t.metadata,i)})}return i});this.tails.set(e,r);try{return await r}finally{this.tails.get(e)===r&&this.tails.delete(e)}}}var a=r(785);let o=globalThis,u=new Set;function d(){return o.__sharedCustomerQueue??=new n(i.agentHost.getSessionStore(),e=>i.agentHost.isSessionRunning(e),async(e,t)=>{u.add(e);try{return await i.agentHost.startRun(t.objective,e,t.messagePayload?.images,{agentIds:t.messagePayload?.agentIds}).completion,(await i.agentHost.getSessionStore().get(e))?.status==="completed"?"completed":"failed"}finally{u.delete(e)}},e=>{u.has(e)&&i.agentHost.abort(e)},(e,t)=>i.agentHost.steer(t,e),(e,t)=>{(0,s.N8n)((0,a.kO)()).db.prepare("UPDATE sessions SET metadata = json_set(metadata, '$.goalState', json(?)), updated = ? WHERE id = ?").run(JSON.stringify(t),new Date().toISOString(),e)})}function l(){for(let e of(0,s.N8n)((0,a.kO)()).db.prepare("SELECT id FROM sessions WHERE json_extract(metadata, '$.goalState.active') IS NOT NULL OR json_array_length(metadata, '$.goalState.queued') > 0").all())d().resume(e.id)}},1614:(e,t,r)=>{r.d(t,{NL:()=>y,V_:()=>b,WW:()=>E});var s=r(7561),i=r(612),n=r(9411),a=r(7718),o=r(1322);function u(e){if(!e.trim())return!1;try{return(0,s.accessSync)(e,s.constants.X_OK),!0}catch{return!1}}function d(e){try{return(0,o.wyD)((0,a.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function l(e){let t=[],r=process.env[e.environmentVariable]?.trim();if(r){let s=u(r);t.push({source:"pin",path:r,executable:s,version:s?d(r):void 0,error:s?void 0:`${e.environmentVariable} "${r}" is not executable`})}let s=function(e){for(let t of(process.env.PATH??"").split(n.delimiter).filter(Boolean)){let r=(0,n.resolve)(t,e);if(u(r))return r}}(e.name);return s&&s!==r&&t.push({source:"path",path:s,executable:!0,version:d(s)}),(0,o.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var c=r(535),h=r(6279),p=r(785);let m=globalThis;class g{constructor(e,t=async()=>[],r=process.platform){this.runtime=e,this.listProjects=t,this.platform=r,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,r){if(!this.runtime.importWorkspace)throw new h.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,r)}async listWorkspaceSessions(e,t,r){let s=await this.runtime.listWorkspaceSessions(e,t,r);if(r?.cursor)return s;let i=new Set(s.data.map(e=>e.id)),n=s.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),w(e,t)):e});for(let r of this.pendingCreations.values())r.agentType!==e||r.projectId!==t||i.has(r.id)||n.unshift(r);return{...s,data:n}}async list(e){let[t,r]=await Promise.all([this.runtime.list(),this.listProjects()]);return I(this.withPendingCreations(t).map(e=>v(e,r,this.platform)),e)}async refresh(e){let[t,r]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return I(this.withPendingCreations(t).map(e=>v(e,r,this.platform)),e)}async create(e){let t=v(await this.runtime.create(e),await this.listProjects(),this.platform),r=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(r.id,r),r}async fork(e,t){if(!b(e))throw new h.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let r=v(t?await this.runtime.fork(e,t):await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(r.id,r),r}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let r;try{r=await this.runtime.get(e,t)}catch(s){let r=this.pendingCreations.get(e);if(!r)throw s;return t?{...r,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...r,messages:[],events:[]}}return v(r,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:s}=await Promise.resolve().then(r.bind(r,1322));return s(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,r,s,i){return this.runtime.run(e,t,r,s,i)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new h.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,r,s="web",i){if(!this.runtime.startRun)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,r,s,i)}async subscribe(e,t,r){if(!this.runtime.subscribe)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,r)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new h.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,r,s="web"){if(!this.runtime.enqueueGoal)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,r,s)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new h.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,r="web"){if(!this.runtime.enqueueMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,r)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,r,s){if(!this.runtime.updateMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,r,s)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new h.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,r=e.map(e=>{t.add(e.id);let r=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),r?w(e,r):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...r]}}function w(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function f(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function y(){if(!m.__nativeRuntimeService){!function(){let e=[(0,n.join)((0,i.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(n.delimiter),r=e.filter(e=>(0,s.existsSync)(e)&&!t.includes(e));r.length>0&&(process.env.PATH=[...t,...r].join(n.delimiter))}();let e=new o.XWE((0,p.kO)());m.__nativeRuntimeService=new g((0,h.v6)({runtimeFactory:e=>{let t=l({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:o.hix}),r=l({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,f("AGENT_CODEX_RUNTIME_ERROR",t),f("AGENT_OPENCODE_RUNTIME_ERROR",r),(0,c.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:r.executable??null,opencodeDetail:r.detail}),(0,h.WH)(t.executable??"codex",e,r.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function v(e,t,r=process.platform){let{projectId:s,...i}=e;if(!e.cwd)return i;let a=N(e.cwd,r),o="win32"===r?n.win32.sep:n.sep,u=t.filter(e=>e.description).map(e=>({project:e,path:N(e.description,r)})).filter(({path:e})=>a===e||a.startsWith(`${e}${o}`)).sort((e,t)=>t.path.length-e.path.length)[0];return u?{...i,projectId:u.project.id}:i}function N(e,t=process.platform){if("win32"!==t)return(0,n.resolve)(e);let r=n.win32.resolve(e),s=n.win32.parse(r).root;return(r.length>s.length?r.replace(/[\\/]+$/,""):r).toLowerCase()}function I(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function b(e){try{return"customer-agent"!==(0,h.Vu)(e).agentType}catch{return!1}}function E(e){if(e instanceof h.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}},1489:(e,t,r)=>{r.d(t,{N:()=>u});var s=r(1322),i=r(6279),n=r(785);class a{constructor(){this.tasks=new s.vo4((0,n.kO)()),this.scheduler=new i.ST(this.tasks,e=>{this.fire(e).catch(e=>console.error("Scheduled Customer Agent run failed",e))},()=>{}),this.scheduler.start()}async fire(e){let{agentHost:t}=await r.e(7519).then(r.bind(r,7519)),{getCustomerGoalCoordinator:s}=await Promise.all([r.e(7519),r.e(732)]).then(r.bind(r,732)),i=e.sessionId;i&&await t.getSessionStore().get(i)||(i=(await t.createSession(e.label||"定时任务")).id,this.tasks.update(e.id,{sessionId:i})),await s().enqueue(i,e.prompt)}call(e,t){let r=String(t[0]||"");switch(e){case"cronList":return this.tasks.list();case"cronCreate":{if("string"!=typeof t[0]||"string"!=typeof t[1]||!t[1].trim())throw Error("cron and prompt required");let e=t[2]&&"object"==typeof t[2]?t[2]:{};return this.tasks.create({cron:t[0],prompt:t[1],recurring:!1!==e.recurring,enabled:!0,durable:!0,..."string"==typeof e.sessionId?{sessionId:e.sessionId}:{},..."string"==typeof e.label?{label:e.label}:{}})}case"cronPause":return this.tasks.pause(r);case"cronResume":return this.tasks.resume(r);case"cronDelete":return this.tasks.delete(r);case"cronDeleteAll":return this.tasks.deleteAll(),{ok:!0};default:throw Error("Unsupported schedule operation")}}}let o=globalThis;function u(){return o.__sharedCronService??=new a}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8375,6703,6244,1322,1773,4621,7519],()=>r(5900));module.exports=s})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=7719,e.ids=[7719],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},6908:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>f,requestAsyncStorage:()=>d,routeModule:()=>c,serverHooks:()=>h,staticGenerationAsyncStorage:()=>p});var i={};r.r(i),r.d(i,{POST:()=>l});var n=r(7786),s=r(5042),o=r(2184),a=r(1890),u=r(1614);async function l(e,{params:t}){if(!(0,u.V_)(t.id))return a.NextResponse.json({error:"Only native sessions can be handed off"},{status:405});try{let e=await (0,u.NL)().handoff(t.id,"desktop");return a.NextResponse.json(e)}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Native handoff failed"},{status:(0,u.WW)(e)})}}let c=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/sessions/[id]/handoff/route",pathname:"/api/sessions/[id]/handoff",filename:"route",bundlePath:"app/api/sessions/[id]/handoff/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-37/customer-agent/packages/server/app/api/sessions/[id]/handoff/route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:d,staticGenerationAsyncStorage:p,serverHooks:h}=c,m="/api/sessions/[id]/handoff/route";function f(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:p})}},535:(e,t,r)=>{r.d(t,{L:()=>o});var i=r(1322),n=r(785);let s=!1;function o(){let e=(0,i.Qfc)();if(e)return e;let t=(0,i.qZ_)({dir:(0,n.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return s||(s=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},1614:(e,t,r)=>{r.d(t,{NL:()=>v,V_:()=>P,WW:()=>_});var i=r(7561),n=r(612),s=r(9411),o=r(7718),a=r(1322);function u(e){if(!e.trim())return!1;try{return(0,i.accessSync)(e,i.constants.X_OK),!0}catch{return!1}}function l(e){try{return(0,a.wyD)((0,o.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function c(e){let t=[],r=process.env[e.environmentVariable]?.trim();if(r){let i=u(r);t.push({source:"pin",path:r,executable:i,version:i?l(r):void 0,error:i?void 0:`${e.environmentVariable} "${r}" is not executable`})}let i=function(e){for(let t of(process.env.PATH??"").split(s.delimiter).filter(Boolean)){let r=(0,s.resolve)(t,e);if(u(r))return r}}(e.name);return i&&i!==r&&t.push({source:"path",path:i,executable:!0,version:l(i)}),(0,a.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var d=r(535),p=r(6279),h=r(785);let m=globalThis;class f{constructor(e,t=async()=>[],r=process.platform){this.runtime=e,this.listProjects=t,this.platform=r,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,r){if(!this.runtime.importWorkspace)throw new p.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,r)}async listWorkspaceSessions(e,t,r){let i=await this.runtime.listWorkspaceSessions(e,t,r);if(r?.cursor)return i;let n=new Set(i.data.map(e=>e.id)),s=i.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),w(e,t)):e});for(let r of this.pendingCreations.values())r.agentType!==e||r.projectId!==t||n.has(r.id)||s.unshift(r);return{...i,data:s}}async list(e){let[t,r]=await Promise.all([this.runtime.list(),this.listProjects()]);return E(this.withPendingCreations(t).map(e=>O(e,r,this.platform)),e)}async refresh(e){let[t,r]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return E(this.withPendingCreations(t).map(e=>O(e,r,this.platform)),e)}async create(e){let t=O(await this.runtime.create(e),await this.listProjects(),this.platform),r=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(r.id,r),r}async fork(e){if(!P(e))throw new p.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let t=O(await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(t.id,t),t}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let r;try{r=await this.runtime.get(e,t)}catch(i){let r=this.pendingCreations.get(e);if(!r)throw i;return t?{...r,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...r,messages:[],events:[]}}return O(r,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:i}=await Promise.resolve().then(r.bind(r,1322));return i(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,r,i,n){return this.runtime.run(e,t,r,i,n)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new p.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,r,i="web",n){if(!this.runtime.startRun)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,r,i,n)}async subscribe(e,t,r){if(!this.runtime.subscribe)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,r)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,r,i="web"){if(!this.runtime.enqueueGoal)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,r,i)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,r="web"){if(!this.runtime.enqueueMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,r)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,r,i){if(!this.runtime.updateMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,r,i)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,r=e.map(e=>{t.add(e.id);let r=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),r?w(e,r):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...r]}}function w(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function g(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function v(){if(!m.__nativeRuntimeService){!function(){let e=[(0,s.join)((0,n.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(s.delimiter),r=e.filter(e=>(0,i.existsSync)(e)&&!t.includes(e));r.length>0&&(process.env.PATH=[...t,...r].join(s.delimiter))}();let e=new a.XWE((0,h.kO)());m.__nativeRuntimeService=new f((0,p.v6)({runtimeFactory:e=>{let t=c({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:a.hix}),r=c({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,g("AGENT_CODEX_RUNTIME_ERROR",t),g("AGENT_OPENCODE_RUNTIME_ERROR",r),(0,d.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:r.executable??null,opencodeDetail:r.detail}),(0,p.WH)(t.executable??"codex",e,r.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function O(e,t,r=process.platform){let{projectId:i,...n}=e;if(!e.cwd)return n;let o=N(e.cwd,r),a="win32"===r?s.win32.sep:s.sep,u=t.filter(e=>e.description).map(e=>({project:e,path:N(e.description,r)})).filter(({path:e})=>o===e||o.startsWith(`${e}${a}`)).sort((e,t)=>t.path.length-e.path.length)[0];return u?{...n,projectId:u.project.id}:n}function N(e,t=process.platform){if("win32"!==t)return(0,s.resolve)(e);let r=s.win32.resolve(e),i=s.win32.parse(r).root;return(r.length>i.length?r.replace(/[\\/]+$/,""):r).toLowerCase()}function E(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function P(e){try{return"customer-agent"!==(0,p.Vu)(e).agentType}catch{return!1}}function _(e){if(e instanceof p.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[8375,6703,6244,1322,1773],()=>r(6908));module.exports=i})();
1
+ "use strict";(()=>{var e={};e.id=7719,e.ids=[7719],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},8546:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>m,patchFetch:()=>f,requestAsyncStorage:()=>d,routeModule:()=>c,serverHooks:()=>h,staticGenerationAsyncStorage:()=>p});var i={};r.r(i),r.d(i,{POST:()=>l});var n=r(7786),s=r(5042),o=r(2184),a=r(1890),u=r(1614);async function l(e,{params:t}){if(!(0,u.V_)(t.id))return a.NextResponse.json({error:"Only native sessions can be handed off"},{status:405});try{let e=await (0,u.NL)().handoff(t.id,"desktop");return a.NextResponse.json(e)}catch(e){return a.NextResponse.json({error:e instanceof Error?e.message:"Native handoff failed"},{status:(0,u.WW)(e)})}}let c=new n.AppRouteRouteModule({definition:{kind:s.x.APP_ROUTE,page:"/api/sessions/[id]/handoff/route",pathname:"/api/sessions/[id]/handoff",filename:"route",bundlePath:"app/api/sessions/[id]/handoff/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/sessions/[id]/handoff/route.ts",nextConfigOutput:"standalone",userland:i}),{requestAsyncStorage:d,staticGenerationAsyncStorage:p,serverHooks:h}=c,m="/api/sessions/[id]/handoff/route";function f(){return(0,o.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:p})}},535:(e,t,r)=>{r.d(t,{L:()=>o});var i=r(1322),n=r(785);let s=!1;function o(){let e=(0,i.Qfc)();if(e)return e;let t=(0,i.qZ_)({dir:(0,n.ME)(),source:"server",minLevel:"info",handlers:{exitOnUncaughtException:!1}});return s||(s=!0,t.info("server logger attached",{dir:t.dir,pid:process.pid})),t}},1614:(e,t,r)=>{r.d(t,{NL:()=>v,V_:()=>P,WW:()=>_});var i=r(7561),n=r(612),s=r(9411),o=r(7718),a=r(1322);function u(e){if(!e.trim())return!1;try{return(0,i.accessSync)(e,i.constants.X_OK),!0}catch{return!1}}function l(e){try{return(0,a.wyD)((0,o.execFileSync)(e,["--version"],{encoding:"utf8",timeout:5e3,stdio:["ignore","pipe","pipe"]}))}catch{return}}function c(e){let t=[],r=process.env[e.environmentVariable]?.trim();if(r){let i=u(r);t.push({source:"pin",path:r,executable:i,version:i?l(r):void 0,error:i?void 0:`${e.environmentVariable} "${r}" is not executable`})}let i=function(e){for(let t of(process.env.PATH??"").split(s.delimiter).filter(Boolean)){let r=(0,s.resolve)(t,e);if(u(r))return r}}(e.name);return i&&i!==r&&t.push({source:"path",path:i,executable:!0,version:l(i)}),(0,a.neJ)(t,{name:e.name,minimumVersion:e.minimumVersion})}var d=r(535),p=r(6279),h=r(785);let m=globalThis;class f{constructor(e,t=async()=>[],r=process.platform){this.runtime=e,this.listProjects=t,this.platform=r,this.pendingCreations=new Map}health(){return this.runtime.health()}listModels(e){return this.runtime.listModels(e)}listWorkspaces(e,t){return this.runtime.listWorkspaces(e,t)}importWorkspace(e,t,r){if(!this.runtime.importWorkspace)throw new p.no("Native workspace import is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.importWorkspace(e,t,r)}async listWorkspaceSessions(e,t,r){let i=await this.runtime.listWorkspaceSessions(e,t,r);if(r?.cursor)return i;let n=new Set(i.data.map(e=>e.id)),s=i.data.map(e=>{let t=this.pendingCreations.get(e.id);return t?(this.pendingCreations.delete(e.id),w(e,t)):e});for(let r of this.pendingCreations.values())r.agentType!==e||r.projectId!==t||n.has(r.id)||s.unshift(r);return{...i,data:s}}async list(e){let[t,r]=await Promise.all([this.runtime.list(),this.listProjects()]);return E(this.withPendingCreations(t).map(e=>O(e,r,this.platform)),e)}async refresh(e){let[t,r]=await Promise.all([this.runtime.refresh(),this.listProjects()]);return E(this.withPendingCreations(t).map(e=>O(e,r,this.platform)),e)}async create(e){let t=O(await this.runtime.create(e),await this.listProjects(),this.platform),r=e.projectId?{...t,projectId:e.projectId}:t;return this.pendingCreations.set(r.id,r),r}async fork(e,t){if(!P(e))throw new p.no("Customer Agent sessions do not support native forks","OPERATION_NOT_SUPPORTED");let r=O(t?await this.runtime.fork(e,t):await this.runtime.fork(e),await this.listProjects(),this.platform);return this.pendingCreations.set(r.id,r),r}async delete(e){await this.runtime.delete(e),this.pendingCreations.delete(e)}async get(e,t){let r;try{r=await this.runtime.get(e,t)}catch(i){let r=this.pendingCreations.get(e);if(!r)throw i;return t?{...r,messages:[],events:[],history:{nextCursor:null,hasMore:!1,pageSize:0,totalItems:0}}:{...r,messages:[],events:[]}}return O(r,await this.listProjects(),this.platform)}async getQueryIndex(e){if(this.runtime.getQueryIndex)return this.runtime.getQueryIndex(e);let t=await this.runtime.get(e),{buildSessionQueryIndex:i}=await Promise.resolve().then(r.bind(r,1322));return i(e,t.messages)}getSessionToolResult(e,t){return this.runtime.getSessionToolResult(e,t)}getSessionWatchPath(e){return this.runtime.getSessionWatchPath(e)}run(e,t,r,i,n){return this.runtime.run(e,t,r,i,n)}steer(e,t){return this.runtime.steer(e,t)}abort(e){return this.runtime.abort(e)}async release(e){if(!this.runtime.release)throw new p.no("Native runtime release is unavailable","RUNTIME_UNAVAILABLE");await this.runtime.release(e)}answerQuestion(e,t){return this.runtime.answerQuestion(e,t)}async startRun(e,t,r,i="web",n){if(!this.runtime.startRun)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.startRun(e,t,r,i,n)}async subscribe(e,t,r){if(!this.runtime.subscribe)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.subscribe(e,t,r)}async snapshot(e,t=0){if(!this.runtime.snapshot)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.snapshot(e,t)}async setPermissionMode(e,t){if(!this.runtime.setPermissionMode)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.setPermissionMode(e,t)}async handoff(e,t){if(!this.runtime.handoff)throw new p.no("Native runtime broker is unavailable","RUNTIME_UNAVAILABLE");return this.runtime.handoff(e,t)}async getGoals(e,t="web"){if(!this.runtime.getGoals)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.getGoals(e,t)}async enqueueGoal(e,t,r,i="web"){if(!this.runtime.enqueueGoal)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueGoal(e,t,r,i)}async reorderGoals(e,t){if(!this.runtime.reorderGoals)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderGoals(e,t)}async cancelGoal(e,t){if(!this.runtime.cancelGoal)throw new p.no("Goal mode is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelGoal(e,t,"web")}async enqueueMessage(e,t,r="web"){if(!this.runtime.enqueueMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.enqueueMessage(e,t,r)}async reorderMessages(e,t){if(!this.runtime.reorderMessages)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.reorderMessages(e,t)}async updateMessage(e,t,r,i){if(!this.runtime.updateMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.updateMessage(e,t,r,i)}async cancelMessage(e,t){if(!this.runtime.cancelMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.cancelMessage(e,t)}async steerMessage(e,t){if(!this.runtime.steerMessage)throw new p.no("Message queue is unavailable","OPERATION_NOT_SUPPORTED");return this.runtime.steerMessage(e,t)}withPendingCreations(e){let t=new Set,r=e.map(e=>{t.add(e.id);let r=this.pendingCreations.get(e.id);return this.pendingCreations.delete(e.id),r?w(e,r):e});return[...[...this.pendingCreations.values()].filter(e=>!t.has(e.id)).sort((e,t)=>t.updated.localeCompare(e.updated)),...r]}}function w(e,t){return{...e,cwd:e.cwd||t.cwd,projectId:e.projectId??t.projectId}}function g(e,t){t.executable?delete process.env[e]:process.env[e]=t.detail}function v(){if(!m.__nativeRuntimeService){!function(){let e=[(0,s.join)((0,n.homedir)(),".local","bin"),"/opt/homebrew/bin","/usr/local/bin"],t=(process.env.PATH??"").split(s.delimiter),r=e.filter(e=>(0,i.existsSync)(e)&&!t.includes(e));r.length>0&&(process.env.PATH=[...t,...r].join(s.delimiter))}();let e=new a.XWE((0,h.kO)());m.__nativeRuntimeService=new f((0,p.v6)({runtimeFactory:e=>{let t=c({name:"codex",environmentVariable:"AGENT_CODEX_BIN",minimumVersion:a.hix}),r=c({name:"opencode",environmentVariable:"AGENT_OPENCODE_BIN"});return process.pid,g("AGENT_CODEX_RUNTIME_ERROR",t),g("AGENT_OPENCODE_RUNTIME_ERROR",r),(0,d.L)().info("native runtime host elected",{pid:process.pid,codex:t.executable??null,codexSource:t.source??null,codexDetail:t.detail,opencode:r.executable??null,opencodeDetail:r.detail}),(0,p.WH)(t.executable??"codex",e,r.executable??"opencode")}}),()=>e.list())}return m.__nativeRuntimeService}function O(e,t,r=process.platform){let{projectId:i,...n}=e;if(!e.cwd)return n;let o=N(e.cwd,r),a="win32"===r?s.win32.sep:s.sep,u=t.filter(e=>e.description).map(e=>({project:e,path:N(e.description,r)})).filter(({path:e})=>o===e||o.startsWith(`${e}${a}`)).sort((e,t)=>t.path.length-e.path.length)[0];return u?{...n,projectId:u.project.id}:n}function N(e,t=process.platform){if("win32"!==t)return(0,s.resolve)(e);let r=s.win32.resolve(e),i=s.win32.parse(r).root;return(r.length>i.length?r.replace(/[\\/]+$/,""):r).toLowerCase()}function E(e,t){return void 0===t?e:e.filter(e=>e.projectId===t)}function P(e){try{return"customer-agent"!==(0,p.Vu)(e).agentType}catch{return!1}}function _(e){if(e instanceof p.no)switch(e.code){case"SESSION_NOT_FOUND":return 404;case"SESSION_OCCUPIED":case"SESSION_ALREADY_RUNNING":case"APPROVAL_EXPIRED":case"CODEX_SESSION_VERSION_INCOMPATIBLE":case"STALE_SESSION_ANCHOR":return 409;case"RUNTIME_UNAVAILABLE":return 503;case"OPERATION_NOT_SUPPORTED":return 405;default:return 400}return 500}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[8375,6703,6244,1322,1773],()=>r(8546));module.exports=i})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=3097,e.ids=[3097],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},1575:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>v,patchFetch:()=>y,requestAsyncStorage:()=>h,routeModule:()=>g,serverHooks:()=>f,staticGenerationAsyncStorage:()=>m});var s={};t.r(s),t.d(s,{GET:()=>l});var o=t(7786),n=t(5042),i=t(2184),u=t(1890),p=t(1322),a=t(7519),d=t(1614),x=t(8274),q=t(6279);let c=new p.pGt;async function l(e,{params:r}){if((0,d.V_)(r.id))try{return u.NextResponse.json(await (0,d.NL)().getQueryIndex(r.id))}catch(e){return u.NextResponse.json({error:e instanceof Error?e.message:"Internal error",...e instanceof q.no?{code:e.code}:{}},{status:(0,d.WW)(e)})}let t=await a.agentHost.getSessionStore().get(r.id);if(!t)return u.NextResponse.json({error:"Session not found"},{status:404});let s=(!t.messages?.length&&t.events?.length?x.Q(t.events):t.messages)?.filter(e=>!p.lWN(e))??[];return u.NextResponse.json(c.getOrCreate(r.id,s))}let g=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/query-index/route",pathname:"/api/sessions/[id]/query-index",filename:"route",bundlePath:"app/api/sessions/[id]/query-index/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-37/customer-agent/packages/server/app/api/sessions/[id]/query-index/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:h,staticGenerationAsyncStorage:m,serverHooks:f}=g,v="/api/sessions/[id]/query-index/route";function y(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:m})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,6244,1322,1773,4621,7519,8532],()=>t(1575));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=3097,e.ids=[3097],e.modules={7728:e=>{e.exports=require("@anthropic-ai/claude-agent-sdk")},5890:e=>{e.exports=require("better-sqlite3")},399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},1282:e=>{e.exports=require("child_process")},2048:e=>{e.exports=require("fs")},9801:e=>{e.exports=require("os")},5315:e=>{e.exports=require("path")},7718:e=>{e.exports=require("node:child_process")},6005:e=>{e.exports=require("node:crypto")},5673:e=>{e.exports=require("node:events")},7561:e=>{e.exports=require("node:fs")},3977:e=>{e.exports=require("node:fs/promises")},8849:e=>{e.exports=require("node:http")},2286:e=>{e.exports=require("node:https")},2033:e=>{e.exports=require("node:module")},7503:e=>{e.exports=require("node:net")},612:e=>{e.exports=require("node:os")},9411:e=>{e.exports=require("node:path")},1747:e=>{e.exports=require("node:readline")},4492:e=>{e.exports=require("node:stream")},6915:e=>{e.exports=require("node:string_decoder")},1041:e=>{e.exports=require("node:url")},5881:e=>{e.exports=require("node:util")},9256:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>v,patchFetch:()=>y,requestAsyncStorage:()=>h,routeModule:()=>g,serverHooks:()=>f,staticGenerationAsyncStorage:()=>m});var s={};t.r(s),t.d(s,{GET:()=>l});var o=t(7786),n=t(5042),i=t(2184),u=t(1890),p=t(1322),a=t(7519),d=t(1614),x=t(8274),q=t(6279);let c=new p.pGt;async function l(e,{params:r}){if((0,d.V_)(r.id))try{return u.NextResponse.json(await (0,d.NL)().getQueryIndex(r.id))}catch(e){return u.NextResponse.json({error:e instanceof Error?e.message:"Internal error",...e instanceof q.no?{code:e.code}:{}},{status:(0,d.WW)(e)})}let t=await a.agentHost.getSessionStore().get(r.id);if(!t)return u.NextResponse.json({error:"Session not found"},{status:404});let s=(!t.messages?.length&&t.events?.length?x.Q(t.events):t.messages)?.filter(e=>!p.lWN(e))??[];return u.NextResponse.json(c.getOrCreate(r.id,s))}let g=new o.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/sessions/[id]/query-index/route",pathname:"/api/sessions/[id]/query-index",filename:"route",bundlePath:"app/api/sessions/[id]/query-index/route"},resolvedPagePath:"/Users/caoqu/.codex/worktrees/npm-preview-39/customer-agent/packages/server/app/api/sessions/[id]/query-index/route.ts",nextConfigOutput:"standalone",userland:s}),{requestAsyncStorage:h,staticGenerationAsyncStorage:m,serverHooks:f}=g,v="/api/sessions/[id]/query-index/route";function y(){return(0,i.patchFetch)({serverHooks:f,staticGenerationAsyncStorage:m})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8375,6703,6244,1322,1773,4621,7519,8532],()=>t(9256));module.exports=s})();