@agimon-ai/po-cloudflare 0.0.2-alpha.3 → 0.0.2-alpha.30
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 +34 -9
- 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 +34 -0
- package/dist/agent-hYMFpT3P.js +6850 -0
- package/dist/anthropic-messages-D8d2TX6o.js +14317 -0
- package/dist/{apiContracts-CHOiCbS_.js → apiContracts-VUUhCgc2.js} +65 -84
- package/dist/{approval-BMXqnTYd.js → approval-BfVxC2eU.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-D_ZQNLnw.js} +2 -2
- package/dist/artifactFiles-DCIkwc78.js +1 -0
- package/dist/assets/assets/{CodeEditorView-CrdoiM5n.js → CodeEditorView-DaYt-pb8.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-DEyR1_-G.js → abnfDiagram-WEYOIA3C-B3mFficC.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DIbLpRdP.js → architecture-WOLXFQ4H-B-Qbzz2a.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-4xFsERIc.js → architectureDiagram-ZHVYKT53-Byq1yGeB.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-Cd6S9GUZ.js → blockDiagram-RJAE7QA3-DgsnVSS_.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-DzuG1Xr1.js → c4Diagram-XDPPPE54-DwOKaMhc.js} +2 -2
- package/dist/assets/assets/channel-DTH_XuhX.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-DrBwvfNq.js → chunk-2E7WHVMD-B45qgsrQ.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-DlfNcIyc.js → chunk-4EMNKR2T-Cn8w9YGc.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-DXGkEHkM.js → chunk-55XCU76K-tLyYS4a5.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-rD7UlM9u.js → chunk-7S6XSTFO-D-UA2En5.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB-C_-VOauT.js → chunk-AQDTSKZB-Df1X3wV5.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-BV_PaseC.js → chunk-DSNLSHJZ-CW26D15j.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-CrpsawGO.js → chunk-HAGFOTED-B9SlWLMP.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-XphIzF5k.js → chunk-HNE4Q36P-D5xIv17P.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-aLsECrt8.js → chunk-NQOKRVIF-D2Tg2yHD.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-wBMoUMdH.js → chunk-UHW7PFBP-N9QNktIy.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-Be1bFElE.js → chunk-VQ5W62QI-Cl1HBKXQ.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK--6jHfIF3.js → chunk-WQQL4CDK-BgnzXOjR.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-C8DIWIR2.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-DeFSeVs9.js → chunk-YZO67HFG-BAgJ_raw.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-LU20lIUK.js → chunk-ZAUX2LTX-ajmsEoht.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-DHg-SKdr.js → chunk-ZCHMQSOR-BobhwgAu.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-3YhPkwCC.js → classDiagram-v2-4MYWR3UA-C0sQy35P.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-BbtQldWb.js → cose-bilkent-JH36ORCC-DkLs33p5.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-B3ytCWWf.js → cynefin-EF2NZ3EQ-CAc_FdvH.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D1bBbxZq.js → cynefinDiagram-WF24UDRP-CcxwQs4Y.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-BfUqj6lc.js → dagre-NK4GIZVX-CdjpzAOK.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-Df088WJQ.js → diagram-CBK3MWTC-DXokcqbV.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-BKD41Tzm.js → diagram-I5XIIV2D-CxdahTQv.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-xXPliCIa.js → diagram-ODIL2UCW-Dg58V6lG.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-BqphqvCz.js → diagram-PFBEJUXE-DRTwxqzb.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-DYB9A-fq.js → diagram-RJA3I4VV-CSujVWCs.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-CFDOm4HQ.js → diagram-TYUNFSNR-D7DRnf7h.js} +2 -2
- package/dist/assets/assets/{dist-Cm3w42b9.js → dist-B79Puro4.js} +2 -2
- package/dist/assets/assets/{dist-DBLdG0d3.js → dist-CQLKRTXD.js} +2 -2
- package/dist/assets/assets/{dist-CW-VIiMc.js → dist-CgRQL8JA.js} +2 -2
- package/dist/assets/assets/{dist-CZEUnb9K.js → dist-DY7HyACy.js} +2 -2
- package/dist/assets/assets/{dist-CtRw0X6v.js → dist-Dp7amurS.js} +2 -2
- package/dist/assets/assets/{dist-CFCITuXX.js → dist-L9J4dsuV.js} +2 -2
- package/dist/assets/assets/{dist-CnE-1DAx.js → dist-LvqVPinj.js} +2 -2
- package/dist/assets/assets/{dist-Q0r1aAmg.js → dist-dtZzwJjB.js} +2 -2
- package/dist/assets/assets/{dist-32WBtSST.js → dist-h-tRJyTx.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-B3_c2PA2.js → ebnfDiagram-V4P3TTPT-qeyCZxtP.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-finM-fki.js → elk-QONTBCTQ-BWl1uGDv.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-DcUcej90.js → erDiagram-KYQIGQAA-DJtfmPnN.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-C1grv7Mr.js → eventmodeling-K75KTNOO-CEiW7xoH.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-D2Qb3AqB.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CR_3csYO.js → ganttDiagram-R7GPNTJY-DLGNxvzE.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-LWyRJEP6.js → gitGraph-VSP46ZUC-DbBD2zmg.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-Cv1hHPyw.js → gitGraphDiagram-PDYL7XHY-DD3l-bHQ.js} +2 -2
- package/dist/assets/assets/index-B2NJvPsd.css +1 -0
- package/dist/assets/assets/index-YlKxkn6l.js +155 -0
- package/dist/assets/assets/{info-OHQRW6UA-C_GrOjp3.js → info-OHQRW6UA-CRxUEC10.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-D_I4R8K0.js → infoDiagram-MVDRKAX5-RhfPIpJB.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-B0ejFQpo.js → ishikawaDiagram-HPEHV2GE-C8LIy4hZ.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-DXOdyS81.js → journeyDiagram-BOSHW7O7-C7MxP5ty.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-BWisQtKX.js → kanban-definition-FNSA4HC5-DXfZCsNk.js} +2 -2
- package/dist/assets/assets/{line-B1Uzdmw5.js → line-C4-UdZx4.js} +2 -2
- package/dist/assets/assets/{linear-DybNECz2.js → linear-DtcHv3_K.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-CvT3V6mf.js → mermaid-parser.core-BJLYAUAA.js} +4 -4
- package/dist/assets/assets/{mermaid.core-klehpHNB.js → mermaid.core-BnIgFCEy.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-DlVByYRq.js → mindmap-definition-6OY57UG3-BGIowv8y.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-CyG432PV.js → packet-JDAUHWVQ-qKkrBONg.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-DE_MbH8y.js → pegDiagram-ECIUJNBX-Dg5Lz9Fj.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-BwnLEKCH.js → pie-XZMESJXO-C_vRDDUk.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-Cm2NxTfT.js → pieDiagram-GNMPY74T-C2l6pzGs.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-B93FG-6N.js → quadrantDiagram-D57K4MC3-q4N-xiN3.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-B0FBAfdW.js → radar-ABXABTNO-K37Ctnew.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-B7BUR_ru.js → railroad-I3PHUGI6-TMk0kCJd.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-CU2Rx91Y.js → railroad-abnf-LNEFI6M7-DD7Pzg2X.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-B84656rV.js → railroad-ebnf-DWYD2UWJ-DZ3BijcL.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-DimsEw55.js → railroad-peg-JR7BVNR7-kWTx4DXS.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-D0fz3OAg.js → railroadDiagram-Y72NRBL7-Bo7k8oEi.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-BuWqdug0.js → requirementDiagram-EQYSW5RA-D38jEo8e.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-B4OVJlyN.js → sankeyDiagram-SY24JHO5-DTIX_eTi.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Cspw_La5.js → sequenceDiagram-BLEHNHQU-COyr84Fo.js} +2 -2
- package/dist/assets/assets/{src-BIQMvDC7.js → src-DPWc-eu_.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-XwTopHIl.js → stateDiagram-v2-A6IESKWZ-DVS1kseN.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-CbWnlSnl.js → swimlanes-B3ENRKFQ-J9tWm3So.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-Crn5SwjU.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-B9RTbrj0.js → timeline-definition-JXYKGLGB-FcpmSriD.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-BLze-qR3.js → treeView-D4JQ5SDB-BT_G4PqW.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-_AVBjluw.js → treemap-SAJKECNS-wQls1Ni3.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-FvKgpSH5.js → usecaseDiagram-WPOLBNNX-BckVkicu.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-BMWwvqE5.js → vennDiagram-Q3Y3IDCW-CSlSs65e.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BNPEZiix.js → wardley-7MLQ67FV-DsoOrBwZ.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-BvVulcGr.js → wardleyDiagram-IVAIDKWA-B0skq9Ip.js} +2 -2
- package/dist/assets/assets/{webpack-B4NM0eot.js → webpack-fkF99xn1.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-C0yCeT3Q.js → xychartDiagram-4URNHDU4-Cygpozvi.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-DLBcuPkr.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -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-CdlHRsXx.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -0
- package/dist/assets/plugins/slots/approval.dd60ec90-DltzLQSt.js +2 -0
- package/dist/assets/plugins/slots/artifacts.a078f1a5-ChkwQ9HU.js +1 -0
- package/dist/assets/plugins/slots/author.497633d0-Du8fSYjC.js +93 -0
- package/dist/assets/plugins/slots/autocompact.86aeccf4-bBqfmdtp.js +1 -0
- package/dist/assets/plugins/slots/browse.5fcf164c-DOby1A5d.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.0a7f0b8e-D0-WyQ15.js +7 -0
- package/dist/assets/plugins/slots/codemode.ff16ac06-3xOcXub2.js +11 -0
- package/dist/assets/plugins/slots/domain.3ddea842-DxJbYN_n.js +1 -0
- package/dist/assets/plugins/slots/edit.c5b0b072-C3FeBbn6.js +7 -0
- package/dist/assets/plugins/slots/files.8ffcdcc0-OBICep2Q.js +2 -0
- package/dist/assets/plugins/slots/goal.423c7a26-CEuI53pK.js +1 -0
- package/dist/assets/plugins/slots/grep.95f470b3-Dm7y6JSu.js +1 -0
- package/dist/assets/plugins/slots/help.03b9ba99-UtB2eek9.js +3 -0
- package/dist/assets/plugins/slots/log.19bda339-DMLLCJRN.js +4 -0
- package/dist/assets/plugins/slots/mcp.ffbe405a-DIu7LvOI.js +109 -0
- package/dist/assets/plugins/slots/plan.5eac6563-BUwB-cuc.js +3 -0
- package/dist/assets/plugins/slots/profile.176710dd-D0T8SB_1.js +1 -0
- package/dist/assets/plugins/slots/prompts.2c187969-DteLcvvc.js +3 -0
- package/dist/assets/plugins/slots/read.1629d556-B49vGK8G.js +1 -0
- package/dist/assets/plugins/slots/runner.962030e5-C71_bMf3.js +8 -0
- package/dist/assets/plugins/slots/skill.f5396fde-Bglqgyhn.js +4 -0
- package/dist/assets/plugins/slots/subagents.d815a296-Dgj_K8kx.js +7 -0
- package/dist/assets/plugins/slots/vault.57fd9047-DQ6yyA0Q.js +1 -0
- package/dist/assets/plugins/slots/voice.b709d05c-CBRosTge.js +1 -0
- package/dist/assets/pwa/pwa.js +12 -12
- package/dist/assets/pwa/sw.js +4 -4
- package/dist/{atomicJson-BJfPFSYF.js → atomicJson-Bl0Ngr-T.js} +2 -3
- package/dist/azure-openai-config-BSV2Zkun.js +55 -0
- package/dist/azure-openai-responses-BD-Sltji.js +183 -0
- package/dist/{backgroundWork-CeFrbRnj.js → backgroundWork-oCjcKuHt.js} +1 -1
- 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 +106 -0
- package/dist/cloudflare-workers-ai-system-one-B0wH6HU5.js +52 -0
- package/dist/{codemode-DbPu0yJN.js → codemode-DN4dyrvt.js} +5 -2
- package/dist/contracts-DiwLZtS-.js +40 -0
- package/dist/contracts-ER9V9JyZ.js +19 -0
- package/dist/diagnostics-DPTP-yrt.js +131 -0
- package/dist/{server-D3PQk1Gt.js → dist-B-vqs6tA.js} +1 -546
- package/dist/{dist-BVBi6VMV.js → dist-CfOWb6f7.js} +1 -1
- package/dist/{dist-PDDFdqDX.js → dist-Dd6zUvjw.js} +1 -1
- package/dist/dist-Dvx5mlIR.js +50 -0
- package/dist/edge-DLMfBsT8.js +266 -0
- package/dist/{emscripten-module.cloudflare-D4Bc9Ykz.js → emscripten-module.cloudflare-B4fhfquU.js} +1 -1
- package/dist/env-api-keys-CAnjjnsR.js +32 -0
- package/dist/error-body-DQZRsyL5.js +102 -0
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{exports-BNZz2DNU.js → exports-DBRFXxZh.js} +25 -9
- package/dist/exports-Dcu66vwx.js +34 -0
- package/dist/{remoteMcp-CMqZldeA.js → exports-o--WKvqb.js} +1044 -175
- package/dist/extensionFile-BEUz_rpB.js +121 -0
- package/dist/{factory-Cs8iaUtc.js → factory-DwoANAyi.js} +1 -1
- package/dist/github-copilot-headers-DpQQAh-s.js +22 -0
- package/dist/google-generative-ai-BK0JsYna.js +328 -0
- package/dist/google-shared-tQ95_tjA.js +19588 -0
- package/dist/google-vertex-B_DKKMUR.js +374 -0
- package/dist/{domains-BNjGTOPj.js → harnessState-4QhL2GVn.js} +175 -16
- package/dist/{harnessStore-BT706Ly6.js → harnessStore-CeYN9ArW.js} +4 -5
- package/dist/hash-B3RRpLS2.js +16 -0
- package/dist/headers-BEuxFxDI.js +17 -0
- package/dist/help-BAAQWi1q.js +1 -0
- package/dist/help-CbRQ_a3o.js +101 -0
- package/dist/http-BoQMtQm8.js +59 -0
- package/dist/{hubChannel-BHQyzcOo.js → hubChannel-2NmE_z7N.js} +11 -28
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/identity-BIeAyilV.js +165 -0
- package/dist/index.edge-AAGhdqtz.js +67 -0
- package/dist/index.edge-BhSIpZLX.js +56 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/index.edge-CoH0zSfG.js +67 -0
- package/dist/index.edge-CwAzrLy4.js +937 -0
- package/dist/index.edge-D2RirEwK.js +14 -0
- package/dist/iso-BCXA5x1w.js +10 -0
- package/dist/{kysely-adapter-D51abb3q.js → kysely-adapter-D3TQ9BKb.js} +1 -1
- package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-DmRhiTvZ.js} +193 -15
- package/dist/majorModes-Bi215trP.js +1 -0
- package/dist/{majorModes-DbCfLZH3.js → majorModes-CCSc7rce.js} +4 -14
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-Be8wtYIK.js} +2 -2
- package/dist/migrations-EDJvwh2u.js +32 -0
- package/dist/mistral-conversations-Ct5Xzcoq.js +689 -0
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/models-D6d73jcW.js +1511 -0
- package/dist/narration-Dtu5_WFZ.js +128 -0
- package/dist/node-CBLSc-YH.js +23 -0
- package/dist/node-bvVKJkBH.js +2479 -0
- package/dist/notification-BdAoBqsC.js +102 -0
- package/dist/openai-69NOv-G_.js +17357 -0
- package/dist/openai-codex-responses-xs-XhwXd.js +1210 -0
- package/dist/openai-completions-q3NP0Rzk.js +984 -0
- package/dist/openai-decisions-Dfn_KgQd.js +142 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js +8 -0
- package/dist/openai-responses-nVzrCKVL.js +281 -0
- package/dist/openai-responses-shared-D4RlUq8e.js +661 -0
- package/dist/openrouter-cost-D99Qqcs6.js +30 -0
- package/dist/openrouter-images-DypUCqIs.js +124 -0
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/pi-messages-RjgHk5b9.js +312 -0
- package/dist/piConfig-CLq9JUuD.js +126 -0
- package/dist/piSettings-B0Xu4xBM.js +1 -0
- package/dist/platform-vI6G0G7v.js +113 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-Bf2o7M88.js +80 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-D819v4ut.js} +2 -2
- package/dist/provider-env-D2M8dslq.js +38 -0
- package/dist/provider-retry-ChD-K2Gv.js +79 -0
- 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 +26 -0
- package/dist/{schemas-Vj8-rCR4.js → schemas-BMBR99Q5.js} +3 -2
- package/dist/{server-Dt4y1rZD.js → server--7yYZ0e-.js} +47 -27
- package/dist/server-BJ-jhxKP.js +1518 -0
- package/dist/{server-D8ndq0wL.js → server-BPC5nldj.js} +11 -9
- package/dist/server-BTFnRnVy.js +2657 -0
- package/dist/{server-Dpgh8PDh.js → server-BYmotNJV.js} +14 -5
- package/dist/server-BZUWyMLG.js +576 -0
- package/dist/{server-BZh1ZXz_.js → server-Bc6sXpYi.js} +8 -19
- package/dist/server-BiiRr_wC.js +640 -0
- package/dist/server-BliYTghK.js +1522 -0
- package/dist/server-BmhomR5W.js +1118 -0
- package/dist/{server-BAAL9-NA.js → server-C-s9mJbt.js} +3 -10
- package/dist/server-C10LNTZr.js +1116 -0
- package/dist/server-C7fYqUEd.js +1803 -0
- package/dist/server-CMQ-4K8I.js +1808 -0
- package/dist/server-CZy9QvKn.js +3125 -0
- package/dist/{server-D4W7EdJY.js → server-CzfJ23RU.js} +16 -16
- package/dist/{server-DJAanjoI.js → server-D5ipFLw4.js} +551 -108
- package/dist/server-D64LRgFU.js +189 -0
- package/dist/server-D7C1qs17.js +295 -0
- package/dist/server-D8ZssJDl.js +679 -0
- package/dist/server-D8_SkyRF.js +934 -0
- package/dist/{server-BE6VqEiA.js → server-DSaarA1d.js} +20 -12
- package/dist/server-Dct1bn1X.js +834 -0
- package/dist/{server-36iuA3MI.js → server-DkYdfvm2.js} +3 -3
- package/dist/server-DlgQ_xYV.js +148 -0
- package/dist/server-DzrmeCTz.js +288 -0
- package/dist/server-QhgsV8T8.js +505 -0
- package/dist/server-RlHrwa_f.js +1276 -0
- package/dist/server-amwNoq4q.js +491 -0
- package/dist/server-cBgXNbZp.js +15106 -0
- package/dist/{build-2gFaVEfG.js → serverPlugin-DOjUKzFU.js} +4288 -4
- package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-BOQsvPIK.js} +550 -760
- package/dist/simple-options-DWrW31_K.js +156 -0
- package/dist/streaming-json-DxsKu9B6.js +858 -0
- package/dist/system-one-shared-DLVLdzYL.js +132 -0
- package/dist/{notification-D76PSL7r.js → telemetry-CrTcxeA5.js} +2 -93
- package/dist/transform-messages-CjTSwW9q.js +356 -0
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/{server-A-_GFpPr.js → type-BTE9JVuX.js} +573 -1406
- package/dist/type-yokaDI_F.js +7 -0
- package/dist/typesafe-system-one-DBVcjcUQ.js +37 -0
- package/dist/uuid-mkNGilLv.js +31 -0
- package/dist/{validation-D77NZBrx.js → validation-D8ixl-xy.js} +8 -3
- package/dist/{value-Djvc2foV.js → value-MMvKKw8F.js} +1 -1
- package/dist/vaultSettings-Sn_p4uqZ.js +292 -0
- package/dist/voiceTools-DK1uIGJv.js +246 -0
- package/dist/web-Bm1F5aMc.js +3 -0
- package/dist/worker.js +107634 -48608
- package/dist/workflow-Cm9ccxru.js +114 -0
- package/package.json +41 -22
- package/wrangler.jsonc +13 -3
- package/dist/assets/assets/channel-COZTDQXE.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-B5qpdvL2.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-KhN8NxvM.js +0 -1
- package/dist/assets/assets/index-C9HC2YsS.js +0 -155
- package/dist/assets/assets/index-DZM68mTk.css +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-BQ6QhI0Z.js +0 -9
- package/dist/contextProjection-DVP2Vc5j.js +0 -188
- package/dist/extensionFile-CXOa5G4C.js +0 -409
- package/dist/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-BiH9vSuD.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-BvWNqoHt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-B4AAgwJ0.js +0 -16
- package/dist/platformFiles-C_bXo4Ig.js +0 -39
- package/dist/server-BZaPPoQp.js +0 -592
- package/dist/server-D75MWDhB.js +0 -118
- package/dist/server-r358hzQg.js +0 -280
- package/dist/server-tvgQ99rv.js +0 -657
- package/dist/serverPlugin-BOI6c6s5.js +0 -3393
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { c as
|
|
6
|
-
import { n as
|
|
7
|
-
import
|
|
8
|
-
import "./
|
|
9
|
-
import "./
|
|
10
|
-
import { a as
|
|
11
|
-
import "./
|
|
12
|
-
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-DbPu0yJN.js";
|
|
1
|
+
import { G as Null, Hn as BACKGROUND_CONTEXT, S as PO_CONFIG_SERVICE, Sn as getOrThrow, V as String$1, Yn as PO_FS_SERVICE, Z as Literal, Zn as PO_SQLITE_SERVICE, ar as PO_SERVER_SCOPE_SERVICE, bt as _Array_, cr as requirePoServerScope, f as isPoHeadlessPromptAdmissionError, gn as createSerialRunner, hn as poHomeDirectory, ht as Optional, ir as requirePoSqlite, l as PoSessionSetupError, n as runCleanups, or as defineServiceContract, pt as _Object_, rr as requirePoFs, s as PoHeadlessPromptAdmissionError, t as defineServerPlugin, vn as nodeHost, y as composeServerProviderOverrides, z as Union } from "./serverPlugin-DOjUKzFU.js";
|
|
2
|
+
import { m as jsonApiResponses, t as defineApiContract } from "./apiContracts-VUUhCgc2.js";
|
|
3
|
+
import { a as pathExists, l as removePath, u as writeFileAtomic } from "./platform-vI6G0G7v.js";
|
|
4
|
+
import "./piSettings-B0Xu4xBM.js";
|
|
5
|
+
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-BOQsvPIK.js";
|
|
6
|
+
import { n as Check } from "./value-MMvKKw8F.js";
|
|
7
|
+
import "./exports-DBRFXxZh.js";
|
|
8
|
+
import { n as readPackageResource, t as packageResourcePath } from "./index.edge-CoH0zSfG.js";
|
|
9
|
+
import { a as readPoWorkflowContextService, n as PO_WORKFLOW_PROFILE_ADMISSION_SERVICE } from "./workflow-Cm9ccxru.js";
|
|
10
|
+
import { a as defineHook, c as defineRoot, l as defineRoute, n as composeRootInjects, s as defineResource, t as composeRootHooks, u as defineRoutedContribution } from "./extensionFile-BEUz_rpB.js";
|
|
11
|
+
import { i as readPoCodemode, n as PO_CODEMODE_SERVICE } from "./codemode-DN4dyrvt.js";
|
|
13
12
|
import path from "node:path";
|
|
13
|
+
//#region ../../foundations/po-config/src/services/profiles/sync.edge.ts
|
|
14
|
+
function nodeOnly(name, asyncName) {
|
|
15
|
+
throw new Error(`${name} is Node-only; use ${asyncName} with a PoPlatform on the edge.`);
|
|
16
|
+
}
|
|
17
|
+
/** @deprecated Node-only sync shim; use loadProfilesAsync. Removed in M2. */
|
|
18
|
+
function loadProfiles(_repoRoot, _homeDirectory) {
|
|
19
|
+
return nodeOnly("loadProfiles", "loadProfilesAsync");
|
|
20
|
+
}
|
|
21
|
+
/** @deprecated Node-only sync shim; use buildPersonaPromptAsync. Removed in M2. */
|
|
22
|
+
function buildPersonaPrompt(_personaRoot, _personaDirectory) {
|
|
23
|
+
return nodeOnly("buildPersonaPrompt", "buildPersonaPromptAsync");
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
14
26
|
//#region ../../foundations/po-profile/src/constants/profileMemory.ts
|
|
15
27
|
const PROFILE_MEMORY_STORE_SERVICE = "po/profile-memory-store";
|
|
16
28
|
const PROFILE_MEMORY_NAMESPACE_SOURCE = "@agimon-ai/po-profile/memory";
|
|
@@ -428,8 +440,12 @@ var root_server_default$1 = defineRoot(({ host }) => {
|
|
|
428
440
|
services: [async (context) => {
|
|
429
441
|
await context.inject([PO_SERVER_SCOPE_SERVICE], async (scoped) => {
|
|
430
442
|
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);
|
|
443
|
+
const releaseSecrets = await scope.provide(defineServiceContract(PROFILE_SECRETS_SERVICE, { scope: host.scope }), secrets);
|
|
444
|
+
const releaseSources = await scope.provide(defineServiceContract(PROFILE_SOURCES_SERVICE, { scope: host.scope }), sources);
|
|
445
|
+
return async () => {
|
|
446
|
+
await releaseSources();
|
|
447
|
+
await releaseSecrets();
|
|
448
|
+
};
|
|
433
449
|
});
|
|
434
450
|
}, async (context) => {
|
|
435
451
|
await context.inject([
|
|
@@ -744,6 +760,9 @@ const PROFILE_RUNTIME_SERVICE = "po/profile-runtime";
|
|
|
744
760
|
//#region ../../foundations/po-profile/src/services/profileRuntime/index.ts
|
|
745
761
|
const UNAVAILABLE = "Profile integration provider is unavailable";
|
|
746
762
|
const INVALIDATED = "Profile operation was invalidated";
|
|
763
|
+
/** Vault namespace for secrets saved from the composer; po-vault's `VAULT_SECRETS_NAMESPACE` writes it. */
|
|
764
|
+
const VAULT_SECRETS_NAMESPACE = "secrets";
|
|
765
|
+
const ALIAS_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/u;
|
|
747
766
|
/** A single selected profile and provider, owned by one session, not a provider registry. */
|
|
748
767
|
var SessionProfileRuntime = class {
|
|
749
768
|
options;
|
|
@@ -764,10 +783,14 @@ var SessionProfileRuntime = class {
|
|
|
764
783
|
capture(profileName, generation) {
|
|
765
784
|
const binding = profileName === void 0 ? void 0 : this.options.readBinding(profileName);
|
|
766
785
|
const env = profileName === void 0 ? void 0 : this.options.readEnv?.(profileName);
|
|
786
|
+
const sourceSecrets = profileName === void 0 ? void 0 : this.options.readSecrets?.(profileName);
|
|
787
|
+
const secrets = sourceSecrets === void 0 ? void 0 : parseProfileVaultSecrets(sourceSecrets);
|
|
788
|
+
if (secrets && Object.keys(secrets).some((name) => binding?.secrets && Object.hasOwn(binding.secrets, name))) throw new Error("Profile secret aliases must be unique");
|
|
767
789
|
return Object.freeze({
|
|
768
790
|
...profileName === void 0 ? {} : { profileName },
|
|
769
791
|
...binding === void 0 ? {} : { integration: parseProfileBinding(binding) },
|
|
770
792
|
...env === void 0 ? {} : { env: Object.freeze({ ...env }) },
|
|
793
|
+
...secrets === void 0 ? {} : { secrets },
|
|
771
794
|
generation,
|
|
772
795
|
signal: this.controller.signal
|
|
773
796
|
});
|
|
@@ -883,6 +906,11 @@ var SessionProfileRuntime = class {
|
|
|
883
906
|
if (!reference.allowedOrigins.includes(request.origin)) throw new Error("Profile secret origin is not allowed");
|
|
884
907
|
});
|
|
885
908
|
}
|
|
909
|
+
resolveInputSecret(name, request) {
|
|
910
|
+
return this.resolveReference(name, request.signal, (reference) => {
|
|
911
|
+
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");
|
|
912
|
+
});
|
|
913
|
+
}
|
|
886
914
|
resolveProxySecret(signal) {
|
|
887
915
|
const name = this.snapshot.integration?.browser?.proxySecret;
|
|
888
916
|
if (name === void 0) return Promise.reject(/* @__PURE__ */ new Error("Profile proxy is not configured"));
|
|
@@ -890,26 +918,80 @@ var SessionProfileRuntime = class {
|
|
|
890
918
|
if (!reference.purposes.includes("proxy")) throw new Error("Profile secret alias is unavailable");
|
|
891
919
|
});
|
|
892
920
|
}
|
|
921
|
+
/** Refresh only value-free aliases, never the selected provider or browser identity. */
|
|
922
|
+
currentBinding(snapshot) {
|
|
923
|
+
if (!snapshot.integration || snapshot.profileName === void 0) return void 0;
|
|
924
|
+
let current;
|
|
925
|
+
try {
|
|
926
|
+
current = parseProfileBinding(this.options.readBinding(snapshot.profileName));
|
|
927
|
+
} catch {
|
|
928
|
+
throw new Error(INVALIDATED);
|
|
929
|
+
}
|
|
930
|
+
const selected = snapshot.integration;
|
|
931
|
+
if (current.provider !== selected.provider || current.organizationId !== selected.organizationId || current.mailboxId !== selected.mailboxId || current.credentialRef !== selected.credentialRef) throw new Error(INVALIDATED);
|
|
932
|
+
return current;
|
|
933
|
+
}
|
|
893
934
|
async resolveReference(name, requestSignal, authorize) {
|
|
894
935
|
if (this.initializing) throw new Error("Profile secrets are unavailable during provider initialization");
|
|
895
936
|
await this.ready();
|
|
896
937
|
const snapshot = this.snapshot;
|
|
897
938
|
const connection = this.connection;
|
|
898
|
-
const
|
|
899
|
-
|
|
900
|
-
|
|
939
|
+
const current = this.currentBinding(snapshot);
|
|
940
|
+
const vaultReference = snapshot.secrets && Object.hasOwn(snapshot.secrets, name) ? snapshot.secrets[name] : void 0;
|
|
941
|
+
const providerReference = current?.secrets && Object.hasOwn(current.secrets, name) ? current.secrets[name] : void 0;
|
|
942
|
+
if (vaultReference && providerReference) throw new Error("Profile secret aliases must be unique");
|
|
901
943
|
const signal = requestSignal ? AbortSignal.any([snapshot.signal, requestSignal]) : snapshot.signal;
|
|
944
|
+
const saved = vaultReference || providerReference ? void 0 : await this.savedSecret(name, signal);
|
|
945
|
+
const reference = vaultReference ?? providerReference ?? saved?.reference;
|
|
946
|
+
if (!reference) throw new Error("Profile secret alias is unavailable");
|
|
947
|
+
authorize(reference);
|
|
902
948
|
if (signal.aborted) throw new Error(INVALIDATED);
|
|
903
949
|
let value;
|
|
904
950
|
try {
|
|
905
|
-
value =
|
|
951
|
+
if (saved) value = saved.value;
|
|
952
|
+
else if (vaultReference) {
|
|
953
|
+
if (!this.options.readVault) throw new Error("Vault unavailable");
|
|
954
|
+
const { namespace, key, field } = vaultReference.vault;
|
|
955
|
+
const entry = await this.options.readVault(namespace, key, signal);
|
|
956
|
+
const selected = field === void 0 ? entry : typeof entry === "object" && entry !== null && !Array.isArray(entry) && Object.hasOwn(entry, field) ? entry[field] : void 0;
|
|
957
|
+
if (typeof selected !== "string") throw new Error("Vault field unavailable");
|
|
958
|
+
value = selected;
|
|
959
|
+
} else {
|
|
960
|
+
if (!connection || !providerReference) throw new Error("Provider unavailable");
|
|
961
|
+
value = await connection.resolveSecret(providerReference, signal);
|
|
962
|
+
}
|
|
906
963
|
} catch {
|
|
907
964
|
throw new Error("Profile secret resolution failed");
|
|
908
965
|
}
|
|
909
966
|
if (signal.aborted || this.snapshot !== snapshot || this.connection !== connection) throw new Error(INVALIDATED);
|
|
967
|
+
if (JSON.stringify(this.currentBinding(snapshot)?.secrets[name]) !== JSON.stringify(providerReference)) throw new Error(INVALIDATED);
|
|
910
968
|
if (typeof value !== "string" || value.length === 0) throw new Error("Profile secret field is unavailable");
|
|
911
969
|
return value;
|
|
912
970
|
}
|
|
971
|
+
/** `secrets/<name>` as `{value, purposes, allowedOrigins?, allowedTargets?}`, checked like a profile alias. */
|
|
972
|
+
async savedSecret(name, signal) {
|
|
973
|
+
if (!this.options.readVault || !ALIAS_PATTERN.test(name)) return void 0;
|
|
974
|
+
try {
|
|
975
|
+
const entry = await this.options.readVault(VAULT_SECRETS_NAMESPACE, name, signal);
|
|
976
|
+
if (typeof entry !== "object" || entry === null || Array.isArray(entry)) return void 0;
|
|
977
|
+
const { value, ...delivery } = entry;
|
|
978
|
+
const vault = {
|
|
979
|
+
namespace: VAULT_SECRETS_NAMESPACE,
|
|
980
|
+
key: name,
|
|
981
|
+
field: "value"
|
|
982
|
+
};
|
|
983
|
+
const reference = parseProfileVaultSecrets({ [name]: {
|
|
984
|
+
...delivery,
|
|
985
|
+
vault
|
|
986
|
+
} }, "Saved secret")[name];
|
|
987
|
+
return reference && {
|
|
988
|
+
reference,
|
|
989
|
+
value
|
|
990
|
+
};
|
|
991
|
+
} catch {
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
913
995
|
dispose() {
|
|
914
996
|
if (this.disposal) return this.disposal;
|
|
915
997
|
this.disposed = true;
|
|
@@ -1048,7 +1130,7 @@ function createProfileServerCommand(host, state, sources, lifetime) {
|
|
|
1048
1130
|
if (signal.aborted) return;
|
|
1049
1131
|
if (requested && !profiles.some(({ name }) => name === requested)) throw new Error(`Unknown profile: ${requested}`);
|
|
1050
1132
|
const profile = requested || void 0;
|
|
1051
|
-
if (profile === execution.selection.profile && host.inspectCapabilities().ready) return;
|
|
1133
|
+
if (profile !== void 0 && profile === execution.selection.profile && host.inspectCapabilities().ready) return;
|
|
1052
1134
|
try {
|
|
1053
1135
|
await host.changeSelection({
|
|
1054
1136
|
axis: "profile",
|
|
@@ -1062,11 +1144,30 @@ function createProfileServerCommand(host, state, sources, lifetime) {
|
|
|
1062
1144
|
}
|
|
1063
1145
|
};
|
|
1064
1146
|
}
|
|
1065
|
-
|
|
1147
|
+
const IDENTITY_MISMATCH = "Profile identity does not match the workflow allocation";
|
|
1148
|
+
/** Value-free comparison of the actual selection to trusted evidence. The stable ref is never compared to credentialRef. */
|
|
1149
|
+
function matchesExpectedIdentity(snapshot, expected) {
|
|
1150
|
+
if (expected.kind === "none") return snapshot === void 0 || snapshot.profileName === void 0;
|
|
1151
|
+
const actual = snapshot?.integration;
|
|
1152
|
+
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;
|
|
1153
|
+
}
|
|
1154
|
+
async function assertExpectedIdentity(runtime, expected) {
|
|
1155
|
+
const before = runtime?.readSelection();
|
|
1156
|
+
if (before?.signal.aborted || !matchesExpectedIdentity(before, expected)) throw new Error(IDENTITY_MISMATCH);
|
|
1157
|
+
await runtime?.ready();
|
|
1158
|
+
const after = runtime?.readSelection();
|
|
1159
|
+
if (after?.generation !== before?.generation || after?.signal !== before?.signal || after?.signal.aborted || !matchesExpectedIdentity(after, expected)) throw new Error(IDENTITY_MISMATCH);
|
|
1160
|
+
}
|
|
1161
|
+
/**
|
|
1162
|
+
* Fail-closed admission. With expected workflow evidence, the actual selected profile and provider identity must
|
|
1163
|
+
* match it across ready(); this does not verify remote authorization or content freshness. Without it, only ready().
|
|
1164
|
+
*/
|
|
1165
|
+
async function assertProfileReady(runtime, expected) {
|
|
1066
1166
|
try {
|
|
1067
|
-
await runtime?.ready();
|
|
1167
|
+
if (expected === void 0) await runtime?.ready();
|
|
1168
|
+
else await assertExpectedIdentity(runtime, expected);
|
|
1068
1169
|
} catch (error) {
|
|
1069
|
-
throw new PoHeadlessPromptAdmissionError(error);
|
|
1170
|
+
throw new PoHeadlessPromptAdmissionError(expected === void 0 ? error : /* @__PURE__ */ new Error(IDENTITY_MISMATCH));
|
|
1070
1171
|
}
|
|
1071
1172
|
}
|
|
1072
1173
|
function createProfileIdentityHook(state, sources) {
|
|
@@ -1095,14 +1196,16 @@ function profileSessionState(context) {
|
|
|
1095
1196
|
}
|
|
1096
1197
|
//#endregion
|
|
1097
1198
|
//#region ../../foundations/po-profile/src/extensions/workspaces/sessions/(backend)/root.server.ts
|
|
1098
|
-
var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
1199
|
+
var root_server_default = defineRoot(async ({ agent, host, signal, context }) => {
|
|
1099
1200
|
if (!agent) return { value: void 0 };
|
|
1100
1201
|
const execution = agent.context;
|
|
1101
1202
|
const scope = { workspaceId: host.context.workspaceId };
|
|
1102
1203
|
const state = profileSessionState(context);
|
|
1103
|
-
const homeDirectory =
|
|
1104
|
-
|
|
1105
|
-
const
|
|
1204
|
+
const homeDirectory = host.context.homeDirectory ?? execution.environment.HOME;
|
|
1205
|
+
if (!homeDirectory) throw new Error("Profile session requires a host home directory.");
|
|
1206
|
+
const loadFiles = () => loadProfilesAsync(requirePoFs(context), execution.repoRoot, BACKGROUND_CONTEXT, homeDirectory);
|
|
1207
|
+
let files = await loadFiles();
|
|
1208
|
+
const readProfile = (profileName) => findProfile(files, readProfileSources(context, scope), profileName);
|
|
1106
1209
|
const handoff = readInitialProfileOutcome(context);
|
|
1107
1210
|
let publishOutcome;
|
|
1108
1211
|
const applyHandoff = (selection, outcome) => {
|
|
@@ -1112,7 +1215,7 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1112
1215
|
...selection,
|
|
1113
1216
|
profile: void 0
|
|
1114
1217
|
};
|
|
1115
|
-
if (mergeProfiles(
|
|
1218
|
+
if (mergeProfiles(files, readProfileSources(context, scope)).some((profile) => profile.name === name)) return {
|
|
1116
1219
|
...selection,
|
|
1117
1220
|
profile: name
|
|
1118
1221
|
};
|
|
@@ -1130,7 +1233,7 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1130
1233
|
kind: "named",
|
|
1131
1234
|
name: selection.profile
|
|
1132
1235
|
};
|
|
1133
|
-
const outcome = await resolveInitialProfile(
|
|
1236
|
+
const outcome = await resolveInitialProfile(files, readProfileSources(context, scope), {
|
|
1134
1237
|
intent,
|
|
1135
1238
|
scope,
|
|
1136
1239
|
signal
|
|
@@ -1143,13 +1246,34 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1143
1246
|
};
|
|
1144
1247
|
};
|
|
1145
1248
|
const unregisterResolver = agent.registerInitialSelectionResolver((selection) => handoff === void 0 ? resolveStartup(selection) : applyHandoff(selection, handoff));
|
|
1249
|
+
let vaultBinding;
|
|
1146
1250
|
const runtime = createProfileRuntime({
|
|
1147
1251
|
readBinding: (profileName) => readProfile(profileName).integration,
|
|
1148
|
-
readEnv: (profileName) => readProfile(profileName).env
|
|
1252
|
+
readEnv: (profileName) => readProfile(profileName).env,
|
|
1253
|
+
readSecrets: (profileName) => readProfile(profileName).secrets,
|
|
1254
|
+
readVault: async (namespace, key, requestSignal) => {
|
|
1255
|
+
requestSignal.throwIfAborted();
|
|
1256
|
+
const binding = vaultBinding;
|
|
1257
|
+
if (!binding?.active) throw new Error("Profile vault is unavailable");
|
|
1258
|
+
const record = await binding.provider.get(namespace, key);
|
|
1259
|
+
requestSignal.throwIfAborted();
|
|
1260
|
+
if (!binding.active) throw new Error("Profile vault is unavailable");
|
|
1261
|
+
return record?.value;
|
|
1262
|
+
}
|
|
1149
1263
|
});
|
|
1264
|
+
let selectedProfile;
|
|
1265
|
+
let personTimeZone;
|
|
1266
|
+
const publishTimeZone = () => personTimeZone?.setProfile(selectedProfile === void 0 ? void 0 : readProfile(selectedProfile).timezone);
|
|
1150
1267
|
const unsubscribe = agent.subscribeSelection(async (selection, applied) => {
|
|
1151
1268
|
try {
|
|
1152
|
-
|
|
1269
|
+
const force = applied?.refresh?.includes("profile") === true;
|
|
1270
|
+
if (force) {
|
|
1271
|
+
runtime.invalidate();
|
|
1272
|
+
files = await loadFiles();
|
|
1273
|
+
}
|
|
1274
|
+
await runtime.select(selection.profile, { force });
|
|
1275
|
+
selectedProfile = selection.profile;
|
|
1276
|
+
publishTimeZone();
|
|
1153
1277
|
} catch (error) {
|
|
1154
1278
|
throw new PoHeadlessPromptAdmissionError(error);
|
|
1155
1279
|
}
|
|
@@ -1162,6 +1286,31 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1162
1286
|
value: runtime,
|
|
1163
1287
|
services: [
|
|
1164
1288
|
createProfileRuntimePlugin(runtime),
|
|
1289
|
+
(serviceContext) => {
|
|
1290
|
+
serviceContext.provide(PO_WORKFLOW_PROFILE_ADMISSION_SERVICE, { assertReady: (expected) => assertProfileReady(runtime, expected) });
|
|
1291
|
+
},
|
|
1292
|
+
(serviceContext) => {
|
|
1293
|
+
serviceContext.inject(["po/vault"], (injected) => {
|
|
1294
|
+
const binding = {
|
|
1295
|
+
provider: injected.get("po/vault"),
|
|
1296
|
+
active: true
|
|
1297
|
+
};
|
|
1298
|
+
vaultBinding = binding;
|
|
1299
|
+
return () => {
|
|
1300
|
+
binding.active = false;
|
|
1301
|
+
if (vaultBinding === binding) vaultBinding = void 0;
|
|
1302
|
+
};
|
|
1303
|
+
});
|
|
1304
|
+
},
|
|
1305
|
+
(serviceContext) => {
|
|
1306
|
+
serviceContext.inject([PO_PERSON_TIME_ZONE_SERVICE], (injected) => {
|
|
1307
|
+
personTimeZone = readPoPersonTimeZone(injected);
|
|
1308
|
+
publishTimeZone();
|
|
1309
|
+
return () => {
|
|
1310
|
+
personTimeZone = void 0;
|
|
1311
|
+
};
|
|
1312
|
+
});
|
|
1313
|
+
},
|
|
1165
1314
|
(serviceContext) => {
|
|
1166
1315
|
if (handoff !== void 0) return;
|
|
1167
1316
|
serviceContext.provide(PROFILE_INITIAL_OUTCOME_SERVICE, void 0);
|
|
@@ -1194,6 +1343,151 @@ var root_server_default = defineRoot(({ agent, host, signal, context }) => {
|
|
|
1194
1343
|
};
|
|
1195
1344
|
});
|
|
1196
1345
|
//#endregion
|
|
1346
|
+
//#region ../../foundations/po-profile/src/constants/personaPresets.ts
|
|
1347
|
+
/** Starting personalities for a personal coordinator agent. `soul` becomes its SOUL.md. */
|
|
1348
|
+
const PERSONA_PRESETS = [
|
|
1349
|
+
{
|
|
1350
|
+
id: "focused",
|
|
1351
|
+
label: "Focused",
|
|
1352
|
+
description: "A precise coding partner that keeps work small and verified.",
|
|
1353
|
+
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."
|
|
1354
|
+
},
|
|
1355
|
+
{
|
|
1356
|
+
id: "friendly",
|
|
1357
|
+
label: "Friendly",
|
|
1358
|
+
description: "A warm everyday assistant that explains things plainly.",
|
|
1359
|
+
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."
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
id: "creative",
|
|
1363
|
+
label: "Creative",
|
|
1364
|
+
description: "A marketing partner that offers fresh angles and options.",
|
|
1365
|
+
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."
|
|
1366
|
+
},
|
|
1367
|
+
{
|
|
1368
|
+
id: "persuasive",
|
|
1369
|
+
label: "Persuasive",
|
|
1370
|
+
description: "A sales partner that frames value and drives to the next step.",
|
|
1371
|
+
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."
|
|
1372
|
+
}
|
|
1373
|
+
];
|
|
1374
|
+
//#endregion
|
|
1375
|
+
//#region ../../foundations/po-profile/src/schemas/apiContracts.ts
|
|
1376
|
+
const ProfileSelectionSchema = _Object_({ profile: Union([Null(), String$1({ minLength: 1 })]) }, { additionalProperties: false });
|
|
1377
|
+
const CreateProfileSchema = _Object_({
|
|
1378
|
+
alias: String$1({ pattern: "^[a-z0-9][a-z0-9-]{0,39}$" }),
|
|
1379
|
+
displayName: String$1({
|
|
1380
|
+
minLength: 1,
|
|
1381
|
+
maxLength: 80
|
|
1382
|
+
}),
|
|
1383
|
+
preset: Union(PERSONA_PRESETS.map(({ id }) => Literal(id))),
|
|
1384
|
+
note: Optional(String$1({ maxLength: 1e3 })),
|
|
1385
|
+
avatarPngBase64: Optional(String$1({
|
|
1386
|
+
minLength: 1,
|
|
1387
|
+
maxLength: 262144
|
|
1388
|
+
}))
|
|
1389
|
+
}, { additionalProperties: false });
|
|
1390
|
+
const CreatedProfileSchema = _Object_({ name: String$1() });
|
|
1391
|
+
const CurrentProfileSchema = _Object_({ profile: Union([Null(), String$1()]) });
|
|
1392
|
+
const ProfileCatalogSchema = _Object_({
|
|
1393
|
+
profiles: _Array_(_Object_({
|
|
1394
|
+
name: String$1(),
|
|
1395
|
+
identity: Optional(_Object_({
|
|
1396
|
+
name: Optional(String$1()),
|
|
1397
|
+
icon: Optional(String$1()),
|
|
1398
|
+
role: Optional(String$1()),
|
|
1399
|
+
contact: Optional(String$1())
|
|
1400
|
+
})),
|
|
1401
|
+
sourceId: String$1()
|
|
1402
|
+
})),
|
|
1403
|
+
readiness: Union([Literal("ready"), Literal("unavailable")])
|
|
1404
|
+
});
|
|
1405
|
+
defineApiContract({
|
|
1406
|
+
version: 1,
|
|
1407
|
+
http: [
|
|
1408
|
+
{
|
|
1409
|
+
id: "profile.create",
|
|
1410
|
+
scope: "global",
|
|
1411
|
+
basePath: "profile",
|
|
1412
|
+
path: "/profiles",
|
|
1413
|
+
method: "POST",
|
|
1414
|
+
authentication: "owner",
|
|
1415
|
+
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.",
|
|
1416
|
+
body: {
|
|
1417
|
+
required: true,
|
|
1418
|
+
contentType: "application/json",
|
|
1419
|
+
schema: CreateProfileSchema
|
|
1420
|
+
},
|
|
1421
|
+
responses: {
|
|
1422
|
+
...jsonApiResponses(CreatedProfileSchema),
|
|
1423
|
+
...jsonApiResponses(CreatedProfileSchema, 201)
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
{
|
|
1427
|
+
id: "profile.current",
|
|
1428
|
+
scope: "session",
|
|
1429
|
+
basePath: "profile",
|
|
1430
|
+
path: "/current",
|
|
1431
|
+
method: "GET",
|
|
1432
|
+
authentication: "owner",
|
|
1433
|
+
description: "Read the current session selection.",
|
|
1434
|
+
responses: jsonApiResponses(CurrentProfileSchema)
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
id: "profile.homeLaunchProfiles",
|
|
1438
|
+
scope: "global",
|
|
1439
|
+
basePath: "profile",
|
|
1440
|
+
path: "/launch-profiles",
|
|
1441
|
+
method: "GET",
|
|
1442
|
+
authentication: "owner",
|
|
1443
|
+
description: "List Home launch profiles from the global catalog, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1444
|
+
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1445
|
+
},
|
|
1446
|
+
{
|
|
1447
|
+
id: "profile.launchProfiles",
|
|
1448
|
+
scope: "workspace",
|
|
1449
|
+
basePath: "profile",
|
|
1450
|
+
path: "/launch-profiles",
|
|
1451
|
+
method: "GET",
|
|
1452
|
+
authentication: "owner",
|
|
1453
|
+
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.",
|
|
1454
|
+
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
id: "profile.profiles",
|
|
1458
|
+
scope: "session",
|
|
1459
|
+
basePath: "profile",
|
|
1460
|
+
path: "/profiles",
|
|
1461
|
+
method: "GET",
|
|
1462
|
+
authentication: "owner",
|
|
1463
|
+
description: "List profiles available to this session, as names and display data only. Waits up to ten seconds for plugin sources.",
|
|
1464
|
+
responses: jsonApiResponses(ProfileCatalogSchema)
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
id: "profile.select",
|
|
1468
|
+
scope: "session",
|
|
1469
|
+
basePath: "profile",
|
|
1470
|
+
path: "/current",
|
|
1471
|
+
method: "PUT",
|
|
1472
|
+
authentication: "owner",
|
|
1473
|
+
description: "Apply a profile at the next tool boundary, or clear it with null. Success means application finished.",
|
|
1474
|
+
body: {
|
|
1475
|
+
required: true,
|
|
1476
|
+
contentType: "application/json",
|
|
1477
|
+
schema: ProfileSelectionSchema
|
|
1478
|
+
},
|
|
1479
|
+
responses: {
|
|
1480
|
+
...jsonApiResponses(CurrentProfileSchema),
|
|
1481
|
+
"400": { description: "Invalid profile selection." },
|
|
1482
|
+
"404": { description: "Unknown profile." },
|
|
1483
|
+
"503": { description: "Sources or integration unavailable; never automatically replay this write." }
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
],
|
|
1487
|
+
sockets: [],
|
|
1488
|
+
dynamic: []
|
|
1489
|
+
});
|
|
1490
|
+
//#endregion
|
|
1197
1491
|
//#region ../../foundations/po-profile/src/services/launchProfiles/type.ts
|
|
1198
1492
|
/** The source id every profile read from a `profiles.yaml` carries. */
|
|
1199
1493
|
const FILE_PROFILE_SOURCE_ID = "files";
|
|
@@ -1241,6 +1535,211 @@ async function listLaunchProfiles(input) {
|
|
|
1241
1535
|
};
|
|
1242
1536
|
}
|
|
1243
1537
|
//#endregion
|
|
1538
|
+
//#region ../../foundations/po-profile/src/services/profileCreation/type.ts
|
|
1539
|
+
/** A refusal with the HTTP status that describes it. Messages never echo request values. */
|
|
1540
|
+
var ProfileCreationError = class extends Error {
|
|
1541
|
+
status;
|
|
1542
|
+
constructor(status, message) {
|
|
1543
|
+
super(message);
|
|
1544
|
+
this.status = status;
|
|
1545
|
+
this.name = "ProfileCreationError";
|
|
1546
|
+
}
|
|
1547
|
+
};
|
|
1548
|
+
//#endregion
|
|
1549
|
+
//#region ../../foundations/po-profile/src/services/profileCreation/index.ts
|
|
1550
|
+
const AGENTS_ROOT = "agents";
|
|
1551
|
+
const AVATAR_FILE = "avatar.png";
|
|
1552
|
+
const COORDINATOR_ROLE = "coordinator";
|
|
1553
|
+
const NOTES_HEADING = "## Notes from the person";
|
|
1554
|
+
const BASE64_PATTERN = /^[A-Za-z0-9+/]+={0,2}$/;
|
|
1555
|
+
const DATA_URL_PREFIX = /^data:[a-z]+\/[a-z0-9.+-]+;base64,/i;
|
|
1556
|
+
const INVALID_AVATAR = "Avatar must be a PNG, JPEG, GIF or WebP image of at most 256 KiB";
|
|
1557
|
+
const startsWith = (bytes, offset, expected) => {
|
|
1558
|
+
const values = typeof expected === "string" ? Array.from({ length: expected.length }, (_, index) => expected.charCodeAt(index)) : expected;
|
|
1559
|
+
return bytes.length >= offset + values.length && values.every((value, index) => bytes[offset + index] === value);
|
|
1560
|
+
};
|
|
1561
|
+
/** Magic bytes, never the declared type. SVG has no entry: it executes script when the cockpit renders it. */
|
|
1562
|
+
const SIGNATURES = [
|
|
1563
|
+
{
|
|
1564
|
+
mime: "image/png",
|
|
1565
|
+
test: (bytes) => startsWith(bytes, 0, [
|
|
1566
|
+
137,
|
|
1567
|
+
80,
|
|
1568
|
+
78,
|
|
1569
|
+
71,
|
|
1570
|
+
13,
|
|
1571
|
+
10,
|
|
1572
|
+
26,
|
|
1573
|
+
10
|
|
1574
|
+
])
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
mime: "image/jpeg",
|
|
1578
|
+
test: (bytes) => startsWith(bytes, 0, [
|
|
1579
|
+
255,
|
|
1580
|
+
216,
|
|
1581
|
+
255
|
|
1582
|
+
])
|
|
1583
|
+
},
|
|
1584
|
+
{
|
|
1585
|
+
mime: "image/gif",
|
|
1586
|
+
test: (bytes) => startsWith(bytes, 0, "GIF8")
|
|
1587
|
+
},
|
|
1588
|
+
{
|
|
1589
|
+
mime: "image/webp",
|
|
1590
|
+
test: (bytes) => startsWith(bytes, 0, "RIFF") && startsWith(bytes, 8, "WEBP")
|
|
1591
|
+
}
|
|
1592
|
+
];
|
|
1593
|
+
/** Decoded avatar bytes the profile loader will keep: an allowed image within its data URL bound. */
|
|
1594
|
+
function avatarBytes(encoded) {
|
|
1595
|
+
const base64 = encoded.replace(DATA_URL_PREFIX, "").replace(/\s/g, "");
|
|
1596
|
+
if (!BASE64_PATTERN.test(base64)) throw new ProfileCreationError(422, INVALID_AVATAR);
|
|
1597
|
+
let bytes;
|
|
1598
|
+
try {
|
|
1599
|
+
bytes = Uint8Array.from(atob(base64), (char) => char.charCodeAt(0));
|
|
1600
|
+
} catch {
|
|
1601
|
+
throw new ProfileCreationError(422, INVALID_AVATAR);
|
|
1602
|
+
}
|
|
1603
|
+
const mime = SIGNATURES.find((signature) => signature.test(bytes))?.mime;
|
|
1604
|
+
const dataUrlLength = `data:${mime};base64,`.length + Math.ceil(bytes.length / 3) * 4;
|
|
1605
|
+
if (!mime || dataUrlLength > 262144) throw new ProfileCreationError(422, INVALID_AVATAR);
|
|
1606
|
+
return bytes;
|
|
1607
|
+
}
|
|
1608
|
+
function profileMarkdown(displayName, hasAvatar) {
|
|
1609
|
+
return [
|
|
1610
|
+
"---",
|
|
1611
|
+
`name: ${JSON.stringify(displayName)}`,
|
|
1612
|
+
...hasAvatar ? [`icon: ${AVATAR_FILE}`] : [],
|
|
1613
|
+
`role: ${COORDINATOR_ROLE}`,
|
|
1614
|
+
"---",
|
|
1615
|
+
""
|
|
1616
|
+
].join("\n");
|
|
1617
|
+
}
|
|
1618
|
+
function soulMarkdown(soul, note) {
|
|
1619
|
+
return note ? `${soul}\n\n${NOTES_HEADING}\n\n${note}\n` : `${soul}\n`;
|
|
1620
|
+
}
|
|
1621
|
+
/**
|
|
1622
|
+
* Creates `~/.po/agents/<alias>` from a preset and makes sure `~/.po/profiles.yaml` lists `agents`.
|
|
1623
|
+
* A coordinator this endpoint made earlier under that alias is rewritten with the new choices, so a person who
|
|
1624
|
+
* restarts onboarding can keep their agent's name; any other profile owning the alias still refuses.
|
|
1625
|
+
*
|
|
1626
|
+
* The profiles.yaml change is planned first, so an invalid file stops before anything is written, and committed
|
|
1627
|
+
* last against the text it was computed from: a concurrent edit removes the new persona again and refuses.
|
|
1628
|
+
*/
|
|
1629
|
+
async function createPersonaProfile(dependencies, request) {
|
|
1630
|
+
const { fs, homeDirectory, context } = dependencies;
|
|
1631
|
+
const displayName = request.displayName.trim();
|
|
1632
|
+
if (!displayName) throw new ProfileCreationError(422, "Display name is required");
|
|
1633
|
+
const preset = PERSONA_PRESETS.find(({ id }) => id === request.preset);
|
|
1634
|
+
if (!preset) throw new ProfileCreationError(422, "Unknown persona preset");
|
|
1635
|
+
const avatar = request.avatarPngBase64 === void 0 ? void 0 : avatarBytes(request.avatarPngBase64);
|
|
1636
|
+
let plan;
|
|
1637
|
+
let profiles;
|
|
1638
|
+
try {
|
|
1639
|
+
plan = await planGlobalProfileRootAsync(fs, homeDirectory, AGENTS_ROOT, context);
|
|
1640
|
+
profiles = await loadProfilesAsync(fs, homeDirectory, context, homeDirectory);
|
|
1641
|
+
} catch {
|
|
1642
|
+
throw new ProfileCreationError(500, "Profile configuration is unavailable");
|
|
1643
|
+
}
|
|
1644
|
+
const personaDirectory = path.join(path.dirname(plan.filePath), AGENTS_ROOT, request.alias);
|
|
1645
|
+
const existing = profiles.find(({ name }) => name === request.alias);
|
|
1646
|
+
const updated = existing?.identity?.role === COORDINATOR_ROLE && path.resolve(existing.personaRoot, existing.persona) === personaDirectory;
|
|
1647
|
+
if (!updated && (existing || await pathExists(fs, personaDirectory, context))) throw new ProfileCreationError(409, "Profile alias is taken");
|
|
1648
|
+
try {
|
|
1649
|
+
if (avatar) await writeFileAtomic(fs, path.join(personaDirectory, AVATAR_FILE), avatar, context);
|
|
1650
|
+
await writeFileAtomic(fs, path.join(personaDirectory, "SOUL.md"), soulMarkdown(preset.soul, request.note?.trim()), context);
|
|
1651
|
+
await writeFileAtomic(fs, path.join(personaDirectory, "profile.md"), profileMarkdown(displayName, avatar !== void 0), context);
|
|
1652
|
+
await commitGlobalProfileRootAsync(fs, plan, context);
|
|
1653
|
+
} catch (error) {
|
|
1654
|
+
if (!updated) await removePath(fs, personaDirectory, context);
|
|
1655
|
+
if (error instanceof ProfileCatalogChangedError) throw new ProfileCreationError(409, "Profile configuration changed. Try again.");
|
|
1656
|
+
throw error;
|
|
1657
|
+
}
|
|
1658
|
+
return {
|
|
1659
|
+
name: request.alias,
|
|
1660
|
+
updated
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
//#endregion
|
|
1664
|
+
//#region ../../foundations/po-profile/src/extensions/(backend)/api/profile/route.server.ts
|
|
1665
|
+
const PROFILES_PATH = "/profiles";
|
|
1666
|
+
const LAUNCH_PROFILES_PATH$1 = "/launch-profiles";
|
|
1667
|
+
/**
|
|
1668
|
+
* Lists Home launch profiles and creates a personal coordinator profile. Global mount only: workspaces and sessions already own `profile`.
|
|
1669
|
+
* Creations run one at a time, so two requests cannot both claim one alias.
|
|
1670
|
+
*/
|
|
1671
|
+
var route_server_default$2 = defineRoutedContribution(({ context, host, signal }) => {
|
|
1672
|
+
if (host.scope !== "global") return void 0;
|
|
1673
|
+
let fs;
|
|
1674
|
+
context.inject([PO_FS_SERVICE], (scoped) => {
|
|
1675
|
+
const bound = requirePoFs(scoped);
|
|
1676
|
+
fs = bound;
|
|
1677
|
+
return () => {
|
|
1678
|
+
if (fs === bound) fs = void 0;
|
|
1679
|
+
};
|
|
1680
|
+
});
|
|
1681
|
+
return {
|
|
1682
|
+
basePath: "profile",
|
|
1683
|
+
start: (api) => {
|
|
1684
|
+
const creations = createSerialRunner();
|
|
1685
|
+
const create = async (request) => {
|
|
1686
|
+
let body;
|
|
1687
|
+
try {
|
|
1688
|
+
body = await request.json();
|
|
1689
|
+
} catch {
|
|
1690
|
+
return Response.json({ error: "Invalid profile" }, { status: 400 });
|
|
1691
|
+
}
|
|
1692
|
+
if (!Check(CreateProfileSchema, body)) return Response.json({ error: "Invalid profile" }, { status: 400 });
|
|
1693
|
+
const homeDirectory = api.homeDirectory ?? host.context.homeDirectory;
|
|
1694
|
+
if (!fs || !homeDirectory) return Response.json({ error: "Profile storage unavailable" }, { status: 503 });
|
|
1695
|
+
try {
|
|
1696
|
+
const { name, updated } = await createPersonaProfile({
|
|
1697
|
+
fs,
|
|
1698
|
+
homeDirectory,
|
|
1699
|
+
context: BACKGROUND_CONTEXT
|
|
1700
|
+
}, body);
|
|
1701
|
+
return Response.json({ name }, { status: updated ? 200 : 201 });
|
|
1702
|
+
} catch (error) {
|
|
1703
|
+
if (error instanceof ProfileCreationError) return Response.json({ error: error.message }, { status: error.status });
|
|
1704
|
+
throw error;
|
|
1705
|
+
}
|
|
1706
|
+
};
|
|
1707
|
+
return {
|
|
1708
|
+
async fetch(request) {
|
|
1709
|
+
const pathname = new URL(request.url).pathname;
|
|
1710
|
+
if (pathname === LAUNCH_PROFILES_PATH$1) {
|
|
1711
|
+
if (request.method !== "GET") return Response.json({ error: "Method not allowed" }, {
|
|
1712
|
+
status: 405,
|
|
1713
|
+
headers: { Allow: "GET" }
|
|
1714
|
+
});
|
|
1715
|
+
const homeDirectory = api.homeDirectory ?? host.context.homeDirectory;
|
|
1716
|
+
if (!fs || !homeDirectory) return Response.json({ error: "Profile storage unavailable" }, { status: 503 });
|
|
1717
|
+
let files;
|
|
1718
|
+
try {
|
|
1719
|
+
files = await loadProfilesAsync(fs, homeDirectory, 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
|
|
@@ -1683,8 +2119,15 @@ const serverPlugin = defineServerPlugin({
|
|
|
1683
2119
|
}),
|
|
1684
2120
|
global: async (context) => {
|
|
1685
2121
|
const scopeGlobal = await context.scopeRoot("global", root_server_default$1, context);
|
|
2122
|
+
const contextGlobal = {
|
|
2123
|
+
...context,
|
|
2124
|
+
root: scopeGlobal.value
|
|
2125
|
+
};
|
|
1686
2126
|
return {
|
|
1687
2127
|
...composeRootHooks(scopeGlobal),
|
|
2128
|
+
get api() {
|
|
2129
|
+
return defined([at(route_server_default$2, contextGlobal)]);
|
|
2130
|
+
},
|
|
1688
2131
|
services: [...scopeGlobal.services ?? []]
|
|
1689
2132
|
};
|
|
1690
2133
|
},
|