@agimon-ai/po-cloudflare 0.0.2-alpha.2 → 0.0.2-alpha.21
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-DZ-OKOHn.js +6850 -0
- package/dist/anthropic-messages-5ODquUB-.js +14317 -0
- package/dist/{apiContracts-CHOiCbS_.js → apiContracts-b33nSAAI.js} +18 -81
- package/dist/{approval-BMXqnTYd.js → approval-r3NnI1VC.js} +19 -3
- package/dist/{approvalPrompt-Bg1JrEEY.js → approvalPrompt-DWoXxu3S.js} +2 -2
- package/dist/artifactFiles-DLCReI0-.js +1 -0
- package/dist/assets/assets/{CodeEditorView-BnyZHaYM.js → CodeEditorView-XeNS0L9M.js} +2 -2
- package/dist/assets/assets/{abnfDiagram-WEYOIA3C-muME0eCj.js → abnfDiagram-WEYOIA3C-B6ZW0nkR.js} +2 -2
- package/dist/assets/assets/{architecture-WOLXFQ4H-DMnhK1WH.js → architecture-WOLXFQ4H-bVR64sHO.js} +1 -1
- package/dist/assets/assets/{architectureDiagram-ZHVYKT53-DKn7XGP7.js → architectureDiagram-ZHVYKT53-D7tZz3io.js} +2 -2
- package/dist/assets/assets/{blockDiagram-RJAE7QA3-DtDctXZg.js → blockDiagram-RJAE7QA3-DdwScfiX.js} +2 -2
- package/dist/assets/assets/{c4Diagram-XDPPPE54-23pGLJeP.js → c4Diagram-XDPPPE54-DgSxZJCV.js} +2 -2
- package/dist/assets/assets/channel-TPcVvp_3.js +2 -0
- package/dist/assets/assets/{chunk-2E7WHVMD-BZ2nGNPa.js → chunk-2E7WHVMD-D5TXC2SM.js} +2 -2
- package/dist/assets/assets/{chunk-4EMNKR2T-Dui1SYFi.js → chunk-4EMNKR2T-BWhOSvo1.js} +2 -2
- package/dist/assets/assets/{chunk-55XCU76K-CUB92Evl.js → chunk-55XCU76K-HkkBzLtZ.js} +2 -2
- package/dist/assets/assets/{chunk-7S6XSTFO-CVayPHfE.js → chunk-7S6XSTFO-CBnjycLU.js} +2 -2
- package/dist/assets/assets/{chunk-AQDTSKZB---wakYqY.js → chunk-AQDTSKZB-75lIIq8T.js} +2 -2
- package/dist/assets/assets/{chunk-DSNLSHJZ-DfbdohUR.js → chunk-DSNLSHJZ-D8PpnXMk.js} +2 -2
- package/dist/assets/assets/{chunk-HAGFOTED-Dr4KRh-b.js → chunk-HAGFOTED-CXRS2NIN.js} +2 -2
- package/dist/assets/assets/{chunk-HNE4Q36P-D06cR91Z.js → chunk-HNE4Q36P-BocUqS94.js} +2 -2
- package/dist/assets/assets/{chunk-NQOKRVIF-Ca4gLeDb.js → chunk-NQOKRVIF-CHf_ogYT.js} +2 -2
- package/dist/assets/assets/{chunk-UHW7PFBP-DmL638jN.js → chunk-UHW7PFBP-DrW1PaIv.js} +2 -2
- package/dist/assets/assets/{chunk-VQ5W62QI-pkxSW5Zj.js → chunk-VQ5W62QI-CLoA7bFm.js} +2 -2
- package/dist/assets/assets/{chunk-WQQL4CDK-Dcc8hV4U.js → chunk-WQQL4CDK-BmBsrj9I.js} +2 -2
- package/dist/assets/assets/chunk-XXDRQBXY-iFE4Tl8c.js +2 -0
- package/dist/assets/assets/{chunk-YZO67HFG-B_HKcFrw.js → chunk-YZO67HFG-DShE_cgv.js} +2 -2
- package/dist/assets/assets/{chunk-ZAUX2LTX-DAzZUysS.js → chunk-ZAUX2LTX-B3oLvSXy.js} +2 -2
- package/dist/assets/assets/{chunk-ZCHMQSOR-DAVgjymL.js → chunk-ZCHMQSOR-B14vKK7C.js} +2 -2
- package/dist/assets/assets/{classDiagram-v2-4MYWR3UA-Fsw8TGPu.js → classDiagram-v2-4MYWR3UA-Da8elIW2.js} +2 -2
- package/dist/assets/assets/{cose-bilkent-JH36ORCC-CgUbISYV.js → cose-bilkent-JH36ORCC-Du4tGtiJ.js} +2 -2
- package/dist/assets/assets/{cynefin-EF2NZ3EQ-D1LxAU2x.js → cynefin-EF2NZ3EQ-Cyj6i_WI.js} +1 -1
- package/dist/assets/assets/{cynefinDiagram-WF24UDRP-D54I1jil.js → cynefinDiagram-WF24UDRP-DFWXwO7A.js} +2 -2
- package/dist/assets/assets/{dagre-NK4GIZVX-DC7zL16U.js → dagre-NK4GIZVX-C1wB_cf-.js} +2 -2
- package/dist/assets/assets/{diagram-CBK3MWTC-DB0ptUdz.js → diagram-CBK3MWTC-MYCOBYl6.js} +2 -2
- package/dist/assets/assets/{diagram-I5XIIV2D-CozSftPJ.js → diagram-I5XIIV2D-BFYbKUFf.js} +2 -2
- package/dist/assets/assets/{diagram-ODIL2UCW-g3WOEWDS.js → diagram-ODIL2UCW-6siqTpv_.js} +2 -2
- package/dist/assets/assets/{diagram-PFBEJUXE-CFxGeOYi.js → diagram-PFBEJUXE-CaBr9CoB.js} +2 -2
- package/dist/assets/assets/{diagram-RJA3I4VV-BQBsLche.js → diagram-RJA3I4VV-DAvmuDpc.js} +2 -2
- package/dist/assets/assets/{diagram-TYUNFSNR-DrjpW2yq.js → diagram-TYUNFSNR-CJnhgCpo.js} +2 -2
- package/dist/assets/assets/{dist-DjL8d1jZ.js → dist-BQ4W1R18.js} +2 -2
- package/dist/assets/assets/{dist-DvgCCshF.js → dist-BnzFckPF.js} +2 -2
- package/dist/assets/assets/{dist-gfbb4ygy.js → dist-CFtBpcYL.js} +2 -2
- package/dist/assets/assets/{dist-BabjcJ3j.js → dist-CIQX1z4W.js} +2 -2
- package/dist/assets/assets/{dist-XIZum9n5.js → dist-ChHYoe9_.js} +2 -2
- package/dist/assets/assets/{dist-1-mhYUBH.js → dist-DKxZO8d9.js} +2 -2
- package/dist/assets/assets/{dist-h6SOnP8-.js → dist-DL6z28wl.js} +2 -2
- package/dist/assets/assets/{dist-B3JXhDWV.js → dist-DNyn1p9Z.js} +2 -2
- package/dist/assets/assets/{dist-Izr2SB3q.js → dist-qYlLXIa8.js} +2 -2
- package/dist/assets/assets/{ebnfDiagram-V4P3TTPT-BZS_aAve.js → ebnfDiagram-V4P3TTPT-AUcqDTM3.js} +2 -2
- package/dist/assets/assets/{elk-QONTBCTQ-B2ksVmMA.js → elk-QONTBCTQ-aA10PEHJ.js} +2 -2
- package/dist/assets/assets/{erDiagram-KYQIGQAA-7P6zF-Z-.js → erDiagram-KYQIGQAA-hhYiqA-x.js} +2 -2
- package/dist/assets/assets/{eventmodeling-K75KTNOO-RoGQoRq-.js → eventmodeling-K75KTNOO-BQZqbRo5.js} +1 -1
- package/dist/assets/assets/flowDiagram-IUGLLWBU-BuyysPYC.js +1 -0
- package/dist/assets/assets/{ganttDiagram-R7GPNTJY-CTOlRy7M.js → ganttDiagram-R7GPNTJY-CLON1GpW.js} +2 -2
- package/dist/assets/assets/{gitGraph-VSP46ZUC-CPqytIt0.js → gitGraph-VSP46ZUC-DbmvNwR2.js} +1 -1
- package/dist/assets/assets/{gitGraphDiagram-PDYL7XHY-BffLxuxg.js → gitGraphDiagram-PDYL7XHY-DJVO0WlL.js} +2 -2
- package/dist/assets/assets/index-BiTVAj5E.js +155 -0
- package/dist/assets/assets/index-CBNQEGK3.css +1 -0
- package/dist/assets/assets/{info-OHQRW6UA-BI8RK0Ow.js → info-OHQRW6UA-CAt3Nt3g.js} +1 -1
- package/dist/assets/assets/{infoDiagram-MVDRKAX5-DUIst1FB.js → infoDiagram-MVDRKAX5-DTuqH-Zb.js} +2 -2
- package/dist/assets/assets/{ishikawaDiagram-HPEHV2GE-CA17Eho5.js → ishikawaDiagram-HPEHV2GE-BnWvdonT.js} +2 -2
- package/dist/assets/assets/{journeyDiagram-BOSHW7O7-CNri5Ap9.js → journeyDiagram-BOSHW7O7-Btxtcgvl.js} +2 -2
- package/dist/assets/assets/{kanban-definition-FNSA4HC5-DnXna7jO.js → kanban-definition-FNSA4HC5-q7ek9o_H.js} +2 -2
- package/dist/assets/assets/{line-BsXJZn93.js → line-B7yLilmC.js} +2 -2
- package/dist/assets/assets/{linear-BHYaD5T0.js → linear-y8aSKEli.js} +2 -2
- package/dist/assets/assets/{mermaid-parser.core-B64Eo-8a.js → mermaid-parser.core-B4rH50nD.js} +4 -4
- package/dist/assets/assets/{mermaid.core-Zw9qmTzg.js → mermaid.core-DnRVHTjE.js} +5 -5
- package/dist/assets/assets/{mindmap-definition-6OY57UG3-E5qz4KNc.js → mindmap-definition-6OY57UG3-DT9Afs2v.js} +2 -2
- package/dist/assets/assets/{packet-JDAUHWVQ-DgfizTr3.js → packet-JDAUHWVQ-CnqNbu4p.js} +1 -1
- package/dist/assets/assets/{pegDiagram-ECIUJNBX-D0WK_agM.js → pegDiagram-ECIUJNBX-cvxdBBFq.js} +2 -2
- package/dist/assets/assets/{pie-XZMESJXO-PJR1sXD4.js → pie-XZMESJXO-etXMNsaL.js} +1 -1
- package/dist/assets/assets/{pieDiagram-GNMPY74T-CPuU-NTs.js → pieDiagram-GNMPY74T-CBN-R3_j.js} +2 -2
- package/dist/assets/assets/{quadrantDiagram-D57K4MC3-5C9yjM1b.js → quadrantDiagram-D57K4MC3-C5jjVPIH.js} +2 -2
- package/dist/assets/assets/{radar-ABXABTNO-BspdXgl0.js → radar-ABXABTNO-CAMd_mrV.js} +1 -1
- package/dist/assets/assets/{railroad-I3PHUGI6-Ct0a6hLD.js → railroad-I3PHUGI6-DIs3auoe.js} +1 -1
- package/dist/assets/assets/{railroad-abnf-LNEFI6M7-fduYB4SA.js → railroad-abnf-LNEFI6M7-CJXr1qWy.js} +1 -1
- package/dist/assets/assets/{railroad-ebnf-DWYD2UWJ-CTQa8Sww.js → railroad-ebnf-DWYD2UWJ-DfwtykqI.js} +1 -1
- package/dist/assets/assets/{railroad-peg-JR7BVNR7-DatoH3GJ.js → railroad-peg-JR7BVNR7-B8beAhTs.js} +1 -1
- package/dist/assets/assets/{railroadDiagram-Y72NRBL7-C8sWN8l2.js → railroadDiagram-Y72NRBL7-BDcQE-EL.js} +2 -2
- package/dist/assets/assets/{requirementDiagram-EQYSW5RA-CqRz4RcT.js → requirementDiagram-EQYSW5RA-KJ4-QjZM.js} +2 -2
- package/dist/assets/assets/{sankeyDiagram-SY24JHO5-bdiuKKlX.js → sankeyDiagram-SY24JHO5-VjIB-Ybr.js} +2 -2
- package/dist/assets/assets/{sequenceDiagram-BLEHNHQU-Zy-8I0Hy.js → sequenceDiagram-BLEHNHQU-MfMuWq1M.js} +2 -2
- package/dist/assets/assets/{src-gihY33R9.js → src-BAxIj8GJ.js} +2 -2
- package/dist/assets/assets/{stateDiagram-v2-A6IESKWZ-DXQERPvz.js → stateDiagram-v2-A6IESKWZ-mHwLRRCY.js} +2 -2
- package/dist/assets/assets/{swimlanes-B3ENRKFQ-1gjZQElg.js → swimlanes-B3ENRKFQ-PArlYoqV.js} +2 -2
- package/dist/assets/assets/swimlanesDiagram-AYQRV4AK-The09-5S.js +9 -0
- package/dist/assets/assets/{timeline-definition-JXYKGLGB-CTeYEw-9.js → timeline-definition-JXYKGLGB-B2nKiNFU.js} +2 -2
- package/dist/assets/assets/{treeView-D4JQ5SDB-DD-EsLLT.js → treeView-D4JQ5SDB-gU23_RuI.js} +1 -1
- package/dist/assets/assets/{treemap-SAJKECNS-BLdFeS5J.js → treemap-SAJKECNS-CiqoMvZa.js} +1 -1
- package/dist/assets/assets/{usecaseDiagram-WPOLBNNX-C1GikSSP.js → usecaseDiagram-WPOLBNNX-DpeoWpMK.js} +2 -2
- package/dist/assets/assets/{vennDiagram-Q3Y3IDCW-B1FoA3g8.js → vennDiagram-Q3Y3IDCW-C31iGKvM.js} +2 -2
- package/dist/assets/assets/{wardley-7MLQ67FV-BrHb5Bjf.js → wardley-7MLQ67FV-CIzHhzNw.js} +1 -1
- package/dist/assets/assets/{wardleyDiagram-IVAIDKWA-CmPLD1X4.js → wardleyDiagram-IVAIDKWA-DIIkoezc.js} +2 -2
- package/dist/assets/assets/{webpack-BYWDFj_R.js → webpack-RFseiMZW.js} +2 -2
- package/dist/assets/assets/{xychartDiagram-4URNHDU4-DR5pfEjl.js → xychartDiagram-4URNHDU4-QiHL91kC.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-CKKRZ7-h.css +2 -0
- package/dist/assets/plugins/assets/browserCaptureWorklet-Droj0fW0-Droj0fW0.js +13 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
- package/dist/assets/plugins/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/assets/plugins/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/assets/plugins/assets/sileroVadWorker-D894njUe-DjN_BMWf.mjs +110 -0
- package/dist/assets/plugins/assets/silero_vad_v6.2.1-SjbCxFXk-SjbCxFXk.onnx +0 -0
- package/dist/assets/plugins/chunks/po-web-runtime-BJDT6Lbw.js +1 -0
- package/dist/assets/plugins/compositions.json +1 -0
- package/dist/assets/plugins/slots/approval.293d9a00-BXIhaPlQ.js +2 -0
- package/dist/assets/plugins/slots/artifacts.24567664-ZzR0gbvy.js +1 -0
- package/dist/assets/plugins/slots/author.0998a880-DAbA-7rb.js +93 -0
- package/dist/assets/plugins/slots/autocompact.dd97d013-IVq4Z6qm.js +1 -0
- package/dist/assets/plugins/slots/builtin-tools.36d7400b-CpCLjRRN.js +7 -0
- package/dist/assets/plugins/slots/codemode.8eaee717-VWt9PqsU.js +10 -0
- package/dist/assets/plugins/slots/domain.5e95fc37-5PIUBqDe.js +1 -0
- package/dist/assets/plugins/slots/edit.385c9aa9-DNAjPNG5.js +7 -0
- package/dist/assets/plugins/slots/files.daf34ed8-CQaTz0i1.js +2 -0
- package/dist/assets/plugins/slots/goal.77ec9930-B8EkarBq.js +1 -0
- package/dist/assets/plugins/slots/grep.02052cdc-CIRhO2gY.js +1 -0
- package/dist/assets/plugins/slots/help.ecd4c0f9-naMF9NN1.js +3 -0
- package/dist/assets/plugins/slots/log.a86eb6d0-D5__rAZJ.js +4 -0
- package/dist/assets/plugins/slots/mcp.974af249-DPNHn9XH.js +109 -0
- package/dist/assets/plugins/slots/plan.bafb8f68-C5GEpybF.js +3 -0
- package/dist/assets/plugins/slots/profile.48851a1d-yX6tzV3x.js +1 -0
- package/dist/assets/plugins/slots/prompts.723d7748-B7zpPeoF.js +3 -0
- package/dist/assets/plugins/slots/read.46bf6536-Cw5Z5z5T.js +1 -0
- package/dist/assets/plugins/slots/runner.53e9bd76-CiQR_FPX.js +8 -0
- package/dist/assets/plugins/slots/skill.086701a4-CL6h_F-x.js +4 -0
- package/dist/assets/plugins/slots/vault.ac9935c8-DKERQYg4.js +1 -0
- package/dist/assets/plugins/slots/voice.e85ca7f9-DEgb-U9m.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-C_7F2zD1.js} +2 -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-B1mPDYlf.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-DQFmrosw.js} +5 -2
- package/dist/contracts-DD3f1Lpn.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/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-B0WMEXCP.js +34 -0
- package/dist/{remoteMcp-CMqZldeA.js → exports-D09VsUk-.js} +1153 -175
- package/dist/{exports-BNZz2DNU.js → exports-nV43ShA7.js} +25 -9
- package/dist/{extensionFile-CXOa5G4C.js → extensionFile-DNM4xsje.js} +26 -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/{domains-BNjGTOPj.js → harnessState-Dwrk3lfv.js} +175 -16
- package/dist/{harnessStore-BT706Ly6.js → harnessStore-Z7yDLO45.js} +4 -5
- package/dist/hash-Dt6RIbkn.js +16 -0
- package/dist/headers-CwtEVQvr.js +17 -0
- package/dist/help-w6vVEZGL.js +101 -0
- package/dist/hubChannel-Cm-sxOvU.js +21 -0
- package/dist/hubRevisions-58pU2dW5.js +363 -0
- package/dist/identity-BgfHobJH.js +165 -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-DyYmurS7.js +62 -0
- package/dist/index.edge-K0w5auwG.js +56 -0
- package/dist/index.edge-Xa5LLtxz.js +67 -0
- package/dist/iso-BPQViXM8.js +10 -0
- package/dist/{layeredConfig-DPQAnlXD.js → layeredConfig-CUkYUs1f.js} +193 -15
- package/dist/{majorModes-DbCfLZH3.js → majorModes-BB0PXgFn.js} +4 -14
- package/dist/majorModes-C7vtBs4D.js +1 -0
- package/dist/{mcpProjection-BsP0IEnb.js → mcpProjection-BtKzB6oK.js} +2 -2
- package/dist/migrations-5gbLIQIc.js +32 -0
- package/dist/mistral-conversations-CLwhVDjA.js +689 -0
- package/dist/modeDefinition-C3Zbrw48.js +44 -0
- package/dist/models-Chzm15vC.js +1511 -0
- package/dist/narration-CpRurWLO.js +127 -0
- package/dist/node-BT4GsJQp.js +2479 -0
- package/dist/node-DytJOfYf.js +23 -0
- package/dist/notification-kckG3leF.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/{hubChannel-BHQyzcOo.js → packageApi-t1oCjNDU.js} +4 -41
- package/dist/photon_rs_bg.wasm +0 -0
- package/dist/pi-messages-BXfrZLC7.js +312 -0
- package/dist/piConfig-DQzlbPY4.js +126 -0
- package/dist/piSettings-Cf1QofNe.js +1 -0
- package/dist/platform-BIEiM4TG.js +113 -0
- package/dist/pluginContributions-Be9EnCAW.js +16 -0
- package/dist/pluginProtocol-BqXXyI4z.js +80 -0
- package/dist/{protocol-Xpm_mCNN.js → protocol-DDL8geoS.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-AbXyhXlY.js +217 -0
- package/dist/server-B6dqQoh2.js +1518 -0
- package/dist/server-BIHo9TFu.js +505 -0
- package/dist/{server-BZh1ZXz_.js → server-BJ7DNzCp.js} +8 -19
- package/dist/server-BO-j_GbD.js +15106 -0
- package/dist/{server-D4W7EdJY.js → server-BQzAiMns.js} +16 -16
- package/dist/server-BR7SZtj7.js +3125 -0
- package/dist/{server-BE6VqEiA.js → server-BT2ORK83.js} +20 -12
- package/dist/server-BbSHYRnY.js +295 -0
- package/dist/server-BqoKlEGk.js +1806 -0
- package/dist/{server-tvgQ99rv.js → server-Busl0pQI.js} +370 -120
- package/dist/server-CIHM4jqu.js +1116 -0
- package/dist/server-CgWSSdvd.js +576 -0
- package/dist/{server-Dpgh8PDh.js → server-Co_UWKrR.js} +14 -5
- package/dist/{server-BAAL9-NA.js → server-CuEPb7u-.js} +3 -10
- package/dist/{server-Dt4y1rZD.js → server-D40q2Jpx.js} +47 -27
- package/dist/server-DCyf2Asb.js +679 -0
- package/dist/server-DH7PfLln.js +148 -0
- package/dist/server-DJ8bc89M.js +934 -0
- package/dist/server-DYdp0W9v.js +489 -0
- package/dist/server-DsdPEYGu.js +639 -0
- package/dist/server-DymH4Ucq.js +189 -0
- package/dist/server-IqECnUrb.js +834 -0
- package/dist/{server-36iuA3MI.js → server-KBgW77zh.js} +3 -3
- package/dist/server-RW_9R3R3.js +1522 -0
- package/dist/server-aUit8j6r.js +1028 -0
- package/dist/{server-DJAanjoI.js → server-gifRriZK.js} +491 -103
- package/dist/server-nkUlqnAL.js +2658 -0
- package/dist/server-oxyEbv1a.js +1256 -0
- package/dist/{server-D8ndq0wL.js → server-ub3s16Mc.js} +11 -9
- package/dist/{build-2gFaVEfG.js → serverPlugin-CELT6P0Q.js} +3946 -3
- package/dist/{sessionConfig-rBQgzXlT.js → sessionConfig-RQGvfm6E.js} +550 -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/{server-A-_GFpPr.js → type-ASYnCGVW.js} +10 -1031
- package/dist/typesafe-system-one-DGxeggJh.js +37 -0
- package/dist/uuid-B0QJx6Kr.js +31 -0
- package/dist/{validation-D77NZBrx.js → validation-BJxVSAwx.js} +8 -3
- package/dist/{value-Djvc2foV.js → value-_W31So3B.js} +1 -1
- package/dist/vaultSettings-Di3n5YIg.js +328 -0
- package/dist/voiceTools-RMn4HvWo.js +246 -0
- package/dist/web-DCP7ELJj.js +3 -0
- package/dist/worker.js +95288 -49863
- package/dist/workflow-B7qx0Vv9.js +79 -0
- package/package.json +37 -22
- package/wrangler.jsonc +4 -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/harnessState-gmzJcPGt.js +0 -88
- package/dist/harnessStore-BiH9vSuD.js +0 -1
- package/dist/index.edge-BgSx_gRO.js +0 -45
- package/dist/majorModes-BvWNqoHt.js +0 -1
- package/dist/piSettings-B6fsgIBA.js +0 -1
- package/dist/platform-B4AAgwJ0.js +0 -16
- package/dist/platformFiles-C_bXo4Ig.js +0 -39
- package/dist/server-BZaPPoQp.js +0 -592
- package/dist/server-D75MWDhB.js +0 -118
- package/dist/server-r358hzQg.js +0 -280
- package/dist/serverPlugin-BOI6c6s5.js +0 -3393
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { n as normalizeProviderError, t as formatProviderError } from "./error-body-CJk7jMUh.js";
|
|
2
|
+
import { i as requiredNumber, n as parseClassifierUsage, r as postClassifierRequest, t as isRecord } from "./classifier-shared-IhSH9hhh.js";
|
|
3
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_018b33d3c6d4455b3921fdf11f2d0b63/node_modules/@earendil-works/pi-ai/dist/api/system-one-shared.js
|
|
4
|
+
/** TypeSafe's opt-in header for its experimental image input. */
|
|
5
|
+
const IMAGE_OPT_IN_HEADERS = { "TypeSafe-Danger-Zone-Images": "true" };
|
|
6
|
+
function probabilities(label, value, id) {
|
|
7
|
+
if (!isRecord(value)) throw new Error(`${label} returned invalid probabilities for ${id}`);
|
|
8
|
+
return Object.fromEntries(Object.entries(value).map(([key, probability]) => [key, requiredNumber(label, probability, `probability for ${id}.${key}`)]));
|
|
9
|
+
}
|
|
10
|
+
function parseAnswers(label, value, context) {
|
|
11
|
+
if (!isRecord(value)) throw new Error(`${label} returned an unexpected response`);
|
|
12
|
+
const answers = [];
|
|
13
|
+
for (const [id, question] of Object.entries(context.questions)) {
|
|
14
|
+
const answer = value[id];
|
|
15
|
+
if (!isRecord(answer)) throw new Error(`${label} did not return an answer for ${id}`);
|
|
16
|
+
if (question.type === "choice") {
|
|
17
|
+
if (answer.type !== "choice" || typeof answer.choice !== "string") throw new Error(`${label} did not return a choice answer for ${id}`);
|
|
18
|
+
answers.push([id, {
|
|
19
|
+
type: "choice",
|
|
20
|
+
choice: answer.choice,
|
|
21
|
+
probabilities: probabilities(label, answer.probabilities, id),
|
|
22
|
+
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
23
|
+
}]);
|
|
24
|
+
} else if (question.type === "score") {
|
|
25
|
+
if (answer.type !== "score") throw new Error(`${label} did not return a score answer for ${id}`);
|
|
26
|
+
answers.push([id, {
|
|
27
|
+
type: "score",
|
|
28
|
+
score: requiredNumber(label, answer.score, `score for ${id}`),
|
|
29
|
+
confidence: requiredNumber(label, answer.confidence, `confidence for ${id}`)
|
|
30
|
+
}]);
|
|
31
|
+
} else {
|
|
32
|
+
if (answer.type !== "noul") throw new Error(`${label} did not return a bool answer for ${id}`);
|
|
33
|
+
answers.push([id, {
|
|
34
|
+
type: "bool",
|
|
35
|
+
probability: requiredNumber(label, answer.noul, `probability for ${id}`)
|
|
36
|
+
}]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return Object.fromEntries(answers);
|
|
40
|
+
}
|
|
41
|
+
const ASSET_FORMATS = {
|
|
42
|
+
"image/png": "png",
|
|
43
|
+
"image/jpeg": "jpeg"
|
|
44
|
+
};
|
|
45
|
+
const DATA_URL_TYPES = /* @__PURE__ */ new Set([
|
|
46
|
+
"image/png",
|
|
47
|
+
"image/jpeg",
|
|
48
|
+
"image/webp"
|
|
49
|
+
]);
|
|
50
|
+
/** Clef accepts at most this many images per request. */
|
|
51
|
+
const MAX_DATA_URL_IMAGES = 4;
|
|
52
|
+
/** Adds the context images to `request` in the service's form. */
|
|
53
|
+
function addImages(label, model, input, images, request) {
|
|
54
|
+
if (input === "images") {
|
|
55
|
+
if (images.length > MAX_DATA_URL_IMAGES) throw new Error(`${label} accepts at most ${MAX_DATA_URL_IMAGES} images for ${model.id}, got ${images.length}`);
|
|
56
|
+
request.images = images.map((image) => {
|
|
57
|
+
if (!DATA_URL_TYPES.has(image.mimeType)) throw new Error(`${label} accepts PNG, JPEG, and WebP images for ${model.id}, got ${image.mimeType}`);
|
|
58
|
+
return `data:${image.mimeType};base64,${image.data}`;
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (input === "state-image-urls") {
|
|
63
|
+
request.state = [...images.map((image) => ({
|
|
64
|
+
type: "image_url",
|
|
65
|
+
image_url: { url: `data:${image.mimeType};base64,${image.data}` }
|
|
66
|
+
})), request.state];
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const assets = {};
|
|
70
|
+
images.forEach((image, index) => {
|
|
71
|
+
const format = ASSET_FORMATS[image.mimeType];
|
|
72
|
+
if (!format) throw new Error(`${label} accepts PNG and JPEG images for ${model.id}, got ${image.mimeType}`);
|
|
73
|
+
assets[`<image-${index + 1}>`] = {
|
|
74
|
+
type: "image",
|
|
75
|
+
format,
|
|
76
|
+
data_base64: image.data
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
request.assets = assets;
|
|
80
|
+
request.state = [...Object.keys(assets), request.state];
|
|
81
|
+
}
|
|
82
|
+
/** Maps public `bool` questions to TypeSafe's wire-level `noul` type. */
|
|
83
|
+
function wireRequest(context) {
|
|
84
|
+
return {
|
|
85
|
+
state: context.state,
|
|
86
|
+
questions: Object.fromEntries(Object.entries(context.questions).map(([id, question]) => [id, question.type === "bool" ? {
|
|
87
|
+
...question,
|
|
88
|
+
type: "noul"
|
|
89
|
+
} : question]))
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** Runs one System One classification over the given transport. */
|
|
93
|
+
async function classifySystemOne(transport, model, context, options) {
|
|
94
|
+
const output = {
|
|
95
|
+
api: model.api,
|
|
96
|
+
provider: model.provider,
|
|
97
|
+
model: model.id,
|
|
98
|
+
answers: {},
|
|
99
|
+
stopReason: "stop",
|
|
100
|
+
timestamp: Date.now()
|
|
101
|
+
};
|
|
102
|
+
try {
|
|
103
|
+
if (model.api !== transport.api) throw new Error(`Unsupported classifier API: ${model.api}`);
|
|
104
|
+
const request = wireRequest(context);
|
|
105
|
+
let requestOptions = options;
|
|
106
|
+
if (context.images?.length) {
|
|
107
|
+
if (!model.input.includes("image")) throw new Error(`${transport.label} does not support image input for ${model.id}`);
|
|
108
|
+
const detected = transport.detectCompat(model);
|
|
109
|
+
const imageInput = model.compat?.imageInput ?? detected.imageInput;
|
|
110
|
+
addImages(transport.label, model, imageInput, context.images, request);
|
|
111
|
+
if (model.compat?.sendImageOptInHeader ?? detected.sendImageOptInHeader) requestOptions = {
|
|
112
|
+
...options,
|
|
113
|
+
headers: {
|
|
114
|
+
...IMAGE_OPT_IN_HEADERS,
|
|
115
|
+
...options?.headers
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const body = await postClassifierRequest(transport.label, transport.url(model), model, transport.payload(model, request), requestOptions);
|
|
120
|
+
const result = transport.output(body);
|
|
121
|
+
const usage = parseClassifierUsage(result.usage, model);
|
|
122
|
+
if (usage) output.usage = usage;
|
|
123
|
+
output.answers = parseAnswers(transport.label, result.answers, context);
|
|
124
|
+
return output;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
127
|
+
output.errorMessage = formatProviderError(normalizeProviderError(error), `${transport.label} error`);
|
|
128
|
+
return output;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { classifySystemOne as t };
|
|
@@ -1,95 +1,4 @@
|
|
|
1
1
|
import { t as __commonJSMin } from "./rolldown-runtime-B-lAHAz2.js";
|
|
2
|
-
import { G as _Object_, _ as Union, k as Literal, q as Optional, y as String$1 } from "./build-2gFaVEfG.js";
|
|
3
|
-
import { n as Check } from "./value-Djvc2foV.js";
|
|
4
|
-
//#region ../../core/po-core/src/schemas/notification.ts
|
|
5
|
-
/** Provider-owned Cordis service for caller-authored notification requests. */
|
|
6
|
-
const PO_NOTIFICATION_SERVICE = "po/notification";
|
|
7
|
-
/** Custom session entry type used to publish normalized notification data. */
|
|
8
|
-
const PO_NOTIFICATION_ENTRY_TYPE = "po-notification";
|
|
9
|
-
const MAX_PO_NOTIFICATION_BODY_CHARACTERS = 4096;
|
|
10
|
-
const PoNotificationLevelSchema = Union([
|
|
11
|
-
Literal("info"),
|
|
12
|
-
Literal("warning"),
|
|
13
|
-
Literal("error")
|
|
14
|
-
]);
|
|
15
|
-
_Object_({
|
|
16
|
-
title: Optional(String$1({
|
|
17
|
-
minLength: 1,
|
|
18
|
-
maxLength: 128
|
|
19
|
-
})),
|
|
20
|
-
subtitle: Optional(String$1({
|
|
21
|
-
minLength: 1,
|
|
22
|
-
maxLength: 256
|
|
23
|
-
})),
|
|
24
|
-
body: String$1({
|
|
25
|
-
minLength: 1,
|
|
26
|
-
maxLength: MAX_PO_NOTIFICATION_BODY_CHARACTERS
|
|
27
|
-
}),
|
|
28
|
-
level: Optional(PoNotificationLevelSchema)
|
|
29
|
-
}, { additionalProperties: false });
|
|
30
|
-
const NormalizablePoNotificationRequestSchema = _Object_({
|
|
31
|
-
title: Optional(String$1()),
|
|
32
|
-
subtitle: Optional(String$1()),
|
|
33
|
-
body: String$1(),
|
|
34
|
-
level: Optional(PoNotificationLevelSchema)
|
|
35
|
-
}, { additionalProperties: false });
|
|
36
|
-
_Object_({
|
|
37
|
-
version: Literal(1),
|
|
38
|
-
title: String$1({ maxLength: 128 }),
|
|
39
|
-
subtitle: String$1({ maxLength: 256 }),
|
|
40
|
-
body: String$1({
|
|
41
|
-
minLength: 1,
|
|
42
|
-
maxLength: MAX_PO_NOTIFICATION_BODY_CHARACTERS
|
|
43
|
-
}),
|
|
44
|
-
level: PoNotificationLevelSchema
|
|
45
|
-
}, { additionalProperties: false });
|
|
46
|
-
function replaceControlCharacters(text) {
|
|
47
|
-
return Array.from(text, (character) => {
|
|
48
|
-
const codePoint = character.codePointAt(0);
|
|
49
|
-
return codePoint !== void 0 && (codePoint < 32 || codePoint === 127) ? " " : character;
|
|
50
|
-
}).join("");
|
|
51
|
-
}
|
|
52
|
-
function normalizeText(text, maximum) {
|
|
53
|
-
const normalized = replaceControlCharacters(text).replace(/\s+/gu, " ").trim();
|
|
54
|
-
if (!normalized) return void 0;
|
|
55
|
-
let truncated = "";
|
|
56
|
-
for (const character of normalized) {
|
|
57
|
-
if (truncated.length + character.length > maximum) break;
|
|
58
|
-
truncated += character;
|
|
59
|
-
}
|
|
60
|
-
return truncated;
|
|
61
|
-
}
|
|
62
|
-
/** Normalize caller-owned notification text into a validated request. */
|
|
63
|
-
function normalizePoNotificationRequest(request) {
|
|
64
|
-
if (!Check(NormalizablePoNotificationRequestSchema, request)) return void 0;
|
|
65
|
-
const body = normalizeText(request.body, MAX_PO_NOTIFICATION_BODY_CHARACTERS);
|
|
66
|
-
if (!body) return void 0;
|
|
67
|
-
const title = request.title && normalizeText(request.title, 128);
|
|
68
|
-
const subtitle = request.subtitle && normalizeText(request.subtitle, 256);
|
|
69
|
-
const normalized = {
|
|
70
|
-
body,
|
|
71
|
-
...title ? { title } : {},
|
|
72
|
-
...subtitle ? { subtitle } : {},
|
|
73
|
-
...request.level ? { level: request.level } : {}
|
|
74
|
-
};
|
|
75
|
-
return Object.freeze(normalized);
|
|
76
|
-
}
|
|
77
|
-
/** Builds normalized, versioned data for a Po notification session entry. */
|
|
78
|
-
function createPoNotificationEntryData(request) {
|
|
79
|
-
const normalized = normalizePoNotificationRequest(request);
|
|
80
|
-
if (!normalized) return void 0;
|
|
81
|
-
return Object.freeze({
|
|
82
|
-
version: 1,
|
|
83
|
-
title: normalized.title ?? "",
|
|
84
|
-
subtitle: normalized.subtitle ?? "",
|
|
85
|
-
body: normalized.body,
|
|
86
|
-
level: normalized.level ?? "info"
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function readPoNotificationService(context) {
|
|
90
|
-
return context.get(PO_NOTIFICATION_SERVICE);
|
|
91
|
-
}
|
|
92
|
-
//#endregion
|
|
93
2
|
//#region ../../../node_modules/.pnpm/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/src/version.js
|
|
94
3
|
var require_version = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
95
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -2522,4 +2431,4 @@ function createPoTelemetryService(options, runtimeLoader) {
|
|
|
2522
2431
|
};
|
|
2523
2432
|
}
|
|
2524
2433
|
//#endregion
|
|
2525
|
-
export {
|
|
2434
|
+
export { createPoTelemetryService as n, sanitizeTelemetryAttributes as r, OperationCancelledError as t };
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_018b33d3c6d4455b3921fdf11f2d0b63/node_modules/@earendil-works/pi-ai/dist/api/constrained-sampling.js
|
|
2
|
+
var UnsupportedStrictJsonSchemaError = class extends Error {};
|
|
3
|
+
const UNSUPPORTED_STRICT_SCHEMA_KEYS = [
|
|
4
|
+
"$ref",
|
|
5
|
+
"$defs",
|
|
6
|
+
"definitions",
|
|
7
|
+
"allOf",
|
|
8
|
+
"oneOf",
|
|
9
|
+
"patternProperties",
|
|
10
|
+
"dependentSchemas",
|
|
11
|
+
"dependencies",
|
|
12
|
+
"unevaluatedProperties",
|
|
13
|
+
"propertyNames",
|
|
14
|
+
"contains",
|
|
15
|
+
"prefixItems",
|
|
16
|
+
"not",
|
|
17
|
+
"if",
|
|
18
|
+
"then",
|
|
19
|
+
"else"
|
|
20
|
+
];
|
|
21
|
+
function isJsonSchemaObject(value) {
|
|
22
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
23
|
+
}
|
|
24
|
+
function isStructuredSchema(schema) {
|
|
25
|
+
if (!isJsonSchemaObject(schema)) return false;
|
|
26
|
+
const types = typeof schema.type === "string" ? [schema.type] : Array.isArray(schema.type) ? schema.type : [];
|
|
27
|
+
return types.includes("object") || types.includes("array") || schema.properties !== void 0 || schema.items !== void 0;
|
|
28
|
+
}
|
|
29
|
+
function schemaAllowsNull(schema) {
|
|
30
|
+
if (!isJsonSchemaObject(schema)) return false;
|
|
31
|
+
if (schema.type === "null" || Array.isArray(schema.type) && schema.type.includes("null")) return true;
|
|
32
|
+
if (schema.const === null || Array.isArray(schema.enum) && schema.enum.includes(null)) return true;
|
|
33
|
+
return Array.isArray(schema.anyOf) && schema.anyOf.some((variant) => schemaAllowsNull(variant));
|
|
34
|
+
}
|
|
35
|
+
function makeJsonSchemaNodeStrict(schema, isUnsupportedKeyword) {
|
|
36
|
+
if (!isJsonSchemaObject(schema)) throw new UnsupportedStrictJsonSchemaError("boolean schemas are unsupported");
|
|
37
|
+
for (const key of UNSUPPORTED_STRICT_SCHEMA_KEYS) if (schema[key] !== void 0) throw new UnsupportedStrictJsonSchemaError(`${key} schemas are unsupported`);
|
|
38
|
+
if (isUnsupportedKeyword) {
|
|
39
|
+
for (const [key, value] of Object.entries(schema)) if (isUnsupportedKeyword(key, value)) throw new UnsupportedStrictJsonSchemaError(`${key}: ${JSON.stringify(value)} is unsupported`);
|
|
40
|
+
}
|
|
41
|
+
if (schema.anyOf !== void 0) {
|
|
42
|
+
if (!Array.isArray(schema.anyOf) || schema.anyOf.length === 0) throw new UnsupportedStrictJsonSchemaError("anyOf must contain at least one schema");
|
|
43
|
+
for (const variant of schema.anyOf) {
|
|
44
|
+
if (isStructuredSchema(variant)) throw new UnsupportedStrictJsonSchemaError("object and array unions are unsupported");
|
|
45
|
+
makeJsonSchemaNodeStrict(variant, isUnsupportedKeyword);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (schema.items !== void 0) {
|
|
49
|
+
if (Array.isArray(schema.items)) throw new UnsupportedStrictJsonSchemaError("tuple schemas are unsupported");
|
|
50
|
+
makeJsonSchemaNodeStrict(schema.items, isUnsupportedKeyword);
|
|
51
|
+
}
|
|
52
|
+
const isObjectSchema = schema.type === "object";
|
|
53
|
+
if (schema.properties !== void 0 && !isObjectSchema) throw new UnsupportedStrictJsonSchemaError("properties require type object");
|
|
54
|
+
if (!isObjectSchema) return;
|
|
55
|
+
if (schema.additionalProperties !== void 0 && schema.additionalProperties !== false) throw new UnsupportedStrictJsonSchemaError("schema-valued or true additionalProperties is unsupported");
|
|
56
|
+
if (schema.properties !== void 0 && !isJsonSchemaObject(schema.properties)) throw new UnsupportedStrictJsonSchemaError("object properties must be a schema map");
|
|
57
|
+
if (schema.required !== void 0 && (!Array.isArray(schema.required) || schema.required.some((key) => typeof key !== "string"))) throw new UnsupportedStrictJsonSchemaError("object required must be a string array");
|
|
58
|
+
const properties = schema.properties ?? {};
|
|
59
|
+
const propertyNames = Object.keys(properties);
|
|
60
|
+
const required = new Set(Array.isArray(schema.required) ? schema.required : []);
|
|
61
|
+
if ([...required].some((key) => !propertyNames.includes(key))) throw new UnsupportedStrictJsonSchemaError("required contains an unknown property");
|
|
62
|
+
for (const [key, property] of Object.entries(properties)) {
|
|
63
|
+
makeJsonSchemaNodeStrict(property, isUnsupportedKeyword);
|
|
64
|
+
if (!required.has(key) && !schemaAllowsNull(property)) properties[key] = { anyOf: [property, { type: "null" }] };
|
|
65
|
+
}
|
|
66
|
+
schema.required = propertyNames;
|
|
67
|
+
schema.additionalProperties = false;
|
|
68
|
+
}
|
|
69
|
+
/** Convert a tool schema to the strict subset expected by provider constrained sampling. */
|
|
70
|
+
function makeStrictJsonSchema(schema, isUnsupportedKeyword) {
|
|
71
|
+
const cloned = structuredClone(schema);
|
|
72
|
+
if (!isJsonSchemaObject(cloned)) throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
|
|
73
|
+
makeJsonSchemaNodeStrict(cloned, isUnsupportedKeyword);
|
|
74
|
+
if (cloned.type !== "object") throw new UnsupportedStrictJsonSchemaError("root schema must have type object");
|
|
75
|
+
return cloned;
|
|
76
|
+
}
|
|
77
|
+
/** Returns true for a tool that asks for strict JSON-schema sampling only when possible (`strict: "prefer"`). */
|
|
78
|
+
function prefersJsonSchemaStrictSampling(tool) {
|
|
79
|
+
const config = tool.constrainedSampling;
|
|
80
|
+
return !!config && config.type === "json_schema" && config.strict === "prefer";
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Claude rejects (on the Anthropic API and on Bedrock) a request whose strict tools exceed its limits with one of these
|
|
84
|
+
* messages. Observed limits: 20 strict tools, and 16 optional or union-typed parameters across all strict tools.
|
|
85
|
+
*/
|
|
86
|
+
const STRICT_TOOL_LIMIT_ERROR_MESSAGES = [
|
|
87
|
+
"The compiled grammar is too large",
|
|
88
|
+
"Too many strict tools (",
|
|
89
|
+
"Schemas contains too many parameters with union types ("
|
|
90
|
+
];
|
|
91
|
+
/** Returns true when a provider error message says the request's strict tools exceed the provider's limits. */
|
|
92
|
+
function isStrictToolLimitErrorMessage(message) {
|
|
93
|
+
return STRICT_TOOL_LIMIT_ERROR_MESSAGES.some((limitMessage) => message.includes(limitMessage));
|
|
94
|
+
}
|
|
95
|
+
function getJsonSchemaToolParameters(tool, strict) {
|
|
96
|
+
return strict === true ? makeStrictJsonSchema(tool.parameters) : tool.parameters;
|
|
97
|
+
}
|
|
98
|
+
function getGrammarToolInput(toolName, arguments_, inputProperty) {
|
|
99
|
+
const input = arguments_[inputProperty];
|
|
100
|
+
if (typeof input !== "string") throw new Error(`Grammar tool call "${toolName}" requires argument "${inputProperty}" to be a string.`);
|
|
101
|
+
return input;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Append `inputDelta` to a streaming grammar tool input and return the matching piece of its JSON arguments text, or
|
|
105
|
+
* `undefined` for an empty delta. Costs time linear in the delta, never in the input so far.
|
|
106
|
+
*/
|
|
107
|
+
function appendGrammarToolInputJsonDelta(buffer, inputProperty, inputDelta) {
|
|
108
|
+
if (buffer.closed) throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
|
|
109
|
+
if (inputDelta.length === 0) return void 0;
|
|
110
|
+
buffer.input += inputDelta;
|
|
111
|
+
return grammarToolInputJsonStart(buffer, inputProperty) + JSON.stringify(inputDelta).slice(1, -1);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Close a streaming grammar tool input and return the rest of its JSON arguments text. `finalInput` is the complete
|
|
115
|
+
* input when the provider sends one; it must continue the input streamed so far. Closing again with the same input
|
|
116
|
+
* returns `undefined`.
|
|
117
|
+
*/
|
|
118
|
+
function closeGrammarToolInputJson(buffer, inputProperty, finalInput) {
|
|
119
|
+
if (buffer.closed) {
|
|
120
|
+
if (finalInput === void 0 || finalInput === buffer.input) return void 0;
|
|
121
|
+
throw new Error(`grammar tool input for property "${inputProperty}" changed after it was closed`);
|
|
122
|
+
}
|
|
123
|
+
if (finalInput !== void 0 && !finalInput.startsWith(buffer.input)) throw new Error(`grammar tool input for property "${inputProperty}" changed non-monotonically`);
|
|
124
|
+
const rest = finalInput === void 0 ? "" : finalInput.slice(buffer.input.length);
|
|
125
|
+
if (finalInput !== void 0) buffer.input = finalInput;
|
|
126
|
+
buffer.closed = true;
|
|
127
|
+
return `${grammarToolInputJsonStart(buffer, inputProperty)}${JSON.stringify(rest).slice(1, -1)}"}`;
|
|
128
|
+
}
|
|
129
|
+
/** The opening of the JSON arguments text, once. */
|
|
130
|
+
function grammarToolInputJsonStart(buffer, inputProperty) {
|
|
131
|
+
if (buffer.started) return "";
|
|
132
|
+
buffer.started = true;
|
|
133
|
+
return `{${JSON.stringify(inputProperty)}:"`;
|
|
134
|
+
}
|
|
135
|
+
function inferGrammarInputProperty(tool) {
|
|
136
|
+
const schema = tool.parameters;
|
|
137
|
+
if (schema.type !== "object") throw new Error("grammar constrained sampling requires an object parameter schema");
|
|
138
|
+
if (!Array.isArray(schema.required) || schema.required.length !== 1 || typeof schema.required[0] !== "string") throw new Error("grammar constrained sampling requires exactly one required string property");
|
|
139
|
+
const inputProperty = schema.required[0];
|
|
140
|
+
if (!schema.properties?.[inputProperty]) throw new Error(`grammar constrained sampling requires a properties entry for ${inputProperty}`);
|
|
141
|
+
if (schema.properties[inputProperty]?.type !== "string") throw new Error(`grammar constrained sampling property ${inputProperty} must have type string`);
|
|
142
|
+
return inputProperty;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Decide whether a JSON-schema tool is sent in strict mode. `isUnsupportedKeyword` lets a provider
|
|
146
|
+
* reject extra keywords its strict mode does not accept, so "prefer" tools fall back to non-strict.
|
|
147
|
+
*/
|
|
148
|
+
function resolveJsonSchemaStrictSampling(tool, supportsStrictMode, isUnsupportedKeyword) {
|
|
149
|
+
const config = tool.constrainedSampling;
|
|
150
|
+
if (!config || config.type !== "json_schema") return void 0;
|
|
151
|
+
if (supportsStrictMode) try {
|
|
152
|
+
makeStrictJsonSchema(tool.parameters, isUnsupportedKeyword);
|
|
153
|
+
return true;
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (!(error instanceof UnsupportedStrictJsonSchemaError)) throw error;
|
|
156
|
+
if (config.strict !== "require") return void 0;
|
|
157
|
+
throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but ${error.message}.`);
|
|
158
|
+
}
|
|
159
|
+
if (config.strict === "require") throw new Error(`Tool "${tool.name}" requires JSON-schema constrained sampling, but strict tools are unsupported.`);
|
|
160
|
+
}
|
|
161
|
+
function resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools) {
|
|
162
|
+
const config = tool.constrainedSampling;
|
|
163
|
+
if (!config || config.type !== "grammar") return;
|
|
164
|
+
if (!supportsOpenAIGrammarTools) return;
|
|
165
|
+
const larkDefinition = config.variants.openai_lark;
|
|
166
|
+
const regexDefinition = config.variants.openai_regex;
|
|
167
|
+
const hasLarkDefinition = typeof larkDefinition === "string" && larkDefinition.trim().length > 0;
|
|
168
|
+
const hasRegexDefinition = typeof regexDefinition === "string" && regexDefinition.trim().length > 0;
|
|
169
|
+
if (!hasLarkDefinition && !hasRegexDefinition) throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: no supported grammar variant was provided.`);
|
|
170
|
+
try {
|
|
171
|
+
return {
|
|
172
|
+
format: hasLarkDefinition ? "lark" : "regex",
|
|
173
|
+
definition: hasLarkDefinition ? larkDefinition : regexDefinition,
|
|
174
|
+
inputProperty: inferGrammarInputProperty(tool)
|
|
175
|
+
};
|
|
176
|
+
} catch (error) {
|
|
177
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
178
|
+
throw new Error(`Tool "${tool.name}" cannot use grammar constrained sampling: ${message}.`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
function createGrammarToolInputProperties(tools, supportsOpenAIGrammarTools) {
|
|
182
|
+
const properties = /* @__PURE__ */ new Map();
|
|
183
|
+
for (const tool of tools ?? []) {
|
|
184
|
+
const grammar = resolveGrammarConstrainedSampling(tool, supportsOpenAIGrammarTools);
|
|
185
|
+
if (grammar) properties.set(tool.name, grammar.inputProperty);
|
|
186
|
+
}
|
|
187
|
+
return properties;
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region ../../../node_modules/.pnpm/@earendil-works+pi-ai@1.5.0_@aws-sdk+credential-provider-node@3.972.86_@modelcontextpro_018b33d3c6d4455b3921fdf11f2d0b63/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js
|
|
191
|
+
const NON_VISION_USER_IMAGE_PLACEHOLDER = "(image omitted: model does not support images)";
|
|
192
|
+
const NON_VISION_TOOL_IMAGE_PLACEHOLDER = "(tool image omitted: model does not support images)";
|
|
193
|
+
const ERROR_TOOL_IMAGE_PLACEHOLDER = "(image attached after the tool results)";
|
|
194
|
+
/**
|
|
195
|
+
* Split the images out of an error tool result, for APIs that reject images in error results
|
|
196
|
+
* (Anthropic, and Claude on Bedrock). Send the returned content as the tool result and the caption and
|
|
197
|
+
* images after all tool results of the turn, in the same user message. Returns undefined for results
|
|
198
|
+
* that need no split (#10794).
|
|
199
|
+
*/
|
|
200
|
+
function splitErrorToolResultImages(msg) {
|
|
201
|
+
if (!msg.isError) return void 0;
|
|
202
|
+
const images = msg.content.filter((block) => block.type === "image");
|
|
203
|
+
if (images.length === 0) return void 0;
|
|
204
|
+
return {
|
|
205
|
+
content: replaceImagesWithPlaceholder(msg.content, ERROR_TOOL_IMAGE_PLACEHOLDER),
|
|
206
|
+
caption: `Images from the error result of tool call ${msg.toolCallId} (${msg.toolName}):`,
|
|
207
|
+
images
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function replaceImagesWithPlaceholder(content, placeholder) {
|
|
211
|
+
const result = [];
|
|
212
|
+
let previousWasPlaceholder = false;
|
|
213
|
+
for (const block of content) {
|
|
214
|
+
if (block.type === "image") {
|
|
215
|
+
if (!previousWasPlaceholder) result.push({
|
|
216
|
+
type: "text",
|
|
217
|
+
text: placeholder
|
|
218
|
+
});
|
|
219
|
+
previousWasPlaceholder = true;
|
|
220
|
+
continue;
|
|
221
|
+
}
|
|
222
|
+
result.push(block);
|
|
223
|
+
previousWasPlaceholder = block.text === placeholder;
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
227
|
+
function downgradeUnsupportedImages(messages, model) {
|
|
228
|
+
if (model.input.includes("image")) return messages;
|
|
229
|
+
return messages.map((msg) => {
|
|
230
|
+
if (msg.role === "user" && Array.isArray(msg.content)) return {
|
|
231
|
+
...msg,
|
|
232
|
+
content: replaceImagesWithPlaceholder(msg.content, NON_VISION_USER_IMAGE_PLACEHOLDER)
|
|
233
|
+
};
|
|
234
|
+
if (msg.role === "toolResult") return {
|
|
235
|
+
...msg,
|
|
236
|
+
content: replaceImagesWithPlaceholder(msg.content, NON_VISION_TOOL_IMAGE_PLACEHOLDER)
|
|
237
|
+
};
|
|
238
|
+
return msg;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Normalize tool call ID for cross-provider compatibility.
|
|
243
|
+
* OpenAI Responses API generates IDs that are 450+ chars with special characters like `|`.
|
|
244
|
+
* Anthropic APIs require IDs matching ^[a-zA-Z0-9_-]+$ (max 64 chars).
|
|
245
|
+
*/
|
|
246
|
+
function transformMessages(messages, model, normalizeToolCallId) {
|
|
247
|
+
const toolCallIdMap = /* @__PURE__ */ new Map();
|
|
248
|
+
const transformed = downgradeUnsupportedImages(messages.map((msg) => msg.content == null ? {
|
|
249
|
+
...msg,
|
|
250
|
+
content: []
|
|
251
|
+
} : msg), model).map((msg) => {
|
|
252
|
+
if (msg.role === "system" || msg.role === "user") return msg;
|
|
253
|
+
if (msg.role === "toolResult") {
|
|
254
|
+
const normalizedId = toolCallIdMap.get(msg.toolCallId);
|
|
255
|
+
if (normalizedId && normalizedId !== msg.toolCallId) return {
|
|
256
|
+
...msg,
|
|
257
|
+
toolCallId: normalizedId
|
|
258
|
+
};
|
|
259
|
+
return msg;
|
|
260
|
+
}
|
|
261
|
+
if (msg.role === "assistant") {
|
|
262
|
+
const assistantMsg = msg;
|
|
263
|
+
const isSameModel = assistantMsg.provider === model.provider && assistantMsg.api === model.api && assistantMsg.model === model.id;
|
|
264
|
+
const transformedContent = assistantMsg.content.flatMap((block) => {
|
|
265
|
+
if (block.type === "thinking") {
|
|
266
|
+
if (!isSameModel) return [];
|
|
267
|
+
if (block.redacted || block.thinkingSignature) return block;
|
|
268
|
+
if (!block.thinking || block.thinking.trim() === "") return [];
|
|
269
|
+
return block;
|
|
270
|
+
}
|
|
271
|
+
if (block.type === "text") {
|
|
272
|
+
if (isSameModel) return block;
|
|
273
|
+
return {
|
|
274
|
+
type: "text",
|
|
275
|
+
text: block.text
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
if (block.type === "toolCall") {
|
|
279
|
+
const toolCall = block;
|
|
280
|
+
let normalizedToolCall = toolCall;
|
|
281
|
+
if (!isSameModel && toolCall.thoughtSignature) {
|
|
282
|
+
normalizedToolCall = { ...toolCall };
|
|
283
|
+
delete normalizedToolCall.thoughtSignature;
|
|
284
|
+
}
|
|
285
|
+
if (!isSameModel && normalizeToolCallId) {
|
|
286
|
+
const normalizedId = normalizeToolCallId(toolCall.id, model, assistantMsg);
|
|
287
|
+
if (normalizedId !== toolCall.id) {
|
|
288
|
+
toolCallIdMap.set(toolCall.id, normalizedId);
|
|
289
|
+
normalizedToolCall = {
|
|
290
|
+
...normalizedToolCall,
|
|
291
|
+
id: normalizedId
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return normalizedToolCall;
|
|
296
|
+
}
|
|
297
|
+
return block;
|
|
298
|
+
});
|
|
299
|
+
return {
|
|
300
|
+
...assistantMsg,
|
|
301
|
+
content: transformedContent
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
return msg;
|
|
305
|
+
});
|
|
306
|
+
const result = [];
|
|
307
|
+
let pendingToolCalls = [];
|
|
308
|
+
let existingToolResultIds = /* @__PURE__ */ new Set();
|
|
309
|
+
const heldSystemMessages = [];
|
|
310
|
+
const closePendingToolCalls = () => {
|
|
311
|
+
if (pendingToolCalls.length > 0) {
|
|
312
|
+
for (const tc of pendingToolCalls) if (!existingToolResultIds.has(tc.id)) result.push({
|
|
313
|
+
role: "toolResult",
|
|
314
|
+
toolCallId: tc.id,
|
|
315
|
+
toolName: tc.name,
|
|
316
|
+
content: [{
|
|
317
|
+
type: "text",
|
|
318
|
+
text: "No result provided"
|
|
319
|
+
}],
|
|
320
|
+
isError: true,
|
|
321
|
+
timestamp: Date.now()
|
|
322
|
+
});
|
|
323
|
+
pendingToolCalls = [];
|
|
324
|
+
existingToolResultIds = /* @__PURE__ */ new Set();
|
|
325
|
+
}
|
|
326
|
+
result.push(...heldSystemMessages);
|
|
327
|
+
heldSystemMessages.length = 0;
|
|
328
|
+
};
|
|
329
|
+
for (let i = 0; i < transformed.length; i++) {
|
|
330
|
+
const msg = transformed[i];
|
|
331
|
+
if (msg.role === "assistant") {
|
|
332
|
+
closePendingToolCalls();
|
|
333
|
+
const assistantMsg = msg;
|
|
334
|
+
if (assistantMsg.stopReason === "error" || assistantMsg.stopReason === "aborted") continue;
|
|
335
|
+
const toolCalls = assistantMsg.content.filter((b) => b.type === "toolCall");
|
|
336
|
+
if (toolCalls.length > 0) {
|
|
337
|
+
pendingToolCalls = toolCalls;
|
|
338
|
+
existingToolResultIds = /* @__PURE__ */ new Set();
|
|
339
|
+
}
|
|
340
|
+
result.push(msg);
|
|
341
|
+
} else if (msg.role === "toolResult") {
|
|
342
|
+
existingToolResultIds.add(msg.toolCallId);
|
|
343
|
+
result.push(msg);
|
|
344
|
+
} else if (msg.role === "system") {
|
|
345
|
+
if (pendingToolCalls.length > 0) heldSystemMessages.push(msg);
|
|
346
|
+
else result.push(msg);
|
|
347
|
+
} else if (msg.role === "user") {
|
|
348
|
+
closePendingToolCalls();
|
|
349
|
+
result.push(msg);
|
|
350
|
+
} else result.push(msg);
|
|
351
|
+
}
|
|
352
|
+
closePendingToolCalls();
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
356
|
+
export { createGrammarToolInputProperties as a, isStrictToolLimitErrorMessage as c, resolveJsonSchemaStrictSampling as d, closeGrammarToolInputJson as i, prefersJsonSchemaStrictSampling as l, transformMessages as n, getGrammarToolInput as o, appendGrammarToolInputJsonDelta as r, getJsonSchemaToolParameters as s, splitErrorToolResultImages as t, resolveGrammarConstrainedSampling as u };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const DEFAULT_MAX_BYTES = 51200;
|
|
2
|
+
/** A trailing newline ends the last line rather than starting another. */
|
|
3
|
+
function splitLinesForCounting(content) {
|
|
4
|
+
if (content.length === 0) return [];
|
|
5
|
+
const lines = content.split("\n");
|
|
6
|
+
if (content.endsWith("\n")) lines.pop();
|
|
7
|
+
return lines;
|
|
8
|
+
}
|
|
9
|
+
function formatSize(bytes) {
|
|
10
|
+
if (bytes < 1024) return `${bytes}B`;
|
|
11
|
+
if (bytes < 1048576) return `${(bytes / 1024).toFixed(1)}KB`;
|
|
12
|
+
return `${(bytes / 1048576).toFixed(1)}MB`;
|
|
13
|
+
}
|
|
14
|
+
/** Cut one line to `maxChars` characters and mark it. */
|
|
15
|
+
function truncateLine(line, maxChars = 500) {
|
|
16
|
+
if (line.length <= maxChars) return {
|
|
17
|
+
text: line,
|
|
18
|
+
wasTruncated: false
|
|
19
|
+
};
|
|
20
|
+
return {
|
|
21
|
+
text: `${line.slice(0, maxChars)}... [truncated]`,
|
|
22
|
+
wasTruncated: true
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Keep the first lines of `content` that fit both limits. */
|
|
26
|
+
function truncateHead(content, options = {}) {
|
|
27
|
+
const maxLines = options.maxLines ?? 2e3;
|
|
28
|
+
const maxBytes = options.maxBytes ?? 51200;
|
|
29
|
+
const totalBytes = Buffer.byteLength(content, "utf-8");
|
|
30
|
+
const lines = splitLinesForCounting(content);
|
|
31
|
+
const totalLines = lines.length;
|
|
32
|
+
if (totalLines <= maxLines && totalBytes <= maxBytes) return {
|
|
33
|
+
content,
|
|
34
|
+
truncated: false,
|
|
35
|
+
truncatedBy: null,
|
|
36
|
+
totalLines,
|
|
37
|
+
totalBytes,
|
|
38
|
+
outputLines: totalLines,
|
|
39
|
+
outputBytes: totalBytes,
|
|
40
|
+
lastLinePartial: false,
|
|
41
|
+
firstLineExceedsLimit: false,
|
|
42
|
+
maxLines,
|
|
43
|
+
maxBytes
|
|
44
|
+
};
|
|
45
|
+
const firstLine = lines[0] ?? "";
|
|
46
|
+
if (Buffer.byteLength(firstLine, "utf-8") > maxBytes) return {
|
|
47
|
+
content: "",
|
|
48
|
+
truncated: true,
|
|
49
|
+
truncatedBy: "bytes",
|
|
50
|
+
totalLines,
|
|
51
|
+
totalBytes,
|
|
52
|
+
outputLines: 0,
|
|
53
|
+
outputBytes: 0,
|
|
54
|
+
lastLinePartial: false,
|
|
55
|
+
firstLineExceedsLimit: true,
|
|
56
|
+
maxLines,
|
|
57
|
+
maxBytes
|
|
58
|
+
};
|
|
59
|
+
const kept = [];
|
|
60
|
+
let keptBytes = 0;
|
|
61
|
+
let truncatedBy = "lines";
|
|
62
|
+
for (let index = 0; index < lines.length && index < maxLines; index += 1) {
|
|
63
|
+
const line = lines[index] ?? "";
|
|
64
|
+
const lineBytes = Buffer.byteLength(line, "utf-8") + (index > 0 ? 1 : 0);
|
|
65
|
+
if (keptBytes + lineBytes > maxBytes) {
|
|
66
|
+
truncatedBy = "bytes";
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
kept.push(line);
|
|
70
|
+
keptBytes += lineBytes;
|
|
71
|
+
}
|
|
72
|
+
if (kept.length >= maxLines && keptBytes <= maxBytes) truncatedBy = "lines";
|
|
73
|
+
const output = kept.join("\n");
|
|
74
|
+
return {
|
|
75
|
+
content: output,
|
|
76
|
+
truncated: true,
|
|
77
|
+
truncatedBy,
|
|
78
|
+
totalLines,
|
|
79
|
+
totalBytes,
|
|
80
|
+
outputLines: kept.length,
|
|
81
|
+
outputBytes: Buffer.byteLength(output, "utf-8"),
|
|
82
|
+
lastLinePartial: false,
|
|
83
|
+
firstLineExceedsLimit: false,
|
|
84
|
+
maxLines,
|
|
85
|
+
maxBytes
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { truncateLine as i, formatSize as n, truncateHead as r, DEFAULT_MAX_BYTES as t };
|