deepline 0.3.284 → 0.3.286
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.ts +1 -2
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +26 -2
- package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +836 -2234
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +19 -6
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -789
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-semantics.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +180 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +3 -22
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +59 -8
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +122 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +458 -130
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +60 -9
- package/dist/bundling-sources/shared_libs/play-runtime/test-async-batching.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +13 -2
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +181 -326
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +38 -151
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +68 -0
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +8 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +10 -1
- package/dist/bundling-sources/shared_libs/plays/enrich-compat-adapter.ts +2 -0
- package/dist/cli/index.js +30579 -34364
- package/dist/cli/index.mjs +30647 -34443
- package/dist/{client-BCXQ_Ftc.d.ts → client-B7ic-kY5.d.ts} +6 -3
- package/dist/{client-B0AjIkgb.d.mts → client-Dzf_KovW.d.mts} +6 -3
- package/dist/{compiler-manifest-B1zo3igW.d.mts → compiler-manifest-9SQtUuKb.d.mts} +1 -1
- package/dist/{compiler-manifest-B1zo3igW.d.ts → compiler-manifest-9SQtUuKb.d.ts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +34 -4
- package/dist/index.mjs +34 -4
- package/dist/install-integrity.json +4 -4
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/bundle-play-file.mjs +8 -1
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +1 -1
|
@@ -337,7 +337,6 @@ export async function reserveRuntimeSandboxCapacityLease(
|
|
|
337
337
|
AND operation.state = $4
|
|
338
338
|
AND lease.released_at IS NULL
|
|
339
339
|
AND lease.sandbox_id IS NULL
|
|
340
|
-
AND lease.expires_at > clock_timestamp()
|
|
341
340
|
ORDER BY operation.created_at ASC
|
|
342
341
|
LIMIT 2`,
|
|
343
342
|
[orgId, runId, input.provider, RuntimeSandboxOperationState.Reserved],
|
|
@@ -539,12 +538,19 @@ export async function reserveRuntimeSandboxCapacityLease(
|
|
|
539
538
|
provider: RuntimeSandboxProviderId;
|
|
540
539
|
operation_attempt: number | null;
|
|
541
540
|
operation_environment: 'preview' | 'production' | null;
|
|
541
|
+
operation_provider: RuntimeSandboxProviderId | null;
|
|
542
542
|
provider_operation_token: string | null;
|
|
543
|
+
operation_state: RuntimeSandboxOperationState | null;
|
|
544
|
+
released_at: Date | null;
|
|
545
|
+
sandbox_id: string | null;
|
|
543
546
|
}>(
|
|
544
547
|
`SELECT lease.org_id, lease.run_id, lease.provider,
|
|
545
548
|
operation.attempt AS operation_attempt,
|
|
546
549
|
operation.environment AS operation_environment,
|
|
547
|
-
operation.
|
|
550
|
+
operation.provider AS operation_provider,
|
|
551
|
+
operation.provider_operation_token,
|
|
552
|
+
operation.state AS operation_state,
|
|
553
|
+
lease.released_at, lease.sandbox_id
|
|
548
554
|
FROM ${leases} AS lease
|
|
549
555
|
LEFT JOIN ${operations} AS operation
|
|
550
556
|
ON operation.operation_key = lease.lease_id
|
|
@@ -559,12 +565,23 @@ export async function reserveRuntimeSandboxCapacityLease(
|
|
|
559
565
|
row.provider !== input.provider ||
|
|
560
566
|
(input.attempt !== undefined &&
|
|
561
567
|
(row.operation_attempt !== input.attempt ||
|
|
562
|
-
row.operation_environment !== (input.environment ?? 'production')
|
|
568
|
+
row.operation_environment !== (input.environment ?? 'production') ||
|
|
569
|
+
row.operation_provider !== input.provider))
|
|
563
570
|
) {
|
|
564
571
|
throw new Error(
|
|
565
572
|
'operationKey reservation did not persist the requested sandbox operation.',
|
|
566
573
|
);
|
|
567
574
|
}
|
|
575
|
+
if (
|
|
576
|
+
input.attempt !== undefined &&
|
|
577
|
+
(row.operation_state !== RuntimeSandboxOperationState.Reserved ||
|
|
578
|
+
row.released_at !== null ||
|
|
579
|
+
row.sandbox_id !== null)
|
|
580
|
+
) {
|
|
581
|
+
throw new RuntimeSandboxOperationNotRetryableError(
|
|
582
|
+
row.operation_state ?? RuntimeSandboxOperationState.Abandoned,
|
|
583
|
+
);
|
|
584
|
+
}
|
|
568
585
|
const resolvedProviderOperationToken =
|
|
569
586
|
row.provider_operation_token === null && input.attempt !== undefined
|
|
570
587
|
? await backfillReservedProviderOperationToken(
|
|
@@ -752,7 +769,10 @@ export async function bindRuntimeSandboxCapacityLease(
|
|
|
752
769
|
`
|
|
753
770
|
UPDATE ${leases}
|
|
754
771
|
SET provider = $2, sandbox_id = $3, routing_domain = $4
|
|
755
|
-
WHERE lease_id = $1 AND released_at IS NULL AND
|
|
772
|
+
WHERE lease_id = $1 AND released_at IS NULL AND provider = $2
|
|
773
|
+
AND (expires_at > clock_timestamp() OR sandbox_id = $3)
|
|
774
|
+
AND (sandbox_id IS NULL OR sandbox_id = $3)
|
|
775
|
+
AND (sandbox_id IS NULL OR routing_domain IS NOT DISTINCT FROM $4)
|
|
756
776
|
RETURNING lease_id
|
|
757
777
|
`,
|
|
758
778
|
[
|
|
@@ -775,7 +795,7 @@ export async function releaseRuntimeSandboxCapacityLease(
|
|
|
775
795
|
`
|
|
776
796
|
UPDATE ${leases}
|
|
777
797
|
SET released_at = clock_timestamp()
|
|
778
|
-
WHERE lease_id = $1 AND released_at IS NULL
|
|
798
|
+
WHERE lease_id = $1 AND released_at IS NULL AND sandbox_id IS NULL
|
|
779
799
|
RETURNING lease_id
|
|
780
800
|
`,
|
|
781
801
|
[assertId(input.leaseId, 'leaseId')],
|
|
@@ -793,15 +813,29 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
793
813
|
input: { operationKey: string },
|
|
794
814
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
795
815
|
): Promise<boolean> {
|
|
796
|
-
const { leases, operations } = schemaTables(options);
|
|
816
|
+
const { leases, operations, runs } = schemaTables(options);
|
|
797
817
|
const result = await client.query<{ operation_key: string }>(
|
|
798
818
|
`
|
|
799
|
-
WITH
|
|
819
|
+
WITH custody_run AS MATERIALIZED (
|
|
820
|
+
SELECT run_id FROM ${runs}
|
|
821
|
+
WHERE run_id = (SELECT run_id FROM ${operations} WHERE operation_key = $1)
|
|
822
|
+
FOR NO KEY UPDATE
|
|
823
|
+
), custody_attempts AS MATERIALIZED (
|
|
824
|
+
SELECT attempt.* FROM ${quoteIdent(options?.schema ?? 'runtime_scheduler')}."attempts" AS attempt
|
|
825
|
+
WHERE attempt.run_id IN (SELECT run_id FROM custody_run)
|
|
826
|
+
ORDER BY attempt.attempt FOR UPDATE
|
|
827
|
+
), eligible_lease AS MATERIALIZED (
|
|
828
|
+
SELECT lease.lease_id FROM ${leases} AS lease
|
|
829
|
+
CROSS JOIN (SELECT count(*) FROM custody_attempts) AS attempt_locks
|
|
830
|
+
WHERE lease_id = $1 AND sandbox_id IS NULL AND released_at IS NULL
|
|
831
|
+
FOR UPDATE OF lease
|
|
832
|
+
), abandoned AS (
|
|
800
833
|
UPDATE ${operations} AS operation
|
|
801
834
|
SET state = $2,
|
|
802
835
|
updated_at = clock_timestamp()
|
|
803
836
|
WHERE operation.operation_key = $1
|
|
804
837
|
AND operation.state = $3
|
|
838
|
+
AND EXISTS (SELECT 1 FROM eligible_lease)
|
|
805
839
|
RETURNING operation.operation_key
|
|
806
840
|
), released AS (
|
|
807
841
|
UPDATE ${leases} AS lease
|
|
@@ -880,14 +914,31 @@ export async function recordRecoveredDaytonaCancellationSandbox(
|
|
|
880
914
|
const { operations, leases, cleanup } = schemaTables(options);
|
|
881
915
|
const schema = quoteIdent(options?.schema ?? 'runtime_scheduler');
|
|
882
916
|
const recorded = await client.query<{ operation_key: string }>(
|
|
883
|
-
`WITH
|
|
917
|
+
`WITH custody_run AS MATERIALIZED (
|
|
918
|
+
SELECT run.run_id FROM ${schema}."runs" AS run
|
|
919
|
+
WHERE run.run_id = (SELECT run_id FROM ${operations} WHERE operation_key = $1)
|
|
920
|
+
FOR NO KEY UPDATE
|
|
921
|
+
), custody_attempts AS MATERIALIZED (
|
|
922
|
+
SELECT attempt.* FROM ${schema}."attempts" AS attempt
|
|
923
|
+
WHERE attempt.run_id IN (SELECT run_id FROM custody_run)
|
|
924
|
+
ORDER BY attempt.attempt FOR UPDATE
|
|
925
|
+
), custody_lease AS MATERIALIZED (
|
|
926
|
+
SELECT lease.lease_id FROM ${leases} AS lease
|
|
927
|
+
CROSS JOIN (SELECT count(*) FROM custody_attempts) AS attempt_locks
|
|
928
|
+
WHERE lease.lease_id = $1 FOR UPDATE OF lease
|
|
929
|
+
), custody_operation AS MATERIALIZED (
|
|
930
|
+
SELECT operation.operation_key FROM ${operations} AS operation
|
|
931
|
+
CROSS JOIN (SELECT count(*) FROM custody_lease) AS lease_locks
|
|
932
|
+
WHERE operation.operation_key = $1 FOR UPDATE OF operation
|
|
933
|
+
), promoted AS (
|
|
884
934
|
UPDATE ${operations} AS operation
|
|
885
935
|
SET state = 'deleting',
|
|
886
936
|
sandbox_id = $2,
|
|
887
937
|
routing_domain = $3,
|
|
888
938
|
provider_created_at = clock_timestamp(),
|
|
889
939
|
updated_at = clock_timestamp()
|
|
890
|
-
|
|
940
|
+
FROM custody_operation
|
|
941
|
+
WHERE operation.operation_key = custody_operation.operation_key
|
|
891
942
|
AND operation.provider = 'daytona'
|
|
892
943
|
AND operation.state = 'reserved'
|
|
893
944
|
RETURNING operation.operation_key, operation.run_id, operation.attempt,
|
|
@@ -87,7 +87,10 @@ export const testAsyncContractLookupBatchStrategy: BatchOperationStrategy<
|
|
|
87
87
|
const first = payloads[0]!;
|
|
88
88
|
const items = payloads.map((payload) => ({
|
|
89
89
|
itemKey: payload.key,
|
|
90
|
-
payload: {
|
|
90
|
+
payload: {
|
|
91
|
+
key: payload.key,
|
|
92
|
+
row_number: payload.row_number,
|
|
93
|
+
},
|
|
91
94
|
}));
|
|
92
95
|
return {
|
|
93
96
|
batchOperation: 'test_async_contract_start',
|
|
@@ -124,13 +124,24 @@ function parseRuntimeTestFaultHeader(
|
|
|
124
124
|
const count =
|
|
125
125
|
rawCount === undefined || rawCount.trim() === ''
|
|
126
126
|
? 1
|
|
127
|
-
:
|
|
127
|
+
: name === 'execution_upstream_response_loss'
|
|
128
|
+
? Number(rawCount.trim())
|
|
129
|
+
: Number.parseInt(rawCount.trim(), 10);
|
|
128
130
|
if (!Number.isInteger(count) || count < 1) {
|
|
129
131
|
return {
|
|
130
132
|
error: `Runtime test fault "${name}" count must be a positive integer.`,
|
|
131
133
|
};
|
|
132
134
|
}
|
|
133
|
-
|
|
135
|
+
const total = (faults.get(name) ?? 0) + count;
|
|
136
|
+
// This seam deliberately interrupts only the first buffered response of
|
|
137
|
+
// each invocation. Repeated losses would test retry exhaustion instead of
|
|
138
|
+
// the durable-result recovery contract.
|
|
139
|
+
if (name === 'execution_upstream_response_loss' && total !== 1) {
|
|
140
|
+
return {
|
|
141
|
+
error: `Runtime test fault "${name}" count must be 1.`,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
faults.set(name, total);
|
|
134
145
|
}
|
|
135
146
|
return faults;
|
|
136
147
|
}
|