@agimon-ai/po-cloudflare 0.0.2-alpha.2 → 0.0.2-alpha.20
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 +4 -3
- package/dist/abort-signals-2GUraIGq.js +34 -0
- package/dist/agent-DTjnYFAN.js +6850 -0
- package/dist/anthropic-messages-5ODquUB-.js +14317 -0
- package/dist/{apiContracts-CHOiCbS_.js → apiContracts-DepyzMNr.js} +94 -81
- package/dist/{approval-BMXqnTYd.js → approval-Biq3NCWj.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-DoHlIPkU.js} +2 -2
- package/dist/assets/assets/{CodeEditorView-BnyZHaYM.js → CodeEditorView-BU8DeV_G.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-muME0eCj.js → abnfDiagram-WEYOIA3C-BkzARjqu.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DMnhK1WH.js → architecture-WOLXFQ4H-B_dgnlXa.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DKn7XGP7.js → architectureDiagram-ZHVYKT53-DMGAifk0.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-DtDctXZg.js → blockDiagram-RJAE7QA3-DwTSK4lj.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-23pGLJeP.js → c4Diagram-XDPPPE54-IRaOcC_u.js} +2 -2
- package/dist/assets/assets/channel-BXwM62E-.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BZ2nGNPa.js → chunk-2E7WHVMD-BvS46crW.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-Dui1SYFi.js → chunk-4EMNKR2T--n96Xbj0.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CUB92Evl.js → chunk-55XCU76K-D3h_hFRi.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-CVayPHfE.js → chunk-7S6XSTFO-Cj18feJl.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB---wakYqY.js → chunk-AQDTSKZB-DXsT43bg.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-DfbdohUR.js → chunk-DSNLSHJZ-Br7dX7yf.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-Dr4KRh-b.js → chunk-HAGFOTED-BcozAtPo.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D06cR91Z.js → chunk-HNE4Q36P-B8kgXgRq.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Ca4gLeDb.js → chunk-NQOKRVIF-Dn7UnsqE.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-DmL638jN.js → chunk-UHW7PFBP-BSJot0vi.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-pkxSW5Zj.js → chunk-VQ5W62QI-Cpf1EfZK.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Dcc8hV4U.js → chunk-WQQL4CDK-Dnc36uZR.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-C9Ka5KSI.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-B_HKcFrw.js → chunk-YZO67HFG-BV8_A7x3.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-DAzZUysS.js → chunk-ZAUX2LTX-C4Ne_31B.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-DAVgjymL.js → chunk-ZCHMQSOR-Dq9ModsA.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Fsw8TGPu.js → classDiagram-v2-4MYWR3UA-1BWEjXP9.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CgUbISYV.js → cose-bilkent-JH36ORCC-DREkvC_x.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-D1LxAU2x.js → cynefin-EF2NZ3EQ-CWziP8nx.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D54I1jil.js → cynefinDiagram-WF24UDRP-DOoYmcvz.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DC7zL16U.js → dagre-NK4GIZVX-OoAtEico.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-DB0ptUdz.js → diagram-CBK3MWTC-B-pl2-iR.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CozSftPJ.js → diagram-I5XIIV2D-uKzNJSZ2.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-g3WOEWDS.js → diagram-ODIL2UCW-CEXY_Tzu.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-CFxGeOYi.js → diagram-PFBEJUXE-MKlRQo-g.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-BQBsLche.js → diagram-RJA3I4VV-c2qlCEVs.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-DrjpW2yq.js → diagram-TYUNFSNR-DTdqLA6J.js} +2 -2
- package/dist/assets/assets/{dist-B3JXhDWV.js → dist-4TUOlkyl.js} +2 -2
- package/dist/assets/assets/{dist-1-mhYUBH.js → dist-BzTxJnSR.js} +2 -2
- package/dist/assets/assets/{dist-XIZum9n5.js → dist-D9lacOpq.js} +2 -2
- package/dist/assets/assets/{dist-gfbb4ygy.js → dist-DCKskbBE.js} +2 -2
- package/dist/assets/assets/{dist-h6SOnP8-.js → dist-DCc8tQ7G.js} +2 -2
- package/dist/assets/assets/{dist-Izr2SB3q.js → dist-DXlts_H5.js} +2 -2
- package/dist/assets/assets/{dist-DvgCCshF.js → dist-DvZCwSZ8.js} +2 -2
- package/dist/assets/assets/{dist-BabjcJ3j.js → dist-mQUN8X3n.js} +2 -2
- package/dist/assets/assets/{dist-DjL8d1jZ.js → dist-qZHwVT1x.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BZS_aAve.js → ebnfDiagram-V4P3TTPT-C89wxfCd.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-B2ksVmMA.js → elk-QONTBCTQ-BMBgLOae.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-7P6zF-Z-.js → erDiagram-KYQIGQAA-Bb04CRa4.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-RoGQoRq-.js → eventmodeling-K75KTNOO-DSyNf2MV.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-DXuTqLUd.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CTOlRy7M.js → ganttDiagram-R7GPNTJY-sB7-pF_t.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-CPqytIt0.js → gitGraph-VSP46ZUC-pWPBCmdT.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BffLxuxg.js → gitGraphDiagram-PDYL7XHY-DronDRed.js} +2 -2
- package/dist/assets/assets/index-CBNQEGK3.css +1 -0
- package/dist/assets/assets/index-DdAdCxGc.js +155 -0
- package/dist/assets/assets/{info-OHQRW6UA-BI8RK0Ow.js → info-OHQRW6UA-B375mT1i.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-DUIst1FB.js → infoDiagram-MVDRKAX5-9Hw3wWP7.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CA17Eho5.js → ishikawaDiagram-HPEHV2GE-CdPAuupk.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CNri5Ap9.js → journeyDiagram-BOSHW7O7-hqmaHM9u.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DnXna7jO.js → kanban-definition-FNSA4HC5-BdOHplX4.js} +2 -2
- package/dist/assets/assets/{line-BsXJZn93.js → line-BCSC3Bu2.js} +2 -2
- package/dist/assets/assets/{linear-BHYaD5T0.js → linear-D5ddQU3r.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-B64Eo-8a.js → mermaid-parser.core-BaSUi_Ph.js} +4 -4
- package/dist/assets/assets/{mermaid.core-Zw9qmTzg.js → mermaid.core-CUUsU9Ou.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-E5qz4KNc.js → mindmap-definition-6OY57UG3-BtVkhvIZ.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DgfizTr3.js → packet-JDAUHWVQ-CQ3OUDwI.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-D0WK_agM.js → pegDiagram-ECIUJNBX-DDnq-Kn3.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-PJR1sXD4.js → pie-XZMESJXO-BvOFTkQB.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CPuU-NTs.js → pieDiagram-GNMPY74T-Bdwhl9jD.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-5C9yjM1b.js → quadrantDiagram-D57K4MC3-GHKoDEeT.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-BspdXgl0.js → radar-ABXABTNO-Yk9rKkKW.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Ct0a6hLD.js → railroad-I3PHUGI6-Crr2QEwm.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-fduYB4SA.js → railroad-abnf-LNEFI6M7-CLrgwBog.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CTQa8Sww.js → railroad-ebnf-DWYD2UWJ-zWReI6MC.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-DatoH3GJ.js → railroad-peg-JR7BVNR7-CnVnlaHi.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-C8sWN8l2.js → railroadDiagram-Y72NRBL7-MJ68mMla.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-CqRz4RcT.js → requirementDiagram-EQYSW5RA-BYb-mTCH.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-bdiuKKlX.js → sankeyDiagram-SY24JHO5-DzONJsqQ.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Zy-8I0Hy.js → sequenceDiagram-BLEHNHQU-0vav9YWV.js} +2 -2
- package/dist/assets/assets/{src-gihY33R9.js → src-DZJUnjaM.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DXQERPvz.js → stateDiagram-v2-A6IESKWZ-B0M8THPh.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-1gjZQElg.js → swimlanes-B3ENRKFQ-5YJZCHIB.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-aJTRXiIU.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-CTeYEw-9.js → timeline-definition-JXYKGLGB-us1LwUHo.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DD-EsLLT.js → treeView-D4JQ5SDB-BSLlcDre.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-BLdFeS5J.js → treemap-SAJKECNS-DZ2SwLmk.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C1GikSSP.js → usecaseDiagram-WPOLBNNX-BrmvO_6k.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-B1FoA3g8.js → vennDiagram-Q3Y3IDCW-FKXSeKp5.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BrHb5Bjf.js → wardley-7MLQ67FV-DZ_vIMp2.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CmPLD1X4.js → wardleyDiagram-IVAIDKWA-CfLYNckm.js} +2 -2
- package/dist/assets/assets/{webpack-BYWDFj_R.js → webpack-CiS_BB3R.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-DR5pfEjl.js → xychartDiagram-4URNHDU4-DBucwhQh.js} +2 -2
- package/dist/assets/bundle-asset-policy.json +1 -1
- package/dist/assets/index.html +2 -2
- package/dist/assets/plugins/assets/base-C3j1WCCq.css +2 -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/chunks/po-web-runtime-Czm_C4SJ.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -0
- package/dist/assets/plugins/slots/approval.3e4ea6e4-CqQk6XG_.js +2 -0
- package/dist/assets/plugins/slots/artifacts.84980c32-DQlO5IFk.js +1 -0
- package/dist/assets/plugins/slots/autocompact.ec8f713f-B3KTYwW1.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.16ef5e25-CZRYQVIP.js +7 -0
- package/dist/assets/plugins/slots/codemode.5f359b9c-Bzl_K_vt.js +10 -0
- package/dist/assets/plugins/slots/domain.832848c8-CvnpuKCY.js +1 -0
- package/dist/assets/plugins/slots/edit.7c802139-kaxIknZ-.js +7 -0
- package/dist/assets/plugins/slots/files.364f16c9-wuB8gcQA.js +2 -0
- package/dist/assets/plugins/slots/grep.d8bf9f57-3FnU8p-d.js +1 -0
- package/dist/assets/plugins/slots/log.07fd59a4-C0PXQ0O1.js +4 -0
- package/dist/assets/plugins/slots/mcp.ea8b6aa2-D0CkHnIw.js +109 -0
- package/dist/assets/plugins/slots/profile.63bc3ae6-BSY3iYfJ.js +1 -0
- package/dist/assets/plugins/slots/prompts.9d9b47cc-xdCkNkoA.js +3 -0
- package/dist/assets/plugins/slots/read.926c024f-qqaxVlEX.js +1 -0
- package/dist/assets/plugins/slots/runner.5393fa6c-DfO2Z9HG.js +8 -0
- package/dist/assets/plugins/slots/skill.56c1cc07-CL_n-l4h.js +4 -0
- package/dist/assets/plugins/slots/vault.587549ba-DbG3F_on.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-DCIsEywH.js} +3 -3
- package/dist/azure-openai-config-COZUaRzM.js +55 -0
- package/dist/azure-openai-responses-Cs4k2HOd.js +183 -0
- package/dist/{backgroundWork-CeFrbRnj.js → backgroundWork-Bswjs1av.js} +1 -1
- package/dist/browser-BWf8OMfl.js +3 -0
- package/dist/childSession-Cf2-kH4O.js +22 -0
- package/dist/classifier-shared-IhSH9hhh.js +106 -0
- package/dist/cloudflare-workers-ai-system-one-BNnc8MuH.js +52 -0
- package/dist/{codemode-DbPu0yJN.js → codemode-CgVosRtU.js} +5 -2
- package/dist/contracts-CylyLZC8.js +19 -0
- package/dist/diagnostics-1lYFeSJe.js +131 -0
- package/dist/{server-D3PQk1Gt.js → dist-B-vqs6tA.js} +1 -546
- package/dist/dist-Dvx5mlIR.js +50 -0
- package/dist/{domains-BNjGTOPj.js → domains-BqChtBLN.js} +90 -16
- package/dist/env-api-keys-Bow6MJe2.js +32 -0
- package/dist/error-body-CJk7jMUh.js +102 -0
- package/dist/esm-BKJy3O9-.js +1553 -0
- package/dist/{exports-BNZz2DNU.js → exports-C_dclnKs.js} +24 -9
- package/dist/{remoteMcp-CMqZldeA.js → exports-DERO0cQf.js} +1154 -175
- package/dist/{extensionFile-CXOa5G4C.js → extensionFile-Ds7RCpnb.js} +12 -2
- package/dist/github-copilot-headers-D1RedfLn.js +22 -0
- package/dist/google-generative-ai-DXTILNT0.js +328 -0
- package/dist/google-shared-e4JDCTVP.js +19588 -0
- package/dist/google-vertex-a1lzvJfq.js +374 -0
- package/dist/{harnessStore-BT706Ly6.js → harnessStore-BectazJQ.js} +4 -4
- package/dist/harnessStore-C0Zwvny8.js +1 -0
- package/dist/hash-Dt6RIbkn.js +16 -0
- package/dist/headers-CwtEVQvr.js +17 -0
- package/dist/help-Dpm82qDr.js +91 -0
- package/dist/{hubChannel-BHQyzcOo.js → hubChannel-COvmdWGO.js} +11 -28
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/identity-BgfHobJH.js +165 -0
- package/dist/index.edge-B0D_Lgbx.js +56 -0
- package/dist/index.edge-BLmsRNW8.js +57 -0
- package/dist/index.edge-COJJ_Dv2.js +937 -0
- package/dist/index.edge-ChYa2LU4.js +14 -0
- package/dist/index.edge-ClLTmPFz.js +191 -0
- package/dist/{index.edge-BgSx_gRO.js → index.edge-b0z7PQ6b.js} +10 -5
- package/dist/iso-BPQViXM8.js +10 -0
- package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-pQGjhAks.js} +124 -15
- package/dist/{majorModes-DbCfLZH3.js → majorModes-BrL4EtzH.js} +5 -14
- package/dist/majorModes-WXt22_km.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-pbPBBuvs.js} +2 -2
- package/dist/migrations-5gbLIQIc.js +32 -0
- package/dist/mistral-conversations-CLwhVDjA.js +689 -0
- package/dist/models-Chzm15vC.js +1511 -0
- package/dist/node-BT4GsJQp.js +2479 -0
- package/dist/node-DytJOfYf.js +23 -0
- package/dist/notification-CINsJWDL.js +102 -0
- package/dist/openai-codex-responses-DRMONxDE.js +1210 -0
- package/dist/openai-completions-CcNhAv8l.js +984 -0
- package/dist/openai-decisions-BsFjaAGw.js +142 -0
- package/dist/openai-kPrtlgjl.js +17357 -0
- package/dist/openai-prompt-cache-Bc6qNWt0.js +8 -0
- package/dist/openai-responses-C5Gp2UOV.js +281 -0
- package/dist/openai-responses-shared-BbSi-wBR.js +661 -0
- package/dist/openrouter-cost-CvC52g3b.js +30 -0
- package/dist/openrouter-images-BoHl8g8p.js +124 -0
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/pi-messages-BXfrZLC7.js +312 -0
- package/dist/piConfig-BDUpA6w0.js +127 -0
- package/dist/piSettings-tdui0CZI.js +1 -0
- package/dist/{platform-B4AAgwJ0.js → platform-yhQXrrM_.js} +1 -1
- package/dist/{platformFiles-C_bXo4Ig.js → platformFiles-DB3Cw1l_.js} +27 -2
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-B6LbEIe6.js} +2 -2
- package/dist/provider-env-CxhHUFiF.js +38 -0
- package/dist/provider-retry-BUoezuw8.js +79 -0
- package/dist/sanitize-unicode-C3Ec8oL6.js +26 -0
- package/dist/sealedChannel-BeWNTWys.js +27 -0
- package/dist/{server-BZh1ZXz_.js → server-1O3JEYO0.js} +8 -19
- package/dist/server-B2G-c0hg.js +639 -0
- package/dist/{server-Dpgh8PDh.js → server-B8P-UkxF.js} +14 -5
- package/dist/server-BR9yl54i.js +2658 -0
- package/dist/{server-tvgQ99rv.js → server-BXFDsLgm.js} +371 -120
- package/dist/{server-BAAL9-NA.js → server-Bt6Zsqo8.js} +3 -10
- package/dist/server-CCwwnpH0.js +148 -0
- package/dist/{server-D4W7EdJY.js → server-Cgym-G0a.js} +16 -16
- package/dist/{server-DJAanjoI.js → server-Ci3ls6LL.js} +492 -103
- package/dist/{server-36iuA3MI.js → server-Ci_BGVwd.js} +3 -3
- package/dist/{server-A-_GFpPr.js → server-CyYesT-G.js} +10 -9
- package/dist/server-CzJjYgVk.js +295 -0
- package/dist/server-DFCXmDed.js +1806 -0
- package/dist/{server-BE6VqEiA.js → server-DL6UyXfJ.js} +19 -12
- package/dist/{server-D8ndq0wL.js → server-DPTp6GXS.js} +11 -9
- package/dist/server-DRcCuj6P.js +217 -0
- package/dist/server-Dgn4el5K.js +190 -0
- package/dist/server-DhkR6ugd.js +577 -0
- package/dist/server-GIQIpf33.js +489 -0
- package/dist/server-OerXqXJT.js +680 -0
- package/dist/server-Re1VNk9s.js +1517 -0
- package/dist/{server-Dt4y1rZD.js → server-V8W5mcGu.js} +6 -6
- package/dist/server-_0288DYR.js +935 -0
- package/dist/server-cStfn1Yv.js +505 -0
- package/dist/server-pY027myK.js +1057 -0
- package/dist/{build-2gFaVEfG.js → serverPlugin-OOfjB8tm.js} +3937 -3
- package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-DfwcUKO2.js} +551 -760
- package/dist/simple-options-CFzI5Pd_.js +156 -0
- package/dist/streaming-json-BWTHTwz-.js +858 -0
- package/dist/system-one-shared-CiIrx29d.js +132 -0
- package/dist/{notification-D76PSL7r.js → telemetry-Csv1ZxAn.js} +1 -92
- package/dist/transform-messages-D77af7Bx.js +356 -0
- package/dist/truncate-M3KbFyVj.js +89 -0
- package/dist/typesafe-system-one-DGxeggJh.js +37 -0
- package/dist/uuid-B0QJx6Kr.js +31 -0
- package/dist/{validation-D77NZBrx.js → validation-DuOGOKEi.js} +2 -2
- package/dist/{value-Djvc2foV.js → value-DyVsxCwZ.js} +1 -1
- package/dist/vaultSettings-BFCRCBM3.js +328 -0
- package/dist/web-cN41ySs9.js +3 -0
- package/dist/worker.js +95189 -49865
- package/dist/workflow-BgwWq0nq.js +79 -0
- package/package.json +32 -22
- package/wrangler.jsonc +2 -2
- package/dist/assets/assets/channel-CMrEzemr.js +0 -2
- package/dist/assets/assets/chunk-XXDRQBXY-CFf0S6bN.js +0 -2
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BhGbWVf0.js +0 -1
- package/dist/assets/assets/index-Bx_K4Joy.js +0 -155
- package/dist/assets/assets/index-DZM68mTk.css +0 -1
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-q91tR8ri.js +0 -9
- package/dist/contextProjection-DVP2Vc5j.js +0 -188
- package/dist/harnessStore-BiH9vSuD.js +0 -1
- package/dist/majorModes-BvWNqoHt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/server-BZaPPoQp.js +0 -592
- package/dist/server-D75MWDhB.js +0 -118
- package/dist/server-r358hzQg.js +0 -280
- package/dist/serverPlugin-BOI6c6s5.js +0 -3393
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import "./
|
|
5
|
-
import { c as
|
|
6
|
-
import "./
|
|
7
|
-
import { n as
|
|
8
|
-
import
|
|
9
|
-
import "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { t as loadHarnessStateAsync } from "./harnessStore-BT706Ly6.js";
|
|
1
|
+
import { B as String$1, Bn as BACKGROUND_CONTEXT, R as Union, W as Null, b as Service, bn as getOrThrow, ft as _Object_, gn as nodeHost, mn as createSerialRunner, mt as Optional, rr as defineServiceContract, x as PO_CONFIG_SERVICE } from "./serverPlugin-OOfjB8tm.js";
|
|
2
|
+
import { i as readTextIfExists, s as writeFileAtomic } from "./platformFiles-DB3Cw1l_.js";
|
|
3
|
+
import "./platform-yhQXrrM_.js";
|
|
4
|
+
import { t as createDirectoryWithMode } from "./atomicJson-DCIsEywH.js";
|
|
5
|
+
import { C as isSeq, _ as parseDocument, b as YAMLMap, c as globalPoConfigPath, f as repositoryPoConfigPath, g as parse, h as parsePoConfig, m as configScopeOf, n as poConfigCandidates, s as globalPoConfigDirectory, t as readPoConfigSourcesAsync, v as stringify, x as isMap } from "./layeredConfig-pQGjhAks.js";
|
|
6
|
+
import { a as defaultDomainsForMajorMode, l as readPoConfig, n as loadDomainsAsync, u as readPoConfigLayers } from "./domains-BqChtBLN.js";
|
|
7
|
+
import { n as defineApiRoutes, t as apiResponse } from "./hubRevisions-58pU2dW5.js";
|
|
8
|
+
import "./web-cN41ySs9.js";
|
|
9
|
+
import { n as savePiImageSettingsAsync, r as DEFAULT_IMAGE_MAX_DIMENSION, t as readPiImageSettings } from "./piConfig-BDUpA6w0.js";
|
|
10
|
+
import { r as MODES_FILE, t as readMajorModesConfig } from "./majorModes-BrL4EtzH.js";
|
|
11
|
+
import { t as loadHarnessStateAsync } from "./harnessStore-BectazJQ.js";
|
|
13
12
|
import path from "node:path";
|
|
14
13
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
15
14
|
//#region ../../foundations/po-config/src/services/config/sync.edge.ts
|
|
16
|
-
function nodeOnly
|
|
15
|
+
function nodeOnly(name, asyncName) {
|
|
17
16
|
throw new Error(`${name} is Node-only; use ${asyncName} with a PoPlatform on the edge.`);
|
|
18
17
|
}
|
|
19
18
|
/** @deprecated Node-only sync shim; use readPoConfig. Removed in M2. */
|
|
20
19
|
function loadPoConfig(_repoRoot, _homeDirectory, _environment) {
|
|
21
|
-
return nodeOnly
|
|
22
|
-
}
|
|
23
|
-
/** @deprecated Node-only sync shim; use readPoConfigLayers. Removed in M2. */
|
|
24
|
-
function loadPoConfigLayers(_repoRoot, _homeDirectory, _environment) {
|
|
25
|
-
return nodeOnly$2("loadPoConfigLayers", "readPoConfigLayers");
|
|
20
|
+
return nodeOnly("loadPoConfig", "readPoConfig");
|
|
26
21
|
}
|
|
27
22
|
//#endregion
|
|
28
23
|
//#region ../../foundations/po-config/src/services/configWriter/core.ts
|
|
@@ -138,379 +133,12 @@ async function writePoConfigValuesAsync(fs, filePath, edits, context, options =
|
|
|
138
133
|
});
|
|
139
134
|
}
|
|
140
135
|
//#endregion
|
|
141
|
-
//#region ../../foundations/po-config/src/services/domains/sync.edge.ts
|
|
142
|
-
function nodeOnly$1(name, asyncName) {
|
|
143
|
-
throw new Error(`${name} is Node-only; use ${asyncName} with a PoPlatform on the edge.`);
|
|
144
|
-
}
|
|
145
|
-
/** @deprecated Node-only sync shim; use loadDomainsAsync. Removed in M2. */
|
|
146
|
-
function loadDomains(_repoRoot, _homeDirectory) {
|
|
147
|
-
return nodeOnly$1("loadDomains", "loadDomainsAsync");
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
136
|
//#region ../../foundations/po-config/src/constants/settings.ts
|
|
151
137
|
const SELECTION_KEYS = {
|
|
152
138
|
majorMode: ["selection", "majorMode"],
|
|
153
139
|
domains: ["selection", "domains"],
|
|
154
140
|
profile: ["selection", "profile"]
|
|
155
141
|
};
|
|
156
|
-
/** Identity with inference, so a route table keeps its literal types. */
|
|
157
|
-
function defineApiRoutes(routes) {
|
|
158
|
-
return routes;
|
|
159
|
-
}
|
|
160
|
-
//#endregion
|
|
161
|
-
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/alien.js
|
|
162
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
163
|
-
function createReactiveSystem({ update, notify, unwatched }) {
|
|
164
|
-
return {
|
|
165
|
-
link,
|
|
166
|
-
unlink,
|
|
167
|
-
propagate,
|
|
168
|
-
checkDirty,
|
|
169
|
-
shallowPropagate
|
|
170
|
-
};
|
|
171
|
-
function link(dep, sub, version) {
|
|
172
|
-
const prevDep = sub.depsTail;
|
|
173
|
-
if (prevDep !== void 0 && prevDep.dep === dep) return;
|
|
174
|
-
const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
|
|
175
|
-
if (nextDep !== void 0 && nextDep.dep === dep) {
|
|
176
|
-
nextDep.version = version;
|
|
177
|
-
sub.depsTail = nextDep;
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const prevSub = dep.subsTail;
|
|
181
|
-
if (prevSub !== void 0 && prevSub.version === version && prevSub.sub === sub) return;
|
|
182
|
-
const newLink = sub.depsTail = dep.subsTail = {
|
|
183
|
-
version,
|
|
184
|
-
dep,
|
|
185
|
-
sub,
|
|
186
|
-
prevDep,
|
|
187
|
-
nextDep,
|
|
188
|
-
prevSub,
|
|
189
|
-
nextSub: void 0
|
|
190
|
-
};
|
|
191
|
-
if (nextDep !== void 0) nextDep.prevDep = newLink;
|
|
192
|
-
if (prevDep !== void 0) prevDep.nextDep = newLink;
|
|
193
|
-
else sub.deps = newLink;
|
|
194
|
-
if (prevSub !== void 0) prevSub.nextSub = newLink;
|
|
195
|
-
else dep.subs = newLink;
|
|
196
|
-
}
|
|
197
|
-
function unlink(link, sub = link.sub) {
|
|
198
|
-
const dep = link.dep;
|
|
199
|
-
const prevDep = link.prevDep;
|
|
200
|
-
const nextDep = link.nextDep;
|
|
201
|
-
const nextSub = link.nextSub;
|
|
202
|
-
const prevSub = link.prevSub;
|
|
203
|
-
if (nextDep !== void 0) nextDep.prevDep = prevDep;
|
|
204
|
-
else sub.depsTail = prevDep;
|
|
205
|
-
if (prevDep !== void 0) prevDep.nextDep = nextDep;
|
|
206
|
-
else sub.deps = nextDep;
|
|
207
|
-
if (nextSub !== void 0) nextSub.prevSub = prevSub;
|
|
208
|
-
else dep.subsTail = prevSub;
|
|
209
|
-
if (prevSub !== void 0) prevSub.nextSub = nextSub;
|
|
210
|
-
else if ((dep.subs = nextSub) === void 0) unwatched(dep);
|
|
211
|
-
return nextDep;
|
|
212
|
-
}
|
|
213
|
-
function propagate(link) {
|
|
214
|
-
let next = link.nextSub;
|
|
215
|
-
let stack;
|
|
216
|
-
top: do {
|
|
217
|
-
const sub = link.sub;
|
|
218
|
-
let flags = sub.flags;
|
|
219
|
-
if (!(flags & 60)) sub.flags = flags | 32;
|
|
220
|
-
else if (!(flags & 12)) flags = 0;
|
|
221
|
-
else if (!(flags & 4)) sub.flags = flags & -9 | 32;
|
|
222
|
-
else if (!(flags & 48) && isValidLink(link, sub)) {
|
|
223
|
-
sub.flags = flags | 40;
|
|
224
|
-
flags &= 1;
|
|
225
|
-
} else flags = 0;
|
|
226
|
-
if (flags & 2) notify(sub);
|
|
227
|
-
if (flags & 1) {
|
|
228
|
-
const subSubs = sub.subs;
|
|
229
|
-
if (subSubs !== void 0) {
|
|
230
|
-
const nextSub = (link = subSubs).nextSub;
|
|
231
|
-
if (nextSub !== void 0) {
|
|
232
|
-
stack = {
|
|
233
|
-
value: next,
|
|
234
|
-
prev: stack
|
|
235
|
-
};
|
|
236
|
-
next = nextSub;
|
|
237
|
-
}
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
if ((link = next) !== void 0) {
|
|
242
|
-
next = link.nextSub;
|
|
243
|
-
continue;
|
|
244
|
-
}
|
|
245
|
-
while (stack !== void 0) {
|
|
246
|
-
link = stack.value;
|
|
247
|
-
stack = stack.prev;
|
|
248
|
-
if (link !== void 0) {
|
|
249
|
-
next = link.nextSub;
|
|
250
|
-
continue top;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
break;
|
|
254
|
-
} while (true);
|
|
255
|
-
}
|
|
256
|
-
function checkDirty(link, sub) {
|
|
257
|
-
let stack;
|
|
258
|
-
let checkDepth = 0;
|
|
259
|
-
let dirty = false;
|
|
260
|
-
top: do {
|
|
261
|
-
const dep = link.dep;
|
|
262
|
-
const flags = dep.flags;
|
|
263
|
-
if (sub.flags & 16) dirty = true;
|
|
264
|
-
else if ((flags & 17) === 17) {
|
|
265
|
-
if (update(dep)) {
|
|
266
|
-
const subs = dep.subs;
|
|
267
|
-
if (subs.nextSub !== void 0) shallowPropagate(subs);
|
|
268
|
-
dirty = true;
|
|
269
|
-
}
|
|
270
|
-
} else if ((flags & 33) === 33) {
|
|
271
|
-
if (link.nextSub !== void 0 || link.prevSub !== void 0) stack = {
|
|
272
|
-
value: link,
|
|
273
|
-
prev: stack
|
|
274
|
-
};
|
|
275
|
-
link = dep.deps;
|
|
276
|
-
sub = dep;
|
|
277
|
-
++checkDepth;
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
if (!dirty) {
|
|
281
|
-
const nextDep = link.nextDep;
|
|
282
|
-
if (nextDep !== void 0) {
|
|
283
|
-
link = nextDep;
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
while (checkDepth--) {
|
|
288
|
-
const firstSub = sub.subs;
|
|
289
|
-
const hasMultipleSubs = firstSub.nextSub !== void 0;
|
|
290
|
-
if (hasMultipleSubs) {
|
|
291
|
-
link = stack.value;
|
|
292
|
-
stack = stack.prev;
|
|
293
|
-
} else link = firstSub;
|
|
294
|
-
if (dirty) {
|
|
295
|
-
if (update(sub)) {
|
|
296
|
-
if (hasMultipleSubs) shallowPropagate(firstSub);
|
|
297
|
-
sub = link.sub;
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
dirty = false;
|
|
301
|
-
} else sub.flags &= -33;
|
|
302
|
-
sub = link.sub;
|
|
303
|
-
const nextDep = link.nextDep;
|
|
304
|
-
if (nextDep !== void 0) {
|
|
305
|
-
link = nextDep;
|
|
306
|
-
continue top;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return dirty;
|
|
310
|
-
} while (true);
|
|
311
|
-
}
|
|
312
|
-
function shallowPropagate(link) {
|
|
313
|
-
do {
|
|
314
|
-
const sub = link.sub;
|
|
315
|
-
const flags = sub.flags;
|
|
316
|
-
if ((flags & 48) === 32) {
|
|
317
|
-
sub.flags = flags | 16;
|
|
318
|
-
if ((flags & 6) === 2) notify(sub);
|
|
319
|
-
}
|
|
320
|
-
} while ((link = link.nextSub) !== void 0);
|
|
321
|
-
}
|
|
322
|
-
function isValidLink(checkLink, sub) {
|
|
323
|
-
let link = sub.depsTail;
|
|
324
|
-
while (link !== void 0) {
|
|
325
|
-
if (link === checkLink) return true;
|
|
326
|
-
link = link.prevDep;
|
|
327
|
-
}
|
|
328
|
-
return false;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
//#endregion
|
|
332
|
-
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/atom.js
|
|
333
|
-
function toObserver(nextHandler, errorHandler, completionHandler) {
|
|
334
|
-
const isObserver = typeof nextHandler === "object";
|
|
335
|
-
const self = isObserver ? nextHandler : void 0;
|
|
336
|
-
return {
|
|
337
|
-
next: (isObserver ? nextHandler.next : nextHandler)?.bind(self),
|
|
338
|
-
error: (isObserver ? nextHandler.error : errorHandler)?.bind(self),
|
|
339
|
-
complete: (isObserver ? nextHandler.complete : completionHandler)?.bind(self)
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
const queuedEffects = [];
|
|
343
|
-
let cycle = 0;
|
|
344
|
-
const { link, unlink, propagate, checkDirty, shallowPropagate } = /* @__PURE__ */ createReactiveSystem({
|
|
345
|
-
update(atom) {
|
|
346
|
-
return atom._update();
|
|
347
|
-
},
|
|
348
|
-
notify(effect) {
|
|
349
|
-
queuedEffects[queuedEffectsLength++] = effect;
|
|
350
|
-
effect.flags &= -3;
|
|
351
|
-
},
|
|
352
|
-
unwatched(atom) {
|
|
353
|
-
if (atom.depsTail !== void 0) {
|
|
354
|
-
atom.depsTail = void 0;
|
|
355
|
-
atom.flags = 17;
|
|
356
|
-
purgeDeps(atom);
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
let notifyIndex = 0;
|
|
361
|
-
let queuedEffectsLength = 0;
|
|
362
|
-
let activeSub;
|
|
363
|
-
function purgeDeps(sub) {
|
|
364
|
-
const depsTail = sub.depsTail;
|
|
365
|
-
let dep = depsTail !== void 0 ? depsTail.nextDep : sub.deps;
|
|
366
|
-
while (dep !== void 0) dep = unlink(dep, sub);
|
|
367
|
-
}
|
|
368
|
-
function flush() {
|
|
369
|
-
while (notifyIndex < queuedEffectsLength) {
|
|
370
|
-
const effect = queuedEffects[notifyIndex];
|
|
371
|
-
queuedEffects[notifyIndex++] = void 0;
|
|
372
|
-
effect.notify();
|
|
373
|
-
}
|
|
374
|
-
notifyIndex = 0;
|
|
375
|
-
queuedEffectsLength = 0;
|
|
376
|
-
}
|
|
377
|
-
function createAtom(valueOrFn, options) {
|
|
378
|
-
const isComputed = typeof valueOrFn === "function";
|
|
379
|
-
const getter = valueOrFn;
|
|
380
|
-
const atom = {
|
|
381
|
-
_snapshot: isComputed ? void 0 : valueOrFn,
|
|
382
|
-
subs: void 0,
|
|
383
|
-
subsTail: void 0,
|
|
384
|
-
deps: void 0,
|
|
385
|
-
depsTail: void 0,
|
|
386
|
-
flags: isComputed ? 0 : 1,
|
|
387
|
-
get() {
|
|
388
|
-
if (activeSub !== void 0) link(atom, activeSub, cycle);
|
|
389
|
-
return atom._snapshot;
|
|
390
|
-
},
|
|
391
|
-
subscribe(observerOrFn) {
|
|
392
|
-
const obs = toObserver(observerOrFn);
|
|
393
|
-
const observed = { current: false };
|
|
394
|
-
const e = effect(() => {
|
|
395
|
-
atom.get();
|
|
396
|
-
if (!observed.current) observed.current = true;
|
|
397
|
-
else {
|
|
398
|
-
activeSub = void 0;
|
|
399
|
-
obs.next?.(atom._snapshot);
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
return { unsubscribe: () => {
|
|
403
|
-
e.stop();
|
|
404
|
-
} };
|
|
405
|
-
},
|
|
406
|
-
_update(getValue) {
|
|
407
|
-
const prevSub = activeSub;
|
|
408
|
-
const compare = options?.compare ?? Object.is;
|
|
409
|
-
if (isComputed) {
|
|
410
|
-
activeSub = atom;
|
|
411
|
-
++cycle;
|
|
412
|
-
atom.depsTail = void 0;
|
|
413
|
-
} else if (getValue === void 0) return false;
|
|
414
|
-
if (isComputed) atom.flags = 5;
|
|
415
|
-
try {
|
|
416
|
-
const oldValue = atom._snapshot;
|
|
417
|
-
const newValue = typeof getValue === "function" ? getValue(oldValue) : getValue === void 0 && isComputed ? getter(oldValue) : getValue;
|
|
418
|
-
if (oldValue === void 0 || !compare(oldValue, newValue)) {
|
|
419
|
-
atom._snapshot = newValue;
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
return false;
|
|
423
|
-
} finally {
|
|
424
|
-
activeSub = prevSub;
|
|
425
|
-
if (isComputed) atom.flags &= -5;
|
|
426
|
-
purgeDeps(atom);
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
if (isComputed) {
|
|
431
|
-
atom.flags = 17;
|
|
432
|
-
atom.get = function() {
|
|
433
|
-
const flags = atom.flags;
|
|
434
|
-
if (flags & 16 || flags & 32 && checkDirty(atom.deps, atom)) {
|
|
435
|
-
if (atom._update()) {
|
|
436
|
-
const subs = atom.subs;
|
|
437
|
-
if (subs !== void 0) shallowPropagate(subs);
|
|
438
|
-
}
|
|
439
|
-
} else if (flags & 32) atom.flags = flags & -33;
|
|
440
|
-
if (activeSub !== void 0) link(atom, activeSub, cycle);
|
|
441
|
-
return atom._snapshot;
|
|
442
|
-
};
|
|
443
|
-
} else atom.set = function(valueOrFn) {
|
|
444
|
-
if (atom._update(valueOrFn)) {
|
|
445
|
-
const subs = atom.subs;
|
|
446
|
-
if (subs !== void 0) {
|
|
447
|
-
propagate(subs);
|
|
448
|
-
shallowPropagate(subs);
|
|
449
|
-
flush();
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
};
|
|
453
|
-
return atom;
|
|
454
|
-
}
|
|
455
|
-
function effect(fn) {
|
|
456
|
-
const run = () => {
|
|
457
|
-
const prevSub = activeSub;
|
|
458
|
-
activeSub = effectObj;
|
|
459
|
-
++cycle;
|
|
460
|
-
effectObj.depsTail = void 0;
|
|
461
|
-
effectObj.flags = 6;
|
|
462
|
-
try {
|
|
463
|
-
return fn();
|
|
464
|
-
} finally {
|
|
465
|
-
activeSub = prevSub;
|
|
466
|
-
effectObj.flags &= -5;
|
|
467
|
-
purgeDeps(effectObj);
|
|
468
|
-
}
|
|
469
|
-
};
|
|
470
|
-
const effectObj = {
|
|
471
|
-
deps: void 0,
|
|
472
|
-
depsTail: void 0,
|
|
473
|
-
subs: void 0,
|
|
474
|
-
subsTail: void 0,
|
|
475
|
-
flags: 6,
|
|
476
|
-
notify() {
|
|
477
|
-
const flags = this.flags;
|
|
478
|
-
if (flags & 16 || flags & 32 && checkDirty(this.deps, this)) run();
|
|
479
|
-
else this.flags = 2;
|
|
480
|
-
},
|
|
481
|
-
stop() {
|
|
482
|
-
this.flags = 0;
|
|
483
|
-
this.depsTail = void 0;
|
|
484
|
-
purgeDeps(this);
|
|
485
|
-
}
|
|
486
|
-
};
|
|
487
|
-
run();
|
|
488
|
-
return effectObj;
|
|
489
|
-
}
|
|
490
|
-
//#endregion
|
|
491
|
-
//#region ../../../node_modules/.pnpm/@tanstack+store@0.11.2/node_modules/@tanstack/store/dist/store.js
|
|
492
|
-
var Store = class {
|
|
493
|
-
constructor(valueOrFn, actionsFactory) {
|
|
494
|
-
this.atom = createAtom(valueOrFn);
|
|
495
|
-
this.get = this.get.bind(this);
|
|
496
|
-
this.setState = this.setState.bind(this);
|
|
497
|
-
this.subscribe = this.subscribe.bind(this);
|
|
498
|
-
if (actionsFactory) this.actions = actionsFactory(this);
|
|
499
|
-
}
|
|
500
|
-
setState(updater) {
|
|
501
|
-
this.atom.set(updater);
|
|
502
|
-
}
|
|
503
|
-
get state() {
|
|
504
|
-
return this.atom.get();
|
|
505
|
-
}
|
|
506
|
-
get() {
|
|
507
|
-
return this.state;
|
|
508
|
-
}
|
|
509
|
-
subscribe(observerOrFn) {
|
|
510
|
-
return this.atom.subscribe(toObserver(observerOrFn));
|
|
511
|
-
}
|
|
512
|
-
};
|
|
513
|
-
new Store({});
|
|
514
142
|
//#endregion
|
|
515
143
|
//#region ../../foundations/po-config/src/types/apiRoutes.ts
|
|
516
144
|
/**
|
|
@@ -533,161 +161,102 @@ var apiRoutes_default = defineApiRoutes({
|
|
|
533
161
|
path: "/",
|
|
534
162
|
/** Repeatable. The page also sends `repoRoot`, which the mount ignores: it serves one repository. */
|
|
535
163
|
query: ["key"],
|
|
536
|
-
response:
|
|
164
|
+
response: /* @__PURE__ */ apiResponse()
|
|
537
165
|
},
|
|
538
166
|
value: {
|
|
539
167
|
method: "PUT",
|
|
540
168
|
path: "/value",
|
|
541
|
-
response:
|
|
169
|
+
response: /* @__PURE__ */ apiResponse()
|
|
542
170
|
},
|
|
543
171
|
repositories: {
|
|
544
172
|
method: "GET",
|
|
545
173
|
path: "/repositories",
|
|
546
|
-
response:
|
|
174
|
+
response: /* @__PURE__ */ apiResponse()
|
|
547
175
|
},
|
|
548
176
|
/** The workspace this mount was bound to; a global mount has none and answers 404. */
|
|
549
177
|
repository: {
|
|
550
178
|
method: "GET",
|
|
551
179
|
path: "/repository",
|
|
552
|
-
response:
|
|
180
|
+
response: /* @__PURE__ */ apiResponse()
|
|
553
181
|
},
|
|
554
182
|
selection: {
|
|
555
183
|
method: "PUT",
|
|
556
184
|
path: "/repository/selection",
|
|
557
|
-
response:
|
|
185
|
+
response: /* @__PURE__ */ apiResponse()
|
|
558
186
|
},
|
|
559
187
|
/** Pi's own image limits, served by the global mount only. */
|
|
560
188
|
images: {
|
|
561
189
|
method: "GET",
|
|
562
190
|
path: "/images",
|
|
563
|
-
response:
|
|
191
|
+
response: /* @__PURE__ */ apiResponse()
|
|
564
192
|
},
|
|
565
193
|
/** The same path as `images`; the method is the whole of the difference. */
|
|
566
194
|
saveImages: {
|
|
567
195
|
method: "PUT",
|
|
568
196
|
path: "/images",
|
|
569
|
-
response:
|
|
197
|
+
response: /* @__PURE__ */ apiResponse()
|
|
198
|
+
},
|
|
199
|
+
/** Your major modes from `~/.po/modes.yaml`, served by the global mount only. */
|
|
200
|
+
presets: {
|
|
201
|
+
method: "GET",
|
|
202
|
+
path: "/presets",
|
|
203
|
+
response: /* @__PURE__ */ apiResponse()
|
|
204
|
+
},
|
|
205
|
+
/** Sets `defaultMajorMode`; the method is the whole of the difference. */
|
|
206
|
+
savePresets: {
|
|
207
|
+
method: "PUT",
|
|
208
|
+
path: "/presets",
|
|
209
|
+
response: /* @__PURE__ */ apiResponse()
|
|
570
210
|
}
|
|
571
211
|
});
|
|
572
212
|
//#endregion
|
|
573
|
-
//#region ../../foundations/po-config/src/services/
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
/** Pi's own cap, from its resize core; also the largest value worth writing. */
|
|
578
|
-
const DEFAULT_IMAGE_MAX_DIMENSION = 2e3;
|
|
579
|
-
function clampImageMaxDimension(value) {
|
|
580
|
-
const rounded = Math.round(value);
|
|
581
|
-
if (rounded < 256) return 256;
|
|
582
|
-
if (rounded > 2e3) return DEFAULT_IMAGE_MAX_DIMENSION;
|
|
583
|
-
return rounded;
|
|
584
|
-
}
|
|
585
|
-
function isRecord$3(value) {
|
|
586
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
587
|
-
}
|
|
588
|
-
/** Resolves the effective limits, defaulting anything absent or unusable. */
|
|
589
|
-
function parsePiImageSettings(config) {
|
|
590
|
-
const images = config[IMAGE_SETTINGS_KEY];
|
|
591
|
-
if (!isRecord$3(images)) return {
|
|
592
|
-
autoResize: true,
|
|
593
|
-
maxDimension: DEFAULT_IMAGE_MAX_DIMENSION
|
|
594
|
-
};
|
|
595
|
-
const autoResize = images[IMAGE_AUTO_RESIZE_KEY];
|
|
596
|
-
const maxDimension = images[IMAGE_MAX_DIMENSION_KEY];
|
|
597
|
-
return {
|
|
598
|
-
autoResize: typeof autoResize === "boolean" ? autoResize : true,
|
|
599
|
-
maxDimension: typeof maxDimension === "number" && Number.isFinite(maxDimension) ? clampImageMaxDimension(maxDimension) : DEFAULT_IMAGE_MAX_DIMENSION
|
|
600
|
-
};
|
|
213
|
+
//#region ../../foundations/po-config/src/services/presets/index.ts
|
|
214
|
+
const io = BACKGROUND_CONTEXT;
|
|
215
|
+
function packageName(entry) {
|
|
216
|
+
return typeof entry === "string" ? entry : entry.name;
|
|
601
217
|
}
|
|
602
218
|
/**
|
|
603
|
-
*
|
|
604
|
-
*
|
|
219
|
+
* Settings > Presets: the major modes in `~/.po/modes.yaml`. Read with the home as the root, so
|
|
220
|
+
* the page shows your presets, never one repository's.
|
|
605
221
|
*/
|
|
606
|
-
function
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
222
|
+
async function readPresetsView(fs, homeDirectory, environment) {
|
|
223
|
+
const config = await readMajorModesConfig(fs, homeDirectory, io, {
|
|
224
|
+
homeDirectory,
|
|
225
|
+
environment
|
|
226
|
+
});
|
|
611
227
|
return {
|
|
612
|
-
|
|
613
|
-
[
|
|
228
|
+
defaultPreset: config.defaultMajorMode,
|
|
229
|
+
presets: Object.entries(config.majorMode).map(([name, mode]) => ({
|
|
230
|
+
name,
|
|
231
|
+
description: mode.description,
|
|
232
|
+
layers: mode.layers.map((layer) => ({
|
|
233
|
+
name: layer,
|
|
234
|
+
packages: (config.layers[layer]?.packages ?? []).map(packageName)
|
|
235
|
+
}))
|
|
236
|
+
})),
|
|
237
|
+
alwaysIncluded: (config.default?.packages ?? []).map(packageName)
|
|
614
238
|
};
|
|
615
239
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
function
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
for (const [key, value] of Object.entries(override)) {
|
|
630
|
-
const current = result[key];
|
|
631
|
-
result[key] = isObject(current) && isObject(value) ? mergeConfig(current, value) : value;
|
|
632
|
-
}
|
|
633
|
-
return result;
|
|
634
|
-
}
|
|
635
|
-
/** Parses one settings file; `undefined` text means the file is missing. */
|
|
636
|
-
function configFromText(text, filePath) {
|
|
637
|
-
if (text === void 0) return {};
|
|
638
|
-
let parsed;
|
|
240
|
+
/**
|
|
241
|
+
* Sets `defaultMajorMode` in `~/.po/modes.yaml`, keeping the file's comments. Answers an error
|
|
242
|
+
* string, rather than writing, when the name is not one of your presets or the file is not YAML;
|
|
243
|
+
* a result the loader refuses is put back as it was.
|
|
244
|
+
*/
|
|
245
|
+
async function writeDefaultPreset(fs, homeDirectory, environment, name) {
|
|
246
|
+
if (!(await readPresetsView(fs, homeDirectory, environment)).presets.some((preset) => preset.name === name)) return { error: `There is no preset named ${name}.` };
|
|
247
|
+
const file = path.join(globalPoConfigDirectory(homeDirectory), MODES_FILE);
|
|
248
|
+
const text = await readTextIfExists(fs, file, io);
|
|
249
|
+
const document = parseDocument(text ?? "");
|
|
250
|
+
if (document.errors.length > 0 || !isMap(document.contents)) return { error: `Your ${MODES_FILE} could not be read as YAML.` };
|
|
251
|
+
document.set("defaultMajorMode", name);
|
|
252
|
+
await writeFileAtomic(fs, file, document.toString(), io);
|
|
639
253
|
try {
|
|
640
|
-
|
|
254
|
+
return await readPresetsView(fs, homeDirectory, environment);
|
|
641
255
|
} catch (error) {
|
|
642
|
-
|
|
256
|
+
if (text === void 0) getOrThrow(await fs.remove(file, { force: true }, io));
|
|
257
|
+
else await writeFileAtomic(fs, file, text, io);
|
|
258
|
+
return { error: `Po left ${MODES_FILE} as it was: ${error instanceof Error ? error.message : String(error)}` };
|
|
643
259
|
}
|
|
644
|
-
if (!isObject(parsed)) throw new Error(`Pi settings at ${filePath} must be a JSON object`);
|
|
645
|
-
return parsed;
|
|
646
|
-
}
|
|
647
|
-
/**
|
|
648
|
-
* Where the image limits are read from and written to.
|
|
649
|
-
*
|
|
650
|
-
* The user layer only. Pi merges a trusted project settings.json over it, but
|
|
651
|
-
* these limits describe one machine's tolerance for image payloads rather than
|
|
652
|
-
* one repository's, and the cockpit page that writes them has no repository
|
|
653
|
-
* scope to offer. The legacy user path is still read, because a machine that
|
|
654
|
-
* has not been migrated still answers from it.
|
|
655
|
-
*/
|
|
656
|
-
function userSettingsPaths(homeDirectory) {
|
|
657
|
-
return {
|
|
658
|
-
legacy: path.join(homeDirectory, CONFIG_DIR_NAME, SETTINGS_FILE_NAME),
|
|
659
|
-
canonical: path.join(defaultAgentDirectory(homeDirectory), SETTINGS_FILE_NAME)
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
//#endregion
|
|
663
|
-
//#region ../../foundations/po-config/src/services/piConfig/index.ts
|
|
664
|
-
/** Image settings saves in this process are queued per file, so none reads a stale document. */
|
|
665
|
-
const imageSettingsWrites = createSerialRunner();
|
|
666
|
-
async function readConfig(fs, filePath, context) {
|
|
667
|
-
return configFromText(await readTextIfExists(fs, filePath, context), filePath);
|
|
668
|
-
}
|
|
669
|
-
async function readConfigPaths(fs, paths, context) {
|
|
670
|
-
return (await Promise.all(paths.map((filePath) => readConfig(fs, filePath, context)))).reduce(mergeConfig, {});
|
|
671
|
-
}
|
|
672
|
-
async function readPiImageSettings(fs, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
673
|
-
const paths = userSettingsPaths(homeDirectory);
|
|
674
|
-
return parsePiImageSettings(await readConfigPaths(fs, [paths.legacy, paths.canonical], context));
|
|
675
|
-
}
|
|
676
|
-
/**
|
|
677
|
-
* Writes the changed keys back and reports the limits that now apply.
|
|
678
|
-
*
|
|
679
|
-
* Read-modify-write on Pi's own file, so a save races a concurrent Pi settings
|
|
680
|
-
* save rather than merging with it. Pi writes only the fields its UI touched,
|
|
681
|
-
* as this does, which keeps the window to the one setting being changed on
|
|
682
|
-
* both sides at once. Saves from this process are queued.
|
|
683
|
-
*/
|
|
684
|
-
async function savePiImageSettingsAsync(fs, update, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
685
|
-
const paths = userSettingsPaths(homeDirectory);
|
|
686
|
-
await imageSettingsWrites.forKey(path.resolve(paths.canonical))(async () => {
|
|
687
|
-
const current = await readConfig(fs, paths.canonical, context);
|
|
688
|
-
await writePrivateAtomicJsonAsync(fs, paths.canonical, applyPiImageSettings(current, update), context);
|
|
689
|
-
});
|
|
690
|
-
return readPiImageSettings(fs, context, homeDirectory);
|
|
691
260
|
}
|
|
692
261
|
//#endregion
|
|
693
262
|
//#region ../../foundations/po-config/src/services/personaFrontMatter/index.ts
|
|
@@ -769,6 +338,66 @@ function parsePersonaFrontMatter(content) {
|
|
|
769
338
|
};
|
|
770
339
|
}
|
|
771
340
|
//#endregion
|
|
341
|
+
//#region ../../core/po-core/src/schemas/profileIdentity.ts
|
|
342
|
+
/**
|
|
343
|
+
* The custom session entry the runtime journals when the active profile's
|
|
344
|
+
* persona identity changes.
|
|
345
|
+
*
|
|
346
|
+
* A profile has always been prompt text only, so a cockpit had nothing to show
|
|
347
|
+
* for it beyond the profile name already published as footer status. This entry
|
|
348
|
+
* carries the persona's display name and avatar so the transcript can attribute
|
|
349
|
+
* each assistant message to the persona that produced it.
|
|
350
|
+
*
|
|
351
|
+
* It rides Pi's `entry_appended` frames on the road the agent-model projection
|
|
352
|
+
* already uses, so any RPC client sees the change live and on replay without a
|
|
353
|
+
* new protocol.
|
|
354
|
+
*
|
|
355
|
+
* Unlike the minor-mode, context, and agent-model projections, this entry is
|
|
356
|
+
* NOT a projection: it is transcript, positioned in journal order. A cockpit
|
|
357
|
+
* folding it must keep every occurrence rather than collapsing to the latest
|
|
358
|
+
* one, because a message written before a switch keeps the identity it was
|
|
359
|
+
* written under. Collapsing would rewrite history.
|
|
360
|
+
*/
|
|
361
|
+
const PO_PROFILE_IDENTITY_ENTRY_TYPE = "po-profile-identity";
|
|
362
|
+
/**
|
|
363
|
+
* Ceiling on the encoded icon, counted on the finished `data:` URL rather than
|
|
364
|
+
* the file, so one number bounds both the journal entry and the transport.
|
|
365
|
+
*
|
|
366
|
+
* An avatar renders at 32 CSS pixels. This much room is already generous, and
|
|
367
|
+
* the cap exists because the entry is replayed with the transcript: an oversize
|
|
368
|
+
* icon is dropped and the persona keeps its name, never failing a profile load.
|
|
369
|
+
*/
|
|
370
|
+
const PROFILE_ICON_MAX_DATA_URL_LENGTH = 262144;
|
|
371
|
+
const MAX_PROFILE_NAME_LENGTH = 128;
|
|
372
|
+
/**
|
|
373
|
+
* Image types allowed for a persona icon.
|
|
374
|
+
*
|
|
375
|
+
* Deliberately narrower than the cockpit's general media catalog: `image/svg+xml`
|
|
376
|
+
* is excluded because an SVG rendered same-origin executes script, and the icon
|
|
377
|
+
* path comes from user-authored persona front-matter. Do not reconcile this list
|
|
378
|
+
* with the broader media type map.
|
|
379
|
+
*/
|
|
380
|
+
const PROFILE_ICON_MIME_TYPES = [
|
|
381
|
+
"image/png",
|
|
382
|
+
"image/jpeg",
|
|
383
|
+
"image/gif",
|
|
384
|
+
"image/webp"
|
|
385
|
+
];
|
|
386
|
+
_Object_({
|
|
387
|
+
profile: Union([String$1({
|
|
388
|
+
minLength: 1,
|
|
389
|
+
maxLength: MAX_PROFILE_NAME_LENGTH
|
|
390
|
+
}), Null()]),
|
|
391
|
+
name: Optional(String$1({
|
|
392
|
+
minLength: 1,
|
|
393
|
+
maxLength: MAX_PROFILE_NAME_LENGTH
|
|
394
|
+
})),
|
|
395
|
+
icon: Optional(String$1({
|
|
396
|
+
minLength: 1,
|
|
397
|
+
maxLength: PROFILE_ICON_MAX_DATA_URL_LENGTH
|
|
398
|
+
}))
|
|
399
|
+
}, { additionalProperties: false });
|
|
400
|
+
//#endregion
|
|
772
401
|
//#region ../../foundations/po-config/src/services/personaIcon/core.ts
|
|
773
402
|
/**
|
|
774
403
|
* Pure half of persona icon loading: confinement and image sniffing. The
|
|
@@ -856,6 +485,27 @@ async function readPersonaIconAsync(fs, personaPath, iconRelative, context) {
|
|
|
856
485
|
}
|
|
857
486
|
}
|
|
858
487
|
//#endregion
|
|
488
|
+
//#region ../../core/po-core/src/schemas/personTimeZone.ts
|
|
489
|
+
const PO_PERSON_TIME_ZONE_SERVICE = "po/person-time-zone";
|
|
490
|
+
defineServiceContract(PO_PERSON_TIME_ZONE_SERVICE, { scope: "session" });
|
|
491
|
+
function readPoPersonTimeZone(context) {
|
|
492
|
+
return context.get(PO_PERSON_TIME_ZONE_SERVICE);
|
|
493
|
+
}
|
|
494
|
+
/** True for a zone name this runtime's Intl accepts, such as `Australia/Sydney`. */
|
|
495
|
+
function isTimeZone(value) {
|
|
496
|
+
if (typeof value !== "string" || value.length === 0 || value.length > 64) return false;
|
|
497
|
+
try {
|
|
498
|
+
new Intl.DateTimeFormat("en", { timeZone: value });
|
|
499
|
+
return true;
|
|
500
|
+
} catch {
|
|
501
|
+
return false;
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/** The system prompt line. It names no clock time, so it stays stable and the prompt cache holds. */
|
|
505
|
+
function personTimeZoneLine(zone) {
|
|
506
|
+
return zone === void 0 ? "Person's timezone: unknown. Ask the person before acting on a clock time or date; never assume the server's zone." : `Person's timezone: ${zone.timeZone} (from their ${zone.source}). Read and write dates and clock times in this zone unless the person names another.`;
|
|
507
|
+
}
|
|
508
|
+
//#endregion
|
|
859
509
|
//#region ../../foundations/po-config/src/services/profileBinding/index.ts
|
|
860
510
|
const BINDING_KEYS = /* @__PURE__ */ new Set([
|
|
861
511
|
"provider",
|
|
@@ -869,18 +519,35 @@ const SECRET_KEYS = /* @__PURE__ */ new Set([
|
|
|
869
519
|
"credentialId",
|
|
870
520
|
"field",
|
|
871
521
|
"purposes",
|
|
872
|
-
"allowedOrigins"
|
|
522
|
+
"allowedOrigins",
|
|
523
|
+
"allowedTargets"
|
|
524
|
+
]);
|
|
525
|
+
const VAULT_SECRET_KEYS = /* @__PURE__ */ new Set([
|
|
526
|
+
"vault",
|
|
527
|
+
"purposes",
|
|
528
|
+
"allowedOrigins",
|
|
529
|
+
"allowedTargets"
|
|
873
530
|
]);
|
|
874
531
|
const BROWSER_KEYS = /* @__PURE__ */ new Set([
|
|
875
532
|
"profileName",
|
|
876
533
|
"allowedOrigins",
|
|
877
534
|
"mode",
|
|
878
|
-
"proxySecret"
|
|
535
|
+
"proxySecret",
|
|
536
|
+
"geoip",
|
|
537
|
+
"timezone",
|
|
538
|
+
"locale",
|
|
539
|
+
"fingerprint"
|
|
540
|
+
]);
|
|
541
|
+
const FINGERPRINT_KEYS = /* @__PURE__ */ new Set([
|
|
542
|
+
"platform",
|
|
543
|
+
"seed",
|
|
544
|
+
"required"
|
|
879
545
|
]);
|
|
880
546
|
const PURPOSES = /* @__PURE__ */ new Set([
|
|
881
547
|
"browser",
|
|
882
548
|
"proxy",
|
|
883
|
-
"env"
|
|
549
|
+
"env",
|
|
550
|
+
"input"
|
|
884
551
|
]);
|
|
885
552
|
const BROWSER_MODES = /* @__PURE__ */ new Set([
|
|
886
553
|
"playwright",
|
|
@@ -890,6 +557,26 @@ const BROWSER_MODES = /* @__PURE__ */ new Set([
|
|
|
890
557
|
const ALIAS_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
891
558
|
const FIELD_PATTERN = /^(?:[A-Za-z][A-Za-z0-9_.-]{0,63}|profileSecret:[A-Z][A-Z0-9_]{0,63})$/;
|
|
892
559
|
const BROWSER_PROFILE_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
560
|
+
/** Browser-level defaults only. Every alias still requires its own exact recipient origins. */
|
|
561
|
+
const PROFILE_SOCIAL_BROWSER_ORIGINS = Object.freeze([
|
|
562
|
+
"https://x.com",
|
|
563
|
+
"https://www.x.com",
|
|
564
|
+
"https://twitter.com",
|
|
565
|
+
"https://www.twitter.com",
|
|
566
|
+
"https://reddit.com",
|
|
567
|
+
"https://www.reddit.com",
|
|
568
|
+
"https://linkedin.com",
|
|
569
|
+
"https://www.linkedin.com",
|
|
570
|
+
"https://facebook.com",
|
|
571
|
+
"https://www.facebook.com",
|
|
572
|
+
"https://instagram.com",
|
|
573
|
+
"https://www.instagram.com",
|
|
574
|
+
"https://tiktok.com",
|
|
575
|
+
"https://www.tiktok.com",
|
|
576
|
+
"https://youtube.com",
|
|
577
|
+
"https://www.youtube.com",
|
|
578
|
+
"https://accounts.google.com"
|
|
579
|
+
]);
|
|
893
580
|
function record(value, location, keys) {
|
|
894
581
|
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`${location} must be a mapping`);
|
|
895
582
|
if (keys && Object.keys(value).some((key) => !keys.has(key))) throw new Error(`${location} contains unsupported metadata`);
|
|
@@ -916,21 +603,118 @@ function origins(value, location) {
|
|
|
916
603
|
}
|
|
917
604
|
function purposes(value, location) {
|
|
918
605
|
if (value === void 0) return Object.freeze(["browser"]);
|
|
919
|
-
if (!Array.isArray(value) || value.length === 0 || value.some((entry) => typeof entry !== "string" || !PURPOSES.has(entry)) || new Set(value).size !== value.length) throw new Error(`${location} must list distinct purposes: browser, proxy or
|
|
606
|
+
if (!Array.isArray(value) || value.length === 0 || value.some((entry) => typeof entry !== "string" || !PURPOSES.has(entry)) || new Set(value).size !== value.length) throw new Error(`${location} must list distinct purposes: browser, proxy, env or input`);
|
|
920
607
|
return Object.freeze([...value]);
|
|
921
608
|
}
|
|
609
|
+
function timezone(value, location) {
|
|
610
|
+
try {
|
|
611
|
+
if (typeof value === "string" && value.length <= 64) {
|
|
612
|
+
new Intl.DateTimeFormat("en-US", { timeZone: value });
|
|
613
|
+
return value;
|
|
614
|
+
}
|
|
615
|
+
} catch {}
|
|
616
|
+
throw new Error(`${location} must be an IANA timezone`);
|
|
617
|
+
}
|
|
618
|
+
function locale(value, location) {
|
|
619
|
+
try {
|
|
620
|
+
if (typeof value === "string" && value.length <= 35 && Intl.getCanonicalLocales(value).length === 1) return value;
|
|
621
|
+
} catch {}
|
|
622
|
+
throw new Error(`${location} must be a BCP 47 locale`);
|
|
623
|
+
}
|
|
624
|
+
function fingerprint(value, location) {
|
|
625
|
+
const entry = record(value, location, FINGERPRINT_KEYS);
|
|
626
|
+
if (entry.platform !== void 0 && entry.platform !== "windows" && entry.platform !== "macos") throw new Error(`${location}.platform must be windows or macos`);
|
|
627
|
+
if (entry.seed !== void 0 && (typeof entry.seed !== "number" || !Number.isInteger(entry.seed) || entry.seed < 1e4 || entry.seed > 99999)) throw new Error(`${location}.seed must be an integer from 10000 to 99999`);
|
|
628
|
+
if (entry.required !== void 0 && typeof entry.required !== "boolean") throw new Error(`${location}.required must be a boolean`);
|
|
629
|
+
return Object.freeze({
|
|
630
|
+
...entry.platform === void 0 ? {} : { platform: entry.platform },
|
|
631
|
+
...entry.seed === void 0 ? {} : { seed: entry.seed },
|
|
632
|
+
...entry.required === void 0 ? {} : { required: entry.required }
|
|
633
|
+
});
|
|
634
|
+
}
|
|
922
635
|
function browser(value, location) {
|
|
923
636
|
const entry = record(value, location, BROWSER_KEYS);
|
|
924
637
|
if (typeof entry.profileName !== "string" || !BROWSER_PROFILE_PATTERN.test(entry.profileName)) throw new Error(`${location}.profileName must be a safe browser profile name`);
|
|
925
638
|
if (entry.mode !== void 0 && (typeof entry.mode !== "string" || !BROWSER_MODES.has(entry.mode))) throw new Error(`${location}.mode must be playwright, extension or stealth`);
|
|
926
639
|
if (entry.proxySecret !== void 0 && (typeof entry.proxySecret !== "string" || !ALIAS_PATTERN.test(entry.proxySecret))) throw new Error(`${location}.proxySecret must be an uppercase alias name`);
|
|
640
|
+
if (entry.geoip !== void 0 && typeof entry.geoip !== "boolean") throw new Error(`${location}.geoip must be a boolean`);
|
|
641
|
+
const pinned = entry.fingerprint === void 0 ? void 0 : fingerprint(entry.fingerprint, `${location}.fingerprint`);
|
|
642
|
+
if (pinned?.required && entry.mode !== void 0 && entry.mode !== "playwright") throw new Error(`${location}.fingerprint.required needs playwright mode`);
|
|
927
643
|
return Object.freeze({
|
|
928
644
|
profileName: entry.profileName,
|
|
929
|
-
allowedOrigins: origins(entry.allowedOrigins, `${location}.allowedOrigins`),
|
|
645
|
+
allowedOrigins: Object.freeze([.../* @__PURE__ */ new Set([...origins(entry.allowedOrigins, `${location}.allowedOrigins`), ...PROFILE_SOCIAL_BROWSER_ORIGINS])]),
|
|
930
646
|
...entry.mode === void 0 ? {} : { mode: entry.mode },
|
|
931
|
-
...entry.proxySecret === void 0 ? {} : { proxySecret: entry.proxySecret }
|
|
647
|
+
...entry.proxySecret === void 0 ? {} : { proxySecret: entry.proxySecret },
|
|
648
|
+
...entry.geoip === void 0 ? {} : { geoip: entry.geoip },
|
|
649
|
+
...entry.timezone === void 0 ? {} : { timezone: timezone(entry.timezone, `${location}.timezone`) },
|
|
650
|
+
...entry.locale === void 0 ? {} : { locale: locale(entry.locale, `${location}.locale`) },
|
|
651
|
+
...pinned === void 0 ? {} : { fingerprint: pinned }
|
|
932
652
|
});
|
|
933
653
|
}
|
|
654
|
+
function targets(value, forInput, location) {
|
|
655
|
+
if (value === void 0) {
|
|
656
|
+
if (forInput) throw new Error(`${location} requires explicit input targets`);
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
if (!forInput) throw new Error(`${location} requires the input purpose`);
|
|
660
|
+
const entries = record(value, location);
|
|
661
|
+
if (Object.keys(entries).length === 0) throw new Error(`${location} requires explicit input targets`);
|
|
662
|
+
const result = Object.create(null);
|
|
663
|
+
for (const [surface, list] of Object.entries(entries)) {
|
|
664
|
+
if (!/^[a-z][a-z0-9-]{0,63}$/.test(surface) || [
|
|
665
|
+
"browser",
|
|
666
|
+
"env",
|
|
667
|
+
"proxy",
|
|
668
|
+
"constructor",
|
|
669
|
+
"prototype"
|
|
670
|
+
].includes(surface) || !Array.isArray(list) || list.length === 0 || list.some((entry) => typeof entry !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,255}$/.test(entry))) throw new Error(`${location} must map surfaces to exact application identifiers`);
|
|
671
|
+
result[surface] = Object.freeze([...new Set(list)]);
|
|
672
|
+
}
|
|
673
|
+
return Object.freeze(result);
|
|
674
|
+
}
|
|
675
|
+
function delivery(secret, location) {
|
|
676
|
+
const secretPurposes = purposes(secret.purposes, `${location}.purposes`);
|
|
677
|
+
const forBrowser = secretPurposes.includes("browser");
|
|
678
|
+
const emptyOrigins = Array.isArray(secret.allowedOrigins) && secret.allowedOrigins.length === 0;
|
|
679
|
+
if (!forBrowser && secret.allowedOrigins !== void 0 && !emptyOrigins) throw new Error(`${location}.allowedOrigins requires the browser purpose`);
|
|
680
|
+
const allowedTargets = targets(secret.allowedTargets, secretPurposes.includes("input"), `${location}.allowedTargets`);
|
|
681
|
+
return {
|
|
682
|
+
purposes: secretPurposes,
|
|
683
|
+
allowedOrigins: forBrowser ? origins(secret.allowedOrigins, `${location}.allowedOrigins`) : Object.freeze([]),
|
|
684
|
+
...allowedTargets === void 0 ? {} : { allowedTargets }
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
/** Explicit vault aliases only. Templates never name a namespace or key themselves. */
|
|
688
|
+
function parseProfileVaultSecrets(value, location = "Profile secrets") {
|
|
689
|
+
const result = Object.create(null);
|
|
690
|
+
for (const [alias, valueEntry] of Object.entries(record(value, location))) {
|
|
691
|
+
if (!ALIAS_PATTERN.test(alias)) throw new Error(`${location} requires uppercase alias names`);
|
|
692
|
+
const secret = record(valueEntry, location, VAULT_SECRET_KEYS);
|
|
693
|
+
const vault = record(secret.vault, `${location}.vault`, /* @__PURE__ */ new Set([
|
|
694
|
+
"namespace",
|
|
695
|
+
"key",
|
|
696
|
+
"field"
|
|
697
|
+
]));
|
|
698
|
+
if (typeof vault.namespace !== "string" || !/^[a-z][a-z0-9.-]{0,63}$/.test(vault.namespace) || typeof vault.key !== "string" || vault.key.length < 1 || vault.key.length > 512 || /\p{Cc}/u.test(vault.key)) throw new Error(`${location}.vault requires a valid namespace and key`);
|
|
699
|
+
const field = vault.field === void 0 ? void 0 : reference(vault.field, `${location}.vault.field`);
|
|
700
|
+
if (field !== void 0 && ([
|
|
701
|
+
"__proto__",
|
|
702
|
+
"prototype",
|
|
703
|
+
"constructor"
|
|
704
|
+
].includes(field) || !FIELD_PATTERN.test(field))) throw new Error(`${location}.vault.field must be an own string field name`);
|
|
705
|
+
const scope = delivery(secret, location);
|
|
706
|
+
if (scope.purposes.some((purpose) => purpose !== "browser" && purpose !== "input")) throw new Error(`${location} vault aliases support browser and input purposes only`);
|
|
707
|
+
result[alias] = Object.freeze({
|
|
708
|
+
vault: Object.freeze({
|
|
709
|
+
namespace: vault.namespace,
|
|
710
|
+
key: vault.key,
|
|
711
|
+
...field === void 0 ? {} : { field }
|
|
712
|
+
}),
|
|
713
|
+
...scope
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
return Object.freeze(result);
|
|
717
|
+
}
|
|
934
718
|
/** Validates and deeply freezes a detached metadata snapshot. No provider SDK or secret is loaded. */
|
|
935
719
|
function parseProfileBinding(value, location = "Profile integration") {
|
|
936
720
|
const entry = record(value, location, BINDING_KEYS);
|
|
@@ -940,15 +724,10 @@ function parseProfileBinding(value, location = "Profile integration") {
|
|
|
940
724
|
if (!ALIAS_PATTERN.test(alias)) throw new Error(`${location}.secrets requires uppercase alias names`);
|
|
941
725
|
const secret = record(value, `${location}.secrets.${alias}`, SECRET_KEYS);
|
|
942
726
|
if (typeof secret.field !== "string" || !FIELD_PATTERN.test(secret.field)) throw new Error(`${location}.secrets.${alias}.field must be a credential field name`);
|
|
943
|
-
const secretPurposes = purposes(secret.purposes, `${location}.secrets.${alias}.purposes`);
|
|
944
|
-
const forBrowser = secretPurposes.includes("browser");
|
|
945
|
-
const emptyOrigins = Array.isArray(secret.allowedOrigins) && secret.allowedOrigins.length === 0;
|
|
946
|
-
if (!forBrowser && secret.allowedOrigins !== void 0 && !emptyOrigins) throw new Error(`${location}.secrets.${alias}.allowedOrigins requires the browser purpose`);
|
|
947
727
|
secrets[alias] = Object.freeze({
|
|
948
728
|
credentialId: reference(secret.credentialId, `${location}.secrets.${alias}.credentialId`),
|
|
949
729
|
field: secret.field,
|
|
950
|
-
|
|
951
|
-
allowedOrigins: forBrowser ? origins(secret.allowedOrigins, `${location}.secrets.${alias}.allowedOrigins`) : Object.freeze([])
|
|
730
|
+
...delivery(secret, `${location}.secrets.${alias}`)
|
|
952
731
|
});
|
|
953
732
|
}
|
|
954
733
|
const browserBinding = entry.browser === void 0 ? void 0 : browser(entry.browser, `${location}.browser`);
|
|
@@ -976,7 +755,9 @@ const PERSONA_IDENTITY_FILE = "profile.md";
|
|
|
976
755
|
const PROFILE_KEYS = /* @__PURE__ */ new Set([
|
|
977
756
|
"persona",
|
|
978
757
|
"env",
|
|
979
|
-
"integration"
|
|
758
|
+
"integration",
|
|
759
|
+
"secrets",
|
|
760
|
+
"timezone"
|
|
980
761
|
]);
|
|
981
762
|
const PROFILE_CATALOG_KEYS = /* @__PURE__ */ new Set([
|
|
982
763
|
"roots",
|
|
@@ -986,7 +767,9 @@ const PROFILE_CATALOG_KEYS = /* @__PURE__ */ new Set([
|
|
|
986
767
|
const SIDECAR_KEYS = /* @__PURE__ */ new Set([
|
|
987
768
|
"version",
|
|
988
769
|
"env",
|
|
989
|
-
"integration"
|
|
770
|
+
"integration",
|
|
771
|
+
"secrets",
|
|
772
|
+
"timezone"
|
|
990
773
|
]);
|
|
991
774
|
const SIDECAR_VERSION = 1;
|
|
992
775
|
const SIDECAR_MAX_BYTES = 65536;
|
|
@@ -1008,11 +791,17 @@ function parseEnvironment(name, value) {
|
|
|
1008
791
|
const environment = {};
|
|
1009
792
|
for (const [key, entry] of Object.entries(value)) {
|
|
1010
793
|
if (typeof entry !== "string") throw new Error(`Profile "${name}" env.${key} must be a string`);
|
|
1011
|
-
if (
|
|
794
|
+
if (/\$\{\s*secrets?\b|\{\{\s*secrets?\b/.test(entry)) throw new Error(`Profile "${name}" env cannot contain secret aliases`);
|
|
1012
795
|
environment[key] = entry;
|
|
1013
796
|
}
|
|
1014
797
|
return environment;
|
|
1015
798
|
}
|
|
799
|
+
/** The profile's own zone, spread into the profile only when declared. */
|
|
800
|
+
function parseTimezone(name, value) {
|
|
801
|
+
if (value === void 0) return {};
|
|
802
|
+
if (!isTimeZone(value)) throw new Error(`Profile "${name}" timezone must be an IANA zone such as Australia/Sydney`);
|
|
803
|
+
return { timezone: value };
|
|
804
|
+
}
|
|
1016
805
|
/** Strict v1 sidecar parse. YAML errors are reported generically so source text never reaches a diagnostic. */
|
|
1017
806
|
function parseProfileSidecar(name, text) {
|
|
1018
807
|
if (Buffer.byteLength(text) > SIDECAR_MAX_BYTES) throw new Error(`Profile "${name}" ${PROFILE_SIDECAR_FILE} is too large`);
|
|
@@ -1023,11 +812,13 @@ function parseProfileSidecar(name, text) {
|
|
|
1023
812
|
throw new Error(`Profile "${name}" ${PROFILE_SIDECAR_FILE} is not valid YAML`);
|
|
1024
813
|
}
|
|
1025
814
|
if (!isRecord$1(document)) throw new Error(`Profile "${name}" ${PROFILE_SIDECAR_FILE} must be a mapping`);
|
|
1026
|
-
if (Object.keys(document).some((key) => !SIDECAR_KEYS.has(key))) throw new Error(`Profile "${name}" ${PROFILE_SIDECAR_FILE} may only set version, env and
|
|
815
|
+
if (Object.keys(document).some((key) => !SIDECAR_KEYS.has(key))) throw new Error(`Profile "${name}" ${PROFILE_SIDECAR_FILE} may only set version, env, integration, secrets and timezone`);
|
|
1027
816
|
if (document.version !== SIDECAR_VERSION) throw new Error(`Profile "${name}" ${PROFILE_SIDECAR_FILE} must declare version: ${SIDECAR_VERSION}`);
|
|
1028
817
|
return {
|
|
1029
818
|
env: parseEnvironment(name, document.env),
|
|
1030
|
-
...document.
|
|
819
|
+
...document.secrets === void 0 ? {} : { secrets: parseProfileVaultSecrets(document.secrets) },
|
|
820
|
+
...document.integration === void 0 ? {} : { integration: parseProfileBinding(document.integration, `Profile "${name}" integration`) },
|
|
821
|
+
...parseTimezone(name, document.timezone)
|
|
1031
822
|
};
|
|
1032
823
|
}
|
|
1033
824
|
function sidecarDiagnostic(filePath, profile, error) {
|
|
@@ -1069,13 +860,45 @@ function parseProfileLayer(source) {
|
|
|
1069
860
|
};
|
|
1070
861
|
}
|
|
1071
862
|
/**
|
|
863
|
+
* The profiles.yaml text that also lists `root` in `profiles.roots`, or undefined when it already does.
|
|
864
|
+
* Comments and every other key are kept, a flat-form file moves under `entries`, and `defaultProfile` is never set.
|
|
865
|
+
*/
|
|
866
|
+
function withProfileRoot(text, filePath, baseDirectory, root) {
|
|
867
|
+
const document = parseDocument(text);
|
|
868
|
+
if (document.errors.length > 0) throw new Error(`${filePath} is not valid YAML`);
|
|
869
|
+
const current = document.toJS();
|
|
870
|
+
if (current === null || current === void 0) return stringify({ [PROFILES_ROOT_KEY]: { roots: [root] } });
|
|
871
|
+
if (parseProfileLayer({
|
|
872
|
+
filePath,
|
|
873
|
+
baseDirectory,
|
|
874
|
+
document: current
|
|
875
|
+
}).roots.includes(path.resolve(baseDirectory, root))) return void 0;
|
|
876
|
+
const profiles = document.get(PROFILES_ROOT_KEY, true);
|
|
877
|
+
if (!isMap(profiles)) throw new Error(`${filePath} must contain a profiles mapping`);
|
|
878
|
+
const roots = profiles.get("roots", true);
|
|
879
|
+
if (isSeq(roots)) roots.add(document.createNode(root));
|
|
880
|
+
else if (profiles.has("entries") || profiles.items.length === 0) profiles.set("roots", document.createNode([root]));
|
|
881
|
+
else {
|
|
882
|
+
const catalog = new YAMLMap();
|
|
883
|
+
catalog.set("roots", document.createNode([root]));
|
|
884
|
+
catalog.set("entries", profiles);
|
|
885
|
+
document.set(PROFILES_ROOT_KEY, catalog);
|
|
886
|
+
}
|
|
887
|
+
const output = document.toString();
|
|
888
|
+
parseProfileLayer({
|
|
889
|
+
filePath,
|
|
890
|
+
baseDirectory,
|
|
891
|
+
document: parse(output)
|
|
892
|
+
});
|
|
893
|
+
return output;
|
|
894
|
+
}
|
|
895
|
+
/**
|
|
1072
896
|
* Shape checks for one explicit entry. The caller checks the persona on disk,
|
|
1073
897
|
* then `profileFromDraft` parses env and integration, keeping the error order.
|
|
1074
898
|
*/
|
|
1075
899
|
function draftProfileEntry(personaRoot, configuredRoots, name, value) {
|
|
1076
900
|
if (!isRecord$1(value)) throw new Error(`Profile "${name}" must be a mapping`);
|
|
1077
|
-
|
|
1078
|
-
if (unsupported.length > 0) throw new Error(`Profile "${name}" may only set persona, env and integration; unsupported: ${unsupported.join(", ")}`);
|
|
901
|
+
if (Object.keys(value).filter((key) => !PROFILE_KEYS.has(key)).length > 0) throw new Error(`Profile "${name}" may only set persona, env, integration, secrets or timezone; unsupported metadata`);
|
|
1079
902
|
if (typeof value.persona !== "string" || value.persona.trim().length === 0) throw new Error(`Profile "${name}" must set a persona`);
|
|
1080
903
|
if (path.isAbsolute(value.persona)) throw new Error(`Profile "${name}" persona must be relative to the config that declares it`);
|
|
1081
904
|
const persona = value.persona;
|
|
@@ -1110,7 +933,9 @@ function profileFromDraft(draft, personaRoot, presentation) {
|
|
|
1110
933
|
persona: draft.persona,
|
|
1111
934
|
personaRoot,
|
|
1112
935
|
env: parseEnvironment(name, value.env),
|
|
936
|
+
...value.secrets === void 0 ? {} : { secrets: parseProfileVaultSecrets(value.secrets) },
|
|
1113
937
|
...value.integration === void 0 ? {} : { integration: parseProfileBinding(value.integration, `Profile "${name}" integration`) },
|
|
938
|
+
...parseTimezone(name, value.timezone),
|
|
1114
939
|
...presentation
|
|
1115
940
|
};
|
|
1116
941
|
}
|
|
@@ -1170,7 +995,9 @@ function inlineProfile(input) {
|
|
|
1170
995
|
persona: source,
|
|
1171
996
|
personaRoot: "",
|
|
1172
997
|
env: parseEnvironment(name, input.env),
|
|
998
|
+
...input.secrets === void 0 ? {} : { secrets: parseProfileVaultSecrets(input.secrets) },
|
|
1173
999
|
...input.integration === void 0 ? {} : { integration: parseProfileBinding(input.integration, `Profile "${name}" integration`) },
|
|
1000
|
+
...parseTimezone(name, input.timezone),
|
|
1174
1001
|
...presentation,
|
|
1175
1002
|
...Object.keys(identity).length === 0 ? {} : { identity },
|
|
1176
1003
|
personaPrompt
|
|
@@ -1180,19 +1007,6 @@ function sortProfiles(byName) {
|
|
|
1180
1007
|
return [...byName.values()].sort((left, right) => left.name.localeCompare(right.name));
|
|
1181
1008
|
}
|
|
1182
1009
|
//#endregion
|
|
1183
|
-
//#region ../../foundations/po-config/src/services/profiles/sync.edge.ts
|
|
1184
|
-
function nodeOnly(name, asyncName) {
|
|
1185
|
-
throw new Error(`${name} is Node-only; use ${asyncName} with a PoPlatform on the edge.`);
|
|
1186
|
-
}
|
|
1187
|
-
/** @deprecated Node-only sync shim; use loadProfilesAsync. Removed in M2. */
|
|
1188
|
-
function loadProfiles(_repoRoot, _homeDirectory) {
|
|
1189
|
-
return nodeOnly("loadProfiles", "loadProfilesAsync");
|
|
1190
|
-
}
|
|
1191
|
-
/** @deprecated Node-only sync shim; use buildPersonaPromptAsync. Removed in M2. */
|
|
1192
|
-
function buildPersonaPrompt(_personaRoot, _personaDirectory) {
|
|
1193
|
-
return nodeOnly("buildPersonaPrompt", "buildPersonaPromptAsync");
|
|
1194
|
-
}
|
|
1195
|
-
//#endregion
|
|
1196
1010
|
//#region ../../foundations/po-config/src/services/profiles/index.ts
|
|
1197
1011
|
/** Profile reads over a FileSystem; the Node shims in `./sync` give the same answers from node:fs. */
|
|
1198
1012
|
const realPath = async (fs, target, context) => getOrThrow(await fs.canonicalPath(target, context));
|
|
@@ -1322,8 +1136,41 @@ async function profilesFromLayers(fs, layers, context, diagnostics = []) {
|
|
|
1322
1136
|
async function loadProfilesAsync(fs, repoRoot, context, homeDirectory = nodeHost.homeDirectory()) {
|
|
1323
1137
|
return profilesFromLayers(fs, await readProfileLayers(fs, repoRoot, context, homeDirectory), context);
|
|
1324
1138
|
}
|
|
1139
|
+
/** Thrown when `~/.po/profiles.yaml` changed between planning and committing a root. */
|
|
1140
|
+
var ProfileCatalogChangedError = class extends Error {
|
|
1141
|
+
constructor(filePath) {
|
|
1142
|
+
super(`${filePath} changed while it was being updated`);
|
|
1143
|
+
this.name = "ProfileCatalogChangedError";
|
|
1144
|
+
}
|
|
1145
|
+
};
|
|
1146
|
+
const profileCatalogWrites = createSerialRunner();
|
|
1147
|
+
/** Reads the personal profiles.yaml and computes the text that lists `root`. Throws when the file is invalid. */
|
|
1148
|
+
async function planGlobalProfileRootAsync(fs, homeDirectory, root, context) {
|
|
1149
|
+
const [candidate] = poConfigCandidates(PROFILES_FILE, homeDirectory, homeDirectory);
|
|
1150
|
+
if (!candidate) throw new Error("No personal profiles.yaml location");
|
|
1151
|
+
const before = await readTextIfExists(fs, candidate.filePath, context);
|
|
1152
|
+
return {
|
|
1153
|
+
filePath: candidate.filePath,
|
|
1154
|
+
before,
|
|
1155
|
+
next: withProfileRoot(before ?? "", candidate.filePath, candidate.baseDirectory, root)
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
1158
|
+
/** Writes a plan unless the file changed since it was read, which throws ProfileCatalogChangedError. */
|
|
1159
|
+
async function commitGlobalProfileRootAsync(fs, plan, context) {
|
|
1160
|
+
await profileCatalogWrites.forKey(path.resolve(plan.filePath))(async () => {
|
|
1161
|
+
if (await readTextIfExists(fs, plan.filePath, context) !== plan.before) throw new ProfileCatalogChangedError(plan.filePath);
|
|
1162
|
+
if (plan.next !== void 0) await writeFileAtomic(fs, plan.filePath, plan.next, context);
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1325
1165
|
//#endregion
|
|
1326
1166
|
//#region ../../foundations/po-config/src/services/settings/index.ts
|
|
1167
|
+
/** The mount's admitted home and environment, so no reader falls back to the host's. */
|
|
1168
|
+
function readOptions(homeDirectory, environment) {
|
|
1169
|
+
return {
|
|
1170
|
+
...homeDirectory === void 0 ? {} : { homeDirectory },
|
|
1171
|
+
environment
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1327
1174
|
function isRecord(value) {
|
|
1328
1175
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1329
1176
|
}
|
|
@@ -1376,12 +1223,13 @@ function configuredSelectionValue(layers, key, effective) {
|
|
|
1376
1223
|
origin
|
|
1377
1224
|
};
|
|
1378
1225
|
}
|
|
1379
|
-
function repositorySettingsView(repository, homeDirectory, environment) {
|
|
1226
|
+
async function repositorySettingsView(fs, repository, homeDirectory, environment, io) {
|
|
1380
1227
|
const repoRoot = repository.path;
|
|
1381
|
-
const
|
|
1382
|
-
const
|
|
1383
|
-
const
|
|
1384
|
-
const
|
|
1228
|
+
const options = readOptions(homeDirectory, environment);
|
|
1229
|
+
const layers = await readPoConfigLayers(fs, repoRoot, io, options);
|
|
1230
|
+
const modes = await readMajorModesConfig(fs, repoRoot, io, options);
|
|
1231
|
+
const domains = await loadDomainsAsync(fs, repoRoot, io, homeDirectory);
|
|
1232
|
+
const profiles = await loadProfilesAsync(fs, repoRoot, io, homeDirectory);
|
|
1385
1233
|
const configured = layers.effective.selection;
|
|
1386
1234
|
const effectiveMajorMode = configured?.majorMode ?? modes.defaultMajorMode;
|
|
1387
1235
|
const effectiveDomains = configured?.domains ?? defaultDomainsForMajorMode(effectiveMajorMode, {}, domains.defaultDomains);
|
|
@@ -1460,9 +1308,9 @@ function selectionEdits(changes) {
|
|
|
1460
1308
|
...value === null ? {} : { value }
|
|
1461
1309
|
}));
|
|
1462
1310
|
}
|
|
1463
|
-
function configView(context, keys) {
|
|
1311
|
+
async function configView(fs, context, keys, io) {
|
|
1464
1312
|
const root = context.scope === "workspace" ? context.workspaceRoot : void 0;
|
|
1465
|
-
const layers =
|
|
1313
|
+
const layers = await readPoConfigLayers(fs, root, io, readOptions(context.homeDirectory, context.environment ?? {}));
|
|
1466
1314
|
const values = {};
|
|
1467
1315
|
for (const key of keys) {
|
|
1468
1316
|
const keyPath = key.split(".");
|
|
@@ -1486,7 +1334,7 @@ function configView(context, keys) {
|
|
|
1486
1334
|
//#region ../../foundations/po-config/src/services/settingsApi/index.ts
|
|
1487
1335
|
/**
|
|
1488
1336
|
* Config handlers are bound to their mount. Request paths cannot choose a different repository.
|
|
1489
|
-
*
|
|
1337
|
+
* Reads, writes and image settings all go through the host's FileSystem.
|
|
1490
1338
|
*/
|
|
1491
1339
|
const createSettingsApi = (fs) => ({
|
|
1492
1340
|
basePath: "settings",
|
|
@@ -1520,9 +1368,9 @@ const createSettingsApi = (fs) => ({
|
|
|
1520
1368
|
*/
|
|
1521
1369
|
const addresses = (route) => url.pathname === route.path && request.method === route.method;
|
|
1522
1370
|
const currentRepository = repository();
|
|
1523
|
-
if (addresses(apiRoutes_default.config)) return Response.json(configView(context, url.searchParams.getAll("key")));
|
|
1371
|
+
if (addresses(apiRoutes_default.config)) return Response.json(await configView(fs, context, url.searchParams.getAll("key"), io));
|
|
1524
1372
|
if (addresses(apiRoutes_default.repositories)) return Response.json({ repositories: context.repositories?.() ?? [] });
|
|
1525
|
-
if (addresses(apiRoutes_default.repository)) return currentRepository ? Response.json(repositorySettingsView(currentRepository, homeDirectory, environment)) : Response.json({ error: "Choose a workspace." }, { status: 404 });
|
|
1373
|
+
if (addresses(apiRoutes_default.repository)) return currentRepository ? Response.json(await repositorySettingsView(fs, currentRepository, homeDirectory, environment, io)) : Response.json({ error: "Choose a workspace." }, { status: 404 });
|
|
1526
1374
|
if (url.pathname === apiRoutes_default.images.path && context.scope === "global") {
|
|
1527
1375
|
if (request.method === apiRoutes_default.images.method) return Response.json(await imageView());
|
|
1528
1376
|
if (request.method === apiRoutes_default.saveImages.method) {
|
|
@@ -1536,11 +1384,23 @@ const createSettingsApi = (fs) => ({
|
|
|
1536
1384
|
return Response.json(await imageView());
|
|
1537
1385
|
}
|
|
1538
1386
|
}
|
|
1387
|
+
if (url.pathname === apiRoutes_default.presets.path && context.scope === "global") {
|
|
1388
|
+
if (!homeDirectory) return Response.json({ error: "Po has no home directory here." }, { status: 503 });
|
|
1389
|
+
if (request.method === apiRoutes_default.presets.method) return Response.json(await readPresetsView(fs, homeDirectory, environment));
|
|
1390
|
+
if (request.method === apiRoutes_default.savePresets.method) {
|
|
1391
|
+
const body = await request.json();
|
|
1392
|
+
if (!isRecord(body) || typeof body.defaultPreset !== "string" || !body.defaultPreset.trim()) return Response.json({ error: "Choose a preset." }, { status: 400 });
|
|
1393
|
+
const result = await writeDefaultPreset(fs, homeDirectory, environment, body.defaultPreset.trim());
|
|
1394
|
+
if ("error" in result) return Response.json(result, { status: 422 });
|
|
1395
|
+
context.configurationChanged?.();
|
|
1396
|
+
return Response.json(result);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1539
1399
|
if (addresses(apiRoutes_default.selection)) {
|
|
1540
1400
|
const body = parseSelectionWrite(await request.json());
|
|
1541
1401
|
if (!body) return Response.json({ error: "A selection write needs typed changes and a file hash." }, { status: 400 });
|
|
1542
1402
|
if (!currentRepository || body.repositoryId !== currentRepository.id) return Response.json({ error: "Workspace not found in this mount." }, { status: 404 });
|
|
1543
|
-
const before = repositorySettingsView(currentRepository, homeDirectory, environment);
|
|
1403
|
+
const before = await repositorySettingsView(fs, currentRepository, homeDirectory, environment, io);
|
|
1544
1404
|
if (before.hash !== body.expectedHash) return Response.json({
|
|
1545
1405
|
error: "The repository config changed since it was read.",
|
|
1546
1406
|
hash: before.hash
|
|
@@ -1549,7 +1409,7 @@ const createSettingsApi = (fs) => ({
|
|
|
1549
1409
|
if (invalid) return Response.json({ error: invalid }, { status: 422 });
|
|
1550
1410
|
await writePoConfigValuesAsync(fs, repositoryPoConfigPath(currentRepository.path), selectionEdits(body.changes), io, { scope: "repository" });
|
|
1551
1411
|
context.configurationChanged?.();
|
|
1552
|
-
return Response.json(repositorySettingsView(currentRepository, homeDirectory, environment));
|
|
1412
|
+
return Response.json(await repositorySettingsView(fs, currentRepository, homeDirectory, environment, io));
|
|
1553
1413
|
}
|
|
1554
1414
|
if (addresses(apiRoutes_default.value)) {
|
|
1555
1415
|
const body = parseWrite(await request.json());
|
|
@@ -1560,7 +1420,7 @@ const createSettingsApi = (fs) => ({
|
|
|
1560
1420
|
const allowed = configScopeOf(edit.keyPath);
|
|
1561
1421
|
return allowed !== "both" && allowed !== scope;
|
|
1562
1422
|
})) return Response.json({ error: "This key cannot be set at this scope." }, { status: 409 });
|
|
1563
|
-
const before = configView(context, []);
|
|
1423
|
+
const before = await configView(fs, context, [], io);
|
|
1564
1424
|
if (before.hashes[scope] !== body.expectedHash) return Response.json({
|
|
1565
1425
|
error: "The config changed since it was read.",
|
|
1566
1426
|
hash: before.hashes[scope]
|
|
@@ -1570,7 +1430,7 @@ const createSettingsApi = (fs) => ({
|
|
|
1570
1430
|
...value === null ? {} : { value }
|
|
1571
1431
|
})), io, { scope });
|
|
1572
1432
|
context.configurationChanged?.();
|
|
1573
|
-
return Response.json(configView(context, body.edits.map((edit) => edit.keyPath.join("."))));
|
|
1433
|
+
return Response.json(await configView(fs, context, body.edits.map((edit) => edit.keyPath.join(".")), io));
|
|
1574
1434
|
}
|
|
1575
1435
|
return Response.json({ error: "Configuration route not found." }, { status: 404 });
|
|
1576
1436
|
};
|
|
@@ -1595,218 +1455,149 @@ const createSettingsApi = (fs) => ({
|
|
|
1595
1455
|
}
|
|
1596
1456
|
});
|
|
1597
1457
|
//#endregion
|
|
1598
|
-
//#region ../../core/po-core/src/
|
|
1599
|
-
/**
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
/**
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
minLength: 1,
|
|
1742
|
-
maxLength: 96
|
|
1743
|
-
})),
|
|
1744
|
-
/** One line of help for the focused field. */
|
|
1745
|
-
detail: Optional(String$1({
|
|
1746
|
-
minLength: 1,
|
|
1747
|
-
maxLength: 240
|
|
1748
|
-
})),
|
|
1749
|
-
/** The config key this writes, shown under the focused field so the file stays legible. */
|
|
1750
|
-
keyPath: Optional(String$1({
|
|
1751
|
-
minLength: 1,
|
|
1752
|
-
maxLength: 128
|
|
1753
|
-
})),
|
|
1754
|
-
status: Optional(ConfigStatusSchema),
|
|
1755
|
-
/** Doubles as the error line: a rejected edit comes back as the old value plus this. */
|
|
1756
|
-
statusText: Optional(String$1({
|
|
1757
|
-
minLength: 1,
|
|
1758
|
-
maxLength: 240
|
|
1759
|
-
})),
|
|
1760
|
-
choices: Optional(_Array_(ConfigChoiceSchema, { maxItems: 128 })),
|
|
1761
|
-
actions: Optional(_Array_(ConfigActionSchema, { maxItems: 4 })),
|
|
1762
|
-
/** Work is running; the renderer dims the field and offers abort. */
|
|
1763
|
-
busy: Optional(Boolean()),
|
|
1764
|
-
progress: Optional(ConfigProgressSchema),
|
|
1765
|
-
steps: Optional(_Array_(ConfigStepSchema, { maxItems: 24 })),
|
|
1766
|
-
/**
|
|
1767
|
-
* The tail of a running command's terminal output.
|
|
1768
|
-
*
|
|
1769
|
-
* A tail rather than the whole scrollback: the field is a few rows of a
|
|
1770
|
-
* shared pane, and what matters is the question a package manager just
|
|
1771
|
-
* asked, not what it printed a minute ago.
|
|
1772
|
-
*/
|
|
1773
|
-
output: Optional(_Array_(String$1({ maxLength: 512 }), { maxItems: 64 })),
|
|
1774
|
-
/**
|
|
1775
|
-
* The command is waiting on the user. The renderer offers a line to type
|
|
1776
|
-
* into, which comes back as an owner-defined action carrying the text.
|
|
1777
|
-
*/
|
|
1778
|
-
awaitingInput: Optional(Boolean())
|
|
1779
|
-
}, { additionalProperties: false });
|
|
1780
|
-
const ConfigSectionSchema = _Object_({
|
|
1781
|
-
id: ConfigIdSchema,
|
|
1782
|
-
title: String$1({
|
|
1783
|
-
minLength: 1,
|
|
1784
|
-
maxLength: 32
|
|
1785
|
-
}),
|
|
1786
|
-
detail: Optional(String$1({
|
|
1787
|
-
minLength: 1,
|
|
1788
|
-
maxLength: 96
|
|
1789
|
-
})),
|
|
1790
|
-
order: Integer({
|
|
1791
|
-
minimum: 0,
|
|
1792
|
-
maximum: 1e3
|
|
1793
|
-
}),
|
|
1794
|
-
/** Section-wide state: readiness, or why a write failed. */
|
|
1795
|
-
notice: Optional(String$1({
|
|
1796
|
-
minLength: 1,
|
|
1797
|
-
maxLength: 240
|
|
1798
|
-
})),
|
|
1799
|
-
noticeLevel: Optional(Union([Literal("info"), Literal("error")])),
|
|
1800
|
-
fields: _Array_(ConfigFieldSchema, { maxItems: 64 })
|
|
1801
|
-
}, { additionalProperties: false });
|
|
1802
|
-
const ConfigSourceRefSchema = _Object_({
|
|
1803
|
-
source: ConfigSourceSchema,
|
|
1804
|
-
generation: String$1({ minLength: 1 })
|
|
1805
|
-
}, { additionalProperties: false });
|
|
1806
|
-
_Object_({
|
|
1807
|
-
...ConfigSourceRefSchema.properties,
|
|
1808
|
-
sections: _Array_(ConfigSectionSchema, { maxItems: 32 })
|
|
1809
|
-
}, { additionalProperties: false });
|
|
1458
|
+
//#region ../../core/po-core/src/services/toolCost/index.ts
|
|
1459
|
+
/** Mirrors the wire shape MCP advertises, so both estimates stay comparable. */
|
|
1460
|
+
function schemaPayload(entry) {
|
|
1461
|
+
return JSON.stringify({
|
|
1462
|
+
name: entry.name,
|
|
1463
|
+
...entry.description === void 0 ? {} : { description: entry.description },
|
|
1464
|
+
...entry.parameters === void 0 ? {} : { parameters: entry.parameters }
|
|
1465
|
+
});
|
|
1466
|
+
}
|
|
1467
|
+
function promptPayload(entry) {
|
|
1468
|
+
return [entry.promptSnippet ?? "", ...entry.promptGuidelines ?? []].filter(Boolean).join("\n");
|
|
1469
|
+
}
|
|
1470
|
+
function tokensForTool(entry, countTokens) {
|
|
1471
|
+
const schemaTokens = countTokens(schemaPayload(entry));
|
|
1472
|
+
const prompt = promptPayload(entry);
|
|
1473
|
+
const promptTokens = prompt.length === 0 ? 0 : countTokens(prompt);
|
|
1474
|
+
return {
|
|
1475
|
+
schemaTokens,
|
|
1476
|
+
promptTokens,
|
|
1477
|
+
totalTokens: schemaTokens + promptTokens
|
|
1478
|
+
};
|
|
1479
|
+
}
|
|
1480
|
+
/** Journal entry the cockpit reads; mirrored by CONTEXT_ENTRY_TYPE in po-web. */
|
|
1481
|
+
const PO_CONTEXT_ENTRY_TYPE = "po-context";
|
|
1482
|
+
/** Session selection and transition journal identities, not transport channels. */
|
|
1483
|
+
const PO_CONFIG_ENTRY_TYPE = "po:config:v1";
|
|
1484
|
+
const PO_CONFIG_TRANSITION_ENTRY_TYPE = "po:transition:v1";
|
|
1485
|
+
/** The tokenizer these counts came from, so a reader can judge them. */
|
|
1486
|
+
const CONTEXT_PROJECTION_ESTIMATOR = "gpt-tokenizer";
|
|
1487
|
+
/** Everything the runtime could not attribute lands here rather than vanishing. */
|
|
1488
|
+
const CORE_GROUP = "core";
|
|
1489
|
+
/** Pi's own tools have no package; the runtime itself is the owner. */
|
|
1490
|
+
const CORE_OWNER = "pi";
|
|
1491
|
+
const KIND_ORDER = {
|
|
1492
|
+
major: 0,
|
|
1493
|
+
minor: 1,
|
|
1494
|
+
domain: 2,
|
|
1495
|
+
shared: 3,
|
|
1496
|
+
core: 4
|
|
1497
|
+
};
|
|
1498
|
+
const SOURCE_ORDER = {
|
|
1499
|
+
extension: 0,
|
|
1500
|
+
mcp: 1,
|
|
1501
|
+
plugin: 2,
|
|
1502
|
+
core: 3
|
|
1503
|
+
};
|
|
1504
|
+
/** Reads only replayable selection fields, accepting legacy projections without a request marker. */
|
|
1505
|
+
function readProjectedSelection(data) {
|
|
1506
|
+
if (typeof data !== "object" || data === null || Array.isArray(data) || !("selection" in data)) return void 0;
|
|
1507
|
+
const selection = data.selection;
|
|
1508
|
+
if (typeof selection !== "object" || selection === null || Array.isArray(selection)) return void 0;
|
|
1509
|
+
if (!("majorMode" in selection) || typeof selection.majorMode !== "string") return void 0;
|
|
1510
|
+
if (!("domains" in selection) || !Array.isArray(selection.domains) || !selection.domains.every((domain) => typeof domain === "string")) return void 0;
|
|
1511
|
+
const profile = "profile" in selection ? selection.profile : void 0;
|
|
1512
|
+
if (profile !== void 0 && typeof profile !== "string") return void 0;
|
|
1513
|
+
const requestedProfile = "requestedProfile" in selection ? selection.requestedProfile : void 0;
|
|
1514
|
+
return {
|
|
1515
|
+
majorMode: selection.majorMode,
|
|
1516
|
+
domains: [...selection.domains],
|
|
1517
|
+
profile,
|
|
1518
|
+
...typeof requestedProfile === "string" || requestedProfile === null ? { requestedProfile } : {}
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
function skillSource(group) {
|
|
1522
|
+
if (group === "plugins") return "plugin";
|
|
1523
|
+
if (group === "extensions") return "extension";
|
|
1524
|
+
return "core";
|
|
1525
|
+
}
|
|
1526
|
+
function byRow(left, right) {
|
|
1527
|
+
return SOURCE_ORDER[left.source] - SOURCE_ORDER[right.source] || left.name.localeCompare(right.name);
|
|
1528
|
+
}
|
|
1529
|
+
function projectContext(input) {
|
|
1530
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
1531
|
+
const declare = (id, label, kind) => {
|
|
1532
|
+
if (!buckets.has(id)) buckets.set(id, {
|
|
1533
|
+
kind,
|
|
1534
|
+
label,
|
|
1535
|
+
items: []
|
|
1536
|
+
});
|
|
1537
|
+
};
|
|
1538
|
+
if (input.majorMode) declare(input.majorMode, input.majorMode, "major");
|
|
1539
|
+
for (const group of input.groups) declare(group.id, group.label, group.kind);
|
|
1540
|
+
for (const domain of input.domains) declare(domain, domain, "domain");
|
|
1541
|
+
const place = (owner, item, conditional) => {
|
|
1542
|
+
const attributed = conditional ?? input.attribution[owner];
|
|
1543
|
+
const id = attributed?.mode ?? CORE_GROUP;
|
|
1544
|
+
const kind = attributed?.kind ?? "core";
|
|
1545
|
+
declare(id, attributed && "label" in attributed ? attributed.label ?? id : id, kind);
|
|
1546
|
+
buckets.get(id)?.items.push(item);
|
|
1547
|
+
};
|
|
1548
|
+
for (const source of input.sources) {
|
|
1549
|
+
const owner = source.kind === "extension" ? source.packageName ?? source.key : source.kind === "mcp" ? source.key.slice(4) : CORE_OWNER;
|
|
1550
|
+
for (const tool of source.tools) {
|
|
1551
|
+
const cost = tokensForTool(tool, input.countTokens);
|
|
1552
|
+
const item = {
|
|
1553
|
+
name: tool.name,
|
|
1554
|
+
itemKind: "tool",
|
|
1555
|
+
source: source.kind === "core" ? "core" : source.kind,
|
|
1556
|
+
owner,
|
|
1557
|
+
tokens: cost.totalTokens,
|
|
1558
|
+
active: tool.active
|
|
1559
|
+
};
|
|
1560
|
+
if (source.kind === "core") {
|
|
1561
|
+
declare(CORE_GROUP, CORE_GROUP, "core");
|
|
1562
|
+
buckets.get(CORE_GROUP)?.items.push(item);
|
|
1563
|
+
} else place(owner, item, tool.contextAttribution);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
for (const skill of input.skills) place(skill.owner, {
|
|
1567
|
+
name: skill.name,
|
|
1568
|
+
itemKind: "skill",
|
|
1569
|
+
source: skillSource(skill.group),
|
|
1570
|
+
owner: skill.owner,
|
|
1571
|
+
tokens: skill.promptTokens ?? 0,
|
|
1572
|
+
active: true
|
|
1573
|
+
}, skill.contextAttribution);
|
|
1574
|
+
const groups = [...buckets.entries()].map(([id, bucket]) => {
|
|
1575
|
+
const items = [...bucket.items].sort(byRow);
|
|
1576
|
+
return {
|
|
1577
|
+
id,
|
|
1578
|
+
label: bucket.label,
|
|
1579
|
+
kind: bucket.kind,
|
|
1580
|
+
items,
|
|
1581
|
+
tokens: items.reduce((total, item) => total + (item.active ? item.tokens : 0), 0),
|
|
1582
|
+
inactiveTokens: items.reduce((total, item) => total + (item.active ? 0 : item.tokens), 0)
|
|
1583
|
+
};
|
|
1584
|
+
}).sort((left, right) => KIND_ORDER[left.kind] - KIND_ORDER[right.kind] || left.label.localeCompare(right.label));
|
|
1585
|
+
return {
|
|
1586
|
+
version: 1,
|
|
1587
|
+
revision: input.revision,
|
|
1588
|
+
selection: {
|
|
1589
|
+
majorMode: input.majorMode,
|
|
1590
|
+
domains: [...input.domains],
|
|
1591
|
+
...input.profile === void 0 ? {} : { profile: input.profile },
|
|
1592
|
+
...input.requestedProfile === void 0 ? {} : { requestedProfile: input.requestedProfile }
|
|
1593
|
+
},
|
|
1594
|
+
groups,
|
|
1595
|
+
totalTokens: groups.reduce((total, group) => total + group.tokens, 0),
|
|
1596
|
+
inactiveTokens: groups.reduce((total, group) => total + group.inactiveTokens, 0),
|
|
1597
|
+
...input.systemPrompt === void 0 ? {} : { systemPrompt: input.systemPrompt },
|
|
1598
|
+
estimator: CONTEXT_PROJECTION_ESTIMATOR
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1810
1601
|
//#endregion
|
|
1811
1602
|
//#region ../../foundations/po-config/src/services/poConfigService/index.ts
|
|
1812
1603
|
function deepFreeze$1(value) {
|
|
@@ -1958,4 +1749,4 @@ function providePoConfigContext(ctx, context, generation = `po-config:${crypto.r
|
|
|
1958
1749
|
return new PoConfigService(ctx, deepFreeze(context), loadPoConfig, generation);
|
|
1959
1750
|
}
|
|
1960
1751
|
//#endregion
|
|
1961
|
-
export {
|
|
1752
|
+
export { loadPoConfig as S, personTimeZoneLine as _, readProjectedSelection as a, PROFILE_ICON_MAX_DATA_URL_LENGTH as b, ProfileCatalogChangedError as c, planGlobalProfileRootAsync as d, inlineProfile as f, isTimeZone as g, PO_PERSON_TIME_ZONE_SERVICE as h, projectContext as i, commitGlobalProfileRootAsync as l, parseProfileVaultSecrets as m, providePoConfigContext as n, tokensForTool as o, parseProfileBinding as p, PO_CONTEXT_ENTRY_TYPE as r, createSettingsApi as s, createNativePoConfigContext as t, loadProfilesAsync as u, readPoPersonTimeZone as v, PROFILE_ICON_MIME_TYPES as x, PO_PROFILE_IDENTITY_ENTRY_TYPE as y };
|