deepline 0.1.301 → 0.1.303
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 +8 -0
- package/dist/bundling-sources/sdk/src/errors.ts +96 -36
- package/dist/bundling-sources/sdk/src/http.ts +82 -5
- package/dist/bundling-sources/sdk/src/index.ts +12 -0
- package/dist/bundling-sources/sdk/src/play.ts +29 -1
- package/dist/bundling-sources/sdk/src/release.ts +5 -3
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +120 -14
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +59 -11
- package/dist/bundling-sources/shared_libs/play-runtime/execution-ledger-store.ts +3 -3
- package/dist/bundling-sources/shared_libs/play-runtime/execution-plan.ts +0 -15
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-actions.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +136 -36
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +17 -12
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +210 -5
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result-paths.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result-types.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +33 -24
- package/dist/bundling-sources/shared_libs/play-runtime/work-receipts.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-contract-version.ts +6 -0
- package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +159 -12
- package/dist/bundling-sources/shared_libs/plays/contracts.ts +69 -1
- package/dist/bundling-sources/shared_libs/tool-execution-error.ts +557 -0
- package/dist/cli/index.js +556 -183
- package/dist/cli/index.mjs +556 -183
- package/dist/index.d.mts +69 -40
- package/dist/index.d.ts +69 -40
- package/dist/index.js +480 -80
- package/dist/index.mjs +477 -80
- package/dist/plays/bundle-play-file.d.mts +4 -2
- package/dist/plays/bundle-play-file.d.ts +4 -2
- package/dist/plays/bundle-play-file.mjs +116 -19
- package/dist/tool-execution-error-YDz7UMl-.d.mts +440 -0
- package/dist/tool-execution-error-YDz7UMl-.d.ts +440 -0
- package/package.json +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/completed-receipt-cache.ts +0 -166
- package/dist/compiler-manifest-BjopNIqx.d.mts +0 -240
- package/dist/compiler-manifest-BjopNIqx.d.ts +0 -240
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../
|
|
2
|
-
export { b as PLAY_ARTIFACT_KINDS } from '../
|
|
1
|
+
import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-YDz7UMl-.mjs';
|
|
2
|
+
export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-YDz7UMl-.mjs';
|
|
3
3
|
|
|
4
4
|
type PlayPackageImport = {
|
|
5
5
|
name: string;
|
|
@@ -17,6 +17,8 @@ type PlayArtifactCompatibility = {
|
|
|
17
17
|
minRunnerVersion: number;
|
|
18
18
|
runtimeFeatures: PlayRuntimeFeature[];
|
|
19
19
|
runtimeBackend?: string | null;
|
|
20
|
+
/** Missing preserves the legacy schema used before this field existed. */
|
|
21
|
+
toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
|
|
20
22
|
};
|
|
21
23
|
/** The only executable Play artifact contract. */
|
|
22
24
|
type PlayArtifactKind = 'cjs_node20';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../
|
|
2
|
-
export { b as PLAY_ARTIFACT_KINDS } from '../
|
|
1
|
+
import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-YDz7UMl-.js';
|
|
2
|
+
export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-YDz7UMl-.js';
|
|
3
3
|
|
|
4
4
|
type PlayPackageImport = {
|
|
5
5
|
name: string;
|
|
@@ -17,6 +17,8 @@ type PlayArtifactCompatibility = {
|
|
|
17
17
|
minRunnerVersion: number;
|
|
18
18
|
runtimeFeatures: PlayRuntimeFeature[];
|
|
19
19
|
runtimeBackend?: string | null;
|
|
20
|
+
/** Missing preserves the legacy schema used before this field existed. */
|
|
21
|
+
toolErrorSchemaVersion?: ToolExecutionErrorSchemaVersion;
|
|
20
22
|
};
|
|
21
23
|
/** The only executable Play artifact contract. */
|
|
22
24
|
type PlayArtifactKind = 'cjs_node20';
|
|
@@ -43,9 +43,15 @@ var PLAY_BACKEND_DESCRIPTORS = {
|
|
|
43
43
|
}
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
+
// ../shared_libs/tool-execution-error.ts
|
|
47
|
+
var TOOL_EXECUTION_ERROR_SCHEMA_VERSION = 1;
|
|
48
|
+
|
|
49
|
+
// ../shared_libs/plays/artifact-contract-version.ts
|
|
50
|
+
var CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION = 2;
|
|
51
|
+
|
|
46
52
|
// ../shared_libs/plays/contracts.ts
|
|
47
53
|
var PLAY_PUBLIC_API_VERSION = 1;
|
|
48
|
-
var PLAY_ARTIFACT_VERSION =
|
|
54
|
+
var PLAY_ARTIFACT_VERSION = CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION;
|
|
49
55
|
var PLAY_MIN_RUNNER_VERSION = 1;
|
|
50
56
|
var PLAY_RUNTIME_FEATURES = [
|
|
51
57
|
"artifact_storage",
|
|
@@ -59,7 +65,8 @@ function buildPlayContractCompatibility(input) {
|
|
|
59
65
|
artifactVersion: PLAY_ARTIFACT_VERSION,
|
|
60
66
|
minRunnerVersion: PLAY_MIN_RUNNER_VERSION,
|
|
61
67
|
runtimeFeatures: [...PLAY_RUNTIME_FEATURES],
|
|
62
|
-
runtimeBackend: input?.runtimeBackend ?? null
|
|
68
|
+
runtimeBackend: input?.runtimeBackend ?? null,
|
|
69
|
+
toolErrorSchemaVersion: input?.toolErrorSchemaVersion ?? TOOL_EXECUTION_ERROR_SCHEMA_VERSION
|
|
63
70
|
};
|
|
64
71
|
}
|
|
65
72
|
|
|
@@ -133,7 +140,7 @@ function validatePlaySourceFilesHaveNoInlineSecrets(sourceFiles) {
|
|
|
133
140
|
var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
|
|
134
141
|
|
|
135
142
|
// ../shared_libs/plays/bundling/index.ts
|
|
136
|
-
var PLAY_BUNDLE_CACHE_VERSION =
|
|
143
|
+
var PLAY_BUNDLE_CACHE_VERSION = 27;
|
|
137
144
|
var PLAY_ARTIFACT_CACHE_DIR = join(
|
|
138
145
|
tmpdir(),
|
|
139
146
|
`deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`
|
|
@@ -283,15 +290,6 @@ function findSourceImportReferences(sourceCode) {
|
|
|
283
290
|
function extractDefinedPlayName(sourceCode) {
|
|
284
291
|
return extractDefinedPlayMetadata(sourceCode, null)?.name ?? null;
|
|
285
292
|
}
|
|
286
|
-
function extractDefinedPlayNameForExport(sourceCode, exportName) {
|
|
287
|
-
return extractDefinedPlayMetadata(sourceCode, exportName)?.name ?? null;
|
|
288
|
-
}
|
|
289
|
-
function extractDefinedPlayDescription(sourceCode) {
|
|
290
|
-
return extractDefinedPlayMetadata(sourceCode, null)?.description ?? null;
|
|
291
|
-
}
|
|
292
|
-
function extractDefinedPlayDescriptionForExport(sourceCode, exportName) {
|
|
293
|
-
return extractDefinedPlayMetadata(sourceCode, exportName)?.description ?? null;
|
|
294
|
-
}
|
|
295
293
|
var TypeScriptParser = Parser.extend(
|
|
296
294
|
tsPlugin({
|
|
297
295
|
allowSatisfies: true,
|
|
@@ -499,9 +497,11 @@ function staticStringFromExpression(node, context, seen = /* @__PURE__ */ new Se
|
|
|
499
497
|
);
|
|
500
498
|
}
|
|
501
499
|
function propertyNameFromKey(property) {
|
|
502
|
-
if (property.computed) return null;
|
|
503
500
|
const key = isAstNode(property.key) ? property.key : null;
|
|
504
501
|
if (!key) return null;
|
|
502
|
+
if (property.computed) {
|
|
503
|
+
return key.type === "Literal" && typeof key.value === "string" ? key.value : null;
|
|
504
|
+
}
|
|
505
505
|
if (key.type === "Identifier" && typeof key.name === "string") {
|
|
506
506
|
return key.name;
|
|
507
507
|
}
|
|
@@ -523,6 +523,77 @@ function objectExpressionFromNode(node, context, seen = /* @__PURE__ */ new Set(
|
|
|
523
523
|
seen
|
|
524
524
|
);
|
|
525
525
|
}
|
|
526
|
+
function resolveStaticProperty(node, propertyName, context, ancestors = /* @__PURE__ */ new Set()) {
|
|
527
|
+
if (!node) return { kind: "absent" };
|
|
528
|
+
const object = objectExpressionFromNode(node, context);
|
|
529
|
+
if (!object) return { kind: "unknown" };
|
|
530
|
+
if (ancestors.has(object)) return { kind: "unknown" };
|
|
531
|
+
const nextAncestors = new Set(ancestors).add(object);
|
|
532
|
+
let resolution = { kind: "absent" };
|
|
533
|
+
for (const property of astArray(object.properties)) {
|
|
534
|
+
if (property.type === "SpreadElement") {
|
|
535
|
+
const spreadResolution = resolveStaticProperty(
|
|
536
|
+
isAstNode(property.argument) ? property.argument : null,
|
|
537
|
+
propertyName,
|
|
538
|
+
context,
|
|
539
|
+
nextAncestors
|
|
540
|
+
);
|
|
541
|
+
if (spreadResolution.kind !== "absent") {
|
|
542
|
+
resolution = spreadResolution;
|
|
543
|
+
}
|
|
544
|
+
continue;
|
|
545
|
+
}
|
|
546
|
+
if (property.type !== "Property") continue;
|
|
547
|
+
const resolvedPropertyName = propertyNameFromKey(property);
|
|
548
|
+
if (resolvedPropertyName !== propertyName) {
|
|
549
|
+
if (property.computed && resolvedPropertyName === null) {
|
|
550
|
+
resolution = { kind: "unknown" };
|
|
551
|
+
}
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
const propertyValue = property.shorthand ? property.key : property.value;
|
|
555
|
+
resolution = isAstNode(propertyValue) ? { kind: "found", value: propertyValue } : { kind: "unknown" };
|
|
556
|
+
}
|
|
557
|
+
return resolution;
|
|
558
|
+
}
|
|
559
|
+
function staticNumberFromExpression(node, context, seen = /* @__PURE__ */ new Set()) {
|
|
560
|
+
const expression = unwrapStaticExpression(node);
|
|
561
|
+
if (!expression) return null;
|
|
562
|
+
if (expression.type === "Literal" && typeof expression.value === "number") {
|
|
563
|
+
return expression.value;
|
|
564
|
+
}
|
|
565
|
+
const identifier = getIdentifierName(expression);
|
|
566
|
+
if (!identifier || seen.has(identifier)) return null;
|
|
567
|
+
seen.add(identifier);
|
|
568
|
+
return staticNumberFromExpression(
|
|
569
|
+
context.declarations.get(identifier),
|
|
570
|
+
context,
|
|
571
|
+
seen
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
function toolErrorSchemaVersionFromOptions(node, context) {
|
|
575
|
+
const directCompatibility = resolveStaticProperty(
|
|
576
|
+
node,
|
|
577
|
+
"compatibility",
|
|
578
|
+
context
|
|
579
|
+
);
|
|
580
|
+
if (directCompatibility.kind === "unknown") return null;
|
|
581
|
+
const bindings = resolveStaticProperty(node, "bindings", context);
|
|
582
|
+
if (bindings.kind === "unknown") return null;
|
|
583
|
+
const bindingCompatibility = bindings.kind === "found" ? resolveStaticProperty(bindings.value, "compatibility", context) : { kind: "absent" };
|
|
584
|
+
if (bindingCompatibility.kind === "unknown") return null;
|
|
585
|
+
const compatibility = directCompatibility.kind === "found" ? directCompatibility : bindingCompatibility;
|
|
586
|
+
if (compatibility.kind === "absent") return void 0;
|
|
587
|
+
const schema = resolveStaticProperty(
|
|
588
|
+
compatibility.value,
|
|
589
|
+
"toolErrorSchemaVersion",
|
|
590
|
+
context
|
|
591
|
+
);
|
|
592
|
+
if (schema.kind !== "found") return null;
|
|
593
|
+
const schemaVersion = staticNumberFromExpression(schema.value, context);
|
|
594
|
+
if (schemaVersion === 0 || schemaVersion === 1) return schemaVersion;
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
526
597
|
function stringPropertyFromObjectExpression(node, propertyName, context, seenObjects = /* @__PURE__ */ new Set()) {
|
|
527
598
|
const object = objectExpressionFromNode(node, context);
|
|
528
599
|
if (!object || seenObjects.has(object)) return null;
|
|
@@ -568,12 +639,13 @@ function playMetadataFromDefinePlayCall(node, context) {
|
|
|
568
639
|
}
|
|
569
640
|
const args = astArray(expression.arguments);
|
|
570
641
|
const firstArg = args[0] ?? null;
|
|
642
|
+
const isObjectForm = args.length === 1 || objectExpressionFromNode(firstArg, context) !== null;
|
|
571
643
|
const objectName = stringPropertyFromObjectExpression(
|
|
572
644
|
firstArg,
|
|
573
645
|
"id",
|
|
574
646
|
context
|
|
575
647
|
);
|
|
576
|
-
const name = objectName
|
|
648
|
+
const name = isObjectForm ? objectName : staticStringFromExpression(firstArg, context);
|
|
577
649
|
let description = stringPropertyFromObjectExpression(firstArg, "description", context) ?? null;
|
|
578
650
|
for (let index = args.length - 1; !description && index >= 2; index -= 1) {
|
|
579
651
|
description = stringPropertyFromObjectExpression(
|
|
@@ -582,8 +654,21 @@ function playMetadataFromDefinePlayCall(node, context) {
|
|
|
582
654
|
context
|
|
583
655
|
);
|
|
584
656
|
}
|
|
585
|
-
|
|
586
|
-
|
|
657
|
+
const options = isObjectForm ? firstArg : args[2] ?? null;
|
|
658
|
+
const toolErrorSchemaVersion = toolErrorSchemaVersionFromOptions(
|
|
659
|
+
options,
|
|
660
|
+
context
|
|
661
|
+
);
|
|
662
|
+
const toolErrorSchemaVersionUnknown = toolErrorSchemaVersion === null;
|
|
663
|
+
if (!name && !description && toolErrorSchemaVersion === void 0 && !toolErrorSchemaVersionUnknown) {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
return {
|
|
667
|
+
name,
|
|
668
|
+
description,
|
|
669
|
+
toolErrorSchemaVersion: toolErrorSchemaVersion ?? null,
|
|
670
|
+
toolErrorSchemaVersionUnknown
|
|
671
|
+
};
|
|
587
672
|
}
|
|
588
673
|
function resolveExportExpression(exportName, context) {
|
|
589
674
|
if (exportName === "default") {
|
|
@@ -960,8 +1045,14 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
|
|
|
960
1045
|
})).sort((left, right) => left.filePath.localeCompare(right.filePath))
|
|
961
1046
|
})
|
|
962
1047
|
);
|
|
963
|
-
const
|
|
964
|
-
|
|
1048
|
+
const metadata = extractDefinedPlayMetadata(sourceCode, exportName) ?? (exportName === "default" ? extractDefinedPlayMetadata(sourceCode, null) : null);
|
|
1049
|
+
if (metadata?.toolErrorSchemaVersionUnknown) {
|
|
1050
|
+
throw new Error(
|
|
1051
|
+
"definePlay compatibility.toolErrorSchemaVersion must be the static literal 0 or 1."
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1054
|
+
const playName = metadata?.name ?? null;
|
|
1055
|
+
const playDescription = metadata?.description ?? null;
|
|
965
1056
|
return {
|
|
966
1057
|
sourceCode,
|
|
967
1058
|
sourceFiles: Object.fromEntries(
|
|
@@ -978,6 +1069,7 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
|
|
|
978
1069
|
},
|
|
979
1070
|
playName,
|
|
980
1071
|
playDescription,
|
|
1072
|
+
toolErrorSchemaVersion: metadata?.toolErrorSchemaVersion ?? null,
|
|
981
1073
|
importedPlayDependencies: [...importedPlayDependencies.values()].sort(
|
|
982
1074
|
(left, right) => left.filePath.localeCompare(right.filePath)
|
|
983
1075
|
)
|
|
@@ -1149,6 +1241,9 @@ entry-export:${exportName}`
|
|
|
1149
1241
|
entryFile: absolutePath,
|
|
1150
1242
|
sourceHash: analysis.sourceHash,
|
|
1151
1243
|
importPolicy: analysis.importPolicy,
|
|
1244
|
+
compatibility: buildPlayContractCompatibility({
|
|
1245
|
+
toolErrorSchemaVersion: analysis.toolErrorSchemaVersion ?? void 0
|
|
1246
|
+
}),
|
|
1152
1247
|
cacheHit: true
|
|
1153
1248
|
},
|
|
1154
1249
|
sourceCode: analysis.sourceCode,
|
|
@@ -1209,7 +1304,9 @@ entry-export:${exportName}`
|
|
|
1209
1304
|
bundledCode: executableCode,
|
|
1210
1305
|
sourceMap: normalizedSourceMap,
|
|
1211
1306
|
importPolicy: analysis.importPolicy,
|
|
1212
|
-
compatibility: buildPlayContractCompatibility(
|
|
1307
|
+
compatibility: buildPlayContractCompatibility({
|
|
1308
|
+
toolErrorSchemaVersion: analysis.toolErrorSchemaVersion ?? void 0
|
|
1309
|
+
}),
|
|
1213
1310
|
generatedAt: Date.now(),
|
|
1214
1311
|
cacheHit: false
|
|
1215
1312
|
};
|
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one executable Play artifact contract. Daytona and local-process both
|
|
3
|
+
* load CommonJS under Node 20.
|
|
4
|
+
*/
|
|
5
|
+
declare const PLAY_ARTIFACT_KINDS: {
|
|
6
|
+
readonly cjsNode20: "cjs_node20";
|
|
7
|
+
};
|
|
8
|
+
type PlayArtifactKind = (typeof PLAY_ARTIFACT_KINDS)[keyof typeof PLAY_ARTIFACT_KINDS];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A top-level key the play's function literally `return`s. Derived from the
|
|
12
|
+
* `return { ... }` object literal — NOT from dataset `.withColumn(...)` names —
|
|
13
|
+
* so the "Returns" graph node mirrors the function's real output shape.
|
|
14
|
+
* `isDataset` is true when the key's value is a `PlayDataset` handle (a table).
|
|
15
|
+
*/
|
|
16
|
+
interface PlayStaticReturnField {
|
|
17
|
+
name: string;
|
|
18
|
+
isDataset: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* For a dataset-valued field, the `ctx.dataset(KEY, ...)` key backing it
|
|
21
|
+
* (e.g. `job_change_checks`) — so the UI can label the return by the dataset
|
|
22
|
+
* it actually produces instead of the bland object key (`rows`). Undefined
|
|
23
|
+
* for non-dataset fields, `ctx.csv(...)` (no durable name), or when the key
|
|
24
|
+
* isn't a static string literal.
|
|
25
|
+
*/
|
|
26
|
+
datasetName?: string;
|
|
27
|
+
}
|
|
28
|
+
interface PlayStaticPipeline {
|
|
29
|
+
tableNamespace?: string;
|
|
30
|
+
inputFields?: string[];
|
|
31
|
+
rowKeyFields?: string[];
|
|
32
|
+
csvArg?: string;
|
|
33
|
+
hasInlineData?: boolean;
|
|
34
|
+
csvDescription?: string;
|
|
35
|
+
datasetDescription?: string;
|
|
36
|
+
fields: string[];
|
|
37
|
+
/**
|
|
38
|
+
* Top-level keys of the play's `return { ... }` object literal, in source
|
|
39
|
+
* order. Undefined when the terminal return isn't a statically-known object
|
|
40
|
+
* literal (bare value, dataset handle, conditional returns, etc.).
|
|
41
|
+
*/
|
|
42
|
+
returnFields?: PlayStaticReturnField[];
|
|
43
|
+
stages?: PlayStaticSubstep[];
|
|
44
|
+
substeps: PlayStaticSubstep[];
|
|
45
|
+
sheetContract?: PlaySheetContract | null;
|
|
46
|
+
sheetContractErrors?: string[];
|
|
47
|
+
}
|
|
48
|
+
type PlaySheetColumnSource = 'input' | 'datasetColumn' | 'waterfallStep' | 'childPlayColumn';
|
|
49
|
+
interface PlaySheetColumnContract {
|
|
50
|
+
id: string;
|
|
51
|
+
sqlName: string;
|
|
52
|
+
source: PlaySheetColumnSource;
|
|
53
|
+
field?: string;
|
|
54
|
+
parentField?: string;
|
|
55
|
+
playId?: string;
|
|
56
|
+
waterfallId?: string;
|
|
57
|
+
outputField?: string;
|
|
58
|
+
outputSqlName?: string;
|
|
59
|
+
stepId?: string;
|
|
60
|
+
toolId?: string;
|
|
61
|
+
isRowKey?: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface PlaySheetContract {
|
|
64
|
+
tableNamespace: string;
|
|
65
|
+
columns: PlaySheetColumnContract[];
|
|
66
|
+
}
|
|
67
|
+
type PlayStaticColumnProducerKind = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
|
|
68
|
+
interface PlayStaticColumnProducer {
|
|
69
|
+
id: string;
|
|
70
|
+
kind: PlayStaticColumnProducerKind;
|
|
71
|
+
field: string;
|
|
72
|
+
toolId?: string;
|
|
73
|
+
playId?: string;
|
|
74
|
+
conditional?: boolean;
|
|
75
|
+
sourceRange?: PlayStaticSourceRange;
|
|
76
|
+
steps?: PlayStaticColumnProducer[];
|
|
77
|
+
substep: PlayStaticSubstep;
|
|
78
|
+
}
|
|
79
|
+
interface PlayStaticDatasetColumn {
|
|
80
|
+
id: string;
|
|
81
|
+
source: PlaySheetColumnSource;
|
|
82
|
+
sqlName?: string;
|
|
83
|
+
producers: PlayStaticColumnProducer[];
|
|
84
|
+
}
|
|
85
|
+
interface PlayStaticSourceRange {
|
|
86
|
+
sourcePath?: string;
|
|
87
|
+
startLine: number;
|
|
88
|
+
endLine: number;
|
|
89
|
+
startColumn: number;
|
|
90
|
+
endColumn: number;
|
|
91
|
+
}
|
|
92
|
+
type PlayStaticSubstepMetadata = {
|
|
93
|
+
conditional?: boolean;
|
|
94
|
+
disabled?: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* One arm of a conditional `control_flow` substep — an `if`/`else if`/`else`
|
|
98
|
+
* leg, a `switch` case, or a ternary branch. Carries its own steps so the graph
|
|
99
|
+
* can render the conditional as a real fork instead of a flat strip.
|
|
100
|
+
*/
|
|
101
|
+
type PlayStaticControlFlowBranch = {
|
|
102
|
+
/** Short arm label, e.g. `if`, `else if`, `else`, `case 'x'`, `default`. */
|
|
103
|
+
label: string;
|
|
104
|
+
/** The arm's condition source text, when it has one (omitted for `else`). */
|
|
105
|
+
condition?: string;
|
|
106
|
+
/** Static work in this arm. Empty for log/throw/return-only arms. */
|
|
107
|
+
steps: PlayStaticSubstep[];
|
|
108
|
+
};
|
|
109
|
+
type PlayStaticSubstep = PlayStaticSubstepMetadata & ({
|
|
110
|
+
type: 'csv';
|
|
111
|
+
field: string;
|
|
112
|
+
path?: string;
|
|
113
|
+
description?: string;
|
|
114
|
+
sourceRange?: PlayStaticSourceRange;
|
|
115
|
+
callDepth?: number;
|
|
116
|
+
callPath?: string[];
|
|
117
|
+
} | {
|
|
118
|
+
type: 'dataset';
|
|
119
|
+
field: string;
|
|
120
|
+
name?: string;
|
|
121
|
+
tableNamespace?: string;
|
|
122
|
+
inputFields?: string[];
|
|
123
|
+
rowKeyFields?: string[];
|
|
124
|
+
outputFields?: string[];
|
|
125
|
+
columns?: PlayStaticDatasetColumn[];
|
|
126
|
+
waterfallIds?: string[];
|
|
127
|
+
steps?: PlayStaticSubstep[];
|
|
128
|
+
sheetContract?: PlaySheetContract | null;
|
|
129
|
+
description?: string;
|
|
130
|
+
sourceRange?: PlayStaticSourceRange;
|
|
131
|
+
callDepth?: number;
|
|
132
|
+
callPath?: string[];
|
|
133
|
+
} | {
|
|
134
|
+
type: 'tool';
|
|
135
|
+
toolId: string;
|
|
136
|
+
field: string;
|
|
137
|
+
paramsSource?: string;
|
|
138
|
+
sourceText?: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
inLoop?: boolean;
|
|
141
|
+
isEventWait?: boolean;
|
|
142
|
+
sourceRange?: PlayStaticSourceRange;
|
|
143
|
+
callDepth?: number;
|
|
144
|
+
callPath?: string[];
|
|
145
|
+
} | {
|
|
146
|
+
type: 'waterfall';
|
|
147
|
+
tool?: string;
|
|
148
|
+
field: string;
|
|
149
|
+
inLoop?: boolean;
|
|
150
|
+
id?: string;
|
|
151
|
+
output?: string;
|
|
152
|
+
minResults?: number;
|
|
153
|
+
sourceText?: string;
|
|
154
|
+
steps?: Array<{
|
|
155
|
+
id: string;
|
|
156
|
+
kind?: 'tool' | 'code';
|
|
157
|
+
toolId?: string;
|
|
158
|
+
paramsSource?: string;
|
|
159
|
+
}>;
|
|
160
|
+
description?: string;
|
|
161
|
+
sourceRange?: PlayStaticSourceRange;
|
|
162
|
+
callDepth?: number;
|
|
163
|
+
callPath?: string[];
|
|
164
|
+
} | {
|
|
165
|
+
type: 'step_suite';
|
|
166
|
+
field: string;
|
|
167
|
+
steps: PlayStaticSubstep[];
|
|
168
|
+
returnSource?: string;
|
|
169
|
+
description?: string;
|
|
170
|
+
sourceRange?: PlayStaticSourceRange;
|
|
171
|
+
callDepth?: number;
|
|
172
|
+
callPath?: string[];
|
|
173
|
+
} | {
|
|
174
|
+
type: 'play_call';
|
|
175
|
+
playId: string;
|
|
176
|
+
execution?: 'inline' | 'child-workflow';
|
|
177
|
+
timeoutMs?: number;
|
|
178
|
+
hasExplicitTimeout?: boolean;
|
|
179
|
+
field: string;
|
|
180
|
+
inLoop?: boolean;
|
|
181
|
+
pipeline?: PlayStaticPipeline | null;
|
|
182
|
+
cycleDetected?: boolean;
|
|
183
|
+
resolutionError?: string;
|
|
184
|
+
description?: string;
|
|
185
|
+
sourceRange?: PlayStaticSourceRange;
|
|
186
|
+
callDepth?: number;
|
|
187
|
+
callPath?: string[];
|
|
188
|
+
} | {
|
|
189
|
+
type: 'control_flow';
|
|
190
|
+
kind: 'conditional' | 'loop';
|
|
191
|
+
field: string;
|
|
192
|
+
/** Flattened steps across every arm, in source order (back-compat). */
|
|
193
|
+
steps: PlayStaticSubstep[];
|
|
194
|
+
/** Discriminant source text (the `if`/ternary test, `switch` subject). */
|
|
195
|
+
condition?: string;
|
|
196
|
+
/** Per-arm breakdown for conditionals; omitted for loops. */
|
|
197
|
+
branches?: PlayStaticControlFlowBranch[];
|
|
198
|
+
description?: string;
|
|
199
|
+
sourceRange?: PlayStaticSourceRange;
|
|
200
|
+
callDepth?: number;
|
|
201
|
+
callPath?: string[];
|
|
202
|
+
} | {
|
|
203
|
+
type: 'run_javascript';
|
|
204
|
+
alias: string;
|
|
205
|
+
sourceText?: string;
|
|
206
|
+
description?: string;
|
|
207
|
+
sourceRange?: PlayStaticSourceRange;
|
|
208
|
+
callDepth?: number;
|
|
209
|
+
callPath?: string[];
|
|
210
|
+
} | {
|
|
211
|
+
type: 'code';
|
|
212
|
+
field: string;
|
|
213
|
+
sourceText?: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
sourceRange?: PlayStaticSourceRange;
|
|
216
|
+
callDepth?: number;
|
|
217
|
+
callPath?: string[];
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
type PlayCompilerDependencyManifest = {
|
|
221
|
+
playName: string;
|
|
222
|
+
/** Original source path for direct imported definePlay dependencies. */
|
|
223
|
+
filePath?: string;
|
|
224
|
+
sourceHash: string;
|
|
225
|
+
graphHash: string;
|
|
226
|
+
artifactHash: string;
|
|
227
|
+
staticPipeline: PlayStaticPipeline;
|
|
228
|
+
};
|
|
229
|
+
type PlayCompilerManifest = {
|
|
230
|
+
compilerVersion: number;
|
|
231
|
+
playName: string;
|
|
232
|
+
sourceHash: string;
|
|
233
|
+
graphHash: string;
|
|
234
|
+
artifactHash: string;
|
|
235
|
+
artifactKind?: PlayArtifactKind;
|
|
236
|
+
staticPipeline: PlayStaticPipeline;
|
|
237
|
+
importedPlayDependencies: PlayCompilerDependencyManifest[];
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
declare const TOOL_EXECUTION_ERROR_SCHEMA_VERSION: 1;
|
|
241
|
+
declare const SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS: readonly [0, 1];
|
|
242
|
+
type ToolExecutionErrorSchemaVersion = (typeof SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS)[number];
|
|
243
|
+
/**
|
|
244
|
+
* The boundary responsible for a failed tool call.
|
|
245
|
+
*
|
|
246
|
+
* Use `provider` to distinguish a provider answer from caller input and
|
|
247
|
+
* Deepline infrastructure. `unknown` fails closed and must not trigger a
|
|
248
|
+
* waterfall fallback.
|
|
249
|
+
*
|
|
250
|
+
* @sdkReference errors 020
|
|
251
|
+
*/
|
|
252
|
+
type ToolExecutionErrorOrigin = 'caller' | 'provider' | 'deepline' | 'unknown';
|
|
253
|
+
/**
|
|
254
|
+
* The stable reason family for a failed tool call.
|
|
255
|
+
*
|
|
256
|
+
* Branch on this field only after narrowing to `ToolExecutionError`. Catch
|
|
257
|
+
* `ProviderTransientError` when the policy is simply “try the next read
|
|
258
|
+
* provider”; it is the safer and shorter waterfall contract.
|
|
259
|
+
*
|
|
260
|
+
* @sdkReference errors 030
|
|
261
|
+
*/
|
|
262
|
+
type ToolExecutionErrorCategory = 'validation' | 'authentication' | 'authorization' | 'rate_limit' | 'network' | 'upstream' | 'billing' | 'conflict' | 'internal' | 'unknown';
|
|
263
|
+
/**
|
|
264
|
+
* The transport failure observed when `category` is `network`.
|
|
265
|
+
*
|
|
266
|
+
* This is `null` for failures that are not network failures.
|
|
267
|
+
*
|
|
268
|
+
* @sdkReference errors 040
|
|
269
|
+
*/
|
|
270
|
+
type ToolExecutionNetworkKind = 'timeout' | 'dns' | 'connect' | 'reset' | 'unavailable' | 'unknown';
|
|
271
|
+
/**
|
|
272
|
+
* The request boundary on which a network failure occurred.
|
|
273
|
+
*
|
|
274
|
+
* `deepline_to_provider` is provider-side. Client and runtime scopes are
|
|
275
|
+
* Deepline transport failures and never qualify as provider fallthrough.
|
|
276
|
+
*
|
|
277
|
+
* @sdkReference errors 050
|
|
278
|
+
*/
|
|
279
|
+
type ToolExecutionNetworkScope = 'client_to_deepline' | 'runtime_to_deepline' | 'deepline_to_provider';
|
|
280
|
+
/**
|
|
281
|
+
* Portable version-1 `tool_error` payload.
|
|
282
|
+
*
|
|
283
|
+
* This allowlisted shape crosses the API, runtime, and SDK boundaries.
|
|
284
|
+
* `message` remains on the Error object and is deliberately not a policy
|
|
285
|
+
* field.
|
|
286
|
+
*
|
|
287
|
+
* @sdkReference errors 064
|
|
288
|
+
*/
|
|
289
|
+
type ToolExecutionFailureV1 = {
|
|
290
|
+
/** Payload version. */
|
|
291
|
+
schemaVersion: typeof TOOL_EXECUTION_ERROR_SCHEMA_VERSION;
|
|
292
|
+
/** Public tool id passed to `tools.execute`. */
|
|
293
|
+
toolId: string;
|
|
294
|
+
/** Provider responsible for the operation, or `null`. */
|
|
295
|
+
provider: string | null;
|
|
296
|
+
/** Provider operation name, or `null`. */
|
|
297
|
+
operation: string | null;
|
|
298
|
+
/** Stable machine-readable failure code, or `null`. */
|
|
299
|
+
code: string | null;
|
|
300
|
+
/** Boundary responsible for the failure. */
|
|
301
|
+
origin: ToolExecutionErrorOrigin;
|
|
302
|
+
/** Stable reason family. */
|
|
303
|
+
category: ToolExecutionErrorCategory;
|
|
304
|
+
/** Whether repeating the same semantic call is delivery-safe. */
|
|
305
|
+
retryable: boolean;
|
|
306
|
+
/** HTTP status when one exists, or `null`. */
|
|
307
|
+
statusCode: number | null;
|
|
308
|
+
/** Provider or Deepline request id, or `null`. */
|
|
309
|
+
requestId: string | null;
|
|
310
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
311
|
+
retryAfterMs: number | null;
|
|
312
|
+
/** Network failure kind, or `null`. */
|
|
313
|
+
networkKind: ToolExecutionNetworkKind | null;
|
|
314
|
+
/** Network boundary that failed, or `null`. */
|
|
315
|
+
networkScope: ToolExecutionNetworkScope | null;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* Constructor input for a structured tool failure.
|
|
319
|
+
*
|
|
320
|
+
* Deepline creates these values while decoding the versioned wire payload.
|
|
321
|
+
* Customer code normally reads `ToolExecutionError` fields instead of
|
|
322
|
+
* constructing an error.
|
|
323
|
+
*
|
|
324
|
+
* @sdkReference errors 065
|
|
325
|
+
*/
|
|
326
|
+
type ToolExecutionErrorOptions = Omit<ToolExecutionFailureV1, 'schemaVersion'> & {
|
|
327
|
+
/**
|
|
328
|
+
* Local diagnostic context inherited from DeeplineError. This is not part of
|
|
329
|
+
* the portable failure payload and is intentionally omitted by serialization.
|
|
330
|
+
*/
|
|
331
|
+
details?: Record<string, unknown>;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* Provider-owned failure categories that may fall through to another read
|
|
335
|
+
* provider.
|
|
336
|
+
*
|
|
337
|
+
* @sdkReference errors 060
|
|
338
|
+
*/
|
|
339
|
+
type ProviderTransientErrorCategory = 'rate_limit' | 'network' | 'upstream';
|
|
340
|
+
/**
|
|
341
|
+
* Base error class shared by the SDK and play runtime.
|
|
342
|
+
*
|
|
343
|
+
* The global brand preserves `instanceof DeeplineError` when a bundled play
|
|
344
|
+
* and the runtime load separate physical copies of this module.
|
|
345
|
+
*
|
|
346
|
+
* @sdkReference errors 010
|
|
347
|
+
*/
|
|
348
|
+
declare class DeeplineError extends Error {
|
|
349
|
+
/** HTTP status when the failure crossed an HTTP boundary. */
|
|
350
|
+
statusCode?: number;
|
|
351
|
+
/** Stable machine-readable error code when one exists. */
|
|
352
|
+
code?: string;
|
|
353
|
+
/** Local diagnostic context; not a portable error contract. */
|
|
354
|
+
details?: Record<string, unknown>;
|
|
355
|
+
/**
|
|
356
|
+
* Construct a Deepline error.
|
|
357
|
+
*
|
|
358
|
+
* SDK and runtime code construct these errors. Application and Play code
|
|
359
|
+
* normally catches the public subclasses instead.
|
|
360
|
+
*
|
|
361
|
+
* @param message Human-readable failure summary.
|
|
362
|
+
* @param statusCode HTTP status when one exists.
|
|
363
|
+
* @param code Stable machine-readable code when one exists.
|
|
364
|
+
* @param details Local diagnostic context; never a portable error contract.
|
|
365
|
+
*/
|
|
366
|
+
constructor(message: string, statusCode?: number, code?: string, details?: Record<string, unknown>);
|
|
367
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* A failed `tools.execute` call with stable, allowlisted provenance.
|
|
371
|
+
*
|
|
372
|
+
* `retryable` means Deepline's delivery/idempotency contract says it is safe
|
|
373
|
+
* to repeat the same semantic call. It does not describe durable receipt
|
|
374
|
+
* repairability and does not make arbitrary side-effecting fallbacks safe.
|
|
375
|
+
*
|
|
376
|
+
* In a Play, catch `ProviderTransientError` to continue a read waterfall and
|
|
377
|
+
* let every other `ToolExecutionError` remain loud. In an SDK client, catch
|
|
378
|
+
* this base class when you need structured diagnostics for every tool failure.
|
|
379
|
+
*
|
|
380
|
+
* @sdkReference errors 070
|
|
381
|
+
*/
|
|
382
|
+
declare class ToolExecutionError extends DeeplineError {
|
|
383
|
+
/** Public tool id passed to `tools.execute`. */
|
|
384
|
+
readonly toolId: string;
|
|
385
|
+
/** Provider responsible for the operation, or `null` when unattributed. */
|
|
386
|
+
readonly provider: string | null;
|
|
387
|
+
/** Provider operation name, or `null` when unavailable. */
|
|
388
|
+
readonly operation: string | null;
|
|
389
|
+
/** Boundary responsible for the failure. */
|
|
390
|
+
readonly origin: ToolExecutionErrorOrigin;
|
|
391
|
+
/** Stable reason family for policy and diagnostics. */
|
|
392
|
+
readonly category: ToolExecutionErrorCategory;
|
|
393
|
+
/**
|
|
394
|
+
* Whether repeating the same semantic call is delivery-safe.
|
|
395
|
+
*
|
|
396
|
+
* This does not mean the error may be ignored. Waterfall fallthrough is
|
|
397
|
+
* represented by `ProviderTransientError`.
|
|
398
|
+
*/
|
|
399
|
+
readonly retryable: boolean;
|
|
400
|
+
/** Provider or Deepline request id, or `null` when unavailable. */
|
|
401
|
+
readonly requestId: string | null;
|
|
402
|
+
/** Suggested same-call retry delay in milliseconds, or `null`. */
|
|
403
|
+
readonly retryAfterMs: number | null;
|
|
404
|
+
/** Network failure kind, or `null` for non-network failures. */
|
|
405
|
+
readonly networkKind: ToolExecutionNetworkKind | null;
|
|
406
|
+
/** Network boundary that failed, or `null` for non-network failures. */
|
|
407
|
+
readonly networkScope: ToolExecutionNetworkScope | null;
|
|
408
|
+
/**
|
|
409
|
+
* Construct a structured tool error.
|
|
410
|
+
*
|
|
411
|
+
* Deepline constructs this from the versioned `tool_error` payload.
|
|
412
|
+
* Application and Play code should catch it rather than create it.
|
|
413
|
+
*/
|
|
414
|
+
constructor(message: string, options: ToolExecutionErrorOptions);
|
|
415
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* A provider-owned transient failure that is safe to handle as an empty
|
|
419
|
+
* waterfall leg. Validation, auth, billing, Deepline, and unknown failures
|
|
420
|
+
* never satisfy this type.
|
|
421
|
+
*
|
|
422
|
+
* `retryable` remains independent: it says whether the same semantic call may
|
|
423
|
+
* be repeated safely. Falling through to a different read provider depends on
|
|
424
|
+
* this class, not on `retryable`.
|
|
425
|
+
*
|
|
426
|
+
* @sdkReference errors 080
|
|
427
|
+
*/
|
|
428
|
+
declare class ProviderTransientError extends ToolExecutionError {
|
|
429
|
+
/** Provider attribution is guaranteed for this subtype. */
|
|
430
|
+
readonly origin: "provider";
|
|
431
|
+
/** Provider failure category that made this error eligible for fallthrough. */
|
|
432
|
+
readonly category: ProviderTransientErrorCategory;
|
|
433
|
+
/** Constructed by Deepline when a provider-owned transient failure arrives. */
|
|
434
|
+
constructor(message: string, options: Omit<ToolExecutionErrorOptions, 'origin' | 'category'> & {
|
|
435
|
+
category: ProviderTransientErrorCategory;
|
|
436
|
+
});
|
|
437
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, ToolExecutionError as c, type ToolExecutionErrorOptions as d, ProviderTransientError as e, type ProviderTransientErrorCategory as f, type ToolExecutionErrorCategory as g, type ToolExecutionErrorOrigin as h, type ToolExecutionFailureV1 as i, type ToolExecutionNetworkKind as j, type ToolExecutionNetworkScope as k };
|