deepline 0.3.461 → 0.3.463
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 +7593 -0
- package/dist/bundling-sources/sdk/src/client.ts +8 -7366
- package/dist/bundling-sources/sdk/src/http-core.ts +1239 -0
- package/dist/bundling-sources/sdk/src/http.ts +6 -1231
- package/dist/bundling-sources/sdk/src/index.ts +4 -1
- package/dist/bundling-sources/sdk/src/play.ts +5 -5
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +437 -0
- package/dist/bundling-sources/sdk/src/plays/client.ts +4 -421
- package/dist/bundling-sources/sdk/src/plays/input-example.ts +3 -4
- package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -1
- 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/server.ts +43 -0
- package/dist/bundling-sources/sdk/src/types.ts +15 -5
- package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +15 -0
- package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +17 -17
- package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -307
- package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +3 -0
- package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +3 -2
- package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +34 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +61 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +122 -2
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +11 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-failure-codes.ts +24 -0
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +32 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +57 -3
- package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +36 -7
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +250 -11
- package/dist/bundling-sources/shared_libs/play-runtime/array-input-store.ts +319 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +991 -359
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +110 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +155 -6
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +110 -6
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -13
- package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +14 -1
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +57 -1
- package/dist/bundling-sources/shared_libs/play-runtime/free-company-lookup-batching.ts +218 -0
- package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +42 -5
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +92 -31
- package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +69 -14
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +93 -23
- package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +15 -4
- package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +22 -18
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +190 -14
- package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +131 -0
- package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +77 -2
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +271 -2
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +51 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +27 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-text-for-log.ts +63 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +112 -16
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +104 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +265 -151
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +35 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-labels.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +136 -70
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +237 -36
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +148 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +285 -32
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +251 -56
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +29 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/sandbox-create-outcome.ts +27 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +22 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1397 -382
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-array-input-receipts.ts +920 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +38 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +14 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +31 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +20 -7
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1496 -320
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +31 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1389 -129
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +162 -23
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +499 -115
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +377 -9
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +117 -8
- package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/terminal-runtime-performance.ts +391 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +40 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/mapped-calls.ts +171 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +16 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +38 -12
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +33 -9
- package/dist/bundling-sources/shared_libs/play-runtime/transport-error-diagnostics.ts +28 -0
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +55 -5
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +41 -1
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +9 -3
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest-contract.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +3 -2
- package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +2 -2
- package/dist/bundling-sources/shared_libs/plays/run-output-summary.ts +66 -0
- package/dist/bundling-sources/shared_libs/plays/script-entry.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +43 -1
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +9 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +91 -13
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +3 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +41 -24
- package/dist/bundling-sources/shared_libs/security/attested-client-ip.ts +91 -0
- package/dist/bundling-sources/shared_libs/security/internal-actor.ts +0 -11
- package/dist/cli/{auth-6HJXNWUG.mjs → auth-LZLBR4C3.mjs} +5 -4
- package/dist/cli/auth-XPGKBJKB.js +41 -0
- package/dist/cli/{billing-6P5HO6QG.js → billing-6TJPNJQD.js} +152 -78
- package/dist/cli/{billing-MJ42N7YF.mjs → billing-OTOP5RE4.mjs} +84 -10
- package/dist/cli/{chunk-FCAZQ7WV.js → chunk-2NISBXMN.js} +52 -50
- package/dist/cli/{chunk-PNATXKLP.js → chunk-2ZIRCBYG.js} +6 -6
- package/dist/cli/{chunk-5FDKJQZE.js → chunk-3BOIOCNX.js} +1 -1
- package/dist/cli/chunk-3BVLLJ3H.mjs +1038 -0
- package/dist/cli/{chunk-FJZILBL7.mjs → chunk-3U5EAP6E.mjs} +5 -5
- package/dist/cli/{describe-FRAVCY5F.mjs → chunk-4YZKBBLZ.mjs} +19 -36
- package/dist/cli/{chunk-QWRHGGUH.js → chunk-5DRNNC72.js} +20 -2
- package/dist/cli/{chunk-Z2GUFYT6.js → chunk-5LEAXRHV.js} +11 -11
- package/dist/cli/{chunk-5MDIZX7M.js → chunk-5LHXOIPT.js} +8 -6
- package/dist/cli/{chunk-NMJ4D2WO.js → chunk-6PMCRYDA.js} +216 -91
- package/dist/cli/{chunk-EBU7LQ64.js → chunk-6V7KVRR5.js} +3 -3
- package/dist/cli/{chunk-MGXEUZHL.mjs → chunk-7D6X7IXW.mjs} +7 -5
- package/dist/cli/{chunk-SAZFZQRI.js → chunk-7FCYPAPP.js} +2 -2
- package/dist/cli/{chunk-ACCR7POB.js → chunk-7XYDDCQ2.js} +27 -27
- package/dist/cli/{chunk-5IYOUBFZ.js → chunk-ALZBANZI.js} +28 -54
- package/dist/cli/{chunk-3DNKFH2G.mjs → chunk-BAPTQDLF.mjs} +19 -1
- package/dist/cli/chunk-BGNWI3KH.js +827 -0
- package/dist/cli/{chunk-V7REJRDZ.mjs → chunk-C25QE4CH.mjs} +1 -1
- package/dist/cli/{chunk-FGMX4HUZ.js → chunk-CBZP6J3V.js} +29 -27
- package/dist/cli/{chunk-QEYHTIV4.mjs → chunk-CTQ56DXP.mjs} +10 -1
- package/dist/cli/{chunk-IHHLTHE7.mjs → chunk-CVQ7N5CV.mjs} +267 -38
- package/dist/cli/{chunk-7DH2FD7Y.mjs → chunk-D464JW3N.mjs} +5 -85
- package/dist/cli/{chunk-MEAIOXJL.mjs → chunk-DHXCBITQ.mjs} +7 -5
- package/dist/cli/chunk-F2RHUPVH.mjs +827 -0
- package/dist/cli/chunk-F6QV42MC.mjs +91 -0
- package/dist/cli/{chunk-OZBWRICM.js → chunk-FK2HNDCN.js} +2 -2
- package/dist/cli/{chunk-BGY2PLP7.mjs → chunk-GUT7CLOL.mjs} +23 -49
- package/dist/cli/{chunk-RY4IVOU3.mjs → chunk-I624J4H5.mjs} +16 -806
- package/dist/cli/{chunk-Z2XUZC34.js → chunk-IAYSWZDJ.js} +188 -76
- package/dist/cli/{chunk-FGLKOWSC.mjs → chunk-IKWRUNAP.mjs} +1 -1
- package/dist/cli/{chunk-KCCOQ5G5.js → chunk-JVDKZJUH.js} +511 -282
- package/dist/cli/{chunk-HDFRJ4IT.mjs → chunk-JVHOS3K3.mjs} +177 -65
- package/dist/cli/chunk-LYFKBLJI.mjs +1039 -0
- package/dist/cli/{chunk-SLEUWLJE.mjs → chunk-MSY22NQW.mjs} +5 -5
- package/dist/cli/{chunk-5FY72YOV.js → chunk-NAPTMYTY.js} +8 -8
- package/dist/cli/{chunk-O6QOMHCH.js → chunk-NDHJR2WZ.js} +37 -35
- package/dist/cli/{chunk-KXMNM4AQ.js → chunk-NMU3VR5U.js} +4 -5
- package/dist/cli/chunk-NTLI6P6Y.mjs +19 -0
- package/dist/cli/{chunk-RFONC4WJ.mjs → chunk-O3BJYD6D.mjs} +3 -3
- package/dist/cli/{describe-2WQY7ZCY.js → chunk-PVY4DPPF.js} +27 -44
- package/dist/cli/{chunk-WIYWSYDS.mjs → chunk-Q2EIZKVX.mjs} +3 -3
- package/dist/cli/{chunk-VZBCEA5S.mjs → chunk-RD6IQ2JY.mjs} +223 -92
- package/dist/cli/chunk-RGOUCIIZ.js +1039 -0
- package/dist/cli/{chunk-EIMG75BT.mjs → chunk-S3A4IXBQ.mjs} +4 -5
- package/dist/cli/{chunk-QIW7TVV6.mjs → chunk-S4XQCFES.mjs} +14 -12
- package/dist/cli/chunk-SKU6ECIY.js +19 -0
- package/dist/cli/{chunk-CRYOUPEB.js → chunk-TIRBDQ3W.js} +16 -16
- package/dist/cli/{chunk-G7L27KZB.mjs → chunk-TKAQR3IB.mjs} +31 -21
- package/dist/cli/{chunk-MDJPEGVN.js → chunk-UC4SFYNU.js} +392 -261
- package/dist/cli/{chunk-3BMLICF7.mjs → chunk-UIURR26V.mjs} +13 -8
- package/dist/cli/{chunk-TNMBPMMC.js → chunk-UROQDCVW.js} +13 -4
- package/dist/cli/{chunk-R64BGGRQ.mjs → chunk-VDGTTH7K.mjs} +2 -2
- package/dist/cli/chunk-VLEVVDWG.js +91 -0
- package/dist/cli/{chunk-R2GLGLDR.mjs → chunk-VPHN2HAL.mjs} +216 -91
- package/dist/cli/chunk-VY2GBNTX.js +1038 -0
- package/dist/cli/{chunk-CFUTOWE4.js → chunk-WG3KGAII.js} +8 -88
- package/dist/cli/{chunk-QAJAJPKK.mjs → chunk-WUMIYOXQ.mjs} +4 -2
- package/dist/cli/{chunk-SCIR5JXW.js → chunk-WUZS2HK6.js} +56 -51
- package/dist/cli/{chunk-T3MVIPHG.mjs → chunk-XDWS2JJT.mjs} +1 -1
- package/dist/cli/{chunk-KGQNIA37.js → chunk-XQCTG5OO.js} +44 -34
- package/dist/cli/{chunk-KVJ5VHW5.mjs → chunk-XW2JIYG7.mjs} +2 -2
- package/dist/cli/chunk-YGGIZ3VT.js +920 -0
- package/dist/cli/command-docs.d.mts +5 -0
- package/dist/cli/command-docs.d.ts +5 -0
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-NX7NO3O6.js → csv-EH5QWR4O.js} +13 -12
- package/dist/cli/{csv-DQ6GW5B5.mjs → csv-OK45Z5XQ.mjs} +4 -3
- package/dist/cli/{db-R72DFMP6.js → db-3ESJKETS.js} +30 -27
- package/dist/cli/{db-2YP33M4K.mjs → db-6Z5E4HKN.mjs} +10 -7
- package/dist/cli/describe-PNDQB7YS.mjs +48 -0
- package/dist/cli/describe-QUF7VTTR.js +48 -0
- package/dist/cli/describe-core.d.mts +153 -5
- package/dist/cli/describe-core.d.ts +153 -5
- package/dist/cli/describe-core.js +9 -5
- package/dist/cli/describe-core.mjs +10 -6
- package/dist/cli/{executions-WFBU7L2Q.mjs → executions-2NTWQFEG.mjs} +7 -5
- package/dist/cli/{executions-ZLHD4QIT.js → executions-KUOBRX5V.js} +9 -7
- package/dist/cli/{feedback-CN3HJFVF.mjs → feedback-7RPRMSGY.mjs} +6 -5
- package/dist/cli/{feedback-NDV6TPHG.js → feedback-UPHAZJ4C.js} +10 -9
- package/dist/cli/getting-started.d.mts +6 -6
- package/dist/cli/getting-started.d.ts +6 -6
- package/dist/cli/getting-started.js +2 -2
- package/dist/cli/getting-started.mjs +1 -1
- package/dist/cli/{git-QAD6E3HW.mjs → git-SCYP6WSZ.mjs} +5 -4
- package/dist/cli/git-UH653WHV.js +25 -0
- package/dist/cli/index.js +152 -142
- package/dist/cli/index.mjs +56 -46
- package/dist/cli/{legacy-noops-KVC5QJ74.js → legacy-noops-7XMFCVRG.js} +8 -7
- package/dist/cli/{legacy-noops-TPTKNBI2.mjs → legacy-noops-A4KYAGI6.mjs} +5 -4
- package/dist/cli/{monitors-SV57JFLO.mjs → monitors-FLC5J7RI.mjs} +19 -6
- package/dist/cli/{monitors-KCROV6PJ.js → monitors-NZV6IX5H.js} +103 -90
- package/dist/cli/{org-NJYX5743.js → org-IZ7UP3XF.js} +70 -67
- package/dist/cli/{org-KX6QIR7A.mjs → org-LUETJ7Z5.mjs} +9 -6
- package/dist/cli/pages-22ML3O7O.js +252 -0
- package/dist/cli/pages-EUX5EAGF.mjs +252 -0
- package/dist/cli/{play-IQQ57L7Z.mjs → play-CDHPAKKM.mjs} +512 -1508
- package/dist/cli/{play-32L7EQN4.js → play-USJBQADG.js} +1090 -2086
- package/dist/cli/{providers-4WEC2EQN.mjs → providers-CCXZ3SQF.mjs} +7 -5
- package/dist/cli/{providers-ZQV6QLVQ.js → providers-WFEUNPGC.js} +10 -8
- package/dist/cli/{quickstart-HKUSFADF.js → quickstart-O4JSUORZ.js} +13 -12
- package/dist/cli/{quickstart-RQ76RIUE.mjs → quickstart-ZUULI635.mjs} +5 -4
- package/dist/cli/run-ISDJYJMU.js +443 -0
- package/dist/cli/run-QJ4NX5F5.mjs +443 -0
- package/dist/cli/{search-ZRAVFBZC.mjs → search-IX3XKZJ3.mjs} +8 -6
- package/dist/cli/search-TIFNLRPM.js +32 -0
- package/dist/cli/{secrets-CMJOVNVH.mjs → secrets-7VUDXTUZ.mjs} +7 -5
- package/dist/cli/{secrets-J3G5Y43U.js → secrets-ELQSNCTR.js} +16 -14
- package/dist/cli/{sessions-WY7VN4AE.js → sessions-A3FG3AZX.js} +6 -5
- package/dist/cli/{sessions-MDQYY5CB.mjs → sessions-VOIQ62GB.mjs} +5 -4
- package/dist/cli/{settings-4RWZPCT5.mjs → settings-S6N6EFBG.mjs} +14 -11
- package/dist/cli/{settings-HTNTFKCE.js → settings-ZTXQEMZI.js} +80 -77
- package/dist/cli/{setup-P3GYYZWG.mjs → setup-AYPIK4JE.mjs} +12 -10
- package/dist/cli/{setup-QGCAP62X.js → setup-Y3WOIFLS.js} +53 -51
- package/dist/cli/{skills-7NAE4ICL.mjs → skills-5SF5QWNI.mjs} +7 -6
- package/dist/cli/skills-MWFRMG3H.js +31 -0
- package/dist/cli/tools-3XNZ4J64.mjs +55 -0
- package/dist/cli/tools-XEC4OD3R.js +55 -0
- package/dist/cli/{update-GODLRKNB.mjs → update-3U4OVX5R.mjs} +9 -8
- package/dist/cli/update-DWYEYTZE.js +33 -0
- package/dist/cli/{workflow-4BXOUVEO.mjs → workflow-2M5JP7SA.mjs} +10 -8
- package/dist/cli/{workflow-AO3A6LXN.js → workflow-RM7H7555.js} +20 -18
- package/dist/client-DS2IWYZF.d.ts +10 -0
- package/dist/client-DTwnz_AW.d.mts +10 -0
- package/dist/{client-CYqG23K1.d.ts → client-core-B_6HAIBy.d.ts} +385 -12
- package/dist/{client-BbU5_j7n.d.mts → client-core-DzBSlY1U.d.mts} +385 -12
- package/dist/{compiler-manifest-CWz_sNOQ.d.ts → compiler-manifest-Dcyd3-Zd.d.mts} +43 -1
- package/dist/{compiler-manifest-CWz_sNOQ.d.mts → compiler-manifest-Dcyd3-Zd.d.ts} +43 -1
- package/dist/errors-d-sTrZhe.d.mts +142 -0
- package/dist/errors-yQwfgrcX.d.ts +142 -0
- package/dist/{index-BF2JB_Ug.d.mts → index-C6oXchjN.d.mts} +1 -1
- package/dist/{index-4NPXDzlD.d.ts → index-P56zy_z5.d.ts} +1 -1
- package/dist/index.d.mts +11 -147
- package/dist/index.d.ts +11 -147
- package/dist/index.js +16 -12
- package/dist/index.mjs +15 -11
- package/dist/install-integrity.json +141 -104
- 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 +2 -1
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/play-description.js +2 -2
- package/dist/plays/play-description.mjs +1 -1
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- 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 +17 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.js +76 -0
- package/dist/server.mjs +76 -0
- package/package.json +6 -1
- package/dist/cli/auth-IACERYQH.js +0 -40
- package/dist/cli/chunk-PQUUWFXY.js +0 -95
- package/dist/cli/chunk-YBWAG72P.mjs +0 -95
- package/dist/cli/chunk-YQDUODZW.js +0 -1710
- package/dist/cli/git-JVI36ZFV.js +0 -24
- package/dist/cli/search-75X5LTDE.js +0 -30
- package/dist/cli/skills-BKJ53JOQ.js +0 -30
- package/dist/cli/tools-COWMIEJ6.mjs +0 -45
- package/dist/cli/tools-TASOCE7I.js +0 -45
- package/dist/cli/update-SJIKVME6.js +0 -32
|
@@ -365,6 +365,7 @@ type RuntimeApiRequest =
|
|
|
365
365
|
action: 'governor_budget_charge';
|
|
366
366
|
} & PlayRunnerBudgetChargeInput)
|
|
367
367
|
| { action: 'get_billing_entitlements' }
|
|
368
|
+
| ({ action: 'write_page' } & PlayPageWriteRequest)
|
|
368
369
|
| { action: 'get_runtime_traffic_policy' }
|
|
369
370
|
| RuntimeReceiptAction;
|
|
370
371
|
|
|
@@ -383,6 +384,13 @@ export type WorkerRuntimeApiContext = {
|
|
|
383
384
|
requestTimeoutMs?: number | null;
|
|
384
385
|
/** A higher-level writer owns retries and preserves the exact request body. */
|
|
385
386
|
retryPolicy?: 'default' | 'none';
|
|
387
|
+
/**
|
|
388
|
+
* Opt-in for a sandbox runner, whose network can be cut for minutes while
|
|
389
|
+
* its process keeps running. When a retryable action's ordinary attempts
|
|
390
|
+
* all get no response, keep sending it until this long after the first
|
|
391
|
+
* attempt. An error response never extends the retries.
|
|
392
|
+
*/
|
|
393
|
+
connectionRetryBudgetMs?: number;
|
|
386
394
|
/**
|
|
387
395
|
* Observe the gateway request identity of a SUCCESSFUL response. Failures
|
|
388
396
|
* already carry it on the thrown error; a success carried it nowhere, so a
|
|
@@ -570,6 +578,11 @@ export function parseRuntimeGatewayServerTiming(
|
|
|
570
578
|
}
|
|
571
579
|
|
|
572
580
|
const APP_RUNTIME_API_RETRY_DELAYS_MS = [100, 250, 500, 1_000] as const;
|
|
581
|
+
// Vercel Function ingress rejects request bodies above 4.5 MB. Keep normal
|
|
582
|
+
// map update requests well below it and leave room for a single large row.
|
|
583
|
+
const APP_RUNTIME_ROW_UPDATE_BATCH_TARGET_BYTES = 3 * 1024 * 1024;
|
|
584
|
+
const APP_RUNTIME_ROW_UPDATE_REQUEST_MAX_BYTES = 4_450_000;
|
|
585
|
+
const APP_RUNTIME_JSON_ENCODER = new TextEncoder();
|
|
573
586
|
const APP_RUNTIME_API_RECEIPT_RETRY_DELAYS_MS = [
|
|
574
587
|
250, 500, 1_000, 2_000, 4_000, 8_000, 12_000,
|
|
575
588
|
] as const;
|
|
@@ -1277,6 +1290,8 @@ function emitAppRuntimeRetrySummary(input: {
|
|
|
1277
1290
|
async function retryAppRuntimeBodyTimeoutOrThrow(input: {
|
|
1278
1291
|
action: RuntimeApiRequest['action'];
|
|
1279
1292
|
attempt: number;
|
|
1293
|
+
/** Position on the error-response ladder; decides the retry and its delay. */
|
|
1294
|
+
ladderAttempt: number;
|
|
1280
1295
|
transportAttemptId: string;
|
|
1281
1296
|
maxAttempts: number;
|
|
1282
1297
|
error: unknown;
|
|
@@ -1285,6 +1300,7 @@ async function retryAppRuntimeBodyTimeoutOrThrow(input: {
|
|
|
1285
1300
|
httpStatus?: number;
|
|
1286
1301
|
retryAfterMs?: number | null;
|
|
1287
1302
|
boundaryLabel: string;
|
|
1303
|
+
signal?: AbortSignal;
|
|
1288
1304
|
}): Promise<void> {
|
|
1289
1305
|
if (!isRequestTimeoutAbort(input.error)) {
|
|
1290
1306
|
recordAppRuntimeRetryFailure({
|
|
@@ -1307,14 +1323,14 @@ async function retryAppRuntimeBodyTimeoutOrThrow(input: {
|
|
|
1307
1323
|
throw input.error;
|
|
1308
1324
|
}
|
|
1309
1325
|
if (
|
|
1310
|
-
input.
|
|
1326
|
+
input.ladderAttempt < input.maxAttempts &&
|
|
1311
1327
|
isRetryableAppRuntimeFetchError({
|
|
1312
1328
|
action: input.action,
|
|
1313
1329
|
error: input.error,
|
|
1314
1330
|
})
|
|
1315
1331
|
) {
|
|
1316
1332
|
const retryDelayMs = appRuntimeRetrySleepMs(
|
|
1317
|
-
appRuntimeRetryDelayMs(input.action, input.
|
|
1333
|
+
appRuntimeRetryDelayMs(input.action, input.ladderAttempt),
|
|
1318
1334
|
input.retryAfterMs,
|
|
1319
1335
|
);
|
|
1320
1336
|
recordAppRuntimeRetryFailure({
|
|
@@ -1326,7 +1342,7 @@ async function retryAppRuntimeBodyTimeoutOrThrow(input: {
|
|
|
1326
1342
|
retryDelayMs,
|
|
1327
1343
|
httpStatus: input.httpStatus,
|
|
1328
1344
|
});
|
|
1329
|
-
await
|
|
1345
|
+
await sleepUnlessAborted(retryDelayMs, input.signal);
|
|
1330
1346
|
return;
|
|
1331
1347
|
}
|
|
1332
1348
|
recordAppRuntimeRetryFailure({
|
|
@@ -1512,14 +1528,111 @@ export function isAppRuntimeApiCapacityError(
|
|
|
1512
1528
|
);
|
|
1513
1529
|
}
|
|
1514
1530
|
|
|
1531
|
+
const CAPACITY_SHED_DEFAULT_RETRY_AFTER_MS = 1_000;
|
|
1532
|
+
|
|
1533
|
+
/**
|
|
1534
|
+
* How long a working store asked the caller to wait, or null when `error` is
|
|
1535
|
+
* not a load shed. A shed proves only that this one delivery did not run, so a
|
|
1536
|
+
* caller re-sending the work needs its own idempotency.
|
|
1537
|
+
*/
|
|
1538
|
+
export function capacityShedRetryAfterMs(error: unknown): number | null {
|
|
1539
|
+
const shed =
|
|
1540
|
+
isAppRuntimeApiCapacityError(error) ||
|
|
1541
|
+
(error instanceof AppRuntimeApiResponseError &&
|
|
1542
|
+
error.retryable &&
|
|
1543
|
+
error.status === 429);
|
|
1544
|
+
if (!shed) return null;
|
|
1545
|
+
const retryAfterMs = (error as AppRuntimeApiResponseError).retryAfterMs;
|
|
1546
|
+
return retryAfterMs && retryAfterMs > 0
|
|
1547
|
+
? retryAfterMs
|
|
1548
|
+
: CAPACITY_SHED_DEFAULT_RETRY_AFTER_MS;
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1515
1551
|
function resolveAppRuntimeApiUrl(context: WorkerRuntimeApiContext): string {
|
|
1516
1552
|
const baseUrl = context.baseUrl.trim().replace(/\/$/, '');
|
|
1517
1553
|
return `${baseUrl}${PLAY_RUNTIME_API_COMPAT_PATH}`;
|
|
1518
1554
|
}
|
|
1519
1555
|
|
|
1556
|
+
const APP_RUNTIME_CONNECTION_RETRY_MAX_DELAY_MS = 8_000;
|
|
1557
|
+
|
|
1520
1558
|
async function postAppRuntimeApi<TResponse>(
|
|
1521
1559
|
context: WorkerRuntimeApiContext,
|
|
1522
1560
|
body: RuntimeApiRequest,
|
|
1561
|
+
): Promise<TResponse> {
|
|
1562
|
+
const budgetMs =
|
|
1563
|
+
context.retryPolicy === 'none'
|
|
1564
|
+
? undefined
|
|
1565
|
+
: context.connectionRetryBudgetMs;
|
|
1566
|
+
if (!budgetMs || !isRetryableAppRuntimeAction(body.action)) {
|
|
1567
|
+
return await postAppRuntimeApiAttempts<TResponse>(context, body, null);
|
|
1568
|
+
}
|
|
1569
|
+
const startedAt = Date.now();
|
|
1570
|
+
// Shared by every round below, so error responses spend one attempt ladder
|
|
1571
|
+
// for the whole operation however the cut splits the rounds.
|
|
1572
|
+
const ladder: AppRuntimeResponseLadder = {
|
|
1573
|
+
respondedAttempts: 0,
|
|
1574
|
+
lastAttemptResponded: false,
|
|
1575
|
+
};
|
|
1576
|
+
for (let outageRetry = 1; ; outageRetry += 1) {
|
|
1577
|
+
try {
|
|
1578
|
+
return await postAppRuntimeApiAttempts<TResponse>(context, body, ladder);
|
|
1579
|
+
} catch (error) {
|
|
1580
|
+
if (
|
|
1581
|
+
!(error instanceof AppRuntimeApiTransportError) ||
|
|
1582
|
+
// A status line arrived, so the error-response ladder already decided.
|
|
1583
|
+
ladder.lastAttemptResponded ||
|
|
1584
|
+
!isRetryableAppRuntimeFetchError({
|
|
1585
|
+
action: body.action,
|
|
1586
|
+
error: error.cause,
|
|
1587
|
+
})
|
|
1588
|
+
) {
|
|
1589
|
+
throw error;
|
|
1590
|
+
}
|
|
1591
|
+
const delayMs = applyRetryJitter(
|
|
1592
|
+
Math.min(
|
|
1593
|
+
APP_RUNTIME_CONNECTION_RETRY_MAX_DELAY_MS,
|
|
1594
|
+
1_000 * outageRetry,
|
|
1595
|
+
),
|
|
1596
|
+
);
|
|
1597
|
+
if (Date.now() - startedAt + delayMs > budgetMs) throw error;
|
|
1598
|
+
await sleepUnlessAborted(delayMs, context.signal);
|
|
1599
|
+
}
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
function sleepUnlessAborted(ms: number, signal?: AbortSignal): Promise<void> {
|
|
1604
|
+
return new Promise((resolve, reject) => {
|
|
1605
|
+
if (signal?.aborted) {
|
|
1606
|
+
reject(signal.reason);
|
|
1607
|
+
return;
|
|
1608
|
+
}
|
|
1609
|
+
const onAbort = () => {
|
|
1610
|
+
clearTimeout(timer);
|
|
1611
|
+
reject(signal?.reason);
|
|
1612
|
+
};
|
|
1613
|
+
const timer = setTimeout(() => {
|
|
1614
|
+
signal?.removeEventListener('abort', onAbort);
|
|
1615
|
+
resolve();
|
|
1616
|
+
}, ms);
|
|
1617
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
1618
|
+
});
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* Attempts that got an HTTP response, counted across one operation. Present
|
|
1623
|
+
* only under a runner's connection retry budget: attempts that got no response
|
|
1624
|
+
* then never spend the ladder that error responses use.
|
|
1625
|
+
*/
|
|
1626
|
+
type AppRuntimeResponseLadder = {
|
|
1627
|
+
respondedAttempts: number;
|
|
1628
|
+
/** The latest attempt got a status line, even if its body then failed. */
|
|
1629
|
+
lastAttemptResponded: boolean;
|
|
1630
|
+
};
|
|
1631
|
+
|
|
1632
|
+
async function postAppRuntimeApiAttempts<TResponse>(
|
|
1633
|
+
context: WorkerRuntimeApiContext,
|
|
1634
|
+
body: RuntimeApiRequest,
|
|
1635
|
+
ladder: AppRuntimeResponseLadder | null,
|
|
1523
1636
|
): Promise<TResponse> {
|
|
1524
1637
|
const baseUrl = context.baseUrl.trim().replace(/\/$/, '');
|
|
1525
1638
|
const token = context.executorToken.trim();
|
|
@@ -1575,7 +1688,11 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1575
1688
|
// immediate plain-JSON resend even when the caller disabled normal retries.
|
|
1576
1689
|
// It does not consume an application retry attempt or sleep.
|
|
1577
1690
|
let attempt = 1;
|
|
1578
|
-
|
|
1691
|
+
// With a ladder, attempts that got no response do not spend it, so `attempt`
|
|
1692
|
+
// can pass `maxAttempts` while error responses still have retries left. The
|
|
1693
|
+
// loop still ends: a response retries only while the ladder has room, and a
|
|
1694
|
+
// failure with no response retries here only while `attempt < maxAttempts`.
|
|
1695
|
+
while (ladder !== null || attempt <= maxAttempts) {
|
|
1579
1696
|
// Re-evaluated per attempt rather than hoisted: the capability can be
|
|
1580
1697
|
// learned from THIS request's own first attempt (or from a sibling request
|
|
1581
1698
|
// that landed in between), so a retry compresses as soon as the origin has
|
|
@@ -1594,6 +1711,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1594
1711
|
// would show up as network cost that no round trip explains.
|
|
1595
1712
|
const attemptStartedAt = Date.now();
|
|
1596
1713
|
const transportAttemptId = randomUUID();
|
|
1714
|
+
if (ladder) ladder.lastAttemptResponded = false;
|
|
1597
1715
|
if (context.onRequestAttempt) {
|
|
1598
1716
|
try {
|
|
1599
1717
|
context.onRequestAttempt({ action: body.action, transportAttemptId });
|
|
@@ -1687,7 +1805,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1687
1805
|
attemptStartedAt,
|
|
1688
1806
|
retryDelayMs,
|
|
1689
1807
|
});
|
|
1690
|
-
await
|
|
1808
|
+
await sleepUnlessAborted(retryDelayMs, context.signal);
|
|
1691
1809
|
attempt += 1;
|
|
1692
1810
|
continue;
|
|
1693
1811
|
}
|
|
@@ -1715,6 +1833,13 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1715
1833
|
boundaryLabel,
|
|
1716
1834
|
});
|
|
1717
1835
|
}
|
|
1836
|
+
if (ladder) {
|
|
1837
|
+
ladder.respondedAttempts += 1;
|
|
1838
|
+
ladder.lastAttemptResponded = true;
|
|
1839
|
+
}
|
|
1840
|
+
// The position on the error-response ladder: every attempt, or under a
|
|
1841
|
+
// connection retry budget only the attempts that got a response.
|
|
1842
|
+
const ladderAttempt = ladder ? ladder.respondedAttempts : attempt;
|
|
1718
1843
|
// Learn the capability from EVERY response, including 4xx/5xx: an error
|
|
1719
1844
|
// response still proves the gateway that produced it can decode a
|
|
1720
1845
|
// compressed body, and a run whose first request fails must not be stuck
|
|
@@ -1784,6 +1909,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1784
1909
|
await retryAppRuntimeBodyTimeoutOrThrow({
|
|
1785
1910
|
action: body.action,
|
|
1786
1911
|
attempt,
|
|
1912
|
+
ladderAttempt,
|
|
1787
1913
|
transportAttemptId,
|
|
1788
1914
|
maxAttempts,
|
|
1789
1915
|
error,
|
|
@@ -1791,6 +1917,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1791
1917
|
attemptStartedAt,
|
|
1792
1918
|
httpStatus: response.status,
|
|
1793
1919
|
boundaryLabel,
|
|
1920
|
+
signal: context.signal,
|
|
1794
1921
|
});
|
|
1795
1922
|
attempt += 1;
|
|
1796
1923
|
continue;
|
|
@@ -1829,6 +1956,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1829
1956
|
await retryAppRuntimeBodyTimeoutOrThrow({
|
|
1830
1957
|
action: body.action,
|
|
1831
1958
|
attempt,
|
|
1959
|
+
ladderAttempt,
|
|
1832
1960
|
transportAttemptId,
|
|
1833
1961
|
maxAttempts,
|
|
1834
1962
|
error,
|
|
@@ -1837,6 +1965,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1837
1965
|
httpStatus: response.status,
|
|
1838
1966
|
retryAfterMs: appRuntimeRetryAfterMs(response, ''),
|
|
1839
1967
|
boundaryLabel,
|
|
1968
|
+
signal: context.signal,
|
|
1840
1969
|
});
|
|
1841
1970
|
attempt += 1;
|
|
1842
1971
|
continue;
|
|
@@ -1855,6 +1984,8 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1855
1984
|
revokeRuntimeApiCompressionCapability(baseUrl);
|
|
1856
1985
|
forceUncompressedNextAttempt = true;
|
|
1857
1986
|
usedLegacyDecoderFallback = true;
|
|
1987
|
+
// Nothing was dispatched, so the resend spends no ladder step either.
|
|
1988
|
+
if (ladder) ladder.respondedAttempts -= 1;
|
|
1858
1989
|
continue;
|
|
1859
1990
|
}
|
|
1860
1991
|
const responseCode = appRuntimeErrorCode(response, responseText);
|
|
@@ -1873,7 +2004,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1873
2004
|
});
|
|
1874
2005
|
}
|
|
1875
2006
|
if (
|
|
1876
|
-
|
|
2007
|
+
ladderAttempt < maxAttempts &&
|
|
1877
2008
|
isRetryableAppRuntimeResponse({
|
|
1878
2009
|
action: body.action,
|
|
1879
2010
|
status: response.status,
|
|
@@ -1882,7 +2013,7 @@ async function postAppRuntimeApi<TResponse>(
|
|
|
1882
2013
|
})
|
|
1883
2014
|
) {
|
|
1884
2015
|
const retryDelayMs = appRuntimeRetrySleepMs(
|
|
1885
|
-
appRuntimeRetryDelayMs(body.action,
|
|
2016
|
+
appRuntimeRetryDelayMs(body.action, ladderAttempt),
|
|
1886
2017
|
appRuntimeRetryAfterMs(response, responseText),
|
|
1887
2018
|
);
|
|
1888
2019
|
recordAppRuntimeRetryFailure({
|
|
@@ -2214,6 +2345,57 @@ export async function getBillingEntitlementsViaAppRuntime(
|
|
|
2214
2345
|
}
|
|
2215
2346
|
}
|
|
2216
2347
|
|
|
2348
|
+
export type PlayPageWriteRequest = {
|
|
2349
|
+
name: string;
|
|
2350
|
+
public: boolean;
|
|
2351
|
+
contentType: string;
|
|
2352
|
+
description?: string;
|
|
2353
|
+
/** Exactly one of these carries the content. */
|
|
2354
|
+
contentText?: string;
|
|
2355
|
+
contentBase64?: string;
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
export type PlayPageWriteResult = {
|
|
2359
|
+
name: string;
|
|
2360
|
+
url: string;
|
|
2361
|
+
public: boolean;
|
|
2362
|
+
created: boolean;
|
|
2363
|
+
warnings: string[];
|
|
2364
|
+
};
|
|
2365
|
+
|
|
2366
|
+
export async function writePageViaAppRuntime(
|
|
2367
|
+
context: WorkerRuntimeApiContext,
|
|
2368
|
+
input: PlayPageWriteRequest,
|
|
2369
|
+
): Promise<PlayPageWriteResult> {
|
|
2370
|
+
try {
|
|
2371
|
+
return await postAppRuntimeApi<PlayPageWriteResult>(context, {
|
|
2372
|
+
action: 'write_page',
|
|
2373
|
+
...input,
|
|
2374
|
+
});
|
|
2375
|
+
} catch (error) {
|
|
2376
|
+
// An older receiver does not know write_page, and a token minted while
|
|
2377
|
+
// page.write is withheld from the defaults lacks it. write_page needs only
|
|
2378
|
+
// page.write, so either exact 403 means page writes are not available yet.
|
|
2379
|
+
if (
|
|
2380
|
+
error instanceof AppRuntimeApiResponseError &&
|
|
2381
|
+
error.status === 403 &&
|
|
2382
|
+
error.code === null &&
|
|
2383
|
+
(error.detail === 'Unsupported runtime action capability scope.' ||
|
|
2384
|
+
error.detail ===
|
|
2385
|
+
'Workflow executor token does not permit this operation.')
|
|
2386
|
+
) {
|
|
2387
|
+
throw new AppRuntimeApiResponseError({
|
|
2388
|
+
action: 'write_page',
|
|
2389
|
+
status: 503,
|
|
2390
|
+
code: 'PAGES_UNAVAILABLE',
|
|
2391
|
+
retryable: false,
|
|
2392
|
+
detail: 'Page writes are not available to this run yet.',
|
|
2393
|
+
});
|
|
2394
|
+
}
|
|
2395
|
+
throw error;
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2217
2399
|
export async function getRuntimeTrafficPolicyViaAppRuntime(
|
|
2218
2400
|
context: WorkerRuntimeApiContext,
|
|
2219
2401
|
): Promise<RuntimeTrafficPolicy> {
|
|
@@ -2814,10 +2996,67 @@ export async function applyRowUpdatesViaAppRuntime(
|
|
|
2814
2996
|
? Omit<T & { action: 'apply_row_updates' }, 'action'>
|
|
2815
2997
|
: never,
|
|
2816
2998
|
): Promise<void> {
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2999
|
+
const requestForUpdates = (updates: typeof input.updates) =>
|
|
3000
|
+
({
|
|
3001
|
+
action: 'apply_row_updates',
|
|
3002
|
+
...input,
|
|
3003
|
+
updates,
|
|
3004
|
+
}) as Extract<RuntimeApiRequest, { action: 'apply_row_updates' }>;
|
|
3005
|
+
if (input.updates.length === 0) {
|
|
3006
|
+
await postAppRuntimeApi<{ ok: true }>(
|
|
3007
|
+
context,
|
|
3008
|
+
requestForUpdates(input.updates),
|
|
3009
|
+
);
|
|
3010
|
+
return;
|
|
3011
|
+
}
|
|
3012
|
+
const measureJsonBytes = (value: unknown) => {
|
|
3013
|
+
const serialized = JSON.stringify(
|
|
3014
|
+
prepareRetainedPlayPipelinesForTransport(value),
|
|
3015
|
+
);
|
|
3016
|
+
if (serialized === undefined) {
|
|
3017
|
+
throw new Error(
|
|
3018
|
+
'Runtime row update request is not serializable as JSON.',
|
|
3019
|
+
);
|
|
3020
|
+
}
|
|
3021
|
+
return APP_RUNTIME_JSON_ENCODER.encode(serialized).byteLength;
|
|
3022
|
+
};
|
|
3023
|
+
const emptyRequestBytes = measureJsonBytes(requestForUpdates([]));
|
|
3024
|
+
let batch: typeof input.updates = [];
|
|
3025
|
+
let batchBytes = emptyRequestBytes;
|
|
3026
|
+
|
|
3027
|
+
const flush = async () => {
|
|
3028
|
+
if (batch.length === 0) return;
|
|
3029
|
+
// Map checkpoint updates carry the same row keys and write-version fence
|
|
3030
|
+
// in every page. Replaying a successful page after a later page fails is
|
|
3031
|
+
// therefore an idempotent merge of the same cell patches.
|
|
3032
|
+
await postAppRuntimeApi<{ ok: true }>(context, requestForUpdates(batch));
|
|
3033
|
+
batch = [];
|
|
3034
|
+
batchBytes = emptyRequestBytes;
|
|
3035
|
+
};
|
|
3036
|
+
|
|
3037
|
+
for (const update of input.updates) {
|
|
3038
|
+
const updateBytes = measureJsonBytes(update);
|
|
3039
|
+
const separatorBytes = batch.length > 0 ? 1 : 0;
|
|
3040
|
+
let nextBytes = batchBytes + separatorBytes + updateBytes;
|
|
3041
|
+
if (
|
|
3042
|
+
batch.length > 0 &&
|
|
3043
|
+
nextBytes > APP_RUNTIME_ROW_UPDATE_BATCH_TARGET_BYTES
|
|
3044
|
+
) {
|
|
3045
|
+
await flush();
|
|
3046
|
+
nextBytes = batchBytes + updateBytes;
|
|
3047
|
+
}
|
|
3048
|
+
if (nextBytes > APP_RUNTIME_ROW_UPDATE_REQUEST_MAX_BYTES) {
|
|
3049
|
+
throw new Error(
|
|
3050
|
+
`A single runtime row update needs ${nextBytes} JSON bytes, above the ${APP_RUNTIME_ROW_UPDATE_REQUEST_MAX_BYTES}-byte app request budget.`,
|
|
3051
|
+
);
|
|
3052
|
+
}
|
|
3053
|
+
batch.push(update);
|
|
3054
|
+
batchBytes = nextBytes;
|
|
3055
|
+
if (batchBytes > APP_RUNTIME_ROW_UPDATE_BATCH_TARGET_BYTES) {
|
|
3056
|
+
await flush();
|
|
3057
|
+
}
|
|
3058
|
+
}
|
|
3059
|
+
await flush();
|
|
2821
3060
|
}
|
|
2822
3061
|
|
|
2823
3062
|
export async function createDbSessionViaAppRuntime(
|