deepline 0.3.285 → 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/context.ts +21 -0
- 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/scheduler-backends/absurd-runtime-worker.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +240 -89
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +40 -7
- package/dist/bundling-sources/shared_libs/play-runtime/test-async-batching.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +68 -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 +30130 -33940
- package/dist/cli/index.mjs +30166 -33987
- package/dist/{client-T2jVnZrq.d.ts → client-B7ic-kY5.d.ts} +2 -3
- package/dist/{client-Cl-zj2oS.d.mts → client-Dzf_KovW.d.mts} +2 -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 +10 -4
- package/dist/index.mjs +10 -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],
|
|
@@ -770,7 +769,10 @@ export async function bindRuntimeSandboxCapacityLease(
|
|
|
770
769
|
`
|
|
771
770
|
UPDATE ${leases}
|
|
772
771
|
SET provider = $2, sandbox_id = $3, routing_domain = $4
|
|
773
|
-
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)
|
|
774
776
|
RETURNING lease_id
|
|
775
777
|
`,
|
|
776
778
|
[
|
|
@@ -793,7 +795,7 @@ export async function releaseRuntimeSandboxCapacityLease(
|
|
|
793
795
|
`
|
|
794
796
|
UPDATE ${leases}
|
|
795
797
|
SET released_at = clock_timestamp()
|
|
796
|
-
WHERE lease_id = $1 AND released_at IS NULL
|
|
798
|
+
WHERE lease_id = $1 AND released_at IS NULL AND sandbox_id IS NULL
|
|
797
799
|
RETURNING lease_id
|
|
798
800
|
`,
|
|
799
801
|
[assertId(input.leaseId, 'leaseId')],
|
|
@@ -811,15 +813,29 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
811
813
|
input: { operationKey: string },
|
|
812
814
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
813
815
|
): Promise<boolean> {
|
|
814
|
-
const { leases, operations } = schemaTables(options);
|
|
816
|
+
const { leases, operations, runs } = schemaTables(options);
|
|
815
817
|
const result = await client.query<{ operation_key: string }>(
|
|
816
818
|
`
|
|
817
|
-
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 (
|
|
818
833
|
UPDATE ${operations} AS operation
|
|
819
834
|
SET state = $2,
|
|
820
835
|
updated_at = clock_timestamp()
|
|
821
836
|
WHERE operation.operation_key = $1
|
|
822
837
|
AND operation.state = $3
|
|
838
|
+
AND EXISTS (SELECT 1 FROM eligible_lease)
|
|
823
839
|
RETURNING operation.operation_key
|
|
824
840
|
), released AS (
|
|
825
841
|
UPDATE ${leases} AS lease
|
|
@@ -898,14 +914,31 @@ export async function recordRecoveredDaytonaCancellationSandbox(
|
|
|
898
914
|
const { operations, leases, cleanup } = schemaTables(options);
|
|
899
915
|
const schema = quoteIdent(options?.schema ?? 'runtime_scheduler');
|
|
900
916
|
const recorded = await client.query<{ operation_key: string }>(
|
|
901
|
-
`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 (
|
|
902
934
|
UPDATE ${operations} AS operation
|
|
903
935
|
SET state = 'deleting',
|
|
904
936
|
sandbox_id = $2,
|
|
905
937
|
routing_domain = $3,
|
|
906
938
|
provider_created_at = clock_timestamp(),
|
|
907
939
|
updated_at = clock_timestamp()
|
|
908
|
-
|
|
940
|
+
FROM custody_operation
|
|
941
|
+
WHERE operation.operation_key = custody_operation.operation_key
|
|
909
942
|
AND operation.provider = 'daytona'
|
|
910
943
|
AND operation.state = 'reserved'
|
|
911
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',
|
|
@@ -2159,3 +2159,71 @@ export function cloneToolExecuteResultWithExecution<TResult>(
|
|
|
2159
2159
|
execution,
|
|
2160
2160
|
}) as ToolExecuteResult<TResult>;
|
|
2161
2161
|
}
|
|
2162
|
+
|
|
2163
|
+
/**
|
|
2164
|
+
* Native splitters return the logical source response; the historical adapter
|
|
2165
|
+
* stores it inside an extra `{ data }` layer. Keep that immutable receipt and
|
|
2166
|
+
* its legacy raw/getter projections, and select the source response only at a
|
|
2167
|
+
* newly admitted Play's boundary. This is one provenance-backed projection,
|
|
2168
|
+
* never recursive provider-envelope unwrapping.
|
|
2169
|
+
*/
|
|
2170
|
+
export function projectNativeBatchToolResponse(
|
|
2171
|
+
value: ToolExecuteResult,
|
|
2172
|
+
policy: 'legacy_envelope' | 'logical_response' = 'logical_response',
|
|
2173
|
+
): ToolExecuteResult {
|
|
2174
|
+
const stored = value.toolResponse.rawV2;
|
|
2175
|
+
const materialized = value.meta?.nativeBatchResponseMaterialized === true;
|
|
2176
|
+
if (policy === 'legacy_envelope' && !materialized) return value;
|
|
2177
|
+
if (policy === 'logical_response' && materialized) return value;
|
|
2178
|
+
if (!materialized && (!isRecord(stored) || !Object.hasOwn(stored, 'data')))
|
|
2179
|
+
return value;
|
|
2180
|
+
const recordedView = value.meta?.nativeBatchResponseView;
|
|
2181
|
+
let view: ToolResponseView | undefined =
|
|
2182
|
+
recordedView === 'data' || recordedView === 'rawV2'
|
|
2183
|
+
? recordedView
|
|
2184
|
+
: undefined;
|
|
2185
|
+
if (view !== 'data' && view !== 'rawV2') {
|
|
2186
|
+
// Retained BounceBan receipts predate the provenance fact. Its scalar
|
|
2187
|
+
// action returns `{ data: verdict }`; only the old batch adapter adds
|
|
2188
|
+
// `{ data: { data: verdict } }`. Do not apply this repair to other tools
|
|
2189
|
+
// or infer it from a provider's arbitrary `data` field.
|
|
2190
|
+
const source = (stored as Record<string, unknown>).data;
|
|
2191
|
+
const verdict = isRecord(source) ? source.data : undefined;
|
|
2192
|
+
if (
|
|
2193
|
+
value._metadata.toolId !== 'bounceban_verify_single' ||
|
|
2194
|
+
!isRecord(source) ||
|
|
2195
|
+
!isRecord(verdict) ||
|
|
2196
|
+
typeof verdict.email !== 'string' ||
|
|
2197
|
+
(verdict.status !== undefined && verdict.status !== 'success') ||
|
|
2198
|
+
!['deliverable', 'undeliverable', 'risky', 'unknown'].includes(
|
|
2199
|
+
String(verdict.result),
|
|
2200
|
+
)
|
|
2201
|
+
) {
|
|
2202
|
+
return value;
|
|
2203
|
+
}
|
|
2204
|
+
view = 'data';
|
|
2205
|
+
}
|
|
2206
|
+
const response = {
|
|
2207
|
+
...value.toolResponse,
|
|
2208
|
+
rawV2: materialized
|
|
2209
|
+
? { data: stored }
|
|
2210
|
+
: (stored as Record<string, unknown>).data,
|
|
2211
|
+
view: materialized ? ('data' as const) : view,
|
|
2212
|
+
};
|
|
2213
|
+
// Preserve non-enumerable metadata/aliases and live list/getter accessors.
|
|
2214
|
+
// Do not mutate a result shared with another artifact or the receipt cache.
|
|
2215
|
+
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
2216
|
+
descriptors.toolResponse = { ...descriptors.toolResponse, value: response };
|
|
2217
|
+
descriptors.toolOutput = { ...descriptors.toolOutput, value: response };
|
|
2218
|
+
descriptors.meta = {
|
|
2219
|
+
value: {
|
|
2220
|
+
...value.meta,
|
|
2221
|
+
nativeBatchResponseView: view,
|
|
2222
|
+
nativeBatchResponseMaterialized: !materialized,
|
|
2223
|
+
},
|
|
2224
|
+
writable: true,
|
|
2225
|
+
enumerable: true,
|
|
2226
|
+
configurable: true,
|
|
2227
|
+
};
|
|
2228
|
+
return Object.create(Object.getPrototypeOf(value), descriptors);
|
|
2229
|
+
}
|
|
@@ -7,10 +7,12 @@ import type { ToolExecutionErrorSchemaVersion } from './tool-execution-error';
|
|
|
7
7
|
import type { PlayDataset, PlayDatasetInput, PlayDatasetRow } from './dataset';
|
|
8
8
|
|
|
9
9
|
export const LEGACY_PLAY_AUTHORING_CONTRACT_EDITION = 1 as const;
|
|
10
|
+
// Reader-first rollout: accept edition 9, but keep new bundles on edition 8
|
|
11
|
+
// until the edition-9 runtime reader has completed deployment.
|
|
10
12
|
export const PLAY_AUTHORING_CONTRACT_EDITION = 8 as const;
|
|
11
13
|
export const PLAY_AUTHORING_INPUT_SCHEMA_SNAPSHOT_EDITION = 3 as const;
|
|
12
14
|
export const SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS = [
|
|
13
|
-
1, 2, 3, 4, 5, 6, 7, 8,
|
|
15
|
+
1, 2, 3, 4, 5, 6, 7, 8, 9,
|
|
14
16
|
] as const;
|
|
15
17
|
|
|
16
18
|
export type PlayAuthoringContractEdition =
|
|
@@ -75,6 +77,13 @@ const PLAY_AUTHORING_CONTRACT_CHANGELOG_DETAILS = [
|
|
|
75
77
|
newWritesEnd: null,
|
|
76
78
|
readerRemoval: null,
|
|
77
79
|
},
|
|
80
|
+
{
|
|
81
|
+
changed:
|
|
82
|
+
'Projects native-batch rawV2 to the logical source response at the Play boundary. Editions 1–8 retain their admitted response nesting; completed tool receipts and provider identities are unchanged.',
|
|
83
|
+
compatibilityOwner: 'Plays Runtime',
|
|
84
|
+
newWritesEnd: null,
|
|
85
|
+
readerRemoval: null,
|
|
86
|
+
},
|
|
78
87
|
] as const;
|
|
79
88
|
|
|
80
89
|
export const PLAY_AUTHORING_CONTRACT_CHANGELOG =
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export const ENRICH_COMPAT_DEFAULT_PLAY_NAME = 'deepline-enrich-v1-compat';
|
|
2
2
|
export const ENRICH_COMPAT_DEFAULT_MAP_NAME = 'deepline_enrich_rows';
|
|
3
|
+
export const ENRICH_COMMAND_DEPRECATION_MESSAGE =
|
|
4
|
+
'The `deepline enrich` command is deprecated. Deepline Plays gives much better results. Run `deepline plays --help` to get started. If you still need the legacy command, submit feedback explaining why.';
|
|
3
5
|
|
|
4
6
|
export type EnrichCompatibilityOptions = {
|
|
5
7
|
playName?: string;
|