@agimon-ai/po-cloudflare 0.0.2-alpha.4 → 0.0.2-alpha.40

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 (303) hide show
  1. package/README.md +30 -6
  2. package/container/Dockerfile +27 -0
  3. package/dist/{BrowserWebSocketTransport-C2SC2VeJ.js → BrowserWebSocketTransport-B4heNdrp.js} +1 -1
  4. package/dist/{NodeWebSocketTransport-CKilJesa.js → NodeWebSocketTransport-BCiOXUEz.js} +2 -2
  5. package/dist/{abort-signals-Bkmp_euQ.js → abort-signals-DG56Ik_S.js} +1 -1
  6. package/dist/agent-Diw1DRAs.js +3878 -0
  7. package/dist/{anthropic-messages-CkYm8M3V.js → anthropic-messages-CGsmFpbQ.js} +291 -63
  8. package/dist/apiContracts-CZAjH3Lf.js +1603 -0
  9. package/dist/{approval-Eu7UgGL-.js → approval-Bdh5btYd.js} +19 -3
  10. package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-ljVZ2Dwl.js} +1 -2
  11. package/dist/artifactFiles-CeNmwFsx.js +1 -0
  12. package/dist/assets/assets/{CodeEditorView-rEfljuRK.js → CodeEditorView-C7jwARvV.js} +2 -2
  13. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-J6Iu5p17.js → abnfDiagram-WEYOIA3C-DZCaojm2.js} +2 -2
  14. package/dist/assets/assets/{architecture-WOLXFQ4H-DKj_xMR1.js → architecture-WOLXFQ4H-CpeMDswb.js} +1 -1
  15. package/dist/assets/assets/{architectureDiagram-ZHVYKT53--D1MzuBo.js → architectureDiagram-ZHVYKT53-CT7uSQh2.js} +2 -2
  16. package/dist/assets/assets/{blockDiagram-RJAE7QA3-CrWO0t-Q.js → blockDiagram-RJAE7QA3-DHhTTgZk.js} +2 -2
  17. package/dist/assets/assets/{c4Diagram-XDPPPE54-CBMOJREz.js → c4Diagram-XDPPPE54-P3qPEZXi.js} +2 -2
  18. package/dist/assets/assets/channel-BcJQkhAa.js +2 -0
  19. package/dist/assets/assets/{chunk-2E7WHVMD-CR9NMk46.js → chunk-2E7WHVMD-QWdNG_tA.js} +2 -2
  20. package/dist/assets/assets/{chunk-4EMNKR2T-B4D0falO.js → chunk-4EMNKR2T-LPlaG7LZ.js} +2 -2
  21. package/dist/assets/assets/{chunk-55XCU76K-CKrttFen.js → chunk-55XCU76K-Bn840YI3.js} +2 -2
  22. package/dist/assets/assets/{chunk-7S6XSTFO-BPNrdjSb.js → chunk-7S6XSTFO-CtBuE1i5.js} +2 -2
  23. package/dist/assets/assets/{chunk-AQDTSKZB-Ddx2gPU_.js → chunk-AQDTSKZB-BdQomXNj.js} +2 -2
  24. package/dist/assets/assets/{chunk-DSNLSHJZ-iQg3RbZ_.js → chunk-DSNLSHJZ-BSi6gGV1.js} +2 -2
  25. package/dist/assets/assets/{chunk-HAGFOTED-CGlDRwnk.js → chunk-HAGFOTED-Cv6f0h0m.js} +2 -2
  26. package/dist/assets/assets/{chunk-HNE4Q36P-CN7VMEsn.js → chunk-HNE4Q36P-gZ9u77qK.js} +2 -2
  27. package/dist/assets/assets/{chunk-NQOKRVIF-DQKmIS4j.js → chunk-NQOKRVIF-DoIrq9uw.js} +2 -2
  28. package/dist/assets/assets/{chunk-UHW7PFBP-BKSG_d1a.js → chunk-UHW7PFBP-C5dX3q3m.js} +2 -2
  29. package/dist/assets/assets/{chunk-VQ5W62QI-AbFHiDOg.js → chunk-VQ5W62QI-DOcVVlNw.js} +2 -2
  30. package/dist/assets/assets/{chunk-WQQL4CDK-C5a4DmCb.js → chunk-WQQL4CDK-M98Yuz0M.js} +2 -2
  31. package/dist/assets/assets/chunk-XXDRQBXY-_IuaK7Jw.js +2 -0
  32. package/dist/assets/assets/{chunk-YZO67HFG-UbKezTdY.js → chunk-YZO67HFG-BYDYYDkp.js} +2 -2
  33. package/dist/assets/assets/{chunk-ZAUX2LTX-BShGGpRc.js → chunk-ZAUX2LTX-BGbi5Jao.js} +2 -2
  34. package/dist/assets/assets/{chunk-ZCHMQSOR-BmV-PDP0.js → chunk-ZCHMQSOR-CphalOeH.js} +2 -2
  35. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DB-cfBNq.js → classDiagram-v2-4MYWR3UA-BUM78MiN.js} +2 -2
  36. package/dist/assets/assets/{cose-bilkent-JH36ORCC-Dprqh48h.js → cose-bilkent-JH36ORCC-Ra6K1C6l.js} +2 -2
  37. package/dist/assets/assets/{cynefin-EF2NZ3EQ-Bz4CND4n.js → cynefin-EF2NZ3EQ-CCown1ww.js} +1 -1
  38. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Cv0Tq-0q.js → cynefinDiagram-WF24UDRP-BhVJbVl0.js} +2 -2
  39. package/dist/assets/assets/{dagre-NK4GIZVX-H4d8oeNm.js → dagre-NK4GIZVX-CWE0mu-R.js} +2 -2
  40. package/dist/assets/assets/{diagram-CBK3MWTC-D75OthTM.js → diagram-CBK3MWTC-COjtdhv2.js} +2 -2
  41. package/dist/assets/assets/{diagram-I5XIIV2D-CB_W2jXU.js → diagram-I5XIIV2D-CDDFwlOU.js} +2 -2
  42. package/dist/assets/assets/{diagram-ODIL2UCW-DPO0lYZ-.js → diagram-ODIL2UCW-S8kxtWUk.js} +2 -2
  43. package/dist/assets/assets/{diagram-PFBEJUXE-DJ9olXAC.js → diagram-PFBEJUXE-ClDwBC-c.js} +2 -2
  44. package/dist/assets/assets/{diagram-RJA3I4VV-DL3974PI.js → diagram-RJA3I4VV-Cn5ddZLf.js} +2 -2
  45. package/dist/assets/assets/{diagram-TYUNFSNR-ZuYESp4p.js → diagram-TYUNFSNR-By8mqP1x.js} +2 -2
  46. package/dist/assets/assets/{dist-zXhaMKmO.js → dist-8CcoxUwb.js} +2 -2
  47. package/dist/assets/assets/{dist-BnkGKHOV.js → dist-B8S7BRj9.js} +2 -2
  48. package/dist/assets/assets/{dist-DvCNYjgK.js → dist-BauGpkj8.js} +2 -2
  49. package/dist/assets/assets/{dist-C8iSs-hT.js → dist-Bl2WYwTY.js} +2 -2
  50. package/dist/assets/assets/{dist-G3vL_xw7.js → dist-C0ydZLqs.js} +2 -2
  51. package/dist/assets/assets/{dist-CXqaT1wB.js → dist-CAOT2o1i.js} +2 -2
  52. package/dist/assets/assets/{dist-CeotBqYt.js → dist-CLACKKzo.js} +2 -2
  53. package/dist/assets/assets/{dist-CdrEbsAL.js → dist-DOqtbjOa.js} +2 -2
  54. package/dist/assets/assets/{dist-D2iSi_lg.js → dist-U6LZorBN.js} +2 -2
  55. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-DNfHKEsm.js → ebnfDiagram-V4P3TTPT-Dtw_lMOJ.js} +2 -2
  56. package/dist/assets/assets/{elk-QONTBCTQ-C0FX9D60.js → elk-QONTBCTQ-D8JCaHij.js} +2 -2
  57. package/dist/assets/assets/{erDiagram-KYQIGQAA-BI1O9lW0.js → erDiagram-KYQIGQAA-BcacA87M.js} +2 -2
  58. package/dist/assets/assets/{eventmodeling-K75KTNOO-BmWt-aOv.js → eventmodeling-K75KTNOO-Cr6b3zHr.js} +1 -1
  59. package/dist/assets/assets/flowDiagram-IUGLLWBU-ROf0Adb4.js +1 -0
  60. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-pM7PmQ6B.js → ganttDiagram-R7GPNTJY-Cwf2u7GQ.js} +2 -2
  61. package/dist/assets/assets/{gitGraph-VSP46ZUC-D0QXMQxv.js → gitGraph-VSP46ZUC-UFfH9fKX.js} +1 -1
  62. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BsMltgt3.js → gitGraphDiagram-PDYL7XHY-WM6mRR6T.js} +2 -2
  63. package/dist/assets/assets/index-B1NXqiu0.css +1 -0
  64. package/dist/assets/assets/index-CjJ73MU8.js +200 -0
  65. package/dist/assets/assets/{info-OHQRW6UA-Dp5Eu5PX.js → info-OHQRW6UA-DSo3ojXQ.js} +1 -1
  66. package/dist/assets/assets/{infoDiagram-MVDRKAX5-TgXRfZiq.js → infoDiagram-MVDRKAX5-DVh_Awn-.js} +2 -2
  67. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-Qzrmih4p.js → ishikawaDiagram-HPEHV2GE-VoEaUMv2.js} +2 -2
  68. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BksI3QOT.js → journeyDiagram-BOSHW7O7-DXMdxFGM.js} +2 -2
  69. package/dist/assets/assets/{kanban-definition-FNSA4HC5-l_IuN5_k.js → kanban-definition-FNSA4HC5-OH0_1YtO.js} +2 -2
  70. package/dist/assets/assets/{line-BDKssGoM.js → line-CH-RDGcc.js} +2 -2
  71. package/dist/assets/assets/{linear-C9vmtzBC.js → linear-B8KyXVf4.js} +2 -2
  72. package/dist/assets/assets/{mermaid-parser.core-O1yFX7K_.js → mermaid-parser.core-B9W7aXhL.js} +4 -4
  73. package/dist/assets/assets/{mermaid.core-CIq57361.js → mermaid.core-CfMNlHlm.js} +5 -5
  74. package/dist/assets/assets/{mindmap-definition-6OY57UG3-BkVuZ010.js → mindmap-definition-6OY57UG3-DeBSA2QS.js} +2 -2
  75. package/dist/assets/assets/{packet-JDAUHWVQ-PPNcSWeV.js → packet-JDAUHWVQ-emIJTJoC.js} +1 -1
  76. package/dist/assets/assets/{pegDiagram-ECIUJNBX-ClwrHXhM.js → pegDiagram-ECIUJNBX-fFmd8Afp.js} +2 -2
  77. package/dist/assets/assets/{pie-XZMESJXO-BAE4Cy9j.js → pie-XZMESJXO-D_SBay3F.js} +1 -1
  78. package/dist/assets/assets/{pieDiagram-GNMPY74T-CvQ62Knb.js → pieDiagram-GNMPY74T-DpaflKb_.js} +2 -2
  79. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CzAyT5ZB.js → quadrantDiagram-D57K4MC3-Dw0veTAE.js} +2 -2
  80. package/dist/assets/assets/{radar-ABXABTNO-CoEe8B7b.js → radar-ABXABTNO-CiHU3APQ.js} +1 -1
  81. package/dist/assets/assets/{railroad-I3PHUGI6-BbK5J8H5.js → railroad-I3PHUGI6-DX1RkKLP.js} +1 -1
  82. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-DlGngfop.js → railroad-abnf-LNEFI6M7-CO40XRBR.js} +1 -1
  83. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-BRk4ifMx.js → railroad-ebnf-DWYD2UWJ-C3SlqlEH.js} +1 -1
  84. package/dist/assets/assets/{railroad-peg-JR7BVNR7-Rz-3vbj2.js → railroad-peg-JR7BVNR7-CIuabuRU.js} +1 -1
  85. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-DQISBRHH.js → railroadDiagram-Y72NRBL7-2ez-hQdC.js} +2 -2
  86. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-DcK4FnTB.js → requirementDiagram-EQYSW5RA-BM374opa.js} +2 -2
  87. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-N2EXBOYb.js → sankeyDiagram-SY24JHO5-CcgDyvAC.js} +2 -2
  88. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-CMJ2EqC_.js → sequenceDiagram-BLEHNHQU-D_xJt-gh.js} +2 -2
  89. package/dist/assets/assets/{src-Df9VBjd7.js → src-Bl9Y8thN.js} +2 -2
  90. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-D6Cxm8wj.js → stateDiagram-v2-A6IESKWZ-mMOwDAQp.js} +2 -2
  91. package/dist/assets/assets/{swimlanes-B3ENRKFQ-BybuzSPd.js → swimlanes-B3ENRKFQ-Dy4MjTcq.js} +2 -2
  92. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BXAhP2HV.js +9 -0
  93. package/dist/assets/assets/{timeline-definition-JXYKGLGB-BzjkWUdz.js → timeline-definition-JXYKGLGB-Q1rMEScH.js} +2 -2
  94. package/dist/assets/assets/{treeView-D4JQ5SDB-DIDWwDtU.js → treeView-D4JQ5SDB-XMi7Mmyw.js} +1 -1
  95. package/dist/assets/assets/{treemap-SAJKECNS-SWP4JszI.js → treemap-SAJKECNS-DsBG9n12.js} +1 -1
  96. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-ZfCxSJdE.js → usecaseDiagram-WPOLBNNX-CocqIWDW.js} +2 -2
  97. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-o44wkgGH.js → vennDiagram-Q3Y3IDCW-D8FsTVui.js} +2 -2
  98. package/dist/assets/assets/{wardley-7MLQ67FV-0zKRsI4Z.js → wardley-7MLQ67FV-CBH_yOMy.js} +1 -1
  99. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CyBVyB40.js → wardleyDiagram-IVAIDKWA-lLJUFxc6.js} +2 -2
  100. package/dist/assets/assets/{webpack-C4nkEwJD.js → webpack-DM7RFzQs.js} +2 -2
  101. package/dist/assets/assets/{xychartDiagram-4URNHDU4-BMvRihYC.js → xychartDiagram-4URNHDU4-DqYWkm7R.js} +2 -2
  102. package/dist/assets/bundle-asset-policy.json +1 -1
  103. package/dist/assets/index.html +8 -2
  104. package/dist/assets/plugins/assets/base-9H6oPHE6.css +2 -0
  105. package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
  106. package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
  107. package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
  108. package/dist/assets/plugins/chunks/po-web-runtime-BhSF51GF.js +1 -0
  109. package/dist/assets/plugins/compositions.json +1 -1
  110. package/dist/assets/plugins/slots/approval.293d9a00-BSeXICbI.js +2 -0
  111. package/dist/assets/plugins/slots/artifacts.24567664-WRTyk2zV.js +1 -0
  112. package/dist/assets/plugins/slots/author.0998a880-CJMUvdJt.js +93 -0
  113. package/dist/assets/plugins/slots/autocompact.dd97d013-C7J2jikY.js +1 -0
  114. package/dist/assets/plugins/slots/browse.4b5f8a0b-_ldrjFqx.js +1 -0
  115. package/dist/assets/plugins/slots/builtin-tools.36d7400b-C4IfAXaZ.js +7 -0
  116. package/dist/assets/plugins/slots/codemode.8eaee717-BCjLw-_j.js +11 -0
  117. package/dist/assets/plugins/slots/domain.5e95fc37-C8zAem_d.js +1 -0
  118. package/dist/assets/plugins/slots/edit.385c9aa9-BOQcLzMh.js +7 -0
  119. package/dist/assets/plugins/slots/files.daf34ed8-ms1al6z7.js +2 -0
  120. package/dist/assets/plugins/slots/goal.77ec9930-CR483tNO.js +1 -0
  121. package/dist/assets/plugins/slots/grep.02052cdc-DikEvfp2.js +1 -0
  122. package/dist/assets/plugins/slots/help.ecd4c0f9-DL7ktrs-.js +3 -0
  123. package/dist/assets/plugins/slots/log.a86eb6d0-Bx77pvm1.js +4 -0
  124. package/dist/assets/plugins/slots/mcp.974af249-CRMSCtWu.js +109 -0
  125. package/dist/assets/plugins/slots/plan.bafb8f68-DJswVj5X.js +3 -0
  126. package/dist/assets/plugins/slots/{profile.ab16dcec-Cu6ev2uW.js → profile.48851a1d-y3TFtlmt.js} +1 -1
  127. package/dist/assets/plugins/slots/prompts.723d7748-CCX8HZaI.js +3 -0
  128. package/dist/assets/plugins/slots/read.46bf6536-DIOZjpp-.js +1 -0
  129. package/dist/assets/plugins/slots/runner.53e9bd76-CYGo3EwH.js +8 -0
  130. package/dist/assets/plugins/slots/sessions.09d5cdbb-DixP5tLq.js +1 -0
  131. package/dist/assets/plugins/slots/skill.086701a4-xzISgcpu.js +4 -0
  132. package/dist/assets/plugins/slots/subagents.8f6fa9e8-DutE7lUn.js +7 -0
  133. package/dist/assets/plugins/slots/vault.ac9935c8-DhboY0MP.js +1 -0
  134. package/dist/assets/plugins/slots/voice.e85ca7f9-NanECpYb.js +1 -0
  135. package/dist/assets/pwa/pwa.js +12 -12
  136. package/dist/assets/pwa/sw.js +4 -4
  137. package/dist/{atomicJson-DwSqByUJ.js → atomicJson-BmnOOx5K.js} +2 -3
  138. package/dist/{azure-openai-config-DHMgdIa-.js → azure-openai-config-DrJddYQ4.js} +2 -2
  139. package/dist/{azure-openai-responses-CTgRdQ4m.js → azure-openai-responses-CcUYAmFp.js} +13 -13
  140. package/dist/backgroundWork-C9HGqqrP.js +43 -0
  141. package/dist/browser-BWf8OMfl.js +3 -0
  142. package/dist/{browser-EJ5_ffnN.js → browser-IsHIcvFg.js} +1 -1
  143. package/dist/childSession-Cf2-kH4O.js +22 -0
  144. package/dist/{classifier-shared-jXm-plIK.js → classifier-shared-DB0OwvlW.js} +5 -5
  145. package/dist/{cloudflare-workers-ai-system-one-B0wH6HU5.js → cloudflare-workers-ai-system-one-D5kettrv.js} +3 -3
  146. package/dist/{codemode-yHAHBZO-.js → codemode-Bma5zRJq.js} +5 -2
  147. package/dist/contracts-CgASg27j.js +19 -0
  148. package/dist/contracts-DwyAzAKP.js +40 -0
  149. package/dist/{diagnostics-DPTP-yrt.js → diagnostics-DT_N5BqI.js} +2 -2
  150. package/dist/{server-y9pjeHJM.js → dist-B-vqs6tA.js} +1 -546
  151. package/dist/{dist-Dvx5mlIR.js → dist-CLdzaXdw.js} +16 -3
  152. package/dist/{dist-BVBi6VMV.js → dist-CfOWb6f7.js} +1 -1
  153. package/dist/{dist-PDDFdqDX.js → dist-Dd6zUvjw.js} +1 -1
  154. package/dist/edge-CNqHUeot.js +266 -0
  155. package/dist/{emscripten-module.cloudflare-D4Bc9Ykz.js → emscripten-module.cloudflare-B4fhfquU.js} +1 -1
  156. package/dist/{env-api-keys-CAnjjnsR.js → env-api-keys-BV3haPEf.js} +1 -1
  157. package/dist/{error-body-DQZRsyL5.js → error-body-DvA_oGc5.js} +26 -4
  158. package/dist/esm-BKJy3O9-.js +1553 -0
  159. package/dist/exports-B3UrEHlm.js +34 -0
  160. package/dist/{remoteMcp-Ci8crSU9.js → exports-CChp18zM.js} +1043 -175
  161. package/dist/{exports-CrJqsTU6.js → exports-OvK-Hjld.js} +26 -9
  162. package/dist/extensionFile-BZLViWa6.js +121 -0
  163. package/dist/{factory-Cs8iaUtc.js → factory-DwoANAyi.js} +1 -1
  164. package/dist/{github-copilot-headers-DpQQAh-s.js → github-copilot-headers-CPfEKjCr.js} +1 -1
  165. package/dist/{google-generative-ai-BTTOo5RQ.js → google-generative-ai-TmoHbRui.js} +9 -9
  166. package/dist/{google-shared-S7bqOccz.js → google-shared-BgJ0m819.js} +6 -6
  167. package/dist/{google-vertex-BcMU_DMb.js → google-vertex-DSG2Vagw.js} +10 -10
  168. package/dist/{domains-dHfk2U8X.js → harnessState-BODakd6-.js} +175 -16
  169. package/dist/{harnessStore-CRtlTdbI.js → harnessStore-Cdy-Rjob.js} +4 -5
  170. package/dist/{hash-B3RRpLS2.js → hash-Zpy-D8On.js} +1 -1
  171. package/dist/{headers-BEuxFxDI.js → headers-FrAgcbwZ.js} +1 -1
  172. package/dist/help-By-wQ4Ps.js +100 -0
  173. package/dist/help-DZAd-c-j.js +1 -0
  174. package/dist/http-C1FlrsoG.js +59 -0
  175. package/dist/{hubChannel-Cj1iF847.js → hubChannel-aovfaZVV.js} +11 -28
  176. package/dist/hubRevisions-58pU2dW5.js +363 -0
  177. package/dist/{identity-BIeAyilV.js → identity-XFc4sLVo.js} +3 -3
  178. package/dist/index.edge-7gfi10OG.js +69 -0
  179. package/dist/index.edge-ClLTmPFz.js +191 -0
  180. package/dist/index.edge-D2RirEwK.js +14 -0
  181. package/dist/index.edge-DJhSGEtk.js +937 -0
  182. package/dist/index.edge-DWTPhdjL.js +67 -0
  183. package/dist/index.edge-DjzCehyy.js +56 -0
  184. package/dist/iso-BCXA5x1w.js +10 -0
  185. package/dist/{kysely-adapter-D51abb3q.js → kysely-adapter-D3TQ9BKb.js} +1 -1
  186. package/dist/{layeredConfig-BqIwPJ-I.js → layeredConfig-DAvvXsAe.js} +193 -15
  187. package/dist/{majorModes-C-OD4PBc.js → majorModes-B0LoDwwN.js} +4 -14
  188. package/dist/majorModes-zOwSWESO.js +1 -0
  189. package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-C9SEZhVM.js} +1 -2
  190. package/dist/migrations-B0potTsS.js +32 -0
  191. package/dist/{mistral-conversations-DN8VSERk.js → mistral-conversations-B8pchf0Y.js} +12 -12
  192. package/dist/modeDefinition-C3Zbrw48.js +44 -0
  193. package/dist/{models-D6d73jcW.js → models-DGReC_qy.js} +41 -46
  194. package/dist/narration-Cbza24r1.js +127 -0
  195. package/dist/{node-UuMT2C3q.js → node-Bf_6MHqe.js} +2 -2
  196. package/dist/{node-DytJOfYf.js → node-CjBe953N.js} +2 -2
  197. package/dist/notification-DmY_niiI.js +101 -0
  198. package/dist/{openai-bt3ZRBZv.js → openai-D6Q-l6hT.js} +187 -187
  199. package/dist/{openai-codex-responses-cL36x0ml.js → openai-codex-responses-BT4rzzPX.js} +21 -25
  200. package/dist/{openai-completions-BWsTNYyT.js → openai-completions-CL59ZjJR.js} +26 -19
  201. package/dist/{openai-decisions-Dfn_KgQd.js → openai-decisions-DH6ExlAC.js} +3 -3
  202. package/dist/{openai-responses-aa0LoyCJ.js → openai-responses-Yn7OV25O.js} +17 -15
  203. package/dist/{openai-responses-shared-H-jH5SlM.js → openai-responses-shared-Cvsbni4_.js} +7 -7
  204. package/dist/{openrouter-cost-D99Qqcs6.js → openrouter-cost-TRj0BKPF.js} +1 -1
  205. package/dist/{openrouter-images-BpwVpALC.js → openrouter-images-CQEhYdHi.js} +7 -7
  206. package/dist/photon_rs_bg.wasm +0 -0
  207. package/dist/{pi-messages-BHAIkYBj.js → pi-messages-COe6DyoX.js} +6 -6
  208. package/dist/piConfig-B71Ozs3F.js +126 -0
  209. package/dist/piSettings-D6-BjWgk.js +1 -0
  210. package/dist/platform-DCHlut8Z.js +113 -0
  211. package/dist/pluginContributions-Be9EnCAW.js +16 -0
  212. package/dist/pluginProtocol-BEU4pbQ5.js +79 -0
  213. package/dist/{protocol-Xpm_mCNN.js → protocol-DSiW726C.js} +1 -2
  214. package/dist/{provider-env-DgfpjgTa.js → provider-env-3chZbmsY.js} +2 -2
  215. package/dist/{provider-retry-ChD-K2Gv.js → provider-retry-BBTrjo8Y.js} +1 -1
  216. package/dist/{puppeteer-cloudflare-B-GHrPGO.js → puppeteer-cloudflare-D4l8smMS.js} +3 -3
  217. package/dist/{rolldown-runtime-B-lAHAz2.js → rolldown-runtime-DbVrKiKs.js} +1 -1
  218. package/dist/{sanitize-unicode-Dl4ROF7y.js → sanitize-unicode-B91An5dg.js} +1 -1
  219. package/dist/{schemas-Vj8-rCR4.js → schemas-BMBR99Q5.js} +3 -2
  220. package/dist/{server-BPvd3Ya5.js → server-0wi67NBx.js} +551 -108
  221. package/dist/server-15LZQW5S.js +833 -0
  222. package/dist/server-4uIdFCRW.js +679 -0
  223. package/dist/server-B7lNIXXE.js +1881 -0
  224. package/dist/server-BR9BM7Xl.js +1811 -0
  225. package/dist/{server-B2xd7WTP.js → server-BZ7zeqb4.js} +8 -19
  226. package/dist/server-BazaldEb.js +978 -0
  227. package/dist/{server-De_PIOty.js → server-BfR4SWHx.js} +47 -27
  228. package/dist/server-BhRMcRdr.js +640 -0
  229. package/dist/server-BxeHrYnZ.js +576 -0
  230. package/dist/server-C0fjBCUo.js +1116 -0
  231. package/dist/server-C9JB3BGm.js +1186 -0
  232. package/dist/{server-CUvohcAm.js → server-CB-OwjZF.js} +19 -12
  233. package/dist/{server-C1ijZQp4.js → server-CDtMTiNv.js} +3 -10
  234. package/dist/server-CfXKEAOg.js +148 -0
  235. package/dist/server-CqO_M-ZL.js +505 -0
  236. package/dist/server-DI8gvsVV.js +1522 -0
  237. package/dist/server-DRauMOAK.js +2656 -0
  238. package/dist/server-DhRUODwF.js +295 -0
  239. package/dist/server-DlIJXbB3.js +3125 -0
  240. package/dist/server-DuNhRsrh.js +189 -0
  241. package/dist/server-Go9P3HD0.js +1294 -0
  242. package/dist/server-KMxBrF36.js +1518 -0
  243. package/dist/server-LMiEdreg.js +288 -0
  244. package/dist/server-Ro3v4iqI.js +491 -0
  245. package/dist/{server-CYQHzqaQ.js → server-U1_Cjduu.js} +11 -9
  246. package/dist/server-YHARHspq.js +343 -0
  247. package/dist/server-YoLYsoMO.js +15105 -0
  248. package/dist/{server-DwWTQg1J.js → server-hqBrd25t.js} +14 -5
  249. package/dist/{server-BccTx_r6.js → server-jgnxE2jr.js} +121 -19
  250. package/dist/serverPlugin-B0fPICPI.js +36542 -0
  251. package/dist/session-resources-Ckd8uUQs.js +10 -0
  252. package/dist/{sessionConfig-2a4LWInR.js → sessionConfig-DhIMgjWW.js} +550 -760
  253. package/dist/{simple-options-DWrW31_K.js → simple-options-DvQPdbMC.js} +13 -6
  254. package/dist/{streaming-json-t4rzNHEp.js → streaming-json-CF5oj8DO.js} +6 -6
  255. package/dist/{system-one-shared-DLVLdzYL.js → system-one-shared-Bg2woRPx.js} +3 -3
  256. package/dist/{notification-D76PSL7r.js → telemetry-CrTcxeA5.js} +2 -93
  257. package/dist/{transform-messages-CjTSwW9q.js → transform-messages-COCl_pQj.js} +3 -16
  258. package/dist/truncate-M3KbFyVj.js +89 -0
  259. package/dist/{server-DrZBZ17y.js → type-D8bki-Kf.js} +572 -1406
  260. package/dist/type-yokaDI_F.js +7 -0
  261. package/dist/{typesafe-system-one-DBVcjcUQ.js → typesafe-system-one-BZlYlQf5.js} +3 -3
  262. package/dist/{uuid-mkNGilLv.js → uuid-l3LNpywg.js} +1 -1
  263. package/dist/{validation-D77NZBrx.js → validation-DpaTzuo3.js} +8 -3
  264. package/dist/vaultSettings-DhZVlmDG.js +292 -0
  265. package/dist/voiceTools-CmJTHnDg.js +246 -0
  266. package/dist/web-BsbXmapR.js +3 -0
  267. package/dist/worker.js +55862 -34871
  268. package/dist/workflow-IYhTyfCf.js +113 -0
  269. package/package.json +44 -25
  270. package/wrangler.jsonc +13 -3
  271. package/dist/apiContracts-CHOiCbS_.js +0 -4451
  272. package/dist/assets/assets/channel-CNegK3Rr.js +0 -2
  273. package/dist/assets/assets/chunk-XXDRQBXY-BbVKQGnw.js +0 -2
  274. package/dist/assets/assets/flowDiagram-IUGLLWBU-DQj3H5a6.js +0 -1
  275. package/dist/assets/assets/index-BTHzc8EN.js +0 -155
  276. package/dist/assets/assets/index-DZM68mTk.css +0 -1
  277. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CXJkO6sc.js +0 -9
  278. package/dist/assets/plugins/assets/base-B5jpmLBl.css +0 -2
  279. package/dist/assets/plugins/chunks/po-web-runtime-D4qQFtJO.js +0 -1
  280. package/dist/assets/plugins/slots/approval.09e72f36-Cck_K9ex.js +0 -2
  281. package/dist/assets/plugins/slots/artifacts.50b639bb-BZM7uEbe.js +0 -1
  282. package/dist/assets/plugins/slots/builtin-tools.75108f21-EWWGTveL.js +0 -7
  283. package/dist/assets/plugins/slots/codemode.c58fb583-CgfTL6kt.js +0 -9
  284. package/dist/assets/plugins/slots/domain.753f9f92-BU0ilfwM.js +0 -1
  285. package/dist/assets/plugins/slots/mcp.82cc1ff5-BaCD2xZB.js +0 -109
  286. package/dist/assets/plugins/slots/skill.62a0a1b3-Bz20F1eA.js +0 -4
  287. package/dist/backgroundWork-bE3pc-R9.js +0 -25
  288. package/dist/build-2gFaVEfG.js +0 -3355
  289. package/dist/contextProjection-DVP2Vc5j.js +0 -188
  290. package/dist/extensionFile-CY4EFNHQ.js +0 -409
  291. package/dist/harnessState-gmzJcPGt.js +0 -88
  292. package/dist/harnessStore-DZ4lDIq6.js +0 -1
  293. package/dist/index.edge-BgSx_gRO.js +0 -45
  294. package/dist/majorModes-AYZvnOpU.js +0 -1
  295. package/dist/piSettings-B6fsgIBA.js +0 -1
  296. package/dist/platform-CNhm9zLi.js +0 -16
  297. package/dist/platformFiles-3rzOh9cg.js +0 -39
  298. package/dist/server-Bf3_VTkt.js +0 -592
  299. package/dist/server-BmAziQml.js +0 -657
  300. package/dist/server-BvV-GqDO.js +0 -280
  301. package/dist/server-xiuzwJ1C.js +0 -118
  302. package/dist/serverPlugin-H4T49sac.js +0 -3347
  303. package/dist/value-Djvc2foV.js +0 -2247
