deepline 0.3.501 → 0.3.503
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 +26 -0
- package/dist/bundling-sources/sdk/src/index.ts +1 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +9 -0
- package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +0 -8
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +174 -0
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +20 -2
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +20 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +62 -2
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +667 -62
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +55 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +29 -14
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +20 -2
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +46 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execution-gateway-invocation-fence.ts +80 -4
- package/dist/bundling-sources/shared_libs/play-runtime/fixture-egress-fetch.ts +95 -0
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +292 -45
- package/dist/bundling-sources/shared_libs/play-runtime/internal-bootstrap-token.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +7 -3
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +31 -1
- package/dist/bundling-sources/shared_libs/play-runtime/post-code-recovery-policy.ts +231 -0
- package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +264 -0
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ending-event.ts +55 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +126 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +70 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +2 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +51 -19
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +9 -4
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-authority.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-gateway-oidc.ts +30 -8
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +42 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +26 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +13 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +53 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +631 -19
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-inventory.ts +719 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +206 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/latest-cache-result.ts +83 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1453 -160
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +61 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +29 -8
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +27 -2
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +45 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +129 -14
- package/dist/bundling-sources/shared_libs/play-runtime/workflow-executor-auth.ts +2 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +10 -1
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +2 -0
- package/dist/cli/{auth-6ECHXOI4.mjs → auth-IC4WLSE3.mjs} +5 -5
- package/dist/cli/auth-ZCMSXZO4.js +43 -0
- package/dist/cli/{billing-75NZYRXA.mjs → billing-2VOV64SD.mjs} +6 -6
- package/dist/cli/{billing-QRR7O6BD.js → billing-LWQOII22.js} +79 -79
- package/dist/cli/{chunk-N2TJJNCW.js → chunk-2626LTU3.js} +291 -273
- package/dist/cli/{chunk-VL72UKNW.js → chunk-26RSSTCF.js} +26 -26
- package/dist/cli/{chunk-HDKXSHGA.js → chunk-2K2QBLYO.js} +53 -53
- package/dist/cli/{chunk-463ZOO2L.js → chunk-33JUK73X.js} +7 -7
- package/dist/cli/{chunk-KTOAJP4N.js → chunk-3CXHK4TW.js} +10 -10
- package/dist/cli/{chunk-YPTZJ7LO.js → chunk-4IIYSBEP.js} +70 -13
- package/dist/cli/{chunk-VTDAJZIJ.mjs → chunk-5GI6NKOE.mjs} +20 -1
- package/dist/cli/{chunk-TFFJ2PRN.mjs → chunk-5M5WSFRZ.mjs} +70 -13
- package/dist/cli/{chunk-5S7MLAI7.mjs → chunk-6XTE6C3W.mjs} +41 -23
- package/dist/cli/{chunk-7L6QNHUL.mjs → chunk-7HEDCIR3.mjs} +1 -1
- package/dist/cli/{chunk-C5R3UH5V.mjs → chunk-7MJYZ33I.mjs} +2 -6
- package/dist/cli/{chunk-TOE7LHEA.js → chunk-A2C6ONWA.js} +6 -6
- package/dist/cli/{chunk-QQ3JJYE2.js → chunk-AARF4SOW.js} +17 -13
- package/dist/cli/{chunk-APAHMCGR.js → chunk-B3X4YWQ6.js} +53 -53
- package/dist/cli/{chunk-J74N375S.mjs → chunk-BI2Q45SY.mjs} +4 -4
- package/dist/cli/{chunk-GBICEYUA.js → chunk-BN5VKY4X.js} +141 -20
- package/dist/cli/{chunk-UR7JOSLT.js → chunk-C5RQTTLP.js} +26 -7
- package/dist/cli/{chunk-ZUOKIBLJ.mjs → chunk-D27HP3HS.mjs} +2 -2
- package/dist/cli/{chunk-UJRN6YP6.mjs → chunk-DPI5OYVU.mjs} +10 -6
- package/dist/cli/{chunk-MSLXAVVK.mjs → chunk-EDMV4JT5.mjs} +2 -2
- package/dist/cli/{chunk-ZUQHQGC5.mjs → chunk-EQ3WMKFY.mjs} +5 -5
- package/dist/cli/{chunk-5X4AUFYW.js → chunk-F73PD2XD.js} +7 -7
- package/dist/cli/{chunk-O3DDVP7Z.mjs → chunk-FHJ54BHH.mjs} +2 -2
- package/dist/cli/{chunk-SV2TEZ2M.js → chunk-FIUTDSJX.js} +5 -4
- package/dist/cli/{chunk-W6JTHVPF.js → chunk-FVDTERO2.js} +21 -21
- package/dist/cli/{chunk-CJJ7JBM2.js → chunk-FZHOWPSN.js} +23 -21
- package/dist/cli/{chunk-WJUDAHIQ.mjs → chunk-GIHNEYBG.mjs} +1 -1
- package/dist/cli/{chunk-V5NHEYU7.mjs → chunk-GLZBFBJS.mjs} +5 -5
- package/dist/cli/{chunk-VVEMPC2I.js → chunk-HRTDCXHI.js} +2 -2
- package/dist/cli/{chunk-BOFCF4L7.js → chunk-HS63YBT5.js} +3 -3
- package/dist/cli/{chunk-4OXHLTCP.js → chunk-IIP46RVC.js} +1 -1
- package/dist/cli/{chunk-SAW3FBCA.mjs → chunk-ITJ7NB2D.mjs} +6 -0
- package/dist/cli/{chunk-NA3J3F2Z.mjs → chunk-J6RBOLK7.mjs} +1 -1
- package/dist/cli/{chunk-PXIF74UJ.mjs → chunk-JJVN7OIX.mjs} +4 -4
- package/dist/cli/{chunk-T7E3XEPG.mjs → chunk-JPDD4Y53.mjs} +10 -8
- package/dist/cli/{chunk-OKOXB3LY.mjs → chunk-K7NFFQFU.mjs} +2 -2
- package/dist/cli/{chunk-66XDYH5T.mjs → chunk-KGLVATEB.mjs} +2 -2
- package/dist/cli/{chunk-EHVFBD36.mjs → chunk-KPBBT6OS.mjs} +2 -1
- package/dist/cli/{chunk-MADTHS56.mjs → chunk-L3TZV625.mjs} +1 -1
- package/dist/cli/{chunk-FS7XYDOF.js → chunk-MJQOG4TZ.js} +16 -16
- package/dist/cli/{chunk-JO5FFSR7.js → chunk-NTLBZUHD.js} +6 -0
- package/dist/cli/{chunk-EKZQ5LQO.js → chunk-PVA3MWCO.js} +3 -3
- package/dist/cli/{chunk-PNF2ZU4R.js → chunk-QIEYEY6Z.js} +8 -8
- package/dist/cli/{chunk-KSHAFYYG.mjs → chunk-R2VZVHJP.mjs} +127 -6
- package/dist/cli/{chunk-XEBFJ2PH.js → chunk-RVOBFO7C.js} +41 -41
- package/dist/cli/{chunk-RU5ROUFO.js → chunk-TCQYWZFS.js} +5 -5
- package/dist/cli/{chunk-I42EOZKQ.js → chunk-TMQUMILM.js} +19 -23
- package/dist/cli/{chunk-EOO7OSS4.mjs → chunk-URZNSJE2.mjs} +4 -4
- package/dist/cli/{chunk-Z6AUOV7D.mjs → chunk-VC5B462T.mjs} +2 -2
- package/dist/cli/{chunk-EKF4DKUA.js → chunk-WHP3FJ7T.js} +5 -5
- package/dist/cli/{chunk-VD2374K7.mjs → chunk-WS274KID.mjs} +1 -1
- package/dist/cli/{chunk-T4U245E4.mjs → chunk-XYZZZLN6.mjs} +2 -2
- package/dist/cli/{chunk-J6SVNKRP.js → chunk-YXGPMTAK.js} +2 -2
- package/dist/cli/{chunk-RFV7PPLS.mjs → chunk-ZEQPCEV4.mjs} +3 -3
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-RZJ4SOIL.mjs → csv-2TXOI3UE.mjs} +4 -4
- package/dist/cli/{csv-JXX2LXK5.js → csv-NEWCNOSZ.js} +13 -13
- package/dist/cli/{db-T2KJNONM.js → db-J3IJS4OG.js} +27 -27
- package/dist/cli/{db-MUTT2NWI.mjs → db-PX7EQEIG.mjs} +6 -6
- package/dist/cli/{describe-K3UMAAVO.mjs → describe-GQHGTZSL.mjs} +20 -21
- package/dist/cli/describe-LE7EZCL4.js +49 -0
- package/dist/cli/describe-core.d.mts +8 -4
- package/dist/cli/describe-core.d.ts +8 -4
- package/dist/cli/describe-core.js +4 -5
- package/dist/cli/describe-core.mjs +3 -4
- package/dist/cli/{executions-PHS4R2OX.mjs → executions-FFKK24RY.mjs} +6 -6
- package/dist/cli/{executions-7HSLDRHR.js → executions-RO3TJUXL.js} +8 -8
- package/dist/cli/{feedback-BJZRM637.js → feedback-XRR4HIS6.js} +8 -8
- package/dist/cli/{feedback-RWMDCIDF.mjs → feedback-ZTO56SRL.mjs} +4 -4
- package/dist/cli/git-26AH4XIO.js +25 -0
- package/dist/cli/{git-YW6VHYZG.mjs → git-FIPBVFYZ.mjs} +5 -5
- package/dist/cli/index.js +142 -142
- package/dist/cli/index.mjs +42 -42
- package/dist/cli/{legacy-noops-5UBSUPGG.mjs → legacy-noops-AMD2NWHF.mjs} +5 -5
- package/dist/cli/{legacy-noops-2WUV2XD7.js → legacy-noops-MTBBGM27.js} +8 -8
- package/dist/cli/{monitors-HWOQO3OK.mjs → monitors-24LDKDJX.mjs} +7 -7
- package/dist/cli/{monitors-YZZRKSTG.js → monitors-42PIGLBF.js} +95 -95
- package/dist/cli/{org-NCXT6RB4.mjs → org-4B7SCFRL.mjs} +6 -6
- package/dist/cli/{org-JY7HLHBA.js → org-GQMCA3MN.js} +72 -72
- package/dist/cli/{pages-QJO53QAT.mjs → pages-PD5EGL2R.mjs} +6 -6
- package/dist/cli/{pages-6ZOHXL6X.js → pages-RL2M62GJ.js} +18 -18
- package/dist/cli/{play-SQRS7JN3.mjs → play-5V54VTUR.mjs} +132 -26
- package/dist/cli/{play-TAYGSR35.js → play-FST6ZAHW.js} +447 -341
- package/dist/cli/{providers-4Q5LOIQ5.js → providers-HBUUPN7J.js} +9 -9
- package/dist/cli/{providers-3IR3N5DT.mjs → providers-N5YVCKPL.mjs} +6 -6
- package/dist/cli/{quickstart-ITNUZENY.js → quickstart-4QIQNSHG.js} +6 -6
- package/dist/cli/{quickstart-KCZCYO6B.mjs → quickstart-NJDDVTQR.mjs} +4 -4
- package/dist/cli/{run-YQ57LMKN.js → run-FGOKCG4J.js} +44 -45
- package/dist/cli/{run-JCWRWDSK.mjs → run-JHI5MTHD.mjs} +25 -26
- package/dist/cli/search-CTKSEVSO.js +32 -0
- package/dist/cli/{search-FUM27HQP.mjs → search-EWIZBIY2.mjs} +7 -7
- package/dist/cli/{search-output-EWEYT34M.mjs → search-output-NAK3MWBH.mjs} +53 -75
- package/dist/cli/{search-output-XAMWKRJH.js → search-output-TMQTRC2W.js} +58 -80
- package/dist/cli/{secrets-2IRRRZBL.js → secrets-5TSUEOJB.js} +15 -15
- package/dist/cli/{secrets-YTI4IAKR.mjs → secrets-ONQVW5SR.mjs} +6 -6
- package/dist/cli/{sessions-EFS4KUPF.mjs → sessions-B7F5O3ZR.mjs} +5 -5
- package/dist/cli/{sessions-HWTRDXBQ.js → sessions-BSGE5EET.js} +6 -6
- package/dist/cli/{settings-FRVEIOKR.js → settings-47LARBRU.js} +78 -78
- package/dist/cli/{settings-NTOO42DY.mjs → settings-SGGFQV5R.mjs} +11 -11
- package/dist/cli/{setup-PAVQPALX.mjs → setup-ATGNXQUK.mjs} +9 -9
- package/dist/cli/{setup-6ZIOAE2V.js → setup-BNFZFXO6.js} +49 -49
- package/dist/cli/skills-6RD25MVM.js +36 -0
- package/dist/cli/{skills-3O3XTPUM.mjs → skills-CIMBRM5R.mjs} +7 -7
- package/dist/cli/{tools-7QSB65UL.mjs → tools-DTDXAULX.mjs} +18 -19
- package/dist/cli/tools-TDZH4XHS.js +56 -0
- package/dist/cli/{update-T6CYS5ZT.mjs → update-EOIJBJCO.mjs} +9 -9
- package/dist/cli/update-Y32VT4VL.js +34 -0
- package/dist/cli/{workflow-OMSXZ73T.mjs → workflow-IWXUJPWY.mjs} +7 -7
- package/dist/cli/{workflow-4KMJBMGX.js → workflow-V5VKPICQ.js} +17 -17
- package/dist/{client-Bn8FwKGO.d.ts → client-CIwenMFS.d.ts} +1 -1
- package/dist/{client-CfNRmjLK.d.mts → client-DYAfJpaN.d.mts} +1 -1
- package/dist/{client-core-B91EV0WS.d.ts → client-core-CRjtyMAI.d.ts} +25 -2
- package/dist/{client-core-BG8Cgrmk.d.mts → client-core-DlzP8vEs.d.mts} +25 -2
- package/dist/{compiler-manifest-DlXDyndN.d.ts → compiler-manifest-DaJrA2KV.d.mts} +1 -1
- package/dist/{compiler-manifest-DlXDyndN.d.mts → compiler-manifest-DaJrA2KV.d.ts} +1 -1
- package/dist/{errors-BtriA2ld.d.mts → errors-BKnSYueU.d.mts} +1 -1
- package/dist/{errors-DmcLykM7.d.ts → errors-KLga4bLr.d.ts} +1 -1
- package/dist/{index-DI0sR_fX.d.mts → index-C-8AFpWy.d.mts} +1 -1
- package/dist/{index--Jw-slHY.d.ts → index-C5nAZ-VS.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +124 -118
- 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 +8 -1
- 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/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 +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-VP7PMXKQ.js +0 -43
- package/dist/cli/chunk-XK5DMLZE.js +0 -111
- package/dist/cli/chunk-XRDXNAAY.mjs +0 -111
- package/dist/cli/describe-SEXUJLE4.js +0 -50
- package/dist/cli/git-VNS7UQWN.js +0 -25
- package/dist/cli/search-I425FRTK.js +0 -32
- package/dist/cli/skills-6ZNMO2PR.js +0 -36
- package/dist/cli/tools-DPV2JES6.js +0 -57
- package/dist/cli/update-Q5GUDEAW.js +0 -34
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type TerminalRuntimePerformance,
|
|
5
5
|
type TerminalRuntimePerformanceUnavailableReason,
|
|
6
6
|
} from './terminal-runtime-performance';
|
|
7
|
+
import { normalizeResumeEpoch } from './run-ending-event';
|
|
7
8
|
import {
|
|
8
9
|
normalizePlayRunFailure,
|
|
9
10
|
PLATFORM_DEPLOY_INTERRUPTED_MESSAGE,
|
|
@@ -20,6 +21,8 @@ import {
|
|
|
20
21
|
} from './docflow-node-io';
|
|
21
22
|
import {
|
|
22
23
|
isPlayActivityObservation,
|
|
24
|
+
PLATFORM_RECOVERY_ACTIVITY_ID,
|
|
25
|
+
CANCELLATION_CLEANUP_ACTIVITY_ID,
|
|
23
26
|
type PlayActivityObservation,
|
|
24
27
|
} from './activity-observation';
|
|
25
28
|
import {
|
|
@@ -235,6 +238,11 @@ export type PlayRunLedgerSnapshot = {
|
|
|
235
238
|
* this field existed — those are treated as authoritative.
|
|
236
239
|
*/
|
|
237
240
|
terminalSource?: PlayRunLedgerEventSource | null;
|
|
241
|
+
/**
|
|
242
|
+
* How many times `runs resume` continued this run (absent means 0). Events
|
|
243
|
+
* from an earlier epoch are stale; a resume from a later one reopens it.
|
|
244
|
+
*/
|
|
245
|
+
resumeEpoch?: number;
|
|
238
246
|
};
|
|
239
247
|
|
|
240
248
|
type PlayRunLedgerBaseEvent = {
|
|
@@ -248,6 +256,11 @@ type PlayRunLedgerBaseEvent = {
|
|
|
248
256
|
* reducer understands.
|
|
249
257
|
*/
|
|
250
258
|
payload?: unknown;
|
|
259
|
+
/**
|
|
260
|
+
* Epoch of the run this lifecycle fact belongs to (absent means 0). Endings
|
|
261
|
+
* carry the epoch encoded in their outbox event ID.
|
|
262
|
+
*/
|
|
263
|
+
resumeEpoch?: number;
|
|
251
264
|
};
|
|
252
265
|
|
|
253
266
|
export type PlayRunLedgerEvent =
|
|
@@ -1012,7 +1025,21 @@ export function normalizePlayRunLedgerSnapshot(
|
|
|
1012
1025
|
? ('invalid_terminal_performance' as const)
|
|
1013
1026
|
: undefined))
|
|
1014
1027
|
: undefined;
|
|
1028
|
+
// Preserve fields written by a newer reader. `logs` is the known legacy
|
|
1029
|
+
// alias already normalized into logTail, not a second retained log body.
|
|
1030
|
+
const {
|
|
1031
|
+
logs: _legacyLogs,
|
|
1032
|
+
workCounters: _rawWorkCounters,
|
|
1033
|
+
terminalWorkCounterSegment: _rawTerminalSegment,
|
|
1034
|
+
terminalRuntimePerformance: _rawPerformance,
|
|
1035
|
+
terminalRuntimePerformanceUnavailableReason: _rawPerformanceReason,
|
|
1036
|
+
...preserved
|
|
1037
|
+
} = value;
|
|
1015
1038
|
return {
|
|
1039
|
+
...preserved,
|
|
1040
|
+
...(value.resumeEpoch !== undefined
|
|
1041
|
+
? { resumeEpoch: normalizeResumeEpoch(value.resumeEpoch) }
|
|
1042
|
+
: {}),
|
|
1016
1043
|
runId: optionalString(value.runId) ?? fallback.runId,
|
|
1017
1044
|
playName:
|
|
1018
1045
|
optionalNullableString(value.playName) ?? fallback.playName ?? null,
|
|
@@ -1794,6 +1821,23 @@ function refineTerminalSyntheticStepStart(
|
|
|
1794
1821
|
};
|
|
1795
1822
|
}
|
|
1796
1823
|
|
|
1824
|
+
function isRunEndingEvent(event: AcceptedPlayRunLedgerEvent): boolean {
|
|
1825
|
+
return (
|
|
1826
|
+
event.type === RUN_EVENT_KIND.runCompleted ||
|
|
1827
|
+
event.type === RUN_EVENT_KIND.runFailed ||
|
|
1828
|
+
event.type === RUN_EVENT_KIND.runCancelled
|
|
1829
|
+
);
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
function isEpochScopedLedgerEvent(event: AcceptedPlayRunLedgerEvent): boolean {
|
|
1833
|
+
// Logs retain the whole story; work counters reconcile their own attempt
|
|
1834
|
+
// segments. All other projections describe the current execution epoch.
|
|
1835
|
+
return (
|
|
1836
|
+
event.type !== RUN_EVENT_KIND.logAppended &&
|
|
1837
|
+
event.type !== RUN_EVENT_KIND.workCounters
|
|
1838
|
+
);
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1797
1841
|
export function reducePlayRunLedgerEvent(
|
|
1798
1842
|
snapshot: PlayRunLedgerSnapshot,
|
|
1799
1843
|
event: AcceptedPlayRunLedgerEvent,
|
|
@@ -1807,6 +1851,88 @@ export function reducePlayRunLedgerEvent(
|
|
|
1807
1851
|
if (event.runId !== snapshot.runId) {
|
|
1808
1852
|
return snapshot;
|
|
1809
1853
|
}
|
|
1854
|
+
// `runs resume` continues a stopped run as the same run under a new epoch.
|
|
1855
|
+
// Lifecycle facts from an earlier epoch are stale whatever the run's state
|
|
1856
|
+
// (a late redelivery of the earlier ending must not end the resumed run),
|
|
1857
|
+
// and a resume from a later epoch reopens a finished run.
|
|
1858
|
+
const snapshotEpoch = normalizeResumeEpoch(snapshot.resumeEpoch);
|
|
1859
|
+
const eventEpoch = normalizeResumeEpoch(event.resumeEpoch);
|
|
1860
|
+
// Endings and resumes always carry their epoch (an ending's is in its
|
|
1861
|
+
// event id); a stale one must not end or reopen the current epoch. Waits,
|
|
1862
|
+
// wakes and starts carry none, so they describe the current epoch.
|
|
1863
|
+
if (
|
|
1864
|
+
eventEpoch < snapshotEpoch &&
|
|
1865
|
+
(isRunEndingEvent(event) ||
|
|
1866
|
+
(isEpochScopedLedgerEvent(event) && event.resumeEpoch !== undefined))
|
|
1867
|
+
) {
|
|
1868
|
+
return snapshot;
|
|
1869
|
+
}
|
|
1870
|
+
if (event.type === RUN_EVENT_KIND.runResumed && eventEpoch > snapshotEpoch) {
|
|
1871
|
+
const occurredAt = Math.max(0, event.occurredAt);
|
|
1872
|
+
const stepsById = Object.fromEntries(
|
|
1873
|
+
Object.entries(snapshot.stepsById).map(([id, step]) => {
|
|
1874
|
+
if (step.status !== 'failed') return [id, step];
|
|
1875
|
+
const { stoppedBy: _stoppedBy, ...unfinished } = step;
|
|
1876
|
+
return [
|
|
1877
|
+
id,
|
|
1878
|
+
{
|
|
1879
|
+
...unfinished,
|
|
1880
|
+
status: 'running' as const,
|
|
1881
|
+
error: null,
|
|
1882
|
+
completedAt: null,
|
|
1883
|
+
updatedAt: occurredAt,
|
|
1884
|
+
progress: step.progress
|
|
1885
|
+
? {
|
|
1886
|
+
...step.progress,
|
|
1887
|
+
error: undefined,
|
|
1888
|
+
completedAt: null,
|
|
1889
|
+
updatedAt: occurredAt,
|
|
1890
|
+
}
|
|
1891
|
+
: step.progress,
|
|
1892
|
+
},
|
|
1893
|
+
];
|
|
1894
|
+
}),
|
|
1895
|
+
);
|
|
1896
|
+
const activeStepId =
|
|
1897
|
+
snapshot.orderedStepIds
|
|
1898
|
+
.filter((id) => stepsById[id]?.status === 'running')
|
|
1899
|
+
.at(-1) ?? null;
|
|
1900
|
+
return {
|
|
1901
|
+
...snapshot,
|
|
1902
|
+
stepsById,
|
|
1903
|
+
activeStepId,
|
|
1904
|
+
activeArtifactTableNamespace: activeStepId
|
|
1905
|
+
? (stepsById[activeStepId]?.artifactTableNamespace ?? null)
|
|
1906
|
+
: null,
|
|
1907
|
+
resumeEpoch: eventEpoch,
|
|
1908
|
+
status: 'running',
|
|
1909
|
+
waitKind: null,
|
|
1910
|
+
waitUntil: null,
|
|
1911
|
+
error: null,
|
|
1912
|
+
finishedAt: null,
|
|
1913
|
+
durationMs: null,
|
|
1914
|
+
result: undefined,
|
|
1915
|
+
resultSummary: undefined,
|
|
1916
|
+
terminalSource: null,
|
|
1917
|
+
terminalWorkCounterSegment: undefined,
|
|
1918
|
+
terminalRuntimePerformance: undefined,
|
|
1919
|
+
terminalRuntimePerformanceUnavailableReason: undefined,
|
|
1920
|
+
activeActivityId: null,
|
|
1921
|
+
activitiesById: Object.fromEntries(
|
|
1922
|
+
Object.entries(snapshot.activitiesById).filter(
|
|
1923
|
+
([id]) =>
|
|
1924
|
+
id !== PLATFORM_RECOVERY_ACTIVITY_ID &&
|
|
1925
|
+
id !== CANCELLATION_CLEANUP_ACTIVITY_ID,
|
|
1926
|
+
),
|
|
1927
|
+
),
|
|
1928
|
+
orderedActivityIds: snapshot.orderedActivityIds.filter(
|
|
1929
|
+
(id) =>
|
|
1930
|
+
id !== PLATFORM_RECOVERY_ACTIVITY_ID &&
|
|
1931
|
+
id !== CANCELLATION_CLEANUP_ACTIVITY_ID,
|
|
1932
|
+
),
|
|
1933
|
+
updatedAt: Math.max(snapshot.updatedAt ?? 0, occurredAt),
|
|
1934
|
+
};
|
|
1935
|
+
}
|
|
1810
1936
|
// A terminal Run Snapshot is immutable with respect to step lifecycle.
|
|
1811
1937
|
// Detached runners can race their best-effort progress transport against the
|
|
1812
1938
|
// terminal outbox, and gateway processes can restart or split that traffic.
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { runtimeToolPath } from '../runtime-api-paths';
|
|
2
|
+
import {
|
|
3
|
+
createPrebuiltBatchQualityCollector,
|
|
4
|
+
measurePrebuiltResultQuality,
|
|
5
|
+
} from '../prebuilt-result-quality';
|
|
2
6
|
import {
|
|
3
7
|
emptyRowFailureCounts,
|
|
4
8
|
readRowFailureCounts,
|
|
5
9
|
type RowFailureCounts,
|
|
6
10
|
} from '../row-failure-summary';
|
|
11
|
+
import { createFixtureEgressFetch } from '../fixture-egress-fetch';
|
|
7
12
|
import { RUN_EVENT_KIND } from '../run-event-catalog';
|
|
8
13
|
import { hydratePlayRunnerConfig } from '../protocol';
|
|
9
14
|
import { appendFileSync, createReadStream, writeFileSync } from 'node:fs';
|
|
@@ -230,6 +235,26 @@ const safeNodeOutboundFetch = sandboxRuntimeAppFetch((async (
|
|
|
230
235
|
return safeOutboundFetch(input, init);
|
|
231
236
|
}) as typeof fetch);
|
|
232
237
|
|
|
238
|
+
function fixtureCtxFetch(
|
|
239
|
+
config: Pick<PlayRunnerExecutionConfig, 'context'>,
|
|
240
|
+
): ReturnType<typeof createFixtureEgressFetch> {
|
|
241
|
+
const baseUrl =
|
|
242
|
+
config.context.executionGatewayBaseUrl?.trim() || config.context.baseUrl;
|
|
243
|
+
const executorToken = config.context.executorToken;
|
|
244
|
+
if (!baseUrl || !executorToken) {
|
|
245
|
+
return async (input) => {
|
|
246
|
+
throw new Error(
|
|
247
|
+
`Fixture ctx.fetch(${String(input)}) requires executorToken and baseUrl.`,
|
|
248
|
+
);
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
return createFixtureEgressFetch({
|
|
252
|
+
baseUrl,
|
|
253
|
+
executorToken,
|
|
254
|
+
extraHeaders: () => vercelBypassHeaders(config),
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
233
258
|
const safeNodeStreamingOutboundFetch = sandboxRuntimeAppFetch((async (
|
|
234
259
|
input: string | URL,
|
|
235
260
|
init?: RequestInit,
|
|
@@ -1396,6 +1421,15 @@ function emitSystemLog(line: string, options?: ExecutePlayRunnerOptions): void {
|
|
|
1396
1421
|
export function playRunnerContextCachePolicy(
|
|
1397
1422
|
context: PlayRunnerExecutionConfig['context'],
|
|
1398
1423
|
): ContextOptions['cachePolicy'] | undefined {
|
|
1424
|
+
// A person resumed this run after fixing what made it stop, so calls that
|
|
1425
|
+
// failed before the resume run again. Successes stay recorded: only failed
|
|
1426
|
+
// receipts are re-claimable, and completed calls return from history.
|
|
1427
|
+
// Automatic retries within one epoch keep failed calls failed.
|
|
1428
|
+
const resumed =
|
|
1429
|
+
typeof context.resumeEpoch === 'number' && context.resumeEpoch > 0;
|
|
1430
|
+
if (resumed && !context.force && !context.forceToolRefresh) {
|
|
1431
|
+
return { forceFailedToolRefresh: true };
|
|
1432
|
+
}
|
|
1399
1433
|
if (context.forceToolRefresh) {
|
|
1400
1434
|
return {
|
|
1401
1435
|
...(context.force ? { forceStepRefresh: true } : {}),
|
|
@@ -2342,6 +2376,15 @@ async function run(
|
|
|
2342
2376
|
writeVersion?: number;
|
|
2343
2377
|
}
|
|
2344
2378
|
>();
|
|
2379
|
+
// A resumed map can return the rows completed by this invocation alone.
|
|
2380
|
+
const prebuiltQualityReference =
|
|
2381
|
+
config.checkpoint &&
|
|
2382
|
+
config.context.prebuiltQualityReference?.endsWith('-batch')
|
|
2383
|
+
? undefined
|
|
2384
|
+
: config.context.prebuiltQualityReference;
|
|
2385
|
+
const prebuiltBatchQuality = createPrebuiltBatchQualityCollector(
|
|
2386
|
+
prebuiltQualityReference,
|
|
2387
|
+
);
|
|
2345
2388
|
const membershipCapturingMaps = new Set<string>();
|
|
2346
2389
|
const runtimeMapDatasetSettlements = new Map<
|
|
2347
2390
|
string,
|
|
@@ -2510,7 +2553,12 @@ async function run(
|
|
|
2510
2553
|
abortSignal: persistenceSignal,
|
|
2511
2554
|
scope,
|
|
2512
2555
|
}),
|
|
2513
|
-
|
|
2556
|
+
// A fixture run answers ctx.fetch from the fixture egress route; it must
|
|
2557
|
+
// never reach the network.
|
|
2558
|
+
fetchImpl:
|
|
2559
|
+
config.context.integrationMode === 'fixture'
|
|
2560
|
+
? fixtureCtxFetch(config)
|
|
2561
|
+
: safeNodeStreamingOutboundFetch,
|
|
2514
2562
|
vercelProtectionBypassToken: config.context.vercelProtectionBypassToken,
|
|
2515
2563
|
orgId: config.context.orgId,
|
|
2516
2564
|
userEmail: config.context.userEmail,
|
|
@@ -2579,6 +2627,7 @@ async function run(
|
|
|
2579
2627
|
config.context.runId ??
|
|
2580
2628
|
config.context.workflowId,
|
|
2581
2629
|
runAttempt: runnerRunAttempt,
|
|
2630
|
+
...(config.context.runScopedKeys === true ? { runScopedKeys: true } : {}),
|
|
2582
2631
|
staticPipeline: config.context.staticPipeline,
|
|
2583
2632
|
checkpoint: config.checkpoint ?? undefined,
|
|
2584
2633
|
durableBoundaries: true,
|
|
@@ -3258,6 +3307,19 @@ async function run(
|
|
|
3258
3307
|
});
|
|
3259
3308
|
const datasetPath = `datasets.${input.tableNamespace}`;
|
|
3260
3309
|
const datasetId = createRuntimeDatasetId(playName, input.tableNamespace);
|
|
3310
|
+
if (
|
|
3311
|
+
prebuiltBatchQuality &&
|
|
3312
|
+
canUseRootPreloadedDbSessions &&
|
|
3313
|
+
playName === config.context.playName
|
|
3314
|
+
) {
|
|
3315
|
+
prebuiltBatchQuality.record({
|
|
3316
|
+
datasetId,
|
|
3317
|
+
rows: input.rows,
|
|
3318
|
+
committedKeys: result.committedKeys,
|
|
3319
|
+
updated: result.updated,
|
|
3320
|
+
recoveredStaleKeys,
|
|
3321
|
+
});
|
|
3322
|
+
}
|
|
3261
3323
|
const settlement = runtimeMapDatasetSettlements.get(datasetId) ?? {
|
|
3262
3324
|
datasetId,
|
|
3263
3325
|
path: datasetPath,
|
|
@@ -3524,6 +3586,7 @@ async function run(
|
|
|
3524
3586
|
workCounterTimer.unref();
|
|
3525
3587
|
|
|
3526
3588
|
try {
|
|
3589
|
+
await ctx.markRunReplayTracked();
|
|
3527
3590
|
emitWorkerLog('Play started', options);
|
|
3528
3591
|
const rawResult = await executeRuntimePlayCode({
|
|
3529
3592
|
artifact: config.artifact,
|
|
@@ -3713,6 +3776,11 @@ async function run(
|
|
|
3713
3776
|
]),
|
|
3714
3777
|
).values(),
|
|
3715
3778
|
).slice(0, 16);
|
|
3779
|
+
const prebuiltResultQuality = measurePrebuiltResultQuality(
|
|
3780
|
+
prebuiltQualityReference,
|
|
3781
|
+
result,
|
|
3782
|
+
prebuiltBatchQuality,
|
|
3783
|
+
);
|
|
3716
3784
|
const checkpoint = ctx.getCheckpoint();
|
|
3717
3785
|
const rowOutcomes = rowOutcomesFromCheckpoint(checkpoint);
|
|
3718
3786
|
|
|
@@ -3731,6 +3799,7 @@ async function run(
|
|
|
3731
3799
|
logMetadata: terminalLogMetadata(ctx),
|
|
3732
3800
|
...(runtimeDiagnostics.length > 0 ? { runtimeDiagnostics } : {}),
|
|
3733
3801
|
...(rowOutcomes ? { rowOutcomes } : {}),
|
|
3802
|
+
...(prebuiltResultQuality ? { prebuiltResultQuality } : {}),
|
|
3734
3803
|
stats: runtimeStats(),
|
|
3735
3804
|
steps: ctx.getSteps(),
|
|
3736
3805
|
checkpoint,
|
|
@@ -21,10 +21,7 @@ import axios, { type InternalAxiosRequestConfig } from 'axios';
|
|
|
21
21
|
import { Readable } from 'node:stream';
|
|
22
22
|
import type { DaytonaClientOptions } from '../../daytona-runtime-config';
|
|
23
23
|
import type { CreateSandboxFromSnapshotParams } from '@daytonaio/sdk';
|
|
24
|
-
import type {
|
|
25
|
-
DaytonaDeleteRetryAuthorization,
|
|
26
|
-
DaytonaDomainAllowListParam,
|
|
27
|
-
} from './daytona-lifecycle';
|
|
24
|
+
import type { DaytonaDeleteRetryAuthorization } from './daytona-lifecycle';
|
|
28
25
|
import {
|
|
29
26
|
DAYTONA_CONTROL_TIMEOUT_MS,
|
|
30
27
|
DaytonaControlTimeoutError,
|
|
@@ -561,7 +558,7 @@ export function createDaytonaLaunchClient(
|
|
|
561
558
|
resolvedDomains.set(sandbox, organizationId.trim());
|
|
562
559
|
},
|
|
563
560
|
async create(
|
|
564
|
-
params: CreateSandboxFromSnapshotParams
|
|
561
|
+
params: CreateSandboxFromSnapshotParams,
|
|
565
562
|
options: { timeout?: number } = {},
|
|
566
563
|
) {
|
|
567
564
|
const timeoutMs = (options.timeout ?? 60) * 1_000;
|
|
@@ -600,10 +597,6 @@ export function createDaytonaLaunchClient(
|
|
|
600
597
|
volumes: params.volumes,
|
|
601
598
|
networkBlockAll: params.networkBlockAll,
|
|
602
599
|
networkAllowList: params.networkAllowList,
|
|
603
|
-
// Pinned Runtime gateway host only; absent on every other run.
|
|
604
|
-
...(params.domainAllowList
|
|
605
|
-
? { domainAllowList: params.domainAllowList }
|
|
606
|
-
: {}),
|
|
607
600
|
linkedSandbox: params.linkedSandbox,
|
|
608
601
|
},
|
|
609
602
|
undefined,
|
package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolve4 } from 'node:dns/promises';
|
|
1
2
|
import type { CreateSandboxFromSnapshotParams, Sandbox } from '@daytonaio/sdk';
|
|
2
3
|
import {
|
|
3
4
|
boundedDaytonaProviderTextForLog,
|
|
@@ -84,7 +85,7 @@ export type DaytonaDeleteRetryAuthorization = {
|
|
|
84
85
|
|
|
85
86
|
export type DaytonaClient = {
|
|
86
87
|
create(
|
|
87
|
-
params: CreateSandboxFromSnapshotParams
|
|
88
|
+
params: CreateSandboxFromSnapshotParams,
|
|
88
89
|
options: { timeout: number },
|
|
89
90
|
): Promise<Sandbox>;
|
|
90
91
|
get?(name: string): Promise<Sandbox>;
|
|
@@ -548,29 +549,55 @@ export function filterIpv4CidrAllowList(raw: string | null): string | null {
|
|
|
548
549
|
return ipv4.length > 0 ? ipv4.join(',') : null;
|
|
549
550
|
}
|
|
550
551
|
|
|
551
|
-
/** Daytona create accepts a comma-separated domain allow-list beside CIDRs. */
|
|
552
|
-
export type DaytonaDomainAllowListParam = { domainAllowList?: string };
|
|
553
|
-
|
|
554
552
|
/**
|
|
555
553
|
* A run pinned to an app-hosted Runtime gateway reaches that immutable
|
|
556
|
-
* deployment by hostname, whose addresses cannot be enumerated
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
554
|
+
* deployment by hostname, whose addresses cannot be enumerated ahead of time.
|
|
555
|
+
* Daytona accepts a CIDR `networkAllowList` or a `domainAllowList`, never
|
|
556
|
+
* both ("mutually exclusive"), and a restricted sandbox already carries the
|
|
557
|
+
* CIDR list. So when egress is already restricted, add the /24 around each
|
|
558
|
+
* IPv4 address the pinned host resolves to, to that same list: the sandbox
|
|
559
|
+
* resolves the same name and may be answered with a different address in the
|
|
560
|
+
* same Vercel range. An unrestricted sandbox needs nothing (a list would
|
|
561
|
+
* restrict it), and an unpinned run is returned unchanged.
|
|
560
562
|
*/
|
|
561
|
-
export function
|
|
563
|
+
export async function runtimeGatewayDaytonaNetworkAllowList(input: {
|
|
562
564
|
credentialScope:
|
|
563
565
|
| PlayRunnerExecutionConfig['context']['runtimeGatewayCredentialScope']
|
|
564
566
|
| undefined;
|
|
565
567
|
networkAllowList: string | null;
|
|
566
|
-
|
|
568
|
+
resolveIpv4?: (hostname: string) => Promise<string[]>;
|
|
569
|
+
}): Promise<string | null> {
|
|
567
570
|
const scope = input.credentialScope;
|
|
568
|
-
if (!scope || !input.networkAllowList) return
|
|
571
|
+
if (!scope || !input.networkAllowList) return input.networkAllowList;
|
|
569
572
|
const hostname = new URL(scope.origin).hostname;
|
|
570
573
|
if (!hostname) {
|
|
571
574
|
throw new Error('Runtime gateway credential scope has no hostname.');
|
|
572
575
|
}
|
|
573
|
-
|
|
576
|
+
const addresses = await (input.resolveIpv4 ?? resolve4)(hostname);
|
|
577
|
+
const networks = [
|
|
578
|
+
...new Set(
|
|
579
|
+
addresses
|
|
580
|
+
.map((address) => address.split('.'))
|
|
581
|
+
.filter(
|
|
582
|
+
(octets) =>
|
|
583
|
+
octets.length === 4 &&
|
|
584
|
+
octets.every((octet) => /^\d{1,3}$/.test(octet)),
|
|
585
|
+
)
|
|
586
|
+
.map((octets) => `${octets[0]}.${octets[1]}.${octets[2]}.0/24`),
|
|
587
|
+
),
|
|
588
|
+
];
|
|
589
|
+
if (networks.length === 0) {
|
|
590
|
+
throw new Error(
|
|
591
|
+
`Runtime gateway host ${hostname} resolved to no IPv4 address; refusing to start a pinned sandbox that could not reach it.`,
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
const existing = input.networkAllowList
|
|
595
|
+
.split(',')
|
|
596
|
+
.map((entry) => entry.trim());
|
|
597
|
+
return [
|
|
598
|
+
...existing,
|
|
599
|
+
...networks.filter((network) => !existing.includes(network)),
|
|
600
|
+
].join(',');
|
|
574
601
|
}
|
|
575
602
|
|
|
576
603
|
export function resolveDaytonaSandboxNetworkPolicy(input: {
|
|
@@ -640,13 +667,19 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
640
667
|
if (runId) labels.runId = runId;
|
|
641
668
|
if (input.providerOperationToken)
|
|
642
669
|
labels.operationKey = input.providerOperationToken;
|
|
643
|
-
const
|
|
670
|
+
const policy = resolveDaytonaSandboxNetworkPolicy({
|
|
644
671
|
runtimeSchedulerSchema: input.context.runtimeSchedulerSchema ?? null,
|
|
645
672
|
});
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
673
|
+
// Only a pinned, already-restricted sandbox resolves anything; every other
|
|
674
|
+
// run keeps the exact synchronous path it had before.
|
|
675
|
+
const credentialScope = input.context.runtimeGatewayCredentialScope;
|
|
676
|
+
const networkAllowList =
|
|
677
|
+
credentialScope && policy.networkAllowList
|
|
678
|
+
? await runtimeGatewayDaytonaNetworkAllowList({
|
|
679
|
+
credentialScope,
|
|
680
|
+
networkAllowList: policy.networkAllowList,
|
|
681
|
+
})
|
|
682
|
+
: policy.networkAllowList;
|
|
650
683
|
|
|
651
684
|
const commonParams = {
|
|
652
685
|
name: input.sandboxName,
|
|
@@ -664,11 +697,10 @@ async function createOneShotDaytonaSandbox(input: {
|
|
|
664
697
|
// A non-empty `networkAllowList` IS the "block all egress except these
|
|
665
698
|
// CIDRs" control; Daytona rejects create when `networkBlockAll: true` is
|
|
666
699
|
// combined with a non-empty allow-list ("networkBlockAll: true cannot be
|
|
667
|
-
// combined with a non-empty networkAllowList
|
|
700
|
+
// combined with a non-empty networkAllowList"). Pass
|
|
668
701
|
// the allow-list alone so the egress restriction holds without the
|
|
669
702
|
// contradictory flag.
|
|
670
703
|
...(networkAllowList ? { networkAllowList } : {}),
|
|
671
|
-
...(domainAllowList ? { domainAllowList } : {}),
|
|
672
704
|
};
|
|
673
705
|
return input.daytona.create(commonParams, {
|
|
674
706
|
timeout: DAYTONA_CREATE_TIMEOUT_SECONDS,
|
package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { computeBillingSessionId } from '../../run-ending-event';
|
|
1
2
|
import { preparePlayRunnerConfigForTransport } from '../../protocol';
|
|
2
3
|
import { randomUUID } from 'node:crypto';
|
|
3
4
|
import { spawn } from 'node:child_process';
|
|
@@ -347,8 +348,10 @@ export const localProcessPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
347
348
|
await upsertComputeBillingSessionViaAppRuntime(
|
|
348
349
|
runtimeApiContextForConfig(config),
|
|
349
350
|
{
|
|
350
|
-
sessionId:
|
|
351
|
+
sessionId: computeBillingSessionId(
|
|
351
352
|
config.context.workflowId ?? config.context.runId ?? 'unknown',
|
|
353
|
+
config.context.resumeEpoch,
|
|
354
|
+
),
|
|
352
355
|
orgId: config.context.orgId ?? 'unknown',
|
|
353
356
|
userId: null,
|
|
354
357
|
operation: 'workflow_run',
|
|
@@ -625,10 +628,12 @@ export const localProcessPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
625
628
|
await recordComputeBillingItemViaAppRuntime(
|
|
626
629
|
runtimeApiContextForConfig(config),
|
|
627
630
|
{
|
|
628
|
-
sessionId:
|
|
631
|
+
sessionId: computeBillingSessionId(
|
|
629
632
|
config.context.workflowId ??
|
|
630
|
-
|
|
631
|
-
|
|
633
|
+
config.context.runId ??
|
|
634
|
+
workspaceRoot,
|
|
635
|
+
config.context.resumeEpoch,
|
|
636
|
+
),
|
|
632
637
|
orgId: config.context.orgId ?? 'unknown',
|
|
633
638
|
userId: null,
|
|
634
639
|
operation: 'workflow_run',
|
|
@@ -985,6 +985,7 @@ export async function inspectDetachedModalRunner(input: {
|
|
|
985
985
|
exitCode: number | null;
|
|
986
986
|
result: PlayRunnerResult | null;
|
|
987
987
|
diagnosis: { stage: string; detail: string | null };
|
|
988
|
+
providerReturnCode?: number | null;
|
|
988
989
|
}> {
|
|
989
990
|
const expectedAppId = input.expectedAppId?.trim() || null;
|
|
990
991
|
if (!expectedAppId) {
|
|
@@ -1040,6 +1041,7 @@ export async function inspectDetachedModalRunner(input: {
|
|
|
1040
1041
|
stage: 'sandbox_stopped',
|
|
1041
1042
|
detail: `Modal sandbox ended with return code ${state.returnCode}.`,
|
|
1042
1043
|
},
|
|
1044
|
+
providerReturnCode: state.returnCode,
|
|
1043
1045
|
};
|
|
1044
1046
|
}
|
|
1045
1047
|
if (input.skipCapturedOutput) {
|
|
@@ -57,6 +57,8 @@ export type RuntimeSandboxDetachedRunnerInspection = {
|
|
|
57
57
|
exitCode: number | null;
|
|
58
58
|
result: PlayRunnerResult | null;
|
|
59
59
|
diagnosis: { stage: string; detail: string | null };
|
|
60
|
+
/** The stopped sandbox's own return code, when the provider reports one. */
|
|
61
|
+
providerReturnCode?: number | null;
|
|
60
62
|
};
|
|
61
63
|
|
|
62
64
|
export type RuntimeSandboxDetachedInspectionOptions = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComputeBillingItem } from './worker-api-types';
|
|
2
2
|
import type { DbLogicalTable, DbSessionOperation } from './db-session';
|
|
3
|
-
import type { PlayRowUpdate } from './ctx-types';
|
|
3
|
+
import type { PlayRowUpdate, PublishLatestCacheResultInput } from './ctx-types';
|
|
4
4
|
import type { PlaySheetContract } from '../plays/static-pipeline';
|
|
5
5
|
import type { PlayRunLedgerEvent } from './run-ledger';
|
|
6
6
|
import type { WorkReceiptFailureKind } from './work-receipts';
|
|
@@ -164,6 +164,17 @@ export type RuntimeReceiptAction =
|
|
|
164
164
|
output: unknown;
|
|
165
165
|
inlineFields?: RuntimeReceiptValueInlineFields;
|
|
166
166
|
}
|
|
167
|
+
| {
|
|
168
|
+
/**
|
|
169
|
+
* Newest-wins write of a `ctx:{org}:cache:v1:*` shared read result. The
|
|
170
|
+
* receiver stamps `recordedAtMs` from its database clock.
|
|
171
|
+
*/
|
|
172
|
+
action: 'publish_latest_cache_result';
|
|
173
|
+
playName: string;
|
|
174
|
+
runId: string;
|
|
175
|
+
key: string;
|
|
176
|
+
output: PublishLatestCacheResultInput['output'];
|
|
177
|
+
}
|
|
167
178
|
| {
|
|
168
179
|
action: 'release_runtime_step_receipt';
|
|
169
180
|
playName: string;
|
|
@@ -152,6 +152,7 @@ export function runtimeAuthorityMintInput(
|
|
|
152
152
|
descriptor: RuntimeAuthorityDescriptor,
|
|
153
153
|
input: {
|
|
154
154
|
runAttempt?: number | null;
|
|
155
|
+
resumeEpoch?: number | null;
|
|
155
156
|
runLeaseToken?: string | null;
|
|
156
157
|
terminalContract?: DirectCompletedTerminalContract | null;
|
|
157
158
|
capabilities?: readonly RuntimeExecutionCapability[];
|
|
@@ -176,6 +177,7 @@ export function runtimeAuthorityMintInput(
|
|
|
176
177
|
actorEmail: descriptor.actorEmail,
|
|
177
178
|
schedulerSchema: descriptor.schedulerSchema,
|
|
178
179
|
runAttempt: input.runAttempt,
|
|
180
|
+
resumeEpoch: input.resumeEpoch,
|
|
179
181
|
runLeaseToken: input.runLeaseToken,
|
|
180
182
|
terminalContract: input.terminalContract,
|
|
181
183
|
capabilities: input.capabilities ?? descriptor.capabilities,
|
|
@@ -186,6 +188,7 @@ export function runtimeAuthorityMintInput(
|
|
|
186
188
|
export async function mintPlayRunAttemptRuntimeToken(input: {
|
|
187
189
|
descriptor: RuntimeAuthorityDescriptor;
|
|
188
190
|
runAttempt?: number | null;
|
|
191
|
+
resumeEpoch?: number | null;
|
|
189
192
|
runLeaseToken?: string | null;
|
|
190
193
|
terminalContract?: DirectCompletedTerminalContract | null;
|
|
191
194
|
capabilities?: readonly RuntimeExecutionCapability[];
|
|
@@ -115,6 +115,30 @@ export function resolveRuntimeGatewayOidcEnvironment(): RuntimeGatewayOidcEnviro
|
|
|
115
115
|
return isTestOnlyRuntime() ? 'preview' : 'production';
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* The environment a signing key was published for, or null for an unpublished
|
|
120
|
+
* kid. A signer takes its environment from its own key: a Fly worker's
|
|
121
|
+
* `NODE_ENV` is inlined when its bundle is built, so the process test above
|
|
122
|
+
* reads "preview" there even in Production. The verifier is unaffected: a
|
|
123
|
+
* deployment still accepts only its own environment's kids and claim, so a
|
|
124
|
+
* Preview key cannot produce a credential Production accepts.
|
|
125
|
+
*/
|
|
126
|
+
export function runtimeGatewayOidcEnvironmentForKid(
|
|
127
|
+
kid: string,
|
|
128
|
+
trust: RuntimeGatewayOidcTrust = RUNTIME_GATEWAY_OIDC_TRUST,
|
|
129
|
+
): RuntimeGatewayOidcEnvironment | null {
|
|
130
|
+
const environments = (['production', 'preview'] as const).filter(
|
|
131
|
+
(environment) => trust.environmentKids[environment].includes(kid),
|
|
132
|
+
);
|
|
133
|
+
if (environments.length > 1) {
|
|
134
|
+
throw new RuntimeGatewayOidcError(
|
|
135
|
+
'signing_key_not_published',
|
|
136
|
+
`Runtime gateway OIDC key id "${kid}" is published for both environments; every kid must belong to exactly one.`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
return environments[0] ?? null;
|
|
140
|
+
}
|
|
141
|
+
|
|
118
142
|
/** Key material a caller trusts; defaults to the code-owned constants. */
|
|
119
143
|
export type RuntimeGatewayOidcTrust = Readonly<{
|
|
120
144
|
jwks: Readonly<{ keys: readonly RuntimeGatewayOidcPublicJwk[] }>;
|
|
@@ -266,7 +290,7 @@ export function mintRuntimeGatewayOidcToken(input: {
|
|
|
266
290
|
runId: string;
|
|
267
291
|
attempt: number;
|
|
268
292
|
nowMs: number;
|
|
269
|
-
/** Defaults to
|
|
293
|
+
/** Defaults to the environment the signing key is published for. */
|
|
270
294
|
environment?: RuntimeGatewayOidcEnvironment;
|
|
271
295
|
/** Defaults to the code-owned keys. */
|
|
272
296
|
trust?: RuntimeGatewayOidcTrust;
|
|
@@ -283,15 +307,13 @@ export function mintRuntimeGatewayOidcToken(input: {
|
|
|
283
307
|
'Runtime gateway OIDC claims are invalid.',
|
|
284
308
|
);
|
|
285
309
|
}
|
|
310
|
+
const trust = input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST;
|
|
286
311
|
const environment =
|
|
287
|
-
input.environment ??
|
|
312
|
+
input.environment ??
|
|
313
|
+
runtimeGatewayOidcEnvironmentForKid(input.signingKey.kid, trust) ??
|
|
314
|
+
resolveRuntimeGatewayOidcEnvironment();
|
|
288
315
|
const key = rsaPrivateKey(input.signingKey);
|
|
289
|
-
assertSigningKeyPublished(
|
|
290
|
-
input.signingKey,
|
|
291
|
-
key,
|
|
292
|
-
environment,
|
|
293
|
-
input.trust ?? RUNTIME_GATEWAY_OIDC_TRUST,
|
|
294
|
-
);
|
|
316
|
+
assertSigningKeyPublished(input.signingKey, key, environment, trust);
|
|
295
317
|
const iat = Math.floor(input.nowMs / 1_000);
|
|
296
318
|
const claims: RuntimeGatewayOidcClaims = {
|
|
297
319
|
iss: RUNTIME_GATEWAY_OIDC_ISSUER,
|