deepline 0.1.210 → 0.1.211
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/apps/play-runner-workers/src/entry.ts +53 -1
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +15 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-latency-profile.ts +90 -0
- package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +161 -99
- package/dist/bundling-sources/sdk/src/play.ts +2 -0
- package/dist/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +343 -83
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +42 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +5 -1
- package/dist/bundling-sources/shared_libs/play-runtime/single-flight.ts +31 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +12 -1
- package/dist/bundling-sources/shared_libs/plays/dataset.ts +41 -5
- package/dist/cli/index.js +93 -12
- package/dist/cli/index.mjs +93 -12
- package/dist/index.d.mts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +22 -5
- package/dist/index.mjs +22 -5
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -608,10 +608,10 @@ var SDK_RELEASE = {
|
|
|
608
608
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
609
609
|
// fields shipped in 0.1.153.
|
|
610
610
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
611
|
-
version: "0.1.
|
|
611
|
+
version: "0.1.211",
|
|
612
612
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
613
613
|
supportPolicy: {
|
|
614
|
-
latest: "0.1.
|
|
614
|
+
latest: "0.1.211",
|
|
615
615
|
minimumSupported: "0.1.53",
|
|
616
616
|
deprecatedBelow: "0.1.53",
|
|
617
617
|
commandMinimumSupported: [
|
|
@@ -10855,7 +10855,8 @@ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
|
10855
10855
|
"--logs",
|
|
10856
10856
|
"--full",
|
|
10857
10857
|
"--force",
|
|
10858
|
-
"--no-open"
|
|
10858
|
+
"--no-open",
|
|
10859
|
+
"--debug-map-latency"
|
|
10859
10860
|
]);
|
|
10860
10861
|
function traceCliSync(phase, fields, run) {
|
|
10861
10862
|
const startedAt = Date.now();
|
|
@@ -14202,6 +14203,7 @@ function parsePlayRunOptions(args) {
|
|
|
14202
14203
|
const emitLogs = !jsonOutput || args.includes("--logs");
|
|
14203
14204
|
const force = args.includes("--force");
|
|
14204
14205
|
const noOpen = args.includes("--no-open");
|
|
14206
|
+
const debugMapLatency = args.includes("--debug-map-latency");
|
|
14205
14207
|
let waitTimeoutMs = null;
|
|
14206
14208
|
let profile = null;
|
|
14207
14209
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -14320,7 +14322,8 @@ function parsePlayRunOptions(args) {
|
|
|
14320
14322
|
waitTimeoutMs,
|
|
14321
14323
|
force,
|
|
14322
14324
|
noOpen,
|
|
14323
|
-
profile
|
|
14325
|
+
profile,
|
|
14326
|
+
debugMapLatency
|
|
14324
14327
|
};
|
|
14325
14328
|
}
|
|
14326
14329
|
function parsePlayCheckOptions(args) {
|
|
@@ -14805,6 +14808,7 @@ async function handleFileBackedRun(options) {
|
|
|
14805
14808
|
...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
|
|
14806
14809
|
...options.force ? { force: true } : {},
|
|
14807
14810
|
...options.profile ? { profile: options.profile } : {},
|
|
14811
|
+
...options.debugMapLatency ? { testPolicyOverrides: { mapLatencyProfile: true } } : {},
|
|
14808
14812
|
...integrationMode ? { integrationMode } : {}
|
|
14809
14813
|
};
|
|
14810
14814
|
if (options.watch) {
|
|
@@ -14966,6 +14970,7 @@ async function handleNamedRun(options) {
|
|
|
14966
14970
|
...stagedFileInputs.packagedFiles.length ? { packagedFiles: stagedFileInputs.packagedFiles } : {},
|
|
14967
14971
|
...options.force ? { force: true } : {},
|
|
14968
14972
|
...options.profile ? { profile: options.profile } : {},
|
|
14973
|
+
...options.debugMapLatency ? { testPolicyOverrides: { mapLatencyProfile: true } } : {},
|
|
14969
14974
|
...integrationMode ? { integrationMode } : {}
|
|
14970
14975
|
};
|
|
14971
14976
|
if (options.watch) {
|
|
@@ -16214,7 +16219,10 @@ Examples:
|
|
|
16214
16219
|
).option("--watch", "Compatibility alias; run waits by default").option("--wait", "Compatibility alias; run waits by default").option("--no-wait", "Start the run and return immediately").option(
|
|
16215
16220
|
"--logs",
|
|
16216
16221
|
"When output is non-interactive, stream play logs to stderr while waiting"
|
|
16217
|
-
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Start a fresh run graph").option(
|
|
16222
|
+
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Start a fresh run graph").option(
|
|
16223
|
+
"--debug-map-latency",
|
|
16224
|
+
"Internal diagnostics: emit one aggregate latency profile per dataset map"
|
|
16225
|
+
).option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").option("--full", "Debug only: with --json, emit the raw status payload").addHelpText(
|
|
16218
16226
|
"afterAll",
|
|
16219
16227
|
`
|
|
16220
16228
|
Pass-through input flags:
|
|
@@ -16250,6 +16258,7 @@ Pass-through input flags:
|
|
|
16250
16258
|
...options.logs ? ["--logs"] : [],
|
|
16251
16259
|
...options.tailTimeoutMs ? ["--tail-timeout-ms", options.tailTimeoutMs] : [],
|
|
16252
16260
|
...options.force ? ["--force"] : [],
|
|
16261
|
+
...options.debugMapLatency ? ["--debug-map-latency"] : [],
|
|
16253
16262
|
...options.noOpen || options.open === false ? ["--no-open"] : [],
|
|
16254
16263
|
...options.json ? ["--json"] : [],
|
|
16255
16264
|
...options.full ? ["--full"] : [],
|
|
@@ -17299,6 +17308,8 @@ function renderPlayStep(command, options) {
|
|
|
17299
17308
|
` const __dlRunIf = ${runIfJs};`,
|
|
17300
17309
|
` if (!__dlRunIf(templateRow)) return null;`
|
|
17301
17310
|
] : [];
|
|
17311
|
+
const inline = command.play?.inline;
|
|
17312
|
+
const inlineHandler = inline ? `__dlInlinePlay_${inline.sourceHash.slice(0, 16)}` : null;
|
|
17302
17313
|
return [
|
|
17303
17314
|
`async (row, stepCtx) => {`,
|
|
17304
17315
|
...options.precheck ? [` if (${options.precheck}) return null;`] : [],
|
|
@@ -17308,9 +17319,16 @@ function renderPlayStep(command, options) {
|
|
|
17308
17319
|
` if (__dlShouldSkipBlankPlayPayload(payload)) return null;`,
|
|
17309
17320
|
` let result: unknown;`,
|
|
17310
17321
|
` try {`,
|
|
17311
|
-
|
|
17312
|
-
|
|
17313
|
-
|
|
17322
|
+
...inlineHandler ? [
|
|
17323
|
+
// Enrich validates and normalizes this payload against the certified
|
|
17324
|
+
// prebuilt contract before code generation. The attachment retains
|
|
17325
|
+
// its concrete input type, while generated payloads are records.
|
|
17326
|
+
` result = await __dlRunInlinePlay(${inlineHandler}, stepCtx, payload as never, ${options.force});`
|
|
17327
|
+
] : [
|
|
17328
|
+
` result = await stepCtx.runPlay(${callId}, ${playRef}, payload, {`,
|
|
17329
|
+
` description: ${stringLiteral(command.description ?? command.alias)}`,
|
|
17330
|
+
` });`
|
|
17331
|
+
],
|
|
17314
17332
|
` } catch (error) {`,
|
|
17315
17333
|
...options.waterfallSoftFail ? [` return __dlWaterfallToolFailure(error);`] : [` throw error;`],
|
|
17316
17334
|
` }`,
|
|
@@ -17318,6 +17336,19 @@ function renderPlayStep(command, options) {
|
|
|
17318
17336
|
`}`
|
|
17319
17337
|
].join("\n");
|
|
17320
17338
|
}
|
|
17339
|
+
function collectInlinePlayHandlers(commands) {
|
|
17340
|
+
const handlers = /* @__PURE__ */ new Map();
|
|
17341
|
+
const visit = (command) => {
|
|
17342
|
+
if (isWaterfall(command)) {
|
|
17343
|
+
command.commands.forEach(visit);
|
|
17344
|
+
return;
|
|
17345
|
+
}
|
|
17346
|
+
const inline = command.play?.inline;
|
|
17347
|
+
if (inline) handlers.set(inline.sourceHash, inline);
|
|
17348
|
+
};
|
|
17349
|
+
commands.forEach(visit);
|
|
17350
|
+
return [...handlers.values()];
|
|
17351
|
+
}
|
|
17321
17352
|
function renderInlineJavascriptStep(command, options) {
|
|
17322
17353
|
const alias = stringLiteral(command.alias);
|
|
17323
17354
|
const extractJs = renderExtractFunction(command, 4);
|
|
@@ -17518,6 +17549,10 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
|
|
|
17518
17549
|
[...options.forceAliases ?? []].map((alias) => normalizeAlias(alias))
|
|
17519
17550
|
);
|
|
17520
17551
|
const columnSteps = [];
|
|
17552
|
+
const inlineHandlers = collectInlinePlayHandlers(config.commands);
|
|
17553
|
+
const inlineTypeImports = [
|
|
17554
|
+
...new Set(inlineHandlers.flatMap((inline) => inline.typeImports ?? []))
|
|
17555
|
+
].sort();
|
|
17521
17556
|
config.commands.forEach((command) => {
|
|
17522
17557
|
if (isWaterfall(command)) {
|
|
17523
17558
|
columnSteps.push(
|
|
@@ -17555,6 +17590,19 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
|
|
|
17555
17590
|
const generatedAliases = collectGeneratedAliases(config.commands);
|
|
17556
17591
|
const runOptionsSource = options.failFast ? `{ key: (row, index) => __dlEnrichRowKey(row, index + rowStart), onRowError: 'fail' as const }` : `{ key: (row, index) => __dlEnrichRowKey(row, index + rowStart) }`;
|
|
17557
17592
|
const body = [
|
|
17593
|
+
`function __dlRunInlinePlay<TContext, TInput, TOutput>(handler: (ctx: TContext, input: TInput) => Promise<TOutput>, scope: TContext, payload: TInput, force: boolean): Promise<TOutput> {`,
|
|
17594
|
+
` if (!force) return handler(scope, payload);`,
|
|
17595
|
+
` const runtimeScope = scope as TContext & { __deeplineRunWithForcedTools?: <T>(run: () => Promise<T>) => Promise<T> };`,
|
|
17596
|
+
` if (typeof runtimeScope.__deeplineRunWithForcedTools !== 'function') {`,
|
|
17597
|
+
` throw new Error('This runtime does not support forced certified inline play execution.');`,
|
|
17598
|
+
` }`,
|
|
17599
|
+
` return runtimeScope.__deeplineRunWithForcedTools(() => handler(scope, payload));`,
|
|
17600
|
+
`}`,
|
|
17601
|
+
``,
|
|
17602
|
+
...inlineHandlers.flatMap((inline) => [
|
|
17603
|
+
`const __dlInlinePlay_${inline.sourceHash.slice(0, 16)} = ${inline.functionExpressionSource};`,
|
|
17604
|
+
``
|
|
17605
|
+
]),
|
|
17558
17606
|
`export default definePlay(${stringLiteral(playName)}, async (ctx, input: EnrichInput) => {`,
|
|
17559
17607
|
` const sourceRows = await ctx.csv<Record<string, unknown>>(input.file);`,
|
|
17560
17608
|
` const rowStart = __dlNonNegativeInteger(input.rowStart, 0);`,
|
|
@@ -17579,7 +17627,8 @@ function compileEnrichConfigToPlaySource(config, options = {}) {
|
|
|
17579
17627
|
const helpers = idiomaticGetters ? selectUsedHelpers(helperSource(), body.join("\n")) : helperSource();
|
|
17580
17628
|
return [
|
|
17581
17629
|
...inlineRunJavascript && configHasRunJavascript(config) ? ["// @ts-nocheck", "/* eslint-disable */", ""] : [],
|
|
17582
|
-
`import { definePlay } from 'deepline';`,
|
|
17630
|
+
`import { definePlay, steps } from 'deepline';`,
|
|
17631
|
+
...inlineTypeImports.length > 0 ? [`import type { ${inlineTypeImports.join(", ")} } from 'deepline';`] : [],
|
|
17583
17632
|
``,
|
|
17584
17633
|
`type EnrichInput = { file: string; rowStart?: number | null; rowEnd?: number | null };`,
|
|
17585
17634
|
``,
|
|
@@ -18794,7 +18843,8 @@ async function buildPlanArgs(args) {
|
|
|
18794
18843
|
"--fail-fast",
|
|
18795
18844
|
"--all",
|
|
18796
18845
|
"--in-place",
|
|
18797
|
-
"--no-open"
|
|
18846
|
+
"--no-open",
|
|
18847
|
+
"--debug-map-latency"
|
|
18798
18848
|
]);
|
|
18799
18849
|
const planArgs = [];
|
|
18800
18850
|
for (let index = 0; index < args.length; index += 1) {
|
|
@@ -21347,11 +21397,15 @@ async function fetchBackingRowsForCsvExport(input2) {
|
|
|
21347
21397
|
}
|
|
21348
21398
|
function mergeRowsForCsvExport(enrichedRows, options) {
|
|
21349
21399
|
const compactAliases = options?.config ? enrichAiRuntimeCompactAliases(options.config) : /* @__PURE__ */ new Set();
|
|
21400
|
+
const preservedAliases = /* @__PURE__ */ new Set([
|
|
21401
|
+
...compactAliases,
|
|
21402
|
+
...options?.config ? collectConfigPlayAliases(options.config) : []
|
|
21403
|
+
]);
|
|
21350
21404
|
const rows = dataExportRows(
|
|
21351
21405
|
normalizeEnrichRowsForCsvExport(enrichedRows, options?.config, {
|
|
21352
21406
|
statusFailureMessages: options?.statusFailureMessages
|
|
21353
21407
|
}),
|
|
21354
|
-
{ preserveJsonStringColumns:
|
|
21408
|
+
{ preserveJsonStringColumns: preservedAliases }
|
|
21355
21409
|
);
|
|
21356
21410
|
const range = options?.rows;
|
|
21357
21411
|
if (!options?.sourceCsvPath) {
|
|
@@ -21428,6 +21482,22 @@ function mergeRowsForCsvExport(enrichedRows, options) {
|
|
|
21428
21482
|
}
|
|
21429
21483
|
return { rows: merged, preferredColumns };
|
|
21430
21484
|
}
|
|
21485
|
+
function collectConfigPlayAliases(config) {
|
|
21486
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
21487
|
+
const visit = (commands) => {
|
|
21488
|
+
for (const command of commands) {
|
|
21489
|
+
if ("with_waterfall" in command) {
|
|
21490
|
+
visit(command.commands);
|
|
21491
|
+
continue;
|
|
21492
|
+
}
|
|
21493
|
+
if (!command.disabled && command.play) {
|
|
21494
|
+
aliases.add(normalizeAlias2(command.alias));
|
|
21495
|
+
}
|
|
21496
|
+
}
|
|
21497
|
+
};
|
|
21498
|
+
visit(config.commands);
|
|
21499
|
+
return aliases;
|
|
21500
|
+
}
|
|
21431
21501
|
function collectConfigScalarAliasOrder(config) {
|
|
21432
21502
|
const aliases = [];
|
|
21433
21503
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -21583,6 +21653,9 @@ function materializeEnrichAliasCellForCsv(row, alias, options) {
|
|
|
21583
21653
|
if (Object.prototype.hasOwnProperty.call(direct, "matched_result") || Object.prototype.hasOwnProperty.call(direct, "matchedResult") || Object.prototype.hasOwnProperty.call(direct, "result")) {
|
|
21584
21654
|
return materializeCsvCellValue(direct);
|
|
21585
21655
|
}
|
|
21656
|
+
if (options?.preservePlainObject && !Object.prototype.hasOwnProperty.call(direct, "_metadata")) {
|
|
21657
|
+
return materializeCsvCellValue(direct);
|
|
21658
|
+
}
|
|
21586
21659
|
const directCells = [];
|
|
21587
21660
|
for (const [field, value] of Object.entries(direct)) {
|
|
21588
21661
|
if (!isEnrichAliasPayloadField(field)) {
|
|
@@ -21639,6 +21712,7 @@ function materializeEnrichAliasCellForCsv(row, alias, options) {
|
|
|
21639
21712
|
function normalizeEnrichRowsForCsvExport(rows, config, options) {
|
|
21640
21713
|
const aliases = config ? collectConfigScalarAliasOrder(config) : [];
|
|
21641
21714
|
const aiCompactAliases = config ? enrichAiRuntimeCompactAliases(config) : null;
|
|
21715
|
+
const playAliases = config ? collectConfigPlayAliases(config) : /* @__PURE__ */ new Set();
|
|
21642
21716
|
const failureOperationByAlias = hardFailureOperationByAlias(config);
|
|
21643
21717
|
return rows.map((row) => {
|
|
21644
21718
|
const metadata = legacyMetadataFromRow(row);
|
|
@@ -21682,7 +21756,8 @@ function normalizeEnrichRowsForCsvExport(rows, config, options) {
|
|
|
21682
21756
|
}
|
|
21683
21757
|
for (const alias of aliases) {
|
|
21684
21758
|
const value = materializeEnrichAliasCellForCsv(normalized, alias, {
|
|
21685
|
-
compactAiCell: aiCompactAliases?.has(normalizeAlias2(alias)) ?? false
|
|
21759
|
+
compactAiCell: aiCompactAliases?.has(normalizeAlias2(alias)) ?? false,
|
|
21760
|
+
preservePlainObject: playAliases.has(normalizeAlias2(alias))
|
|
21686
21761
|
});
|
|
21687
21762
|
if (value !== void 0) {
|
|
21688
21763
|
normalized[alias] = value;
|
|
@@ -21870,6 +21945,9 @@ function registerEnrichCommand(program) {
|
|
|
21870
21945
|
).option(
|
|
21871
21946
|
"--profile <id>",
|
|
21872
21947
|
"Internal/testing: override the execution profile for the generated play run."
|
|
21948
|
+
).option(
|
|
21949
|
+
"--debug-map-latency",
|
|
21950
|
+
"Internal diagnostics: emit one aggregate latency profile per dataset map."
|
|
21873
21951
|
).option(
|
|
21874
21952
|
"--fail-fast",
|
|
21875
21953
|
"Fail the generated play when any selected row errors, while preserving recovered runtime-sheet rows for export."
|
|
@@ -22015,6 +22093,9 @@ function registerEnrichCommand(program) {
|
|
|
22015
22093
|
if (options.profile) {
|
|
22016
22094
|
runArgs.push("--profile", options.profile);
|
|
22017
22095
|
}
|
|
22096
|
+
if (options.debugMapLatency) {
|
|
22097
|
+
runArgs.push("--debug-map-latency");
|
|
22098
|
+
}
|
|
22018
22099
|
if (options.noOpen || input2.suppressOpen) {
|
|
22019
22100
|
runArgs.push("--no-open");
|
|
22020
22101
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1143,6 +1143,13 @@ type EnrichStepCommand = {
|
|
|
1143
1143
|
play?: {
|
|
1144
1144
|
ref: string;
|
|
1145
1145
|
mode?: 'scalar';
|
|
1146
|
+
execution?: 'child' | 'inline';
|
|
1147
|
+
inline?: {
|
|
1148
|
+
exportName: string;
|
|
1149
|
+
functionExpressionSource: string;
|
|
1150
|
+
sourceHash: string;
|
|
1151
|
+
typeImports: string[];
|
|
1152
|
+
};
|
|
1146
1153
|
};
|
|
1147
1154
|
payload: Record<string, unknown>;
|
|
1148
1155
|
extract_js?: string;
|
|
@@ -2850,7 +2857,7 @@ interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
2850
2857
|
* Large datasets should flow by handle through Neon-backed storage, not
|
|
2851
2858
|
* through worker memory as giant arrays.
|
|
2852
2859
|
*/
|
|
2853
|
-
materialize(
|
|
2860
|
+
materialize(options?: number | PlayDatasetMaterializeOptions): Promise<T[]>;
|
|
2854
2861
|
toJSON(): {
|
|
2855
2862
|
kind: 'dataset';
|
|
2856
2863
|
datasetKind: PlayDatasetKind;
|
|
@@ -2866,6 +2873,13 @@ interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
2866
2873
|
preview: T[];
|
|
2867
2874
|
};
|
|
2868
2875
|
}
|
|
2876
|
+
type PlayDatasetMaterializeScope = 'result' | 'full_persisted_dataset';
|
|
2877
|
+
type PlayDatasetMaterializeOptions = {
|
|
2878
|
+
/** Rows returned by this operation, or every current row in its persisted dataset. */
|
|
2879
|
+
scope?: PlayDatasetMaterializeScope;
|
|
2880
|
+
/** Maximum number of rows to load into memory. */
|
|
2881
|
+
limit?: number;
|
|
2882
|
+
};
|
|
2869
2883
|
|
|
2870
2884
|
type ToolResultExecutionMetadata = {
|
|
2871
2885
|
idempotent: true;
|
|
@@ -3038,6 +3052,8 @@ type PlayBindings = {
|
|
|
3038
3052
|
* older clients can continue to register revisions during the migration.
|
|
3039
3053
|
*/
|
|
3040
3054
|
description?: string;
|
|
3055
|
+
/** Allow compilers to bundle this named handler directly without a child run. */
|
|
3056
|
+
inline?: boolean;
|
|
3041
3057
|
/** Optional per-run billing controls enforced by the runtime. */
|
|
3042
3058
|
billing?: {
|
|
3043
3059
|
/** Stop the run before a billed action would push total run credits above this cap. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1143,6 +1143,13 @@ type EnrichStepCommand = {
|
|
|
1143
1143
|
play?: {
|
|
1144
1144
|
ref: string;
|
|
1145
1145
|
mode?: 'scalar';
|
|
1146
|
+
execution?: 'child' | 'inline';
|
|
1147
|
+
inline?: {
|
|
1148
|
+
exportName: string;
|
|
1149
|
+
functionExpressionSource: string;
|
|
1150
|
+
sourceHash: string;
|
|
1151
|
+
typeImports: string[];
|
|
1152
|
+
};
|
|
1146
1153
|
};
|
|
1147
1154
|
payload: Record<string, unknown>;
|
|
1148
1155
|
extract_js?: string;
|
|
@@ -2850,7 +2857,7 @@ interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
2850
2857
|
* Large datasets should flow by handle through Neon-backed storage, not
|
|
2851
2858
|
* through worker memory as giant arrays.
|
|
2852
2859
|
*/
|
|
2853
|
-
materialize(
|
|
2860
|
+
materialize(options?: number | PlayDatasetMaterializeOptions): Promise<T[]>;
|
|
2854
2861
|
toJSON(): {
|
|
2855
2862
|
kind: 'dataset';
|
|
2856
2863
|
datasetKind: PlayDatasetKind;
|
|
@@ -2866,6 +2873,13 @@ interface PlayDataset<T> extends AsyncIterable<T> {
|
|
|
2866
2873
|
preview: T[];
|
|
2867
2874
|
};
|
|
2868
2875
|
}
|
|
2876
|
+
type PlayDatasetMaterializeScope = 'result' | 'full_persisted_dataset';
|
|
2877
|
+
type PlayDatasetMaterializeOptions = {
|
|
2878
|
+
/** Rows returned by this operation, or every current row in its persisted dataset. */
|
|
2879
|
+
scope?: PlayDatasetMaterializeScope;
|
|
2880
|
+
/** Maximum number of rows to load into memory. */
|
|
2881
|
+
limit?: number;
|
|
2882
|
+
};
|
|
2869
2883
|
|
|
2870
2884
|
type ToolResultExecutionMetadata = {
|
|
2871
2885
|
idempotent: true;
|
|
@@ -3038,6 +3052,8 @@ type PlayBindings = {
|
|
|
3038
3052
|
* older clients can continue to register revisions during the migration.
|
|
3039
3053
|
*/
|
|
3040
3054
|
description?: string;
|
|
3055
|
+
/** Allow compilers to bundle this named handler directly without a child run. */
|
|
3056
|
+
inline?: boolean;
|
|
3041
3057
|
/** Optional per-run billing controls enforced by the runtime. */
|
|
3042
3058
|
billing?: {
|
|
3043
3059
|
/** Stop the run before a billed action would push total run credits above this cap. */
|
package/dist/index.js
CHANGED
|
@@ -422,10 +422,10 @@ var SDK_RELEASE = {
|
|
|
422
422
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
423
423
|
// fields shipped in 0.1.153.
|
|
424
424
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
425
|
-
version: "0.1.
|
|
425
|
+
version: "0.1.211",
|
|
426
426
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
427
427
|
supportPolicy: {
|
|
428
|
-
latest: "0.1.
|
|
428
|
+
latest: "0.1.211",
|
|
429
429
|
minimumSupported: "0.1.53",
|
|
430
430
|
deprecatedBelow: "0.1.53",
|
|
431
431
|
commandMinimumSupported: [
|
|
@@ -4485,16 +4485,33 @@ var DeferredPlayDataset = class {
|
|
|
4485
4485
|
take(limit, options) {
|
|
4486
4486
|
return this.slice(0, limit, options);
|
|
4487
4487
|
}
|
|
4488
|
-
async materialize(
|
|
4488
|
+
async materialize(options) {
|
|
4489
|
+
const scope = typeof options === "object" ? options.scope ?? "result" : "result";
|
|
4490
|
+
const limit = typeof options === "number" ? options : options?.limit;
|
|
4489
4491
|
const requestedLimit = limit !== void 0 ? Math.max(0, Math.floor(limit)) : void 0;
|
|
4490
4492
|
const cap = resolveMaterializeLimitCap();
|
|
4493
|
+
const materialize = scope === "full_persisted_dataset" ? this.resolvers.materializeFullPersistedDataset : this.resolvers.materialize;
|
|
4494
|
+
if (!materialize) {
|
|
4495
|
+
throw new Error(
|
|
4496
|
+
'PlayDataset.materialize({ scope: "full_persisted_dataset" }) is only available for a persisted dataset returned by ctx.dataset(...).run().'
|
|
4497
|
+
);
|
|
4498
|
+
}
|
|
4491
4499
|
if (requestedLimit !== void 0) {
|
|
4492
4500
|
if (requestedLimit > cap) {
|
|
4493
4501
|
throw new Error(
|
|
4494
4502
|
`PlayDataset.materialize(${requestedLimit}) exceeds the hard limit of ${cap} rows. Return the dataset handle instead, or request a smaller bounded slice.`
|
|
4495
4503
|
);
|
|
4496
4504
|
}
|
|
4497
|
-
return await
|
|
4505
|
+
return await materialize(requestedLimit);
|
|
4506
|
+
}
|
|
4507
|
+
if (scope === "full_persisted_dataset") {
|
|
4508
|
+
const rows = await materialize(cap + 1);
|
|
4509
|
+
if (rows.length > cap) {
|
|
4510
|
+
throw new Error(
|
|
4511
|
+
`PlayDataset.materialize({ scope: "full_persisted_dataset" }) refuses to load more than ${cap} rows into memory. Pass an explicit bounded limit.`
|
|
4512
|
+
);
|
|
4513
|
+
}
|
|
4514
|
+
return rows;
|
|
4498
4515
|
}
|
|
4499
4516
|
const count = await this.count();
|
|
4500
4517
|
if (count > cap) {
|
|
@@ -4502,7 +4519,7 @@ var DeferredPlayDataset = class {
|
|
|
4502
4519
|
`PlayDataset.materialize() refuses to load ${count} rows into memory. The hard limit is ${cap}. Return the dataset handle instead or call materialize(limit).`
|
|
4503
4520
|
);
|
|
4504
4521
|
}
|
|
4505
|
-
return await
|
|
4522
|
+
return await materialize();
|
|
4506
4523
|
}
|
|
4507
4524
|
async *[Symbol.asyncIterator]() {
|
|
4508
4525
|
for await (const row of this.resolvers.iterate()) {
|
package/dist/index.mjs
CHANGED
|
@@ -352,10 +352,10 @@ var SDK_RELEASE = {
|
|
|
352
352
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
353
353
|
// fields shipped in 0.1.153.
|
|
354
354
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
355
|
-
version: "0.1.
|
|
355
|
+
version: "0.1.211",
|
|
356
356
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
357
357
|
supportPolicy: {
|
|
358
|
-
latest: "0.1.
|
|
358
|
+
latest: "0.1.211",
|
|
359
359
|
minimumSupported: "0.1.53",
|
|
360
360
|
deprecatedBelow: "0.1.53",
|
|
361
361
|
commandMinimumSupported: [
|
|
@@ -4415,16 +4415,33 @@ var DeferredPlayDataset = class {
|
|
|
4415
4415
|
take(limit, options) {
|
|
4416
4416
|
return this.slice(0, limit, options);
|
|
4417
4417
|
}
|
|
4418
|
-
async materialize(
|
|
4418
|
+
async materialize(options) {
|
|
4419
|
+
const scope = typeof options === "object" ? options.scope ?? "result" : "result";
|
|
4420
|
+
const limit = typeof options === "number" ? options : options?.limit;
|
|
4419
4421
|
const requestedLimit = limit !== void 0 ? Math.max(0, Math.floor(limit)) : void 0;
|
|
4420
4422
|
const cap = resolveMaterializeLimitCap();
|
|
4423
|
+
const materialize = scope === "full_persisted_dataset" ? this.resolvers.materializeFullPersistedDataset : this.resolvers.materialize;
|
|
4424
|
+
if (!materialize) {
|
|
4425
|
+
throw new Error(
|
|
4426
|
+
'PlayDataset.materialize({ scope: "full_persisted_dataset" }) is only available for a persisted dataset returned by ctx.dataset(...).run().'
|
|
4427
|
+
);
|
|
4428
|
+
}
|
|
4421
4429
|
if (requestedLimit !== void 0) {
|
|
4422
4430
|
if (requestedLimit > cap) {
|
|
4423
4431
|
throw new Error(
|
|
4424
4432
|
`PlayDataset.materialize(${requestedLimit}) exceeds the hard limit of ${cap} rows. Return the dataset handle instead, or request a smaller bounded slice.`
|
|
4425
4433
|
);
|
|
4426
4434
|
}
|
|
4427
|
-
return await
|
|
4435
|
+
return await materialize(requestedLimit);
|
|
4436
|
+
}
|
|
4437
|
+
if (scope === "full_persisted_dataset") {
|
|
4438
|
+
const rows = await materialize(cap + 1);
|
|
4439
|
+
if (rows.length > cap) {
|
|
4440
|
+
throw new Error(
|
|
4441
|
+
`PlayDataset.materialize({ scope: "full_persisted_dataset" }) refuses to load more than ${cap} rows into memory. Pass an explicit bounded limit.`
|
|
4442
|
+
);
|
|
4443
|
+
}
|
|
4444
|
+
return rows;
|
|
4428
4445
|
}
|
|
4429
4446
|
const count = await this.count();
|
|
4430
4447
|
if (count > cap) {
|
|
@@ -4432,7 +4449,7 @@ var DeferredPlayDataset = class {
|
|
|
4432
4449
|
`PlayDataset.materialize() refuses to load ${count} rows into memory. The hard limit is ${cap}. Return the dataset handle instead or call materialize(limit).`
|
|
4433
4450
|
);
|
|
4434
4451
|
}
|
|
4435
|
-
return await
|
|
4452
|
+
return await materialize();
|
|
4436
4453
|
}
|
|
4437
4454
|
async *[Symbol.asyncIterator]() {
|
|
4438
4455
|
for await (const row of this.resolvers.iterate()) {
|