deepline 0.3.534 → 0.3.536
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 +254 -147
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +27 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +16 -5
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +2 -23
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +26 -14
- package/dist/bundling-sources/shared_libs/integration-contracts/monitor-input-contract.ts +33 -8
- package/dist/bundling-sources/shared_libs/monitors/fleets/count-drift-alert.ts +121 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +14 -82
- package/dist/bundling-sources/shared_libs/monitors/package.json +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
- package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -26
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +21 -31
- package/dist/bundling-sources/shared_libs/play-runtime/call-requeue-state-machine.ts +420 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +727 -102
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-retry-policy.ts +624 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
- package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +60 -1
- package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +372 -10
- package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +6 -2
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +63 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +90 -49
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +136 -30
- package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
- package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +63 -13
- package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
- package/dist/cli/auth-6XQKFOLG.js +43 -0
- package/dist/cli/{auth-MHQYIMVX.mjs → auth-KCTCUO7P.mjs} +7 -7
- package/dist/cli/{billing-YQLNP4S5.js → billing-4VBGZ3CT.js} +273 -112
- package/dist/cli/{billing-LX2PSBJ4.mjs → billing-OOJHKLNS.mjs} +185 -24
- package/dist/cli/{chunk-DGKTHWWH.js → chunk-2B4IOGFD.js} +406 -382
- package/dist/cli/{chunk-MQORQ7WL.js → chunk-2FCSUOYN.js} +55 -55
- package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
- package/dist/cli/{chunk-6IFZPEJE.mjs → chunk-2YWJS76L.mjs} +1 -1
- package/dist/cli/{chunk-E7TP25I2.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
- package/dist/cli/{chunk-LGRZCHKC.js → chunk-4E5JXZ3W.js} +18 -20
- package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
- package/dist/cli/{chunk-SUWTLXCV.js → chunk-6BBGUQJJ.js} +67 -146
- package/dist/cli/{chunk-JBBJDFUJ.js → chunk-6VUGBQZQ.js} +5 -5
- package/dist/cli/{chunk-2P3NVX65.mjs → chunk-AB2GBOD4.mjs} +40 -27
- package/dist/cli/{chunk-62SOZ67Y.mjs → chunk-ANUKBZ6W.mjs} +475 -11
- package/dist/cli/{chunk-MG6YL4M7.mjs → chunk-BASLYGXK.mjs} +101 -77
- package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
- package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
- package/dist/cli/{chunk-RH3YRMUY.js → chunk-CIDN5K23.js} +1 -1
- package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
- package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
- package/dist/cli/{chunk-UWNVFAFN.js → chunk-CWSLUNA6.js} +33 -33
- package/dist/cli/{chunk-5FXMEEF4.mjs → chunk-CXTW7SRW.mjs} +67 -146
- package/dist/cli/{chunk-O53LHONF.mjs → chunk-DA2I2M7D.mjs} +2 -2
- package/dist/cli/{chunk-EYXUAJAU.mjs → chunk-DQHUJMCL.mjs} +5 -5
- package/dist/cli/{chunk-7GFR5Y4J.mjs → chunk-DUYAMLOC.mjs} +1 -1
- package/dist/cli/{chunk-OMVVHX4U.mjs → chunk-E24UGPGG.mjs} +13 -15
- package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
- package/dist/cli/{chunk-KJVY7V2X.mjs → chunk-GF32SBST.mjs} +1 -1
- package/dist/cli/{chunk-AK622KIG.mjs → chunk-GHLDCLSC.mjs} +1 -1
- package/dist/cli/{chunk-A6HNT4EE.js → chunk-GTVZKY3F.js} +2 -2
- package/dist/cli/{chunk-BXIUZM5N.mjs → chunk-HAJQGP5V.mjs} +2 -2
- package/dist/cli/{chunk-6CEUQYMB.js → chunk-HWDKRN7L.js} +3 -3
- package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
- package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
- package/dist/cli/{chunk-WR4WETRU.mjs → chunk-JUHDJNSI.mjs} +4 -4
- package/dist/cli/{chunk-TQH3533L.mjs → chunk-KPQHUVYW.mjs} +5 -5
- package/dist/cli/{chunk-V7SCRUFQ.js → chunk-KWYGWO4Y.js} +9 -6
- package/dist/cli/{chunk-DZS4JC7I.js → chunk-LDGZFDUB.js} +2 -2
- package/dist/cli/{chunk-EGTUOYYG.js → chunk-LN6RXDTB.js} +523 -59
- package/dist/cli/{chunk-DQ5ADV2J.mjs → chunk-LZXZQPA2.mjs} +4 -1
- package/dist/cli/{chunk-MYSKWJMA.js → chunk-MSP4DTSD.js} +13 -13
- package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
- package/dist/cli/{chunk-NNAE7E23.mjs → chunk-OUDTOMZC.mjs} +7 -9
- package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
- package/dist/cli/{chunk-ENCA6O2D.mjs → chunk-PNY3BWHP.mjs} +2 -2
- package/dist/cli/{chunk-KSA2XE4T.js → chunk-Q4MNUOS4.js} +316 -303
- package/dist/cli/{chunk-GTXSUPCJ.js → chunk-Q5CXV3E3.js} +2 -2
- package/dist/cli/{chunk-VAG5YKP6.mjs → chunk-RVSSQPQO.mjs} +1 -1
- package/dist/cli/{chunk-VE7ZPLN2.js → chunk-SLPJ3LXI.js} +22 -22
- package/dist/cli/{chunk-IX45S5VC.js → chunk-TX5TUHJN.js} +17 -19
- package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
- package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
- package/dist/cli/{chunk-NDFNBJGL.js → chunk-VBDZIMWD.js} +26 -26
- package/dist/cli/{chunk-GVGQ6NZW.js → chunk-W7AEIGZR.js} +41 -41
- package/dist/cli/{chunk-WDNRPZED.mjs → chunk-WC5M3JXE.mjs} +2 -2
- package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
- package/dist/cli/{chunk-MQX363YF.js → chunk-XBAH3TKU.js} +5 -5
- package/dist/cli/{chunk-BDWZBMGV.mjs → chunk-XJD2GYUP.mjs} +5 -5
- package/dist/cli/{chunk-XRZJKHUA.mjs → chunk-XVZRJJDS.mjs} +4 -4
- package/dist/cli/{chunk-TVINIDHB.js → chunk-Y2NTPYGS.js} +17 -17
- package/dist/cli/{chunk-6GTGWZJG.mjs → chunk-YBMHOH6H.mjs} +4 -4
- package/dist/cli/{chunk-TG2UB3A5.mjs → chunk-YRLAUGQY.mjs} +3 -3
- package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
- package/dist/cli/{chunk-KXQCUX3X.mjs → chunk-Z7UIOGW4.mjs} +3 -3
- package/dist/cli/{chunk-HCD36BP6.js → chunk-ZEV2Y56V.js} +44 -44
- package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
- package/dist/cli/{chunk-XBK6WCVA.js → chunk-ZILSRDIN.js} +8 -8
- package/dist/cli/{chunk-B2AS3R5W.js → chunk-ZISEH7OL.js} +16 -16
- package/dist/cli/{chunk-HPJAE6PP.js → chunk-ZZ4MF2GI.js} +6 -6
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-U3M2G76R.js → csv-2V2DIFNG.js} +15 -15
- package/dist/cli/{csv-4ID4E5W3.mjs → csv-P3HLK4GO.mjs} +6 -6
- package/dist/cli/{db-IHAQIKEQ.js → db-MREAQVW6.js} +36 -36
- package/dist/cli/{db-LHX5BBCZ.mjs → db-ZYOY3QRQ.mjs} +9 -9
- package/dist/cli/describe-IKZFOADR.mjs +49 -0
- package/dist/cli/describe-WW3OQRLP.js +49 -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 +5 -5
- package/dist/cli/describe-core.mjs +4 -4
- package/dist/cli/{executions-CJ5LV23G.js → executions-H5IJ7QSQ.js} +11 -11
- package/dist/cli/{executions-UJ6JZUL5.mjs → executions-KTSY5M34.mjs} +9 -9
- package/dist/cli/{feedback-TGUBVGRP.js → feedback-724QK3Z5.js} +16 -16
- package/dist/cli/{feedback-YGTPJBRJ.mjs → feedback-WWJRIXEU.mjs} +8 -8
- package/dist/cli/git-PHYRD56H.js +25 -0
- package/dist/cli/{git-3DOTQHJO.mjs → git-R5VRG7X6.mjs} +7 -7
- package/dist/cli/index.js +151 -157
- package/dist/cli/index.mjs +51 -57
- package/dist/cli/{legacy-noops-BHEHVFHI.js → legacy-noops-C6GDEGPU.js} +11 -11
- package/dist/cli/{legacy-noops-RBBYRVLG.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
- package/dist/cli/{monitors-XECKLAXA.js → monitors-VAVQ4WCE.js} +125 -122
- package/dist/cli/{monitors-5AJCG6IV.mjs → monitors-WQSKMHAP.mjs} +19 -16
- package/dist/cli/{org-DOBAIYWG.js → org-CWWRWXZQ.js} +89 -89
- package/dist/cli/{org-ZAAIEZKB.mjs → org-MAL4QPVF.mjs} +9 -9
- package/dist/cli/{play-KLYRMQPF.mjs → play-ILW6MSNG.mjs} +174 -80
- package/dist/cli/{play-E74VN6B7.js → play-WJOWK5PQ.js} +690 -596
- package/dist/cli/{providers-XTQXV5LB.mjs → providers-4V2NMLZZ.mjs} +9 -9
- package/dist/cli/{providers-APZ6SOSK.js → providers-W662ANCH.js} +12 -12
- package/dist/cli/{quickstart-S6WN6NWW.js → quickstart-BW6EBUYX.js} +8 -8
- package/dist/cli/{quickstart-X7RHHQCH.mjs → quickstart-C22BR743.mjs} +6 -6
- package/dist/cli/{run-3YLIJJ57.js → run-KW7KW4FX.js} +50 -53
- package/dist/cli/{run-TZPBBSPX.mjs → run-SPAU5IMW.mjs} +31 -34
- package/dist/cli/search-HLE54W5G.js +32 -0
- package/dist/cli/{search-VLHE2CMZ.mjs → search-XPC75HLM.mjs} +10 -11
- package/dist/cli/{search-output-73BYB7UE.mjs → search-output-JKYJSEPM.mjs} +6 -6
- package/dist/cli/{search-output-GCT7PQIT.js → search-output-VJYE7USJ.js} +8 -8
- package/dist/cli/{secrets-RLOTGKQZ.mjs → secrets-OJG73GXQ.mjs} +9 -9
- package/dist/cli/{secrets-J6CEKXKQ.js → secrets-YB57KGSB.js} +18 -18
- package/dist/cli/{sessions-7HZ7OZ62.mjs → sessions-7ZL37BW4.mjs} +8 -8
- package/dist/cli/sessions-VEBYZIEU.js +22 -0
- package/dist/cli/{settings-WRV5XEZC.js → settings-A7DD2ZYE.js} +88 -89
- package/dist/cli/{settings-72K5YCIS.mjs → settings-RKSQB7FA.mjs} +15 -16
- package/dist/cli/{setup-KQFY6WT4.mjs → setup-NXDUTITY.mjs} +11 -12
- package/dist/cli/{setup-QVXWT2EQ.js → setup-S3K5YU62.js} +51 -52
- package/dist/cli/skills-NVQ744CN.js +36 -0
- package/dist/cli/{skills-C3K3E473.mjs → skills-VMFAIDO6.mjs} +9 -10
- package/dist/cli/{tools-4A2OH6MB.mjs → tools-52NTHBSJ.mjs} +20 -21
- package/dist/cli/tools-SBDUL3WB.js +56 -0
- package/dist/cli/update-HHVFZPCV.js +34 -0
- package/dist/cli/{update-BS6USKPR.mjs → update-SAKBEKMV.mjs} +11 -12
- package/dist/cli/{views-WB6GFTRX.mjs → views-ACRV7MD6.mjs} +54 -10
- package/dist/cli/{views-4NZGAXHL.js → views-C3GJOBDG.js} +66 -22
- package/dist/cli/{workflow-2D4WX55R.mjs → workflow-CS22E7TC.mjs} +10 -10
- package/dist/cli/{workflow-L2QTQZYV.js → workflow-ZNWCZEGN.js} +20 -20
- package/dist/{client-DoUVSkqC.d.mts → client-BlLYQDNo.d.mts} +1 -1
- package/dist/{client-DQm56zMs.d.ts → client-DSQlkIDO.d.ts} +1 -1
- package/dist/{client-core-C7KkUIE_.d.ts → client-core-CDwapXy5.d.ts} +167 -108
- package/dist/{client-core-CPlwsC1Q.d.mts → client-core-rX7n2H8U.d.mts} +167 -108
- package/dist/{compiler-manifest-DsxsQP-T.d.mts → compiler-manifest-BHNC4RL-.d.mts} +58 -21
- package/dist/{compiler-manifest-DsxsQP-T.d.ts → compiler-manifest-BHNC4RL-.d.ts} +58 -21
- package/dist/{errors-qdJUVQ3g.d.mts → errors-D7sPXrvB.d.mts} +1 -1
- package/dist/{errors-Bk5h1D-C.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
- package/dist/{index-bL66eHYz.d.ts → index-CQTBHXHr.d.ts} +1 -1
- package/dist/{index-PaupwX1B.d.mts → index-NaDZq2xf.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +15 -15
- package/dist/index.mjs +11 -11
- package/dist/install-integrity.json +131 -132
- package/dist/monitor-fleet-contract.d.mts +17 -11
- package/dist/monitor-fleet-contract.d.ts +17 -11
- package/dist/monitor-fleet-contract.js +3 -3
- package/dist/monitor-fleet-contract.mjs +2 -2
- package/dist/monitor-input-contract.js +2 -2
- package/dist/monitor-input-contract.mjs +1 -1
- 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 +67 -3
- 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 +3 -3
- package/dist/plays/run-request.mjs +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 +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +12 -12
- package/dist/server.mjs +6 -6
- package/package.json +1 -1
- package/dist/cli/auth-UP2RGPI6.js +0 -43
- package/dist/cli/chunk-5LZ5VSOK.mjs +0 -405
- package/dist/cli/chunk-D3J2Y2BP.js +0 -405
- package/dist/cli/describe-CI4MREFF.mjs +0 -50
- package/dist/cli/describe-IVTSD7ST.js +0 -50
- package/dist/cli/git-R3W25XIF.js +0 -25
- package/dist/cli/pages-FUOSF6BE.mjs +0 -266
- package/dist/cli/pages-TLC2N6L7.js +0 -266
- package/dist/cli/search-NB5CBALV.js +0 -33
- package/dist/cli/sessions-SFCZSB77.js +0 -22
- package/dist/cli/skills-WIJEHVLA.js +0 -37
- package/dist/cli/tools-VMMERMLO.js +0 -57
- package/dist/cli/update-54WZQDTS.js +0 -35
|
@@ -195,6 +195,13 @@ export type RuntimeMapHeapSnapshot = {
|
|
|
195
195
|
residentBytes?: number;
|
|
196
196
|
};
|
|
197
197
|
|
|
198
|
+
export type RuntimeMapAdmissionHoldCause =
|
|
199
|
+
| 'unpricedRows'
|
|
200
|
+
| 'width'
|
|
201
|
+
| 'memory'
|
|
202
|
+
| 'eventLoop'
|
|
203
|
+
| 'callSlots';
|
|
204
|
+
|
|
198
205
|
export type RuntimeMapHeapAdmissionSnapshot = {
|
|
199
206
|
activeRows: number;
|
|
200
207
|
activeRowPeak: number;
|
|
@@ -306,6 +313,30 @@ export type RuntimeMapHeapAdmissionSnapshot = {
|
|
|
306
313
|
eventLoopPressureEvents: number;
|
|
307
314
|
/** Row ceiling set by event-loop lag; maxConcurrency when it never lagged. */
|
|
308
315
|
eventLoopCeiling: number;
|
|
316
|
+
/**
|
|
317
|
+
* The per-row reserve the last probe measured while every admitted row was
|
|
318
|
+
* still waiting on a provider (a queued or in-flight call per row) with no
|
|
319
|
+
* body held; null when the prior or the ledger priced rows instead.
|
|
320
|
+
*/
|
|
321
|
+
probedWaitingRowReserveBytes: number | null;
|
|
322
|
+
/**
|
|
323
|
+
* Wall time at least one row waited for admission, and that time by what
|
|
324
|
+
* held it: the unknown full-row prior (`unpricedRows`), a window full of
|
|
325
|
+
* priced rows (`width`), memory or event-loop pressure, or the run's
|
|
326
|
+
* call-slot backlog. Lets a readout state time lost, not only count holds.
|
|
327
|
+
*/
|
|
328
|
+
admissionHoldMs: number;
|
|
329
|
+
admissionHoldMsByCause: Record<RuntimeMapAdmissionHoldCause, number>;
|
|
330
|
+
/**
|
|
331
|
+
* Whether the run's call-slot backlog ever held new rows. From then on,
|
|
332
|
+
* settlement paces admission: each settled row lets in at most
|
|
333
|
+
* `rowsPerSettledRow` more plus its own replacement.
|
|
334
|
+
*/
|
|
335
|
+
limitedByCallSlots: boolean;
|
|
336
|
+
/** Episodes in which that backlog held new rows. */
|
|
337
|
+
callSlotBacklogHolds: number;
|
|
338
|
+
/** Wall time rows waited because that backlog held them. */
|
|
339
|
+
callSlotBacklogHoldMs: number;
|
|
309
340
|
/** The last event-loop lag reading admission acted on, if it had one. */
|
|
310
341
|
eventLoopLagMs: number | null;
|
|
311
342
|
memoryPressureEvents: number;
|
|
@@ -453,6 +484,32 @@ const RUNTIME_MAP_ROW_FOOTPRINT_SAMPLE_MIN_ACTIVE_ROWS_DIVISOR = 4;
|
|
|
453
484
|
// ~490 agent calls queued on a 30-permit lane). Rows keep arriving for as long
|
|
454
485
|
// as rows keep finishing, so a map of any size still runs to completion.
|
|
455
486
|
const RUNTIME_MAP_ROWS_PER_SETTLED_ROW = 4;
|
|
487
|
+
/**
|
|
488
|
+
* Calls already waiting for the run's call slots, in multiples of its slot
|
|
489
|
+
* count, past which a map admits no new row. A row admitted then can only add
|
|
490
|
+
* calls to that queue, while its state, receipt hydration and dispatch work
|
|
491
|
+
* still load the runner: calls-10 at 64 and 256 slots (43305298615) admitted
|
|
492
|
+
* about 800 of 1,000 rows, held 270-400 MB live, and the event-loop and heap
|
|
493
|
+
* pressure that followed stopped new calls for about 44 s. Four slot-counts
|
|
494
|
+
* keep about four call times of work queued, so a new row still reaches
|
|
495
|
+
* dispatch before the queue runs dry.
|
|
496
|
+
*/
|
|
497
|
+
export const RUNTIME_MAP_CALL_SLOT_BACKLOG_MULTIPLE = 4;
|
|
498
|
+
/**
|
|
499
|
+
* Multiple of the live growth a probe measures per admitted row that prices
|
|
500
|
+
* one more waiting row before any row has settled. The unknown full-row prior
|
|
501
|
+
* otherwise charges every waiting row 3 MiB until 16 rows settle, so a map
|
|
502
|
+
* whose calls stay open for minutes never grows past its opening wave:
|
|
503
|
+
* primitives-residence hold-120s (43305298615) sat at 86 rows for 120 s with
|
|
504
|
+
* 102 MB live of a 280 MB target and rows that settled at 5 KB. The probe
|
|
505
|
+
* counts garbage between collections, which errs high; this factor covers the
|
|
506
|
+
* rest. It applies only while no provider body is held and the run's slot
|
|
507
|
+
* queue holds a call for every admitted row, so a body that lands returns
|
|
508
|
+
* every unpriced row to the prior, a probe of rows still reading receipts
|
|
509
|
+
* never prices them, and bodies themselves still pass the byte-admitted
|
|
510
|
+
* response-body gate before they are read.
|
|
511
|
+
*/
|
|
512
|
+
export const RUNTIME_MAP_PROBED_WAITING_ROW_RESERVE_FACTOR = 2;
|
|
456
513
|
|
|
457
514
|
/**
|
|
458
515
|
* The runner's real heap, rather than input JSON size, is the authority for
|
|
@@ -998,6 +1055,17 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
998
1055
|
*/
|
|
999
1056
|
getEventLoopLagMs?: () => number | null;
|
|
1000
1057
|
eventLoopLagHoldMs?: number;
|
|
1058
|
+
/**
|
|
1059
|
+
* The run's call slots: how many calls are waiting for one, and how many
|
|
1060
|
+
* slots the run has. Admission holds new rows while more than
|
|
1061
|
+
* `RUNTIME_MAP_CALL_SLOT_BACKLOG_MULTIPLE` slot-counts of calls wait.
|
|
1062
|
+
*/
|
|
1063
|
+
callSlotBacklog?: () => {
|
|
1064
|
+
waiting: number;
|
|
1065
|
+
slots: number;
|
|
1066
|
+
/** Calls holding a slot; absent, the probed reserve never applies. */
|
|
1067
|
+
inFlight?: number;
|
|
1068
|
+
} | null;
|
|
1001
1069
|
eventLoopAdjustIntervalMs?: number;
|
|
1002
1070
|
/** Publishes the snapshot the watchdog attaches to a memory abort. */
|
|
1003
1071
|
reportLedger?: (snapshot: RuntimeMapHeapAdmissionSnapshot) => void;
|
|
@@ -1178,6 +1246,88 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1178
1246
|
: RUNTIME_MAP_EVENT_LOOP_ADJUST_INTERVAL_MS;
|
|
1179
1247
|
let eventLoopCeiling = maxConcurrency;
|
|
1180
1248
|
let lastEventLoopAdjustAtMs: number | null = null;
|
|
1249
|
+
let probedWaitingRowReserveBytes: number | null = null;
|
|
1250
|
+
let admissionHoldMs = 0;
|
|
1251
|
+
const admissionHoldMsByCause: Record<RuntimeMapAdmissionHoldCause, number> = {
|
|
1252
|
+
unpricedRows: 0,
|
|
1253
|
+
width: 0,
|
|
1254
|
+
memory: 0,
|
|
1255
|
+
eventLoop: 0,
|
|
1256
|
+
callSlots: 0,
|
|
1257
|
+
};
|
|
1258
|
+
let holdCause: RuntimeMapAdmissionHoldCause | null = null;
|
|
1259
|
+
let holdTickAtMs: number | null = null;
|
|
1260
|
+
let limitedByCallSlots = false;
|
|
1261
|
+
let callSlotBacklogHolds = 0;
|
|
1262
|
+
let callSlotBacklogHoldMs = 0;
|
|
1263
|
+
let callSlotBacklogHeldSinceMs: number | null = null;
|
|
1264
|
+
// A held map must not refill its window in one drain when the backlog
|
|
1265
|
+
// clears. Its width kept growing with every row that settled during the
|
|
1266
|
+
// hold, and a row admitted now reaches the slot queue only after its
|
|
1267
|
+
// receipt reads, so the backlog cannot see the refill until it is done:
|
|
1268
|
+
// calls-10 at 64 slots (43328763172) admitted all 744 waiting rows in one
|
|
1269
|
+
// drain, 7,440 receipt hydrations at once, and its event loop lagged 57 s
|
|
1270
|
+
// until receipt persistence gave up. From the first hold on, each settled
|
|
1271
|
+
// row lets in at most `rowsPerSettledRow` more plus its own replacement,
|
|
1272
|
+
// the pace an unheld map's width grows at; a probe adds one row (see
|
|
1273
|
+
// `reconcile`).
|
|
1274
|
+
let settlePacedAdmission = false;
|
|
1275
|
+
let settledAdmissionCredit = 0;
|
|
1276
|
+
// A row admitted while the run's calls already queue for slots can only
|
|
1277
|
+
// lengthen that queue. The last progress row is always admitted.
|
|
1278
|
+
const callSlotsBackedUp = (): boolean => {
|
|
1279
|
+
const backlog = input.callSlotBacklog?.() ?? null;
|
|
1280
|
+
return (
|
|
1281
|
+
backlog !== null &&
|
|
1282
|
+
backlog.slots > 0 &&
|
|
1283
|
+
backlog.waiting > backlog.slots * RUNTIME_MAP_CALL_SLOT_BACKLOG_MULTIPLE
|
|
1284
|
+
);
|
|
1285
|
+
};
|
|
1286
|
+
const trackCallSlotHold = (held: boolean): void => {
|
|
1287
|
+
if (held) {
|
|
1288
|
+
if (callSlotBacklogHeldSinceMs === null) {
|
|
1289
|
+
callSlotBacklogHeldSinceMs = now();
|
|
1290
|
+
callSlotBacklogHolds += 1;
|
|
1291
|
+
limitedByCallSlots = true;
|
|
1292
|
+
}
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
if (callSlotBacklogHeldSinceMs !== null) {
|
|
1296
|
+
callSlotBacklogHoldMs += Math.max(0, now() - callSlotBacklogHeldSinceMs);
|
|
1297
|
+
callSlotBacklogHeldSinceMs = null;
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
// Credit the time since the last tick to what held rows then, and record
|
|
1301
|
+
// what holds them now. Every admission decision ticks, so a cause is never
|
|
1302
|
+
// charged for more than one probe interval past its end.
|
|
1303
|
+
const tickHold = (): void => {
|
|
1304
|
+
const tickAtMs = now();
|
|
1305
|
+
if (holdCause !== null && holdTickAtMs !== null) {
|
|
1306
|
+
const heldMs = Math.max(0, tickAtMs - holdTickAtMs);
|
|
1307
|
+
admissionHoldMs += heldMs;
|
|
1308
|
+
admissionHoldMsByCause[holdCause] += heldMs;
|
|
1309
|
+
}
|
|
1310
|
+
holdTickAtMs = tickAtMs;
|
|
1311
|
+
holdCause =
|
|
1312
|
+
closed || waiters.length === 0
|
|
1313
|
+
? null
|
|
1314
|
+
: admissionPaused
|
|
1315
|
+
? eventLoopPressureActive
|
|
1316
|
+
? 'eventLoop'
|
|
1317
|
+
: 'memory'
|
|
1318
|
+
: callSlotBacklogHeldSinceMs !== null ||
|
|
1319
|
+
(settlePacedAdmission &&
|
|
1320
|
+
settledAdmissionCredit === 0 &&
|
|
1321
|
+
activeRows > 0 &&
|
|
1322
|
+
activeRows < concurrency)
|
|
1323
|
+
? 'callSlots'
|
|
1324
|
+
: activeRows >= concurrency
|
|
1325
|
+
? measuredRowBytes === null &&
|
|
1326
|
+
probedWaitingRowReserveBytes === null
|
|
1327
|
+
? 'unpricedRows'
|
|
1328
|
+
: 'width'
|
|
1329
|
+
: null;
|
|
1330
|
+
};
|
|
1181
1331
|
let memoryPressureEvents = 0;
|
|
1182
1332
|
let closed = false;
|
|
1183
1333
|
let closeError: unknown = null;
|
|
@@ -1292,6 +1442,31 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1292
1442
|
eventLoopPressureEvents,
|
|
1293
1443
|
eventLoopCeiling,
|
|
1294
1444
|
eventLoopLagMs,
|
|
1445
|
+
probedWaitingRowReserveBytes,
|
|
1446
|
+
...(() => {
|
|
1447
|
+
const openMs =
|
|
1448
|
+
holdCause === null || holdTickAtMs === null
|
|
1449
|
+
? 0
|
|
1450
|
+
: Math.max(0, now() - holdTickAtMs);
|
|
1451
|
+
return {
|
|
1452
|
+
admissionHoldMs: admissionHoldMs + openMs,
|
|
1453
|
+
admissionHoldMsByCause: {
|
|
1454
|
+
...admissionHoldMsByCause,
|
|
1455
|
+
...(holdCause === null
|
|
1456
|
+
? {}
|
|
1457
|
+
: {
|
|
1458
|
+
[holdCause]: admissionHoldMsByCause[holdCause] + openMs,
|
|
1459
|
+
}),
|
|
1460
|
+
},
|
|
1461
|
+
};
|
|
1462
|
+
})(),
|
|
1463
|
+
limitedByCallSlots,
|
|
1464
|
+
callSlotBacklogHolds,
|
|
1465
|
+
callSlotBacklogHoldMs:
|
|
1466
|
+
callSlotBacklogHoldMs +
|
|
1467
|
+
(callSlotBacklogHeldSinceMs === null
|
|
1468
|
+
? 0
|
|
1469
|
+
: Math.max(0, now() - callSlotBacklogHeldSinceMs)),
|
|
1295
1470
|
};
|
|
1296
1471
|
};
|
|
1297
1472
|
|
|
@@ -1300,6 +1475,19 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1300
1475
|
allowWhilePaused = false,
|
|
1301
1476
|
) => {
|
|
1302
1477
|
let admissions = 0;
|
|
1478
|
+
const backedUp = waiters.length > 0 && callSlotsBackedUp();
|
|
1479
|
+
trackCallSlotHold(
|
|
1480
|
+
backedUp &&
|
|
1481
|
+
!admissionPaused &&
|
|
1482
|
+
activeRows > 0 &&
|
|
1483
|
+
activeRows < concurrency,
|
|
1484
|
+
);
|
|
1485
|
+
if (backedUp && activeRows > 0) {
|
|
1486
|
+
// From the first hold on, settlement paces admission, and a hold spends
|
|
1487
|
+
// whatever settlement credit it finds instead of banking it.
|
|
1488
|
+
settlePacedAdmission = true;
|
|
1489
|
+
settledAdmissionCredit = 0;
|
|
1490
|
+
}
|
|
1303
1491
|
while (
|
|
1304
1492
|
!closed &&
|
|
1305
1493
|
// A pressure pause retains exactly one progress row after the active
|
|
@@ -1307,12 +1495,18 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1307
1495
|
// noticed the zero width, so make the allowance in drain rather than
|
|
1308
1496
|
// relying on a waiter already existing at that instant.
|
|
1309
1497
|
(allowWhilePaused || !admissionPaused || activeRows === 0) &&
|
|
1498
|
+
(!backedUp || activeRows === 0) &&
|
|
1499
|
+
(!settlePacedAdmission ||
|
|
1500
|
+
activeRows === 0 ||
|
|
1501
|
+
settledAdmissionCredit > 0) &&
|
|
1310
1502
|
admissions < maximumAdmissions &&
|
|
1311
1503
|
activeRows < concurrency &&
|
|
1312
1504
|
waiters.length > 0
|
|
1313
1505
|
) {
|
|
1314
1506
|
const waiter = waiters.shift();
|
|
1315
1507
|
if (!waiter) return;
|
|
1508
|
+
if (activeRows > 0 && settledAdmissionCredit > 0)
|
|
1509
|
+
settledAdmissionCredit -= 1;
|
|
1316
1510
|
activeRows += 1;
|
|
1317
1511
|
activeRowPeak = Math.max(activeRowPeak, activeRows);
|
|
1318
1512
|
admittedRows += 1;
|
|
@@ -1324,6 +1518,8 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1324
1518
|
released = true;
|
|
1325
1519
|
activeRows = Math.max(0, activeRows - 1);
|
|
1326
1520
|
settledRows += 1;
|
|
1521
|
+
if (settlePacedAdmission)
|
|
1522
|
+
settledAdmissionCredit = rowsPerSettledRow + 1;
|
|
1327
1523
|
// Re-pricing here is deliberate and load-bearing: a settling row is
|
|
1328
1524
|
// the only evidence the ledger gets about what a row of this shape
|
|
1329
1525
|
// actually cost, and `probeIntervalMs` may be far longer than a row
|
|
@@ -1334,9 +1530,12 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1334
1530
|
},
|
|
1335
1531
|
});
|
|
1336
1532
|
}
|
|
1533
|
+
tickHold();
|
|
1337
1534
|
};
|
|
1338
1535
|
|
|
1339
1536
|
const pauseAdmission = () => {
|
|
1537
|
+
// Memory or event-loop pressure is the hold from here, not the backlog.
|
|
1538
|
+
trackCallSlotHold(false);
|
|
1340
1539
|
externalExecutionPressure = true;
|
|
1341
1540
|
admissionHolds += 1;
|
|
1342
1541
|
admissionPaused = true;
|
|
@@ -1714,7 +1913,42 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1714
1913
|
// per-row peak scaled by its calibration factor, or the unmeasured prior
|
|
1715
1914
|
// until enough rows have settled to state one. It is floored so a run of
|
|
1716
1915
|
// light rows cannot authorize a launch wave for a heavy one.
|
|
1717
|
-
|
|
1916
|
+
// Before 16 rows have settled the reserve is the unknown full-row prior.
|
|
1917
|
+
// While no provider body is held anywhere and the slot queue holds at
|
|
1918
|
+
// least one call per admitted row, those rows have done their receipt
|
|
1919
|
+
// reads and are waiting on providers, and what they cost is in the probe:
|
|
1920
|
+
// price the next one by that measurement, times a safety factor, instead.
|
|
1921
|
+
// A probe taken before rows queue their calls measures rows that have
|
|
1922
|
+
// done nothing yet: calls-10 (43328763172) opened 256 rows on such a
|
|
1923
|
+
// probe instead of the prior's 86, and 2,560 receipt hydrations at once
|
|
1924
|
+
// lagged the event loop 7-12 s before the first call left.
|
|
1925
|
+
const providerBodiesHeld =
|
|
1926
|
+
(memorySnapshot?.bytesByCategory.providerBody ?? 0) > 0;
|
|
1927
|
+
const slotBacklog = activeRows > 0 ? input.callSlotBacklog?.() : null;
|
|
1928
|
+
const admittedRowsQueuedCalls =
|
|
1929
|
+
slotBacklog?.inFlight !== undefined &&
|
|
1930
|
+
slotBacklog.waiting + slotBacklog.inFlight >= activeRows;
|
|
1931
|
+
probedWaitingRowReserveBytes =
|
|
1932
|
+
providerBodyReservationDeferred &&
|
|
1933
|
+
memorySnapshot !== null &&
|
|
1934
|
+
occupancy.measuredOwnerBytes === null &&
|
|
1935
|
+
!providerBodiesHeld &&
|
|
1936
|
+
admittedRowsQueuedCalls &&
|
|
1937
|
+
activeRows > 0
|
|
1938
|
+
? Math.min(
|
|
1939
|
+
defaultRowReserveBytes,
|
|
1940
|
+
Math.max(
|
|
1941
|
+
waitingRowReserveBytes ?? rowReserveMinBytes,
|
|
1942
|
+
Math.ceil(
|
|
1943
|
+
(Math.max(0, reading.liveBytes - reading.liveBaselineBytes) /
|
|
1944
|
+
activeRows) *
|
|
1945
|
+
RUNTIME_MAP_PROBED_WAITING_ROW_RESERVE_FACTOR,
|
|
1946
|
+
),
|
|
1947
|
+
),
|
|
1948
|
+
)
|
|
1949
|
+
: null;
|
|
1950
|
+
rowReserveBytes =
|
|
1951
|
+
probedWaitingRowReserveBytes ?? reserveForAdmittedRow(occupancy);
|
|
1718
1952
|
// Rows already admitted may not have shown their bodies yet. Charge them
|
|
1719
1953
|
// the reserve minus whatever growth occupancy already reflects, so a
|
|
1720
1954
|
// static reading between probes cannot be mistaken for free headroom.
|
|
@@ -1735,9 +1969,15 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1735
1969
|
|
|
1736
1970
|
const reconcile = () => {
|
|
1737
1971
|
if (closed) return;
|
|
1972
|
+
// A paced map still admits one row per probe once its backlog clears, so
|
|
1973
|
+
// rows that settle slowly cannot strand it. A probe runs at most every
|
|
1974
|
+
// probe interval and slows with the event loop, so this cannot burst.
|
|
1975
|
+
if (settlePacedAdmission)
|
|
1976
|
+
settledAdmissionCredit = Math.max(settledAdmissionCredit, 1);
|
|
1738
1977
|
try {
|
|
1739
1978
|
reconcileState();
|
|
1740
1979
|
} finally {
|
|
1980
|
+
tickHold();
|
|
1741
1981
|
// Only a current complete healthy observation may clear a known hold.
|
|
1742
1982
|
if (
|
|
1743
1983
|
admissionPaused ||
|
|
@@ -1823,6 +2063,10 @@ export function createRuntimeMapHeapAdmission(input: {
|
|
|
1823
2063
|
},
|
|
1824
2064
|
close(error) {
|
|
1825
2065
|
if (!closed) {
|
|
2066
|
+
tickHold();
|
|
2067
|
+
holdCause = null;
|
|
2068
|
+
// A closed map holds no row, so an open backlog hold ends here too.
|
|
2069
|
+
trackCallSlotHold(false);
|
|
1826
2070
|
closed = true;
|
|
1827
2071
|
closeError = error ?? new Error('Runtime map row admission is closed.');
|
|
1828
2072
|
clearInterval(timer);
|
|
@@ -1941,14 +2185,110 @@ type RuntimeMapRowsTrackerInput = {
|
|
|
1941
2185
|
budgetBytes?: number;
|
|
1942
2186
|
};
|
|
1943
2187
|
|
|
2188
|
+
/** What `track` charged one row, which `release` takes back. */
|
|
2189
|
+
export type RuntimeMapTrackedRow = {
|
|
2190
|
+
serializedBytes: number;
|
|
2191
|
+
residentBytes: number;
|
|
2192
|
+
};
|
|
2193
|
+
|
|
1944
2194
|
type RuntimeMapRowsTracker = {
|
|
1945
|
-
track(row: unknown):
|
|
2195
|
+
track(row: unknown): RuntimeMapTrackedRow;
|
|
2196
|
+
/**
|
|
2197
|
+
* Stop charging a row `track` returned, once nothing retains it. The
|
|
2198
|
+
* largest row seen stays: it describes what was tracked, not what is held.
|
|
2199
|
+
*/
|
|
2200
|
+
release(tracked: RuntimeMapTrackedRow): void;
|
|
1946
2201
|
estimate(): RuntimeMapMemoryEstimate;
|
|
1947
2202
|
};
|
|
1948
2203
|
|
|
2204
|
+
/*
|
|
2205
|
+
* What a completed row costs while a map retains it for its caller's result,
|
|
2206
|
+
* priced from its structure rather than as a multiple of its JSON length.
|
|
2207
|
+
*
|
|
2208
|
+
* Retained rows were charged serialized bytes x 4 + 512. Measured on Node 24.19
|
|
2209
|
+
* and 22.22 (2,000-3,000 rows parsed from JSON and retained as
|
|
2210
|
+
* { key, inputIndex, data } with every value distinct, heap after a full
|
|
2211
|
+
* collection; scripts/benchmark-retained-map-row-resident.mjs), that
|
|
2212
|
+
* charge read 4.00x the resident bytes of a load-heavy-play row, 3.53x a
|
|
2213
|
+
* 40-field CRM upsert and 3.35x a 13 KB nested profile, yet only 0.95x a row
|
|
2214
|
+
* of 150 doubles and 0.74x a 400-field row: one multiplier cannot bound both,
|
|
2215
|
+
* because V8 boxes a double property in a 16-byte HeapNumber, stores a wide
|
|
2216
|
+
* object's properties in a dictionary at 40-60 bytes each against about 8 in
|
|
2217
|
+
* fast mode, and stores a numeric array unboxed at 8 bytes an element.
|
|
2218
|
+
*
|
|
2219
|
+
* In Production the gap held maps shut. The 5,000-row engagers maps of
|
|
2220
|
+
* linkedin-engager-profile-backfill (2026-11-12) carried 204-229 MB of that
|
|
2221
|
+
* charge at their collected live peak while everything the process held
|
|
2222
|
+
* above baseline was 119-139 MB, so ledger occupancy sat over the heap
|
|
2223
|
+
* target with live memory near half of it, and they ran 996-4,757 s.
|
|
2224
|
+
*
|
|
2225
|
+
* Priced this way and scaled by RETAINED_ROW_SAFETY_FACTOR, every measured
|
|
2226
|
+
* shape reads 1.10-3.10x its resident bytes on both versions, never below
|
|
2227
|
+
* it: 1.15x the load-heavy-play row, 1.21x the CRM upsert, 1.32x the
|
|
2228
|
+
* profile, 1.15x the 400-field row, 1.52x the 150 doubles, and at most 3.10x
|
|
2229
|
+
* a row of 200 tiny nested objects.
|
|
2230
|
+
*/
|
|
2231
|
+
const RETAINED_STRING_HEADER_BYTES = 24;
|
|
2232
|
+
const RETAINED_HEAP_NUMBER_BYTES = 16;
|
|
2233
|
+
const RETAINED_CONTAINER_BYTES = 64;
|
|
2234
|
+
const RETAINED_ELEMENT_BYTES = 16;
|
|
2235
|
+
const RETAINED_NUMBER_ELEMENT_BYTES = 8;
|
|
2236
|
+
const RETAINED_FAST_PROPERTY_BYTES = 16;
|
|
2237
|
+
const RETAINED_DICTIONARY_PROPERTY_BYTES = 64;
|
|
2238
|
+
/** Own keys past which a parsed object is priced as a dictionary. */
|
|
2239
|
+
const RETAINED_DICTIONARY_PROPERTY_COUNT = 64;
|
|
2240
|
+
const RETAINED_ROW_SAFETY_FACTOR = 1.1;
|
|
2241
|
+
const SMI_LIMIT = 2 ** 30;
|
|
2242
|
+
const TWO_BYTE_CHARACTER = /[^\u0000-\u00ff]/;
|
|
2243
|
+
|
|
2244
|
+
/**
|
|
2245
|
+
* Estimated V8 heap bytes one retained row holds when nothing else shares
|
|
2246
|
+
* its values: an upper bound for every row shape measured above.
|
|
2247
|
+
*/
|
|
2248
|
+
export function estimateRuntimeMapRetainedRowBytes(row: unknown): number {
|
|
2249
|
+
let bytes = 0;
|
|
2250
|
+
const pending: unknown[] = [row];
|
|
2251
|
+
while (pending.length > 0) {
|
|
2252
|
+
const value = pending.pop();
|
|
2253
|
+
if (typeof value === 'string') {
|
|
2254
|
+
bytes +=
|
|
2255
|
+
RETAINED_STRING_HEADER_BYTES +
|
|
2256
|
+
value.length * (TWO_BYTE_CHARACTER.test(value) ? 2 : 1);
|
|
2257
|
+
} else if (typeof value === 'number') {
|
|
2258
|
+
if (
|
|
2259
|
+
!(Number.isInteger(value) && value >= -SMI_LIMIT && value < SMI_LIMIT)
|
|
2260
|
+
)
|
|
2261
|
+
bytes += RETAINED_HEAP_NUMBER_BYTES;
|
|
2262
|
+
} else if (ArrayBuffer.isView(value)) {
|
|
2263
|
+
bytes += RETAINED_CONTAINER_BYTES + value.byteLength;
|
|
2264
|
+
} else if (Array.isArray(value)) {
|
|
2265
|
+
if (value.every((element) => typeof element === 'number')) {
|
|
2266
|
+
bytes +=
|
|
2267
|
+
RETAINED_CONTAINER_BYTES +
|
|
2268
|
+
RETAINED_NUMBER_ELEMENT_BYTES * value.length;
|
|
2269
|
+
} else {
|
|
2270
|
+
bytes +=
|
|
2271
|
+
RETAINED_CONTAINER_BYTES + RETAINED_ELEMENT_BYTES * value.length;
|
|
2272
|
+
for (const element of value) pending.push(element);
|
|
2273
|
+
}
|
|
2274
|
+
} else if (value !== null && typeof value === 'object') {
|
|
2275
|
+
const properties = Object.values(value);
|
|
2276
|
+
bytes +=
|
|
2277
|
+
RETAINED_CONTAINER_BYTES +
|
|
2278
|
+
properties.length *
|
|
2279
|
+
(properties.length > RETAINED_DICTIONARY_PROPERTY_COUNT
|
|
2280
|
+
? RETAINED_DICTIONARY_PROPERTY_BYTES
|
|
2281
|
+
: RETAINED_FAST_PROPERTY_BYTES);
|
|
2282
|
+
for (const property of properties) pending.push(property);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
return Math.ceil(bytes * RETAINED_ROW_SAFETY_FACTOR);
|
|
2286
|
+
}
|
|
2287
|
+
|
|
1949
2288
|
function createRuntimeMapRowsTracker(
|
|
1950
2289
|
input: RuntimeMapRowsTrackerInput,
|
|
1951
2290
|
phase: 'materialize' | 'retained_rows',
|
|
2291
|
+
residentBytesOf: (row: unknown, serializedBytes: number) => number,
|
|
1952
2292
|
): RuntimeMapRowsTracker {
|
|
1953
2293
|
const budgetBytes = positiveBudget(
|
|
1954
2294
|
input.budgetBytes,
|
|
@@ -1957,18 +2297,21 @@ function createRuntimeMapRowsTracker(
|
|
|
1957
2297
|
let rowCount = 0;
|
|
1958
2298
|
let serializedBytes = 0;
|
|
1959
2299
|
let largestRowBytes = 0;
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2300
|
+
let estimatedResidentBytes = 0;
|
|
2301
|
+
const estimate = (): RuntimeMapMemoryEstimate => ({
|
|
2302
|
+
rowCount,
|
|
2303
|
+
serializedBytes,
|
|
2304
|
+
largestRowBytes,
|
|
2305
|
+
estimatedResidentBytes,
|
|
2306
|
+
});
|
|
1966
2307
|
return {
|
|
1967
2308
|
track(row) {
|
|
1968
2309
|
const rowBytes = runtimeMapJsonByteLength(row);
|
|
2310
|
+
const residentBytes = residentBytesOf(row, rowBytes);
|
|
1969
2311
|
rowCount += 1;
|
|
1970
2312
|
serializedBytes += rowBytes;
|
|
1971
2313
|
largestRowBytes = Math.max(largestRowBytes, rowBytes);
|
|
2314
|
+
estimatedResidentBytes += residentBytes;
|
|
1972
2315
|
const current = estimate();
|
|
1973
2316
|
if (current.estimatedResidentBytes > budgetBytes) {
|
|
1974
2317
|
throw new RuntimeMapMemoryLimitError({
|
|
@@ -1978,19 +2321,38 @@ function createRuntimeMapRowsTracker(
|
|
|
1978
2321
|
budgetBytes,
|
|
1979
2322
|
});
|
|
1980
2323
|
}
|
|
2324
|
+
return { serializedBytes: rowBytes, residentBytes };
|
|
2325
|
+
},
|
|
2326
|
+
release(tracked) {
|
|
2327
|
+
rowCount = Math.max(0, rowCount - 1);
|
|
2328
|
+
serializedBytes = Math.max(0, serializedBytes - tracked.serializedBytes);
|
|
2329
|
+
estimatedResidentBytes = Math.max(
|
|
2330
|
+
0,
|
|
2331
|
+
estimatedResidentBytes - tracked.residentBytes,
|
|
2332
|
+
);
|
|
1981
2333
|
},
|
|
1982
2334
|
estimate,
|
|
1983
2335
|
};
|
|
1984
2336
|
}
|
|
1985
2337
|
|
|
2338
|
+
/** Input rows a map materializes, priced as before: serialized x 4 + 512. */
|
|
1986
2339
|
export function createRuntimeMapMaterializationTracker(
|
|
1987
2340
|
input: RuntimeMapRowsTrackerInput,
|
|
1988
2341
|
): RuntimeMapRowsTracker {
|
|
1989
|
-
return createRuntimeMapRowsTracker(
|
|
2342
|
+
return createRuntimeMapRowsTracker(
|
|
2343
|
+
input,
|
|
2344
|
+
'materialize',
|
|
2345
|
+
(_row, serializedBytes) =>
|
|
2346
|
+
serializedBytes * NODE_RUNTIME_MAP_MATERIALIZED_MEMORY_MULTIPLIER +
|
|
2347
|
+
NODE_RUNTIME_MAP_ROW_OVERHEAD_BYTES,
|
|
2348
|
+
);
|
|
1990
2349
|
}
|
|
1991
2350
|
|
|
2351
|
+
/** Completed rows a map retains for its result, priced by their structure. */
|
|
1992
2352
|
export function createRuntimeMapRetainedRowsTracker(
|
|
1993
2353
|
input: RuntimeMapRowsTrackerInput,
|
|
1994
2354
|
): RuntimeMapRowsTracker {
|
|
1995
|
-
return createRuntimeMapRowsTracker(input, 'retained_rows')
|
|
2355
|
+
return createRuntimeMapRowsTracker(input, 'retained_rows', (row) =>
|
|
2356
|
+
estimateRuntimeMapRetainedRowBytes(row),
|
|
2357
|
+
);
|
|
1996
2358
|
}
|
|
@@ -84,6 +84,15 @@ export const RUNTIME_MEMORY_LEDGER_OBJECT_PRIOR_FACTOR = 3;
|
|
|
84
84
|
export const RUNTIME_MEMORY_LEDGER_RAW_PRIOR_FACTOR = 1.1;
|
|
85
85
|
/** A two-byte string of a one-byte payload is the worst honest text reading. */
|
|
86
86
|
export const RUNTIME_MEMORY_LEDGER_RAW_MAX_FACTOR = 2.5;
|
|
87
|
+
/**
|
|
88
|
+
* A category that registers its own resident-byte estimate rather than a
|
|
89
|
+
* serialized length. That estimate already prices the object graph, so a
|
|
90
|
+
* factor above 1 would charge the expansion twice: retained map rows at the
|
|
91
|
+
* object prior of 3 opened at 12x their JSON length, and in the maps that held
|
|
92
|
+
* admission in Production (linkedin-engager-profile-backfill, 2026-11-12) the
|
|
93
|
+
* probe had driven that category's factor to the floor of 1.
|
|
94
|
+
*/
|
|
95
|
+
export const RUNTIME_MEMORY_LEDGER_RESIDENT_PRIOR_FACTOR = 1;
|
|
87
96
|
/**
|
|
88
97
|
* A category must own at least this share of the current prediction before a
|
|
89
98
|
* sample is allowed to move its factor. One heap reading is one equation in
|
|
@@ -133,9 +142,13 @@ export const RUNTIME_MEMORY_LEDGER_CATEGORY_EXPANSION: Record<
|
|
|
133
142
|
min: RUNTIME_MEMORY_LEDGER_MIN_FACTOR,
|
|
134
143
|
max: RUNTIME_MEMORY_LEDGER_MAX_FACTOR,
|
|
135
144
|
},
|
|
136
|
-
// Rows the caller will read
|
|
145
|
+
// Rows the caller will read. Unlike the other categories this one registers
|
|
146
|
+
// an estimate of resident bytes, not a serialized length
|
|
147
|
+
// (`estimateRuntimeMapRetainedRowBytes`, an upper bound for every measured
|
|
148
|
+
// row shape), so it opens at 1 rather than multiplying that estimate by the
|
|
149
|
+
// object prior again. The probe may still raise it.
|
|
137
150
|
materializedRows: {
|
|
138
|
-
prior:
|
|
151
|
+
prior: RUNTIME_MEMORY_LEDGER_RESIDENT_PRIOR_FACTOR,
|
|
139
152
|
min: RUNTIME_MEMORY_LEDGER_MIN_FACTOR,
|
|
140
153
|
max: RUNTIME_MEMORY_LEDGER_MAX_FACTOR,
|
|
141
154
|
},
|
|
@@ -402,6 +402,8 @@ export type LedgerTerminalResultRef = {
|
|
|
402
402
|
responsePreview?: LedgerStoredRunOutputPreview;
|
|
403
403
|
/** Failure ownership retained when the full failed result is out of line. */
|
|
404
404
|
failure?: LedgerTerminalFailureSummary;
|
|
405
|
+
/** The Play explicitly declined an MCP completion notification. */
|
|
406
|
+
suppressMcpCompletionEvent?: true;
|
|
405
407
|
};
|
|
406
408
|
|
|
407
409
|
export const LEDGER_TERMINAL_RESULT_STORED_WARNING =
|
|
@@ -1175,6 +1177,18 @@ export function isLedgerTerminalResultRef(
|
|
|
1175
1177
|
);
|
|
1176
1178
|
}
|
|
1177
1179
|
|
|
1180
|
+
/** A top-level boolean decision is independent of the output preview budget. */
|
|
1181
|
+
export function shouldSuppressMcpCompletionEvent(value: unknown): boolean {
|
|
1182
|
+
if (isLedgerTerminalResultRef(value)) {
|
|
1183
|
+
return value.suppressMcpCompletionEvent === true;
|
|
1184
|
+
}
|
|
1185
|
+
return (
|
|
1186
|
+
isPlainObject(value) &&
|
|
1187
|
+
Object.hasOwn(value, 'notifyWork') &&
|
|
1188
|
+
value.notifyWork === false
|
|
1189
|
+
);
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1178
1192
|
export function stripReplayOnlyTerminalResult(value: unknown): unknown {
|
|
1179
1193
|
if (!isPlainObject(value) || isLedgerTerminalResultRef(value)) return value;
|
|
1180
1194
|
const stripped: Record<string, unknown> = {};
|
|
@@ -1216,6 +1230,7 @@ function ledgerTerminalResultRef(
|
|
|
1216
1230
|
preview?: BoundedRunListOutputPreview;
|
|
1217
1231
|
responsePreview?: LedgerStoredRunOutputPreview;
|
|
1218
1232
|
failure?: LedgerTerminalFailureSummary;
|
|
1233
|
+
suppressMcpCompletionEvent?: true;
|
|
1219
1234
|
} = {},
|
|
1220
1235
|
): LedgerTerminalResultRef {
|
|
1221
1236
|
return {
|
|
@@ -1231,6 +1246,9 @@ function ledgerTerminalResultRef(
|
|
|
1231
1246
|
? { responsePreview: options.responsePreview }
|
|
1232
1247
|
: {}),
|
|
1233
1248
|
...(options.failure ? { failure: options.failure } : {}),
|
|
1249
|
+
...(options.suppressMcpCompletionEvent
|
|
1250
|
+
? { suppressMcpCompletionEvent: true }
|
|
1251
|
+
: {}),
|
|
1234
1252
|
warning: options.content
|
|
1235
1253
|
? LEDGER_TERMINAL_RESULT_STORED_WARNING
|
|
1236
1254
|
: LEDGER_TERMINAL_RESULT_OMITTED_WARNING,
|
|
@@ -1347,6 +1365,9 @@ export function ledgerTerminalResultRefForValue(
|
|
|
1347
1365
|
preview,
|
|
1348
1366
|
responsePreview,
|
|
1349
1367
|
failure,
|
|
1368
|
+
...(shouldSuppressMcpCompletionEvent(value)
|
|
1369
|
+
? { suppressMcpCompletionEvent: true }
|
|
1370
|
+
: {}),
|
|
1350
1371
|
});
|
|
1351
1372
|
}
|
|
1352
1373
|
|
|
@@ -10,6 +10,7 @@ const RESULT_COLUMNS = {
|
|
|
10
10
|
'company-to-job-postings': 'job_postings',
|
|
11
11
|
'company-to-news': 'news_events',
|
|
12
12
|
'company-to-tech-stack': 'technologies',
|
|
13
|
+
'find-professional': 'person_name',
|
|
13
14
|
'name-and-domain-to-email-waterfall': 'email',
|
|
14
15
|
'person-linkedin-to-company': 'company_domain',
|
|
15
16
|
'person-linkedin-to-email': 'email',
|
|
@@ -19,7 +20,6 @@ const RESULT_COLUMNS = {
|
|
|
19
20
|
'person-to-phone': 'phone',
|
|
20
21
|
'personal-email': 'personal_email',
|
|
21
22
|
'personal-email-to-linkedin': 'linkedin_url',
|
|
22
|
-
'professional-to-email': 'email',
|
|
23
23
|
'smb-business-email': 'email',
|
|
24
24
|
} as const;
|
|
25
25
|
|
|
@@ -62,6 +62,12 @@ export type PlayRunnerRateStateAcquireInput = {
|
|
|
62
62
|
export type PlayRunnerRateStateConcurrencyObservation = {
|
|
63
63
|
kind: 'success' | 'throttled';
|
|
64
64
|
latencyMs: number;
|
|
65
|
+
/**
|
|
66
|
+
* The permit's server-authored `inFlightAtStart`. Optional: older runners
|
|
67
|
+
* omit it, and older receivers ignore it. A receiver that reads it lets a
|
|
68
|
+
* success grow the learned limit only when the call ran near that limit.
|
|
69
|
+
*/
|
|
70
|
+
inFlightAtStart?: number;
|
|
65
71
|
};
|
|
66
72
|
|
|
67
73
|
export type PlayRunnerRateStateConcurrencyObservationBatch = {
|
|
@@ -99,6 +99,7 @@ export function simulateFixtureCapacityDiscovery(
|
|
|
99
99
|
concurrency: providerConcurrencyControllerOptions({
|
|
100
100
|
initialLimit: initialConcurrency,
|
|
101
101
|
maximumLimit: maximumExplorationConcurrency,
|
|
102
|
+
unknownProvider: true,
|
|
102
103
|
}),
|
|
103
104
|
});
|
|
104
105
|
const pending: number[] = Array.from(
|