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

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 (302) 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-BPGaXWA5.js} +1 -1
  6. package/dist/agent-COvApaVM.js +3878 -0
  7. package/dist/{anthropic-messages-CkYm8M3V.js → anthropic-messages-BxS7qXqx.js} +291 -63
  8. package/dist/apiContracts-BCr_ULWJ.js +1603 -0
  9. package/dist/{approval-Eu7UgGL-.js → approval-Cg-PCa5M.js} +19 -3
  10. package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-D7peArNh.js} +1 -2
  11. package/dist/artifactFiles-CbGIbj93.js +1 -0
  12. package/dist/assets/assets/{CodeEditorView-rEfljuRK.js → CodeEditorView-J2_5q1WT.js} +2 -2
  13. package/dist/assets/assets/{abnfDiagram-WEYOIA3C-J6Iu5p17.js → abnfDiagram-WEYOIA3C-_gWnN1r-.js} +2 -2
  14. package/dist/assets/assets/{architecture-WOLXFQ4H-DKj_xMR1.js → architecture-WOLXFQ4H-DOEVRwUT.js} +1 -1
  15. package/dist/assets/assets/{architectureDiagram-ZHVYKT53--D1MzuBo.js → architectureDiagram-ZHVYKT53-BI3jFrO0.js} +2 -2
  16. package/dist/assets/assets/{blockDiagram-RJAE7QA3-CrWO0t-Q.js → blockDiagram-RJAE7QA3-B_PkpROK.js} +2 -2
  17. package/dist/assets/assets/{c4Diagram-XDPPPE54-CBMOJREz.js → c4Diagram-XDPPPE54-DhSjpw5T.js} +2 -2
  18. package/dist/assets/assets/channel-CVgc46nD.js +2 -0
  19. package/dist/assets/assets/{chunk-2E7WHVMD-CR9NMk46.js → chunk-2E7WHVMD-BrDo2biY.js} +2 -2
  20. package/dist/assets/assets/{chunk-4EMNKR2T-B4D0falO.js → chunk-4EMNKR2T-CdlJ35FL.js} +2 -2
  21. package/dist/assets/assets/{chunk-55XCU76K-CKrttFen.js → chunk-55XCU76K-D9eb1FTZ.js} +2 -2
  22. package/dist/assets/assets/{chunk-7S6XSTFO-BPNrdjSb.js → chunk-7S6XSTFO-VVyUsBaV.js} +2 -2
  23. package/dist/assets/assets/{chunk-AQDTSKZB-Ddx2gPU_.js → chunk-AQDTSKZB-DJmW9j7o.js} +2 -2
  24. package/dist/assets/assets/{chunk-DSNLSHJZ-iQg3RbZ_.js → chunk-DSNLSHJZ-bQ4kpxiE.js} +2 -2
  25. package/dist/assets/assets/{chunk-HAGFOTED-CGlDRwnk.js → chunk-HAGFOTED-CXTtS6oc.js} +2 -2
  26. package/dist/assets/assets/{chunk-HNE4Q36P-CN7VMEsn.js → chunk-HNE4Q36P-CjJ9StOJ.js} +2 -2
  27. package/dist/assets/assets/{chunk-NQOKRVIF-DQKmIS4j.js → chunk-NQOKRVIF-CEttWQFT.js} +2 -2
  28. package/dist/assets/assets/{chunk-UHW7PFBP-BKSG_d1a.js → chunk-UHW7PFBP-CJZzmAtC.js} +2 -2
  29. package/dist/assets/assets/{chunk-VQ5W62QI-AbFHiDOg.js → chunk-VQ5W62QI-Bp76YSjS.js} +2 -2
  30. package/dist/assets/assets/{chunk-WQQL4CDK-C5a4DmCb.js → chunk-WQQL4CDK-wm0yUUcN.js} +2 -2
  31. package/dist/assets/assets/chunk-XXDRQBXY-BkEG_5cB.js +2 -0
  32. package/dist/assets/assets/{chunk-YZO67HFG-UbKezTdY.js → chunk-YZO67HFG-BmXRKyV5.js} +2 -2
  33. package/dist/assets/assets/{chunk-ZAUX2LTX-BShGGpRc.js → chunk-ZAUX2LTX-DJCmQeWP.js} +2 -2
  34. package/dist/assets/assets/{chunk-ZCHMQSOR-BmV-PDP0.js → chunk-ZCHMQSOR-D3pxm97L.js} +2 -2
  35. package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DB-cfBNq.js → classDiagram-v2-4MYWR3UA-DxMxFm6d.js} +2 -2
  36. package/dist/assets/assets/{cose-bilkent-JH36ORCC-Dprqh48h.js → cose-bilkent-JH36ORCC-Ck_lCjTR.js} +2 -2
  37. package/dist/assets/assets/{cynefin-EF2NZ3EQ-Bz4CND4n.js → cynefin-EF2NZ3EQ-CgjU58bC.js} +1 -1
  38. package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Cv0Tq-0q.js → cynefinDiagram-WF24UDRP-CUP0NVKn.js} +2 -2
  39. package/dist/assets/assets/{dagre-NK4GIZVX-H4d8oeNm.js → dagre-NK4GIZVX-DkvcOoGp.js} +2 -2
  40. package/dist/assets/assets/{diagram-CBK3MWTC-D75OthTM.js → diagram-CBK3MWTC-CFl4wUVN.js} +2 -2
  41. package/dist/assets/assets/{diagram-I5XIIV2D-CB_W2jXU.js → diagram-I5XIIV2D-CldqmFr0.js} +2 -2
  42. package/dist/assets/assets/{diagram-ODIL2UCW-DPO0lYZ-.js → diagram-ODIL2UCW-CPieOVfl.js} +2 -2
  43. package/dist/assets/assets/{diagram-PFBEJUXE-DJ9olXAC.js → diagram-PFBEJUXE-DgTWsRKS.js} +2 -2
  44. package/dist/assets/assets/{diagram-RJA3I4VV-DL3974PI.js → diagram-RJA3I4VV-DmxD5RVL.js} +2 -2
  45. package/dist/assets/assets/{diagram-TYUNFSNR-ZuYESp4p.js → diagram-TYUNFSNR-DC_QoE9Q.js} +2 -2
  46. package/dist/assets/assets/{dist-CeotBqYt.js → dist-BoXKbh_9.js} +2 -2
  47. package/dist/assets/assets/{dist-CdrEbsAL.js → dist-C-aQ-0ab.js} +2 -2
  48. package/dist/assets/assets/{dist-CXqaT1wB.js → dist-CHKWIm0j.js} +2 -2
  49. package/dist/assets/assets/{dist-BnkGKHOV.js → dist-CeZ4Dyeb.js} +2 -2
  50. package/dist/assets/assets/{dist-C8iSs-hT.js → dist-DtfkqVX-.js} +2 -2
  51. package/dist/assets/assets/{dist-G3vL_xw7.js → dist-JVpnlOn0.js} +2 -2
  52. package/dist/assets/assets/{dist-DvCNYjgK.js → dist-L_xVrjFQ.js} +2 -2
  53. package/dist/assets/assets/{dist-zXhaMKmO.js → dist-_Q_eXWhh.js} +2 -2
  54. package/dist/assets/assets/{dist-D2iSi_lg.js → dist-m3yHSyxW.js} +2 -2
  55. package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-DNfHKEsm.js → ebnfDiagram-V4P3TTPT-BdrqTmnC.js} +2 -2
  56. package/dist/assets/assets/{elk-QONTBCTQ-C0FX9D60.js → elk-QONTBCTQ-BBnxKz3T.js} +2 -2
  57. package/dist/assets/assets/{erDiagram-KYQIGQAA-BI1O9lW0.js → erDiagram-KYQIGQAA-DX45_hK2.js} +2 -2
  58. package/dist/assets/assets/{eventmodeling-K75KTNOO-BmWt-aOv.js → eventmodeling-K75KTNOO-EIuQjWpD.js} +1 -1
  59. package/dist/assets/assets/flowDiagram-IUGLLWBU-Bdol35Vj.js +1 -0
  60. package/dist/assets/assets/{ganttDiagram-R7GPNTJY-pM7PmQ6B.js → ganttDiagram-R7GPNTJY-CveiRngd.js} +2 -2
  61. package/dist/assets/assets/{gitGraph-VSP46ZUC-D0QXMQxv.js → gitGraph-VSP46ZUC-D4yRXN3j.js} +1 -1
  62. package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BsMltgt3.js → gitGraphDiagram-PDYL7XHY-D5DsbgCK.js} +2 -2
  63. package/dist/assets/assets/index-BDUEIar6.css +1 -0
  64. package/dist/assets/assets/index-BfW-zJ-Y.js +200 -0
  65. package/dist/assets/assets/{info-OHQRW6UA-Dp5Eu5PX.js → info-OHQRW6UA-C0PnFIek.js} +1 -1
  66. package/dist/assets/assets/{infoDiagram-MVDRKAX5-TgXRfZiq.js → infoDiagram-MVDRKAX5-DpwE-14N.js} +2 -2
  67. package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-Qzrmih4p.js → ishikawaDiagram-HPEHV2GE-X1GxSc7S.js} +2 -2
  68. package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BksI3QOT.js → journeyDiagram-BOSHW7O7-0cwzSgYT.js} +2 -2
  69. package/dist/assets/assets/{kanban-definition-FNSA4HC5-l_IuN5_k.js → kanban-definition-FNSA4HC5-C-U-zp3B.js} +2 -2
  70. package/dist/assets/assets/{line-BDKssGoM.js → line-CxMWkCyB.js} +2 -2
  71. package/dist/assets/assets/{linear-C9vmtzBC.js → linear-BpB8rX3C.js} +2 -2
  72. package/dist/assets/assets/{mermaid-parser.core-O1yFX7K_.js → mermaid-parser.core-CmAfQFuk.js} +4 -4
  73. package/dist/assets/assets/{mermaid.core-CIq57361.js → mermaid.core-BTk7Bw6z.js} +5 -5
  74. package/dist/assets/assets/{mindmap-definition-6OY57UG3-BkVuZ010.js → mindmap-definition-6OY57UG3-B2sMo2jC.js} +2 -2
  75. package/dist/assets/assets/{packet-JDAUHWVQ-PPNcSWeV.js → packet-JDAUHWVQ-BzzVSUon.js} +1 -1
  76. package/dist/assets/assets/{pegDiagram-ECIUJNBX-ClwrHXhM.js → pegDiagram-ECIUJNBX-VIiN2lIU.js} +2 -2
  77. package/dist/assets/assets/{pie-XZMESJXO-BAE4Cy9j.js → pie-XZMESJXO-B-jSi7x9.js} +1 -1
  78. package/dist/assets/assets/{pieDiagram-GNMPY74T-CvQ62Knb.js → pieDiagram-GNMPY74T-190bpqyE.js} +2 -2
  79. package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CzAyT5ZB.js → quadrantDiagram-D57K4MC3-CHsQo88q.js} +2 -2
  80. package/dist/assets/assets/{radar-ABXABTNO-CoEe8B7b.js → radar-ABXABTNO-CW2EglFo.js} +1 -1
  81. package/dist/assets/assets/{railroad-I3PHUGI6-BbK5J8H5.js → railroad-I3PHUGI6-C1b0ftsy.js} +1 -1
  82. package/dist/assets/assets/{railroad-abnf-LNEFI6M7-DlGngfop.js → railroad-abnf-LNEFI6M7-DTT_CP-y.js} +1 -1
  83. package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-BRk4ifMx.js → railroad-ebnf-DWYD2UWJ-RCPkVVI9.js} +1 -1
  84. package/dist/assets/assets/{railroad-peg-JR7BVNR7-Rz-3vbj2.js → railroad-peg-JR7BVNR7-DixVu6c8.js} +1 -1
  85. package/dist/assets/assets/{railroadDiagram-Y72NRBL7-DQISBRHH.js → railroadDiagram-Y72NRBL7-DbdG32pF.js} +2 -2
  86. package/dist/assets/assets/{requirementDiagram-EQYSW5RA-DcK4FnTB.js → requirementDiagram-EQYSW5RA-U_x9QFHY.js} +2 -2
  87. package/dist/assets/assets/{sankeyDiagram-SY24JHO5-N2EXBOYb.js → sankeyDiagram-SY24JHO5-qfiLv1KI.js} +2 -2
  88. package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-CMJ2EqC_.js → sequenceDiagram-BLEHNHQU-DMBomC37.js} +2 -2
  89. package/dist/assets/assets/{src-Df9VBjd7.js → src-DaNTNLrJ.js} +2 -2
  90. package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-D6Cxm8wj.js → stateDiagram-v2-A6IESKWZ-BgAnpbx_.js} +2 -2
  91. package/dist/assets/assets/{swimlanes-B3ENRKFQ-BybuzSPd.js → swimlanes-B3ENRKFQ-Dihe5c6o.js} +2 -2
  92. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-Cgg-RsbC.js +9 -0
  93. package/dist/assets/assets/{timeline-definition-JXYKGLGB-BzjkWUdz.js → timeline-definition-JXYKGLGB-BISDYTXW.js} +2 -2
  94. package/dist/assets/assets/{treeView-D4JQ5SDB-DIDWwDtU.js → treeView-D4JQ5SDB-DMSWtiHi.js} +1 -1
  95. package/dist/assets/assets/{treemap-SAJKECNS-SWP4JszI.js → treemap-SAJKECNS-0SsdPE-3.js} +1 -1
  96. package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-ZfCxSJdE.js → usecaseDiagram-WPOLBNNX-CY0WaaL_.js} +2 -2
  97. package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-o44wkgGH.js → vennDiagram-Q3Y3IDCW-DXXcHfKI.js} +2 -2
  98. package/dist/assets/assets/{wardley-7MLQ67FV-0zKRsI4Z.js → wardley-7MLQ67FV-BzVdmZfO.js} +1 -1
  99. package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CyBVyB40.js → wardleyDiagram-IVAIDKWA-BiDG6ka7.js} +2 -2
  100. package/dist/assets/assets/{webpack-C4nkEwJD.js → webpack-CUCfmjk-.js} +2 -2
  101. package/dist/assets/assets/{xychartDiagram-4URNHDU4-BMvRihYC.js → xychartDiagram-4URNHDU4-DTR1zwTC.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-LmdY6uBA.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-Ka6K4y6i.js +1 -0
  109. package/dist/assets/plugins/compositions.json +1 -1
  110. package/dist/assets/plugins/slots/approval.dd60ec90-D_Iw2VJn.js +2 -0
  111. package/dist/assets/plugins/slots/artifacts.a078f1a5-CS9a_zNA.js +1 -0
  112. package/dist/assets/plugins/slots/author.497633d0-BFa_H5ZE.js +93 -0
  113. package/dist/assets/plugins/slots/autocompact.86aeccf4-B0hGnck7.js +1 -0
  114. package/dist/assets/plugins/slots/browse.5fcf164c-CVRtiGzR.js +1 -0
  115. package/dist/assets/plugins/slots/builtin-tools.0a7f0b8e-CJTf-98P.js +7 -0
  116. package/dist/assets/plugins/slots/codemode.ff16ac06-BRYQKsyR.js +11 -0
  117. package/dist/assets/plugins/slots/domain.3ddea842-02QPrhJk.js +1 -0
  118. package/dist/assets/plugins/slots/edit.c5b0b072-CETRuGf0.js +7 -0
  119. package/dist/assets/plugins/slots/files.8ffcdcc0-DgGX5poR.js +2 -0
  120. package/dist/assets/plugins/slots/goal.423c7a26-D67j7FqW.js +1 -0
  121. package/dist/assets/plugins/slots/grep.95f470b3-CmhMD_DW.js +1 -0
  122. package/dist/assets/plugins/slots/help.03b9ba99-os14i52k.js +3 -0
  123. package/dist/assets/plugins/slots/log.19bda339-DvprmzHk.js +4 -0
  124. package/dist/assets/plugins/slots/mcp.ffbe405a-CcCIF5cJ.js +109 -0
  125. package/dist/assets/plugins/slots/plan.5eac6563-CqYx6E9R.js +3 -0
  126. package/dist/assets/plugins/slots/{profile.ab16dcec-Cu6ev2uW.js → profile.176710dd-BDgBh-Su.js} +1 -1
  127. package/dist/assets/plugins/slots/prompts.2c187969-Bls5s3m1.js +3 -0
  128. package/dist/assets/plugins/slots/read.1629d556-Bg9NIMAZ.js +1 -0
  129. package/dist/assets/plugins/slots/runner.962030e5-_04Fb699.js +8 -0
  130. package/dist/assets/plugins/slots/sessions.fc763f42-BaHBIWGm.js +1 -0
  131. package/dist/assets/plugins/slots/skill.f5396fde-MNxJbIRc.js +4 -0
  132. package/dist/assets/plugins/slots/subagents.d815a296-DNYKN2_3.js +7 -0
  133. package/dist/assets/plugins/slots/vault.57fd9047-C3YDx6j4.js +1 -0
  134. package/dist/assets/plugins/slots/voice.b709d05c-BT788wX1.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-CU27fWtF.js} +2 -3
  138. package/dist/{azure-openai-config-DHMgdIa-.js → azure-openai-config-DkmTos8T.js} +2 -2
  139. package/dist/{azure-openai-responses-CTgRdQ4m.js → azure-openai-responses-sm_U3omr.js} +13 -13
  140. package/dist/backgroundWork-C3TYOD5X.js +49 -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-B7BdEyPa.js} +5 -5
  145. package/dist/{cloudflare-workers-ai-system-one-B0wH6HU5.js → cloudflare-workers-ai-system-one-DpnCKwVj.js} +3 -3
  146. package/dist/{codemode-yHAHBZO-.js → codemode-CU_gontV.js} +5 -2
  147. package/dist/contracts-B_eb2dl9.js +19 -0
  148. package/dist/contracts-mVtrvUmY.js +40 -0
  149. package/dist/{diagnostics-DPTP-yrt.js → diagnostics-C43OHsIc.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-accj222e.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-CSPKWgJn.js} +1 -1
  157. package/dist/{error-body-DQZRsyL5.js → error-body-BvLDKbXN.js} +26 -4
  158. package/dist/esm-BKJy3O9-.js +1553 -0
  159. package/dist/{exports-CrJqsTU6.js → exports-BlsXYnB_.js} +27 -9
  160. package/dist/{remoteMcp-Ci8crSU9.js → exports-CHx8bsjQ.js} +1062 -176
  161. package/dist/exports-CUM-AowA.js +34 -0
  162. package/dist/extensionFile-Bf1PbYVu.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-CZIImZmD.js} +1 -1
  165. package/dist/{google-generative-ai-BTTOo5RQ.js → google-generative-ai-P4ubvgcU.js} +9 -9
  166. package/dist/{google-shared-S7bqOccz.js → google-shared-C8Kez75I.js} +6 -6
  167. package/dist/{google-vertex-BcMU_DMb.js → google-vertex-T1trcCEz.js} +10 -10
  168. package/dist/{domains-dHfk2U8X.js → harnessState-DMini_AN.js} +175 -16
  169. package/dist/{harnessStore-CRtlTdbI.js → harnessStore-CTomNyVl.js} +4 -5
  170. package/dist/{hash-B3RRpLS2.js → hash-CMLRVP3c.js} +1 -1
  171. package/dist/{headers-BEuxFxDI.js → headers-CX-ZuPIi.js} +1 -1
  172. package/dist/help-BxTDP41H.js +1 -0
  173. package/dist/help-C4aC-kWh.js +100 -0
  174. package/dist/http-4lVtjwa7.js +59 -0
  175. package/dist/{hubChannel-Cj1iF847.js → hubChannel-Bq4zyVgX.js} +12 -29
  176. package/dist/hubRevisions-BknPawK7.js +364 -0
  177. package/dist/{identity-BIeAyilV.js → identity-DEwhWpjw.js} +3 -3
  178. package/dist/index.edge-ClLTmPFz.js +191 -0
  179. package/dist/index.edge-CwcYQLj9.js +70 -0
  180. package/dist/index.edge-D2RirEwK.js +14 -0
  181. package/dist/index.edge-Dw11TL5F.js +56 -0
  182. package/dist/index.edge-DyUqSroq.js +67 -0
  183. package/dist/index.edge-Ts1NG9b4.js +937 -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-DVe-JMGQ.js} +217 -24
  187. package/dist/{majorModes-C-OD4PBc.js → majorModes-BBT0wftm.js} +4 -14
  188. package/dist/majorModes-BcA8pk7t.js +1 -0
  189. package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-BZoy_uKa.js} +1 -2
  190. package/dist/{mistral-conversations-DN8VSERk.js → mistral-conversations-jEBsA1Xz.js} +12 -12
  191. package/dist/modeDefinition-C3Zbrw48.js +44 -0
  192. package/dist/{models-D6d73jcW.js → models-BoBYu6VI.js} +41 -46
  193. package/dist/narration-BtGsZwE7.js +127 -0
  194. package/dist/{node-UuMT2C3q.js → node-CdIUdDAa.js} +2 -2
  195. package/dist/{node-DytJOfYf.js → node-CjBe953N.js} +2 -2
  196. package/dist/notification-BHaYyLJJ.js +101 -0
  197. package/dist/{openai-bt3ZRBZv.js → openai-69NOv-G_.js} +187 -187
  198. package/dist/{openai-codex-responses-cL36x0ml.js → openai-codex-responses-x01Vnd68.js} +21 -25
  199. package/dist/{openai-completions-BWsTNYyT.js → openai-completions-B81ryS-E.js} +26 -19
  200. package/dist/{openai-decisions-Dfn_KgQd.js → openai-decisions-Kybq6lsr.js} +3 -3
  201. package/dist/{openai-responses-aa0LoyCJ.js → openai-responses-BK5Zz1Ib.js} +17 -15
  202. package/dist/{openai-responses-shared-H-jH5SlM.js → openai-responses-shared-b4nN_ZS7.js} +7 -7
  203. package/dist/{openrouter-cost-D99Qqcs6.js → openrouter-cost-C4M4CjUF.js} +1 -1
  204. package/dist/{openrouter-images-BpwVpALC.js → openrouter-images-DMMiksXo.js} +7 -7
  205. package/dist/photon_rs_bg.wasm +0 -0
  206. package/dist/{pi-messages-BHAIkYBj.js → pi-messages-D3F6NGQb.js} +6 -6
  207. package/dist/piConfig-BeRtzEWI.js +126 -0
  208. package/dist/piSettings-CDcdxob2.js +1 -0
  209. package/dist/platform-CAhzdBhg.js +113 -0
  210. package/dist/pluginContributions-Be9EnCAW.js +16 -0
  211. package/dist/pluginProtocol-ZOY2-HIL.js +136 -0
  212. package/dist/{protocol-Xpm_mCNN.js → protocol-Db1l1xpe.js} +1 -2
  213. package/dist/{provider-env-DgfpjgTa.js → provider-env-C6KlbHmf.js} +2 -2
  214. package/dist/{provider-retry-ChD-K2Gv.js → provider-retry-C8AvzuUi.js} +1 -1
  215. package/dist/{puppeteer-cloudflare-B-GHrPGO.js → puppeteer-cloudflare-D4l8smMS.js} +3 -3
  216. package/dist/{rolldown-runtime-B-lAHAz2.js → rolldown-runtime-DbVrKiKs.js} +1 -1
  217. package/dist/{sanitize-unicode-Dl4ROF7y.js → sanitize-unicode-Di-31Zpn.js} +1 -1
  218. package/dist/{schemas-Vj8-rCR4.js → schemas-BMBR99Q5.js} +3 -2
  219. package/dist/server-4R5ZprW5.js +978 -0
  220. package/dist/server-B0PFs3Yl.js +288 -0
  221. package/dist/server-B4f5d7ka.js +1811 -0
  222. package/dist/server-BQ0I9oeZ.js +1359 -0
  223. package/dist/server-BZ_bk5i9.js +295 -0
  224. package/dist/{server-CUvohcAm.js → server-Ba7pnDkx.js} +54 -47
  225. package/dist/server-BayLsR7Z.js +343 -0
  226. package/dist/{server-BccTx_r6.js → server-BbNo0APc.js} +121 -19
  227. package/dist/server-Bi9VOAOP.js +833 -0
  228. package/dist/{server-De_PIOty.js → server-BkmcRLIT.js} +47 -27
  229. package/dist/{server-DwWTQg1J.js → server-BwtSRROE.js} +14 -5
  230. package/dist/server-BxzzL3_G.js +1883 -0
  231. package/dist/{server-CYQHzqaQ.js → server-By1ctEvA.js} +11 -9
  232. package/dist/server-CA5TuWDo.js +3125 -0
  233. package/dist/{server-C1ijZQp4.js → server-CBHlRlm4.js} +3 -10
  234. package/dist/server-CDypk2xJ.js +1296 -0
  235. package/dist/server-ChlBgWIn.js +1116 -0
  236. package/dist/server-CkMqSsYi.js +15105 -0
  237. package/dist/server-CnsLcuj-.js +1518 -0
  238. package/dist/server-CrqcdtBx.js +178 -0
  239. package/dist/server-CwlDZ2N-.js +491 -0
  240. package/dist/server-D3j7dywQ.js +576 -0
  241. package/dist/server-DXD7cbH0.js +679 -0
  242. package/dist/server-DesEguVZ.js +640 -0
  243. package/dist/server-Dqjcc8p0.js +2656 -0
  244. package/dist/{server-BPvd3Ya5.js → server-DrmY-Chg.js} +570 -127
  245. package/dist/{server-B2xd7WTP.js → server-DtCOCPGp.js} +9 -20
  246. package/dist/server-DuAckacI.js +1522 -0
  247. package/dist/server-EgPpwMaj.js +505 -0
  248. package/dist/server-h0TSZCjm.js +189 -0
  249. package/dist/serverPlugin-Cx6a5RT0.js +36624 -0
  250. package/dist/session-resources-DLg07yAP.js +10 -0
  251. package/dist/{sessionConfig-2a4LWInR.js → sessionConfig-6NVRcVwL.js} +615 -766
  252. package/dist/{simple-options-DWrW31_K.js → simple-options-DM-a_ljY.js} +13 -6
  253. package/dist/{streaming-json-t4rzNHEp.js → streaming-json-Bs_lERVE.js} +6 -6
  254. package/dist/{system-one-shared-DLVLdzYL.js → system-one-shared-B63vQ3Om.js} +3 -3
  255. package/dist/{notification-D76PSL7r.js → telemetry-CrTcxeA5.js} +2 -93
  256. package/dist/{transform-messages-CjTSwW9q.js → transform-messages-Bbr4sgbB.js} +3 -16
  257. package/dist/truncate-M3KbFyVj.js +89 -0
  258. package/dist/{server-DrZBZ17y.js → type-CuAiPMD4.js} +569 -1409
  259. package/dist/type-yokaDI_F.js +7 -0
  260. package/dist/{typesafe-system-one-DBVcjcUQ.js → typesafe-system-one-7g930h9C.js} +3 -3
  261. package/dist/{uuid-mkNGilLv.js → uuid-D5Z4Ivdo.js} +1 -1
  262. package/dist/{validation-D77NZBrx.js → validation-DesEfRe-.js} +8 -3
  263. package/dist/vaultSettings-BdkqnmJf.js +292 -0
  264. package/dist/voiceTools-Chad-LEE.js +246 -0
  265. package/dist/web-QeFwt_Vl.js +3 -0
  266. package/dist/worker.js +56560 -35339
  267. package/dist/workflow-BLBCriNp.js +113 -0
  268. package/package.json +44 -25
  269. package/wrangler.jsonc +13 -3
  270. package/dist/apiContracts-CHOiCbS_.js +0 -4451
  271. package/dist/assets/assets/channel-CNegK3Rr.js +0 -2
  272. package/dist/assets/assets/chunk-XXDRQBXY-BbVKQGnw.js +0 -2
  273. package/dist/assets/assets/flowDiagram-IUGLLWBU-DQj3H5a6.js +0 -1
  274. package/dist/assets/assets/index-BTHzc8EN.js +0 -155
  275. package/dist/assets/assets/index-DZM68mTk.css +0 -1
  276. package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CXJkO6sc.js +0 -9
  277. package/dist/assets/plugins/assets/base-B5jpmLBl.css +0 -2
  278. package/dist/assets/plugins/chunks/po-web-runtime-D4qQFtJO.js +0 -1
  279. package/dist/assets/plugins/slots/approval.09e72f36-Cck_K9ex.js +0 -2
  280. package/dist/assets/plugins/slots/artifacts.50b639bb-BZM7uEbe.js +0 -1
  281. package/dist/assets/plugins/slots/builtin-tools.75108f21-EWWGTveL.js +0 -7
  282. package/dist/assets/plugins/slots/codemode.c58fb583-CgfTL6kt.js +0 -9
  283. package/dist/assets/plugins/slots/domain.753f9f92-BU0ilfwM.js +0 -1
  284. package/dist/assets/plugins/slots/mcp.82cc1ff5-BaCD2xZB.js +0 -109
  285. package/dist/assets/plugins/slots/skill.62a0a1b3-Bz20F1eA.js +0 -4
  286. package/dist/backgroundWork-bE3pc-R9.js +0 -25
  287. package/dist/build-2gFaVEfG.js +0 -3355
  288. package/dist/contextProjection-DVP2Vc5j.js +0 -188
  289. package/dist/extensionFile-CY4EFNHQ.js +0 -409
  290. package/dist/harnessState-gmzJcPGt.js +0 -88
  291. package/dist/harnessStore-DZ4lDIq6.js +0 -1
  292. package/dist/index.edge-BgSx_gRO.js +0 -45
  293. package/dist/majorModes-AYZvnOpU.js +0 -1
  294. package/dist/piSettings-B6fsgIBA.js +0 -1
  295. package/dist/platform-CNhm9zLi.js +0 -16
  296. package/dist/platformFiles-3rzOh9cg.js +0 -39
  297. package/dist/server-Bf3_VTkt.js +0 -592
  298. package/dist/server-BmAziQml.js +0 -657
  299. package/dist/server-BvV-GqDO.js +0 -280
  300. package/dist/server-xiuzwJ1C.js +0 -118
  301. package/dist/serverPlugin-H4T49sac.js +0 -3347
  302. package/dist/value-Djvc2foV.js +0 -2247