@@ -1,188 +0,0 @@
1
- import { C as Null, G as _Object_, _ as Union, q as Optional, y as String } from "./build-2gFaVEfG.js";
2
- //#region ../../core/po-core/src/schemas/profileIdentity.ts
3
- /**
4
- * The custom session entry the runtime journals when the active profile's
5
- * persona identity changes.
6
- *
7
- * A profile has always been prompt text only, so a cockpit had nothing to show
8
- * for it beyond the profile name already published as footer status. This entry
9
- * carries the persona's display name and avatar so the transcript can attribute
10
- * each assistant message to the persona that produced it.
11
- *
12
- * It rides Pi's `entry_appended` frames on the road the agent-model projection
13
- * already uses, so any RPC client sees the change live and on replay without a
14
- * new protocol.
15
- *
16
- * Unlike the minor-mode, context, and agent-model projections, this entry is
17
- * NOT a projection: it is transcript, positioned in journal order. A cockpit
18
- * folding it must keep every occurrence rather than collapsing to the latest
19
- * one, because a message written before a switch keeps the identity it was
20
- * written under. Collapsing would rewrite history.
21
- */
22
- const PO_PROFILE_IDENTITY_ENTRY_TYPE = "po-profile-identity";
23
- /**
24
- * Ceiling on the encoded icon, counted on the finished `data:` URL rather than
25
- * the file, so one number bounds both the journal entry and the transport.
26
- *
27
- * An avatar renders at 32 CSS pixels. This much room is already generous, and
28
- * the cap exists because the entry is replayed with the transcript: an oversize
29
- * icon is dropped and the persona keeps its name, never failing a profile load.
30
- */
31
- const PROFILE_ICON_MAX_DATA_URL_LENGTH = 262144;
32
- const MAX_PROFILE_NAME_LENGTH = 128;
33
- /**
34
- * Image types allowed for a persona icon.
35
- *
36
- * Deliberately narrower than the cockpit's general media catalog: `image/svg+xml`
37
- * is excluded because an SVG rendered same-origin executes script, and the icon
38
- * path comes from user-authored persona front-matter. Do not reconcile this list
39
- * with the broader media type map.
40
- */
41
- const PROFILE_ICON_MIME_TYPES = [
42
- "image/png",
43
- "image/jpeg",
44
- "image/gif",
45
- "image/webp"
46
- ];
47
- _Object_({
48
- profile: Union([String({
49
- minLength: 1,
50
- maxLength: MAX_PROFILE_NAME_LENGTH
51
- }), Null()]),
52
- name: Optional(String({
53
- minLength: 1,
54
- maxLength: MAX_PROFILE_NAME_LENGTH
55
- })),
56
- icon: Optional(String({
57
- minLength: 1,
58
- maxLength: PROFILE_ICON_MAX_DATA_URL_LENGTH
59
- }))
60
- }, { additionalProperties: false });
61
- //#endregion
62
- //#region ../../core/po-core/src/services/toolCost/index.ts
63
- /** Mirrors the wire shape MCP advertises, so both estimates stay comparable. */
64
- function schemaPayload(entry) {
65
- return JSON.stringify({
66
- name: entry.name,
67
- ...entry.description === void 0 ? {} : { description: entry.description },
68
- ...entry.parameters === void 0 ? {} : { parameters: entry.parameters }
69
- });
70
- }
71
- function promptPayload(entry) {
72
- return [entry.promptSnippet ?? "", ...entry.promptGuidelines ?? []].filter(Boolean).join("\n");
73
- }
74
- function tokensForTool(entry, countTokens) {
75
- const schemaTokens = countTokens(schemaPayload(entry));
76
- const prompt = promptPayload(entry);
77
- const promptTokens = prompt.length === 0 ? 0 : countTokens(prompt);
78
- return {
79
- schemaTokens,
80
- promptTokens,
81
- totalTokens: schemaTokens + promptTokens
82
- };
83
- }
84
- /** Journal entry the cockpit reads; mirrored by CONTEXT_ENTRY_TYPE in po-web. */
85
- const PO_CONTEXT_ENTRY_TYPE = "po-context";
86
- /** Session selection and transition journal identities, not transport channels. */
87
- const PO_CONFIG_ENTRY_TYPE = "po:config:v1";
88
- const PO_CONFIG_TRANSITION_ENTRY_TYPE = "po:transition:v1";
89
- /** The tokenizer these counts came from, so a reader can judge them. */
90
- const CONTEXT_PROJECTION_ESTIMATOR = "gpt-tokenizer";
91
- /** Everything the runtime could not attribute lands here rather than vanishing. */
92
- const CORE_GROUP = "core";
93
- /** Pi's own tools have no package; the runtime itself is the owner. */
94
- const CORE_OWNER = "pi";
95
- const KIND_ORDER = {
96
- major: 0,
97
- minor: 1,
98
- domain: 2,
99
- shared: 3,
100
- core: 4
101
- };
102
- const SOURCE_ORDER = {
103
- extension: 0,
104
- mcp: 1,
105
- plugin: 2,
106
- core: 3
107
- };
108
- function skillSource(group) {
109
- if (group === "plugins") return "plugin";
110
- if (group === "extensions") return "extension";
111
- return "core";
112
- }
113
- function byRow(left, right) {
114
- return SOURCE_ORDER[left.source] - SOURCE_ORDER[right.source] || left.name.localeCompare(right.name);
115
- }
116
- function projectContext(input) {
117
- const buckets = /* @__PURE__ */ new Map();
118
- const declare = (id, label, kind) => {
119
- if (!buckets.has(id)) buckets.set(id, {
120
- kind,
121
- label,
122
- items: []
123
- });
124
- };
125
- if (input.majorMode) declare(input.majorMode, input.majorMode, "major");
126
- for (const group of input.groups) declare(group.id, group.label, group.kind);
127
- for (const domain of input.domains) declare(domain, domain, "domain");
128
- const place = (owner, item, conditional) => {
129
- const attributed = conditional ?? input.attribution[owner];
130
- const id = attributed?.mode ?? CORE_GROUP;
131
- const kind = attributed?.kind ?? "core";
132
- declare(id, attributed && "label" in attributed ? attributed.label ?? id : id, kind);
133
- buckets.get(id)?.items.push(item);
134
- };
135
- for (const source of input.sources) {
136
- const owner = source.kind === "extension" ? source.packageName ?? source.key : source.kind === "mcp" ? source.key.slice(4) : CORE_OWNER;
137
- for (const tool of source.tools) {
138
- const cost = tokensForTool(tool, input.countTokens);
139
- const item = {
140
- name: tool.name,
141
- itemKind: "tool",
142
- source: source.kind === "core" ? "core" : source.kind,
143
- owner,
144
- tokens: cost.totalTokens,
145
- active: tool.active
146
- };
147
- if (source.kind === "core") {
148
- declare(CORE_GROUP, CORE_GROUP, "core");
149
- buckets.get(CORE_GROUP)?.items.push(item);
150
- } else place(owner, item, tool.contextAttribution);
151
- }
152
- }
153
- for (const skill of input.skills) place(skill.owner, {
154
- name: skill.name,
155
- itemKind: "skill",
156
- source: skillSource(skill.group),
157
- owner: skill.owner,
158
- tokens: skill.promptTokens ?? 0,
159
- active: true
160
- }, skill.contextAttribution);
161
- const groups = [...buckets.entries()].map(([id, bucket]) => {
162
- const items = [...bucket.items].sort(byRow);
163
- return {
164
- id,
165
- label: bucket.label,
166
- kind: bucket.kind,
167
- items,
168
- tokens: items.reduce((total, item) => total + (item.active ? item.tokens : 0), 0),
169
- inactiveTokens: items.reduce((total, item) => total + (item.active ? 0 : item.tokens), 0)
170
- };
171
- }).sort((left, right) => KIND_ORDER[left.kind] - KIND_ORDER[right.kind] || left.label.localeCompare(right.label));
172
- return {
173
- version: 1,
174
- revision: input.revision,
175
- selection: {
176
- majorMode: input.majorMode,
177
- domains: [...input.domains],
178
- ...input.profile === void 0 ? {} : { profile: input.profile }
179
- },
180
- groups,
181
- totalTokens: groups.reduce((total, group) => total + group.tokens, 0),
182
- inactiveTokens: groups.reduce((total, group) => total + group.inactiveTokens, 0),
183
- ...input.systemPrompt === void 0 ? {} : { systemPrompt: input.systemPrompt },
184
- estimator: CONTEXT_PROJECTION_ESTIMATOR
185
- };
186
- }
187
- //#endregion
188
- export { tokensForTool as a, PROFILE_ICON_MIME_TYPES as c, projectContext as i, PO_CONFIG_TRANSITION_ENTRY_TYPE as n, PO_PROFILE_IDENTITY_ENTRY_TYPE as o, PO_CONTEXT_ENTRY_TYPE as r, PROFILE_ICON_MAX_DATA_URL_LENGTH as s, PO_CONFIG_ENTRY_TYPE as t };
@@ -1,409 +0,0 @@
1
- import { Q as readPoHeadlessHost, at as requirePoServerHost, dt as PO_SERVER_SCOPE_LEVELS, ft as PO_SERVER_SCOPE_SERVICE, mt as requirePoServerScope, nt as PO_SERVER_HOST_SERVICE } from "./serverPlugin-H4T49sac.js";
2
- //#region ../../core/po-core/src/services/pluginLifecycle/index.ts
3
- /** Runs ordered cleanup steps to completion before reporting their failures. */
4
- async function runCleanups(steps, message) {
5
- const errors = [];
6
- for (const step of steps) {
7
- if (!step) continue;
8
- try {
9
- await step();
10
- } catch (error) {
11
- errors.push(error);
12
- }
13
- }
14
- if (errors.length) throw new AggregateError(errors, message);
15
- }
16
- /** Owns one mounted plugin, independently of the host supplying its context. */
17
- function createPluginLifecycle(makeContext) {
18
- const controller = new AbortController();
19
- const context = makeContext(controller.signal);
20
- const cleanups = [];
21
- let hooks;
22
- let startup;
23
- let disposal;
24
- let started = false;
25
- let draining = false;
26
- const dispose = () => {
27
- if (disposal) return disposal;
28
- disposal = Promise.resolve().then(async () => {
29
- await startup?.catch(() => void 0);
30
- draining = true;
31
- const onStop = hooks?.onStop;
32
- const onDispose = hooks?.onDispose;
33
- await runCleanups([
34
- started && onStop ? () => onStop(context) : void 0,
35
- ...cleanups.splice(0).reverse(),
36
- onDispose ? () => onDispose(context) : void 0
37
- ], "Plugin cleanup failed.");
38
- });
39
- controller.abort();
40
- return disposal;
41
- };
42
- return {
43
- context,
44
- own(cleanup) {
45
- if (draining) throw new Error("Cannot own a registration after plugin cleanup begins.");
46
- cleanups.push(cleanup);
47
- },
48
- mount(definition, register) {
49
- if (startup || disposal) return Promise.reject(/* @__PURE__ */ new Error("A plugin lifecycle can only mount once."));
50
- startup = Promise.resolve().then(async () => {
51
- controller.signal.throwIfAborted();
52
- const resolved = typeof definition === "function" ? await definition() : definition;
53
- hooks = resolved;
54
- controller.signal.throwIfAborted();
55
- await register(resolved);
56
- controller.signal.throwIfAborted();
57
- started = true;
58
- if (resolved.onStart) await resolved.onStart(context);
59
- controller.signal.throwIfAborted();
60
- });
61
- return startup.catch(async (error) => {
62
- try {
63
- await dispose();
64
- } catch (cleanupError) {
65
- const errors = cleanupError instanceof AggregateError ? cleanupError.errors : [cleanupError];
66
- throw new AggregateError([error, ...errors], error instanceof Error ? error.message : String(error), { cause: error });
67
- }
68
- throw error;
69
- });
70
- },
71
- dispose
72
- };
73
- }
74
- //#endregion
75
- //#region ../../core/po-core/src/extensions/serverPlugin.ts
76
- /**
77
- * Holds a built root's teardown for the levels that reuse it.
78
- *
79
- * The building level keeps the root's hooks in its own lifecycle, but each one runs only when no
80
- * inner level still holds a lease. Otherwise the last lease to be released runs what the building
81
- * level held back. So a reload of the building level installs the new build for itself and for every
82
- * level that mounts from then on, while a session already running keeps the root it mounted with
83
- * until it closes.
84
- */
85
- function holdRoot(built) {
86
- let leases = 0;
87
- let owed = {
88
- stop: false,
89
- dispose: false
90
- };
91
- let stopped = false;
92
- let disposed = false;
93
- const stop = async (context) => {
94
- if (stopped) return;
95
- stopped = true;
96
- await built.onStop?.(context);
97
- };
98
- const dispose = async (context) => {
99
- if (disposed) return;
100
- disposed = true;
101
- await built.onDispose?.(context);
102
- };
103
- return {
104
- held: {
105
- value: built.value,
106
- ...built.activities === void 0 ? {} : { activities: built.activities },
107
- acquire() {
108
- leases += 1;
109
- let released = false;
110
- return async () => {
111
- if (released) return;
112
- released = true;
113
- leases -= 1;
114
- if (leases > 0 || owed.context === void 0) return;
115
- const context = owed.context;
116
- await runCleanups([owed.stop ? () => stop(context) : void 0, owed.dispose ? () => dispose(context) : void 0], "Shared root cleanup failed.");
117
- };
118
- }
119
- },
120
- declaration: {
121
- ...built,
122
- onStop: async (context) => {
123
- owed = {
124
- ...owed,
125
- stop: true,
126
- context
127
- };
128
- if (leases === 0) await stop(context);
129
- },
130
- onDispose: async (context) => {
131
- owed = {
132
- ...owed,
133
- dispose: true,
134
- context
135
- };
136
- if (leases === 0) await dispose(context);
137
- }
138
- }
139
- };
140
- }
141
- const depth = (level) => PO_SERVER_SCOPE_LEVELS.indexOf(level);
142
- /** Throws for a contract listed where it cannot work, so a bad declaration fails at load, not at mount. */
143
- function checkContracts(plugin) {
144
- for (const level of PO_SERVER_SCOPE_LEVELS) {
145
- const provided = plugin.provides?.[level] ?? [];
146
- if (provided.length > 0 && plugin[level] === void 0) throw new Error(`Server plugin '${plugin.name}' provides contracts at the ${level} level but declares nothing there.`);
147
- const names = /* @__PURE__ */ new Set();
148
- for (const contract of provided) {
149
- if (contract.scope !== level) throw new Error(`Server plugin '${plugin.name}' lists the ${contract.scope} contract '${contract.name}' as provided at the ${level} level.`);
150
- if (names.has(contract.name)) throw new Error(`Server plugin '${plugin.name}' provides contract '${contract.name}' twice.`);
151
- names.add(contract.name);
152
- }
153
- for (const contract of plugin.injects?.[level] ?? []) if (depth(contract.scope) > depth(level)) throw new Error(`Server plugin '${plugin.name}' cannot inject the ${contract.scope} contract '${contract.name}' at the ${level} level.`);
154
- }
155
- }
156
- function defineServerPlugin(plugin) {
157
- checkContracts(plugin);
158
- return {
159
- name: plugin.name,
160
- ...plugin.providerOverrides ? { providerOverrides: plugin.providerOverrides } : {},
161
- ...plugin.provides ? { provides: plugin.provides } : {},
162
- ...plugin.injects ? { injects: plugin.injects } : {},
163
- inject: [.../* @__PURE__ */ new Set([
164
- PO_SERVER_HOST_SERVICE,
165
- PO_SERVER_SCOPE_SERVICE,
166
- ...plugin.inject ?? []
167
- ])],
168
- async apply(context) {
169
- const level = requirePoServerHost(context).scope;
170
- const declaration = plugin[level];
171
- if (!declaration) return void 0;
172
- const required = (plugin.injects?.[level] ?? []).map((contract) => contract.name);
173
- if (required.length === 0) return mount(plugin, declaration, context);
174
- await context.inject(required, (inner) => mount(plugin, declaration, inner));
175
- }
176
- };
177
- }
178
- async function mount(owner, declaration, context) {
179
- const host = requirePoServerHost(context);
180
- const level = host.scope;
181
- const agent = level === "session" ? readPoHeadlessHost(context) : void 0;
182
- const share = requirePoServerScope(context).plugin(owner);
183
- /** Every root this level holds, built here or reused, for the levels inside it. */
184
- const roots = {};
185
- /** What this level holds of the build's shared values and outer roots, released once it has unwound. */
186
- const leases = [];
187
- let withdraw;
188
- const lifecycle = createPluginLifecycle((signal) => ({
189
- context,
190
- host,
191
- agent,
192
- signal,
193
- resources: { async acquire(key, create, dispose) {
194
- signal.throwIfAborted();
195
- const lease = await share.acquire(key, create, dispose);
196
- if (signal.aborted) {
197
- await lease.release();
198
- signal.throwIfAborted();
199
- }
200
- leases.push(() => lease.release());
201
- return lease.value;
202
- } },
203
- async scopeRoot(rootLevel, root, rootContext) {
204
- const reused = share.outer(rootLevel).map((held) => held[rootLevel]).find((candidate) => candidate !== void 0);
205
- if (reused !== void 0) {
206
- leases.push(reused.acquire());
207
- roots[rootLevel] = reused;
208
- return {
209
- value: reused.value,
210
- ...reused.activities === void 0 ? {} : { activities: reused.activities }
211
- };
212
- }
213
- const { held, declaration: owned } = holdRoot(await root(rootContext));
214
- roots[rootLevel] = held;
215
- return owned;
216
- },
217
- hosted: (from) => share.outer(from).length > 0
218
- }));
219
- context.effect(() => async () => {
220
- withdraw?.();
221
- try {
222
- await lifecycle.dispose();
223
- } finally {
224
- for (const release of leases.splice(0).reverse()) try {
225
- await release();
226
- } catch (error) {
227
- host.context.onNotice(`server plugin '${owner.name}' could not release a shared value (${error instanceof Error ? error.message : String(error)})`);
228
- }
229
- }
230
- });
231
- const own = (registration) => {
232
- lifecycle.own(() => registration.dispose());
233
- if ("mounted" in registration && registration.mounted === false) throw new Error("Server plugin registration was refused.");
234
- };
235
- await lifecycle.mount(() => typeof declaration === "function" ? declaration(lifecycle.context) : declaration, async (scope) => {
236
- for (const service of scope.services ?? []) {
237
- const fiber = context.plugin(service);
238
- lifecycle.own(() => fiber.dispose());
239
- await fiber;
240
- }
241
- for (const channel of scope.channels ?? []) own(host.registerChannel(channel()));
242
- for (const api of scope.api ?? []) own(host.registerApi(api));
243
- for (const method of scope.methods ?? []) own(method.register(host));
244
- if (!agent) return;
245
- const session = scope;
246
- for (const restriction of session.toolRestrictions ?? []) {
247
- if (!("restrict" in restriction)) {
248
- own(agent.registerToolRestriction(restriction));
249
- continue;
250
- }
251
- let registration;
252
- lifecycle.own(() => {
253
- const current = registration;
254
- registration = void 0;
255
- return current?.dispose();
256
- });
257
- const refresh = () => {
258
- if (lifecycle.context.signal.aborted) return;
259
- const previous = registration;
260
- registration = void 0;
261
- previous?.dispose();
262
- registration = agent.registerToolRestriction(restriction.restrict());
263
- if ("mounted" in registration && registration.mounted === false) throw new Error(`Server tool restriction ${restriction.source} was refused.`);
264
- };
265
- refresh();
266
- const unsubscribe = restriction.subscribe?.(refresh);
267
- if (unsubscribe) lifecycle.own(unsubscribe);
268
- }
269
- for (const resource of session.resources ?? []) if (resource !== void 0) own(agent.registerResource(resource));
270
- for (const tool of session.tools ?? []) if ("kind" in tool) own(agent.registerTool({
271
- ...tool,
272
- async execute(toolCallId, input, signal, update, execution) {
273
- const invocationSignal = signal ? AbortSignal.any([signal, lifecycle.context.signal]) : lifecycle.context.signal;
274
- invocationSignal.throwIfAborted();
275
- try {
276
- return await tool.execute(input, {
277
- toolCallId,
278
- signal: invocationSignal,
279
- cwd: execution.cwd,
280
- update: (result) => update?.(result),
281
- notify: (request) => execution.client.notify(request)
282
- });
283
- } catch (error) {
284
- return {
285
- content: [{
286
- type: "text",
287
- text: error instanceof Error ? error.message : String(error)
288
- }],
289
- isError: true
290
- };
291
- }
292
- }
293
- }));
294
- else own(agent.registerTool(tool));
295
- for (const command of session.commands ?? []) if ("kind" in command) own(agent.registerCommand({
296
- ...command,
297
- execute: (args, execution) => {
298
- lifecycle.context.signal.throwIfAborted();
299
- return command.execute(args, {
300
- cwd: execution.cwd,
301
- signal: lifecycle.context.signal,
302
- notify: (request) => execution.client.notify(request)
303
- });
304
- }
305
- }));
306
- else own(agent.registerCommand(command));
307
- for (const hook of session.hooks ?? []) own(agent.registerHook(hook));
308
- for (const activity of session.activities ?? []) own(agent.registerActivity(activity));
309
- });
310
- if (level !== "session") withdraw = share.run(roots);
311
- return () => lifecycle.dispose();
312
- }
313
- //#endregion
314
- //#region ../../core/po-core/src/extensions/extensionFile.ts
315
- /**
316
- * Identity helpers for folder-routed backend files, one per surface.
317
- *
318
- * A routed file's default export is its whole contract with the host, and
319
- * nothing else validates it: the generated entry merges the path's identity in
320
- * and hands the result to a contribution array, where an excess or misspelled
321
- * key is invisible. These make the shape checkable at the point it is written,
322
- * and give the factory form a typed context instead of an implicit any.
323
- *
324
- * Most return their argument unchanged, so the value is entirely in the
325
- * position they check and the inference they supply. The two that do not,
326
- * `defineTool` and `defineCommand`, add the discriminant the host reads to
327
- * tell a portable contribution from a raw host declaration.
328
- */
329
- /** Declares non-default route cardinality while preserving the routed surface's inferred host type. */
330
- function defineRoutedContribution(file, _options) {
331
- return file;
332
- }
333
- /** `resource/<name>.ts`. Declares one package resource. */
334
- function defineResource(file) {
335
- return file;
336
- }
337
- /** `tool/<name>.server.ts`. A native headless tool, handed to the host untouched. */
338
- function defineServerTool(file) {
339
- return file;
340
- }
341
- /**
342
- * `root.ts`. Constructs one scope and names what its subtree shares.
343
- *
344
- * The answer to a package whose surfaces all read one per-mount object graph.
345
- * The root builds that graph once, and every routed file beneath it receives
346
- * it as `context.root`, so the package decomposes into a file per surface
347
- * without either rebuilding the graph per file or reaching for a module-level
348
- * singleton.
349
- *
350
- * `inject` names the contracts, from this package or another, that the level
351
- * waits for before it builds this root and restarts with when they change.
352
- */
353
- function defineRoot(file, options) {
354
- return options?.inject === void 0 ? file : Object.assign(file, { inject: options.inject });
355
- }
356
- /**
357
- * The contracts each level waits for: every contract injected by the roots that level builds or
358
- * reuses, once each. A level none of whose roots inject anything is left out.
359
- */
360
- function composeRootInjects(levels) {
361
- const injects = {};
362
- for (const [level, roots] of Object.entries(levels)) {
363
- const contracts = new Map(roots.flatMap((root) => root.inject ?? []).map((contract) => [contract.name, contract]));
364
- if (contracts.size > 0) injects[level] = [...contracts.values()];
365
- }
366
- return injects;
367
- }
368
- /**
369
- * Folds every root in a scope chain into one set of lifecycle hooks.
370
- *
371
- * Start outermost first and tear down innermost first, which is the order the
372
- * roots were constructed in and the only order in which an inner scope can
373
- * still rely on its outer one while stopping.
374
- */
375
- function composeRootHooks(...roots) {
376
- const reversed = [...roots].reverse();
377
- return {
378
- async onStart(context) {
379
- for (const root of roots) await root.onStart?.(context);
380
- },
381
- async onStop(context) {
382
- await runCleanups(reversed.map((root) => () => root.onStop?.(context)), "Root stop failed.");
383
- },
384
- async onDispose(context) {
385
- await runCleanups(reversed.map((root) => () => root.onDispose?.(context)), "Root cleanup failed.");
386
- }
387
- };
388
- }
389
- /** `command/<name>.server.ts`. A native headless or portable Po command. */
390
- function defineServerCommand(file) {
391
- return file;
392
- }
393
- /** `hook/<event>.ts`. Name the event here too when the handler needs a precise payload. */
394
- function defineHook(file) {
395
- return file;
396
- }
397
- function defineChannel(file, options) {
398
- return options?.context === true ? file : () => file();
399
- }
400
- /** `api/<segments>/route.ts`. The folder path is the route. */
401
- function defineRoute(file) {
402
- return file;
403
- }
404
- /** `method/<member>.ts`. Build the value with `defineServerMethod` to keep schema inference. */
405
- function defineMethod(file) {
406
- return file;
407
- }
408
- //#endregion
409
- export { defineMethod as a, defineRoute as c, defineServerTool as d, defineServerPlugin as f, defineHook as i, defineRoutedContribution as l, composeRootInjects as n, defineResource as o, runCleanups as p, defineChannel as r, defineRoot as s, composeRootHooks as t, defineServerCommand as u };
@@ -1,88 +0,0 @@
1
- import path from "node:path";
2
- //#region ../../foundations/po-config/src/services/harnessState/index.ts
3
- /**
4
- * The codec between harness state and the environment.
5
- *
6
- * Decoding exists for processes that were started without a state file: a
7
- * nested run, a third-party spawn, or anything older than the store. Encoding
8
- * exists because shell launchers and packages that do not
9
- * depend on this one can only read an environment. Ownership, persistence and
10
- * mutation belong to harnessStore.ts; nothing here touches disk or holds state.
11
- */
12
- const DEFAULT_MAJOR_MODE = "copilot";
13
- const DISABLED_FLAG = "0";
14
- const HARNESS_STATE_KEYS = {
15
- root: "PO_ROOT",
16
- majorMode: "PO_MAJOR_MODE",
17
- temporaryDirectory: "PO_TEMP_DIR",
18
- domains: "PO_DOMAINS",
19
- layers: "PO_LAYERS",
20
- compositionFingerprint: "PO_COMPOSITION_FINGERPRINT",
21
- profile: "PO_PROFILE",
22
- profileEnvironment: "PO_PROFILE_ENV",
23
- skillDirectories: "PO_SKILL_DIRS",
24
- agentDirectories: "PO_AGENT_DIRS",
25
- additionalDirectories: "PO_ADDITIONAL_DIRS",
26
- childExtensions: "PO_CHILD_EXTENSIONS",
27
- pluginDirectories: "PO_PLUGIN_DIRS",
28
- mcpConfigPath: "PO_MCP_CONFIG",
29
- personaFile: "PO_PERSONA_FILE",
30
- agents: "PO_AGENTS_ENABLED",
31
- mcp: "PO_MCP_ENABLED",
32
- allowProtectedWrites: "PO_ALLOW_PROTECTED_WRITES"
33
- };
34
- function splitCsv(value) {
35
- return value?.split(",").map((item) => item.trim()).filter(Boolean) ?? [];
36
- }
37
- function splitPaths(value) {
38
- return value?.split(path.delimiter).map((item) => item.trim()).filter(Boolean) ?? [];
39
- }
40
- function parseFlag(value) {
41
- return value !== DISABLED_FLAG;
42
- }
43
- function parseStringRecord(value, key, report) {
44
- if (!value) return {};
45
- try {
46
- const parsed = JSON.parse(value);
47
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) return {};
48
- return Object.fromEntries(Object.entries(parsed).filter((entry) => typeof entry[1] === "string"));
49
- } catch (error) {
50
- report?.(key, error);
51
- return {};
52
- }
53
- }
54
- function parseStringList(value, key, report) {
55
- if (!value) return [];
56
- try {
57
- const parsed = JSON.parse(value);
58
- return Array.isArray(parsed) ? parsed.filter((item) => typeof item === "string") : [];
59
- } catch (error) {
60
- report?.(key, error);
61
- return [];
62
- }
63
- }
64
- function readHarnessState(environment = process.env, report) {
65
- const keys = HARNESS_STATE_KEYS;
66
- return {
67
- root: environment[keys.root] || void 0,
68
- majorMode: environment[keys.majorMode] || DEFAULT_MAJOR_MODE,
69
- temporaryDirectory: environment[keys.temporaryDirectory] || void 0,
70
- domains: splitCsv(environment[keys.domains]),
71
- layers: splitCsv(environment[keys.layers]),
72
- compositionFingerprint: environment[keys.compositionFingerprint] || void 0,
73
- profile: environment[keys.profile] || void 0,
74
- profileEnvironment: parseStringRecord(environment[keys.profileEnvironment], keys.profileEnvironment, report),
75
- skillDirectories: splitPaths(environment[keys.skillDirectories]),
76
- agentDirectories: splitPaths(environment[keys.agentDirectories]),
77
- additionalDirectories: splitPaths(environment[keys.additionalDirectories]),
78
- childExtensions: parseStringList(environment[keys.childExtensions], keys.childExtensions, report),
79
- pluginDirectories: splitPaths(environment[keys.pluginDirectories]),
80
- mcpConfigPath: environment[keys.mcpConfigPath] || void 0,
81
- personaFile: environment[keys.personaFile] || void 0,
82
- agents: parseFlag(environment[keys.agents]),
83
- mcp: parseFlag(environment[keys.mcp]),
84
- allowProtectedWrites: parseFlag(environment[keys.allowProtectedWrites])
85
- };
86
- }
87
- //#endregion
88
- export { readHarnessState as t };
@@ -1 +0,0 @@
1
- import "./harnessStore-CRtlTdbI.js";