@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.
- package/README.md +30 -6
- package/container/Dockerfile +27 -0
- package/dist/{BrowserWebSocketTransport-C2SC2VeJ.js → BrowserWebSocketTransport-B4heNdrp.js} +1 -1
- package/dist/{NodeWebSocketTransport-CKilJesa.js → NodeWebSocketTransport-BCiOXUEz.js} +2 -2
- package/dist/{abort-signals-Bkmp_euQ.js → abort-signals-BPGaXWA5.js} +1 -1
- package/dist/agent-COvApaVM.js +3878 -0
- package/dist/{anthropic-messages-CkYm8M3V.js → anthropic-messages-BxS7qXqx.js} +291 -63
- package/dist/apiContracts-BCr_ULWJ.js +1603 -0
- package/dist/{approval-Eu7UgGL-.js → approval-Cg-PCa5M.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-D7peArNh.js} +1 -2
- package/dist/artifactFiles-CbGIbj93.js +1 -0
- package/dist/assets/assets/{CodeEditorView-rEfljuRK.js → CodeEditorView-J2_5q1WT.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-J6Iu5p17.js → abnfDiagram-WEYOIA3C-_gWnN1r-.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DKj_xMR1.js → architecture-WOLXFQ4H-DOEVRwUT.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53--D1MzuBo.js → architectureDiagram-ZHVYKT53-BI3jFrO0.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-CrWO0t-Q.js → blockDiagram-RJAE7QA3-B_PkpROK.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-CBMOJREz.js → c4Diagram-XDPPPE54-DhSjpw5T.js} +2 -2
- package/dist/assets/assets/channel-CVgc46nD.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-CR9NMk46.js → chunk-2E7WHVMD-BrDo2biY.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-B4D0falO.js → chunk-4EMNKR2T-CdlJ35FL.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CKrttFen.js → chunk-55XCU76K-D9eb1FTZ.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-BPNrdjSb.js → chunk-7S6XSTFO-VVyUsBaV.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-Ddx2gPU_.js → chunk-AQDTSKZB-DJmW9j7o.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-iQg3RbZ_.js → chunk-DSNLSHJZ-bQ4kpxiE.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-CGlDRwnk.js → chunk-HAGFOTED-CXTtS6oc.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-CN7VMEsn.js → chunk-HNE4Q36P-CjJ9StOJ.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-DQKmIS4j.js → chunk-NQOKRVIF-CEttWQFT.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-BKSG_d1a.js → chunk-UHW7PFBP-CJZzmAtC.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-AbFHiDOg.js → chunk-VQ5W62QI-Bp76YSjS.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-C5a4DmCb.js → chunk-WQQL4CDK-wm0yUUcN.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-BkEG_5cB.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-UbKezTdY.js → chunk-YZO67HFG-BmXRKyV5.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-BShGGpRc.js → chunk-ZAUX2LTX-DJCmQeWP.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-BmV-PDP0.js → chunk-ZCHMQSOR-D3pxm97L.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-DB-cfBNq.js → classDiagram-v2-4MYWR3UA-DxMxFm6d.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-Dprqh48h.js → cose-bilkent-JH36ORCC-Ck_lCjTR.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-Bz4CND4n.js → cynefin-EF2NZ3EQ-CgjU58bC.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-Cv0Tq-0q.js → cynefinDiagram-WF24UDRP-CUP0NVKn.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-H4d8oeNm.js → dagre-NK4GIZVX-DkvcOoGp.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-D75OthTM.js → diagram-CBK3MWTC-CFl4wUVN.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CB_W2jXU.js → diagram-I5XIIV2D-CldqmFr0.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-DPO0lYZ-.js → diagram-ODIL2UCW-CPieOVfl.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-DJ9olXAC.js → diagram-PFBEJUXE-DgTWsRKS.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-DL3974PI.js → diagram-RJA3I4VV-DmxD5RVL.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-ZuYESp4p.js → diagram-TYUNFSNR-DC_QoE9Q.js} +2 -2
- package/dist/assets/assets/{dist-CeotBqYt.js → dist-BoXKbh_9.js} +2 -2
- package/dist/assets/assets/{dist-CdrEbsAL.js → dist-C-aQ-0ab.js} +2 -2
- package/dist/assets/assets/{dist-CXqaT1wB.js → dist-CHKWIm0j.js} +2 -2
- package/dist/assets/assets/{dist-BnkGKHOV.js → dist-CeZ4Dyeb.js} +2 -2
- package/dist/assets/assets/{dist-C8iSs-hT.js → dist-DtfkqVX-.js} +2 -2
- package/dist/assets/assets/{dist-G3vL_xw7.js → dist-JVpnlOn0.js} +2 -2
- package/dist/assets/assets/{dist-DvCNYjgK.js → dist-L_xVrjFQ.js} +2 -2
- package/dist/assets/assets/{dist-zXhaMKmO.js → dist-_Q_eXWhh.js} +2 -2
- package/dist/assets/assets/{dist-D2iSi_lg.js → dist-m3yHSyxW.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-DNfHKEsm.js → ebnfDiagram-V4P3TTPT-BdrqTmnC.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-C0FX9D60.js → elk-QONTBCTQ-BBnxKz3T.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-BI1O9lW0.js → erDiagram-KYQIGQAA-DX45_hK2.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-BmWt-aOv.js → eventmodeling-K75KTNOO-EIuQjWpD.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-Bdol35Vj.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-pM7PmQ6B.js → ganttDiagram-R7GPNTJY-CveiRngd.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-D0QXMQxv.js → gitGraph-VSP46ZUC-D4yRXN3j.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BsMltgt3.js → gitGraphDiagram-PDYL7XHY-D5DsbgCK.js} +2 -2
- package/dist/assets/assets/index-BDUEIar6.css +1 -0
- package/dist/assets/assets/index-BfW-zJ-Y.js +200 -0
- package/dist/assets/assets/{info-OHQRW6UA-Dp5Eu5PX.js → info-OHQRW6UA-C0PnFIek.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-TgXRfZiq.js → infoDiagram-MVDRKAX5-DpwE-14N.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-Qzrmih4p.js → ishikawaDiagram-HPEHV2GE-X1GxSc7S.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-BksI3QOT.js → journeyDiagram-BOSHW7O7-0cwzSgYT.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-l_IuN5_k.js → kanban-definition-FNSA4HC5-C-U-zp3B.js} +2 -2
- package/dist/assets/assets/{line-BDKssGoM.js → line-CxMWkCyB.js} +2 -2
- package/dist/assets/assets/{linear-C9vmtzBC.js → linear-BpB8rX3C.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-O1yFX7K_.js → mermaid-parser.core-CmAfQFuk.js} +4 -4
- package/dist/assets/assets/{mermaid.core-CIq57361.js → mermaid.core-BTk7Bw6z.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-BkVuZ010.js → mindmap-definition-6OY57UG3-B2sMo2jC.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-PPNcSWeV.js → packet-JDAUHWVQ-BzzVSUon.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-ClwrHXhM.js → pegDiagram-ECIUJNBX-VIiN2lIU.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-BAE4Cy9j.js → pie-XZMESJXO-B-jSi7x9.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CvQ62Knb.js → pieDiagram-GNMPY74T-190bpqyE.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-CzAyT5ZB.js → quadrantDiagram-D57K4MC3-CHsQo88q.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-CoEe8B7b.js → radar-ABXABTNO-CW2EglFo.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-BbK5J8H5.js → railroad-I3PHUGI6-C1b0ftsy.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-DlGngfop.js → railroad-abnf-LNEFI6M7-DTT_CP-y.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-BRk4ifMx.js → railroad-ebnf-DWYD2UWJ-RCPkVVI9.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-Rz-3vbj2.js → railroad-peg-JR7BVNR7-DixVu6c8.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-DQISBRHH.js → railroadDiagram-Y72NRBL7-DbdG32pF.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-DcK4FnTB.js → requirementDiagram-EQYSW5RA-U_x9QFHY.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-N2EXBOYb.js → sankeyDiagram-SY24JHO5-qfiLv1KI.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-CMJ2EqC_.js → sequenceDiagram-BLEHNHQU-DMBomC37.js} +2 -2
- package/dist/assets/assets/{src-Df9VBjd7.js → src-DaNTNLrJ.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-D6Cxm8wj.js → stateDiagram-v2-A6IESKWZ-BgAnpbx_.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-BybuzSPd.js → swimlanes-B3ENRKFQ-Dihe5c6o.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-Cgg-RsbC.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-BzjkWUdz.js → timeline-definition-JXYKGLGB-BISDYTXW.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DIDWwDtU.js → treeView-D4JQ5SDB-DMSWtiHi.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-SWP4JszI.js → treemap-SAJKECNS-0SsdPE-3.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-ZfCxSJdE.js → usecaseDiagram-WPOLBNNX-CY0WaaL_.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-o44wkgGH.js → vennDiagram-Q3Y3IDCW-DXXcHfKI.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-0zKRsI4Z.js → wardley-7MLQ67FV-BzVdmZfO.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CyBVyB40.js → wardleyDiagram-IVAIDKWA-BiDG6ka7.js} +2 -2
- package/dist/assets/assets/{webpack-C4nkEwJD.js → webpack-CUCfmjk-.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-BMvRihYC.js → xychartDiagram-4URNHDU4-DTR1zwTC.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +8 -2
- package/dist/assets/plugins/assets/base-LmdY6uBA.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
- package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-Ka6K4y6i.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -1
- package/dist/assets/plugins/slots/approval.dd60ec90-D_Iw2VJn.js +2 -0
- package/dist/assets/plugins/slots/artifacts.a078f1a5-CS9a_zNA.js +1 -0
- package/dist/assets/plugins/slots/author.497633d0-BFa_H5ZE.js +93 -0
- package/dist/assets/plugins/slots/autocompact.86aeccf4-B0hGnck7.js +1 -0
- package/dist/assets/plugins/slots/browse.5fcf164c-CVRtiGzR.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.0a7f0b8e-CJTf-98P.js +7 -0
- package/dist/assets/plugins/slots/codemode.ff16ac06-BRYQKsyR.js +11 -0
- package/dist/assets/plugins/slots/domain.3ddea842-02QPrhJk.js +1 -0
- package/dist/assets/plugins/slots/edit.c5b0b072-CETRuGf0.js +7 -0
- package/dist/assets/plugins/slots/files.8ffcdcc0-DgGX5poR.js +2 -0
- package/dist/assets/plugins/slots/goal.423c7a26-D67j7FqW.js +1 -0
- package/dist/assets/plugins/slots/grep.95f470b3-CmhMD_DW.js +1 -0
- package/dist/assets/plugins/slots/help.03b9ba99-os14i52k.js +3 -0
- package/dist/assets/plugins/slots/log.19bda339-DvprmzHk.js +4 -0
- package/dist/assets/plugins/slots/mcp.ffbe405a-CcCIF5cJ.js +109 -0
- package/dist/assets/plugins/slots/plan.5eac6563-CqYx6E9R.js +3 -0
- package/dist/assets/plugins/slots/{profile.ab16dcec-Cu6ev2uW.js → profile.176710dd-BDgBh-Su.js} +1 -1
- package/dist/assets/plugins/slots/prompts.2c187969-Bls5s3m1.js +3 -0
- package/dist/assets/plugins/slots/read.1629d556-Bg9NIMAZ.js +1 -0
- package/dist/assets/plugins/slots/runner.962030e5-_04Fb699.js +8 -0
- package/dist/assets/plugins/slots/sessions.fc763f42-BaHBIWGm.js +1 -0
- package/dist/assets/plugins/slots/skill.f5396fde-MNxJbIRc.js +4 -0
- package/dist/assets/plugins/slots/subagents.d815a296-DNYKN2_3.js +7 -0
- package/dist/assets/plugins/slots/vault.57fd9047-C3YDx6j4.js +1 -0
- package/dist/assets/plugins/slots/voice.b709d05c-BT788wX1.js +1 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +4 -4
- package/dist/{atomicJson-DwSqByUJ.js → atomicJson-CU27fWtF.js} +2 -3
- package/dist/{azure-openai-config-DHMgdIa-.js → azure-openai-config-DkmTos8T.js} +2 -2
- package/dist/{azure-openai-responses-CTgRdQ4m.js → azure-openai-responses-sm_U3omr.js} +13 -13
- package/dist/backgroundWork-C3TYOD5X.js +49 -0
- package/dist/browser-BWf8OMfl.js +3 -0
- package/dist/{browser-EJ5_ffnN.js → browser-IsHIcvFg.js} +1 -1
- package/dist/childSession-Cf2-kH4O.js +22 -0
- package/dist/{classifier-shared-jXm-plIK.js → classifier-shared-B7BdEyPa.js} +5 -5
- package/dist/{cloudflare-workers-ai-system-one-B0wH6HU5.js → cloudflare-workers-ai-system-one-DpnCKwVj.js} +3 -3
- package/dist/{codemode-yHAHBZO-.js → codemode-CU_gontV.js} +5 -2
- package/dist/contracts-B_eb2dl9.js +19 -0
- package/dist/contracts-mVtrvUmY.js +40 -0
- package/dist/{diagnostics-DPTP-yrt.js → diagnostics-C43OHsIc.js} +2 -2
- package/dist/{server-y9pjeHJM.js → dist-B-vqs6tA.js} +1 -546
- package/dist/{dist-Dvx5mlIR.js → dist-CLdzaXdw.js} +16 -3
- package/dist/{dist-BVBi6VMV.js → dist-CfOWb6f7.js} +1 -1
- package/dist/{dist-PDDFdqDX.js → dist-Dd6zUvjw.js} +1 -1
- package/dist/edge-accj222e.js +266 -0
- package/dist/{emscripten-module.cloudflare-D4Bc9Ykz.js → emscripten-module.cloudflare-B4fhfquU.js} +1 -1
- package/dist/{env-api-keys-CAnjjnsR.js → env-api-keys-CSPKWgJn.js} +1 -1
- package/dist/{error-body-DQZRsyL5.js → error-body-BvLDKbXN.js} +26 -4
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{exports-CrJqsTU6.js → exports-BlsXYnB_.js} +27 -9
- package/dist/{remoteMcp-Ci8crSU9.js → exports-CHx8bsjQ.js} +1062 -176
- package/dist/exports-CUM-AowA.js +34 -0
- package/dist/extensionFile-Bf1PbYVu.js +121 -0
- package/dist/{factory-Cs8iaUtc.js → factory-DwoANAyi.js} +1 -1
- package/dist/{github-copilot-headers-DpQQAh-s.js → github-copilot-headers-CZIImZmD.js} +1 -1
- package/dist/{google-generative-ai-BTTOo5RQ.js → google-generative-ai-P4ubvgcU.js} +9 -9
- package/dist/{google-shared-S7bqOccz.js → google-shared-C8Kez75I.js} +6 -6
- package/dist/{google-vertex-BcMU_DMb.js → google-vertex-T1trcCEz.js} +10 -10
- package/dist/{domains-dHfk2U8X.js → harnessState-DMini_AN.js} +175 -16
- package/dist/{harnessStore-CRtlTdbI.js → harnessStore-CTomNyVl.js} +4 -5
- package/dist/{hash-B3RRpLS2.js → hash-CMLRVP3c.js} +1 -1
- package/dist/{headers-BEuxFxDI.js → headers-CX-ZuPIi.js} +1 -1
- package/dist/help-BxTDP41H.js +1 -0
- package/dist/help-C4aC-kWh.js +100 -0
- package/dist/http-4lVtjwa7.js +59 -0
- package/dist/{hubChannel-Cj1iF847.js → hubChannel-Bq4zyVgX.js} +12 -29
- package/dist/hubRevisions-BknPawK7.js +364 -0
- package/dist/{identity-BIeAyilV.js → identity-DEwhWpjw.js} +3 -3
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/index.edge-CwcYQLj9.js +70 -0
- package/dist/index.edge-D2RirEwK.js +14 -0
- package/dist/index.edge-Dw11TL5F.js +56 -0
- package/dist/index.edge-DyUqSroq.js +67 -0
- package/dist/index.edge-Ts1NG9b4.js +937 -0
- package/dist/iso-BCXA5x1w.js +10 -0
- package/dist/{kysely-adapter-D51abb3q.js → kysely-adapter-D3TQ9BKb.js} +1 -1
- package/dist/{layeredConfig-BqIwPJ-I.js → layeredConfig-DVe-JMGQ.js} +217 -24
- package/dist/{majorModes-C-OD4PBc.js → majorModes-BBT0wftm.js} +4 -14
- package/dist/majorModes-BcA8pk7t.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-BZoy_uKa.js} +1 -2
- package/dist/{mistral-conversations-DN8VSERk.js → mistral-conversations-jEBsA1Xz.js} +12 -12
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/{models-D6d73jcW.js → models-BoBYu6VI.js} +41 -46
- package/dist/narration-BtGsZwE7.js +127 -0
- package/dist/{node-UuMT2C3q.js → node-CdIUdDAa.js} +2 -2
- package/dist/{node-DytJOfYf.js → node-CjBe953N.js} +2 -2
- package/dist/notification-BHaYyLJJ.js +101 -0
- package/dist/{openai-bt3ZRBZv.js → openai-69NOv-G_.js} +187 -187
- package/dist/{openai-codex-responses-cL36x0ml.js → openai-codex-responses-x01Vnd68.js} +21 -25
- package/dist/{openai-completions-BWsTNYyT.js → openai-completions-B81ryS-E.js} +26 -19
- package/dist/{openai-decisions-Dfn_KgQd.js → openai-decisions-Kybq6lsr.js} +3 -3
- package/dist/{openai-responses-aa0LoyCJ.js → openai-responses-BK5Zz1Ib.js} +17 -15
- package/dist/{openai-responses-shared-H-jH5SlM.js → openai-responses-shared-b4nN_ZS7.js} +7 -7
- package/dist/{openrouter-cost-D99Qqcs6.js → openrouter-cost-C4M4CjUF.js} +1 -1
- package/dist/{openrouter-images-BpwVpALC.js → openrouter-images-DMMiksXo.js} +7 -7
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/{pi-messages-BHAIkYBj.js → pi-messages-D3F6NGQb.js} +6 -6
- package/dist/piConfig-BeRtzEWI.js +126 -0
- package/dist/piSettings-CDcdxob2.js +1 -0
- package/dist/platform-CAhzdBhg.js +113 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-ZOY2-HIL.js +136 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-Db1l1xpe.js} +1 -2
- package/dist/{provider-env-DgfpjgTa.js → provider-env-C6KlbHmf.js} +2 -2
- package/dist/{provider-retry-ChD-K2Gv.js → provider-retry-C8AvzuUi.js} +1 -1
- package/dist/{puppeteer-cloudflare-B-GHrPGO.js → puppeteer-cloudflare-D4l8smMS.js} +3 -3
- package/dist/{rolldown-runtime-B-lAHAz2.js → rolldown-runtime-DbVrKiKs.js} +1 -1
- package/dist/{sanitize-unicode-Dl4ROF7y.js → sanitize-unicode-Di-31Zpn.js} +1 -1
- package/dist/{schemas-Vj8-rCR4.js → schemas-BMBR99Q5.js} +3 -2
- package/dist/server-4R5ZprW5.js +978 -0
- package/dist/server-B0PFs3Yl.js +288 -0
- package/dist/server-B4f5d7ka.js +1811 -0
- package/dist/server-BQ0I9oeZ.js +1359 -0
- package/dist/server-BZ_bk5i9.js +295 -0
- package/dist/{server-CUvohcAm.js → server-Ba7pnDkx.js} +54 -47
- package/dist/server-BayLsR7Z.js +343 -0
- package/dist/{server-BccTx_r6.js → server-BbNo0APc.js} +121 -19
- package/dist/server-Bi9VOAOP.js +833 -0
- package/dist/{server-De_PIOty.js → server-BkmcRLIT.js} +47 -27
- package/dist/{server-DwWTQg1J.js → server-BwtSRROE.js} +14 -5
- package/dist/server-BxzzL3_G.js +1883 -0
- package/dist/{server-CYQHzqaQ.js → server-By1ctEvA.js} +11 -9
- package/dist/server-CA5TuWDo.js +3125 -0
- package/dist/{server-C1ijZQp4.js → server-CBHlRlm4.js} +3 -10
- package/dist/server-CDypk2xJ.js +1296 -0
- package/dist/server-ChlBgWIn.js +1116 -0
- package/dist/server-CkMqSsYi.js +15105 -0
- package/dist/server-CnsLcuj-.js +1518 -0
- package/dist/server-CrqcdtBx.js +178 -0
- package/dist/server-CwlDZ2N-.js +491 -0
- package/dist/server-D3j7dywQ.js +576 -0
- package/dist/server-DXD7cbH0.js +679 -0
- package/dist/server-DesEguVZ.js +640 -0
- package/dist/server-Dqjcc8p0.js +2656 -0
- package/dist/{server-BPvd3Ya5.js → server-DrmY-Chg.js} +570 -127
- package/dist/{server-B2xd7WTP.js → server-DtCOCPGp.js} +9 -20
- package/dist/server-DuAckacI.js +1522 -0
- package/dist/server-EgPpwMaj.js +505 -0
- package/dist/server-h0TSZCjm.js +189 -0
- package/dist/serverPlugin-Cx6a5RT0.js +36624 -0
- package/dist/session-resources-DLg07yAP.js +10 -0
- package/dist/{sessionConfig-2a4LWInR.js → sessionConfig-6NVRcVwL.js} +615 -766
- package/dist/{simple-options-DWrW31_K.js → simple-options-DM-a_ljY.js} +13 -6
- package/dist/{streaming-json-t4rzNHEp.js → streaming-json-Bs_lERVE.js} +6 -6
- package/dist/{system-one-shared-DLVLdzYL.js → system-one-shared-B63vQ3Om.js} +3 -3
- package/dist/{notification-D76PSL7r.js → telemetry-CrTcxeA5.js} +2 -93
- package/dist/{transform-messages-CjTSwW9q.js → transform-messages-Bbr4sgbB.js} +3 -16
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/{server-DrZBZ17y.js → type-CuAiPMD4.js} +569 -1409
- package/dist/type-yokaDI_F.js +7 -0
- package/dist/{typesafe-system-one-DBVcjcUQ.js → typesafe-system-one-7g930h9C.js} +3 -3
- package/dist/{uuid-mkNGilLv.js → uuid-D5Z4Ivdo.js} +1 -1
- package/dist/{validation-D77NZBrx.js → validation-DesEfRe-.js} +8 -3
- package/dist/vaultSettings-BdkqnmJf.js +292 -0
- package/dist/voiceTools-Chad-LEE.js +246 -0
- package/dist/web-QeFwt_Vl.js +3 -0
- package/dist/worker.js +56560 -35339
- package/dist/workflow-BLBCriNp.js +113 -0
- package/package.json +44 -25
- package/wrangler.jsonc +13 -3
- package/dist/apiContracts-CHOiCbS_.js +0 -4451
- package/dist/assets/assets/channel-CNegK3Rr.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-BbVKQGnw.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-DQj3H5a6.js +0 -1
- package/dist/assets/assets/index-BTHzc8EN.js +0 -155
- package/dist/assets/assets/index-DZM68mTk.css +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-CXJkO6sc.js +0 -9
- package/dist/assets/plugins/assets/base-B5jpmLBl.css +0 -2
- package/dist/assets/plugins/chunks/po-web-runtime-D4qQFtJO.js +0 -1
- package/dist/assets/plugins/slots/approval.09e72f36-Cck_K9ex.js +0 -2
- package/dist/assets/plugins/slots/artifacts.50b639bb-BZM7uEbe.js +0 -1
- package/dist/assets/plugins/slots/builtin-tools.75108f21-EWWGTveL.js +0 -7
- package/dist/assets/plugins/slots/codemode.c58fb583-CgfTL6kt.js +0 -9
- package/dist/assets/plugins/slots/domain.753f9f92-BU0ilfwM.js +0 -1
- package/dist/assets/plugins/slots/mcp.82cc1ff5-BaCD2xZB.js +0 -109
- package/dist/assets/plugins/slots/skill.62a0a1b3-Bz20F1eA.js +0 -4
- package/dist/backgroundWork-bE3pc-R9.js +0 -25
- package/dist/build-2gFaVEfG.js +0 -3355
- package/dist/contextProjection-DVP2Vc5j.js +0 -188
- package/dist/extensionFile-CY4EFNHQ.js +0 -409
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-DZ4lDIq6.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-AYZvnOpU.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-CNhm9zLi.js +0 -16
- package/dist/platformFiles-3rzOh9cg.js +0 -39
- package/dist/server-Bf3_VTkt.js +0 -592
- package/dist/server-BmAziQml.js +0 -657
- package/dist/server-BvV-GqDO.js +0 -280
- package/dist/server-xiuzwJ1C.js +0 -118
- package/dist/serverPlugin-H4T49sac.js +0 -3347
- package/dist/value-Djvc2foV.js +0 -2247
|
@@ -1,16 +1,27 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { m as
|
|
5
|
-
import
|
|
6
|
-
import { n as readPackageResource, t as packageResourcePath } from "./index.edge-
|
|
7
|
-
import {
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import "./exports-CrJqsTU6.js";
|
|
12
|
-
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-yHAHBZO-.js";
|
|
1
|
+
import { $t as requirePoSqlite, A as Check, B as Null, J as Optional, Kt as PO_SQLITE_SERVICE, L as Union, Lt as BACKGROUND_CONTEXT, O as PO_CONFIG_SERVICE, Qt as requirePoFs, R as String$1, T as composeServerProviderOverrides, V as Literal, Wt as PO_FS_SERVICE, Y as _Array_, ct as getOrThrow, en as PO_SERVER_SCOPE_SERVICE, h as PoSessionSetupError, it as nodeHost, n as runCleanups, nt as createSerialRunner, p as PoHeadlessPromptAdmissionError, q as _Object_, rn as requirePoServerScope, t as defineServerPlugin, tn as defineServiceContract, tt as poHomeDirectory, v as isPoHeadlessPromptAdmissionError } from "./serverPlugin-Cx6a5RT0.js";
|
|
2
|
+
import { a as pathExists, l as removePath, u as writeFileAtomic } from "./platform-CAhzdBhg.js";
|
|
3
|
+
import "./piSettings-CDcdxob2.js";
|
|
4
|
+
import { c as ProfileCatalogChangedError, d as planGlobalProfileRootAsync, f as inlineProfile, h as PO_PERSON_TIME_ZONE_SERVICE, l as commitGlobalProfileRootAsync, m as parseProfileVaultSecrets, p as parseProfileBinding, u as loadProfilesAsync, v as readPoPersonTimeZone, y as PO_PROFILE_IDENTITY_ENTRY_TYPE } from "./sessionConfig-6NVRcVwL.js";
|
|
5
|
+
import "./exports-BlsXYnB_.js";
|
|
6
|
+
import { n as readPackageResource, t as packageResourcePath } from "./index.edge-CwcYQLj9.js";
|
|
7
|
+
import { s as jsonApiResponses, t as defineApiContract } from "./apiContracts-BCr_ULWJ.js";
|
|
8
|
+
import { a as readPoWorkflowContextService, n as PO_WORKFLOW_PROFILE_ADMISSION_SERVICE } from "./workflow-BLBCriNp.js";
|
|
9
|
+
import { a as defineHook, c as defineRoot, l as defineRoute, n as composeRootInjects, s as defineResource, t as composeRootHooks, u as defineRoutedContribution } from "./extensionFile-Bf1PbYVu.js";
|
|
10
|
+
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-CU_gontV.js";
|
|
13
11
|
import path from "node:path";
|
|
12
|
+
//#region ../../foundations/po-config/src/services/profiles/sync.edge.ts
|
|
13
|
+
function nodeOnly(name, asyncName) {
|
|
14
|
+
throw new Error(`${name} is Node-only; use ${asyncName} with a PoPlatform on the edge.`);
|
|
15
|
+
}
|
|
16
|
+
/** @deprecated Node-only sync shim; use loadProfilesAsync. Removed in M2. */
|
|
17
|
+
function loadProfiles(_repoRoot, _homeDirectory) {
|
|
18
|
+
return nodeOnly("loadProfiles", "loadProfilesAsync");
|
|
19
|
+
}
|
|
20
|
+
/** @deprecated Node-only sync shim; use buildPersonaPromptAsync. Removed in M2. */
|
|
21
|
+
function buildPersonaPrompt(_personaRoot, _personaDirectory) {
|
|
22
|
+
return nodeOnly("buildPersonaPrompt", "buildPersonaPromptAsync");
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
14
25
|
//#region ../../foundations/po-profile/src/constants/profileMemory.ts
|
|
15
26
|
const PROFILE_MEMORY_STORE_SERVICE = "po/profile-memory-store";
|
|
16
27
|
const PROFILE_MEMORY_NAMESPACE_SOURCE = "@agimon-ai/po-profile/memory";
|
|
@@ -428,8 +439,12 @@ var root_server_default$1 = defineRoot(({ host }) => {
|
|
|
428
439
|
services: [async (context) => {
|
|
429
440
|
await context.inject([PO_SERVER_SCOPE_SERVICE], async (scoped) => {
|
|
430
441
|
const scope = requirePoServerScope(scoped);
|
|
431
|
-
await scope.provide(defineServiceContract(PROFILE_SECRETS_SERVICE, { scope: host.scope }), secrets);
|
|
432
|
-
await scope.provide(defineServiceContract(PROFILE_SOURCES_SERVICE, { scope: host.scope }), sources);
|
|
442
|
+
const releaseSecrets = await scope.provide(defineServiceContract(PROFILE_SECRETS_SERVICE, { scope: host.scope }), secrets);
|
|
443
|
+
const releaseSources = await scope.provide(defineServiceContract(PROFILE_SOURCES_SERVICE, { scope: host.scope }), sources);
|
|
444
|
+
return async () => {
|
|
445
|
+
await releaseSources();
|
|
446
|
+
await releaseSecrets();
|
|
447
|
+
};
|
|
433
448
|
});
|
|
434
449
|
}, async (context) => {
|
|
435
450
|
await context.inject([
|
|
@@ -744,6 +759,9 @@ const PROFILE_RUNTIME_SERVICE = "po/profile-runtime";
|
|
|
744
759
|
//#region ../../foundations/po-profile/src/services/profileRuntime/index.ts
|
|
745
760
|
const UNAVAILABLE = "Profile integration provider is unavailable";
|
|
746
761
|
const INVALIDATED = "Profile operation was invalidated";
|
|
762
|
+
/** Vault namespace for secrets saved from the composer; po-vault's `VAULT_SECRETS_NAMESPACE` writes it. */
|
|
763
|
+
const VAULT_SECRETS_NAMESPACE = "secrets";
|
|
764
|
+
const ALIAS_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/u;
|
|
747
765
|
/** A single selected profile and provider, owned by one session, not a provider registry. */
|
|
748
766
|
var SessionProfileRuntime = class {
|
|
749
767
|
options;
|
|
@@ -764,10 +782,14 @@ var SessionProfileRuntime = class {
|
|
|
764
782
|
capture(profileName, generation) {
|
|
765
783
|
const binding = profileName === void 0 ? void 0 : this.options.readBinding(profileName);
|
|
766
784
|
const env = profileName === void 0 ? void 0 : this.options.readEnv?.(profileName);
|
|
785
|
+
const sourceSecrets = profileName === void 0 ? void 0 : this.options.readSecrets?.(profileName);
|
|
786
|
+
const secrets = sourceSecrets === void 0 ? void 0 : parseProfileVaultSecrets(sourceSecrets);
|
|
787
|
+
if (secrets && Object.keys(secrets).some((name) => binding?.secrets && Object.hasOwn(binding.secrets, name))) throw new Error("Profile secret aliases must be unique");
|
|
767
788
|
return Object.freeze({
|
|
768
789
|
...profileName === void 0 ? {} : { profileName },
|
|
769
790
|
...binding === void 0 ? {} : { integration: parseProfileBinding(binding) },
|
|
770
791
|
...env === void 0 ? {} : { env: Object.freeze({ ...env }) },
|
|
792
|
+
...secrets === void 0 ? {} : { secrets },
|
|
771
793
|
generation,
|
|
772
794
|
signal: this.controller.signal
|
|
773
795
|
});
|
|
@@ -883,6 +905,11 @@ var SessionProfileRuntime = class {
|
|
|
883
905
|
if (!reference.allowedOrigins.includes(request.origin)) throw new Error("Profile secret origin is not allowed");
|
|
884
906
|
});
|
|
885
907
|
}
|
|
908
|
+
resolveInputSecret(name, request) {
|
|
909
|
+
return this.resolveReference(name, request.signal, (reference) => {
|
|
910
|
+
if (!reference.purposes.includes("input") || !reference.allowedTargets || !Object.hasOwn(reference.allowedTargets, request.surface) || !reference.allowedTargets[request.surface]?.includes(request.target)) throw new Error("Profile secret input target is not allowed");
|
|
911
|
+
});
|
|
912
|
+
}
|
|
886
913
|
resolveProxySecret(signal) {
|
|
887
914
|
const name = this.snapshot.integration?.browser?.proxySecret;
|
|
888
915
|
if (name === void 0) return Promise.reject(/* @__PURE__ */ new Error("Profile proxy is not configured"));
|
|
@@ -890,26 +917,80 @@ var SessionProfileRuntime = class {
|
|
|
890
917
|
if (!reference.purposes.includes("proxy")) throw new Error("Profile secret alias is unavailable");
|
|
891
918
|
});
|
|
892
919
|
}
|
|
920
|
+
/** Refresh only value-free aliases, never the selected provider or browser identity. */
|
|
921
|
+
currentBinding(snapshot) {
|
|
922
|
+
if (!snapshot.integration || snapshot.profileName === void 0) return void 0;
|
|
923
|
+
let current;
|
|
924
|
+
try {
|
|
925
|
+
current = parseProfileBinding(this.options.readBinding(snapshot.profileName));
|
|
926
|
+
} catch {
|
|
927
|
+
throw new Error(INVALIDATED);
|
|
928
|
+
}
|
|
929
|
+
const selected = snapshot.integration;
|
|
930
|
+
if (current.provider !== selected.provider || current.organizationId !== selected.organizationId || current.mailboxId !== selected.mailboxId || current.credentialRef !== selected.credentialRef) throw new Error(INVALIDATED);
|
|
931
|
+
return current;
|
|
932
|
+
}
|
|
893
933
|
async resolveReference(name, requestSignal, authorize) {
|
|
894
934
|
if (this.initializing) throw new Error("Profile secrets are unavailable during provider initialization");
|
|
895
935
|
await this.ready();
|
|
896
936
|
const snapshot = this.snapshot;
|
|
897
937
|
const connection = this.connection;
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
|
|
938
|
+
const current = this.currentBinding(snapshot);
|
|
939
|
+
const vaultReference = snapshot.secrets && Object.hasOwn(snapshot.secrets, name) ? snapshot.secrets[name] : void 0;
|
|
940
|
+
const providerReference = current?.secrets && Object.hasOwn(current.secrets, name) ? current.secrets[name] : void 0;
|
|
941
|
+
if (vaultReference && providerReference) throw new Error("Profile secret aliases must be unique");
|
|
901
942
|
const signal = requestSignal ? AbortSignal.any([snapshot.signal, requestSignal]) : snapshot.signal;
|
|
943
|
+
const saved = vaultReference || providerReference ? void 0 : await this.savedSecret(name, signal);
|
|
944
|
+
const reference = vaultReference ?? providerReference ?? saved?.reference;
|
|
945
|
+
if (!reference) throw new Error("Profile secret alias is unavailable");
|
|
946
|
+
authorize(reference);
|
|
902
947
|
if (signal.aborted) throw new Error(INVALIDATED);
|
|
903
948
|
let value;
|
|
904
949
|
try {
|
|
905
|
-
value =
|
|
950
|
+
if (saved) value = saved.value;
|
|
951
|
+
else if (vaultReference) {
|
|
952
|
+
if (!this.options.readVault) throw new Error("Vault unavailable");
|
|
953
|
+
const { namespace, key, field } = vaultReference.vault;
|
|
954
|
+
const entry = await this.options.readVault(namespace, key, signal);
|
|
955
|
+
const selected = field === void 0 ? entry : typeof entry === "object" && entry !== null && !Array.isArray(entry) && Object.hasOwn(entry, field) ? entry[field] : void 0;
|
|
956
|
+
if (typeof selected !== "string") throw new Error("Vault field unavailable");
|
|
957
|
+
value = selected;
|
|
958
|
+
} else {
|
|
959
|
+
if (!connection || !providerReference) throw new Error("Provider unavailable");
|
|
960
|
+
value = await connection.resolveSecret(providerReference, signal);
|
|
961
|
+
}
|
|
906
962
|
} catch {
|
|
907
963
|
throw new Error("Profile secret resolution failed");
|
|
908
964
|
}
|
|
909
965
|
if (signal.aborted || this.snapshot !== snapshot || this.connection !== connection) throw new Error(INVALIDATED);
|
|
966
|
+
if (JSON.stringify(this.currentBinding(snapshot)?.secrets[name]) !== JSON.stringify(providerReference)) throw new Error(INVALIDATED);
|
|
910
967
|
if (typeof value !== "string" || value.length === 0) throw new Error("Profile secret field is unavailable");
|
|
911
968
|
return value;
|
|
912
969
|
}
|
|
970
|
+
/** `secrets/<name>` as `{value, purposes, allowedOrigins?, allowedTargets?}`, checked like a profile alias. */
|
|
971
|
+
async savedSecret(name, signal) {
|
|
972
|
+
if (!this.options.readVault || !ALIAS_PATTERN.test(name)) return void 0;
|
|
973
|
+
try {
|
|
974
|
+
const entry = await this.options.readVault(VAULT_SECRETS_NAMESPACE, name, signal);
|
|
975
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return void 0;
|
|
976
|
+
const { value, ...delivery } = entry;
|
|
977
|
+
const vault = {
|
|
978
|
+
namespace: VAULT_SECRETS_NAMESPACE,
|
|
979
|
+
key: name,
|
|
980
|
+
field: "value"
|
|
981
|
+
};
|
|
982
|
+
const reference = parseProfileVaultSecrets({ [name]: {
|
|
983
|
+
...delivery,
|
|
984
|
+
vault
|
|
985
|
+
} }, "Saved secret")[name];
|
|
986
|
+
return reference && {
|
|
987
|
+
reference,
|
|
988
|
+
value
|
|
989
|
+
};
|
|
990
|
+
} catch {
|
|
991
|
+
return;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
913
994
|
dispose() {
|
|
914
995
|
if (this.disposal) return this.disposal;
|
|
915
996
|
this.disposed = true;
|
|
@@ -1048,7 +1129,7 @@ function createProfileServerCommand(host, state, sources, lifetime) {
|
|
|
1048
1129
|
if (signal.aborted) return;
|
|
1049
1130
|
if (requested && !profiles.some(({ name }) => name === requested)) throw new Error(`Unknown profile: ${requested}`);
|
|
1050
1131
|
const profile = requested || void 0;
|
|
1051
|
-
if (profile === execution.selection.profile && host.inspectCapabilities().ready) return;
|
|
1132
|
+
if (profile !== void 0 && profile === execution.selection.profile && host.inspectCapabilities().ready) return;
|
|
1052
1133
|
try {
|
|
1053
1134
|
await host.changeSelection({
|
|
1054
1135
|
axis: "profile",
|
|
@@ -1062,11 +1143,30 @@ function createProfileServerCommand(host, state, sources, lifetime) {
|
|
|
1062
1143
|
}
|
|
1063
1144
|
};
|
|
1064
1145
|
}
|
|
1065
|
-
|
|
1146
|
+
const IDENTITY_MISMATCH = "Profile identity does not match the workflow allocation";
|
|
1147
|
+
/** Value-free comparison of the actual selection to trusted evidence. The stable ref is never compared to credentialRef. */
|
|
1148
|
+
function matchesExpectedIdentity(snapshot, expected) {
|
|
1149
|
+
if (expected.kind === "none") return snapshot === void 0 || snapshot.profileName === void 0;
|
|
1150
|
+
const actual = snapshot?.integration;
|
|
1151
|
+
return snapshot?.profileName === expected.profile && actual?.provider === expected.provider.provider && actual.organizationId === expected.provider.organizationId && actual.mailboxId === expected.provider.mailboxId && actual.credentialRef === expected.provider.credentialRef;
|
|
1152
|
+
}
|
|
1153
|
+
async function assertExpectedIdentity(runtime, expected) {
|
|
1154
|
+
const before = runtime?.readSelection();
|
|
1155
|
+
if (before?.signal.aborted || !matchesExpectedIdentity(before, expected)) throw new Error(IDENTITY_MISMATCH);
|
|
1156
|
+
await runtime?.ready();
|
|
1157
|
+
const after = runtime?.readSelection();
|
|
1158
|
+
if (after?.generation !== before?.generation || after?.signal !== before?.signal || after?.signal.aborted || !matchesExpectedIdentity(after, expected)) throw new Error(IDENTITY_MISMATCH);
|
|
1159
|
+
}
|
|
1160
|
+
/**
|
|
1161
|
+
* Fail-closed admission. With expected workflow evidence, the actual selected profile and provider identity must
|
|
1162
|
+
* match it across ready(); this does not verify remote authorization or content freshness. Without it, only ready().
|
|
1163
|
+
*/
|
|
1164
|
+
async function assertProfileReady(runtime, expected) {
|
|
1066
1165
|
try {
|
|
1067
|
-
await runtime?.ready();
|
|
1166
|
+
if (expected === void 0) await runtime?.ready();
|
|
1167
|
+
else await assertExpectedIdentity(runtime, expected);
|
|
1068
1168
|
} catch (error) {
|
|
1069
|
-
throw new PoHeadlessPromptAdmissionError(error);
|
|
1169
|
+
throw new PoHeadlessPromptAdmissionError(expected === void 0 ? error : /* @__PURE__ */ new Error(IDENTITY_MISMATCH));
|
|
1070
1170
|
}
|
|
1071
1171
|
}
|
|
1072
1172
|
function createProfileIdentityHook(state, sources) {
|
|
@@ -1095,14 +1195,16 @@ function profileSessionState(context) {
|
|
|
1095
1195
|
}
|
|
1096
1196
|
//#endregion
|
|
1097
1197
|
//#region ../../foundations/po-profile/src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
1098
|
-
var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
1198
|
+
var root_server_default = defineRoot(async ({ agent, host, signal, context }) => {
|
|
1099
1199
|
if (!agent) return { value: void 0 };
|
|
1100
1200
|
const execution = agent.context;
|
|
1101
1201
|
const scope = { workspaceId: host.context.workspaceId };
|
|
1102
1202
|
const state = profileSessionState(context);
|
|
1103
|
-
const homeDirectory =
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1203
|
+
const homeDirectory = host.context.homeDirectory ?? execution.environment.HOME;
|
|
1204
|
+
if (!homeDirectory) throw new Error("Profile session requires a host home directory.");
|
|
1205
|
+
const loadFiles = () => loadProfilesAsync(requirePoFs(context), execution.repoRoot, BACKGROUND_CONTEXT, homeDirectory);
|
|
1206
|
+
let files = await loadFiles();
|
|
1207
|
+
const readProfile = (profileName) => findProfile(files, readProfileSources(context, scope), profileName);
|
|
1106
1208
|
const handoff = readInitialProfileOutcome(context);
|
|
1107
1209
|
let publishOutcome;
|
|
1108
1210
|
const applyHandoff = (selection, outcome) => {
|
|
@@ -1112,7 +1214,7 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1112
1214
|
...selection,
|
|
1113
1215
|
profile: void 0
|
|
1114
1216
|
};
|
|
1115
|
-
if (mergeProfiles(
|
|
1217
|
+
if (mergeProfiles(files, readProfileSources(context, scope)).some((profile) => profile.name === name)) return {
|
|
1116
1218
|
...selection,
|
|
1117
1219
|
profile: name
|
|
1118
1220
|
};
|
|
@@ -1130,7 +1232,7 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1130
1232
|
kind: "named",
|
|
1131
1233
|
name: selection.profile
|
|
1132
1234
|
};
|
|
1133
|
-
const outcome = await resolveInitialProfile(
|
|
1235
|
+
const outcome = await resolveInitialProfile(files, readProfileSources(context, scope), {
|
|
1134
1236
|
intent,
|
|
1135
1237
|
scope,
|
|
1136
1238
|
signal
|
|
@@ -1143,13 +1245,34 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1143
1245
|
};
|
|
1144
1246
|
};
|
|
1145
1247
|
const unregisterResolver = agent.registerInitialSelectionResolver((selection) => handoff === void 0 ? resolveStartup(selection) : applyHandoff(selection, handoff));
|
|
1248
|
+
let vaultBinding;
|
|
1146
1249
|
const runtime = createProfileRuntime({
|
|
1147
1250
|
readBinding: (profileName) => readProfile(profileName).integration,
|
|
1148
|
-
readEnv: (profileName) => readProfile(profileName).env
|
|
1251
|
+
readEnv: (profileName) => readProfile(profileName).env,
|
|
1252
|
+
readSecrets: (profileName) => readProfile(profileName).secrets,
|
|
1253
|
+
readVault: async (namespace, key, requestSignal) => {
|
|
1254
|
+
requestSignal.throwIfAborted();
|
|
1255
|
+
const binding = vaultBinding;
|
|
1256
|
+
if (!binding?.active) throw new Error("Profile vault is unavailable");
|
|
1257
|
+
const record = await binding.provider.get(namespace, key);
|
|
1258
|
+
requestSignal.throwIfAborted();
|
|
1259
|
+
if (!binding.active) throw new Error("Profile vault is unavailable");
|
|
1260
|
+
return record?.value;
|
|
1261
|
+
}
|
|
1149
1262
|
});
|
|
1263
|
+
let selectedProfile;
|
|
1264
|
+
let personTimeZone;
|
|
1265
|
+
const publishTimeZone = () => personTimeZone?.setProfile(selectedProfile === void 0 ? void 0 : readProfile(selectedProfile).timezone);
|
|
1150
1266
|
const unsubscribe = agent.subscribeSelection(async (selection, applied) => {
|
|
1151
1267
|
try {
|
|
1152
|
-
|
|
1268
|
+
const force = applied?.refresh?.includes("profile") === true;
|
|
1269
|
+
if (force) {
|
|
1270
|
+
runtime.invalidate();
|
|
1271
|
+
files = await loadFiles();
|
|
1272
|
+
}
|
|
1273
|
+
await runtime.select(selection.profile, { force });
|
|
1274
|
+
selectedProfile = selection.profile;
|
|
1275
|
+
publishTimeZone();
|
|
1153
1276
|
} catch (error) {
|
|
1154
1277
|
throw new PoHeadlessPromptAdmissionError(error);
|
|
1155
1278
|
}
|
|
@@ -1162,6 +1285,31 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1162
1285
|
value: runtime,
|
|
1163
1286
|
services: [
|
|
1164
1287
|
createProfileRuntimePlugin(runtime),
|
|
1288
|
+
(serviceContext) => {
|
|
1289
|
+
serviceContext.provide(PO_WORKFLOW_PROFILE_ADMISSION_SERVICE, { assertReady: (expected) => assertProfileReady(runtime, expected) });
|
|
1290
|
+
},
|
|
1291
|
+
(serviceContext) => {
|
|
1292
|
+
serviceContext.inject(["po/vault"], (injected) => {
|
|
1293
|
+
const binding = {
|
|
1294
|
+
provider: injected.get("po/vault"),
|
|
1295
|
+
active: true
|
|
1296
|
+
};
|
|
1297
|
+
vaultBinding = binding;
|
|
1298
|
+
return () => {
|
|
1299
|
+
binding.active = false;
|
|
1300
|
+
if (vaultBinding === binding) vaultBinding = void 0;
|
|
1301
|
+
};
|
|
1302
|
+
});
|
|
1303
|
+
},
|
|
1304
|
+
(serviceContext) => {
|
|
1305
|
+
serviceContext.inject([PO_PERSON_TIME_ZONE_SERVICE], (injected) => {
|
|
1306
|
+
personTimeZone = readPoPersonTimeZone(injected);
|
|
1307
|
+
publishTimeZone();
|
|
1308
|
+
return () => {
|
|
1309
|
+
personTimeZone = void 0;
|
|
1310
|
+
};
|
|
1311
|
+
});
|
|
1312
|
+
},
|
|
1165
1313
|
(serviceContext) => {
|
|
1166
1314
|
if (handoff !== void 0) return;
|
|
1167
1315
|
serviceContext.provide(PROFILE_INITIAL_OUTCOME_SERVICE, void 0);
|
|
@@ -1194,6 +1342,151 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1194
1342
|
};
|
|
1195
1343
|
});
|
|
1196
1344
|
//#endregion
|
|
1345
|
+
//#region ../../foundations/po-profile/src/constants/personaPresets.ts
|
|
1346
|
+
/** Starting personalities for a personal coordinator agent. `soul` becomes its SOUL.md. */
|
|
1347
|
+
const PERSONA_PRESETS = [
|
|
1348
|
+
{
|
|
1349
|
+
id: "focused",
|
|
1350
|
+
label: "Focused",
|
|
1351
|
+
description: "A precise coding partner that keeps work small and verified.",
|
|
1352
|
+
soul: "You are a focused engineering coordinator.\n\nKeep answers short and concrete. Prefer the smallest change that works, and verify it before calling it done.\n\nSplit larger work into clear tasks and hand them to sessions or subagents when that is faster."
|
|
1353
|
+
},
|
|
1354
|
+
{
|
|
1355
|
+
id: "friendly",
|
|
1356
|
+
label: "Friendly",
|
|
1357
|
+
description: "A warm everyday assistant that explains things plainly.",
|
|
1358
|
+
soul: "You are a friendly personal assistant and coordinator.\n\nSpeak plainly and kindly. Ask one clear question when something is ambiguous, then get on with it.\n\nKeep track of what the person is juggling and offer to take the next step."
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
id: "creative",
|
|
1362
|
+
label: "Creative",
|
|
1363
|
+
description: "A marketing partner that offers fresh angles and options.",
|
|
1364
|
+
soul: "You are a creative marketing coordinator.\n\nOffer a few distinct angles before settling on one. Write in a lively, specific voice and avoid cliches.\n\nTie every idea back to the audience and the goal the person named."
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
id: "persuasive",
|
|
1368
|
+
label: "Persuasive",
|
|
1369
|
+
description: "A sales partner that frames value and drives to the next step.",
|
|
1370
|
+
soul: "You are a persuasive sales coordinator.\n\nLead with the value to the customer, back claims with evidence, and keep messages short.\n\nAlways propose a clear next step, and never promise what cannot be delivered."
|
|
1371
|
+
}
|
|
1372
|
+
];
|
|
1373
|
+
//#endregion
|
|
1374
|
+
//#region ../../foundations/po-profile/src/schemas/apiContracts.ts
|
|
1375
|
+
const ProfileSelectionSchema = _Object_({ profile: Union([Null(), String$1({ minLength: 1 })]) }, { additionalProperties: false });
|
|
1376
|
+
const CreateProfileSchema = _Object_({
|
|
1377
|
+
alias: String$1({ pattern: "^[a-z0-9][a-z0-9-]{0,39}$" }),
|
|
1378
|
+
displayName: String$1({
|
|
1379
|
+
minLength: 1,
|
|
1380
|
+
maxLength: 80
|
|
1381
|
+
}),
|
|
1382
|
+
preset: Union(PERSONA_PRESETS.map(({ id }) => Literal(id))),
|
|
1383
|
+
note: Optional(String$1({ maxLength: 1e3 })),
|
|
1384
|
+
avatarPngBase64: Optional(String$1({
|
|
1385
|
+
minLength: 1,
|
|
1386
|
+
maxLength: 262144
|
|
1387
|
+
}))
|
|
1388
|
+
}, { additionalProperties: false });
|
|
1389
|
+
const CreatedProfileSchema = _Object_({ name: String$1() });
|
|
1390
|
+
const CurrentProfileSchema = _Object_({ profile: Union([Null(), String$1()]) });
|
|
1391
|
+
const ProfileCatalogSchema = _Object_({
|
|
1392
|
+
profiles: _Array_(_Object_({
|
|
1393
|
+
name: String$1(),
|
|
1394
|
+
identity: Optional(_Object_({
|
|
1395
|
+
name: Optional(String$1()),
|
|
1396
|
+
icon: Optional(String$1()),
|
|
1397
|
+
role: Optional(String$1()),
|
|
1398
|
+
contact: Optional(String$1())
|
|
1399
|
+
})),
|
|
1400
|
+
sourceId: String$1()
|
|
1401
|
+
})),
|
|
1402
|
+
readiness: Union([Literal("ready"), Literal("unavailable")])
|
|
1403
|
+
});
|
|
1404
|
+
defineApiContract({
|
|
1405
|
+
version: 1,
|
|
1406
|
+
http: [
|
|
1407
|
+
{
|
|
1408
|
+
id: "profile.create",
|
|
1409
|
+
scope: "host",
|
|
1410
|
+
basePath: "profile",
|
|
1411
|
+
path: "/profiles",
|
|
1412
|
+
method: "POST",
|
|
1413
|
+
authentication: "owner",
|
|
1414
|
+
description: "Create a personal coordinator profile under ~/.po/agents from a persona preset and list that root in ~/.po/profiles.yaml. Answers 200 when it rewrites a coordinator it made earlier under the same alias.",
|
|
1415
|
+
body: {
|
|
1416
|
+
required: true,
|
|
1417
|
+
contentType: "application/json",
|
|
1418
|
+
schema: CreateProfileSchema
|
|
1419
|
+
},
|
|
1420
|
+
responses: {
|
|
1421
|
+
...jsonApiResponses(CreatedProfileSchema),
|
|
1422
|
+
...jsonApiResponses(CreatedProfileSchema, 201)
|
|
1423
|
+
}
|
|
1424
|
+
},
|
|
1425
|
+
{
|
|
1426
|
+
id: "profile.current",
|
|
1427
|
+
scope: "session",
|
|
1428
|
+
basePath: "profile",
|
|
1429
|
+
path: "/current",
|
|
1430
|
+
method: "GET",
|
|
1431
|
+
authentication: "owner",
|
|
1432
|
+
description: "Read the current session selection.",
|
|
1433
|
+
responses: jsonApiResponses(CurrentProfileSchema)
|
|
1434
|
+
},
|
|
1435
|
+
{
|
|
1436
|
+
id: "profile.homeLaunchProfiles",
|
|
1437
|
+
scope: "host",
|
|
1438
|
+
basePath: "profile",
|
|
1439
|
+
path: "/launch-profiles",
|
|
1440
|
+
method: "GET",
|
|
1441
|
+
authentication: "owner",
|
|
1442
|
+
description: "List Home launch profiles from the global catalog, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1443
|
+
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1444
|
+
},
|
|
1445
|
+
{
|
|
1446
|
+
id: "profile.launchProfiles",
|
|
1447
|
+
scope: "workspace",
|
|
1448
|
+
basePath: "profile",
|
|
1449
|
+
path: "/launch-profiles",
|
|
1450
|
+
method: "GET",
|
|
1451
|
+
authentication: "owner",
|
|
1452
|
+
description: "List the profiles a new session in this workspace can start with, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1453
|
+
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1454
|
+
},
|
|
1455
|
+
{
|
|
1456
|
+
id: "profile.profiles",
|
|
1457
|
+
scope: "session",
|
|
1458
|
+
basePath: "profile",
|
|
1459
|
+
path: "/profiles",
|
|
1460
|
+
method: "GET",
|
|
1461
|
+
authentication: "owner",
|
|
1462
|
+
description: "List profiles available to this session, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1463
|
+
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
id: "profile.select",
|
|
1467
|
+
scope: "session",
|
|
1468
|
+
basePath: "profile",
|
|
1469
|
+
path: "/current",
|
|
1470
|
+
method: "PUT",
|
|
1471
|
+
authentication: "owner",
|
|
1472
|
+
description: "Apply a profile at the next tool boundary, or clear it with null. Success means application finished.",
|
|
1473
|
+
body: {
|
|
1474
|
+
required: true,
|
|
1475
|
+
contentType: "application/json",
|
|
1476
|
+
schema: ProfileSelectionSchema
|
|
1477
|
+
},
|
|
1478
|
+
responses: {
|
|
1479
|
+
...jsonApiResponses(CurrentProfileSchema),
|
|
1480
|
+
"400": { description: "Invalid profile selection." },
|
|
1481
|
+
"404": { description: "Unknown profile." },
|
|
1482
|
+
"503": { description: "Sources or integration unavailable; never automatically replay this write." }
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
],
|
|
1486
|
+
sockets: [],
|
|
1487
|
+
dynamic: []
|
|
1488
|
+
});
|
|
1489
|
+
//#endregion
|
|
1197
1490
|
//#region ../../foundations/po-profile/src/services/launchProfiles/type.ts
|
|
1198
1491
|
/** The source id every profile read from a `profiles.yaml` carries. */
|
|
1199
1492
|
const FILE_PROFILE_SOURCE_ID = "files";
|
|
@@ -1241,6 +1534,212 @@ async function listLaunchProfiles(input) {
|
|
|
1241
1534
|
};
|
|
1242
1535
|
}
|
|
1243
1536
|
//#endregion
|
|
1537
|
+
//#region ../../foundations/po-profile/src/services/profileCreation/type.ts
|
|
1538
|
+
/** A refusal with the HTTP status that describes it. Messages never echo request values. */
|
|
1539
|
+
var ProfileCreationError = class extends Error {
|
|
1540
|
+
status;
|
|
1541
|
+
constructor(status, message) {
|
|
1542
|
+
super(message);
|
|
1543
|
+
this.status = status;
|
|
1544
|
+
this.name = "ProfileCreationError";
|
|
1545
|
+
}
|
|
1546
|
+
};
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region ../../foundations/po-profile/src/services/profileCreation/index.ts
|
|
1549
|
+
const AGENTS_ROOT = "agents";
|
|
1550
|
+
const AVATAR_FILE = "avatar.png";
|
|
1551
|
+
const COORDINATOR_ROLE = "coordinator";
|
|
1552
|
+
const NOTES_HEADING = "## Notes from the person";
|
|
1553
|
+
const BASE64_PATTERN = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
1554
|
+
const DATA_URL_PREFIX = /^data:[a-z]+\/[a-z0-9.+-]+;base64,/i;
|
|
1555
|
+
const INVALID_AVATAR = "Avatar must be a PNG, JPEG, GIF or WebP image of at most 256 KiB";
|
|
1556
|
+
const startsWith = (bytes, offset, expected) => {
|
|
1557
|
+
const values = typeof expected === "string" ? Array.from({ length: expected.length }, (_, index) => expected.charCodeAt(index)) : expected;
|
|
1558
|
+
return bytes.length >= offset + values.length && values.every((value, index) => bytes[offset + index] === value);
|
|
1559
|
+
};
|
|
1560
|
+
/** Magic bytes, never the declared type. SVG has no entry: it executes script when the cockpit renders it. */
|
|
1561
|
+
const SIGNATURES = [
|
|
1562
|
+
{
|
|
1563
|
+
mime: "image/png",
|
|
1564
|
+
test: (bytes) => startsWith(bytes, 0, [
|
|
1565
|
+
137,
|
|
1566
|
+
80,
|
|
1567
|
+
78,
|
|
1568
|
+
71,
|
|
1569
|
+
13,
|
|
1570
|
+
10,
|
|
1571
|
+
26,
|
|
1572
|
+
10
|
|
1573
|
+
])
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
mime: "image/jpeg",
|
|
1577
|
+
test: (bytes) => startsWith(bytes, 0, [
|
|
1578
|
+
255,
|
|
1579
|
+
216,
|
|
1580
|
+
255
|
|
1581
|
+
])
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
mime: "image/gif",
|
|
1585
|
+
test: (bytes) => startsWith(bytes, 0, "GIF8")
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
mime: "image/webp",
|
|
1589
|
+
test: (bytes) => startsWith(bytes, 0, "RIFF") && startsWith(bytes, 8, "WEBP")
|
|
1590
|
+
}
|
|
1591
|
+
];
|
|
1592
|
+
/** Decoded avatar bytes the profile loader will keep: an allowed image within its data URL bound. */
|
|
1593
|
+
function avatarBytes(encoded) {
|
|
1594
|
+
const base64 = encoded.replace(DATA_URL_PREFIX, "").replace(/\s/g, "");
|
|
1595
|
+
if (!BASE64_PATTERN.test(base64)) throw new ProfileCreationError(422, INVALID_AVATAR);
|
|
1596
|
+
let bytes;
|
|
1597
|
+
try {
|
|
1598
|
+
bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
|
|
1599
|
+
} catch {
|
|
1600
|
+
throw new ProfileCreationError(422, INVALID_AVATAR);
|
|
1601
|
+
}
|
|
1602
|
+
const mime = SIGNATURES.find((signature) => signature.test(bytes))?.mime;
|
|
1603
|
+
const dataUrlLength = `data:${mime};base64,`.length + Math.ceil(bytes.length / 3) * 4;
|
|
1604
|
+
if (!mime || dataUrlLength > 262144) throw new ProfileCreationError(422, INVALID_AVATAR);
|
|
1605
|
+
return bytes;
|
|
1606
|
+
}
|
|
1607
|
+
function profileMarkdown(displayName, hasAvatar) {
|
|
1608
|
+
return [
|
|
1609
|
+
"---",
|
|
1610
|
+
`name: ${JSON.stringify(displayName)}`,
|
|
1611
|
+
...hasAvatar ? [`icon: ${AVATAR_FILE}`] : [],
|
|
1612
|
+
`role: ${COORDINATOR_ROLE}`,
|
|
1613
|
+
"---",
|
|
1614
|
+
""
|
|
1615
|
+
].join("\n");
|
|
1616
|
+
}
|
|
1617
|
+
function soulMarkdown(soul, note) {
|
|
1618
|
+
return note ? `${soul}\n\n${NOTES_HEADING}\n\n${note}\n` : `${soul}\n`;
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Creates `~/.po/agents/<alias>` from a preset and makes sure `~/.po/profiles.yaml` lists `agents`.
|
|
1622
|
+
* A coordinator this endpoint made earlier under that alias is rewritten with the new choices, so a person who
|
|
1623
|
+
* restarts onboarding can keep their agent's name; any other profile owning the alias still refuses.
|
|
1624
|
+
*
|
|
1625
|
+
* The profiles.yaml change is planned first, so an invalid file stops before anything is written, and committed
|
|
1626
|
+
* last against the text it was computed from: a concurrent edit removes the new persona again and refuses.
|
|
1627
|
+
*/
|
|
1628
|
+
async function createPersonaProfile(dependencies, request) {
|
|
1629
|
+
const { fs, homeDirectory, context } = dependencies;
|
|
1630
|
+
const displayName = request.displayName.trim();
|
|
1631
|
+
if (!displayName) throw new ProfileCreationError(422, "Display name is required");
|
|
1632
|
+
const preset = PERSONA_PRESETS.find(({ id }) => id === request.preset);
|
|
1633
|
+
if (!preset) throw new ProfileCreationError(422, "Unknown persona preset");
|
|
1634
|
+
const avatar = request.avatarPngBase64 === void 0 ? void 0 : avatarBytes(request.avatarPngBase64);
|
|
1635
|
+
let plan;
|
|
1636
|
+
let profiles;
|
|
1637
|
+
try {
|
|
1638
|
+
plan = await planGlobalProfileRootAsync(fs, homeDirectory, AGENTS_ROOT, context);
|
|
1639
|
+
profiles = await loadProfilesAsync(fs, path.dirname(plan.filePath), context, homeDirectory);
|
|
1640
|
+
} catch {
|
|
1641
|
+
throw new ProfileCreationError(500, "Profile configuration is unavailable");
|
|
1642
|
+
}
|
|
1643
|
+
const personaDirectory = path.join(path.dirname(plan.filePath), AGENTS_ROOT, request.alias);
|
|
1644
|
+
const existing = profiles.find(({ name }) => name === request.alias);
|
|
1645
|
+
const updated = existing?.identity?.role === COORDINATOR_ROLE && path.resolve(existing.personaRoot, existing.persona) === personaDirectory;
|
|
1646
|
+
if (!updated && (existing || await pathExists(fs, personaDirectory, context))) throw new ProfileCreationError(409, "Profile alias is taken");
|
|
1647
|
+
try {
|
|
1648
|
+
if (avatar) await writeFileAtomic(fs, path.join(personaDirectory, AVATAR_FILE), avatar, context);
|
|
1649
|
+
await writeFileAtomic(fs, path.join(personaDirectory, "SOUL.md"), soulMarkdown(preset.soul, request.note?.trim()), context);
|
|
1650
|
+
await writeFileAtomic(fs, path.join(personaDirectory, "profile.md"), profileMarkdown(displayName, avatar !== void 0), context);
|
|
1651
|
+
await commitGlobalProfileRootAsync(fs, plan, context);
|
|
1652
|
+
} catch (error) {
|
|
1653
|
+
if (!updated) await removePath(fs, personaDirectory, context);
|
|
1654
|
+
if (error instanceof ProfileCatalogChangedError) throw new ProfileCreationError(409, "Profile configuration changed. Try again.");
|
|
1655
|
+
throw error;
|
|
1656
|
+
}
|
|
1657
|
+
return {
|
|
1658
|
+
name: request.alias,
|
|
1659
|
+
updated
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
//#endregion
|
|
1663
|
+
//#region ../../foundations/po-profile/src/extensions/(backend)/api/profile/route.server.ts
|
|
1664
|
+
const PROFILES_PATH = "/profiles";
|
|
1665
|
+
const LAUNCH_PROFILES_PATH$1 = "/launch-profiles";
|
|
1666
|
+
/**
|
|
1667
|
+
* Lists Home launch profiles and creates a personal coordinator profile. Global mount only: workspaces and sessions already own `profile`.
|
|
1668
|
+
* Creations run one at a time, so two requests cannot both claim one alias.
|
|
1669
|
+
*/
|
|
1670
|
+
var route_server_default$2 = defineRoutedContribution(({ context, host, signal }) => {
|
|
1671
|
+
if (host.scope !== "host") return void 0;
|
|
1672
|
+
let fs;
|
|
1673
|
+
context.inject([PO_FS_SERVICE], (scoped) => {
|
|
1674
|
+
const bound = requirePoFs(scoped);
|
|
1675
|
+
fs = bound;
|
|
1676
|
+
return () => {
|
|
1677
|
+
if (fs === bound) fs = void 0;
|
|
1678
|
+
};
|
|
1679
|
+
});
|
|
1680
|
+
return {
|
|
1681
|
+
basePath: "profile",
|
|
1682
|
+
start: (api) => {
|
|
1683
|
+
const creations = createSerialRunner();
|
|
1684
|
+
const create = async (request) => {
|
|
1685
|
+
let body;
|
|
1686
|
+
try {
|
|
1687
|
+
body = await request.json();
|
|
1688
|
+
} catch {
|
|
1689
|
+
return Response.json({ error: "Invalid profile" }, { status: 400 });
|
|
1690
|
+
}
|
|
1691
|
+
if (!Check(CreateProfileSchema, body)) return Response.json({ error: "Invalid profile" }, { status: 400 });
|
|
1692
|
+
const homeDirectory = api.homeDirectory ?? host.context.homeDirectory;
|
|
1693
|
+
if (!fs || !homeDirectory) return Response.json({ error: "Profile storage unavailable" }, { status: 503 });
|
|
1694
|
+
try {
|
|
1695
|
+
const { name, updated } = await createPersonaProfile({
|
|
1696
|
+
fs,
|
|
1697
|
+
homeDirectory,
|
|
1698
|
+
context: BACKGROUND_CONTEXT
|
|
1699
|
+
}, body);
|
|
1700
|
+
return Response.json({ name }, { status: updated ? 200 : 201 });
|
|
1701
|
+
} catch (error) {
|
|
1702
|
+
if (error instanceof ProfileCreationError) return Response.json({ error: error.message }, { status: error.status });
|
|
1703
|
+
throw error;
|
|
1704
|
+
}
|
|
1705
|
+
};
|
|
1706
|
+
return {
|
|
1707
|
+
async fetch(request) {
|
|
1708
|
+
const pathname = new URL(request.url).pathname;
|
|
1709
|
+
if (pathname === LAUNCH_PROFILES_PATH$1) {
|
|
1710
|
+
if (request.method !== "GET") return Response.json({ error: "Method not allowed" }, {
|
|
1711
|
+
status: 405,
|
|
1712
|
+
headers: { Allow: "GET" }
|
|
1713
|
+
});
|
|
1714
|
+
const homeDirectory = api.homeDirectory ?? host.context.homeDirectory;
|
|
1715
|
+
if (!fs || !homeDirectory) return Response.json({ error: "Profile storage unavailable" }, { status: 503 });
|
|
1716
|
+
let files;
|
|
1717
|
+
try {
|
|
1718
|
+
const root = poHomeDirectory(homeDirectory, host.context.environment);
|
|
1719
|
+
files = await loadProfilesAsync(fs, root, BACKGROUND_CONTEXT, homeDirectory);
|
|
1720
|
+
} catch {
|
|
1721
|
+
return Response.json({ error: "Profile configuration is unavailable" }, { status: 500 });
|
|
1722
|
+
}
|
|
1723
|
+
return Response.json(await listLaunchProfiles({
|
|
1724
|
+
files,
|
|
1725
|
+
sources: readProfileSources(context),
|
|
1726
|
+
scope: {},
|
|
1727
|
+
signal: AbortSignal.any([request.signal, signal])
|
|
1728
|
+
}));
|
|
1729
|
+
}
|
|
1730
|
+
if (pathname !== PROFILES_PATH) return Response.json({ error: "Not found" }, { status: 404 });
|
|
1731
|
+
if (request.method !== "POST") return Response.json({ error: "Method not allowed" }, {
|
|
1732
|
+
status: 405,
|
|
1733
|
+
headers: { Allow: "POST" }
|
|
1734
|
+
});
|
|
1735
|
+
return creations(() => create(request));
|
|
1736
|
+
},
|
|
1737
|
+
close() {}
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
};
|
|
1741
|
+
}, { cardinality: "optional" });
|
|
1742
|
+
//#endregion
|
|
1244
1743
|
//#region ../../foundations/po-profile/src/extensions/workspaces/(backend)/api/profile/route.server.ts
|
|
1245
1744
|
const LAUNCH_PROFILES_PATH = "/launch-profiles";
|
|
1246
1745
|
/** What a launcher may offer before any session exists: names and display data only. */
|
|
@@ -1274,80 +1773,6 @@ var route_server_default$1 = defineRoute(({ context, signal }) => ({
|
|
|
1274
1773
|
})
|
|
1275
1774
|
}));
|
|
1276
1775
|
//#endregion
|
|
1277
|
-
//#region ../../foundations/po-profile/src/schemas/apiContracts.ts
|
|
1278
|
-
const ProfileSelectionSchema = _Object_({ profile: Union([Null(), String$1({ minLength: 1 })]) }, { additionalProperties: false });
|
|
1279
|
-
const CurrentProfileSchema = _Object_({ profile: Union([Null(), String$1()]) });
|
|
1280
|
-
const ProfileCatalogSchema = _Object_({
|
|
1281
|
-
profiles: _Array_(_Object_({
|
|
1282
|
-
name: String$1(),
|
|
1283
|
-
identity: Optional(_Object_({
|
|
1284
|
-
name: Optional(String$1()),
|
|
1285
|
-
icon: Optional(String$1()),
|
|
1286
|
-
role: Optional(String$1()),
|
|
1287
|
-
contact: Optional(String$1())
|
|
1288
|
-
})),
|
|
1289
|
-
sourceId: String$1()
|
|
1290
|
-
})),
|
|
1291
|
-
readiness: Union([Literal("ready"), Literal("unavailable")])
|
|
1292
|
-
});
|
|
1293
|
-
defineApiContract({
|
|
1294
|
-
version: 1,
|
|
1295
|
-
http: [
|
|
1296
|
-
{
|
|
1297
|
-
id: "profile.current",
|
|
1298
|
-
scope: "session",
|
|
1299
|
-
basePath: "profile",
|
|
1300
|
-
path: "/current",
|
|
1301
|
-
method: "GET",
|
|
1302
|
-
authentication: "owner",
|
|
1303
|
-
description: "Read the current session selection.",
|
|
1304
|
-
responses: jsonApiResponses(CurrentProfileSchema)
|
|
1305
|
-
},
|
|
1306
|
-
{
|
|
1307
|
-
id: "profile.launchProfiles",
|
|
1308
|
-
scope: "workspace",
|
|
1309
|
-
basePath: "profile",
|
|
1310
|
-
path: "/launch-profiles",
|
|
1311
|
-
method: "GET",
|
|
1312
|
-
authentication: "owner",
|
|
1313
|
-
description: "List the profiles a new session in this workspace can start with, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1314
|
-
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1315
|
-
},
|
|
1316
|
-
{
|
|
1317
|
-
id: "profile.profiles",
|
|
1318
|
-
scope: "session",
|
|
1319
|
-
basePath: "profile",
|
|
1320
|
-
path: "/profiles",
|
|
1321
|
-
method: "GET",
|
|
1322
|
-
authentication: "owner",
|
|
1323
|
-
description: "List profiles available to this session, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1324
|
-
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1325
|
-
},
|
|
1326
|
-
{
|
|
1327
|
-
id: "profile.select",
|
|
1328
|
-
scope: "session",
|
|
1329
|
-
basePath: "profile",
|
|
1330
|
-
path: "/current",
|
|
1331
|
-
method: "PUT",
|
|
1332
|
-
authentication: "owner",
|
|
1333
|
-
description: "Apply a profile at the next tool boundary, or clear it with null. Success means application finished.",
|
|
1334
|
-
body: {
|
|
1335
|
-
required: true,
|
|
1336
|
-
contentType: "application/json",
|
|
1337
|
-
schema: ProfileSelectionSchema
|
|
1338
|
-
},
|
|
1339
|
-
responses: {
|
|
1340
|
-
...jsonApiResponses(CurrentProfileSchema),
|
|
1341
|
-
"400": { description: "Invalid profile selection." },
|
|
1342
|
-
"404": { description: "Unknown profile." },
|
|
1343
|
-
"503": { description: "Sources or integration unavailable; never automatically replay this write." }
|
|
1344
|
-
}
|
|
1345
|
-
}
|
|
1346
|
-
],
|
|
1347
|
-
sockets: [],
|
|
1348
|
-
dynamic: []
|
|
1349
|
-
});
|
|
1350
|
-
//#endregion
|
|
1351
1776
|
//#region ../../foundations/po-profile/src/extensions/workspaces/sessions/(backend)/_lib/profileApi.ts
|
|
1352
1777
|
/** Session roots may differ from the workspace launcher's root. Only display data leaves the host. */
|
|
1353
1778
|
async function listSessionProfiles(input) {
|
|
@@ -1387,7 +1812,7 @@ async function selectSessionProfile(input, request) {
|
|
|
1387
1812
|
}
|
|
1388
1813
|
}
|
|
1389
1814
|
signal.throwIfAborted();
|
|
1390
|
-
if (profile !== agent.context.selection.profile || !agent.inspectCapabilities().ready) try {
|
|
1815
|
+
if (profile === void 0 || profile !== agent.context.selection.profile || !agent.inspectCapabilities().ready) try {
|
|
1391
1816
|
await agent.changeSelection({
|
|
1392
1817
|
axis: "profile",
|
|
1393
1818
|
profile
|
|
@@ -1600,6 +2025,17 @@ function createProfileMemoryExtraction(options) {
|
|
|
1600
2025
|
//#region ../../foundations/po-profile/src/extensions/workspaces/sessions/(backend)/hook/agentSettled.server.ts
|
|
1601
2026
|
var agentSettled_server_default = defineHook(({ root, context }) => {
|
|
1602
2027
|
let extraction;
|
|
2028
|
+
let config;
|
|
2029
|
+
context.inject([PO_CONFIG_SERVICE], (scoped) => {
|
|
2030
|
+
const binding = scoped.get(PO_CONFIG_SERVICE);
|
|
2031
|
+
config = binding;
|
|
2032
|
+
return () => {
|
|
2033
|
+
if (config !== binding) return;
|
|
2034
|
+
config = void 0;
|
|
2035
|
+
extraction?.dispose();
|
|
2036
|
+
extraction = void 0;
|
|
2037
|
+
};
|
|
2038
|
+
});
|
|
1603
2039
|
return {
|
|
1604
2040
|
event: "agent_settled",
|
|
1605
2041
|
handle(_event, execution) {
|
|
@@ -1607,7 +2043,7 @@ var agentSettled_server_default = defineHook(({ root, context }) => {
|
|
|
1607
2043
|
extraction ??= createProfileMemoryExtraction({
|
|
1608
2044
|
store: requireProfileMemoryStore(context),
|
|
1609
2045
|
runtime: root,
|
|
1610
|
-
automatic: () =>
|
|
2046
|
+
automatic: () => config?.getSnapshot().settings.profileMemory?.automatic === true,
|
|
1611
2047
|
onError: (error, failed) => failed.client.setStatus(EXTRACTION_STATUS_SOURCE, `Memory extraction failed: ${error instanceof Error ? error.message : String(error)}`)
|
|
1612
2048
|
});
|
|
1613
2049
|
extraction.settle(execution);
|
|
@@ -1616,8 +2052,8 @@ var agentSettled_server_default = defineHook(({ root, context }) => {
|
|
|
1616
2052
|
});
|
|
1617
2053
|
//#endregion
|
|
1618
2054
|
//#region ../../foundations/po-profile/src/extensions/workspaces/sessions/(backend)/hook/beforeAgentStart.server.ts
|
|
1619
|
-
var beforeAgentStart_server_default = defineHook(({ root }) => ({ async handle() {
|
|
1620
|
-
await assertProfileReady(root);
|
|
2055
|
+
var beforeAgentStart_server_default = defineHook(({ root, context }) => ({ async handle() {
|
|
2056
|
+
await assertProfileReady(root, readPoWorkflowContextService(context)?.identity);
|
|
1621
2057
|
} }));
|
|
1622
2058
|
//#endregion
|
|
1623
2059
|
//#region ../../foundations/po-profile/src/extensions/workspaces/sessions/(backend)/hook/sessionStart.server.ts
|
|
@@ -1677,44 +2113,51 @@ const serverPlugin = defineServerPlugin({
|
|
|
1677
2113
|
name: "@agimon-ai/po-profile",
|
|
1678
2114
|
providerOverrides: composeServerProviderOverrides(root_server_default$1, root_server_default),
|
|
1679
2115
|
injects: composeRootInjects({
|
|
1680
|
-
|
|
2116
|
+
host: [root_server_default$1],
|
|
1681
2117
|
workspace: [root_server_default$1],
|
|
1682
2118
|
session: [root_server_default$1, root_server_default]
|
|
1683
2119
|
}),
|
|
1684
|
-
|
|
1685
|
-
const
|
|
2120
|
+
host: async (context) => {
|
|
2121
|
+
const scopeHost = await context.scopeRoot("host", root_server_default$1, context);
|
|
2122
|
+
const contextHost = {
|
|
2123
|
+
...context,
|
|
2124
|
+
root: scopeHost.value
|
|
2125
|
+
};
|
|
1686
2126
|
return {
|
|
1687
|
-
...composeRootHooks(
|
|
1688
|
-
|
|
2127
|
+
...composeRootHooks(scopeHost),
|
|
2128
|
+
get api() {
|
|
2129
|
+
return defined([at(route_server_default$2, contextHost)]);
|
|
2130
|
+
},
|
|
2131
|
+
services: [...scopeHost.services ?? []]
|
|
1689
2132
|
};
|
|
1690
2133
|
},
|
|
1691
2134
|
workspace: async (context) => {
|
|
1692
|
-
const
|
|
1693
|
-
const
|
|
2135
|
+
const scopeHost = await context.scopeRoot("host", root_server_default$1, context);
|
|
2136
|
+
const contextHost = {
|
|
1694
2137
|
...context,
|
|
1695
|
-
root:
|
|
2138
|
+
root: scopeHost.value
|
|
1696
2139
|
};
|
|
1697
2140
|
return {
|
|
1698
|
-
...composeRootHooks(
|
|
2141
|
+
...composeRootHooks(scopeHost),
|
|
1699
2142
|
get api() {
|
|
1700
|
-
return [at(route_server_default$1,
|
|
2143
|
+
return [at(route_server_default$1, contextHost)];
|
|
1701
2144
|
},
|
|
1702
|
-
services: [...
|
|
2145
|
+
services: [...scopeHost.services ?? []]
|
|
1703
2146
|
};
|
|
1704
2147
|
},
|
|
1705
2148
|
session: async (context) => {
|
|
1706
|
-
const
|
|
1707
|
-
const
|
|
2149
|
+
const scopeHost = await context.scopeRoot("host", root_server_default$1, context);
|
|
2150
|
+
const contextHost = {
|
|
1708
2151
|
...context,
|
|
1709
|
-
root:
|
|
2152
|
+
root: scopeHost.value
|
|
1710
2153
|
};
|
|
1711
|
-
const scopeSession = await context.scopeRoot("session", root_server_default,
|
|
2154
|
+
const scopeSession = await context.scopeRoot("session", root_server_default, contextHost);
|
|
1712
2155
|
const contextSession = {
|
|
1713
|
-
...
|
|
2156
|
+
...contextHost,
|
|
1714
2157
|
root: scopeSession.value
|
|
1715
2158
|
};
|
|
1716
2159
|
return {
|
|
1717
|
-
...composeRootHooks(
|
|
2160
|
+
...composeRootHooks(scopeHost, scopeSession),
|
|
1718
2161
|
get api() {
|
|
1719
2162
|
return [at(route_server_default, contextSession)];
|
|
1720
2163
|
},
|
|
@@ -1735,9 +2178,9 @@ const serverPlugin = defineServerPlugin({
|
|
|
1735
2178
|
at(profileConfig_server_default, contextSession)
|
|
1736
2179
|
];
|
|
1737
2180
|
},
|
|
1738
|
-
services: [...
|
|
2181
|
+
services: [...scopeHost.services ?? [], ...scopeSession.services ?? []],
|
|
1739
2182
|
get activities() {
|
|
1740
|
-
return [...
|
|
2183
|
+
return [...scopeHost.activities ?? [], ...scopeSession.activities ?? []];
|
|
1741
2184
|
}
|
|
1742
2185
|
};
|
|
1743
2186
|
}
|