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
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
onMemoryPressure as subscribeRuntimeMemoryPressure,
|
|
21
21
|
reportMemoryLedger as publishRuntimeMemoryLedger,
|
|
22
22
|
} from './memory-pressure-signal';
|
|
23
|
+
import { DEFAULT_AUTOMATIC_UNMEASURED_ROW_CONCURRENCY } from './governor/policy';
|
|
23
24
|
|
|
24
25
|
export const NODE_RUNTIME_MAP_MEMORY_BUDGET_BYTES = 512 * 1024 * 1024;
|
|
25
26
|
export const NODE_RUNTIME_MAP_MATERIALIZED_MEMORY_MULTIPLIER = 4;
|
|
@@ -184,6 +185,8 @@ export type RuntimeMapHeapSnapshot = {
|
|
|
184
185
|
* of the live footprint the map can actually shrink.
|
|
185
186
|
*/
|
|
186
187
|
externalBytes?: number;
|
|
188
|
+
/** Subset of externalBytes, retained only for decomposition diagnostics. */
|
|
189
|
+
arrayBuffersBytes?: number;
|
|
187
190
|
/**
|
|
188
191
|
* The process working set. It is what the sandbox cgroup kills on, but Node
|
|
189
192
|
* rarely returns freed pages to the OS, so RSS only proves proximity to the
|
|
@@ -314,6 +317,10 @@ export type RuntimeMapHeapAdmissionSnapshot = {
|
|
|
314
317
|
* post-collection re-probe replaces the reading it supersedes.
|
|
315
318
|
*/
|
|
316
319
|
type HeapReading = {
|
|
320
|
+
heapUsedBytes: number | null;
|
|
321
|
+
externalBytes: number | null;
|
|
322
|
+
arrayBuffersBytes: number | null;
|
|
323
|
+
lastLedgerMutationAtMs: number | null;
|
|
317
324
|
heapLimitBytes: number;
|
|
318
325
|
heapTargetBytes: number;
|
|
319
326
|
liveBytes: number;
|
|
@@ -336,6 +343,10 @@ export type RuntimeMapHeapAdmission = {
|
|
|
336
343
|
acquire(): Promise<RuntimeMapHeapAdmissionLease>;
|
|
337
344
|
/** Sample V8 and admit any newly safe waiting rows. Useful for deterministic tests. */
|
|
338
345
|
reconcile(): void;
|
|
346
|
+
/** Current confirmed pressure only; row width is not a tool-call limit. */
|
|
347
|
+
readExternalExecutionPressure(): boolean;
|
|
348
|
+
/** Reuse this controller's reconciliation; no second policy timer. */
|
|
349
|
+
subscribeExternalExecutionPressure(changed: () => void): () => void;
|
|
339
350
|
/** Reject waiters after a row failure, or release the timer after normal completion. */
|
|
340
351
|
close(error?: unknown): RuntimeMapHeapAdmissionSnapshot;
|
|
341
352
|
snapshot(): RuntimeMapHeapAdmissionSnapshot;
|
|
@@ -549,6 +560,11 @@ export function readRuntimeMapHeapSnapshot(): RuntimeMapHeapSnapshot | null {
|
|
|
549
560
|
Number.isFinite(memoryUsage.external) && memoryUsage.external >= 0
|
|
550
561
|
? memoryUsage.external
|
|
551
562
|
: undefined,
|
|
563
|
+
arrayBuffersBytes:
|
|
564
|
+
Number.isFinite(memoryUsage.arrayBuffers) &&
|
|
565
|
+
memoryUsage.arrayBuffers >= 0
|
|
566
|
+
? memoryUsage.arrayBuffers
|
|
567
|
+
: undefined,
|
|
552
568
|
residentBytes: Number.isFinite(memoryUsage.rss)
|
|
553
569
|
? memoryUsage.rss
|
|
554
570
|
: undefined,
|
|
@@ -730,6 +746,35 @@ export type RuntimeMemoryOccupancyReader = {
|
|
|
730
746
|
};
|
|
731
747
|
};
|
|
732
748
|
|
|
749
|
+
function isFreshRuntimeMajorGc(
|
|
750
|
+
completedAtMs: number | null,
|
|
751
|
+
probeAtMs: number,
|
|
752
|
+
windowMs: number,
|
|
753
|
+
watermarkMs: number | null,
|
|
754
|
+
ledger?: RuntimeMemoryLedger | null,
|
|
755
|
+
): completedAtMs is number {
|
|
756
|
+
const mutationAtMs = ledger?.lastMutationAtMs?.() ?? null;
|
|
757
|
+
return (
|
|
758
|
+
completedAtMs !== null &&
|
|
759
|
+
Number.isFinite(completedAtMs) &&
|
|
760
|
+
completedAtMs >= 0 &&
|
|
761
|
+
Number.isFinite(probeAtMs) &&
|
|
762
|
+
completedAtMs <= probeAtMs &&
|
|
763
|
+
// A recent collection cannot have collected a later registered/released
|
|
764
|
+
// graph. Integer mutation clocks cannot order the GC's fractional same
|
|
765
|
+
// millisecond either, so that known ambiguity is conservative as well.
|
|
766
|
+
(mutationAtMs === null ||
|
|
767
|
+
(Number.isFinite(mutationAtMs) &&
|
|
768
|
+
mutationAtMs >= 0 &&
|
|
769
|
+
Math.floor(mutationAtMs) < Math.floor(completedAtMs))) &&
|
|
770
|
+
probeAtMs - completedAtMs < windowMs &&
|
|
771
|
+
// Performance GC entries are fractional; Date.now watermarks are integral.
|
|
772
|
+
// An event in an explicit collection's same millisecond is not independent evidence.
|
|
773
|
+
Math.floor(completedAtMs) >
|
|
774
|
+
Math.floor(watermarkMs ?? Number.NEGATIVE_INFINITY)
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
|
|
733
778
|
/**
|
|
734
779
|
* A process-wide occupancy reader.
|
|
735
780
|
*
|
|
@@ -831,9 +876,13 @@ export function createRuntimeMemoryOccupancyReader(input: {
|
|
|
831
876
|
const lastMajorAtMs =
|
|
832
877
|
gcObserver?.().byKind.major.lastCompletedAtMs ?? null;
|
|
833
878
|
if (
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
879
|
+
isFreshRuntimeMajorGc(
|
|
880
|
+
lastMajorAtMs,
|
|
881
|
+
startedAt,
|
|
882
|
+
gcMinIntervalMs,
|
|
883
|
+
lastGcAtMs,
|
|
884
|
+
input.memoryLedger,
|
|
885
|
+
)
|
|
837
886
|
) {
|
|
838
887
|
// V8 already swept inside the interval; re-probing reads live objects
|
|
839
888
|
// without paying for a second sweep of them.
|
|
@@ -904,6 +953,8 @@ export function createRuntimeMemoryOccupancyReader(input: {
|
|
|
904
953
|
*/
|
|
905
954
|
export function createRuntimeMapHeapAdmission(input: {
|
|
906
955
|
maxConcurrency: number;
|
|
956
|
+
/** Omission preserves existing explicitly configured admission semantics. */
|
|
957
|
+
concurrencySource?: 'automatic' | 'requested';
|
|
907
958
|
heapProbe?: () => RuntimeMapHeapSnapshot | null;
|
|
908
959
|
initialConcurrency?: number;
|
|
909
960
|
probeIntervalMs?: number;
|
|
@@ -976,6 +1027,10 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
976
1027
|
now?: () => number;
|
|
977
1028
|
}): RuntimeMapHeapAdmission {
|
|
978
1029
|
const maxConcurrency = positiveBudget(input.maxConcurrency, 1);
|
|
1030
|
+
const unmeasuredMaxConcurrency =
|
|
1031
|
+
input.concurrencySource === 'automatic'
|
|
1032
|
+
? Math.min(maxConcurrency, DEFAULT_AUTOMATIC_UNMEASURED_ROW_CONCURRENCY)
|
|
1033
|
+
: maxConcurrency;
|
|
979
1034
|
const initialConcurrency = Math.min(
|
|
980
1035
|
maxConcurrency,
|
|
981
1036
|
positiveBudget(
|
|
@@ -1076,6 +1131,10 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1076
1131
|
let admittedRows = 0;
|
|
1077
1132
|
let settledRows = 0;
|
|
1078
1133
|
let heapLimitBytes: number | null = null;
|
|
1134
|
+
let heapProbeAvailable = false;
|
|
1135
|
+
// The last existing controller pressure verdict survives loss of its probe.
|
|
1136
|
+
let externalExecutionPressure = false;
|
|
1137
|
+
const externalPressureListeners = new Set<() => void>();
|
|
1079
1138
|
let heapTargetBytes: number | null = null;
|
|
1080
1139
|
let heapUsedBytes: number | null = null;
|
|
1081
1140
|
let heapUsedPeakBytes: number | null = null;
|
|
@@ -1143,9 +1202,13 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1143
1202
|
lastGcAtMs = finishedAt;
|
|
1144
1203
|
}
|
|
1145
1204
|
const initial = heapProbe();
|
|
1205
|
+
heapProbeAvailable = initial !== null;
|
|
1146
1206
|
if (initial) {
|
|
1147
1207
|
liveBaselineBytes =
|
|
1148
1208
|
initial.usedHeapBytes + Math.max(0, initial.externalBytes ?? 0);
|
|
1209
|
+
if (runtimeGc !== null) {
|
|
1210
|
+
memoryLedger?.recordCollectedBaseline?.(liveBaselineBytes);
|
|
1211
|
+
}
|
|
1149
1212
|
// The opening width is spent before any probe: every row worker calls
|
|
1150
1213
|
// acquire() at once, and a granted lease cannot be taken back. So the
|
|
1151
1214
|
// unmeasured reserve has to bound the first wave too, not just the
|
|
@@ -1173,6 +1236,8 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1173
1236
|
Math.floor(openingHeadroomBytes / openingRowReserveBytes),
|
|
1174
1237
|
),
|
|
1175
1238
|
);
|
|
1239
|
+
} else {
|
|
1240
|
+
concurrency = Math.min(concurrency, unmeasuredMaxConcurrency);
|
|
1176
1241
|
}
|
|
1177
1242
|
}
|
|
1178
1243
|
|
|
@@ -1272,11 +1337,13 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1272
1337
|
};
|
|
1273
1338
|
|
|
1274
1339
|
const pauseAdmission = () => {
|
|
1340
|
+
externalExecutionPressure = true;
|
|
1275
1341
|
admissionHolds += 1;
|
|
1276
1342
|
admissionPaused = true;
|
|
1277
1343
|
};
|
|
1278
1344
|
|
|
1279
1345
|
const applyHeapSample = (heap: RuntimeMapHeapSnapshot): HeapReading => {
|
|
1346
|
+
heapProbeAvailable = true;
|
|
1280
1347
|
heapLimitBytes = heap.heapLimitBytes;
|
|
1281
1348
|
heapUsedBytes = heap.usedHeapBytes;
|
|
1282
1349
|
heapUsedPeakBytes = Math.max(heapUsedPeakBytes ?? 0, heap.usedHeapBytes);
|
|
@@ -1304,7 +1371,13 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1304
1371
|
: Math.floor(
|
|
1305
1372
|
cgroupLimitBytes * RUNTIME_MAP_RESIDENT_GUARD_CGROUP_FRACTION,
|
|
1306
1373
|
);
|
|
1374
|
+
const component = (value: number | null | undefined): number | null =>
|
|
1375
|
+
value != null && Number.isFinite(value) && value >= 0 ? value : null;
|
|
1307
1376
|
return {
|
|
1377
|
+
heapUsedBytes: component(heap.usedHeapBytes),
|
|
1378
|
+
externalBytes: component(heap.externalBytes),
|
|
1379
|
+
arrayBuffersBytes: component(heap.arrayBuffersBytes),
|
|
1380
|
+
lastLedgerMutationAtMs: component(memoryLedger?.lastMutationAtMs?.()),
|
|
1308
1381
|
heapLimitBytes: heap.heapLimitBytes,
|
|
1309
1382
|
heapTargetBytes,
|
|
1310
1383
|
liveBytes,
|
|
@@ -1326,17 +1399,31 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1326
1399
|
* Returns the post-collection reading, or null when no collection happened
|
|
1327
1400
|
* and the caller's reading still stands.
|
|
1328
1401
|
*/
|
|
1329
|
-
const collectAndReprobe = ()
|
|
1402
|
+
const collectAndReprobe = () => {
|
|
1330
1403
|
const startedAt = now();
|
|
1331
1404
|
const lastMajorAtMs = gcObserver?.().byKind.major.lastCompletedAtMs ?? null;
|
|
1332
1405
|
if (
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1406
|
+
isFreshRuntimeMajorGc(
|
|
1407
|
+
lastMajorAtMs,
|
|
1408
|
+
startedAt,
|
|
1409
|
+
gcMinIntervalMs,
|
|
1410
|
+
lastGcAtMs,
|
|
1411
|
+
memoryLedger,
|
|
1412
|
+
)
|
|
1336
1413
|
) {
|
|
1337
1414
|
lastGcAtMs = lastMajorAtMs;
|
|
1338
1415
|
const swept = heapProbe();
|
|
1339
|
-
|
|
1416
|
+
const probeAtMs = now();
|
|
1417
|
+
return swept
|
|
1418
|
+
? {
|
|
1419
|
+
reading: applyHeapSample(swept),
|
|
1420
|
+
observation: {
|
|
1421
|
+
probeAtMs,
|
|
1422
|
+
gcCompletedAtMs: lastMajorAtMs,
|
|
1423
|
+
reason: 'natural-major-gc' as const,
|
|
1424
|
+
},
|
|
1425
|
+
}
|
|
1426
|
+
: null;
|
|
1340
1427
|
}
|
|
1341
1428
|
if (runtimeGc === null) return null;
|
|
1342
1429
|
if (lastGcAtMs !== null && startedAt - lastGcAtMs < gcMinIntervalMs) {
|
|
@@ -1348,7 +1435,17 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1348
1435
|
gcExplicitTotalMs += Math.max(0, finishedAt - startedAt);
|
|
1349
1436
|
lastGcAtMs = finishedAt;
|
|
1350
1437
|
const collected = heapProbe();
|
|
1351
|
-
|
|
1438
|
+
const probeAtMs = now();
|
|
1439
|
+
return collected
|
|
1440
|
+
? {
|
|
1441
|
+
reading: applyHeapSample(collected),
|
|
1442
|
+
observation: {
|
|
1443
|
+
probeAtMs,
|
|
1444
|
+
gcCompletedAtMs: finishedAt,
|
|
1445
|
+
reason: 'explicit-gc' as const,
|
|
1446
|
+
},
|
|
1447
|
+
}
|
|
1448
|
+
: null;
|
|
1352
1449
|
};
|
|
1353
1450
|
|
|
1354
1451
|
/**
|
|
@@ -1373,32 +1470,56 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1373
1470
|
: safeWidth;
|
|
1374
1471
|
};
|
|
1375
1472
|
|
|
1376
|
-
const
|
|
1473
|
+
const reconcileState = () => {
|
|
1377
1474
|
if (closed) return;
|
|
1378
1475
|
const heap = heapProbe();
|
|
1379
1476
|
if (!heap) {
|
|
1477
|
+
heapProbeAvailable = false;
|
|
1380
1478
|
admissionPaused = false;
|
|
1381
|
-
concurrency =
|
|
1479
|
+
concurrency = unmeasuredMaxConcurrency;
|
|
1382
1480
|
drain();
|
|
1383
1481
|
return;
|
|
1384
1482
|
}
|
|
1483
|
+
const probeAtMs = now();
|
|
1385
1484
|
let reading = applyHeapSample(heap);
|
|
1485
|
+
let observation: {
|
|
1486
|
+
probeAtMs: number;
|
|
1487
|
+
gcCompletedAtMs: number | null;
|
|
1488
|
+
reason: 'explicit-gc' | 'natural-major-gc' | 'gc-unavailable';
|
|
1489
|
+
} = { probeAtMs, gcCompletedAtMs: null, reason: 'gc-unavailable' };
|
|
1386
1490
|
// A collection the watchdog just asked for makes this probe a collected
|
|
1387
1491
|
// one, which is the only kind the ledger may calibrate from.
|
|
1388
1492
|
let postCollectionSample = nextProbeIsPostCollection;
|
|
1389
1493
|
nextProbeIsPostCollection = false;
|
|
1494
|
+
if (postCollectionSample)
|
|
1495
|
+
observation = {
|
|
1496
|
+
probeAtMs: observation.probeAtMs,
|
|
1497
|
+
gcCompletedAtMs: lastGcAtMs,
|
|
1498
|
+
reason: 'explicit-gc',
|
|
1499
|
+
};
|
|
1390
1500
|
// V8's own major collections count too: a probe taken right after one
|
|
1391
1501
|
// reads live objects, not garbage, so a light map that never crosses the
|
|
1392
1502
|
// target still calibrates instead of keeping the prior for its whole life.
|
|
1393
1503
|
const naturalMajorAtMs =
|
|
1394
1504
|
gcObserver?.().byKind.major.lastCompletedAtMs ?? null;
|
|
1395
1505
|
if (
|
|
1396
|
-
|
|
1506
|
+
isFreshRuntimeMajorGc(
|
|
1507
|
+
naturalMajorAtMs,
|
|
1508
|
+
observation.probeAtMs,
|
|
1509
|
+
gcMinIntervalMs,
|
|
1510
|
+
lastGcAtMs,
|
|
1511
|
+
memoryLedger,
|
|
1512
|
+
) &&
|
|
1397
1513
|
naturalMajorAtMs >
|
|
1398
1514
|
(lastNaturalMajorCalibratedAtMs ?? Number.NEGATIVE_INFINITY)
|
|
1399
1515
|
) {
|
|
1400
1516
|
lastNaturalMajorCalibratedAtMs = naturalMajorAtMs;
|
|
1401
1517
|
postCollectionSample = true;
|
|
1518
|
+
observation = {
|
|
1519
|
+
probeAtMs: observation.probeAtMs,
|
|
1520
|
+
gcCompletedAtMs: naturalMajorAtMs,
|
|
1521
|
+
reason: 'natural-major-gc',
|
|
1522
|
+
};
|
|
1402
1523
|
}
|
|
1403
1524
|
|
|
1404
1525
|
// Observed live over the target is a question about garbage, not a verdict
|
|
@@ -1412,7 +1533,8 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1412
1533
|
} else {
|
|
1413
1534
|
const collected = collectAndReprobe();
|
|
1414
1535
|
if (collected) {
|
|
1415
|
-
reading = collected;
|
|
1536
|
+
reading = collected.reading;
|
|
1537
|
+
observation = collected.observation;
|
|
1416
1538
|
postCollectionSample = true;
|
|
1417
1539
|
}
|
|
1418
1540
|
if (postCollectionSample || !gcAvailable) {
|
|
@@ -1460,6 +1582,13 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1460
1582
|
observedLiveBytes: reading.liveBytes,
|
|
1461
1583
|
baselineBytes: reading.liveBaselineBytes,
|
|
1462
1584
|
admittedRowReserveBytes,
|
|
1585
|
+
observation: {
|
|
1586
|
+
...observation,
|
|
1587
|
+
heapUsedBytes: reading.heapUsedBytes,
|
|
1588
|
+
externalBytes: reading.externalBytes,
|
|
1589
|
+
arrayBuffersBytes: reading.arrayBuffersBytes,
|
|
1590
|
+
lastLedgerMutationAtMs: reading.lastLedgerMutationAtMs,
|
|
1591
|
+
},
|
|
1463
1592
|
});
|
|
1464
1593
|
}
|
|
1465
1594
|
memorySnapshot = memoryLedger?.snapshot() ?? null;
|
|
@@ -1564,7 +1693,11 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1564
1693
|
return;
|
|
1565
1694
|
}
|
|
1566
1695
|
eventLoopPressureActive = false;
|
|
1567
|
-
if (
|
|
1696
|
+
if (
|
|
1697
|
+
eventLoopLagMs !== null &&
|
|
1698
|
+
eventLoopCeiling < maxConcurrency &&
|
|
1699
|
+
adjustDue
|
|
1700
|
+
) {
|
|
1568
1701
|
lastEventLoopAdjustAtMs = now();
|
|
1569
1702
|
eventLoopCeiling = Math.min(
|
|
1570
1703
|
maxConcurrency,
|
|
@@ -1600,6 +1733,32 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1600
1733
|
drain();
|
|
1601
1734
|
};
|
|
1602
1735
|
|
|
1736
|
+
const reconcile = () => {
|
|
1737
|
+
if (closed) return;
|
|
1738
|
+
try {
|
|
1739
|
+
reconcileState();
|
|
1740
|
+
} finally {
|
|
1741
|
+
// Only a current complete healthy observation may clear a known hold.
|
|
1742
|
+
if (
|
|
1743
|
+
admissionPaused ||
|
|
1744
|
+
(eventLoopLagMs !== null && eventLoopLagMs >= eventLoopLagHoldMs)
|
|
1745
|
+
) {
|
|
1746
|
+
externalExecutionPressure = true;
|
|
1747
|
+
} else if (
|
|
1748
|
+
heapProbeAvailable &&
|
|
1749
|
+
residentBytes !== null &&
|
|
1750
|
+
Number.isFinite(residentBytes) &&
|
|
1751
|
+
residentGuardBytes !== null &&
|
|
1752
|
+
Number.isFinite(residentGuardBytes) &&
|
|
1753
|
+
eventLoopLagMs !== null &&
|
|
1754
|
+
Number.isFinite(eventLoopLagMs)
|
|
1755
|
+
) {
|
|
1756
|
+
externalExecutionPressure = false;
|
|
1757
|
+
}
|
|
1758
|
+
for (const changed of externalPressureListeners) changed();
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
|
|
1603
1762
|
const unsubscribeMemoryPressure = subscribeMemoryPressure(() => {
|
|
1604
1763
|
if (closed) return;
|
|
1605
1764
|
externalPressureSignals += 1;
|
|
@@ -1647,12 +1806,29 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1647
1806
|
);
|
|
1648
1807
|
},
|
|
1649
1808
|
reconcile,
|
|
1809
|
+
readExternalExecutionPressure() {
|
|
1810
|
+
return (
|
|
1811
|
+
!closed &&
|
|
1812
|
+
(externalExecutionPressure ||
|
|
1813
|
+
admissionPaused ||
|
|
1814
|
+
(eventLoopLagMs !== null && eventLoopLagMs >= eventLoopLagHoldMs))
|
|
1815
|
+
);
|
|
1816
|
+
},
|
|
1817
|
+
subscribeExternalExecutionPressure(changed) {
|
|
1818
|
+
if (closed) return () => {};
|
|
1819
|
+
externalPressureListeners.add(changed);
|
|
1820
|
+
return () => {
|
|
1821
|
+
externalPressureListeners.delete(changed);
|
|
1822
|
+
};
|
|
1823
|
+
},
|
|
1650
1824
|
close(error) {
|
|
1651
1825
|
if (!closed) {
|
|
1652
1826
|
closed = true;
|
|
1653
1827
|
closeError = error ?? new Error('Runtime map row admission is closed.');
|
|
1654
1828
|
clearInterval(timer);
|
|
1655
1829
|
unsubscribeMemoryPressure();
|
|
1830
|
+
for (const changed of externalPressureListeners) changed();
|
|
1831
|
+
externalPressureListeners.clear();
|
|
1656
1832
|
while (waiters.length > 0) {
|
|
1657
1833
|
waiters.shift()?.reject(closeError);
|
|
1658
1834
|
}
|
|
@@ -180,6 +180,32 @@ export type RuntimeMemoryLedgerHandle = {
|
|
|
180
180
|
release(): void;
|
|
181
181
|
};
|
|
182
182
|
|
|
183
|
+
export type RuntimeMemoryLedgerObservationMetadata = {
|
|
184
|
+
/** Same scored probe; ArrayBuffers are a subset of external, not additive. */
|
|
185
|
+
heapUsedBytes?: number | null;
|
|
186
|
+
externalBytes?: number | null;
|
|
187
|
+
arrayBuffersBytes?: number | null;
|
|
188
|
+
lastLedgerMutationAtMs?: number | null;
|
|
189
|
+
|
|
190
|
+
probeAtMs?: number | null;
|
|
191
|
+
gcCompletedAtMs?: number | null;
|
|
192
|
+
reason?: 'explicit-gc' | 'natural-major-gc' | 'gc-unavailable' | null;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
export type RuntimeMemoryLedgerPeakObservation = {
|
|
196
|
+
/** Same scored probe; ArrayBuffers are a subset of external, not additive. */
|
|
197
|
+
heapUsedBytes?: number | null;
|
|
198
|
+
externalBytes?: number | null;
|
|
199
|
+
arrayBuffersBytes?: number | null;
|
|
200
|
+
lastLedgerMutationAtMs?: number | null;
|
|
201
|
+
|
|
202
|
+
probeAtMs: number | null;
|
|
203
|
+
gcCompletedAtMs: number | null;
|
|
204
|
+
reason: Exclude<RuntimeMemoryLedgerObservationMetadata['reason'], undefined>;
|
|
205
|
+
bytesByCategory: Record<RuntimeMemoryLedgerCategory, number>;
|
|
206
|
+
predictedBytesByCategory: Record<RuntimeMemoryLedgerCategory, number>;
|
|
207
|
+
};
|
|
208
|
+
|
|
183
209
|
export type RuntimeMemoryLedgerSnapshot = {
|
|
184
210
|
bytesByCategory: Record<RuntimeMemoryLedgerCategory, number>;
|
|
185
211
|
/** Per-category high-water marks. These are independent maxima. */
|
|
@@ -242,6 +268,10 @@ export type RuntimeMemoryLedgerSnapshot = {
|
|
|
242
268
|
* same as `predictedLiveBytes`.
|
|
243
269
|
*/
|
|
244
270
|
predictedAtObservedPeakBytes: number | null;
|
|
271
|
+
/** Baseline from that SAME probe; absence keeps historical reader behavior. */
|
|
272
|
+
baselineAtObservedPeakBytes?: number | null;
|
|
273
|
+
/** Fixed scalar/category evidence, before fitting; absent on older snapshots. */
|
|
274
|
+
observationAtObservedPeak?: RuntimeMemoryLedgerPeakObservation | null;
|
|
245
275
|
/** Ledger bytes registered at that same instant, for the same reason. */
|
|
246
276
|
ledgerBytesAtObservedPeak: number | null;
|
|
247
277
|
/**
|
|
@@ -254,6 +284,8 @@ export type RuntimeMemoryLedgerSnapshot = {
|
|
|
254
284
|
};
|
|
255
285
|
|
|
256
286
|
export type RuntimeMemoryLedger = {
|
|
287
|
+
/** Internal ownership clock; absent on legacy ledgers. Never a wire field. */
|
|
288
|
+
lastMutationAtMs?(): number | null;
|
|
257
289
|
register(input: {
|
|
258
290
|
category: RuntimeMemoryLedgerCategory;
|
|
259
291
|
ownerId?: string | null;
|
|
@@ -268,6 +300,8 @@ export type RuntimeMemoryLedger = {
|
|
|
268
300
|
settleOwner(ownerId: string): number | null;
|
|
269
301
|
/** Bytes currently registered to an owner, or null if it is not tracked. */
|
|
270
302
|
ownerBytes(ownerId: string): number | null;
|
|
303
|
+
/** Retain an actual collected opening baseline without fitting or scoring a sample. */
|
|
304
|
+
recordCollectedBaseline?(bytes: number): void;
|
|
271
305
|
/**
|
|
272
306
|
* Fit the ledger to the process. `observedLiveBytes` is heapUsed + external
|
|
273
307
|
* from the same probe that paces admission; `baselineBytes` is the reading
|
|
@@ -283,6 +317,7 @@ export type RuntimeMemoryLedger = {
|
|
|
283
317
|
* promise about in-flight work rather than a retained object.
|
|
284
318
|
*/
|
|
285
319
|
admittedRowReserveBytes?: number;
|
|
320
|
+
observation?: RuntimeMemoryLedgerObservationMetadata;
|
|
286
321
|
}): void;
|
|
287
322
|
snapshot(): RuntimeMemoryLedgerSnapshot;
|
|
288
323
|
};
|
|
@@ -308,6 +343,8 @@ type SettledOwnerPeak = {
|
|
|
308
343
|
};
|
|
309
344
|
|
|
310
345
|
export function createRuntimeMemoryLedger(options?: {
|
|
346
|
+
/** Same wall-clock authority as GC completion timestamps; injectable for tests. */
|
|
347
|
+
now?: () => number;
|
|
311
348
|
settledReservoirSize?: number;
|
|
312
349
|
calibrationFloorBytes?: number;
|
|
313
350
|
calibrationAlpha?: number;
|
|
@@ -325,6 +362,16 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
325
362
|
*/
|
|
326
363
|
random?: () => number;
|
|
327
364
|
}): RuntimeMemoryLedger {
|
|
365
|
+
const now = options?.now ?? Date.now;
|
|
366
|
+
let lastMutationAtMs: number | null = null;
|
|
367
|
+
const recordMutation = () => {
|
|
368
|
+
const at = now();
|
|
369
|
+
if (!Number.isFinite(at) || at < 0)
|
|
370
|
+
throw new RangeError(
|
|
371
|
+
'Memory ownership clock must be finite and non-negative.',
|
|
372
|
+
);
|
|
373
|
+
lastMutationAtMs = Math.max(lastMutationAtMs ?? at, at);
|
|
374
|
+
};
|
|
328
375
|
const random = typeof options?.random === 'function' ? options.random : null;
|
|
329
376
|
const uniform = (): number => {
|
|
330
377
|
const value = random ? random() : Math.random();
|
|
@@ -481,6 +528,9 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
481
528
|
let observedLiveBytes: number | null = null;
|
|
482
529
|
let observedCollectedPeakBytes: number | null = null;
|
|
483
530
|
let predictedAtObservedPeakBytes: number | null = null;
|
|
531
|
+
let baselineAtObservedPeakBytes: number | null = null;
|
|
532
|
+
let observationAtObservedPeak: RuntimeMemoryLedgerPeakObservation | null =
|
|
533
|
+
null;
|
|
484
534
|
let ledgerBytesAtObservedPeak: number | null = null;
|
|
485
535
|
let admittedRowReserveBytesAtObservedPeak: number | null = null;
|
|
486
536
|
let baselineBytes: number | null = null;
|
|
@@ -535,6 +585,7 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
535
585
|
|
|
536
586
|
const releaseEntry = (entry: LedgerEntry): void => {
|
|
537
587
|
if (entry.released) return;
|
|
588
|
+
recordMutation();
|
|
538
589
|
entry.released = true;
|
|
539
590
|
liveEntries = Math.max(0, liveEntries - 1);
|
|
540
591
|
applyDelta(entry, -entry.bytes);
|
|
@@ -545,6 +596,7 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
545
596
|
};
|
|
546
597
|
|
|
547
598
|
return {
|
|
599
|
+
lastMutationAtMs: () => lastMutationAtMs,
|
|
548
600
|
register({ category, ownerId, bytes }) {
|
|
549
601
|
const normalizedBytes = requireByteCount(bytes);
|
|
550
602
|
if (!RUNTIME_MEMORY_LEDGER_CATEGORIES.includes(category)) {
|
|
@@ -552,6 +604,7 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
552
604
|
`Runtime memory ledger received an unknown category "${String(category)}".`,
|
|
553
605
|
);
|
|
554
606
|
}
|
|
607
|
+
recordMutation();
|
|
555
608
|
const normalizedOwnerId =
|
|
556
609
|
typeof ownerId === 'string' && ownerId.length > 0 ? ownerId : null;
|
|
557
610
|
const entry: LedgerEntry = {
|
|
@@ -581,6 +634,8 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
581
634
|
update(nextBytes) {
|
|
582
635
|
if (entry.released) return;
|
|
583
636
|
const normalizedNext = requireByteCount(nextBytes);
|
|
637
|
+
// Equal byte counts can replace the entire retained object graph.
|
|
638
|
+
recordMutation();
|
|
584
639
|
const delta = normalizedNext - entry.bytes;
|
|
585
640
|
entry.bytes = normalizedNext;
|
|
586
641
|
applyDelta(entry, delta);
|
|
@@ -625,16 +680,38 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
625
680
|
return owners.get(ownerId)?.bytes ?? null;
|
|
626
681
|
},
|
|
627
682
|
|
|
683
|
+
recordCollectedBaseline(bytes) {
|
|
684
|
+
const value = requireByteCount(bytes);
|
|
685
|
+
// An opening reading must never replace an already observed/scored baseline.
|
|
686
|
+
baselineBytes ??= value;
|
|
687
|
+
},
|
|
628
688
|
calibrate({
|
|
629
689
|
observedLiveBytes: observed,
|
|
630
690
|
baselineBytes: baseline,
|
|
631
691
|
admittedRowReserveBytes: admittedRowReserve = 0,
|
|
692
|
+
observation,
|
|
632
693
|
}) {
|
|
633
694
|
// The prediction admission was acting on at this probe, judged before
|
|
634
695
|
// this probe is allowed to change it. Learning first and then scoring
|
|
635
696
|
// would grade the fit against itself.
|
|
636
697
|
const predictedBefore = predictedLiveBytesNow();
|
|
637
698
|
const reservedBytes = requireByteCount(admittedRowReserve);
|
|
699
|
+
const time = (value: number | null | undefined): number | null => {
|
|
700
|
+
if (value == null) return null;
|
|
701
|
+
if (!Number.isFinite(value) || value < 0)
|
|
702
|
+
throw new RangeError(
|
|
703
|
+
'Memory observation time must be finite and non-negative.',
|
|
704
|
+
);
|
|
705
|
+
return value;
|
|
706
|
+
};
|
|
707
|
+
const probeAtMs = time(observation?.probeAtMs);
|
|
708
|
+
const gcCompletedAtMs = time(observation?.gcCompletedAtMs);
|
|
709
|
+
const reason = observation?.reason ?? null;
|
|
710
|
+
if (
|
|
711
|
+
reason !== null &&
|
|
712
|
+
!['explicit-gc', 'natural-major-gc', 'gc-unavailable'].includes(reason)
|
|
713
|
+
)
|
|
714
|
+
throw new RangeError('Memory observation reason is invalid.');
|
|
638
715
|
if (Number.isFinite(observed) && observed >= 0) {
|
|
639
716
|
observedLiveBytes = observed;
|
|
640
717
|
if (observed > (observedCollectedPeakBytes ?? -1)) {
|
|
@@ -644,6 +721,47 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
644
721
|
// readouts can explain an unaccounted gap, but judge the ledger's
|
|
645
722
|
// prediction only on bytes its owners actually registered.
|
|
646
723
|
predictedAtObservedPeakBytes = Math.round(predictedBefore);
|
|
724
|
+
baselineAtObservedPeakBytes =
|
|
725
|
+
baseline != null && Number.isFinite(baseline) && baseline >= 0
|
|
726
|
+
? baseline
|
|
727
|
+
: null;
|
|
728
|
+
// Diagnostics never change scoring or fit. Preserve absent legacy
|
|
729
|
+
// fields, and freeze only these four finite/nonnegative scalars.
|
|
730
|
+
const components: Pick<
|
|
731
|
+
RuntimeMemoryLedgerObservationMetadata,
|
|
732
|
+
| 'heapUsedBytes'
|
|
733
|
+
| 'externalBytes'
|
|
734
|
+
| 'arrayBuffersBytes'
|
|
735
|
+
| 'lastLedgerMutationAtMs'
|
|
736
|
+
> = {};
|
|
737
|
+
for (const key of [
|
|
738
|
+
'heapUsedBytes',
|
|
739
|
+
'externalBytes',
|
|
740
|
+
'arrayBuffersBytes',
|
|
741
|
+
'lastLedgerMutationAtMs',
|
|
742
|
+
] as const) {
|
|
743
|
+
const value = observation?.[key];
|
|
744
|
+
if (value !== undefined)
|
|
745
|
+
components[key] =
|
|
746
|
+
value !== null && Number.isFinite(value) && value >= 0
|
|
747
|
+
? value
|
|
748
|
+
: null;
|
|
749
|
+
}
|
|
750
|
+
observationAtObservedPeak = {
|
|
751
|
+
...components,
|
|
752
|
+
probeAtMs,
|
|
753
|
+
gcCompletedAtMs,
|
|
754
|
+
reason,
|
|
755
|
+
bytesByCategory: { ...bytesByCategory },
|
|
756
|
+
predictedBytesByCategory: Object.fromEntries(
|
|
757
|
+
RUNTIME_MEMORY_LEDGER_CATEGORIES.map((category) => [
|
|
758
|
+
category,
|
|
759
|
+
Math.round(
|
|
760
|
+
bytesByCategory[category] * categoryFactors[category],
|
|
761
|
+
),
|
|
762
|
+
]),
|
|
763
|
+
) as Record<RuntimeMemoryLedgerCategory, number>,
|
|
764
|
+
};
|
|
647
765
|
ledgerBytesAtObservedPeak = liveBytes;
|
|
648
766
|
admittedRowReserveBytesAtObservedPeak = reservedBytes;
|
|
649
767
|
}
|
|
@@ -721,6 +839,19 @@ export function createRuntimeMemoryLedger(options?: {
|
|
|
721
839
|
observedLiveBytes,
|
|
722
840
|
observedCollectedPeakBytes,
|
|
723
841
|
predictedAtObservedPeakBytes,
|
|
842
|
+
baselineAtObservedPeakBytes,
|
|
843
|
+
observationAtObservedPeak:
|
|
844
|
+
observationAtObservedPeak === null
|
|
845
|
+
? null
|
|
846
|
+
: {
|
|
847
|
+
...observationAtObservedPeak,
|
|
848
|
+
bytesByCategory: {
|
|
849
|
+
...observationAtObservedPeak.bytesByCategory,
|
|
850
|
+
},
|
|
851
|
+
predictedBytesByCategory: {
|
|
852
|
+
...observationAtObservedPeak.predictedBytesByCategory,
|
|
853
|
+
},
|
|
854
|
+
},
|
|
724
855
|
ledgerBytesAtObservedPeak,
|
|
725
856
|
admittedRowReserveBytesAtObservedPeak,
|
|
726
857
|
baselineBytes,
|