@@ -0,0 +1,178 @@
1
+ import { $t as requirePoSqlite, Kt as PO_SQLITE_SERVICE, Lt as BACKGROUND_CONTEXT, Qt as requirePoFs, T as composeServerProviderOverrides, Wt as PO_FS_SERVICE, ct as getOrThrow, en as PO_SERVER_SCOPE_SERVICE, it as nodeHost, rn as requirePoServerScope, t as defineServerPlugin, tt as poHomeDirectory } from "./serverPlugin-Cx6a5RT0.js";
2
+ import "./platform-CAhzdBhg.js";
3
+ import "./piSettings-CDcdxob2.js";
4
+ import { c as defineRoot, n as composeRootInjects, t as composeRootHooks } from "./extensionFile-Bf1PbYVu.js";
5
+ import { i as PO_DB_PREFIX_PATTERN, r as PO_DB_FILE, t as PO_DB_CONTRACT } from "./contracts-B_eb2dl9.js";
6
+ import path from "node:path";
7
+ //#region ../../../node_modules/.pnpm/@earendil-works+chord@1.5.1_esbuild@0.28.2_react@19.3.0_ws@8.22.0/node_modules/@earendil-works/chord/dist/sqlite/schema.js
8
+ /** Validate a prefix before using it as part of a SQLite identifier. */
9
+ function validateSqliteSchemaPrefix(prefix) {
10
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(prefix)) throw new Error(`Invalid SQLite schema prefix ${JSON.stringify(prefix)}`);
11
+ if (prefix.toLowerCase().startsWith("sqlite_")) throw new Error(`SQLite schema prefix ${JSON.stringify(prefix)} is reserved`);
12
+ }
13
+ //#endregion
14
+ //#region ../../../node_modules/.pnpm/@earendil-works+chord@1.5.1_esbuild@0.28.2_react@19.3.0_ws@8.22.0/node_modules/@earendil-works/chord/dist/sqlite/migrations.js
15
+ /** Apply all pending migrations atomically, tracking their version in the named metadata table. */
16
+ async function applySqliteMigrations(database, migrations, options) {
17
+ const { table } = options;
18
+ validateSqliteSchemaPrefix(table);
19
+ for (let index = 0; index < migrations.length; index++) if (migrations[index]?.version !== index + 1) throw new Error("SQLite migrations must have contiguous versions starting at 1");
20
+ await database.transaction(async (transaction) => {
21
+ await transaction.exec(`CREATE TABLE IF NOT EXISTS ${table} (
22
+ singleton INTEGER PRIMARY KEY CHECK (singleton = 1),
23
+ version INTEGER NOT NULL CHECK (version >= 0)
24
+ ) STRICT`);
25
+ await transaction.run(`INSERT OR IGNORE INTO ${table} (singleton, version) VALUES (1, 0)`);
26
+ const row = await transaction.get(`SELECT version FROM ${table} WHERE singleton = 1`);
27
+ if (row === void 0) throw new Error("SQLite schema metadata is missing");
28
+ const currentVersion = migrations.at(-1)?.version ?? 0;
29
+ if (row.version > currentVersion) throw new Error(`SQLite schema version ${row.version} is newer than supported version ${currentVersion}`);
30
+ for (const migration of migrations) {
31
+ if (migration.version <= row.version) continue;
32
+ for (const statement of migration.statements) await transaction.exec(statement);
33
+ await transaction.run(`UPDATE ${table} SET version = ? WHERE singleton = 1`, migration.version);
34
+ }
35
+ });
36
+ }
37
+ //#endregion
38
+ //#region ../../foundations/po-db/src/services/poDb/index.ts
39
+ /** sqlite names its own automatic indexes `sqlite_autoindex_*`; nobody owns those. */
40
+ const SQLITE_INTERNAL = "sqlite_";
41
+ function assertPrefix(prefix) {
42
+ if (prefix.length > 48 || !PO_DB_PREFIX_PATTERN.test(prefix) || prefix === "sqlite" || prefix.startsWith(SQLITE_INTERNAL)) throw new Error(`Invalid po-db table prefix ${JSON.stringify(prefix)}.`);
43
+ }
44
+ async function schemaNames(executor) {
45
+ const rows = await executor.all("SELECT type, name FROM sqlite_master");
46
+ return new Set(rows.map((row) => `${row.type}\0${row.name}`));
47
+ }
48
+ /**
49
+ * A view of the shared connection that cannot close it.
50
+ *
51
+ * Consumers such as the calendar store call `close()` on the database they were given. One
52
+ * connection serves every package in the process, so only the owning handle may end it.
53
+ */
54
+ function sharedView(database) {
55
+ return {
56
+ exec: (sql) => database.exec(sql),
57
+ run: (sql, ...params) => database.run(sql, ...params),
58
+ runCounted: (sql, ...params) => database.runCounted(sql, ...params),
59
+ get: (sql, ...params) => database.get(sql, ...params),
60
+ all: (sql, ...params) => database.all(sql, ...params),
61
+ transaction: (callback) => database.transaction(callback),
62
+ close: async () => void 0
63
+ };
64
+ }
65
+ /**
66
+ * Runs chord's migrator with every transaction it opens checking the schema it leaves.
67
+ *
68
+ * The check runs inside the migration's own transaction, so a migration that creates an
69
+ * object outside its prefix rolls back with everything else it did.
70
+ */
71
+ function prefixGuarded(database, prefix) {
72
+ const owned = `${prefix}_`;
73
+ return {
74
+ ...sharedView(database),
75
+ transaction: (callback) => database.transaction(async (transaction) => {
76
+ const before = await schemaNames(transaction);
77
+ const result = await callback(transaction);
78
+ for (const entry of await schemaNames(transaction)) {
79
+ if (before.has(entry)) continue;
80
+ const [type, name = ""] = entry.split("\0");
81
+ if (name.startsWith(owned) || name.startsWith(SQLITE_INTERNAL)) continue;
82
+ throw new Error(`po-db migration for ${JSON.stringify(prefix)} created ${type} ${JSON.stringify(name)} outside its prefix.`);
83
+ }
84
+ return result;
85
+ })
86
+ };
87
+ }
88
+ function createPoDb(options) {
89
+ const { database } = options;
90
+ let closing;
91
+ return {
92
+ database: sharedView(database),
93
+ async migrate(prefix, migrations) {
94
+ assertPrefix(prefix);
95
+ await applySqliteMigrations(prefixGuarded(database, prefix), migrations, { table: `${prefix}_migrations` });
96
+ },
97
+ close() {
98
+ closing ??= database.close();
99
+ return closing;
100
+ }
101
+ };
102
+ }
103
+ //#endregion
104
+ //#region ../../foundations/po-db/src/extensions/(backend)/_lib/root.server.ts
105
+ /**
106
+ * The process's one Po database, `<po home>/db/po.sqlite`, bound as `po/db` at the global level.
107
+ *
108
+ * Only a global host with a home directory opens it. Workspaces and sessions resolve the global
109
+ * binding through the server scope, so the process keeps a single connection: a second
110
+ * connection would block the event loop while it waits on the first one's write lock.
111
+ */
112
+ async function createPoDbGlobalRoot(plugin) {
113
+ const host = plugin.host;
114
+ const homeDirectory = host.context.homeDirectory;
115
+ if (host.scope !== "host" || homeDirectory === void 0) return { value: void 0 };
116
+ let handle;
117
+ const provider = plugin.context.inject([
118
+ PO_SERVER_SCOPE_SERVICE,
119
+ PO_FS_SERVICE,
120
+ PO_SQLITE_SERVICE
121
+ ], async (injected) => {
122
+ if (handle === void 0) {
123
+ const directory = path.join(poHomeDirectory(homeDirectory, host.context.environment ?? {}), PO_DB_FILE[0]);
124
+ getOrThrow(await requirePoFs(injected).createDir(directory, { recursive: true }, BACKGROUND_CONTEXT));
125
+ await nodeHost.setMode(directory, 448);
126
+ handle = createPoDb({ database: await requirePoSqlite(injected).open(path.join(directory, PO_DB_FILE[1]), BACKGROUND_CONTEXT) });
127
+ }
128
+ return requirePoServerScope(injected).provide(PO_DB_CONTRACT, handle);
129
+ });
130
+ await provider.await();
131
+ return {
132
+ value: handle,
133
+ onDispose: async () => {
134
+ await provider.dispose();
135
+ await handle?.close();
136
+ }
137
+ };
138
+ }
139
+ //#endregion
140
+ //#region ../../foundations/po-db/src/extensions/(backend)/root.server.ts
141
+ var root_server_default = defineRoot(createPoDbGlobalRoot);
142
+ //#endregion
143
+ //#region ../../foundations/po-db/generated/server.ts
144
+ const serverPlugin = defineServerPlugin({
145
+ name: "@agimon-ai/po-db",
146
+ providerOverrides: composeServerProviderOverrides(root_server_default),
147
+ injects: composeRootInjects({
148
+ host: [root_server_default],
149
+ workspace: [root_server_default],
150
+ session: [root_server_default]
151
+ }),
152
+ host: async (context) => {
153
+ const scopeHost = await context.scopeRoot("host", root_server_default, context);
154
+ return {
155
+ ...composeRootHooks(scopeHost),
156
+ services: [...scopeHost.services ?? []]
157
+ };
158
+ },
159
+ workspace: async (context) => {
160
+ const scopeHost = await context.scopeRoot("host", root_server_default, context);
161
+ return {
162
+ ...composeRootHooks(scopeHost),
163
+ services: [...scopeHost.services ?? []]
164
+ };
165
+ },
166
+ session: async (context) => {
167
+ const scopeHost = await context.scopeRoot("host", root_server_default, context);
168
+ return {
169
+ ...composeRootHooks(scopeHost),
170
+ services: [...scopeHost.services ?? []],
171
+ get activities() {
172
+ return [...scopeHost.activities ?? []];
173
+ }
174
+ };
175
+ }
176
+ });
177
+ //#endregion
178
+ export { serverPlugin as default, serverPlugin };
@@ -0,0 +1,491 @@
1
+ import { Lt as BACKGROUND_CONTEXT, Qt as requirePoFs, ct as getOrThrow, et as piAgentDirectory, it as nodeHost, t as defineServerPlugin } from "./serverPlugin-Cx6a5RT0.js";
2
+ import "./platform-CAhzdBhg.js";
3
+ import "./piSettings-CDcdxob2.js";
4
+ import "./approvalPrompt-D7peArNh.js";
5
+ import { n as defineApiRoutes, t as apiResponse } from "./hubRevisions-BknPawK7.js";
6
+ import { n as readPackageResource } from "./index.edge-CwcYQLj9.js";
7
+ import { t as PO_HELP_WHEN } from "./help-C4aC-kWh.js";
8
+ import { d as defineServerCommand, l as defineRoute, s as defineResource } from "./extensionFile-Bf1PbYVu.js";
9
+ import "./browser-BWf8OMfl.js";
10
+ import { t as Hono } from "./dist-B-vqs6tA.js";
11
+ import "./help-BxTDP41H.js";
12
+ import path from "node:path";
13
+ //#region ../../default/po-prompt/src/constants/promptStore.ts
14
+ const PROMPTS_DIR = "prompts";
15
+ //#endregion
16
+ //#region ../../default/po-prompt/src/constants/savedPromptDocument.ts
17
+ const DESCRIPTION_KEY = "description:";
18
+ const NAME_PATTERN = /^[a-z0-9][a-z0-9-]*$/u;
19
+ const PROMPT_NAME_RULE = "lowercase letters, digits and dashes, starting with a letter or digit";
20
+ //#endregion
21
+ //#region ../../default/po-prompt/src/services/savedPromptDocument/index.ts
22
+ /**
23
+ * The saved prompt document format.
24
+ *
25
+ * DESIGN PATTERNS:
26
+ * - A saved prompt is an ordinary Pi prompt template: YAML frontmatter with a
27
+ * description, then the prompt body verbatim. Reusing that format is why
28
+ * `/<name>` works on the next start without this package registering anything.
29
+ * - Pure string handling. The store owns paths and the filesystem.
30
+ *
31
+ * AVOID:
32
+ * - A richer frontmatter surface. Anything this package invents here stops
33
+ * being a plain template that Pi can already read.
34
+ */
35
+ /** Keeps the picker's second column to one readable line. */
36
+ /** Filename and slash command in one, so the name has to be safe as both. */
37
+ /** Tokens Pi's template engine substitutes when the prompt is invoked. */
38
+ /** The pattern a saved prompt name must match, for user-facing messages. */
39
+ function isValidPromptName(name) {
40
+ return name.length <= 64 && NAME_PATTERN.test(name);
41
+ }
42
+ /** The first non-empty line, shortened for the picker's description column. */
43
+ function describePrompt(text) {
44
+ const firstLine = text.split("\n").map((line) => line.trim()).find((line) => line.length > 0);
45
+ if (!firstLine) return "";
46
+ if (firstLine.length <= 80) return firstLine;
47
+ return `${firstLine.slice(0, 79).trimEnd()}…`;
48
+ }
49
+ /** Quotes the description so a colon or a quote cannot break the frontmatter. */
50
+ function quoteDescription(description) {
51
+ return `"${description.replaceAll(/\s+/gu, " ").trim().replaceAll("\\", "\\\\").replaceAll("\"", "\\\"")}"`;
52
+ }
53
+ function unquoteDescription(value) {
54
+ const trimmed = value.trim();
55
+ if (!trimmed.startsWith("\"") || !trimmed.endsWith("\"") || trimmed.length < 2) return trimmed;
56
+ return trimmed.slice(1, -1).replaceAll("\\\"", "\"").replaceAll("\\\\", "\\");
57
+ }
58
+ function buildPromptDocument(prompt) {
59
+ const body = prompt.text.endsWith("\n") ? prompt.text : `${prompt.text}\n`;
60
+ const description = prompt.description.trim();
61
+ if (!description) return body;
62
+ return [
63
+ "---",
64
+ `description: ${quoteDescription(description)}`,
65
+ "---",
66
+ body
67
+ ].join("\n");
68
+ }
69
+ /**
70
+ * Splits a template back into its description and body.
71
+ *
72
+ * A document without frontmatter, or with frontmatter this package did not
73
+ * write, is still a usable prompt: the whole file becomes the body and the
74
+ * description falls back to the first line.
75
+ */
76
+ function parsePromptDocument(name, content) {
77
+ const normalized = content.replaceAll("\r\n", "\n");
78
+ if (!normalized.startsWith(`---\n`)) return {
79
+ name,
80
+ description: describePrompt(normalized),
81
+ text: normalized.trim()
82
+ };
83
+ const closing = normalized.indexOf(`\n---\n`, 3);
84
+ if (closing === -1) return {
85
+ name,
86
+ description: describePrompt(normalized),
87
+ text: normalized.trim()
88
+ };
89
+ const frontmatter = normalized.slice(4, closing);
90
+ const body = normalized.slice(closing + 3 + 2).trim();
91
+ const descriptionLine = frontmatter.split("\n").find((line) => line.trimStart().startsWith(DESCRIPTION_KEY));
92
+ return {
93
+ name,
94
+ description: descriptionLine ? unquoteDescription(descriptionLine.trimStart().slice(12)) : describePrompt(body),
95
+ text: body
96
+ };
97
+ }
98
+ //#endregion
99
+ //#region ../../default/po-prompt/src/services/fileSystemPromptStore/index.ts
100
+ /**
101
+ * Saved prompts as Pi prompt templates, on whatever filesystem the host admitted.
102
+ *
103
+ * DESIGN PATTERNS:
104
+ * - The only implementation of the store port that the server graph imports. It
105
+ * reaches files through an injected `FileSystem`, never `node:fs`, so the same
106
+ * code runs on Node and in a Worker. The Node entry wraps it in
107
+ * src/services/promptStore.
108
+ * - The environment and the home directory are arguments with no default: this
109
+ * module never reads the process.
110
+ * - Private modes go through `nodeHost`, which applies them on Node and skips
111
+ * them on the edge, where there is no other account to protect against.
112
+ *
113
+ * AVOID:
114
+ * - Turning a read fault into an empty library. Only a missing directory or
115
+ * template is absent; anything else is reported.
116
+ */
117
+ /** A name holds no readable template when the open fails in one of these ways. */
118
+ const ABSENT = /* @__PURE__ */ new Set([
119
+ "not_found",
120
+ "is_directory",
121
+ "invalid"
122
+ ]);
123
+ /** `<agentDir>/prompts`, honouring the override Pi itself reads. */
124
+ function promptsDirectory(environment, homeDirectory) {
125
+ return path.join(piAgentDirectory(environment, homeDirectory), PROMPTS_DIR);
126
+ }
127
+ function createFileSystemSavedPromptStore({ fs, directory }) {
128
+ const filePath = (name) => path.join(directory, `${name}.md`);
129
+ return {
130
+ async list() {
131
+ const listing = await fs.listDir(directory, BACKGROUND_CONTEXT);
132
+ if (!listing.ok && listing.error.code === "not_found") return [];
133
+ const prompts = [];
134
+ const names = getOrThrow(listing).map((entry) => entry.name);
135
+ for (const entry of names.filter((name) => name.endsWith(".md")).sort()) {
136
+ const read = await fs.readTextFile(path.join(directory, entry), BACKGROUND_CONTEXT);
137
+ if (!read.ok && (read.error.code === "not_found" || read.error.code === "is_directory")) continue;
138
+ prompts.push(parsePromptDocument(entry.slice(0, -3), getOrThrow(read)));
139
+ }
140
+ return prompts;
141
+ },
142
+ async has(name) {
143
+ const opened = await fs.openBinaryReader(filePath(name), {}, BACKGROUND_CONTEXT);
144
+ if (!opened.ok && ABSENT.has(opened.error.code)) return false;
145
+ await getOrThrow(opened).close(BACKGROUND_CONTEXT);
146
+ return true;
147
+ },
148
+ async save(prompt) {
149
+ if (!getOrThrow(await fs.exists(directory, BACKGROUND_CONTEXT))) {
150
+ getOrThrow(await fs.createDir(directory, { recursive: true }, BACKGROUND_CONTEXT));
151
+ await nodeHost.setMode(directory, 448);
152
+ }
153
+ const target = filePath(prompt.name);
154
+ const temporary = `${target}.tmp`;
155
+ try {
156
+ getOrThrow(await fs.writeFile(temporary, "", BACKGROUND_CONTEXT));
157
+ await nodeHost.setMode(temporary, 384);
158
+ getOrThrow(await fs.writeFile(temporary, buildPromptDocument(prompt), BACKGROUND_CONTEXT));
159
+ getOrThrow(await fs.renameFile(temporary, target, BACKGROUND_CONTEXT));
160
+ } catch (error) {
161
+ await fs.remove(temporary, { force: true }, BACKGROUND_CONTEXT);
162
+ throw error;
163
+ }
164
+ return {
165
+ name: prompt.name,
166
+ path: target
167
+ };
168
+ },
169
+ async remove(name) {
170
+ const removed = await fs.remove(filePath(name), {}, BACKGROUND_CONTEXT);
171
+ if (!removed.ok && removed.error.code === "not_found") return false;
172
+ getOrThrow(removed);
173
+ return true;
174
+ }
175
+ };
176
+ }
177
+ /**
178
+ * The store for one mounted package, built from what its host admitted: the
179
+ * `po/fs` filesystem, the environment and the home directory.
180
+ *
181
+ * It opens on first use, so a host that lacks one of them still mounts the
182
+ * package and reports the missing capability where it is needed. An absent
183
+ * environment or home is refused rather than replaced by the process's own,
184
+ * which would send the prompts to a directory the host never chose.
185
+ */
186
+ function hostPromptStore({ context, host }) {
187
+ let store;
188
+ const open = () => {
189
+ if (store) return store;
190
+ const { environment, homeDirectory } = host.context;
191
+ if (environment === void 0 || homeDirectory === void 0) throw new Error("Saved prompts need the host-admitted environment and home directory.");
192
+ store = createFileSystemSavedPromptStore({
193
+ fs: requirePoFs(context),
194
+ directory: promptsDirectory(environment, homeDirectory)
195
+ });
196
+ return store;
197
+ };
198
+ return {
199
+ list: async () => open().list(),
200
+ has: async (name) => open().has(name),
201
+ save: async (prompt) => open().save(prompt),
202
+ remove: async (name) => open().remove(name)
203
+ };
204
+ }
205
+ //#endregion
206
+ //#region ../../default/po-prompt/src/constants/promptsApi.ts
207
+ const NAME_PARAM = "name";
208
+ const STATUS = {
209
+ badRequest: 400,
210
+ notFound: 404,
211
+ tooLarge: 413,
212
+ failed: 500
213
+ };
214
+ //#endregion
215
+ //#region ../../default/po-prompt/src/constants/webPrompts.ts
216
+ const API_BASE_PATH = "prompts";
217
+ const PROMPTS_PATH = "/prompts";
218
+ //#endregion
219
+ //#region ../../core/po-core/src/constants/nativeHost.ts
220
+ /**
221
+ * The only modules a native composition may import at runtime.
222
+ *
223
+ * Defined once here. The CLI native build marks exactly these as external and
224
+ * fails on any other bare import, and the po-native shell builds a frozen module
225
+ * map whose keys must equal this list plus the Unistyles component paths.
226
+ */
227
+ /** Bare specifiers the shell provides to every native composition. */
228
+ const NATIVE_HOST_MODULES = [
229
+ "react",
230
+ "react/jsx-runtime",
231
+ "react/jsx-dev-runtime",
232
+ "react-native",
233
+ "react-native-unistyles",
234
+ "@tanstack/store",
235
+ "@agimon-ai/po-core/native",
236
+ "@agimon-ai/po-native-components",
237
+ "@agimon-ai/po-native-components/shell",
238
+ "@agimon-ai/po-native-dashboard",
239
+ "@gorhom/bottom-sheet",
240
+ "expo-symbols",
241
+ "expo-haptics",
242
+ "expo-clipboard",
243
+ "@expo/vector-icons/MaterialIcons",
244
+ "@shopify/flash-list",
245
+ "@react-native-segmented-control/segmented-control",
246
+ "react-native-safe-area-context"
247
+ ];
248
+ /** Prefix of the component imports the Unistyles Babel plugin generates. */
249
+ const NATIVE_UNISTYLES_COMPONENT_PREFIX = "react-native-unistyles/components/native/";
250
+ /**
251
+ * Every component under `components/native/` in react-native-unistyles 3.5.2. The Babel plugin can emit
252
+ * all of them, including `NativeText` and `NativeView` for the `unstable_Native*` aliases.
253
+ */
254
+ const NATIVE_UNISTYLES_COMPONENTS = [
255
+ "ActivityIndicator",
256
+ "Animated",
257
+ "FlatList",
258
+ "Image",
259
+ "ImageBackground",
260
+ "KeyboardAvoidingView",
261
+ "NativeText",
262
+ "NativeView",
263
+ "Pressable",
264
+ "RefreshControl",
265
+ "SafeAreaView",
266
+ "ScrollView",
267
+ "SectionList",
268
+ "Switch",
269
+ "Text",
270
+ "TextInput",
271
+ "TouchableHighlight",
272
+ "TouchableOpacity",
273
+ "View",
274
+ "VirtualizedList"
275
+ ];
276
+ [...NATIVE_HOST_MODULES, ...NATIVE_UNISTYLES_COMPONENTS.map((name) => `${NATIVE_UNISTYLES_COMPONENT_PREFIX}${name}`)];
277
+ //#endregion
278
+ //#region ../../default/po-prompt/src/types/apiRoutes.ts
279
+ /**
280
+ * This package's routes, as data.
281
+ *
282
+ * No scope and no base path. The build reads both off
283
+ * `src/extensions/(backend)/api/prompts/`, so the mount is stated once, by the
284
+ * folder that creates it. This package stated it three times before: a
285
+ * constant, and the literal `prompts` twice more inside a URL builder that also
286
+ * decided, on its own, whether a call was global or session scoped.
287
+ *
288
+ * The Hono app registers these paths and the browser addresses them, so a path
289
+ * cannot move on one side alone.
290
+ *
291
+ * `:name` is Hono's own parameter syntax, because the app registers `path`
292
+ * verbatim, and the client fills it from `params` on the call.
293
+ */
294
+ var apiRoutes_default = defineApiRoutes({
295
+ list: {
296
+ method: "GET",
297
+ path: PROMPTS_PATH,
298
+ response: /* @__PURE__ */ apiResponse()
299
+ },
300
+ save: {
301
+ method: "PUT",
302
+ path: `${PROMPTS_PATH}/:${NAME_PARAM}`,
303
+ response: /* @__PURE__ */ apiResponse()
304
+ },
305
+ /** The same path as `save`; the method is the whole of the difference. */
306
+ remove: {
307
+ method: "DELETE",
308
+ path: `${PROMPTS_PATH}/:${NAME_PARAM}`
309
+ }
310
+ });
311
+ //#endregion
312
+ //#region ../../default/po-prompt/src/services/promptsApi/index.ts
313
+ function toView(prompt) {
314
+ return {
315
+ name: prompt.name,
316
+ description: prompt.description,
317
+ text: prompt.text
318
+ };
319
+ }
320
+ function failureMessage(error) {
321
+ return error instanceof Error ? error.message : "The prompt library could not complete that request.";
322
+ }
323
+ /** Reads `{ text }` out of a request body, or the reason it is unusable. */
324
+ async function readText(request) {
325
+ let payload;
326
+ try {
327
+ payload = await request.json();
328
+ } catch {
329
+ return { error: "The request body must be JSON." };
330
+ }
331
+ const text = payload?.text;
332
+ if (typeof text !== "string" || text.trim().length === 0) return { error: "A non-empty text is required." };
333
+ if (Buffer.byteLength(text, "utf8") > 65536) return { error: "That prompt is too large to save." };
334
+ return { text };
335
+ }
336
+ function createPromptHubApi({ store }) {
337
+ const app = new Hono();
338
+ app.get(apiRoutes_default.list.path, async (context) => {
339
+ try {
340
+ const prompts = await store.list();
341
+ return context.json({ prompts: prompts.map(toView) });
342
+ } catch (error) {
343
+ return context.json({ error: failureMessage(error) }, STATUS.failed);
344
+ }
345
+ });
346
+ app.put(apiRoutes_default.save.path, async (context) => {
347
+ const name = context.req.param(NAME_PARAM);
348
+ if (!isValidPromptName(name)) return context.json({ error: `"${name}" is not a usable prompt name. Use ${PROMPT_NAME_RULE}.` }, STATUS.badRequest);
349
+ const body = await readText(context.req.raw);
350
+ if ("error" in body) {
351
+ const status = body.error.includes("too large") ? STATUS.tooLarge : STATUS.badRequest;
352
+ return context.json({ error: body.error }, status);
353
+ }
354
+ try {
355
+ const replaced = await store.has(name);
356
+ const prompt = {
357
+ name,
358
+ description: describePrompt(body.text),
359
+ text: body.text
360
+ };
361
+ await store.save(prompt);
362
+ return context.json({
363
+ prompt: toView(prompt),
364
+ replaced
365
+ });
366
+ } catch (error) {
367
+ return context.json({ error: failureMessage(error) }, STATUS.failed);
368
+ }
369
+ });
370
+ app.delete(apiRoutes_default.remove.path, async (context) => {
371
+ const name = context.req.param(NAME_PARAM);
372
+ if (!isValidPromptName(name)) return context.json({ error: `"${name}" is not a usable prompt name.` }, STATUS.badRequest);
373
+ try {
374
+ if (!await store.remove(name)) return context.json({ error: `No saved prompt is named "${name}".` }, STATUS.notFound);
375
+ return context.json({ name });
376
+ } catch (error) {
377
+ return context.json({ error: failureMessage(error) }, STATUS.failed);
378
+ }
379
+ });
380
+ return app;
381
+ }
382
+ /** What a host mounts under this package's base path, answering from `store`. */
383
+ function createPromptApi(store) {
384
+ return {
385
+ basePath: API_BASE_PATH,
386
+ start(_context) {
387
+ const app = createPromptHubApi({ store });
388
+ return {
389
+ fetch: (request) => app.fetch(request),
390
+ close: () => void 0
391
+ };
392
+ }
393
+ };
394
+ }
395
+ //#endregion
396
+ //#region ../../default/po-prompt/src/extensions/(backend)/api/prompts/route.server.ts
397
+ /**
398
+ * Mounts this package's HTTP API at `prompts`, which the folder names.
399
+ *
400
+ * The folder is the declaration: the build reads the base path off it and hands
401
+ * the browser a client bound to the same segment, so the mount is stated once
402
+ * rather than in a constant, a URL builder and a story stub that were each free
403
+ * to drift.
404
+ *
405
+ * The API answers from the filesystem, environment and home the host admitted,
406
+ * so the same route runs on the Node hub and inside a Worker.
407
+ */
408
+ var route_server_default = defineRoute((plugin) => createPromptApi(hostPromptStore(plugin)));
409
+ //#endregion
410
+ //#region ../../default/po-prompt/src/constants/prompts.ts
411
+ const COMMAND_NAME = "prompts";
412
+ const SERVER_COMMAND_DESCRIPTION = "List saved prompts or run one by name.";
413
+ //#endregion
414
+ //#region ../../default/po-prompt/src/services/serverPrompts/index.ts
415
+ function createServerPromptCommand(store) {
416
+ return {
417
+ name: COMMAND_NAME,
418
+ description: SERVER_COMMAND_DESCRIPTION,
419
+ async execute(args, execution) {
420
+ const prompts = await store.list();
421
+ const requested = args.trim();
422
+ if (!requested) {
423
+ await execution.client.notify({
424
+ title: "Po prompts",
425
+ body: prompts.map((prompt) => `/${prompt.name}: ${prompt.description}`).join("\n") || "(no saved prompts)",
426
+ level: "info"
427
+ });
428
+ return;
429
+ }
430
+ const prompt = prompts.find((candidate) => candidate.name === requested);
431
+ if (!prompt) {
432
+ await execution.client.notify({
433
+ body: `Saved prompt not found: ${requested}`,
434
+ level: "warning"
435
+ });
436
+ return;
437
+ }
438
+ await execution.session.prompt(prompt.text);
439
+ }
440
+ };
441
+ }
442
+ //#endregion
443
+ //#region ../../default/po-prompt/src/extensions/workspaces/sessions/(backend)/command/prompts.server.ts
444
+ var prompts_server_default$1 = defineServerCommand((plugin) => createServerPromptCommand(hostPromptStore(plugin)));
445
+ //#endregion
446
+ //#region ../../default/po-prompt/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-prompt.server.ts
447
+ var help_how_to_prompt_server_default = defineResource({
448
+ name: "help-how-to-prompt",
449
+ when: PO_HELP_WHEN,
450
+ kind: "skill",
451
+ read: () => readPackageResource("bundle:///po-prompt/src/extensions/workspaces/sessions/(backend)/resource/help-how-to-prompt.server.ts", "src/prompts/help-how-to-prompt/SKILL.md")
452
+ });
453
+ //#endregion
454
+ //#region ../../default/po-prompt/src/extensions/workspaces/sessions/(backend)/resource/prompts.server.ts
455
+ var prompts_server_default = defineResource((plugin) => {
456
+ const store = hostPromptStore(plugin);
457
+ return {
458
+ name: "po/prompts",
459
+ kind: "prompt",
460
+ read: async () => JSON.stringify(await store.list(), null, 2)
461
+ };
462
+ });
463
+ //#endregion
464
+ //#region ../../default/po-prompt/generated/server.ts
465
+ const at = (value, context) => typeof value === "function" ? value(context) : value;
466
+ const via = (identity, value) => value === void 0 ? void 0 : {
467
+ ...identity,
468
+ ...value
469
+ };
470
+ const serverPlugin = defineServerPlugin({
471
+ name: "@agimon-ai/po-prompt",
472
+ host: (context) => ({ get api() {
473
+ return [at(route_server_default, context)];
474
+ } }),
475
+ workspace: (context) => ({ get api() {
476
+ return [at(route_server_default, context)];
477
+ } }),
478
+ session: (context) => ({
479
+ get api() {
480
+ return [at(route_server_default, context)];
481
+ },
482
+ get commands() {
483
+ return [via({ name: "prompts" }, at(prompts_server_default$1, context))];
484
+ },
485
+ get resources() {
486
+ return [at(help_how_to_prompt_server_default, context), at(prompts_server_default, context)];
487
+ }
488
+ })
489
+ });
490
+ //#endregion
491
+ export { serverPlugin as default, serverPlugin };