@code-yeongyu/senpi 2026.10.26-1 → 2026.10.27-1

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 (179) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/dist/bundle/chunks/{anthropic-messages-M235FJQV.js → anthropic-messages-ODSFJCXR.js} +1 -1
  3. package/dist/bundle/chunks/{args-FBNJOJSR.js → args-SWKJAYQD.js} +1 -1
  4. package/dist/bundle/chunks/{azure-openai-responses-YQRTQ7H6.js → azure-openai-responses-REGXS4XO.js} +1 -1
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
  6. package/dist/bundle/chunks/{chunk-DMFAVE5N.js → chunk-4QVORFQ2.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-ZXHLH4MW.js → chunk-5W3DTM2J.js} +1 -1
  8. package/dist/bundle/chunks/{chunk-QYFOHFPS.js → chunk-6CJC6JY4.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-QREKAXKX.js → chunk-6GAMRAVM.js} +5 -5
  10. package/dist/bundle/chunks/{chunk-MSHRIZGT.js → chunk-7IZH2KQX.js} +3 -3
  11. package/dist/bundle/chunks/{chunk-PH3JDRB2.js → chunk-ARSENVDY.js} +1 -1
  12. package/dist/bundle/chunks/{chunk-5KZH6EYQ.js → chunk-CNDPCYNT.js} +1 -1
  13. package/dist/bundle/chunks/{chunk-DYWIFF2Q.js → chunk-CYOHFREV.js} +1 -1
  14. package/dist/bundle/chunks/{chunk-3LPWILUZ.js → chunk-DNDZPKIQ.js} +1 -1
  15. package/dist/bundle/chunks/{chunk-ZLIVZQDY.js → chunk-EQNUL2WB.js} +1 -1
  16. package/dist/bundle/chunks/{chunk-LO5MYLGF.js → chunk-FQDARFHT.js} +1 -1
  17. package/dist/bundle/chunks/{chunk-7KOUQSBX.js → chunk-GPPOPK76.js} +3 -3
  18. package/dist/bundle/chunks/{chunk-I7QWTWVZ.js → chunk-IHKHCWWG.js} +1 -1
  19. package/dist/bundle/chunks/{chunk-MY4ZD3EW.js → chunk-IY4G44MN.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-OQ3WDMB3.js → chunk-JH7MVRNJ.js} +1 -1
  21. package/dist/bundle/chunks/chunk-KBSFTXAT.js +2 -0
  22. package/dist/bundle/chunks/{chunk-UW6M3EXY.js → chunk-KRO63T4Q.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-J5FCH7TI.js → chunk-KTDIIF2F.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-3WP5RFQR.js → chunk-NDNIMC5W.js} +1 -1
  25. package/dist/bundle/chunks/chunk-NXQFBAUI.js +2 -0
  26. package/dist/bundle/chunks/{chunk-CDQPA4FP.js → chunk-ODRGPC5S.js} +1 -1
  27. package/dist/bundle/chunks/{chunk-5FQMNHXV.js → chunk-P5E4EVQF.js} +1 -1
  28. package/dist/bundle/chunks/{chunk-3A3XCLNH.js → chunk-PDG4XWO2.js} +1 -1
  29. package/dist/bundle/chunks/{chunk-5LWUUXMH.js → chunk-PY4ZQHTN.js} +1 -1
  30. package/dist/bundle/chunks/chunk-Q2A2V6NT.js +5 -0
  31. package/dist/bundle/chunks/{chunk-SOXQ42VS.js → chunk-RQ5JTXUC.js} +1 -1
  32. package/dist/bundle/chunks/{chunk-JPGT64RV.js → chunk-TV3UI63P.js} +1 -1
  33. package/dist/bundle/chunks/{chunk-JFQUWEN7.js → chunk-TWHF52G6.js} +4 -4
  34. package/dist/bundle/chunks/{chunk-6U3TBFBA.js → chunk-UJPG4ROT.js} +1 -1
  35. package/dist/bundle/chunks/{chunk-UDM7VO6O.js → chunk-XM36IFP3.js} +1 -1
  36. package/dist/bundle/chunks/{chunk-XQ45JMGN.js → chunk-Z6BREXV3.js} +1 -1
  37. package/dist/bundle/chunks/chunk-ZAS4NBVK.js +410 -0
  38. package/dist/bundle/chunks/{chunk-ADQAPDPV.js → chunk-ZP6JJDYV.js} +1 -1
  39. package/dist/bundle/chunks/{chunk-EZP6AYW2.js → chunk-ZXIAVLJV.js} +88 -88
  40. package/dist/bundle/chunks/{cli-main-55EQA5PS.js → cli-main-36FRZ7ZB.js} +1 -1
  41. package/dist/bundle/chunks/client-CBDPMWZJ.js +2 -0
  42. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-ZJQGIIRC.js → cloudflare-workers-ai-system-one-WDHT7BBV.js} +1 -1
  43. package/dist/bundle/chunks/cursor-agent.js +1 -1
  44. package/dist/bundle/chunks/devin-agent.js +1 -1
  45. package/dist/bundle/chunks/{dispatch-C2IBP5VV.js → dispatch-W5PENPZM.js} +3 -3
  46. package/dist/bundle/chunks/{google-generative-ai-5G4RIQA6.js → google-generative-ai-FHYFXKLA.js} +1 -1
  47. package/dist/bundle/chunks/{google-vertex-ALD4P27O.js → google-vertex-5DWE5U5K.js} +1 -1
  48. package/dist/bundle/chunks/{help-fast-path-PEIKGCKZ.js → help-fast-path-FETLIF3W.js} +1 -1
  49. package/dist/bundle/chunks/{host-command-657VCQ34.js → host-command-XEB7SHT3.js} +1 -1
  50. package/dist/bundle/chunks/{host-session-command-OV5XDOJK.js → host-session-command-FFN52LXJ.js} +1 -1
  51. package/dist/bundle/chunks/{interactive-mode-MLXSYK2H.js → interactive-mode-5S7NNV2Z.js} +1 -1
  52. package/dist/bundle/chunks/{mistral-conversations-RAE4K2XY.js → mistral-conversations-I2PI7DDF.js} +1 -1
  53. package/dist/bundle/chunks/{multi-session-host-774MACJU.js → multi-session-host-E3OPE6HJ.js} +3 -3
  54. package/dist/bundle/chunks/{openai-codex-responses-3CW4R7TG.js → openai-codex-responses-WSEX6SH7.js} +1 -1
  55. package/dist/bundle/chunks/{openai-completions-5UIJXQUF.js → openai-completions-YCBHTBSS.js} +1 -1
  56. package/dist/bundle/chunks/{openai-responses-2BO44MRW.js → openai-responses-GXNSQF4A.js} +1 -1
  57. package/dist/bundle/chunks/{package-manager-cli-MZHVCX2S.js → package-manager-cli-3XO456VE.js} +1 -1
  58. package/dist/bundle/chunks/{pi-messages-RF6GER4R.js → pi-messages-O6GISIRW.js} +1 -1
  59. package/dist/bundle/chunks/protocol-GLNWYI5G.js +2 -0
  60. package/dist/bundle/chunks/{role-ETSFSDTS.js → role-SHIZQKK4.js} +1 -1
  61. package/dist/bundle/chunks/{rotation-stream-ZMQB4GPO.js → rotation-stream-2PCZWNKF.js} +1 -1
  62. package/dist/bundle/chunks/{rpc-mode-UJXOIZCW.js → rpc-mode-GLWKLTMA.js} +1 -1
  63. package/dist/bundle/chunks/{schedule-command-KA7LFFNK.js → schedule-command-B7RRSANU.js} +1 -1
  64. package/dist/bundle/chunks/{session-control-endpoint-MFWXUR7Z.js → session-control-endpoint-KLE2X4RR.js} +1 -1
  65. package/dist/bundle/chunks/{session-picker-BP33NRSL.js → session-picker-DTGBOXDR.js} +1 -1
  66. package/dist/bundle/chunks/session-worker.js +131 -131
  67. package/dist/bundle/chunks/{typesafe-system-one-GNNZ5O5U.js → typesafe-system-one-XGYJJVSE.js} +1 -1
  68. package/dist/bundle/cli.js +2 -2
  69. package/dist/bundle/index.js +1 -1
  70. package/dist/bundle/rpc-entry.js +1 -1
  71. package/dist/bundle/runtime-manifest.json +1 -1
  72. package/dist/core/agent-session.d.ts +11 -1
  73. package/dist/core/agent-session.js +19 -2
  74. package/dist/core/extensions/builtin/anthropic-subscription/account-context.d.ts +15 -0
  75. package/dist/core/extensions/builtin/anthropic-subscription/account-context.js +53 -0
  76. package/dist/core/extensions/builtin/anthropic-subscription/auth-attempt.d.ts +3 -0
  77. package/dist/core/extensions/builtin/anthropic-subscription/auth-attempt.js +26 -9
  78. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane-boundary.d.ts +16 -0
  79. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane-boundary.js +27 -0
  80. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.d.ts +2 -13
  81. package/dist/core/extensions/builtin/anthropic-subscription/auth-lane.js +3 -26
  82. package/dist/core/extensions/builtin/anthropic-subscription/errors.js +3 -2
  83. package/dist/core/extensions/builtin/anthropic-subscription/guidance.d.ts +6 -1
  84. package/dist/core/extensions/builtin/anthropic-subscription/guidance.js +1 -1
  85. package/dist/core/extensions/builtin/anthropic-subscription/stream-guidance.js +13 -2
  86. package/dist/core/extensions/builtin/compaction/index.js +7 -1
  87. package/dist/core/extensions/builtin/herdr/index.js +9 -5
  88. package/dist/core/extensions/builtin/mcp/auth/oauth-issuer.d.ts +6 -0
  89. package/dist/core/extensions/builtin/mcp/auth/oauth-issuer.js +25 -0
  90. package/dist/core/extensions/builtin/mcp/auth/oauth-provider.d.ts +3 -3
  91. package/dist/core/extensions/builtin/mcp/auth/oauth-provider.js +50 -19
  92. package/dist/core/extensions/builtin/mcp/auth/oauth-refresh.js +4 -3
  93. package/dist/core/extensions/builtin/mcp/auth/oauth.js +19 -12
  94. package/dist/core/extensions/builtin/mcp/modern/consent-queue.js +1 -0
  95. package/dist/core/extensions/builtin/mcp/modern/dispatch.js +1 -0
  96. package/dist/core/extensions/builtin/mcp/modern/parameter-headers.d.ts +4 -1
  97. package/dist/core/extensions/builtin/mcp/modern/parameter-headers.js +33 -35
  98. package/dist/core/extensions/builtin/mcp/modern/request.js +6 -2
  99. package/dist/core/extensions/builtin/mcp/modern/transport.d.ts +2 -0
  100. package/dist/core/extensions/builtin/mcp/modern/transport.js +4 -2
  101. package/dist/core/extensions/builtin/mcp/sdk.lazy.d.ts +2 -0
  102. package/dist/core/extensions/builtin/mcp/sdk.lazy.js +2 -0
  103. package/dist/core/extensions/builtin/mcp/transport-sdk.js +12 -1
  104. package/dist/core/extensions/builtin/terminal/extension-state.js +2 -1
  105. package/dist/core/extensions/builtin/vertex-model-garden/auth.d.ts +9 -0
  106. package/dist/core/extensions/builtin/vertex-model-garden/auth.js +17 -1
  107. package/dist/core/extensions/builtin/websearch/websearch/providers/google.d.ts +6 -0
  108. package/dist/core/extensions/builtin/websearch/websearch/providers/google.js +6 -1
  109. package/dist/core/extensions/types.d.ts +2 -0
  110. package/dist/core/lifecycle-children.d.ts +3 -1
  111. package/dist/core/lifecycle-children.js +79 -15
  112. package/dist/core/lifecycle-record.js +1 -24
  113. package/dist/core/lifecycle-session-binding.js +2 -1
  114. package/dist/core/lifecycle-wait-items.d.ts +17 -0
  115. package/dist/core/lifecycle-wait-items.js +72 -0
  116. package/dist/core/model-runtime.js +6 -1
  117. package/dist/core/provider-api-key-auth.d.ts +6 -1
  118. package/dist/core/provider-api-key-auth.js +11 -4
  119. package/dist/core/provider-composer.d.ts +8 -1
  120. package/dist/core/provider-composer.js +7 -3
  121. package/dist/core/sdk.js +4 -1
  122. package/dist/core/session-activity.js +2 -0
  123. package/dist/core/session-lifecycle-types.d.ts +20 -4
  124. package/dist/core/session-lifecycle.js +35 -4
  125. package/dist/core/structured-session-lane.d.ts +33 -0
  126. package/dist/core/structured-session-lane.js +62 -0
  127. package/dist/core/work-custody-record.d.ts +2 -1
  128. package/dist/core/work-custody-record.js +2 -0
  129. package/dist/core/work-obligations.d.ts +1 -1
  130. package/dist/core/work-obligations.js +8 -2
  131. package/dist/modes/interactive/interactive-mode.d.ts +2 -1
  132. package/dist/modes/interactive/interactive-mode.js +2 -1
  133. package/dist/modes/json-event.d.ts +79 -1
  134. package/dist/modes/json-event.js +79 -1
  135. package/dist/modes/rpc/compact-commit-dependencies.d.ts +13 -0
  136. package/dist/modes/rpc/compact-commit-dependencies.js +48 -0
  137. package/dist/modes/rpc/compact-content-index.d.ts +84 -0
  138. package/dist/modes/rpc/compact-content-index.js +243 -0
  139. package/dist/modes/rpc/compact-content-store.d.ts +10 -43
  140. package/dist/modes/rpc/compact-content-store.js +61 -163
  141. package/dist/modes/rpc/compact-index-pages.d.ts +12 -0
  142. package/dist/modes/rpc/compact-index-pages.js +31 -0
  143. package/dist/modes/rpc/compact-read-lease.d.ts +15 -0
  144. package/dist/modes/rpc/compact-read-lease.js +40 -0
  145. package/dist/modes/rpc/compact-session-state.d.ts +14 -63
  146. package/dist/modes/rpc/compact-session-state.js +69 -51
  147. package/dist/modes/rpc/compact-spool-dir.d.ts +4 -1
  148. package/dist/modes/rpc/compact-spool-dir.js +41 -8
  149. package/dist/modes/rpc/compact-spool-storage.d.ts +58 -0
  150. package/dist/modes/rpc/compact-spool-storage.js +195 -0
  151. package/dist/modes/rpc/compact-storage-io.d.ts +2 -1
  152. package/dist/modes/rpc/compact-storage-io.js +7 -1
  153. package/dist/modes/rpc/compact-text-roots.d.ts +22 -0
  154. package/dist/modes/rpc/compact-text-roots.js +138 -0
  155. package/dist/modes/rpc/compact-text-view.d.ts +22 -0
  156. package/dist/modes/rpc/compact-text-view.js +16 -0
  157. package/dist/modes/rpc/compact-transition.d.ts +41 -0
  158. package/dist/modes/rpc/compact-transition.js +12 -0
  159. package/dist/modes/rpc/connection-handler.d.ts +2 -0
  160. package/dist/modes/rpc/connection-handler.js +12 -6
  161. package/dist/modes/rpc/host-ensure-start.js +5 -3
  162. package/dist/modes/rpc/security-presentations.js +2 -1
  163. package/dist/modes/rpc/session-binding.js +10 -0
  164. package/dist/modes/rpc/session-event-writer.d.ts +2 -0
  165. package/dist/modes/rpc/session-event-writer.js +2 -0
  166. package/dist/modes/rpc/session-record-stream.d.ts +3 -3
  167. package/dist/modes/rpc/session-record-stream.js +3 -3
  168. package/dist/modes/rpc/session-structured-lanes.d.ts +12 -0
  169. package/dist/modes/rpc/session-structured-lanes.js +24 -0
  170. package/dist/modes/rpc/session-worker-client.js +6 -5
  171. package/dist/modes/rpc/structured-session-records.d.ts +12 -0
  172. package/dist/modes/rpc/structured-session-records.js +88 -0
  173. package/docs/extensions.md +7 -1
  174. package/docs/rpc.md +17 -2
  175. package/package.json +6 -6
  176. package/dist/bundle/chunks/chunk-GQJYNFMO.js +0 -2
  177. package/dist/bundle/chunks/chunk-VICDRG3J.js +0 -410
  178. package/dist/bundle/chunks/chunk-VL7O5PO4.js +0 -5
  179. package/dist/bundle/chunks/client-LOS6GSEW.js +0 -2
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
3
- import"./chunk-MYAENL22.js";import{enableStartupCompileCache}from"./chunk-QYFOHFPS.js";import"./chunk-OQ3WDMB3.js";import{installStaleExtensionContainment,main}from"./chunk-EZP6AYW2.js";import"./chunk-6U3TBFBA.js";import"./chunk-UDM7VO6O.js";import"./chunk-ADQAPDPV.js";import{configureHttpDispatcher}from"./chunk-3A3XCLNH.js";import"./chunk-DXJJP6RP.js";import"./chunk-GXY5JEI5.js";import"./chunk-VICDRG3J.js";import"./chunk-GY5MR5KR.js";import"./chunk-3LPWILUZ.js";import"./chunk-DYWIFF2Q.js";import"./chunk-CNPDUC4D.js";import"./chunk-MLVIYDHK.js";import"./chunk-Y3TMJV3J.js";import"./chunk-JFQUWEN7.js";import"./chunk-JPGT64RV.js";import"./chunk-HWTD4QF3.js";import"./chunk-MSHRIZGT.js";import"./chunk-5KZH6EYQ.js";import"./chunk-QMRJYMNH.js";import"./chunk-XMNPK472.js";import"./chunk-TIVW4P37.js";import"./chunk-H4QOEVS5.js";import"./chunk-SOXQ42VS.js";import"./chunk-XMJKZK5H.js";import"./chunk-6VWIMHMH.js";import"./chunk-LO5MYLGF.js";import"./chunk-KLAX467B.js";import"./chunk-JFFS72FL.js";import"./chunk-ORXZXUMC.js";import"./chunk-GZVCRV7I.js";import"./chunk-KUPQO7MC.js";import"./chunk-SOMFLLPD.js";import"./chunk-I7QWTWVZ.js";import"./chunk-26UBFF6N.js";import"./chunk-MTQQ2VQH.js";import"./chunk-L2O6K3SJ.js";import"./chunk-H4WJ4LY3.js";import"./chunk-Z6SAQ5O3.js";import"./chunk-ZAUVY6ZC.js";import"./chunk-J2YAYTB2.js";import"./chunk-4WZRVZNX.js";import"./chunk-U3VOXCGP.js";import"./chunk-GWGNVYPB.js";import"./chunk-YI7SPFDN.js";import"./chunk-HB35RBP4.js";import"./chunk-Z6WGAK7W.js";import"./chunk-DLAY7CIU.js";import"./chunk-3WP5RFQR.js";import"./chunk-QXREUA5F.js";import"./chunk-RUGYFYH7.js";import"./chunk-OEFCY46F.js";import"./chunk-KRNXUTZJ.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-J5FCH7TI.js";import"./chunk-FDL4CF6F.js";import"./chunk-7KOUQSBX.js";import"./chunk-YU4AYH4C.js";import"./chunk-QREKAXKX.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-ZLIVZQDY.js";import"./chunk-GVSBCJFI.js";import"./chunk-WASCMT6Y.js";import"./chunk-MY4ZD3EW.js";import"./chunk-QGJLZ6BI.js";import"./chunk-WHPDEDCC.js";import"./chunk-AA2L2RHH.js";import"./chunk-HK46JMSC.js";import"./chunk-5LWUUXMH.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-ZXHLH4MW.js";import"./chunk-45SZOLCU.js";import"./chunk-GQJYNFMO.js";import"./chunk-PJ34QVL5.js";import"./chunk-BMX2U22F.js";import"./chunk-YU2P3CAR.js";import{installEarlyInspectorVmImportRecovery}from"./chunk-5FQMNHXV.js";import"./chunk-ZOFZRJSL.js";import"./chunk-2SOVDETB.js";import"./chunk-V3CK2AVC.js";import"./chunk-VRDU425E.js";import"./chunk-ZGAB7WQA.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunk-7YO7VQZW.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-OXNWERO4.js";import"./chunk-QN2BHP3M.js";import"./chunk-NTK2MHJ5.js";import"./chunk-O5RYI3IW.js";import"./chunk-IKOFCODM.js";await enableStartupCompileCache();installEarlyInspectorVmImportRecovery();installStaleExtensionContainment();process.title=APP_NAME;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.emitWarning=(()=>{});configureHttpDispatcher();await main(process.argv.slice(2));
3
+ import"./chunk-MYAENL22.js";import{enableStartupCompileCache}from"./chunk-6CJC6JY4.js";import"./chunk-JH7MVRNJ.js";import{installStaleExtensionContainment,main}from"./chunk-ZXIAVLJV.js";import"./chunk-UJPG4ROT.js";import"./chunk-XM36IFP3.js";import"./chunk-ZP6JJDYV.js";import{configureHttpDispatcher}from"./chunk-PDG4XWO2.js";import"./chunk-DXJJP6RP.js";import"./chunk-GXY5JEI5.js";import"./chunk-ZAS4NBVK.js";import"./chunk-GY5MR5KR.js";import"./chunk-DNDZPKIQ.js";import"./chunk-CYOHFREV.js";import"./chunk-CNPDUC4D.js";import"./chunk-MLVIYDHK.js";import"./chunk-Y3TMJV3J.js";import"./chunk-TWHF52G6.js";import"./chunk-TV3UI63P.js";import"./chunk-HWTD4QF3.js";import"./chunk-7IZH2KQX.js";import"./chunk-CNDPCYNT.js";import"./chunk-QMRJYMNH.js";import"./chunk-XMNPK472.js";import"./chunk-TIVW4P37.js";import"./chunk-H4QOEVS5.js";import"./chunk-RQ5JTXUC.js";import"./chunk-XMJKZK5H.js";import"./chunk-6VWIMHMH.js";import"./chunk-FQDARFHT.js";import"./chunk-KLAX467B.js";import"./chunk-JFFS72FL.js";import"./chunk-ORXZXUMC.js";import"./chunk-GZVCRV7I.js";import"./chunk-KUPQO7MC.js";import"./chunk-SOMFLLPD.js";import"./chunk-IHKHCWWG.js";import"./chunk-26UBFF6N.js";import"./chunk-MTQQ2VQH.js";import"./chunk-L2O6K3SJ.js";import"./chunk-H4WJ4LY3.js";import"./chunk-Z6SAQ5O3.js";import"./chunk-ZAUVY6ZC.js";import"./chunk-J2YAYTB2.js";import"./chunk-4WZRVZNX.js";import"./chunk-U3VOXCGP.js";import"./chunk-GWGNVYPB.js";import"./chunk-YI7SPFDN.js";import"./chunk-HB35RBP4.js";import"./chunk-Z6WGAK7W.js";import"./chunk-DLAY7CIU.js";import"./chunk-NDNIMC5W.js";import"./chunk-QXREUA5F.js";import"./chunk-RUGYFYH7.js";import"./chunk-OEFCY46F.js";import"./chunk-KRNXUTZJ.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-KTDIIF2F.js";import"./chunk-FDL4CF6F.js";import"./chunk-GPPOPK76.js";import"./chunk-YU4AYH4C.js";import"./chunk-6GAMRAVM.js";import"./chunk-COH5F7QV.js";import"./chunk-RFB5CBW7.js";import"./chunk-2VZJTDUX.js";import"./chunk-EQNUL2WB.js";import"./chunk-GVSBCJFI.js";import"./chunk-WASCMT6Y.js";import"./chunk-IY4G44MN.js";import"./chunk-QGJLZ6BI.js";import"./chunk-WHPDEDCC.js";import"./chunk-AA2L2RHH.js";import"./chunk-HK46JMSC.js";import"./chunk-PY4ZQHTN.js";import"./chunk-WDTJ6JKE.js";import"./chunk-5ROMKDLK.js";import"./chunk-3W47LTXQ.js";import"./chunk-5W3DTM2J.js";import"./chunk-45SZOLCU.js";import"./chunk-KBSFTXAT.js";import"./chunk-PJ34QVL5.js";import"./chunk-BMX2U22F.js";import"./chunk-YU2P3CAR.js";import{installEarlyInspectorVmImportRecovery}from"./chunk-P5E4EVQF.js";import"./chunk-ZOFZRJSL.js";import"./chunk-2SOVDETB.js";import"./chunk-V3CK2AVC.js";import"./chunk-VRDU425E.js";import"./chunk-ZGAB7WQA.js";import{APP_NAME,scrubBrandFromEnvironment}from"./chunk-7YO7VQZW.js";import"./chunk-ATQFN5HI.js";import"./chunk-MIENF2YK.js";import"./chunk-OXNWERO4.js";import"./chunk-QN2BHP3M.js";import"./chunk-NTK2MHJ5.js";import"./chunk-O5RYI3IW.js";import"./chunk-IKOFCODM.js";await enableStartupCompileCache();installEarlyInspectorVmImportRecovery();installStaleExtensionContainment();process.title=APP_NAME;scrubBrandFromEnvironment();process.env.PI_CODING_AGENT="true";process.emitWarning=(()=>{});configureHttpDispatcher();await main(process.argv.slice(2));
@@ -0,0 +1,2 @@
1
+ import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
+ import{Protocol,mergeCapabilities}from"./chunk-NXQFBAUI.js";import{getLiteralValue,getObjectShape,safeParse}from"./chunk-L73UYAH5.js";import{CallToolResultSchema,CompleteResultSchema,CreateMessageRequestSchema,CreateMessageResultSchema,CreateMessageResultWithToolsSchema,CreateTaskResultSchema,ElicitRequestSchema,ElicitResultSchema,EmptyResultSchema,ErrorCode,GetPromptResultSchema,InitializeResultSchema,LATEST_PROTOCOL_VERSION,ListChangedOptionsBaseSchema,ListPromptsResultSchema,ListResourceTemplatesResultSchema,ListResourcesResultSchema,ListToolsResultSchema,McpError,PromptListChangedNotificationSchema,ReadResourceResultSchema,ResourceListChangedNotificationSchema,SUPPORTED_PROTOCOL_VERSIONS,ToolListChangedNotificationSchema}from"./chunk-WJOT3DFL.js";import"./chunk-AX72VNRS.js";import{require_applicator,require_codegen,require_core,require_core2,require_discriminator,require_format,require_metadata,require_ref_error,require_validate,require_validation,require_validation_error}from"./chunk-Y3TMJV3J.js";import{__commonJS,__toESM}from"./chunk-IKOFCODM.js";var require_draft7=__commonJS({"node_modules/ajv/dist/vocabularies/draft7.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core_1=require_core2(),validation_1=require_validation(),applicator_1=require_applicator(),format_1=require_format(),metadata_1=require_metadata(),draft7Vocabularies=[core_1.default,validation_1.default,(0,applicator_1.default)(),format_1.default,metadata_1.metadataVocabulary,metadata_1.contentVocabulary];exports.default=draft7Vocabularies}});var require_json_schema_draft_07=__commonJS({"node_modules/ajv/dist/refs/json-schema-draft-07.json"(exports,module){module.exports={$schema:"http://json-schema.org/draft-07/schema#",$id:"http://json-schema.org/draft-07/schema#",title:"Core schema meta-schema",definitions:{schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},default:!0}}});var require_ajv=__commonJS({"node_modules/ajv/dist/ajv.js"(exports,module){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.MissingRefError=exports.ValidationError=exports.CodeGen=exports.Name=exports.nil=exports.stringify=exports.str=exports._=exports.KeywordCxt=exports.Ajv=void 0;var core_1=require_core(),draft7_1=require_draft7(),discriminator_1=require_discriminator(),draft7MetaSchema=require_json_schema_draft_07(),META_SUPPORT_DATA=["/properties"],META_SCHEMA_ID="http://json-schema.org/draft-07/schema",Ajv2=class extends core_1.default{_addVocabularies(){super._addVocabularies(),draft7_1.default.forEach(v=>this.addVocabulary(v)),this.opts.discriminator&&this.addKeyword(discriminator_1.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let metaSchema=this.opts.$data?this.$dataMetaSchema(draft7MetaSchema,META_SUPPORT_DATA):draft7MetaSchema;this.addMetaSchema(metaSchema,META_SCHEMA_ID,!1),this.refs["http://json-schema.org/schema"]=META_SCHEMA_ID}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(META_SCHEMA_ID)?META_SCHEMA_ID:void 0)}};exports.Ajv=Ajv2;module.exports=exports=Ajv2;module.exports.Ajv=Ajv2;Object.defineProperty(exports,"__esModule",{value:!0});exports.default=Ajv2;var validate_1=require_validate();Object.defineProperty(exports,"KeywordCxt",{enumerable:!0,get:function(){return validate_1.KeywordCxt}});var codegen_1=require_codegen();Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return codegen_1._}});Object.defineProperty(exports,"str",{enumerable:!0,get:function(){return codegen_1.str}});Object.defineProperty(exports,"stringify",{enumerable:!0,get:function(){return codegen_1.stringify}});Object.defineProperty(exports,"nil",{enumerable:!0,get:function(){return codegen_1.nil}});Object.defineProperty(exports,"Name",{enumerable:!0,get:function(){return codegen_1.Name}});Object.defineProperty(exports,"CodeGen",{enumerable:!0,get:function(){return codegen_1.CodeGen}});var validation_error_1=require_validation_error();Object.defineProperty(exports,"ValidationError",{enumerable:!0,get:function(){return validation_error_1.default}});var ref_error_1=require_ref_error();Object.defineProperty(exports,"MissingRefError",{enumerable:!0,get:function(){return ref_error_1.default}})}});var require_formats=__commonJS({"node_modules/ajv-formats/dist/formats.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.formatNames=exports.fastFormats=exports.fullFormats=void 0;function fmtDef(validate,compare){return{validate,compare}}exports.fullFormats={date:fmtDef(date,compareDate),time:fmtDef(getTime(!0),compareTime),"date-time":fmtDef(getDateTime(!0),compareDateTime),"iso-time":fmtDef(getTime(),compareIsoTime),"iso-date-time":fmtDef(getDateTime(),compareIsoDateTime),duration:/^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/,uri,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,url:/^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu,email:/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,hostname:/^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i,ipv4:/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)$/,ipv6:/^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i,regex,uuid:/^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i,"json-pointer":/^(?:\/(?:[^~/]|~0|~1)*)*$/,"json-pointer-uri-fragment":/^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/,byte,int32:{type:"number",validate:validateInt32},int64:{type:"number",validate:validateInt64},float:{type:"number",validate:validateNumber},double:{type:"number",validate:validateNumber},password:!0,binary:!0};exports.fastFormats={...exports.fullFormats,date:fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/,compareDate),time:fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareTime),"date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,compareDateTime),"iso-time":fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoTime),"iso-date-time":fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,compareIsoDateTime),uri:/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i,"uri-reference":/^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,email:/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i};exports.formatNames=Object.keys(exports.fullFormats);function isLeapYear(year){return year%4===0&&(year%100!==0||year%400===0)}var DATE=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,DAYS=[0,31,28,31,30,31,30,31,31,30,31,30,31];function date(str){let matches=DATE.exec(str);if(!matches)return!1;let year=+matches[1],month=+matches[2],day=+matches[3];return month>=1&&month<=12&&day>=1&&day<=(month===2&&isLeapYear(year)?29:DAYS[month])}function compareDate(d1,d2){if(d1&&d2)return d1>d2?1:d1<d2?-1:0}var TIME=/^(\d\d):(\d\d):(\d\d(?:\.\d+)?)(z|([+-])(\d\d)(?::?(\d\d))?)?$/i;function getTime(strictTimeZone){return function(str){let matches=TIME.exec(str);if(!matches)return!1;let hr=+matches[1],min=+matches[2],sec=+matches[3],tz=matches[4],tzSign=matches[5]==="-"?-1:1,tzH=+(matches[6]||0),tzM=+(matches[7]||0);if(tzH>23||tzM>59||strictTimeZone&&!tz)return!1;if(hr<=23&&min<=59&&sec<60)return!0;let utcMin=min-tzM*tzSign,utcHr=hr-tzH*tzSign-(utcMin<0?1:0);return(utcHr===23||utcHr===-1)&&(utcMin===59||utcMin===-1)&&sec<61}}function compareTime(s1,s2){if(!(s1&&s2))return;let t1=new Date("2020-01-01T"+s1).valueOf(),t2=new Date("2020-01-01T"+s2).valueOf();if(t1&&t2)return t1-t2}function compareIsoTime(t1,t2){if(!(t1&&t2))return;let a1=TIME.exec(t1),a2=TIME.exec(t2);if(a1&&a2)return t1=a1[1]+a1[2]+a1[3],t2=a2[1]+a2[2]+a2[3],t1>t2?1:t1<t2?-1:0}var DATE_TIME_SEPARATOR=/t|\s/i;function getDateTime(strictTimeZone){let time=getTime(strictTimeZone);return function(str){let dateTime=str.split(DATE_TIME_SEPARATOR);return dateTime.length===2&&date(dateTime[0])&&time(dateTime[1])}}function compareDateTime(dt1,dt2){if(!(dt1&&dt2))return;let d1=new Date(dt1).valueOf(),d2=new Date(dt2).valueOf();if(d1&&d2)return d1-d2}function compareIsoDateTime(dt1,dt2){if(!(dt1&&dt2))return;let[d1,t1]=dt1.split(DATE_TIME_SEPARATOR),[d2,t2]=dt2.split(DATE_TIME_SEPARATOR),res=compareDate(d1,d2);if(res!==void 0)return res||compareTime(t1,t2)}var NOT_URI_FRAGMENT=/\/|:/,URI=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;function uri(str){return NOT_URI_FRAGMENT.test(str)&&URI.test(str)}var BYTE=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm;function byte(str){return BYTE.lastIndex=0,BYTE.test(str)}var MIN_INT32=-(2**31),MAX_INT32=2**31-1;function validateInt32(value){return Number.isInteger(value)&&value<=MAX_INT32&&value>=MIN_INT32}function validateInt64(value){return Number.isInteger(value)}function validateNumber(){return!0}var Z_ANCHOR=/[^\\]\\Z/;function regex(str){if(Z_ANCHOR.test(str))return!1;try{return new RegExp(str),!0}catch{return!1}}}});var require_limit=__commonJS({"node_modules/ajv-formats/dist/limit.js"(exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.formatLimitDefinition=void 0;var ajv_1=require_ajv(),codegen_1=require_codegen(),ops=codegen_1.operators,KWDs={formatMaximum:{okStr:"<=",ok:ops.LTE,fail:ops.GT},formatMinimum:{okStr:">=",ok:ops.GTE,fail:ops.LT},formatExclusiveMaximum:{okStr:"<",ok:ops.LT,fail:ops.GTE},formatExclusiveMinimum:{okStr:">",ok:ops.GT,fail:ops.LTE}},error={message:({keyword,schemaCode})=>(0,codegen_1.str)`should be ${KWDs[keyword].okStr} ${schemaCode}`,params:({keyword,schemaCode})=>(0,codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`};exports.formatLimitDefinition={keyword:Object.keys(KWDs),type:"string",schemaType:"string",$data:!0,error,code(cxt){let{gen,data,schemaCode,keyword,it}=cxt,{opts,self}=it;if(!opts.validateFormats)return;let fCxt=new ajv_1.KeywordCxt(it,self.RULES.all.format.definition,"format");fCxt.$data?validate$DataFormat():validateFormat();function validate$DataFormat(){let fmts=gen.scopeValue("formats",{ref:self.formats,code:opts.code.formats}),fmt=gen.const("fmt",(0,codegen_1._)`${fmts}[${fCxt.schemaCode}]`);cxt.fail$data((0,codegen_1.or)((0,codegen_1._)`typeof ${fmt} != "object"`,(0,codegen_1._)`${fmt} instanceof RegExp`,(0,codegen_1._)`typeof ${fmt}.compare != "function"`,compareCode(fmt)))}function validateFormat(){let format=fCxt.schema,fmtDef=self.formats[format];if(!fmtDef||fmtDef===!0)return;if(typeof fmtDef!="object"||fmtDef instanceof RegExp||typeof fmtDef.compare!="function")throw new Error(`"${keyword}": format "${format}" does not define "compare" function`);let fmt=gen.scopeValue("formats",{key:format,ref:fmtDef,code:opts.code.formats?(0,codegen_1._)`${opts.code.formats}${(0,codegen_1.getProperty)(format)}`:void 0});cxt.fail$data(compareCode(fmt))}function compareCode(fmt){return(0,codegen_1._)`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`}},dependencies:["format"]};var formatLimitPlugin=ajv=>(ajv.addKeyword(exports.formatLimitDefinition),ajv);exports.default=formatLimitPlugin}});var require_dist=__commonJS({"node_modules/ajv-formats/dist/index.js"(exports,module){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var formats_1=require_formats(),limit_1=require_limit(),codegen_1=require_codegen(),fullName=new codegen_1.Name("fullFormats"),fastName=new codegen_1.Name("fastFormats"),formatsPlugin=(ajv,opts={keywords:!0})=>{if(Array.isArray(opts))return addFormats(ajv,opts,formats_1.fullFormats,fullName),ajv;let[formats,exportName]=opts.mode==="fast"?[formats_1.fastFormats,fastName]:[formats_1.fullFormats,fullName],list=opts.formats||formats_1.formatNames;return addFormats(ajv,list,formats,exportName),opts.keywords&&(0,limit_1.default)(ajv),ajv};formatsPlugin.get=(name,mode="full")=>{let f=(mode==="fast"?formats_1.fastFormats:formats_1.fullFormats)[name];if(!f)throw new Error(`Unknown format "${name}"`);return f};function addFormats(ajv,list,fs,exportName){var _a,_b;(_a=(_b=ajv.opts.code).formats)!==null&&_a!==void 0||(_b.formats=(0,codegen_1._)`require("ajv-formats/dist/formats").${exportName}`);for(let f of list)ajv.addFormat(f,fs[f])}module.exports=exports=formatsPlugin;Object.defineProperty(exports,"__esModule",{value:!0});exports.default=formatsPlugin}});var import_ajv=__toESM(require_ajv(),1),import_ajv_formats=__toESM(require_dist(),1);function createDefaultAjvInstance(){let ajv=new import_ajv.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return(0,import_ajv_formats.default)(ajv),ajv}var AjvJsonSchemaValidator=class{constructor(ajv){this._ajv=ajv??createDefaultAjvInstance()}getValidator(schema){let ajvValidator="$id"in schema&&typeof schema.$id=="string"?this._ajv.getSchema(schema.$id)??this._ajv.compile(schema):this._ajv.compile(schema);return input=>ajvValidator(input)?{valid:!0,data:input,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(ajvValidator.errors)}}};var ExperimentalClientTasks=class{constructor(_client){this._client=_client}async*callToolStream(params,resultSchema=CallToolResultSchema,options){let clientInternal=this._client,optionsWithTask={...options,task:options?.task??(clientInternal.isToolTask(params.name)?{}:void 0)},stream=clientInternal.requestStream({method:"tools/call",params},resultSchema,optionsWithTask),validator=clientInternal.getToolOutputValidator(params.name);for await(let message of stream){if(message.type==="result"&&validator){let result=message.result;if(!result.structuredContent&&!result.isError){yield{type:"error",error:new McpError(ErrorCode.InvalidRequest,`Tool ${params.name} has an output schema but did not return structured content`)};return}if(result.structuredContent)try{let validationResult=validator(result.structuredContent);if(!validationResult.valid){yield{type:"error",error:new McpError(ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${validationResult.errorMessage}`)};return}}catch(error){if(error instanceof McpError){yield{type:"error",error};return}yield{type:"error",error:new McpError(ErrorCode.InvalidParams,`Failed to validate structured content: ${error instanceof Error?error.message:String(error)}`)};return}}yield message}}async getTask(taskId,options){return this._client.getTask({taskId},options)}async getTaskResult(taskId,resultSchema,options){return this._client.getTaskResult({taskId},resultSchema,options)}async listTasks(cursor,options){return this._client.listTasks(cursor?{cursor}:void 0,options)}async cancelTask(taskId,options){return this._client.cancelTask({taskId},options)}requestStream(request,resultSchema,options){return this._client.requestStream(request,resultSchema,options)}};function assertToolsCallTaskCapability(requests,method,entityName){if(!requests)throw new Error(`${entityName} does not support task creation (required for ${method})`);switch(method){case"tools/call":if(!requests.tools?.call)throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`);break;default:break}}function assertClientRequestTaskCapability(requests,method,entityName){if(!requests)throw new Error(`${entityName} does not support task creation (required for ${method})`);switch(method){case"sampling/createMessage":if(!requests.sampling?.createMessage)throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`);break;case"elicitation/create":if(!requests.elicitation?.create)throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);break;default:break}}function applyElicitationDefaults(schema,data){if(!(!schema||data===null||typeof data!="object")){if(schema.type==="object"&&schema.properties&&typeof schema.properties=="object"){let obj=data,props=schema.properties;for(let key of Object.keys(props)){let propSchema=props[key];obj[key]===void 0&&Object.prototype.hasOwnProperty.call(propSchema,"default")&&(obj[key]=propSchema.default),obj[key]!==void 0&&applyElicitationDefaults(propSchema,obj[key])}}if(Array.isArray(schema.anyOf))for(let sub of schema.anyOf)typeof sub!="boolean"&&applyElicitationDefaults(sub,data);if(Array.isArray(schema.oneOf))for(let sub of schema.oneOf)typeof sub!="boolean"&&applyElicitationDefaults(sub,data)}}function getSupportedElicitationModes(capabilities){if(!capabilities)return{supportsFormMode:!1,supportsUrlMode:!1};let hasFormCapability=capabilities.form!==void 0,hasUrlCapability=capabilities.url!==void 0;return{supportsFormMode:hasFormCapability||!hasFormCapability&&!hasUrlCapability,supportsUrlMode:hasUrlCapability}}var Client=class extends Protocol{constructor(_clientInfo,options){super(options),this._clientInfo=_clientInfo,this._cachedToolOutputValidators=new Map,this._cachedKnownTaskTools=new Set,this._cachedRequiredTaskTools=new Set,this._listChangedDebounceTimers=new Map,this._capabilities=options?.capabilities??{},this._jsonSchemaValidator=options?.jsonSchemaValidator??new AjvJsonSchemaValidator,options?.listChanged&&(this._pendingListChangedConfig=options.listChanged)}_setupListChangedHandlers(config){config.tools&&this._serverCapabilities?.tools?.listChanged&&this._setupListChangedHandler("tools",ToolListChangedNotificationSchema,config.tools,async()=>(await this.listTools()).tools),config.prompts&&this._serverCapabilities?.prompts?.listChanged&&this._setupListChangedHandler("prompts",PromptListChangedNotificationSchema,config.prompts,async()=>(await this.listPrompts()).prompts),config.resources&&this._serverCapabilities?.resources?.listChanged&&this._setupListChangedHandler("resources",ResourceListChangedNotificationSchema,config.resources,async()=>(await this.listResources()).resources)}get experimental(){return this._experimental||(this._experimental={tasks:new ExperimentalClientTasks(this)}),this._experimental}registerCapabilities(capabilities){if(this.transport)throw new Error("Cannot register capabilities after connecting to transport");this._capabilities=mergeCapabilities(this._capabilities,capabilities)}setRequestHandler(requestSchema,handler){let methodSchema=getObjectShape(requestSchema)?.method;if(!methodSchema)throw new Error("Schema is missing a method literal");let methodValue=getLiteralValue(methodSchema);if(typeof methodValue!="string")throw new Error("Schema method literal must be a string");let method=methodValue;if(method==="elicitation/create"){let wrappedHandler=async(request,extra)=>{let validatedRequest=safeParse(ElicitRequestSchema,request);if(!validatedRequest.success){let errorMessage=validatedRequest.error instanceof Error?validatedRequest.error.message:String(validatedRequest.error);throw new McpError(ErrorCode.InvalidParams,`Invalid elicitation request: ${errorMessage}`)}let{params}=validatedRequest.data;params.mode=params.mode??"form";let{supportsFormMode,supportsUrlMode}=getSupportedElicitationModes(this._capabilities.elicitation);if(params.mode==="form"&&!supportsFormMode)throw new McpError(ErrorCode.InvalidParams,"Client does not support form-mode elicitation requests");if(params.mode==="url"&&!supportsUrlMode)throw new McpError(ErrorCode.InvalidParams,"Client does not support URL-mode elicitation requests");let result=await Promise.resolve(handler(request,extra));if(params.task){let taskValidationResult=safeParse(CreateTaskResultSchema,result);if(!taskValidationResult.success){let errorMessage=taskValidationResult.error instanceof Error?taskValidationResult.error.message:String(taskValidationResult.error);throw new McpError(ErrorCode.InvalidParams,`Invalid task creation result: ${errorMessage}`)}return taskValidationResult.data}let validationResult=safeParse(ElicitResultSchema,result);if(!validationResult.success){let errorMessage=validationResult.error instanceof Error?validationResult.error.message:String(validationResult.error);throw new McpError(ErrorCode.InvalidParams,`Invalid elicitation result: ${errorMessage}`)}let validatedResult=validationResult.data,requestedSchema=params.mode==="form"?params.requestedSchema:void 0;if(params.mode==="form"&&validatedResult.action==="accept"&&validatedResult.content&&requestedSchema&&this._capabilities.elicitation?.form?.applyDefaults)try{applyElicitationDefaults(requestedSchema,validatedResult.content)}catch{}return validatedResult};return super.setRequestHandler(requestSchema,wrappedHandler)}if(method==="sampling/createMessage"){let wrappedHandler=async(request,extra)=>{let validatedRequest=safeParse(CreateMessageRequestSchema,request);if(!validatedRequest.success){let errorMessage=validatedRequest.error instanceof Error?validatedRequest.error.message:String(validatedRequest.error);throw new McpError(ErrorCode.InvalidParams,`Invalid sampling request: ${errorMessage}`)}let{params}=validatedRequest.data,result=await Promise.resolve(handler(request,extra));if(params.task){let taskValidationResult=safeParse(CreateTaskResultSchema,result);if(!taskValidationResult.success){let errorMessage=taskValidationResult.error instanceof Error?taskValidationResult.error.message:String(taskValidationResult.error);throw new McpError(ErrorCode.InvalidParams,`Invalid task creation result: ${errorMessage}`)}return taskValidationResult.data}let resultSchema=params.tools||params.toolChoice?CreateMessageResultWithToolsSchema:CreateMessageResultSchema,validationResult=safeParse(resultSchema,result);if(!validationResult.success){let errorMessage=validationResult.error instanceof Error?validationResult.error.message:String(validationResult.error);throw new McpError(ErrorCode.InvalidParams,`Invalid sampling result: ${errorMessage}`)}return validationResult.data};return super.setRequestHandler(requestSchema,wrappedHandler)}return super.setRequestHandler(requestSchema,handler)}assertCapability(capability,method){if(!this._serverCapabilities?.[capability])throw new Error(`Server does not support ${capability} (required for ${method})`)}async connect(transport,options){if(await super.connect(transport),transport.sessionId===void 0)try{let result=await this.request({method:"initialize",params:{protocolVersion:LATEST_PROTOCOL_VERSION,capabilities:this._capabilities,clientInfo:this._clientInfo}},InitializeResultSchema,options);if(result===void 0)throw new Error(`Server sent invalid initialize result: ${result}`);if(!SUPPORTED_PROTOCOL_VERSIONS.includes(result.protocolVersion))throw new Error(`Server's protocol version is not supported: ${result.protocolVersion}`);this._serverCapabilities=result.capabilities,this._serverVersion=result.serverInfo,transport.setProtocolVersion&&transport.setProtocolVersion(result.protocolVersion),this._instructions=result.instructions,await this.notification({method:"notifications/initialized"}),this._pendingListChangedConfig&&(this._setupListChangedHandlers(this._pendingListChangedConfig),this._pendingListChangedConfig=void 0)}catch(error){throw this.close(),error}}getServerCapabilities(){return this._serverCapabilities}getServerVersion(){return this._serverVersion}getInstructions(){return this._instructions}assertCapabilityForMethod(method){switch(method){case"logging/setLevel":if(!this._serverCapabilities?.logging)throw new Error(`Server does not support logging (required for ${method})`);break;case"prompts/get":case"prompts/list":if(!this._serverCapabilities?.prompts)throw new Error(`Server does not support prompts (required for ${method})`);break;case"resources/list":case"resources/templates/list":case"resources/read":case"resources/subscribe":case"resources/unsubscribe":if(!this._serverCapabilities?.resources)throw new Error(`Server does not support resources (required for ${method})`);if(method==="resources/subscribe"&&!this._serverCapabilities.resources.subscribe)throw new Error(`Server does not support resource subscriptions (required for ${method})`);break;case"tools/call":case"tools/list":if(!this._serverCapabilities?.tools)throw new Error(`Server does not support tools (required for ${method})`);break;case"completion/complete":if(!this._serverCapabilities?.completions)throw new Error(`Server does not support completions (required for ${method})`);break;case"initialize":break;case"ping":break}}assertNotificationCapability(method){switch(method){case"notifications/roots/list_changed":if(!this._capabilities.roots?.listChanged)throw new Error(`Client does not support roots list changed notifications (required for ${method})`);break;case"notifications/initialized":break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(method){if(this._capabilities)switch(method){case"sampling/createMessage":if(!this._capabilities.sampling)throw new Error(`Client does not support sampling capability (required for ${method})`);break;case"elicitation/create":if(!this._capabilities.elicitation)throw new Error(`Client does not support elicitation capability (required for ${method})`);break;case"roots/list":if(!this._capabilities.roots)throw new Error(`Client does not support roots capability (required for ${method})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw new Error(`Client does not support tasks capability (required for ${method})`);break;case"ping":break}}assertTaskCapability(method){assertToolsCallTaskCapability(this._serverCapabilities?.tasks?.requests,method,"Server")}assertTaskHandlerCapability(method){this._capabilities&&assertClientRequestTaskCapability(this._capabilities.tasks?.requests,method,"Client")}async ping(options){return this.request({method:"ping"},EmptyResultSchema,options)}async complete(params,options){return this.request({method:"completion/complete",params},CompleteResultSchema,options)}async setLoggingLevel(level,options){return this.request({method:"logging/setLevel",params:{level}},EmptyResultSchema,options)}async getPrompt(params,options){return this.request({method:"prompts/get",params},GetPromptResultSchema,options)}async listPrompts(params,options){return this.request({method:"prompts/list",params},ListPromptsResultSchema,options)}async listResources(params,options){return this.request({method:"resources/list",params},ListResourcesResultSchema,options)}async listResourceTemplates(params,options){return this.request({method:"resources/templates/list",params},ListResourceTemplatesResultSchema,options)}async readResource(params,options){return this.request({method:"resources/read",params},ReadResourceResultSchema,options)}async subscribeResource(params,options){return this.request({method:"resources/subscribe",params},EmptyResultSchema,options)}async unsubscribeResource(params,options){return this.request({method:"resources/unsubscribe",params},EmptyResultSchema,options)}async callTool(params,resultSchema=CallToolResultSchema,options){if(this.isToolTaskRequired(params.name))throw new McpError(ErrorCode.InvalidRequest,`Tool "${params.name}" requires task-based execution. Use client.experimental.tasks.callToolStream() instead.`);let result=await this.request({method:"tools/call",params},resultSchema,options),validator=this.getToolOutputValidator(params.name);if(validator){if(!result.structuredContent&&!result.isError)throw new McpError(ErrorCode.InvalidRequest,`Tool ${params.name} has an output schema but did not return structured content`);if(result.structuredContent)try{let validationResult=validator(result.structuredContent);if(!validationResult.valid)throw new McpError(ErrorCode.InvalidParams,`Structured content does not match the tool's output schema: ${validationResult.errorMessage}`)}catch(error){throw error instanceof McpError?error:new McpError(ErrorCode.InvalidParams,`Failed to validate structured content: ${error instanceof Error?error.message:String(error)}`)}}return result}isToolTask(toolName){return this._serverCapabilities?.tasks?.requests?.tools?.call?this._cachedKnownTaskTools.has(toolName):!1}isToolTaskRequired(toolName){return this._cachedRequiredTaskTools.has(toolName)}cacheToolMetadata(tools){this._cachedToolOutputValidators.clear(),this._cachedKnownTaskTools.clear(),this._cachedRequiredTaskTools.clear();for(let tool of tools){if(tool.outputSchema){let toolValidator=this._jsonSchemaValidator.getValidator(tool.outputSchema);this._cachedToolOutputValidators.set(tool.name,toolValidator)}let taskSupport=tool.execution?.taskSupport;(taskSupport==="required"||taskSupport==="optional")&&this._cachedKnownTaskTools.add(tool.name),taskSupport==="required"&&this._cachedRequiredTaskTools.add(tool.name)}}getToolOutputValidator(toolName){return this._cachedToolOutputValidators.get(toolName)}async listTools(params,options){let result=await this.request({method:"tools/list",params},ListToolsResultSchema,options);return this.cacheToolMetadata(result.tools),result}_setupListChangedHandler(listType,notificationSchema,options,fetcher){let parseResult=ListChangedOptionsBaseSchema.safeParse(options);if(!parseResult.success)throw new Error(`Invalid ${listType} listChanged options: ${parseResult.error.message}`);if(typeof options.onChanged!="function")throw new Error(`Invalid ${listType} listChanged options: onChanged must be a function`);let{autoRefresh,debounceMs}=parseResult.data,{onChanged}=options,refresh=async()=>{if(!autoRefresh){onChanged(null,null);return}try{let items=await fetcher();onChanged(null,items)}catch(e){let error=e instanceof Error?e:new Error(String(e));onChanged(error,null)}},handler=()=>{if(debounceMs){let existingTimer=this._listChangedDebounceTimers.get(listType);existingTimer&&clearTimeout(existingTimer);let timer=setTimeout(refresh,debounceMs);this._listChangedDebounceTimers.set(listType,timer)}else refresh()};this.setNotificationHandler(notificationSchema,handler)}async sendRootsListChanged(){return this.notification({method:"notifications/roots/list_changed"})}};export{Client,getSupportedElicitationModes};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url); { const __piWorkerThreads = require("node:worker_threads"); if (typeof __piWorkerThreads.markAsUncloneable !== "function") { __piWorkerThreads.markAsUncloneable = () => {}; } }
2
- import{classifySystemOne,isRecord}from"./chunk-UW6M3EXY.js";import"./chunk-EDOW5W5H.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-ZXHLH4MW.js";import"./chunk-45SZOLCU.js";import"./chunk-GQJYNFMO.js";import"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var LABEL="Cloudflare Workers AI";function cloudflareErrorMessage(errors){if(Array.isArray(errors)){let messages=errors.map(error=>isRecord(error)&&typeof error.message=="string"?error.message:void 0).filter(message=>message!==void 0);if(messages.length>0)return`${LABEL} error: ${messages.join("; ")}`}return`${LABEL} request failed`}var transport={api:"cloudflare-workers-ai-system-one",label:LABEL,url:model=>new URL("run",`${model.baseUrl.replace(/\/+$/u,"")}/`),payload:(model,request)=>({model:model.id,input:request}),output:body=>{if(!isRecord(body))throw new Error(`${LABEL} returned an unexpected response`);if(body.success===!1)throw new Error(cloudflareErrorMessage(body.errors));let run=body.result;if(!isRecord(run))throw new Error(`${LABEL} returned an unexpected response`);if(run.state!=="Completed")throw new Error(`${LABEL} run did not complete (state: ${String(run.state)})`);if(!isRecord(run.result))throw new Error(`${LABEL} returned an unexpected response`);return run.result}},classify=(model,context,options)=>classifySystemOne(transport,model,context,options);export{classify};
2
+ import{classifySystemOne,isRecord}from"./chunk-KRO63T4Q.js";import"./chunk-EDOW5W5H.js";import"./chunk-TAV6QZFM.js";import"./chunk-PELNNWGO.js";import"./chunk-5W3DTM2J.js";import"./chunk-45SZOLCU.js";import"./chunk-KBSFTXAT.js";import"./chunk-PJ34QVL5.js";import"./chunk-IKOFCODM.js";var LABEL="Cloudflare Workers AI";function cloudflareErrorMessage(errors){if(Array.isArray(errors)){let messages=errors.map(error=>isRecord(error)&&typeof error.message=="string"?error.message:void 0).filter(message=>message!==void 0);if(messages.length>0)return`${LABEL} error: ${messages.join("; ")}`}return`${LABEL} request failed`}var transport={api:"cloudflare-workers-ai-system-one",label:LABEL,url:model=>new URL("run",`${model.baseUrl.replace(/\/+$/u,"")}/`),payload:(model,request)=>({model:model.id,input:request}),output:body=>{if(!isRecord(body))throw new Error(`${LABEL} returned an unexpected response`);if(body.success===!1)throw new Error(cloudflareErrorMessage(body.errors));let run=body.result;if(!isRecord(run))throw new Error(`${LABEL} returned an unexpected response`);if(run.state!=="Completed")throw new Error(`${LABEL} run did not complete (state: ${String(run.state)})`);if(!isRecord(run.result))throw new Error(`${LABEL} returned an unexpected response`);return run.result}},classify=(model,context,options)=>classifySystemOne(transport,model,context,options);export{classify};
@@ -15,7 +15,7 @@ Run independent searches and reads together in one batch. Keep dependent steps i
15
15
 
16
16
  A task is finished when the requested behavior is in place and you have watched it work: the relevant test, build, or command run, and its output read. Until you have that, keep going. If something remains unproven or broken, say which part and why.
17
17
 
18
- When asked a question, answer it from the code and stop there. Edit when a change was requested or when a fix is confirmed.`,COMPOSER_MODEL_ID_PATTERN=/(?:^|[/:._-])composer(?:[/:._-]|\d|$)/i;function isCursorComposerModel(modelId){return COMPOSER_MODEL_ID_PATTERN.test(modelId)}var CURSOR_MULTIMODAL_ID_PATTERN=/^default$|claude|gemini|gpt-|codex|kimi-k3|muse-|cursor-grok-4\.[56]/;function cursorDiscoveredInput(modelId){return CURSOR_MULTIMODAL_ID_PATTERN.test(modelId.toLowerCase())?["text","image"]:["text"]}var captures=new WeakMap,readers=new WeakMap,writers=new WeakMap,states=new WeakMap,demanded=new WeakSet,warned=new WeakSet,NO_CHANGE=Object.freeze({}),subscribers=0,capturedAny=!1;function setAssistantReader(owner,reader){readers.set(owner,reader)}function setAssistantProgressWriter(owner,writer){writers.set(owner,writer)}function enableAssistantCapture(owner){states.has(owner)||states.set(owner,void 0)}function activeState(owner){let state=states.get(owner);if(state!==void 0||!states.has(owner))return state??void 0;let decided=subscribers>0||demanded.has(owner)?{positions:new Map,metadata:new Map,insertCopies:new Map,failedBlocks:new Set}:null;return capturedAny||=decided!==null,states.set(owner,decided),decided??void 0}function dropCapture(owner,error,state,contentIndex){contentIndex!==void 0&&state?.failedBlocks.add(contentIndex),!warned.has(owner)&&(warned.add(owner),console.warn("[assistant-capture] could not build an internal capture record; that block's records are dropped",error))}function freezeCapture(value){let freeze=part=>{if(!(part===null||typeof part!="object"||Object.isFrozen(part))){for(let child of Object.values(part))freeze(child);Object.freeze(part)}},copy=structuredClone(value);return freeze(copy),copy}function publicBlock(block){return Object.fromEntries({text:["type","text","audience","textSignature"],thinking:["type","thinking","thinkingSignature","redacted","startedAt","endedAt"],toolCall:["type","id","name","arguments","incomplete","errorMessage","thoughtSignature","namespace"],providerNative:["type","subtype","raw"]}[block.type].filter(key=>key in block).map(key=>[key,Reflect.get(block,key)]))}function sameValue(left,right){if(left===right)return!0;if(!isPlainData(left)||!isPlainData(right)||Array.isArray(left)!==Array.isArray(right))return!1;let keys=Object.keys(left);return keys.length===Object.keys(right).length&&keys.every(key=>Object.hasOwn(right,key)&&sameValue(Reflect.get(left,key),Reflect.get(right,key)))}function isPlainData(value){if(typeof value!="object"||value===null)return!1;let prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===Array.prototype||prototype===null}function dropAssistantCapture(event){capturedAny&&captures.delete(event)}function captureAssistantEvent(owner,event,hint={}){let state=activeState(owner);if(!state||captures.has(event))return;let contentIndex="contentIndex"in event?hint.contentIndex??event.contentIndex:void 0;if(!(contentIndex!==void 0&&state.failedBlocks.has(contentIndex)))try{captures.set(event,buildCapture(state,event,hint))}catch(error){dropCapture(owner,error,state,contentIndex)}}function buildCapture(state,event,hint){let message=event.type==="done"?event.message:event.type==="error"?event.error:event.partial,usage=usageCopy(state,message.usage);if(!("contentIndex"in event))return Object.freeze({usage,metadata:changedMetadata(state,message),message:freezeCapture({...message,content:message.content.map(publicBlock)})});let index=hint.contentIndex??event.contentIndex,own=index===event.contentIndex?{}:{contentIndex:index};if("delta"in event){let position=state.positions.get(index)??{offset:0,parsedThrough:0},offset=hint.offset??position.offset;return position.offset=offset+event.delta.length,event.type==="toolcall_delta"&&event.delta.length>0&&(position.parsedThrough=hint.parsedThrough??Math.max(position.parsedThrough,position.offset)),state.positions.set(index,position),Object.freeze({usage,offset,...own,...event.type==="toolcall_delta"?{parsedThrough:position.parsedThrough}:{}})}let metadata=changedMetadata(state,message),block=freezeCapture(publicBlock(event.type==="toolcall_end"?event.toolCall:message.content[index]));if(event.type!=="text_start"&&event.type!=="thinking_start"&&event.type!=="toolcall_start")return Object.freeze({usage,metadata,block,...own});let rawArgumentPrefix=hint.rawArgumentPrefix??"",coveredCodeUnits=block.type==="text"?block.text.length:block.type==="thinking"?block.thinking.length:rawArgumentPrefix.length,parsedThrough=hint.parsedThrough??0;return state.positions.set(index,{offset:hint.offset??coveredCodeUnits,parsedThrough}),Object.freeze({usage,metadata,block,coveredCodeUnits,...own,...block.type==="toolCall"?{rawArgumentPrefix,parsedThrough}:{}})}function usageCopy(state,usage){if(state.usage!==void 0&&sameValue(usage,state.usage))return state.usage;let copy=Object.freeze({...usage,cost:Object.freeze({...usage.cost}),...usage.contextUsage?{contextUsage:Object.freeze({...usage.contextUsage})}:{}});return state.usage=copy,copy}function changedMetadata(state,message){let changed={};for(let key of Object.keys(message)){if(key==="content"||key==="usage")continue;let value=Reflect.get(message,key);(!state.metadata.has(key)||state.metadata.get(key)!==value)&&(changed[key]=value)}for(let key of state.metadata.keys())key in message||(changed[key]=null);let frozen=Object.keys(changed).length===0?NO_CHANGE:freezeCapture(changed);for(let key of Object.keys(changed))key in message?state.metadata.set(key,Reflect.get(message,key)):state.metadata.delete(key);return frozen}var FifoQueue=class{constructor(){this.incoming=[],this.outgoing=[]}get length(){return this.incoming.length+this.outgoing.length}enqueue(value){this.incoming.push(value)}prepend(value){this.outgoing.push(value)}dequeue(){if(this.outgoing.length===0)for(;this.incoming.length>0;)this.outgoing.push(this.incoming.pop());return this.outgoing.pop()}},EventStream=class{#queue;#queueHead;#failed;#error;#localWorkDepth;constructor(isComplete,extractResult){this.#queue=[],this.#queueHead=0,this.waiting=new FifoQueue,this.done=!1,this.#failed=!1,this.#localWorkDepth=0,this.isComplete=isComplete,this.extractResult=extractResult,this.finalResultPromise=new Promise((resolve,reject)=>{this.resolveFinalResult=resolve,this.rejectFinalResult=reject}),this.finalResultPromise.catch(()=>{})}get queue(){return this.#queue.slice(this.#queueHead).flatMap(entry=>"event"in entry?[entry.event]:[])}#enqueue(event){this.#queue.push(event)}#dequeue(){let event=this.#queue[this.#queueHead];if(event===void 0)throw new Error("EventStream queue underflow");return this.#queueHead++,this.#queueHead>1024&&this.#queueHead*2>=this.#queue.length&&(this.#queue=this.#queue.slice(this.#queueHead),this.#queueHead=0),event}push(event){this.done||(this.isComplete(event)&&(this.done=!0,this.resolveFinalResult(this.extractResult(event))),this.#deliver({event}))}enqueueProgress(progress){this.done||this.#deliver({progress})}#deliver(entry){let waiter=this.waiting.dequeue();waiter?waiter.resolve({value:entry,done:!1}):this.#enqueue(entry)}end(result){for(this.done=!0,result!==void 0&&this.resolveFinalResult(result);this.waiting.length>0;){let waiter=this.waiting.dequeue();waiter&&waiter.resolve({value:void 0,done:!0})}}fail(error){if(!this.done)for(this.done=!0,this.#failed=!0,this.#error=error,this.rejectFinalResult(error);this.waiting.length>0;){let waiter=this.waiting.dequeue();waiter&&waiter.reject(error)}}[Symbol.asyncIterator](){return this.mapIterator(entry=>"event"in entry?{value:entry.event,done:!1}:void 0)}mapIterator(project){return{next:()=>{for(;this.#queueHead<this.#queue.length;){let result=project(this.#dequeue());if(result)return Promise.resolve(result)}return this.#failed?Promise.reject(this.#error):this.done?Promise.resolve({value:void 0,done:!0}):new Promise((resolve,reject)=>{let waiter={reject,resolve:next=>{let result=next.done?{value:void 0,done:!0}:project(next.value);result?resolve(result):this.waiting.prepend(waiter)}};this.waiting.enqueue(waiter)})}}}result(){return this.finalResultPromise}async trackLocalWork(work){this.#localWorkDepth++;try{return await work}finally{this.#localWorkDepth--}}hasPendingLocalWork(){return this.#localWorkDepth>0}},AssistantMessageEventStream=class _AssistantMessageEventStream extends EventStream{constructor(options={}){super(event=>event.type==="done"||event.type==="error",event=>{if(event.type==="done")return event.message;if(event.type==="error")return event.error;throw new Error("Unexpected event type for final result")}),options.captureBlocks&&enableAssistantCapture(this),setAssistantProgressWriter(this,progress=>this.enqueueProgress(progress)),new.target.prototype[Symbol.asyncIterator]===_AssistantMessageEventStream.prototype[Symbol.asyncIterator]&&setAssistantReader(this,project=>this.mapIterator(project))}push(event,hint){this.done||(captureAssistantEvent(this,event,hint),super.push(event))}[Symbol.asyncIterator](){return this.mapIterator(entry=>{if("event"in entry)return dropAssistantCapture(entry.event),{value:entry.event,done:!1}})}};function costCardAt(cost,atMs){let card=cost,startedAt=Number.NEGATIVE_INFINITY;for(let rate of cost.effectiveRates??[]){let from=Date.parse(rate.effectiveFrom);from<=atMs&&from>startedAt&&(card=rate,startedAt=from)}return card}function contentText(content,separator=`
18
+ When asked a question, answer it from the code and stop there. Edit when a change was requested or when a fix is confirmed.`,COMPOSER_MODEL_ID_PATTERN=/(?:^|[/:._-])composer(?:[/:._-]|\d|$)/i;function isCursorComposerModel(modelId){return COMPOSER_MODEL_ID_PATTERN.test(modelId)}var CURSOR_MULTIMODAL_ID_PATTERN=/^default$|claude|gemini|gpt-|codex|kimi-k3|muse-|cursor-grok-4\.[56]/;function cursorDiscoveredInput(modelId){return CURSOR_MULTIMODAL_ID_PATTERN.test(modelId.toLowerCase())?["text","image"]:["text"]}var captures=new WeakMap,readers=new WeakMap,writers=new WeakMap,states=new WeakMap,demanded=new WeakSet,warned=new WeakSet,NO_CHANGE=Object.freeze({}),subscribers=0,capturedAny=!1;function setAssistantReader(owner,reader){readers.set(owner,reader)}function setAssistantProgressWriter(owner,writer){writers.set(owner,writer)}function enableAssistantCapture(owner){states.has(owner)||states.set(owner,void 0)}function activeState(owner){let state=states.get(owner);if(state!==void 0||!states.has(owner))return state??void 0;let decided=subscribers>0||demanded.has(owner)?{positions:new Map,metadata:new Map,insertCopies:new Map,failedBlocks:new Set}:null;return capturedAny||=decided!==null,states.set(owner,decided),decided??void 0}function dropCapture(owner,error,state,contentIndex){contentIndex!==void 0&&state?.failedBlocks.add(contentIndex),!warned.has(owner)&&(warned.add(owner),console.warn("[assistant-capture] could not build an internal capture record; that block's records are dropped",error))}function freezeCapture(value){let freeze=part=>{if(!(part===null||typeof part!="object"||Object.isFrozen(part))){for(let child of Object.values(part))freeze(child);Object.freeze(part)}},copy=structuredClone(value);return freeze(copy),copy}function publicBlock(block){return Object.fromEntries({text:["type","text","audience","textSignature"],thinking:["type","thinking","thinkingSignature","redacted","startedAt","endedAt"],toolCall:["type","id","name","arguments","incomplete","errorMessage","thoughtSignature","namespace"],providerNative:["type","subtype","raw"]}[block.type].filter(key=>key in block).map(key=>[key,Reflect.get(block,key)]))}function sameValue(left,right){if(left===right)return!0;if(!isPlainData(left)||!isPlainData(right)||Array.isArray(left)!==Array.isArray(right))return!1;let keys=Object.keys(left);return keys.length===Object.keys(right).length&&keys.every(key=>Object.hasOwn(right,key)&&sameValue(Reflect.get(left,key),Reflect.get(right,key)))}function isPlainData(value){if(typeof value!="object"||value===null)return!1;let prototype=Object.getPrototypeOf(value);return prototype===Object.prototype||prototype===Array.prototype||prototype===null}function dropAssistantCapture(event){capturedAny&&captures.delete(event)}function captureAssistantEvent(owner,event,hint={}){let state=activeState(owner);if(!state||captures.has(event)||hint.carried===null||hint.carried?.contentIndex!==void 0)return;let contentIndex="contentIndex"in event?hint.contentIndex??event.contentIndex:void 0;if(!(contentIndex!==void 0&&state.failedBlocks.has(contentIndex)))try{let capture=buildCapture(state,event,hint);capture&&captures.set(event,capture)}catch(error){dropCapture(owner,error,state,contentIndex)}}function buildCapture(state,event,hint){let message=event.type==="done"?event.message:event.type==="error"?event.error:event.partial,usage=usageCopy(state,message.usage);if(!("contentIndex"in event))return Object.freeze({usage,metadata:changedMetadata(state,message),message:freezeCapture({...message,content:message.content.map(publicBlock)}),...hint.rewrittenFrom===void 0?{}:{rewrittenFrom:hint.rewrittenFrom}});let index=hint.contentIndex??event.contentIndex,own=index===event.contentIndex?{}:{contentIndex:index},carried=hint.carried;if("delta"in event){if(carried){let{parsedThrough:parsedThrough2}=carried;return Object.freeze({usage,offset:carried.offset,...parsedThrough2===void 0?{}:{parsedThrough:parsedThrough2}})}let position=state.positions.get(index)??{offset:0,parsedThrough:0},offset=hint.offset??position.offset;return position.offset=offset+event.delta.length,event.type==="toolcall_delta"&&event.delta.length>0&&(position.parsedThrough=hint.parsedThrough??Math.max(position.parsedThrough,position.offset)),state.positions.set(index,position),Object.freeze({usage,offset,...own,...event.type==="toolcall_delta"?{parsedThrough:position.parsedThrough}:{}})}let metadata=changedMetadata(state,message);if(carried){let{usage:_usage,metadata:_metadata,message:_message,offset:_offset,...facts}=carried;return Object.freeze({...facts,usage,metadata})}let starts=event.type==="text_start"||event.type==="thinking_start"||event.type==="toolcall_start",source=event.type==="toolcall_end"?event.toolCall:message.content[index];if(starts&&source===void 0)return;let block=freezeCapture(publicBlock(source));if(!starts)return Object.freeze({usage,metadata,block,...own});let rawArgumentPrefix=hint.rawArgumentPrefix??"",coveredCodeUnits=block.type==="text"?block.text.length:block.type==="thinking"?block.thinking.length:rawArgumentPrefix.length,parsedThrough=hint.parsedThrough??0;return state.positions.set(index,{offset:hint.offset??coveredCodeUnits,parsedThrough}),Object.freeze({usage,metadata,block,coveredCodeUnits,...own,...block.type==="toolCall"?{rawArgumentPrefix,parsedThrough}:{}})}function usageCopy(state,usage){return state.usage!==void 0&&sameValue(usage,state.usage)||(state.usage=frozenUsage(usage)),state.usage}function frozenUsage(usage){return Object.freeze({...usage,cost:Object.freeze({...usage.cost}),...usage.contextUsage?{contextUsage:Object.freeze({...usage.contextUsage})}:{}})}function changedMetadata(state,message){let changed={};for(let key of Object.keys(message)){if(key==="content"||key==="usage")continue;let value=Reflect.get(message,key);(!state.metadata.has(key)||state.metadata.get(key)!==value)&&(changed[key]=value)}for(let key of state.metadata.keys())key in message||(changed[key]=null);let frozen=Object.keys(changed).length===0?NO_CHANGE:freezeCapture(changed);for(let key of Object.keys(changed))key in message?state.metadata.set(key,Reflect.get(message,key)):state.metadata.delete(key);return frozen}var FifoQueue=class{constructor(){this.incoming=[],this.outgoing=[]}get length(){return this.incoming.length+this.outgoing.length}enqueue(value){this.incoming.push(value)}prepend(value){this.outgoing.push(value)}dequeue(){if(this.outgoing.length===0)for(;this.incoming.length>0;)this.outgoing.push(this.incoming.pop());return this.outgoing.pop()}},EventStream=class{#queue;#queueHead;#failed;#error;#localWorkDepth;constructor(isComplete,extractResult){this.#queue=[],this.#queueHead=0,this.waiting=new FifoQueue,this.done=!1,this.#failed=!1,this.#localWorkDepth=0,this.isComplete=isComplete,this.extractResult=extractResult,this.finalResultPromise=new Promise((resolve,reject)=>{this.resolveFinalResult=resolve,this.rejectFinalResult=reject}),this.finalResultPromise.catch(()=>{})}get queue(){return this.#queue.slice(this.#queueHead).flatMap(entry=>"event"in entry?[entry.event]:[])}#enqueue(event){this.#queue.push(event)}#dequeue(){let event=this.#queue[this.#queueHead];if(event===void 0)throw new Error("EventStream queue underflow");return this.#queueHead++,this.#queueHead>1024&&this.#queueHead*2>=this.#queue.length&&(this.#queue=this.#queue.slice(this.#queueHead),this.#queueHead=0),event}push(event){this.done||(this.isComplete(event)&&(this.done=!0,this.resolveFinalResult(this.extractResult(event))),this.#deliver({event}))}enqueueProgress(progress){this.done||this.#deliver({progress})}#deliver(entry){let waiter=this.waiting.dequeue();waiter?waiter.resolve({value:entry,done:!1}):this.#enqueue(entry)}end(result){for(this.done=!0,result!==void 0&&this.resolveFinalResult(result);this.waiting.length>0;){let waiter=this.waiting.dequeue();waiter&&waiter.resolve({value:void 0,done:!0})}}fail(error){if(!this.done)for(this.done=!0,this.#failed=!0,this.#error=error,this.rejectFinalResult(error);this.waiting.length>0;){let waiter=this.waiting.dequeue();waiter&&waiter.reject(error)}}[Symbol.asyncIterator](){return this.mapIterator(entry=>"event"in entry?{value:entry.event,done:!1}:void 0)}mapIterator(project){return{next:()=>{for(;this.#queueHead<this.#queue.length;){let result=project(this.#dequeue());if(result)return Promise.resolve(result)}return this.#failed?Promise.reject(this.#error):this.done?Promise.resolve({value:void 0,done:!0}):new Promise((resolve,reject)=>{let waiter={reject,resolve:next=>{let result=next.done?{value:void 0,done:!0}:project(next.value);result?resolve(result):this.waiting.prepend(waiter)}};this.waiting.enqueue(waiter)})}}}result(){return this.finalResultPromise}async trackLocalWork(work){this.#localWorkDepth++;try{return await work}finally{this.#localWorkDepth--}}hasPendingLocalWork(){return this.#localWorkDepth>0}},AssistantMessageEventStream=class _AssistantMessageEventStream extends EventStream{constructor(options={}){super(event=>event.type==="done"||event.type==="error",event=>{if(event.type==="done")return event.message;if(event.type==="error")return event.error;throw new Error("Unexpected event type for final result")}),options.captureBlocks&&enableAssistantCapture(this),setAssistantProgressWriter(this,progress=>this.enqueueProgress(progress)),new.target.prototype[Symbol.asyncIterator]===_AssistantMessageEventStream.prototype[Symbol.asyncIterator]&&setAssistantReader(this,project=>this.mapIterator(project))}push(event,hint){this.done||(captureAssistantEvent(this,event,hint),super.push(event))}[Symbol.asyncIterator](){return this.mapIterator(entry=>{if("event"in entry)return dropAssistantCapture(entry.event),{value:entry.event,done:!1}})}};function costCardAt(cost,atMs){let card=cost,startedAt=Number.NEGATIVE_INFINITY;for(let rate of cost.effectiveRates??[]){let from=Date.parse(rate.effectiveFrom);from<=atMs&&from>startedAt&&(card=rate,startedAt=from)}return card}function contentText(content,separator=`
19
19
  `){return typeof content=="string"?content:content.filter(block=>block.type==="text").map(block=>block.text).join(separator)}function getSystemMessageText(message){let parts=[contentText(message.content)];for(let text of Object.values(message.sections??{}))text!==null&&parts.push(text);return parts.filter(part=>part.length>0).join(`
20
20
 
21
21
  `)}function isSystemMessage(message){return message.role==="system"}function getCurrentTools(messages){let tools=new Map;for(let message of messages)if(isSystemMessage(message)){for(let tool of message.toolsRemoved??[])tools.delete(tool.name);for(let tool of message.toolsAdded??[])tools.set(tool.name,tool)}return[...tools.values()]}function getCurrentSystemMessage(messages){let content=[],sections=new Map,timestamp;for(let message of messages){if(!isSystemMessage(message))continue;timestamp??=message.timestamp;let text=contentText(message.content);text.length>0&&content.push(text);for(let[name,value]of Object.entries(message.sections??{}))value===null?sections.delete(name):sections.set(name,value)}let tools=getCurrentTools(messages);if(!(timestamp===void 0&&tools.length===0))return{role:"system",content:content.join(`