deepline 0.3.551 → 0.3.553
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/dist/bundling-sources/sdk/src/client-core.ts +130 -12
- package/dist/bundling-sources/sdk/src/compat.ts +239 -87
- package/dist/bundling-sources/sdk/src/config.ts +113 -2
- package/dist/bundling-sources/sdk/src/errors.ts +2 -0
- package/dist/bundling-sources/sdk/src/http-core.ts +124 -10
- package/dist/bundling-sources/sdk/src/index.ts +2 -0
- package/dist/bundling-sources/sdk/src/integrations.ts +6 -4
- package/dist/bundling-sources/sdk/src/play.ts +3 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +66 -30
- package/dist/bundling-sources/sdk/src/tool-calls.ts +2 -1
- package/dist/bundling-sources/sdk/src/tool-failure-hint.ts +104 -0
- package/dist/bundling-sources/sdk/src/types.ts +9 -1
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +4 -2
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-plan-skus.ts +25 -0
- package/dist/bundling-sources/shared_libs/monitors/action-actor.ts +2 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/credit-recovery.ts +58 -4
- package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +11 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +13 -0
- package/dist/bundling-sources/shared_libs/monitors/deactivation-reasons.ts +103 -5
- package/dist/bundling-sources/shared_libs/monitors/fleets/converge-admission.ts +133 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/fence-attention.ts +165 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/fence-release.ts +726 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/fence-walk.ts +274 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +1 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/provider-bulk-wait.ts +126 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/shared-payload.ts +189 -0
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +28 -0
- package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +4 -0
- package/dist/bundling-sources/shared_libs/monitors/inventory-counter-errors.ts +25 -0
- package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +65 -0
- package/dist/bundling-sources/shared_libs/monitors/package.json +11 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +152 -1
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +6 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +390 -10
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +34 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +66 -30
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-state.ts +30 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +80 -13
- package/dist/bundling-sources/shared_libs/monitors/provider-resource-failure.ts +26 -3
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +41 -13
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/raw-receipt-causes.ts +219 -0
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +21 -10
- package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +13 -0
- package/dist/bundling-sources/shared_libs/monitors/tamradar-countries.ts +285 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +6 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +13 -0
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/log-metadata.ts +5 -3
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +10 -1
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/redaction.ts +24 -1
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +312 -41
- package/dist/bundling-sources/shared_libs/observability/scheduled-work-manual.ts +1 -2
- package/dist/bundling-sources/shared_libs/play-data-plane/preview-r2-oidc.ts +188 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +170 -16
- package/dist/bundling-sources/shared_libs/play-data-plane/runtime-sheet-storage-contract.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +68 -2
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +568 -26
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-fetch-caller-deadline.ts +200 -0
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +21 -1
- package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +3 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +14 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +70 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +92 -16
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +7 -1
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +62 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +74 -3
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +31 -3
- package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +39 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +9 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-identity.ts +33 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +24 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +300 -57
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +87 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +241 -10
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +161 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +16 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-compression.ts +37 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api-paths.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +298 -46
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +39 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +62 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +206 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +185 -64
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-slot-ledger.ts +157 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +110 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-listener-hint.ts +323 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/executor-attempt-standing.ts +72 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-storage.ts +23 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +32 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-workspace-purge.ts +199 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +632 -66
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +517 -16
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-api-origin.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-receipt-value-storage.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +599 -2
- package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +60 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +51 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call-retry-facts.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +113 -3
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +5 -7
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +37 -7
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +40 -5
- package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/control-plane-types.ts +16 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +10 -41
- package/dist/bundling-sources/shared_libs/plays/extension-bridge.ts +33 -0
- package/dist/bundling-sources/shared_libs/plays/row-identity.ts +18 -1
- package/dist/bundling-sources/shared_libs/plays/tool-execution-error.ts +108 -0
- package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +14 -0
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +171 -0
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +27 -1
- package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +9 -24
- package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +178 -5
- package/dist/bundling-sources/shared_libs/security/signup-email-dns-screen.ts +148 -0
- package/dist/bundling-sources/shared_libs/tool-execution-error.ts +108 -0
- package/dist/cli/{auth-E7BH4GMJ.mjs → auth-I3QAU4RV.mjs} +8 -7
- package/dist/cli/auth-MQCN7WGZ.js +44 -0
- package/dist/cli/{billing-OXKU462W.mjs → billing-3IC54OQQ.mjs} +202 -59
- package/dist/cli/{billing-DNQAZGX7.js → billing-YGFFVAIC.js} +302 -159
- package/dist/cli/{chunk-COGREZAO.js → chunk-2B5B5KAW.js} +210 -128
- package/dist/cli/{chunk-UBKA33KY.mjs → chunk-2MGZAI54.mjs} +17 -0
- package/dist/cli/{chunk-T2B5BVZE.js → chunk-3NTP2OSG.js} +13 -13
- package/dist/cli/{chunk-FOTGUFVK.mjs → chunk-45OAVGU6.mjs} +5 -5
- package/dist/cli/{chunk-54EEYLTF.js → chunk-4747TPLV.js} +3 -3
- package/dist/cli/{chunk-CLRAANWH.mjs → chunk-4BFTDNHU.mjs} +1 -1
- package/dist/cli/{chunk-BGBJV26E.mjs → chunk-4HYNMXXF.mjs} +4 -4
- package/dist/cli/{chunk-5S6PHKRV.mjs → chunk-4SMCFQ23.mjs} +1 -1
- package/dist/cli/{chunk-VWLHRZFG.mjs → chunk-55F6HNOY.mjs} +5 -5
- package/dist/cli/{chunk-LX35AXTN.mjs → chunk-5TYLSS4Q.mjs} +6 -6
- package/dist/cli/{chunk-VTGG2RT3.js → chunk-6NE3RRRY.js} +1 -1
- package/dist/cli/{chunk-EITMD3A5.js → chunk-6VLFQZK6.js} +8 -8
- package/dist/cli/{chunk-MNSTCJMX.mjs → chunk-72V4PDH5.mjs} +18 -18
- package/dist/cli/{chunk-ZCDKE4UH.js → chunk-74RES4DS.js} +5 -5
- package/dist/cli/{chunk-WKBHUB6R.js → chunk-7GEMELKI.js} +366 -320
- package/dist/cli/{chunk-C4CUZH57.js → chunk-7O6J6A7P.js} +1871 -92
- package/dist/cli/{chunk-7RSIFA72.js → chunk-7SERLBNR.js} +161 -53
- package/dist/cli/{chunk-3G6QZACZ.js → chunk-7YRJ5UC4.js} +21 -21
- package/dist/cli/{chunk-I4VKGNAQ.mjs → chunk-A7DLBE5K.mjs} +136 -54
- package/dist/cli/{chunk-GGB3JYCW.mjs → chunk-AGICYWGN.mjs} +299 -69
- package/dist/cli/{chunk-44KSACJW.mjs → chunk-AGIQDA2T.mjs} +12 -12
- package/dist/cli/{chunk-PACD5DGC.js → chunk-AGLR6QVN.js} +255 -109
- package/dist/cli/{chunk-NURW5XH4.mjs → chunk-ASB47RXJ.mjs} +1 -1
- package/dist/cli/{chunk-4OMAGJ6U.js → chunk-BVDKFS2T.js} +2 -2
- package/dist/cli/{chunk-LPJPCGT3.js → chunk-CACFJODG.js} +190 -134
- package/dist/cli/{chunk-GVYLCCKN.mjs → chunk-CAEBJOYU.mjs} +1 -1
- package/dist/cli/{chunk-XDVT3GOM.js → chunk-CFJFUVX2.js} +18 -1
- package/dist/cli/{chunk-POLUE7D5.js → chunk-DP2VH7CO.js} +12 -12
- package/dist/cli/{chunk-D6M5HFBB.mjs → chunk-DP64MD6U.mjs} +1 -1
- package/dist/cli/{chunk-W425ERWN.mjs → chunk-DZA7RFGL.mjs} +5 -5
- package/dist/cli/{chunk-R7J7CJPZ.js → chunk-E2G2DNAB.js} +4 -1
- package/dist/cli/{chunk-GGGAEVCX.mjs → chunk-E7WZOX2A.mjs} +22 -18
- package/dist/cli/{chunk-44I675YK.js → chunk-FM7LPUPA.js} +41 -41
- package/dist/cli/{chunk-2UXDHFSF.mjs → chunk-GAVZ4EOD.mjs} +1 -1
- package/dist/cli/{chunk-Z2FIOG3V.js → chunk-HEBO3XNZ.js} +27 -31
- package/dist/cli/{chunk-6PWJKMFQ.mjs → chunk-HSJ6X2AQ.mjs} +4 -4
- package/dist/cli/{chunk-UPMRIVZB.js → chunk-HVI55MTK.js} +61 -10
- package/dist/cli/{chunk-KWSH5T7K.js → chunk-IH6GDNKW.js} +21 -21
- package/dist/cli/{chunk-3KYBDAR3.js → chunk-IMX7J4DU.js} +8 -8
- package/dist/cli/{chunk-HEHVGEZV.mjs → chunk-INEMTYMT.mjs} +8 -8
- package/dist/cli/{chunk-5VVSEU67.js → chunk-IUOGII7D.js} +6 -7
- package/dist/cli/{chunk-MXGA6JFI.mjs → chunk-JJGWHITQ.mjs} +5 -5
- package/dist/cli/{chunk-QM6Y6S4E.js → chunk-JLGP5XAJ.js} +5 -5
- package/dist/cli/{chunk-V6SCP4B7.mjs → chunk-LFOERUQY.mjs} +69 -3
- package/dist/cli/{chunk-BBTKAASQ.js → chunk-LFQJW4S2.js} +42 -1
- package/dist/cli/{chunk-ZMNGZ6XS.mjs → chunk-LH5PZKER.mjs} +80 -24
- package/dist/cli/{chunk-MR5LTVHD.js → chunk-LRDHPOZW.js} +69 -69
- package/dist/cli/{chunk-5LUF4LAR.mjs → chunk-LRZGS6RZ.mjs} +3 -0
- package/dist/cli/{chunk-SL6MYJYM.js → chunk-MJTVX4QK.js} +35 -35
- package/dist/cli/{chunk-UDXULACQ.js → chunk-MLABYI4M.js} +90 -24
- package/dist/cli/{chunk-S7IZWGUA.mjs → chunk-NDNHYONK.mjs} +17 -21
- package/dist/cli/{chunk-4D3WIZST.mjs → chunk-OTV2UUKW.mjs} +164 -18
- package/dist/cli/{chunk-XYE5XPGF.js → chunk-Q6Z6N3A7.js} +18 -18
- package/dist/cli/{chunk-7WQNWJQW.mjs → chunk-QG6JIWUL.mjs} +151 -43
- package/dist/cli/{chunk-3T65J5RG.mjs → chunk-QI5S5HWB.mjs} +2 -2
- package/dist/cli/{chunk-CBV7AKWM.js → chunk-R6DZ6NQ2.js} +5 -5
- package/dist/cli/{chunk-PM7MO62Y.mjs → chunk-RMNOZKRI.mjs} +3 -3
- package/dist/cli/{chunk-NMWGZD6Y.js → chunk-RTV4RF7N.js} +36 -36
- package/dist/cli/{chunk-CQ6JYQSW.js → chunk-SBH4CKPN.js} +11 -11
- package/dist/cli/{chunk-BIIJATTX.mjs → chunk-SG3LUONJ.mjs} +3 -3
- package/dist/cli/{chunk-2WFPHBR4.js → chunk-TFEXSHPM.js} +22 -18
- package/dist/cli/{chunk-5IL7SC45.mjs → chunk-TN4TY6TT.mjs} +6 -7
- package/dist/cli/{chunk-WEHCBH5R.mjs → chunk-UEVKMZLR.mjs} +54 -3
- package/dist/cli/{chunk-RE5MJBEV.mjs → chunk-UVQJYV76.mjs} +2 -2
- package/dist/cli/{chunk-FSIVF2SI.mjs → chunk-VZGLIK5U.mjs} +1 -1
- package/dist/cli/{chunk-W2ZWQUHT.js → chunk-WOCHZCUJ.js} +2 -2
- package/dist/cli/{chunk-ZDQFBJPO.js → chunk-XLIHTJVM.js} +348 -118
- package/dist/cli/{chunk-2ZYRBMQM.js → chunk-Y6SP3JMI.js} +22 -22
- package/dist/cli/{chunk-PPSDCN6C.js → chunk-YUA6HA6D.js} +2 -2
- package/dist/cli/{chunk-JL2OTMSG.mjs → chunk-Z3A2S3QM.mjs} +41 -0
- package/dist/cli/{chunk-E64HFB4L.mjs → chunk-Z6XPSHKM.mjs} +87 -41
- package/dist/cli/{chunk-7DOQ3OEX.mjs → chunk-Z7AOIHFE.mjs} +1870 -91
- package/dist/cli/command-docs.js +3 -3
- package/dist/cli/command-docs.mjs +2 -2
- package/dist/cli/concurrent-runs-help-CFJH4KXV.js +22 -0
- package/dist/cli/{concurrent-runs-help-C6L6I5OR.mjs → concurrent-runs-help-DNV2X5AZ.mjs} +9 -8
- package/dist/cli/{csv-QMF4FWE7.js → csv-SA6ELJY6.js} +16 -15
- package/dist/cli/{csv-SYSDXFEM.mjs → csv-ZXZGHWOM.mjs} +7 -6
- package/dist/cli/{db-Q7HURWRZ.mjs → db-A54SP6AD.mjs} +16 -16
- package/dist/cli/{db-YSHPPA4H.js → db-JHFEIQBU.js} +43 -43
- package/dist/cli/describe-PHQ33AGS.mjs +50 -0
- package/dist/cli/describe-RHJ4XRFI.js +50 -0
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/describe-core.js +6 -6
- package/dist/cli/describe-core.mjs +5 -5
- package/dist/cli/{executions-G7U3VUXN.mjs → executions-HL2M2DFU.mjs} +10 -10
- package/dist/cli/{executions-MWBC5TAW.js → executions-TLFZRHBJ.js} +12 -12
- package/dist/cli/{feedback-SD55OY6H.js → feedback-5UEX5UZK.js} +17 -16
- package/dist/cli/{feedback-GMHIFLBJ.mjs → feedback-QMBTNXVG.mjs} +9 -8
- package/dist/cli/git-4JWOOHBG.js +26 -0
- package/dist/cli/{git-HPE45OPD.mjs → git-LKGXVIVC.mjs} +8 -7
- package/dist/cli/index.js +170 -158
- package/dist/cli/index.mjs +60 -48
- package/dist/cli/{integrations-HFKVBY6G.js → integrations-6RUTLMN7.js} +23 -27
- package/dist/cli/{integrations-2W4MGIQR.mjs → integrations-FGGRVUJ7.mjs} +15 -19
- package/dist/cli/{legacy-noops-SXVNDEXN.js → legacy-noops-J3Z7QRWZ.js} +12 -11
- package/dist/cli/{legacy-noops-GZYKNU2Z.mjs → legacy-noops-YIPRMVXZ.mjs} +9 -8
- package/dist/cli/{mcp-PJRHQHHU.js → mcp-6LWFP7RW.js} +121 -48
- package/dist/cli/{mcp-BWA6KULG.mjs → mcp-CHDYFO7F.mjs} +100 -27
- package/dist/cli/{monitors-K2WSI6CR.js → monitors-STM6A7OU.js} +221 -186
- package/dist/cli/{monitors-SYQKCATO.mjs → monitors-UGRY2BXI.mjs} +58 -23
- package/dist/cli/org-3SYOUQCX.mjs +2289 -0
- package/dist/cli/org-ZOBSNSIB.js +2289 -0
- package/dist/cli/outcomes-H4YYAT5X.js +2865 -0
- package/dist/cli/outcomes-Z3P2JE67.mjs +2865 -0
- package/dist/cli/{play-SZXY2F2S.js → play-SM4CW2GS.js} +1116 -846
- package/dist/cli/{play-TTMABJEI.mjs → play-SN5YWLS7.mjs} +375 -105
- package/dist/cli/{providers-GQIOMRQO.mjs → providers-WZ4YBR5Y.mjs} +10 -10
- package/dist/cli/{providers-YDHCTZAF.js → providers-WZARYMCF.js} +13 -13
- package/dist/cli/{quickstart-PHSSMKCA.mjs → quickstart-2575BNKA.mjs} +7 -6
- package/dist/cli/{quickstart-BNYOXQXG.js → quickstart-PS4YHQJ6.js} +9 -8
- package/dist/cli/{run-GFIAZXVL.js → run-FLZ6OTM7.js} +51 -51
- package/dist/cli/{run-74C3C75C.mjs → run-ZUHCZOJS.mjs} +31 -31
- package/dist/cli/run-identity-LMLFMACS.js +31 -0
- package/dist/cli/{run-identity-MRNCEGV2.mjs → run-identity-MAZ7ANH5.mjs} +9 -3
- package/dist/cli/{search-3SWUB7KX.mjs → search-HLPPKQEO.mjs} +11 -11
- package/dist/cli/search-JJWVHR3N.js +32 -0
- package/dist/cli/{search-output-K2SWHVHQ.mjs → search-output-PDAXNOGP.mjs} +9 -8
- package/dist/cli/{search-output-6JF3S4TP.js → search-output-RXJLU36B.js} +12 -11
- package/dist/cli/{secrets-2M4XWEKE.mjs → secrets-CGELYQ3H.mjs} +11 -11
- package/dist/cli/{secrets-2SAKLH2H.js → secrets-QJNG7G2Y.js} +20 -20
- package/dist/cli/sessions-DHTBT2GN.js +23 -0
- package/dist/cli/{sessions-A64BCXTO.mjs → sessions-ELMWVR4M.mjs} +9 -8
- package/dist/cli/{settings-HV64WIJF.js → settings-44I44P5F.js} +89 -89
- package/dist/cli/{settings-SVGEC3FI.mjs → settings-RR3LZXL7.mjs} +16 -16
- package/dist/cli/{setup-EDC3NEJ3.mjs → setup-KGWRWH4B.mjs} +20 -19
- package/dist/cli/{setup-FHXOLQGQ.js → setup-KTEYOCJO.js} +60 -59
- package/dist/cli/skills-EPZPEXI2.js +37 -0
- package/dist/cli/{skills-3HGHZMXB.mjs → skills-FPRID2I5.mjs} +10 -9
- package/dist/cli/tools-IGQQ5TML.js +57 -0
- package/dist/cli/{tools-P2QS6A6Q.mjs → tools-PI4WMDLY.mjs} +23 -23
- package/dist/cli/update-4RNCVYGE.js +37 -0
- package/dist/cli/{update-552BYQM4.mjs → update-VJOJAZ7B.mjs} +14 -11
- package/dist/cli/{views-PA25NAE3.js → views-NTUOLNQU.js} +62 -64
- package/dist/cli/{views-LD5HXJYY.mjs → views-OVPSINZO.mjs} +47 -49
- package/dist/cli/{workflow-FIDBUQV6.js → workflow-2UDYDM6F.js} +23 -23
- package/dist/cli/{workflow-LDYFGBYP.mjs → workflow-7OEFNXZC.mjs} +13 -13
- package/dist/{client-DuDFiJDU.d.mts → client-B8f7RNF8.d.mts} +1 -1
- package/dist/{client-t9HZAkFD.d.ts → client-C5TgXmJQ.d.ts} +1 -1
- package/dist/{client-core-DydMQOft.d.mts → client-core-SLLGBTht.d.mts} +285 -23
- package/dist/{client-core-CJRzLanv.d.ts → client-core-p0sOxnkl.d.ts} +285 -23
- package/dist/{compiler-manifest-BqwVrOri.d.mts → compiler-manifest-D_zZEh9Q.d.mts} +70 -5
- package/dist/{compiler-manifest-BqwVrOri.d.ts → compiler-manifest-D_zZEh9Q.d.ts} +70 -5
- package/dist/{errors-BU8FB99X.d.mts → errors-CZCrBFrQ.d.mts} +1 -1
- package/dist/{errors-DfVN_FUG.d.ts → errors-DsUkLrdZ.d.ts} +1 -1
- package/dist/{index-BGnvtYGc.d.ts → index-B6RTOZGC.d.ts} +1 -1
- package/dist/{index-DjZgwpGw.d.mts → index-DeOVrEmX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +66 -55
- package/dist/index.mjs +25 -14
- package/dist/install-integrity.json +162 -142
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +23 -4
- package/dist/plays/csv-data-input.js +3 -3
- package/dist/plays/csv-data-input.mjs +2 -2
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +4 -4
- package/dist/plays/run-request.mjs +3 -3
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +15 -13
- package/dist/server.mjs +9 -7
- package/package.json +1 -1
- package/dist/cli/auth-B4PI7GVY.js +0 -43
- package/dist/cli/concurrent-runs-help-JEFQZTJI.js +0 -21
- package/dist/cli/describe-PXTSBJTL.js +0 -50
- package/dist/cli/describe-YGMQBV44.mjs +0 -50
- package/dist/cli/git-I3JV7IGH.js +0 -25
- package/dist/cli/org-5KD7X7IA.mjs +0 -1282
- package/dist/cli/org-YQ2CR32B.js +0 -1282
- package/dist/cli/run-identity-G257GQED.js +0 -25
- package/dist/cli/search-2RRRF4LW.js +0 -32
- package/dist/cli/sessions-SBH27JNW.js +0 -22
- package/dist/cli/skills-Y3SRLOYD.js +0 -36
- package/dist/cli/tools-OFYPUPUV.js +0 -57
- package/dist/cli/update-SOUSCLB7.js +0 -34
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DURABLE_RUNS_ROLLOUT } from './durable-runs-rollout';
|
|
2
|
+
import { resolveExperimentSwitch } from './experiment-switches';
|
|
2
3
|
import {
|
|
3
4
|
createFencedCallDiagnosticsBudget,
|
|
4
5
|
startFencedCallDiagnostics,
|
|
@@ -129,6 +130,7 @@ import {
|
|
|
129
130
|
import { isImmutableRuntimeExecutionRecoveryOrigin } from './scheduler-backends/runtime-api-origin';
|
|
130
131
|
import {
|
|
131
132
|
isRetryableSecretResolutionStatus,
|
|
133
|
+
secretResolutionAccountAccessRetryDelayMs,
|
|
132
134
|
secretResolutionGotNoResponse,
|
|
133
135
|
secretResolutionOutageRetryDelayMs,
|
|
134
136
|
secretResolutionRetryDecision,
|
|
@@ -136,6 +138,7 @@ import {
|
|
|
136
138
|
SECRET_RESOLUTION_ATTEMPT_TIMEOUT_MS,
|
|
137
139
|
type SecretResolutionRetryDecision,
|
|
138
140
|
} from './secret-resolution-retry-policy';
|
|
141
|
+
import { isAccountAccessUnavailableResponse } from './runtime-constants';
|
|
139
142
|
import {
|
|
140
143
|
createRootRunExecutionScope,
|
|
141
144
|
deriveChildRunExecutionScope,
|
|
@@ -144,7 +147,11 @@ import {
|
|
|
144
147
|
import { DEFAULT_RUNTIME_EXECUTION_CAPABILITIES } from './execution-capabilities';
|
|
145
148
|
import { vercelProtectionBypassHeader } from './vercel-protection';
|
|
146
149
|
import { positiveTimeoutMs } from './runtime-reliability-policy';
|
|
147
|
-
import {
|
|
150
|
+
import {
|
|
151
|
+
CtxFetchTimeoutError as PlayHttpTimeoutError,
|
|
152
|
+
sendPlayHttpRequest,
|
|
153
|
+
} from './play-http-request';
|
|
154
|
+
import { CtxFetchCallerDeadline } from './ctx-fetch-caller-deadline';
|
|
148
155
|
export { CtxFetchTimeoutError } from './play-http-request';
|
|
149
156
|
export {
|
|
150
157
|
RuntimeSheetRowsBlockedError,
|
|
@@ -166,7 +173,10 @@ import {
|
|
|
166
173
|
type RuntimeResourceSnapshot,
|
|
167
174
|
type RuntimeProviderPermit,
|
|
168
175
|
} from './resource-governor';
|
|
169
|
-
import {
|
|
176
|
+
import {
|
|
177
|
+
CTX_FETCH_EGRESS_PROVIDER,
|
|
178
|
+
CTX_FETCH_EGRESS_TOOL_ID,
|
|
179
|
+
} from './builtin-pacing';
|
|
170
180
|
import {
|
|
171
181
|
legacyRawFromToolResponseRawV2,
|
|
172
182
|
RAW_V2_TOOL_RESPONSE_CONTRACT,
|
|
@@ -406,6 +416,7 @@ import {
|
|
|
406
416
|
isCustomerDbDatasetTool,
|
|
407
417
|
isQueryResultDatasetReadRequest,
|
|
408
418
|
isQueryResultDatasetTool,
|
|
419
|
+
readQueryResultDatasetResultRef,
|
|
409
420
|
} from './query-result-dataset';
|
|
410
421
|
import {
|
|
411
422
|
applyCacheReuseWindow,
|
|
@@ -470,6 +481,8 @@ import {
|
|
|
470
481
|
createRuntimeMemoryOccupancyReader,
|
|
471
482
|
createRuntimeMapMaterializationTracker,
|
|
472
483
|
createRuntimeMapRetainedRowsTracker,
|
|
484
|
+
runtimeMapJsonByteLengthOfRecordEntry,
|
|
485
|
+
type RuntimeMapRecordEntryBytesCache,
|
|
473
486
|
estimateRuntimeMapRowsMemory,
|
|
474
487
|
NODE_RUNTIME_MAP_MATERIALIZED_MEMORY_MULTIPLIER,
|
|
475
488
|
NODE_RUNTIME_MAP_ROW_OVERHEAD_BYTES,
|
|
@@ -929,6 +942,76 @@ const MAP_PERSIST_CHUNK_ROWS = 2_000;
|
|
|
929
942
|
const MAP_PERSIST_CHUNK_BYTES = 8 * 1024 * 1024;
|
|
930
943
|
const MAP_ROW_WRITER_BUFFER_BYTES = 16 * 1024 * 1024;
|
|
931
944
|
const MAP_ROW_WRITER_MAX_FLUSH_MS = 1_000;
|
|
945
|
+
/**
|
|
946
|
+
* EXPERIMENT SO1 (experiment-switches.ts): serialize each dataset row once.
|
|
947
|
+
* Cell-meta bytes are charged per changed cell instead of re-serializing the
|
|
948
|
+
* row's whole record on every cell update; a terminal row's JSON size is
|
|
949
|
+
* measured once and shared by the retained-row tracker, the row writer and
|
|
950
|
+
* the persist chunker; the runner builds a map-row write from the rows'
|
|
951
|
+
* prepared JSON. Every charge and size check keeps its value and its unit.
|
|
952
|
+
*/
|
|
953
|
+
export const SERIALIZE_DATASET_ROWS_ONCE = false;
|
|
954
|
+
/**
|
|
955
|
+
* EXPERIMENT PA1 (experiment-switches.ts): admit an in-memory dataset one
|
|
956
|
+
* execution page at a time on the streaming path, so the rows of the first
|
|
957
|
+
* page run while later pages are admitted, instead of admitting every row
|
|
958
|
+
* before any row runs. Per-page rerun admission, the run's single write
|
|
959
|
+
* intent and version, and fencing are the streaming path's own.
|
|
960
|
+
*/
|
|
961
|
+
export const PIPELINE_ARRAY_DATASET_ADMISSION = false;
|
|
962
|
+
|
|
963
|
+
/** UTF-8 bytes of a string, without encoding it. */
|
|
964
|
+
function utf8ByteLength(value: string): number {
|
|
965
|
+
return Buffer.byteLength(value, 'utf8');
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
type MeasuredPersistableRow = {
|
|
969
|
+
/** `JSON.stringify(row).length`, the writer's and chunker's unit. */
|
|
970
|
+
length: number;
|
|
971
|
+
/** UTF-8 bytes of the same text, the memory trackers' unit. */
|
|
972
|
+
bytes: number;
|
|
973
|
+
};
|
|
974
|
+
// A terminal row is not changed after it is built (a later cell update makes
|
|
975
|
+
// a new record), so its one measurement serves every tracker that sizes it.
|
|
976
|
+
const measuredPersistableRows = new WeakMap<object, MeasuredPersistableRow>();
|
|
977
|
+
|
|
978
|
+
function measurePersistableMapRow(
|
|
979
|
+
row: PersistableMapRow,
|
|
980
|
+
): MeasuredPersistableRow {
|
|
981
|
+
const cached = measuredPersistableRows.get(row);
|
|
982
|
+
if (cached) return cached;
|
|
983
|
+
const serialized = JSON.stringify(row);
|
|
984
|
+
const measured = {
|
|
985
|
+
length: serialized.length,
|
|
986
|
+
bytes: utf8ByteLength(serialized),
|
|
987
|
+
};
|
|
988
|
+
measuredPersistableRows.set(row, measured);
|
|
989
|
+
return measured;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
/**
|
|
993
|
+
* `{ ...row, data: { ...row.data, ...patch } }` serializes exactly as `row`
|
|
994
|
+
* does when every patch entry restates an own value of `row.data`: the keys,
|
|
995
|
+
* their order and their values are unchanged. Such a copy takes the source
|
|
996
|
+
* row's measurement instead of being serialized again.
|
|
997
|
+
*/
|
|
998
|
+
function inheritPersistableMapRowMeasurement(
|
|
999
|
+
from: PersistableMapRow,
|
|
1000
|
+
to: PersistableMapRow,
|
|
1001
|
+
patch: Record<string, unknown>,
|
|
1002
|
+
): void {
|
|
1003
|
+
const data = from.data as Record<string, unknown>;
|
|
1004
|
+
for (const key of Object.keys(patch)) {
|
|
1005
|
+
if (
|
|
1006
|
+
!Object.prototype.hasOwnProperty.call(data, key) ||
|
|
1007
|
+
!Object.is(data[key], patch[key])
|
|
1008
|
+
) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
measuredPersistableRows.set(to, measurePersistableMapRow(from));
|
|
1013
|
+
}
|
|
1014
|
+
|
|
932
1015
|
const MAP_STALL_LOG_INTERVAL_MS = 60_000;
|
|
933
1016
|
// Once the persistence latch has tripped, nothing a map is still waiting on can
|
|
934
1017
|
// change its outcome: the map fails and the run ends. What the wait can still
|
|
@@ -1610,6 +1693,23 @@ export async function reconcileNodeRuntimeMapResultsWithPersistedSheet(input: {
|
|
|
1610
1693
|
offset: number;
|
|
1611
1694
|
rowMode: 'all' | 'output';
|
|
1612
1695
|
}) => Promise<Record<string, unknown>[]>;
|
|
1696
|
+
/**
|
|
1697
|
+
* Keys this run committed as visible terminal rows, in commit order.
|
|
1698
|
+
* Overlapping runs of one Play share the dataset, and a later run's
|
|
1699
|
+
* admission or write moves a row's ownership to itself. Run-scoped reads
|
|
1700
|
+
* then omit that row; these keys let finalization return it and prove each
|
|
1701
|
+
* missing row was finished by another run rather than lost.
|
|
1702
|
+
*/
|
|
1703
|
+
committedRowKeys?: readonly string[];
|
|
1704
|
+
/**
|
|
1705
|
+
* Finished (enriched or failed) rows for the keys, whichever run owns them,
|
|
1706
|
+
* plus the keys another run re-admitted and has not finished, or null when
|
|
1707
|
+
* the reader cannot answer (an older runtime API). Null keeps the shortfall
|
|
1708
|
+
* a failure.
|
|
1709
|
+
*/
|
|
1710
|
+
readCommittedTerminalRows?: (
|
|
1711
|
+
keys: string[],
|
|
1712
|
+
) => Promise<CommittedRowsRead | null>;
|
|
1613
1713
|
log?: (line: string) => void;
|
|
1614
1714
|
}): Promise<Record<string, unknown>[]> {
|
|
1615
1715
|
if (
|
|
@@ -1634,6 +1734,36 @@ export async function reconcileNodeRuntimeMapResultsWithPersistedSheet(input: {
|
|
|
1634
1734
|
}
|
|
1635
1735
|
|
|
1636
1736
|
if (persistedRows.length < input.expectedRows) {
|
|
1737
|
+
const committed = await readCommittedRowsAcrossRuns(input);
|
|
1738
|
+
if (
|
|
1739
|
+
committed &&
|
|
1740
|
+
committed.takenOverRows + committed.supersededByTakeover > 0
|
|
1741
|
+
) {
|
|
1742
|
+
if (
|
|
1743
|
+
committed.unfinishedKeys === 0 &&
|
|
1744
|
+
committed.rows.length >=
|
|
1745
|
+
input.expectedRows - committed.supersededByTakeover
|
|
1746
|
+
) {
|
|
1747
|
+
input.log?.(
|
|
1748
|
+
`Runtime sheet finalization recovered ctx.dataset("${input.mapName}") ` +
|
|
1749
|
+
`with ${committed.takenOverRows} committed row(s) another run of this dataset now owns; ` +
|
|
1750
|
+
`${persistedRows.length}/${input.expectedRows} terminal persisted row(s) are still owned by ` +
|
|
1751
|
+
`run ${input.runId ?? 'unknown'}.`,
|
|
1752
|
+
);
|
|
1753
|
+
if (committed.supersededByTakeover > 0) {
|
|
1754
|
+
input.log?.(
|
|
1755
|
+
`Runtime sheet finalization skipped ${committed.supersededByTakeover} committed row(s) of ` +
|
|
1756
|
+
`ctx.dataset("${input.mapName}") because a newer run of this dataset re-admitted them and has not finished them yet.`,
|
|
1757
|
+
);
|
|
1758
|
+
}
|
|
1759
|
+
return committed.rows;
|
|
1760
|
+
}
|
|
1761
|
+
input.log?.(
|
|
1762
|
+
`Runtime sheet finalization found ${committed.takenOverRows} committed row(s) of ctx.dataset("${input.mapName}") ` +
|
|
1763
|
+
`finished by another run and ${committed.supersededByTakeover} re-admitted by another run; ` +
|
|
1764
|
+
`${committed.unfinishedKeys} committed row(s) have no finished row.`,
|
|
1765
|
+
);
|
|
1766
|
+
}
|
|
1637
1767
|
throw new Error(
|
|
1638
1768
|
`Runtime sheet finalization mismatch for ctx.dataset("${input.mapName}"): ` +
|
|
1639
1769
|
`expected ${input.expectedRows} terminal persisted row(s), saw ${persistedRows.length}; ` +
|
|
@@ -1653,6 +1783,86 @@ export async function reconcileNodeRuntimeMapResultsWithPersistedSheet(input: {
|
|
|
1653
1783
|
return input.currentRows;
|
|
1654
1784
|
}
|
|
1655
1785
|
|
|
1786
|
+
export type CommittedTerminalRow = {
|
|
1787
|
+
key: string;
|
|
1788
|
+
data: Record<string, unknown>;
|
|
1789
|
+
inputIndex?: number;
|
|
1790
|
+
ownedByOtherRun: boolean;
|
|
1791
|
+
};
|
|
1792
|
+
|
|
1793
|
+
export type CommittedRowsRead = {
|
|
1794
|
+
rows: readonly CommittedTerminalRow[];
|
|
1795
|
+
/**
|
|
1796
|
+
* Keys another run re-admitted (moved to itself as pending) and has not
|
|
1797
|
+
* finished. A newer run took precedence over these rows, so finalization
|
|
1798
|
+
* leaves them out as superseded rather than lost. Absent from older readers.
|
|
1799
|
+
*/
|
|
1800
|
+
unfinishedTakeoverKeys?: readonly string[];
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
// Each answer carries full row bodies; keep one gateway response small.
|
|
1804
|
+
const RUNTIME_SHEET_TAKEOVER_KEY_BATCH = 100;
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Every committed row in one list: rows this run still owns stay in input
|
|
1808
|
+
* order, and each row another run took over keeps its commit slot (its input
|
|
1809
|
+
* position in this run is not stored once the owner changes).
|
|
1810
|
+
*/
|
|
1811
|
+
async function readCommittedRowsAcrossRuns(input: {
|
|
1812
|
+
committedRowKeys?: readonly string[];
|
|
1813
|
+
readCommittedTerminalRows?: (
|
|
1814
|
+
keys: string[],
|
|
1815
|
+
) => Promise<CommittedRowsRead | null>;
|
|
1816
|
+
}): Promise<{
|
|
1817
|
+
rows: Record<string, unknown>[];
|
|
1818
|
+
takenOverRows: number;
|
|
1819
|
+
supersededByTakeover: number;
|
|
1820
|
+
unfinishedKeys: number;
|
|
1821
|
+
} | null> {
|
|
1822
|
+
if (!input.committedRowKeys || !input.readCommittedTerminalRows) return null;
|
|
1823
|
+
const keys = [...new Set(input.committedRowKeys.filter(Boolean))];
|
|
1824
|
+
const byKey = new Map<string, CommittedTerminalRow>();
|
|
1825
|
+
const reAdmittedByOtherRun = new Set<string>();
|
|
1826
|
+
for (
|
|
1827
|
+
let offset = 0;
|
|
1828
|
+
offset < keys.length;
|
|
1829
|
+
offset += RUNTIME_SHEET_TAKEOVER_KEY_BATCH
|
|
1830
|
+
) {
|
|
1831
|
+
const page = keys.slice(offset, offset + RUNTIME_SHEET_TAKEOVER_KEY_BATCH);
|
|
1832
|
+
const read = await input.readCommittedTerminalRows(page);
|
|
1833
|
+
if (read === null) return null;
|
|
1834
|
+
const requested = new Set(page);
|
|
1835
|
+
for (const row of read.rows) {
|
|
1836
|
+
if (requested.has(row.key)) byKey.set(row.key, row);
|
|
1837
|
+
}
|
|
1838
|
+
for (const key of read.unfinishedTakeoverKeys ?? []) {
|
|
1839
|
+
if (requested.has(key)) reAdmittedByOtherRun.add(key);
|
|
1840
|
+
}
|
|
1841
|
+
}
|
|
1842
|
+
// A finished row wins over a re-admission report for the same key.
|
|
1843
|
+
for (const key of byKey.keys()) reAdmittedByOtherRun.delete(key);
|
|
1844
|
+
const slots = keys.flatMap((key) => {
|
|
1845
|
+
const row = byKey.get(key);
|
|
1846
|
+
return row ? [row] : [];
|
|
1847
|
+
});
|
|
1848
|
+
const ownedInInputOrder = slots
|
|
1849
|
+
.filter((row) => !row.ownedByOtherRun)
|
|
1850
|
+
.sort(
|
|
1851
|
+
(left, right) =>
|
|
1852
|
+
(left.inputIndex ?? Number.MAX_SAFE_INTEGER) -
|
|
1853
|
+
(right.inputIndex ?? Number.MAX_SAFE_INTEGER),
|
|
1854
|
+
);
|
|
1855
|
+
let nextOwned = 0;
|
|
1856
|
+
return {
|
|
1857
|
+
rows: slots.map((row) =>
|
|
1858
|
+
row.ownedByOtherRun ? row.data : ownedInInputOrder[nextOwned++]!.data,
|
|
1859
|
+
),
|
|
1860
|
+
takenOverRows: slots.length - ownedInInputOrder.length,
|
|
1861
|
+
supersededByTakeover: reAdmittedByOtherRun.size,
|
|
1862
|
+
unfinishedKeys: keys.length - slots.length - reAdmittedByOtherRun.size,
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1656
1866
|
export function resolveToolRuntimeTimeoutMs(
|
|
1657
1867
|
toolId: string,
|
|
1658
1868
|
requestedTimeoutMs?: number,
|
|
@@ -1686,6 +1896,7 @@ export function resolveToolRuntimeTimeoutMs(
|
|
|
1686
1896
|
normalized === 'deeplineagent_ai_inference' ||
|
|
1687
1897
|
normalized === 'ai_evaluate' ||
|
|
1688
1898
|
normalized === 'deeplineagent_ai_evaluate' ||
|
|
1899
|
+
normalized === 'ai_decision' ||
|
|
1689
1900
|
normalized === 'aiinference'
|
|
1690
1901
|
? DEEPLINEAGENT_TOOL_RUNTIME_TIMEOUT_MS
|
|
1691
1902
|
: DEFAULT_TOOL_RUNTIME_TIMEOUT_MS;
|
|
@@ -2310,6 +2521,8 @@ type ToolExecutionApiOptions = {
|
|
|
2310
2521
|
offset: number;
|
|
2311
2522
|
pageSize: number;
|
|
2312
2523
|
totalRows: number;
|
|
2524
|
+
/** Stored-result handle the first page reported; later pages read it. */
|
|
2525
|
+
resultRef?: string | null;
|
|
2313
2526
|
};
|
|
2314
2527
|
/**
|
|
2315
2528
|
* Rows — and the column within each row — that will retain this call's
|
|
@@ -2383,6 +2596,43 @@ const LOG_RATE_LIMIT_MARKER_EVERY = 1_000;
|
|
|
2383
2596
|
|
|
2384
2597
|
type LogRateLimitState = { seen: number; sampled: number; suppressed: number };
|
|
2385
2598
|
const STEP_PROGRAM_MAP_DEFINITION = Symbol('deepline.stepProgramMapDefinition');
|
|
2599
|
+
/** The authored step program a step-program map definition wraps. */
|
|
2600
|
+
const STEP_PROGRAM_MAP_SOURCE = Symbol('deepline.stepProgramMapSource');
|
|
2601
|
+
/**
|
|
2602
|
+
* Source text of a column function that may call out of the row: a tool, a
|
|
2603
|
+
* Play, a wait or sleep, a fetch, or a suspension thrown directly.
|
|
2604
|
+
*/
|
|
2605
|
+
const ROW_WORK_MAY_AWAIT_SOURCE =
|
|
2606
|
+
/\.tools\b|\btools\.|runPlay|\.wait|waitFor|\.sleep\(|\bfetch\(|Suspend|Backpressure|\[native code\]/;
|
|
2607
|
+
|
|
2608
|
+
/**
|
|
2609
|
+
* Whether any function reachable from a map definition's authored columns may
|
|
2610
|
+
* make the row wait on work outside it, which can suspend the map. A function
|
|
2611
|
+
* whose source cannot be read counts as one that may.
|
|
2612
|
+
*/
|
|
2613
|
+
function mapDefinitionMayAwaitRowWork(definition: object): boolean {
|
|
2614
|
+
const program = (definition as Record<PropertyKey, unknown>)[
|
|
2615
|
+
STEP_PROGRAM_MAP_SOURCE
|
|
2616
|
+
];
|
|
2617
|
+
const seen = new Set<object>();
|
|
2618
|
+
const visit = (value: unknown, depth: number): boolean => {
|
|
2619
|
+
if (typeof value === 'function') {
|
|
2620
|
+
let source: string;
|
|
2621
|
+
try {
|
|
2622
|
+
source = Function.prototype.toString.call(value);
|
|
2623
|
+
} catch {
|
|
2624
|
+
return true;
|
|
2625
|
+
}
|
|
2626
|
+
return ROW_WORK_MAY_AWAIT_SOURCE.test(source);
|
|
2627
|
+
}
|
|
2628
|
+
if (!value || typeof value !== 'object' || seen.has(value)) return false;
|
|
2629
|
+
if (depth > 8) return true;
|
|
2630
|
+
seen.add(value);
|
|
2631
|
+
const children = Array.isArray(value) ? value : Object.values(value);
|
|
2632
|
+
return children.some((child) => visit(child, depth + 1));
|
|
2633
|
+
};
|
|
2634
|
+
return visit(program ?? definition, 0);
|
|
2635
|
+
}
|
|
2386
2636
|
const ACTIVE_MAP_CHECKPOINT_ROW_META_LEDGER_KEY = Symbol(
|
|
2387
2637
|
'deepline.activeMapCheckpointRowMetaLedgerKey',
|
|
2388
2638
|
);
|
|
@@ -2493,6 +2743,8 @@ function createRuntimeMapRowPersistence(
|
|
|
2493
2743
|
prepareTerminalRow?: (row: PersistableMapRow) => PersistableMapRow;
|
|
2494
2744
|
persistCheckpoint?: (updates: PlayRowUpdate[]) => Promise<void>;
|
|
2495
2745
|
onFailure?: (error: unknown) => void;
|
|
2746
|
+
/** A terminal row's writer bytes; `persistableMapRowBytes` when absent. */
|
|
2747
|
+
estimateTerminalBytes?: (row: PersistableMapRow) => number;
|
|
2496
2748
|
/**
|
|
2497
2749
|
* A trip anywhere in the run — a receipt completion that could not be
|
|
2498
2750
|
* stored, a sheet write this run no longer owns — fails this writer with
|
|
@@ -2528,7 +2780,8 @@ function createRuntimeMapRowPersistence(
|
|
|
2528
2780
|
...(incoming.cellMetaPatch ?? {}),
|
|
2529
2781
|
},
|
|
2530
2782
|
}),
|
|
2531
|
-
estimateTerminalBytes:
|
|
2783
|
+
estimateTerminalBytes:
|
|
2784
|
+
options?.estimateTerminalBytes ?? persistableMapRowBytes,
|
|
2532
2785
|
estimateCheckpointBytes: (update) => JSON.stringify(update).length,
|
|
2533
2786
|
maxBatchRows: MAP_PERSIST_CHUNK_ROWS,
|
|
2534
2787
|
maxBatchBytes: MAP_PERSIST_CHUNK_BYTES,
|
|
@@ -3220,6 +3473,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3220
3473
|
private activeMapCellMeta: Map<string, Record<string, unknown>> | null = null;
|
|
3221
3474
|
/** Exact serialized ownership of activeMapCellMeta, one current record per row. */
|
|
3222
3475
|
private activeMapCellMetaBytesByKey: Map<string, number> | null = null;
|
|
3476
|
+
/**
|
|
3477
|
+
* SO1: each row's per-cell serialized shares and its key's, so a cell
|
|
3478
|
+
* update re-serializes only the cells whose value changed.
|
|
3479
|
+
*/
|
|
3480
|
+
private activeMapCellMetaEntryBytes: RuntimeMapRecordEntryBytesCache | null =
|
|
3481
|
+
null;
|
|
3482
|
+
#serializeRowsOnce: boolean | undefined;
|
|
3483
|
+
#pipelineArrayAdmission: boolean | undefined;
|
|
3223
3484
|
private activeMapCellMetaBytes = 0;
|
|
3224
3485
|
private activeMapCellMetaMemory: RuntimeMemoryLedgerHandle | null = null;
|
|
3225
3486
|
/**
|
|
@@ -4894,6 +5155,24 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4894
5155
|
);
|
|
4895
5156
|
}
|
|
4896
5157
|
|
|
5158
|
+
/** SO1 for this run: the run's override, else the static default. */
|
|
5159
|
+
private serializeRowsOnce(): boolean {
|
|
5160
|
+
return (this.#serializeRowsOnce ??= resolveExperimentSwitch(
|
|
5161
|
+
'SO1',
|
|
5162
|
+
this.#options.experimentSwitchOverrides,
|
|
5163
|
+
SERIALIZE_DATASET_ROWS_ONCE,
|
|
5164
|
+
));
|
|
5165
|
+
}
|
|
5166
|
+
|
|
5167
|
+
/** PA1 for this run: the run's override, else the static default. */
|
|
5168
|
+
private pipelineArrayAdmission(): boolean {
|
|
5169
|
+
return (this.#pipelineArrayAdmission ??= resolveExperimentSwitch(
|
|
5170
|
+
'PA1',
|
|
5171
|
+
this.#options.experimentSwitchOverrides,
|
|
5172
|
+
PIPELINE_ARRAY_DATASET_ADMISSION,
|
|
5173
|
+
));
|
|
5174
|
+
}
|
|
5175
|
+
|
|
4897
5176
|
private emitScopedRowUpdate(
|
|
4898
5177
|
key: string | null,
|
|
4899
5178
|
tableNamespace: string | null,
|
|
@@ -4994,7 +5273,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
4994
5273
|
// Nested step values exist in cell patches, not the authored return row.
|
|
4995
5274
|
// Commit them with the terminal row before clearing its checkpoint state,
|
|
4996
5275
|
// without adding internal fields to the immediate authored result snapshot.
|
|
4997
|
-
|
|
5276
|
+
if (!patch) return row;
|
|
5277
|
+
const merged = { ...row, data: { ...row.data, ...patch } };
|
|
5278
|
+
if (this.serializeRowsOnce()) {
|
|
5279
|
+
inheritPersistableMapRowMeasurement(row, merged, patch);
|
|
5280
|
+
}
|
|
5281
|
+
return merged;
|
|
4998
5282
|
}
|
|
4999
5283
|
|
|
5000
5284
|
private clearActiveMapCheckpointUpdate(
|
|
@@ -5014,12 +5298,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
5014
5298
|
this.clearActiveMapCellMeta();
|
|
5015
5299
|
this.activeMapCellMeta = new Map();
|
|
5016
5300
|
this.activeMapCellMetaBytesByKey = new Map();
|
|
5301
|
+
this.activeMapCellMetaEntryBytes = this.serializeRowsOnce()
|
|
5302
|
+
? new Map()
|
|
5303
|
+
: null;
|
|
5017
5304
|
this.activeMapCellMetaBytes = 0;
|
|
5018
5305
|
}
|
|
5019
5306
|
|
|
5020
5307
|
private clearActiveMapCellMeta(): void {
|
|
5021
5308
|
this.activeMapCellMeta = null;
|
|
5022
5309
|
this.activeMapCellMetaBytesByKey = null;
|
|
5310
|
+
this.activeMapCellMetaEntryBytes = null;
|
|
5023
5311
|
this.activeMapCellMetaBytes = 0;
|
|
5024
5312
|
this.activeMapCellMetaMemory?.release();
|
|
5025
5313
|
this.activeMapCellMetaMemory = null;
|
|
@@ -5033,7 +5321,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
5033
5321
|
const bytesByKey = this.activeMapCellMetaBytesByKey;
|
|
5034
5322
|
if (!cellMeta || !bytesByKey) return;
|
|
5035
5323
|
const previousBytes = bytesByKey.get(key) ?? 0;
|
|
5036
|
-
const nextBytes =
|
|
5324
|
+
const nextBytes = this.activeMapCellMetaEntryBytes
|
|
5325
|
+
? runtimeMapJsonByteLengthOfRecordEntry(
|
|
5326
|
+
key,
|
|
5327
|
+
value,
|
|
5328
|
+
this.activeMapCellMetaEntryBytes,
|
|
5329
|
+
)
|
|
5330
|
+
: runtimeMapJsonByteLength({ [key]: value });
|
|
5037
5331
|
cellMeta.set(key, value);
|
|
5038
5332
|
bytesByKey.set(key, nextBytes);
|
|
5039
5333
|
this.activeMapCellMetaBytes = Math.max(
|
|
@@ -5052,6 +5346,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
5052
5346
|
if (previousBytes === undefined) return;
|
|
5053
5347
|
this.activeMapCellMeta?.delete(key);
|
|
5054
5348
|
this.activeMapCellMetaBytesByKey?.delete(key);
|
|
5349
|
+
this.activeMapCellMetaEntryBytes?.delete(key);
|
|
5055
5350
|
this.activeMapCellMetaBytes = Math.max(
|
|
5056
5351
|
0,
|
|
5057
5352
|
this.activeMapCellMetaBytes - previousBytes,
|
|
@@ -5376,12 +5671,29 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
5376
5671
|
|
|
5377
5672
|
const retryAfter = response.headers.get('retry-after');
|
|
5378
5673
|
respondedAttempts += 1;
|
|
5379
|
-
const
|
|
5674
|
+
const ladder = isRetryableSecretResolutionStatus(response.status)
|
|
5380
5675
|
? secretResolutionRetryDecision({
|
|
5381
5676
|
attempt: respondedAttempts,
|
|
5382
5677
|
retryAfter,
|
|
5383
5678
|
})
|
|
5384
5679
|
: NO_SECRET_RESOLUTION_RETRY;
|
|
5680
|
+
// A declared account-access refusal ran before any route: keep
|
|
5681
|
+
// resending through a brief dependency blip within its own budget.
|
|
5682
|
+
const accountAccessRetryDelayMs =
|
|
5683
|
+
!ladder.retry && isAccountAccessUnavailableResponse(response)
|
|
5684
|
+
? secretResolutionAccountAccessRetryDelayMs({
|
|
5685
|
+
respondedAttempts,
|
|
5686
|
+
elapsedMs: Date.now() - operationStartedAt,
|
|
5687
|
+
})
|
|
5688
|
+
: null;
|
|
5689
|
+
const retry =
|
|
5690
|
+
accountAccessRetryDelayMs === null
|
|
5691
|
+
? ladder
|
|
5692
|
+
: {
|
|
5693
|
+
...ladder,
|
|
5694
|
+
retry: true,
|
|
5695
|
+
retryDelayMs: accountAccessRetryDelayMs,
|
|
5696
|
+
};
|
|
5385
5697
|
const responseDiagnostic = {
|
|
5386
5698
|
stage: response.ok ? 'invalid_response' : 'http_response',
|
|
5387
5699
|
secret_name: secret.name,
|
|
@@ -9366,6 +9678,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9366
9678
|
const originalRequestInput = requestInput as Record<string, unknown>;
|
|
9367
9679
|
const datasetLimit =
|
|
9368
9680
|
finitePositiveInteger(dataset.returned_limit) ?? totalRows;
|
|
9681
|
+
const storedResultRef = readQueryResultDatasetResultRef(dataset);
|
|
9369
9682
|
const effectiveCount = Math.min(totalRows, datasetLimit);
|
|
9370
9683
|
const previewRows = rows.slice(0, Math.min(rows.length, 25));
|
|
9371
9684
|
const executionNonce =
|
|
@@ -9396,6 +9709,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
9396
9709
|
offset,
|
|
9397
9710
|
pageSize: Math.min(limit, QUERY_RESULT_DATASET_PAGE_SIZE),
|
|
9398
9711
|
totalRows,
|
|
9712
|
+
resultRef: storedResultRef,
|
|
9399
9713
|
},
|
|
9400
9714
|
},
|
|
9401
9715
|
);
|
|
@@ -10419,8 +10733,34 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10419
10733
|
}
|
|
10420
10734
|
}
|
|
10421
10735
|
}
|
|
10736
|
+
// PA1: an in-memory array the materialized path would admit whole runs
|
|
10737
|
+
// on the streaming path instead, one execution page at a time with one
|
|
10738
|
+
// pool fed across pages, as a staged or cursor source already does. A
|
|
10739
|
+
// pure-JS fast-path definition pages serially there, and a suspended
|
|
10740
|
+
// materialized frame replays on its own path, so both keep theirs.
|
|
10741
|
+
// Only a fresh invocation whose columns cannot wait on outside work
|
|
10742
|
+
// pipelines: the streaming path re-reads an unsealed array on replay,
|
|
10743
|
+
// where the materialized path replays the inputs it checkpointed.
|
|
10744
|
+
const pipelinedArrayInput =
|
|
10745
|
+
sealedArrayInput === null &&
|
|
10746
|
+
Array.isArray(items) &&
|
|
10747
|
+
!replayMapFrame &&
|
|
10748
|
+
sourceArrayEstimate !== null &&
|
|
10749
|
+
// Below the size at which an array would be staged instead.
|
|
10750
|
+
sourceArrayEstimate.estimatedResidentBytes * 2 <=
|
|
10751
|
+
mapMemoryLimits.materializedBudgetBytes &&
|
|
10752
|
+
hasRuntimeSheetControls &&
|
|
10753
|
+
canReadPersistedMapResults &&
|
|
10754
|
+
Boolean(this.#options.onMapStartPages) &&
|
|
10755
|
+
this.pipelineArrayAdmission() &&
|
|
10756
|
+
!this.canUsePureJsMapFastPath(
|
|
10757
|
+
input as MapFieldDefinition<Record<string, unknown>>,
|
|
10758
|
+
) &&
|
|
10759
|
+
!mapDefinitionMayAwaitRowWork(input);
|
|
10422
10760
|
const shouldStreamRuntimeBackedDataset =
|
|
10423
|
-
(isPlayDataset<T>(items) ||
|
|
10761
|
+
(isPlayDataset<T>(items) ||
|
|
10762
|
+
sealedArrayInput !== null ||
|
|
10763
|
+
pipelinedArrayInput) &&
|
|
10424
10764
|
hasRuntimeSheetControls;
|
|
10425
10765
|
// A suspended map's admitted pending inputs remain authoritative even
|
|
10426
10766
|
// when a stateful authored source returns fewer rows after a wake.
|
|
@@ -10482,9 +10822,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10482
10822
|
// budget among the active page, sheet-admission copies, retained row
|
|
10483
10823
|
// outcomes, and the optional immediate result cache. A cursor has no
|
|
10484
10824
|
// resident source.
|
|
10485
|
-
const arraySourceMemoryEstimate =
|
|
10486
|
-
? sourceArrayEstimate
|
|
10487
|
-
: null;
|
|
10825
|
+
const arraySourceMemoryEstimate =
|
|
10826
|
+
sealedArrayInput || pipelinedArrayInput ? sourceArrayEstimate : null;
|
|
10488
10827
|
if (
|
|
10489
10828
|
arraySourceMemoryEstimate &&
|
|
10490
10829
|
arraySourceMemoryEstimate.estimatedResidentBytes >
|
|
@@ -10499,9 +10838,16 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10499
10838
|
}
|
|
10500
10839
|
// Both explicit and implicit first-wins keys survive page settlement.
|
|
10501
10840
|
// Reserve their bounded index apart from transient page allocations.
|
|
10841
|
+
// A pipelined array keeps the materialized path's first-wins implicit
|
|
10842
|
+
// keys across pages, so it reserves the same key index a sealed one does.
|
|
10843
|
+
const pagedArrayRows = sealedArrayInput
|
|
10844
|
+
? sealedArrayInput.sourceRows
|
|
10845
|
+
: pipelinedArrayInput && Array.isArray(items)
|
|
10846
|
+
? items.length
|
|
10847
|
+
: 0;
|
|
10502
10848
|
const keyIndexBudgetBytes =
|
|
10503
|
-
sealedArrayInput && !useSourceRowIdentity
|
|
10504
|
-
?
|
|
10849
|
+
(sealedArrayInput || pipelinedArrayInput) && !useSourceRowIdentity
|
|
10850
|
+
? pagedArrayRows *
|
|
10505
10851
|
(explicitKeyResolver
|
|
10506
10852
|
? explicitKeyReservationBytesPerRow
|
|
10507
10853
|
: implicitKeyReservationBytesPerRow)
|
|
@@ -10545,9 +10891,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10545
10891
|
? sealedArrayInput.sourceRows
|
|
10546
10892
|
: isPlayDataset(items)
|
|
10547
10893
|
? await items.count()
|
|
10548
|
-
: (
|
|
10549
|
-
|
|
10550
|
-
|
|
10894
|
+
: pipelinedArrayInput && Array.isArray(items)
|
|
10895
|
+
? items.length
|
|
10896
|
+
: (() => {
|
|
10897
|
+
throw new Error('Runtime-backed map source is missing.');
|
|
10898
|
+
})();
|
|
10551
10899
|
const mapScope = this.createMapExecutionScope({
|
|
10552
10900
|
logicalNamespace: normalizedMapNamespace,
|
|
10553
10901
|
artifactTableNamespace: resolvedTableNamespace,
|
|
@@ -10663,7 +11011,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10663
11011
|
chunkBytes = 0;
|
|
10664
11012
|
};
|
|
10665
11013
|
for (const row of rows) {
|
|
10666
|
-
const rowBytes =
|
|
11014
|
+
const rowBytes = this.serializeRowsOnce()
|
|
11015
|
+
? measurePersistableMapRow(row).length
|
|
11016
|
+
: persistableMapRowBytes(row);
|
|
10667
11017
|
if (
|
|
10668
11018
|
chunk.length >= MAP_PERSIST_CHUNK_ROWS ||
|
|
10669
11019
|
(chunkBytes + rowBytes > MAP_PERSIST_CHUNK_BYTES &&
|
|
@@ -10716,6 +11066,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10716
11066
|
budgetBytes: pageBudgetBytes,
|
|
10717
11067
|
});
|
|
10718
11068
|
}
|
|
11069
|
+
// PA1: a key depends only on the row, its index and the namespace, so
|
|
11070
|
+
// the admitted rows below reuse the stamped keys unless admission
|
|
11071
|
+
// rebound the namespace.
|
|
11072
|
+
const stampNamespace = resolvedTableNamespace;
|
|
11073
|
+
const stampedRowKeys = pipelinedArrayInput
|
|
11074
|
+
? pageRawItems.map((row, index) =>
|
|
11075
|
+
seedRowIdentity(row, page.offset + index),
|
|
11076
|
+
)
|
|
11077
|
+
: null;
|
|
10719
11078
|
const pageStartRows = pageRawItems.map((row, index) => {
|
|
10720
11079
|
const originalIndex = page.offset + index;
|
|
10721
11080
|
return {
|
|
@@ -10724,7 +11083,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10724
11083
|
? { __deeplineSourceRow: getPlayDatasetSourceRowIdentity(row) }
|
|
10725
11084
|
: {}),
|
|
10726
11085
|
...mapRowOutcomeRuntimeFields({
|
|
10727
|
-
key:
|
|
11086
|
+
key:
|
|
11087
|
+
stampedRowKeys?.[index] ?? seedRowIdentity(row, originalIndex),
|
|
10728
11088
|
inputIndex: originalIndex,
|
|
10729
11089
|
}),
|
|
10730
11090
|
};
|
|
@@ -10758,9 +11118,14 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10758
11118
|
const { pendingRowsByKey, completedRowsByKey, previousCellsByKey } =
|
|
10759
11119
|
admission;
|
|
10760
11120
|
|
|
11121
|
+
const reusableRowKeys =
|
|
11122
|
+
stampedRowKeys && resolvedTableNamespace === stampNamespace
|
|
11123
|
+
? stampedRowKeys
|
|
11124
|
+
: null;
|
|
10761
11125
|
const seededItems = pageRawItems.map((row, index) => {
|
|
10762
11126
|
const originalIndex = page.offset + index;
|
|
10763
|
-
const rowKey =
|
|
11127
|
+
const rowKey =
|
|
11128
|
+
reusableRowKeys?.[index] ?? seedRowIdentity(row, originalIndex);
|
|
10764
11129
|
const persisted =
|
|
10765
11130
|
pendingRowsByKey.get(rowKey) ?? completedRowsByKey.get(rowKey);
|
|
10766
11131
|
return {
|
|
@@ -10822,7 +11187,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10822
11187
|
}
|
|
10823
11188
|
const rowKey = rowIdentity(row, index);
|
|
10824
11189
|
if (
|
|
10825
|
-
sealedArrayInput &&
|
|
11190
|
+
(sealedArrayInput || pipelinedArrayInput) &&
|
|
10826
11191
|
!explicitKeyResolver &&
|
|
10827
11192
|
!useSourceRowIdentity
|
|
10828
11193
|
) {
|
|
@@ -10901,6 +11266,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
10901
11266
|
{
|
|
10902
11267
|
prepareTerminalRow: (row) =>
|
|
10903
11268
|
this.withPendingMapRowData(row, resolvedTableNamespace),
|
|
11269
|
+
...(this.serializeRowsOnce()
|
|
11270
|
+
? {
|
|
11271
|
+
estimateTerminalBytes: (row: PersistableMapRow) =>
|
|
11272
|
+
measurePersistableMapRow(row).length,
|
|
11273
|
+
}
|
|
11274
|
+
: {}),
|
|
10904
11275
|
persistCheckpoint: this.#options.onMapRowsCheckpoint
|
|
10905
11276
|
? (updates) =>
|
|
10906
11277
|
this.#options.onMapRowsCheckpoint!({
|
|
@@ -11233,6 +11604,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11233
11604
|
});
|
|
11234
11605
|
} catch (error) {
|
|
11235
11606
|
rowFeed.fail(error);
|
|
11607
|
+
if (pipelinedArrayInput && isPlayExecutionSuspendedError(error)) {
|
|
11608
|
+
// PA1 admits only columns that cannot wait on outside work. One
|
|
11609
|
+
// that suspended anyway would replay a re-read authored array,
|
|
11610
|
+
// not checkpointed inputs, so stop the run instead.
|
|
11611
|
+
throw new Error(
|
|
11612
|
+
`Dataset ${normalizedMapNamespace} suspended while its in-memory input was admitted page by page (experiment PA1); its inputs are not checkpointed for replay.`,
|
|
11613
|
+
{ cause: error },
|
|
11614
|
+
);
|
|
11615
|
+
}
|
|
11236
11616
|
throw error;
|
|
11237
11617
|
} finally {
|
|
11238
11618
|
await pump;
|
|
@@ -11990,7 +12370,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
11990
12370
|
chunkBytes = 0;
|
|
11991
12371
|
};
|
|
11992
12372
|
for (const row of rows) {
|
|
11993
|
-
const rowBytes =
|
|
12373
|
+
const rowBytes = this.serializeRowsOnce()
|
|
12374
|
+
? measurePersistableMapRow(row).length
|
|
12375
|
+
: JSON.stringify(row).length;
|
|
11994
12376
|
if (
|
|
11995
12377
|
chunk.length >= MAP_PERSIST_CHUNK_ROWS ||
|
|
11996
12378
|
(chunkBytes + rowBytes > MAP_PERSIST_CHUNK_BYTES && chunk.length > 0)
|
|
@@ -12006,6 +12388,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
12006
12388
|
? createRuntimeMapRowPersistence(persistMapRows, visibility, {
|
|
12007
12389
|
prepareTerminalRow: (row) =>
|
|
12008
12390
|
this.withPendingMapRowData(row, resolvedTableNamespace),
|
|
12391
|
+
...(this.serializeRowsOnce()
|
|
12392
|
+
? {
|
|
12393
|
+
estimateTerminalBytes: (row: PersistableMapRow) =>
|
|
12394
|
+
measurePersistableMapRow(row).length,
|
|
12395
|
+
}
|
|
12396
|
+
: {}),
|
|
12009
12397
|
persistCheckpoint: this.#options.onMapRowsCheckpoint
|
|
12010
12398
|
? (updates) =>
|
|
12011
12399
|
this.#options.onMapRowsCheckpoint!({
|
|
@@ -12219,6 +12607,54 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
12219
12607
|
currentRows: results,
|
|
12220
12608
|
failedRowCount: resumedPendingRowsOnly ? 0 : visibleFailedRows.length,
|
|
12221
12609
|
rowMode: finalizationRowMode,
|
|
12610
|
+
// When the resumed frame recorded superseded rows, restoreCompletedRows
|
|
12611
|
+
// already kept only keys this run still owned at that wake; the
|
|
12612
|
+
// others became reused inputs and left expectedRows. Takeovers after
|
|
12613
|
+
// that restore (or on a frame without superseded rows) remain here
|
|
12614
|
+
// and must be proven finished by another run, or re-admitted and
|
|
12615
|
+
// still unfinished under another run (left out as superseded).
|
|
12616
|
+
committedRowKeys: [
|
|
12617
|
+
...previouslyCompletedRowKeys,
|
|
12618
|
+
...visibleCompletedRows.map((row) => row.key),
|
|
12619
|
+
],
|
|
12620
|
+
readCommittedTerminalRows:
|
|
12621
|
+
this.#options.baseUrl &&
|
|
12622
|
+
this.#options.executorToken &&
|
|
12623
|
+
this.#options.playName &&
|
|
12624
|
+
this.#options.runId
|
|
12625
|
+
? async (keys) => {
|
|
12626
|
+
const result = await readRuntimeSheetDatasetRowKeys(
|
|
12627
|
+
{
|
|
12628
|
+
baseUrl: this.#options.baseUrl!,
|
|
12629
|
+
executorToken: this.#options.executorToken!,
|
|
12630
|
+
dbSessionStrategy: this.#options.dbSessionStrategy,
|
|
12631
|
+
playName: this.#options.playName!,
|
|
12632
|
+
userEmail: this.#options.userEmail,
|
|
12633
|
+
runId: this.#options.runId!,
|
|
12634
|
+
},
|
|
12635
|
+
{
|
|
12636
|
+
tableNamespace: resolvedTableNamespace,
|
|
12637
|
+
runId: this.#options.runId!,
|
|
12638
|
+
keys,
|
|
12639
|
+
rowMode: 'terminalRowsAnyRun',
|
|
12640
|
+
},
|
|
12641
|
+
);
|
|
12642
|
+
// An older runtime API answers an unknown mode as an
|
|
12643
|
+
// `output` read of this run's own keys; only an echoed mode
|
|
12644
|
+
// carries rows from every run.
|
|
12645
|
+
return result.rowMode === 'terminalRowsAnyRun' &&
|
|
12646
|
+
Array.isArray(result.rows)
|
|
12647
|
+
? {
|
|
12648
|
+
rows: result.rows,
|
|
12649
|
+
unfinishedTakeoverKeys: Array.isArray(
|
|
12650
|
+
result.unfinishedTakeoverKeys,
|
|
12651
|
+
)
|
|
12652
|
+
? result.unfinishedTakeoverKeys
|
|
12653
|
+
: [],
|
|
12654
|
+
}
|
|
12655
|
+
: null;
|
|
12656
|
+
}
|
|
12657
|
+
: undefined,
|
|
12222
12658
|
log: (line) => this.runtimeLog(line),
|
|
12223
12659
|
readPersistedRows: async (readInput) => {
|
|
12224
12660
|
if (
|
|
@@ -12596,7 +13032,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
12596
13032
|
): void => {
|
|
12597
13033
|
if (!retainedRowsComplete) return;
|
|
12598
13034
|
try {
|
|
12599
|
-
retainedRowCharges.set(
|
|
13035
|
+
retainedRowCharges.set(
|
|
13036
|
+
row,
|
|
13037
|
+
retainedRowsMemoryTracker.track(
|
|
13038
|
+
row,
|
|
13039
|
+
this.serializeRowsOnce()
|
|
13040
|
+
? measurePersistableMapRow(row).bytes
|
|
13041
|
+
: undefined,
|
|
13042
|
+
),
|
|
13043
|
+
);
|
|
12600
13044
|
target.push(row);
|
|
12601
13045
|
trackMaterializedRowBytes();
|
|
12602
13046
|
} catch (error) {
|
|
@@ -12793,7 +13237,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
12793
13237
|
...(this.#options.runtimeMapHeapProbe
|
|
12794
13238
|
? { heapProbe: this.#options.runtimeMapHeapProbe }
|
|
12795
13239
|
: {}),
|
|
12796
|
-
|
|
13240
|
+
// Only lag sampled while this map runs: the run-wide EWMA still held the
|
|
13241
|
+
// runner's boot and row preparation when admission was quick, and cut
|
|
13242
|
+
// 10k-row maps to ~300 rows before they started (load round
|
|
13243
|
+
// 44282760713, stream js-10k).
|
|
13244
|
+
getEventLoopLagMs: this.resourceGovernor.eventLoopLagSinceNow(),
|
|
12797
13245
|
callSlotBacklog: () =>
|
|
12798
13246
|
this.resourceGovernor.externalExecutionBacklog?.() ?? null,
|
|
12799
13247
|
onMemoryPressure: releaseCommittedRowsForMemoryPressure,
|
|
@@ -13927,6 +14375,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
13927
14375
|
value: true,
|
|
13928
14376
|
enumerable: false,
|
|
13929
14377
|
});
|
|
14378
|
+
Object.defineProperty(definition, STEP_PROGRAM_MAP_SOURCE, {
|
|
14379
|
+
value: program,
|
|
14380
|
+
enumerable: false,
|
|
14381
|
+
});
|
|
13930
14382
|
return definition;
|
|
13931
14383
|
}
|
|
13932
14384
|
|
|
@@ -18259,6 +18711,52 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
18259
18711
|
}
|
|
18260
18712
|
}
|
|
18261
18713
|
|
|
18714
|
+
/**
|
|
18715
|
+
* A ctx.fetch that ended on a timeout or abort writes one runtime
|
|
18716
|
+
* `tool_call_failed` record, like a failed tool call, so it reaches
|
|
18717
|
+
* `play.call.finished`. It says whose deadline ended it and where the time
|
|
18718
|
+
* went: queued inside Deepline or in flight. Other failures are unchanged.
|
|
18719
|
+
*/
|
|
18720
|
+
private observeCtxFetchEnded(input: {
|
|
18721
|
+
error: unknown;
|
|
18722
|
+
callerDeadline: CtxFetchCallerDeadline;
|
|
18723
|
+
key: string;
|
|
18724
|
+
}): void {
|
|
18725
|
+
// An ambiguous write keeps the timeout that ended it as its cause.
|
|
18726
|
+
const platformTimeout =
|
|
18727
|
+
input.error instanceof PlayHttpTimeoutError ||
|
|
18728
|
+
(input.error instanceof Error &&
|
|
18729
|
+
input.error.cause instanceof PlayHttpTimeoutError);
|
|
18730
|
+
const abortKind =
|
|
18731
|
+
input.callerDeadline.abortKind ??
|
|
18732
|
+
(platformTimeout ? 'platform_timeout' : null);
|
|
18733
|
+
if (!abortKind) return;
|
|
18734
|
+
const split = input.callerDeadline.timeSplit();
|
|
18735
|
+
const row = rowContext.getStore();
|
|
18736
|
+
this.runtimeLog(
|
|
18737
|
+
JSON.stringify({
|
|
18738
|
+
event: 'tool_call_failed',
|
|
18739
|
+
run_id: this.currentRunId,
|
|
18740
|
+
...(row?.tableNamespace ? { dataset: row.tableNamespace } : {}),
|
|
18741
|
+
...(row?.fieldName ? { column: row.fieldName } : {}),
|
|
18742
|
+
call_key: input.key,
|
|
18743
|
+
tool: 'ctx.fetch',
|
|
18744
|
+
provider: CTX_FETCH_EGRESS_PROVIDER,
|
|
18745
|
+
status: 'failed',
|
|
18746
|
+
duration_ms: split.queuedMs + split.inFlightMs,
|
|
18747
|
+
abort_kind: abortKind,
|
|
18748
|
+
ended_phase: split.phase,
|
|
18749
|
+
queued_ms: split.queuedMs,
|
|
18750
|
+
in_flight_ms: split.inFlightMs,
|
|
18751
|
+
sends: split.sends,
|
|
18752
|
+
retries: split.retries,
|
|
18753
|
+
...(split.sends > 0 ? {} : { last_error_dispatched: false }),
|
|
18754
|
+
...toolCallFailureLogFields(input.error),
|
|
18755
|
+
}),
|
|
18756
|
+
{ level: 'warn' },
|
|
18757
|
+
);
|
|
18758
|
+
}
|
|
18759
|
+
|
|
18262
18760
|
private logCtxFetchHttpFailure(input: {
|
|
18263
18761
|
key: string;
|
|
18264
18762
|
method: string;
|
|
@@ -18990,6 +19488,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
18990
19488
|
// the requested auth header, and that transport must be TLS.
|
|
18991
19489
|
assertSecretAuthUsesTls(secretAuth, input, 'ctx.fetch');
|
|
18992
19490
|
const secretHeaderMarkers = secretAuthHeaderMarkers(secretAuth);
|
|
19491
|
+
// A signal that has already aborted fails the call before any receipt or
|
|
19492
|
+
// checkpoint reuse, as fetch does.
|
|
19493
|
+
init.signal?.throwIfAborted();
|
|
19494
|
+
// Time this request waits inside Deepline does not spend a caller's
|
|
19495
|
+
// AbortSignal.timeout budget; an explicit abort still cancels the request.
|
|
19496
|
+
const callerDeadline = new CtxFetchCallerDeadline(init.signal);
|
|
18993
19497
|
|
|
18994
19498
|
const execution = this.executeWithRuntimeReceipt<PlayFetchResponse>(
|
|
18995
19499
|
'fetch',
|
|
@@ -19059,7 +19563,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19059
19563
|
headers,
|
|
19060
19564
|
Object.keys(secretHeaderMarkers),
|
|
19061
19565
|
);
|
|
19062
|
-
const fetchInit = {
|
|
19566
|
+
const fetchInit = {
|
|
19567
|
+
...init,
|
|
19568
|
+
headers,
|
|
19569
|
+
...(callerDeadline.signal ? { signal: callerDeadline.signal } : {}),
|
|
19570
|
+
};
|
|
19063
19571
|
delete fetchInit.auth;
|
|
19064
19572
|
const boundaryId = this.durableBoundaryId(
|
|
19065
19573
|
`fetch-${stableDigest(
|
|
@@ -19128,6 +19636,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19128
19636
|
orgId: this.#options.orgId ?? null,
|
|
19129
19637
|
providerResourceKey: CTX_FETCH_EGRESS_TOOL_ID,
|
|
19130
19638
|
toolId: CTX_FETCH_EGRESS_TOOL_ID,
|
|
19639
|
+
...(callerDeadline.signal ? { signal: callerDeadline.signal } : {}),
|
|
19131
19640
|
});
|
|
19132
19641
|
retainExternalCallSlot(() => egressSlot.release());
|
|
19133
19642
|
const finishFetchObservation =
|
|
@@ -19146,6 +19655,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19146
19655
|
log: (message) => this.runtimeLog(message),
|
|
19147
19656
|
reportAmbiguousWrite:
|
|
19148
19657
|
this.usesExplicitFreshness && !reusableReadMethod,
|
|
19658
|
+
queueClock: callerDeadline,
|
|
19149
19659
|
});
|
|
19150
19660
|
const rawJson = parseJsonOrNull(bodyText);
|
|
19151
19661
|
const output: PlayFetchResponse =
|
|
@@ -19209,7 +19719,18 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
19209
19719
|
},
|
|
19210
19720
|
},
|
|
19211
19721
|
);
|
|
19212
|
-
|
|
19722
|
+
try {
|
|
19723
|
+
return await execution;
|
|
19724
|
+
} catch (error) {
|
|
19725
|
+
this.observeCtxFetchEnded({
|
|
19726
|
+
error,
|
|
19727
|
+
callerDeadline,
|
|
19728
|
+
key: normalizedKey,
|
|
19729
|
+
});
|
|
19730
|
+
throw error;
|
|
19731
|
+
} finally {
|
|
19732
|
+
callerDeadline.dispose();
|
|
19733
|
+
}
|
|
19213
19734
|
}
|
|
19214
19735
|
|
|
19215
19736
|
async step<T>(
|
|
@@ -22619,6 +23140,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
22619
23140
|
offset: options.customerDbDataset.offset,
|
|
22620
23141
|
page_size: options.customerDbDataset.pageSize,
|
|
22621
23142
|
total_rows: options.customerDbDataset.totalRows,
|
|
23143
|
+
...(options.customerDbDataset.resultRef
|
|
23144
|
+
? { result_ref: options.customerDbDataset.resultRef }
|
|
23145
|
+
: {}),
|
|
22622
23146
|
},
|
|
22623
23147
|
...(isCustomerDbDatasetTool(toolId)
|
|
22624
23148
|
? {
|
|
@@ -24511,6 +25035,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
24511
25035
|
Boolean(asyncExecutionRecovery),
|
|
24512
25036
|
executionFenced: usesDurableInvocationFence,
|
|
24513
25037
|
providerServerErrorReplay,
|
|
25038
|
+
errorCodeHeader: response.headers.get(
|
|
25039
|
+
'x-deepline-error-code',
|
|
25040
|
+
),
|
|
24514
25041
|
});
|
|
24515
25042
|
const failure =
|
|
24516
25043
|
preclassifiedHttpFailure.current?.failure ??
|
|
@@ -24521,6 +25048,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
24521
25048
|
bodyText: text,
|
|
24522
25049
|
schemaVersion: toolErrorSchemaVersion,
|
|
24523
25050
|
retryAfterHeader: response.headers.get('retry-after'),
|
|
25051
|
+
errorCodeHeader: response.headers.get(
|
|
25052
|
+
'x-deepline-error-code',
|
|
25053
|
+
),
|
|
24524
25054
|
retryAtMs: parseToolExecuteExactProviderRetryAtMs(response),
|
|
24525
25055
|
transientHttpRetrySafe:
|
|
24526
25056
|
retrySafeTransientHttp ||
|
|
@@ -24585,7 +25115,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
24585
25115
|
failure.reason === 'provider_pacing_wait' ||
|
|
24586
25116
|
failure.reason === 'runtime_scheduler_capacity' ||
|
|
24587
25117
|
failure.reason === 'billing_unavailable_before_dispatch' ||
|
|
24588
|
-
failure.reason === '
|
|
25118
|
+
failure.reason === 'runtime_jwks_unavailable' ||
|
|
25119
|
+
failure.reason === 'account_access_unavailable' ||
|
|
25120
|
+
failure.reason === 'gateway_invocation_in_progress' ||
|
|
25121
|
+
// A Deepline limiter (a workspace's people-search rate, say)
|
|
25122
|
+
// refused before dispatch: the provider received nothing, so
|
|
25123
|
+
// it is not a send `retry.maximumAttempts` counts.
|
|
25124
|
+
(failure.reason === 'rate_limit' && failure.knownNotDispatched);
|
|
24589
25125
|
if (!preDispatchRefusal) providerSendsThisBurst += 1;
|
|
24590
25126
|
// The call's own `retry` may end this call's in-call retries: a
|
|
24591
25127
|
// `nonRetryable` class, or `maximumAttempts` reached by every
|
|
@@ -24706,11 +25242,17 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
24706
25242
|
// of the same attempt may have a row, so the attempt must not move.
|
|
24707
25243
|
// A billing-plane refusal is the same: the charge for this
|
|
24708
25244
|
// request identity may already be open, and the resend keeps both.
|
|
25245
|
+
// A gateway that could not fetch its signing keys refused before
|
|
25246
|
+
// any provider request and holds no invocation for this attempt.
|
|
25247
|
+
// An app account-access refusal ran before any route, and a
|
|
25248
|
+
// fenced gateway releases its claim as not dispatched.
|
|
24709
25249
|
const shedKnownNotDispatched =
|
|
24710
25250
|
failure.reason === 'concurrency_backpressure' ||
|
|
24711
25251
|
failure.reason === 'provider_pacing_wait' ||
|
|
24712
25252
|
failure.reason === 'runtime_scheduler_capacity' ||
|
|
24713
|
-
failure.reason === 'billing_unavailable_before_dispatch'
|
|
25253
|
+
failure.reason === 'billing_unavailable_before_dispatch' ||
|
|
25254
|
+
failure.reason === 'runtime_jwks_unavailable' ||
|
|
25255
|
+
failure.reason === 'account_access_unavailable';
|
|
24714
25256
|
if (
|
|
24715
25257
|
failure.shouldRetry &&
|
|
24716
25258
|
!stopInCallRetry &&
|