deepline 0.3.258 → 0.3.260
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/api-error.ts +45 -0
- package/dist/bundling-sources/sdk/src/client.ts +98 -459
- package/dist/bundling-sources/sdk/src/http.ts +1 -34
- package/dist/bundling-sources/sdk/src/index.ts +8 -0
- package/dist/bundling-sources/sdk/src/plays/csv-data-input.ts +139 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +855 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/overview.ts +45 -2
- package/dist/bundling-sources/sdk/src/types.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +42 -10
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-admission-outcome.ts +23 -5
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-execution-state.ts +845 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +106 -6
- package/dist/bundling-sources/shared_libs/play-runtime/run-observation.ts +440 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +35 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +66 -7
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-crash-details.ts +95 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +13 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +0 -29
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +475 -36
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +78 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +550 -42
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +181 -8
- package/dist/bundling-sources/shared_libs/play-runtime/step-lifecycle-tracker.ts +0 -18
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +80 -7
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +37 -2
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +148 -18
- package/dist/bundling-sources/shared_libs/plays/cascade-falloff.ts +86 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +611 -0
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +21 -0
- package/dist/bundling-sources/shared_libs/plays/play-exports.ts +28 -5
- package/dist/bundling-sources/shared_libs/plays/settings-contract.ts +92 -10
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +5 -0
- package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +222 -0
- package/dist/bundling-sources/shared_libs/plays/trigger-config-route.ts +15 -0
- package/dist/cli/index.js +4957 -771
- package/dist/cli/index.mjs +4957 -771
- package/dist/client-B5XbKrrs.d.mts +6564 -0
- package/dist/client-C9Y49yya.d.ts +6564 -0
- package/dist/{compiler-manifest-C4mdRJOP.d.mts → compiler-manifest-CUuh8C3b.d.mts} +14 -1
- package/dist/{compiler-manifest-C4mdRJOP.d.ts → compiler-manifest-CUuh8C3b.d.ts} +14 -1
- package/dist/index.d.mts +7 -6275
- package/dist/index.d.ts +7 -6275
- package/dist/index.js +360 -326
- package/dist/index.mjs +360 -326
- package/dist/install-integrity.json +22 -2
- 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 +117 -18
- package/dist/plays/csv-data-input.d.mts +37 -0
- package/dist/plays/csv-data-input.d.ts +37 -0
- package/dist/plays/csv-data-input.js +3135 -0
- package/dist/plays/csv-data-input.mjs +3108 -0
- package/dist/plays/run-request.d.mts +6 -0
- package/dist/plays/run-request.d.ts +6 -0
- package/dist/plays/run-request.js +664 -0
- package/dist/plays/run-request.mjs +614 -0
- 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 +12 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"packageFiles": [
|
|
4
4
|
"dist/bundling-sources/sdk/src/agent-runtime.ts",
|
|
5
|
+
"dist/bundling-sources/sdk/src/api-error.ts",
|
|
5
6
|
"dist/bundling-sources/sdk/src/client.ts",
|
|
6
7
|
"dist/bundling-sources/sdk/src/compat.ts",
|
|
7
8
|
"dist/bundling-sources/sdk/src/config.ts",
|
|
@@ -18,8 +19,10 @@
|
|
|
18
19
|
"dist/bundling-sources/sdk/src/pagination.ts",
|
|
19
20
|
"dist/bundling-sources/sdk/src/play.ts",
|
|
20
21
|
"dist/bundling-sources/sdk/src/plays/bundle-play-file.ts",
|
|
22
|
+
"dist/bundling-sources/sdk/src/plays/csv-data-input.ts",
|
|
21
23
|
"dist/bundling-sources/sdk/src/plays/input-example.ts",
|
|
22
24
|
"dist/bundling-sources/sdk/src/plays/local-file-discovery.ts",
|
|
25
|
+
"dist/bundling-sources/sdk/src/plays/run-request.ts",
|
|
23
26
|
"dist/bundling-sources/sdk/src/release.ts",
|
|
24
27
|
"dist/bundling-sources/sdk/src/runs/observe-transport.ts",
|
|
25
28
|
"dist/bundling-sources/sdk/src/runs/overview.ts",
|
|
@@ -301,6 +304,7 @@
|
|
|
301
304
|
"dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts",
|
|
302
305
|
"dist/bundling-sources/shared_libs/play-runtime/row-isolation.ts",
|
|
303
306
|
"dist/bundling-sources/shared_libs/play-runtime/run-execution-scope.ts",
|
|
307
|
+
"dist/bundling-sources/shared_libs/play-runtime/run-execution-state.ts",
|
|
304
308
|
"dist/bundling-sources/shared_libs/play-runtime/run-failure.ts",
|
|
305
309
|
"dist/bundling-sources/shared_libs/play-runtime/run-identity.ts",
|
|
306
310
|
"dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts",
|
|
@@ -309,6 +313,7 @@
|
|
|
309
313
|
"dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts",
|
|
310
314
|
"dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts",
|
|
311
315
|
"dist/bundling-sources/shared_libs/play-runtime/run-log-buffer.ts",
|
|
316
|
+
"dist/bundling-sources/shared_libs/play-runtime/run-observation.ts",
|
|
312
317
|
"dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts",
|
|
313
318
|
"dist/bundling-sources/shared_libs/play-runtime/run-terminal-source.ts",
|
|
314
319
|
"dist/bundling-sources/shared_libs/play-runtime/runner-app/child-play-resolver.ts",
|
|
@@ -322,6 +327,7 @@
|
|
|
322
327
|
"dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts",
|
|
323
328
|
"dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts",
|
|
324
329
|
"dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts",
|
|
330
|
+
"dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-crash-details.ts",
|
|
325
331
|
"dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-labels.ts",
|
|
326
332
|
"dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts",
|
|
327
333
|
"dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts",
|
|
@@ -478,6 +484,7 @@
|
|
|
478
484
|
"dist/bundling-sources/shared_libs/plays/bundling/index.ts",
|
|
479
485
|
"dist/bundling-sources/shared_libs/plays/bundling/limits.ts",
|
|
480
486
|
"dist/bundling-sources/shared_libs/plays/bundling/repository-adapter.ts",
|
|
487
|
+
"dist/bundling-sources/shared_libs/plays/cascade-falloff.ts",
|
|
481
488
|
"dist/bundling-sources/shared_libs/plays/cell-staleness.ts",
|
|
482
489
|
"dist/bundling-sources/shared_libs/plays/child-run-projection.ts",
|
|
483
490
|
"dist/bundling-sources/shared_libs/plays/compiler-manifest.ts",
|
|
@@ -497,6 +504,7 @@
|
|
|
497
504
|
"dist/bundling-sources/shared_libs/plays/deployment-status.ts",
|
|
498
505
|
"dist/bundling-sources/shared_libs/plays/docflow-binding-owner.ts",
|
|
499
506
|
"dist/bundling-sources/shared_libs/plays/docflow-binding.ts",
|
|
507
|
+
"dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts",
|
|
500
508
|
"dist/bundling-sources/shared_libs/plays/docflow.ts",
|
|
501
509
|
"dist/bundling-sources/shared_libs/plays/email-status.ts",
|
|
502
510
|
"dist/bundling-sources/shared_libs/plays/enrich-compat-adapter.ts",
|
|
@@ -542,6 +550,8 @@
|
|
|
542
550
|
"dist/bundling-sources/shared_libs/plays/tool-response-contract.ts",
|
|
543
551
|
"dist/bundling-sources/shared_libs/plays/tool-result-types.ts",
|
|
544
552
|
"dist/bundling-sources/shared_libs/plays/transform-factor-structure.ts",
|
|
553
|
+
"dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts",
|
|
554
|
+
"dist/bundling-sources/shared_libs/plays/trigger-config-route.ts",
|
|
545
555
|
"dist/bundling-sources/shared_libs/plays/ts-ast.ts",
|
|
546
556
|
"dist/bundling-sources/shared_libs/plays/user-code-safety.ts",
|
|
547
557
|
"dist/bundling-sources/shared_libs/plays/webhook-payload.ts",
|
|
@@ -582,8 +592,10 @@
|
|
|
582
592
|
"dist/cli/index.js",
|
|
583
593
|
"dist/cli/index.mjs",
|
|
584
594
|
"dist/cli/text-imports.d.ts",
|
|
585
|
-
"dist/
|
|
586
|
-
"dist/
|
|
595
|
+
"dist/client-B5XbKrrs.d.mts",
|
|
596
|
+
"dist/client-C9Y49yya.d.ts",
|
|
597
|
+
"dist/compiler-manifest-CUuh8C3b.d.mts",
|
|
598
|
+
"dist/compiler-manifest-CUuh8C3b.d.ts",
|
|
587
599
|
"dist/helpers.d.mts",
|
|
588
600
|
"dist/helpers.d.ts",
|
|
589
601
|
"dist/helpers.js",
|
|
@@ -603,6 +615,14 @@
|
|
|
603
615
|
"dist/plays/bundle-play-file.d.mts",
|
|
604
616
|
"dist/plays/bundle-play-file.d.ts",
|
|
605
617
|
"dist/plays/bundle-play-file.mjs",
|
|
618
|
+
"dist/plays/csv-data-input.d.mts",
|
|
619
|
+
"dist/plays/csv-data-input.d.ts",
|
|
620
|
+
"dist/plays/csv-data-input.js",
|
|
621
|
+
"dist/plays/csv-data-input.mjs",
|
|
622
|
+
"dist/plays/run-request.d.mts",
|
|
623
|
+
"dist/plays/run-request.d.ts",
|
|
624
|
+
"dist/plays/run-request.js",
|
|
625
|
+
"dist/plays/run-request.mjs",
|
|
606
626
|
"dist/plays/text-imports.d.ts",
|
|
607
627
|
"dist/release.d.mts",
|
|
608
628
|
"dist/release.d.ts",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./text-imports.d.ts" />
|
|
2
|
-
import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-
|
|
3
|
-
export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-
|
|
2
|
+
import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-CUuh8C3b.mjs';
|
|
3
|
+
export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-CUuh8C3b.mjs';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
|
|
6
6
|
type ImportedPlayDependency = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="./text-imports.d.ts" />
|
|
2
|
-
import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-
|
|
3
|
-
export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-
|
|
2
|
+
import { P as PlayArtifactKind, a as PlayBundleArtifact, b as PlaySandboxRuntimeDeclaration, c as PlayCompilerManifest } from '../compiler-manifest-CUuh8C3b.js';
|
|
3
|
+
export { d as PLAY_ARTIFACT_KINDS, e as PlayArtifactCompatibility, f as PlayImportPolicy, g as PlayPackageImport, h as PlayRuntimeFeature } from '../compiler-manifest-CUuh8C3b.js';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
|
|
6
6
|
type ImportedPlayDependency = {
|
|
@@ -1708,11 +1708,26 @@ function isDefinePlayCall(node) {
|
|
|
1708
1708
|
}
|
|
1709
1709
|
return false;
|
|
1710
1710
|
}
|
|
1711
|
+
function stringLiteralValue(node) {
|
|
1712
|
+
const expression = unwrapStaticExpression(node);
|
|
1713
|
+
return expression?.type === "Literal" && typeof expression.value === "string" ? expression.value : null;
|
|
1714
|
+
}
|
|
1711
1715
|
function definePlayName(node) {
|
|
1712
1716
|
const expression = unwrapStaticExpression(node);
|
|
1713
1717
|
if (!expression || expression.type !== "CallExpression") return null;
|
|
1714
|
-
const first =
|
|
1715
|
-
|
|
1718
|
+
const first = unwrapStaticExpression(
|
|
1719
|
+
astArray(expression.arguments)[0] ?? null
|
|
1720
|
+
);
|
|
1721
|
+
if (first?.type !== "ObjectExpression") return stringLiteralValue(first);
|
|
1722
|
+
let id = null;
|
|
1723
|
+
for (const property of astArray(first.properties)) {
|
|
1724
|
+
if (property.type !== "Property" || property.computed) continue;
|
|
1725
|
+
const key = isAstNode(property.key) ? property.key : null;
|
|
1726
|
+
const keyName = getIdentifierName(key) ?? (key?.type === "Literal" && typeof key.value === "string" ? key.value : null);
|
|
1727
|
+
if (keyName !== "id") continue;
|
|
1728
|
+
id = stringLiteralValue(isAstNode(property.value) ? property.value : null);
|
|
1729
|
+
}
|
|
1730
|
+
return id;
|
|
1716
1731
|
}
|
|
1717
1732
|
function listPlayFileExports(sourceCode) {
|
|
1718
1733
|
const ast = parsePlaySourceForAnalysis(sourceCode);
|
|
@@ -2114,6 +2129,11 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
|
|
|
2114
2129
|
if (existing && existing.label === existing.id && label !== id) {
|
|
2115
2130
|
existing.label = label;
|
|
2116
2131
|
existing.kind = kind;
|
|
2132
|
+
for (const subgraph of subgraphs.values()) {
|
|
2133
|
+
const at = subgraph.memberIds.indexOf(id);
|
|
2134
|
+
if (at !== -1) subgraph.memberIds.splice(at, 1);
|
|
2135
|
+
}
|
|
2136
|
+
subgraphStack[subgraphStack.length - 1]?.memberIds.push(id);
|
|
2117
2137
|
} else if (existing && existing.label !== label) {
|
|
2118
2138
|
errors.push(`Docflow node "${id}" has conflicting labels.`);
|
|
2119
2139
|
} else if (!existing) {
|
|
@@ -2129,10 +2149,12 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
|
|
|
2129
2149
|
const id = opened[1];
|
|
2130
2150
|
const rawLabel = opened[2]?.trim() ?? "";
|
|
2131
2151
|
const label = rawLabel.length >= 2 && (rawLabel.startsWith('"') && rawLabel.endsWith('"') || rawLabel.startsWith("'") && rawLabel.endsWith("'")) ? rawLabel.slice(1, -1) : rawLabel;
|
|
2152
|
+
const parent = subgraphStack[subgraphStack.length - 1];
|
|
2132
2153
|
const subgraph = {
|
|
2133
2154
|
id,
|
|
2134
2155
|
label: label || id,
|
|
2135
|
-
memberIds: []
|
|
2156
|
+
memberIds: [],
|
|
2157
|
+
...parent ? { parentId: parent.id } : {}
|
|
2136
2158
|
};
|
|
2137
2159
|
subgraphs.set(id, subgraph);
|
|
2138
2160
|
subgraphStack.push(subgraph);
|
|
@@ -3759,20 +3781,73 @@ function sourceLoaderForPath(path) {
|
|
|
3759
3781
|
}
|
|
3760
3782
|
return "ts";
|
|
3761
3783
|
}
|
|
3762
|
-
function
|
|
3784
|
+
function isFunctionNode(node) {
|
|
3785
|
+
return !!node && (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression");
|
|
3786
|
+
}
|
|
3787
|
+
function definePlayRunFunction(call) {
|
|
3763
3788
|
if (!isDefinePlayCallExpression(call)) return null;
|
|
3764
3789
|
const args = astArray(call.arguments);
|
|
3765
|
-
const
|
|
3766
|
-
|
|
3767
|
-
);
|
|
3768
|
-
if (!
|
|
3769
|
-
|
|
3790
|
+
const positional = args.find((argument) => isFunctionNode(argument));
|
|
3791
|
+
if (positional) return positional;
|
|
3792
|
+
const config = unwrapStaticExpression2(args[0] ?? null);
|
|
3793
|
+
if (!config || config.type !== "ObjectExpression") return null;
|
|
3794
|
+
let run = null;
|
|
3795
|
+
for (const property of astArray(config.properties)) {
|
|
3796
|
+
if (property.type !== "Property") continue;
|
|
3797
|
+
if (propertyNameFromKey(property) !== "run") continue;
|
|
3798
|
+
const value = unwrapStaticExpression2(
|
|
3799
|
+
isAstNode(property.value) ? property.value : null
|
|
3800
|
+
);
|
|
3801
|
+
run = isFunctionNode(value) ? value : null;
|
|
3802
|
+
}
|
|
3803
|
+
return run;
|
|
3770
3804
|
}
|
|
3771
|
-
|
|
3805
|
+
var DOCFLOW_INJECTED_CONTEXT_NAME = "__deeplineDocflowContext";
|
|
3806
|
+
function docflowContextFromCall(call, sourceCode) {
|
|
3807
|
+
if (!isDefinePlayCallExpression(call)) return null;
|
|
3808
|
+
const run = definePlayRunFunction(call);
|
|
3809
|
+
if (!run) {
|
|
3810
|
+
return {
|
|
3811
|
+
kind: "unsupported",
|
|
3812
|
+
reason: "its definePlay call does not declare the run function inline (pass `definePlay(name, async (ctx, input) => \u2026)` or `definePlay({ id, run: async (ctx, input) => \u2026 })`)"
|
|
3813
|
+
};
|
|
3814
|
+
}
|
|
3815
|
+
const params = astArray(run.params);
|
|
3816
|
+
const first = params[0];
|
|
3817
|
+
if (first) {
|
|
3818
|
+
const name = getIdentifierName3(first);
|
|
3819
|
+
return name ? { kind: "named", name } : {
|
|
3820
|
+
kind: "unsupported",
|
|
3821
|
+
reason: `its run function's first parameter is not a plain identifier (found ${first.type}; declare the context as \`ctx\` and destructure inside the body)`
|
|
3822
|
+
};
|
|
3823
|
+
}
|
|
3824
|
+
const runBounds = astNodeBounds(run);
|
|
3825
|
+
const body = isAstNode(run.body) ? astNodeBounds(run.body) : null;
|
|
3826
|
+
if (!runBounds || !body) {
|
|
3827
|
+
return {
|
|
3828
|
+
kind: "unsupported",
|
|
3829
|
+
reason: "its run function has no source span"
|
|
3830
|
+
};
|
|
3831
|
+
}
|
|
3832
|
+
const signature = sourceCode.slice(runBounds.start, body.start);
|
|
3833
|
+
const emptyParams = /\(\s*\)/.exec(signature);
|
|
3834
|
+
if (!emptyParams) {
|
|
3835
|
+
return {
|
|
3836
|
+
kind: "unsupported",
|
|
3837
|
+
reason: "its parameterless run function has no `()` parameter list"
|
|
3838
|
+
};
|
|
3839
|
+
}
|
|
3840
|
+
return {
|
|
3841
|
+
kind: "inject",
|
|
3842
|
+
name: DOCFLOW_INJECTED_CONTEXT_NAME,
|
|
3843
|
+
at: runBounds.start + emptyParams.index + 1
|
|
3844
|
+
};
|
|
3845
|
+
}
|
|
3846
|
+
function findDocflowContext(input) {
|
|
3772
3847
|
let owner = input.statement;
|
|
3773
3848
|
while (owner) {
|
|
3774
|
-
const
|
|
3775
|
-
if (
|
|
3849
|
+
const context = docflowContextFromCall(owner, input.sourceCode);
|
|
3850
|
+
if (context) return context;
|
|
3776
3851
|
owner = input.parents.get(owner) ?? null;
|
|
3777
3852
|
}
|
|
3778
3853
|
const lineStart = input.lineStarts[input.bindingLine - 1];
|
|
@@ -3794,7 +3869,7 @@ function findDocflowContextIdentifier(input) {
|
|
|
3794
3869
|
else if (isAstNode(child)) pending.push(child);
|
|
3795
3870
|
}
|
|
3796
3871
|
}
|
|
3797
|
-
return best ?
|
|
3872
|
+
return best ? docflowContextFromCall(best, input.sourceCode) : null;
|
|
3798
3873
|
}
|
|
3799
3874
|
function docflowInputCaptureSource(paths) {
|
|
3800
3875
|
return `[${paths.map((path) => {
|
|
@@ -3816,6 +3891,8 @@ function docflowObservationTarget(statement) {
|
|
|
3816
3891
|
expression = statement.expression;
|
|
3817
3892
|
} else if (statement.type === "IfStatement" && isAstNode(statement.test)) {
|
|
3818
3893
|
expression = statement.test;
|
|
3894
|
+
} else if (statement.type === "ThrowStatement" && isAstNode(statement.argument)) {
|
|
3895
|
+
expression = statement.argument;
|
|
3819
3896
|
}
|
|
3820
3897
|
if (!expression) return null;
|
|
3821
3898
|
const bounds = astNodeBounds(expression);
|
|
@@ -3823,11 +3900,13 @@ function docflowObservationTarget(statement) {
|
|
|
3823
3900
|
return {
|
|
3824
3901
|
...bounds,
|
|
3825
3902
|
awaitsResult: expressionContainsTopLevelAwait(expression),
|
|
3826
|
-
expression
|
|
3903
|
+
expression,
|
|
3904
|
+
throws: statement.type === "ThrowStatement"
|
|
3827
3905
|
};
|
|
3828
3906
|
}
|
|
3829
3907
|
function docflowObservedExpression(input) {
|
|
3830
|
-
const
|
|
3908
|
+
const body = input.throws ? `{throw (${input.expression})}` : `(${input.expression})`;
|
|
3909
|
+
const callback = input.awaitsResult ? `async()=>${body}` : `()=>${body}`;
|
|
3831
3910
|
const observation = `((runtimeContext,inputCaptures,execute)=>typeof runtimeContext.__deeplineObserveDocflowNode==="function"?runtimeContext.__deeplineObserveDocflowNode(${JSON.stringify(input.nodeId)},inputCaptures,${JSON.stringify(input.outputs)},execute):execute())(${input.contextName},${docflowInputCaptureSource(input.inputs)},${callback})`;
|
|
3832
3911
|
return input.awaitsResult ? `(await ${observation})` : observation;
|
|
3833
3912
|
}
|
|
@@ -3854,17 +3933,26 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
|
|
|
3854
3933
|
const lineStarts = sourceLineStarts(sourceCode);
|
|
3855
3934
|
const replacements = [];
|
|
3856
3935
|
const targets = [];
|
|
3936
|
+
const injectedContextAt = /* @__PURE__ */ new Set();
|
|
3857
3937
|
const parents = buildDocflowParentIndex(ast);
|
|
3858
3938
|
for (const binding of parsed.bindings) {
|
|
3859
3939
|
const resolution = resolveDocflowBinding(ast, binding, lineStarts, parents);
|
|
3860
|
-
const
|
|
3940
|
+
const context = findDocflowContext({
|
|
3861
3941
|
ast,
|
|
3942
|
+
sourceCode,
|
|
3862
3943
|
statement: resolution.statement,
|
|
3863
3944
|
bindingLine: binding.line,
|
|
3864
3945
|
lineStarts,
|
|
3865
3946
|
parents
|
|
3866
3947
|
});
|
|
3867
|
-
if (!
|
|
3948
|
+
if (!context) continue;
|
|
3949
|
+
if (context.kind === "unsupported") {
|
|
3950
|
+
throw new Error(
|
|
3951
|
+
`@mermaid-node ${binding.nodeId} (line ${binding.line}) cannot be observed at runtime: ${context.reason}.`
|
|
3952
|
+
);
|
|
3953
|
+
}
|
|
3954
|
+
if (context.kind === "inject") injectedContextAt.add(context.at);
|
|
3955
|
+
const contextName = context.kind === "inject" ? `(${context.name}??{})` : context.name;
|
|
3868
3956
|
const target = docflowObservationTarget(resolution.statement);
|
|
3869
3957
|
const observedRoot = docflowOutputRoot(binding);
|
|
3870
3958
|
if (target && observedRoot && docflowExpressionWrapsStepBuilder(target.expression, observedRoot)) {
|
|
@@ -3897,6 +3985,7 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
|
|
|
3897
3985
|
start: target.start,
|
|
3898
3986
|
end: target.end,
|
|
3899
3987
|
awaitsResult: target.awaitsResult,
|
|
3988
|
+
throws: target.throws,
|
|
3900
3989
|
contextName: target.contextName,
|
|
3901
3990
|
bindings: [target.binding]
|
|
3902
3991
|
});
|
|
@@ -3904,6 +3993,7 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
|
|
|
3904
3993
|
}
|
|
3905
3994
|
for (const group of groups) {
|
|
3906
3995
|
let expression = sourceCode.slice(group.start, group.end);
|
|
3996
|
+
let innermost = true;
|
|
3907
3997
|
for (const binding of [...group.bindings].reverse()) {
|
|
3908
3998
|
expression = docflowObservedExpression({
|
|
3909
3999
|
contextName: group.contextName,
|
|
@@ -3911,8 +4001,10 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
|
|
|
3911
4001
|
inputs: binding.inputs ?? [],
|
|
3912
4002
|
outputs: binding.outputs ?? [],
|
|
3913
4003
|
expression,
|
|
3914
|
-
awaitsResult: group.awaitsResult
|
|
4004
|
+
awaitsResult: group.awaitsResult,
|
|
4005
|
+
throws: group.throws && innermost
|
|
3915
4006
|
});
|
|
4007
|
+
innermost = false;
|
|
3916
4008
|
}
|
|
3917
4009
|
replacements.push({
|
|
3918
4010
|
start: group.start,
|
|
@@ -3920,6 +4012,13 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
|
|
|
3920
4012
|
value: expression
|
|
3921
4013
|
});
|
|
3922
4014
|
}
|
|
4015
|
+
for (const at of injectedContextAt) {
|
|
4016
|
+
replacements.push({
|
|
4017
|
+
start: at,
|
|
4018
|
+
end: at,
|
|
4019
|
+
value: DOCFLOW_INJECTED_CONTEXT_NAME
|
|
4020
|
+
});
|
|
4021
|
+
}
|
|
3923
4022
|
return replacements.sort((left, right) => right.start - left.start).reduce(
|
|
3924
4023
|
(source, replacement) => `${source.slice(0, replacement.start)}${replacement.value}${source.slice(replacement.end)}`,
|
|
3925
4024
|
sourceCode
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference path="./text-imports.d.ts" />
|
|
2
|
+
type CsvDataInputSource = {
|
|
3
|
+
/** Dotted path into the run input, for error messages. */
|
|
4
|
+
inputPath: string;
|
|
5
|
+
/** What the caller supplied: a CLI path or a dropped file's name. */
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
type ParsedCsvDataInput = {
|
|
9
|
+
/** Trimmed header names, in column order. */
|
|
10
|
+
headers: string[];
|
|
11
|
+
/** Trimmed data records, positional (one entry per header, ragged allowed). */
|
|
12
|
+
records: string[][];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* STRICT validation of the play's CSV DATA input (the row source):
|
|
16
|
+
*
|
|
17
|
+
* - parses with `relax_quotes: false` so an unclosed/ragged quote is a LOUD
|
|
18
|
+
* error naming the line/character (prod run 20260611t145823-710 swallowed an
|
|
19
|
+
* entire `"https://...`-no-closing-quote row into one giant linkedin_url),
|
|
20
|
+
* - detects EXACT-after-trim duplicate header names (prod run
|
|
21
|
+
* 20260611t145821-917 had two `linkedin_url` columns; the second silently
|
|
22
|
+
* won) — case-DIFFERENT duplicates are handled play-side and not rejected,
|
|
23
|
+
* - rejects a header-only CSV with zero data rows.
|
|
24
|
+
*
|
|
25
|
+
* Any violation throws a `DeeplineError` (code `PLAY_INPUT_FILE_PREFLIGHT`)
|
|
26
|
+
* before any staging or API call, so no run is created and nothing is billed.
|
|
27
|
+
*/
|
|
28
|
+
declare function parseCsvDataInput(source: CsvDataInputSource, content: string, options?: {
|
|
29
|
+
/**
|
|
30
|
+
* Called after each parsed record (header included) with the running
|
|
31
|
+
* count. Observation only: it cannot change, drop, or reorder records.
|
|
32
|
+
* The dashboard's parser worker uses it to report row progress.
|
|
33
|
+
*/
|
|
34
|
+
onRecord?: (recordCount: number) => void;
|
|
35
|
+
}): ParsedCsvDataInput;
|
|
36
|
+
|
|
37
|
+
export { type CsvDataInputSource, type ParsedCsvDataInput, parseCsvDataInput };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference path="./text-imports.d.ts" />
|
|
2
|
+
type CsvDataInputSource = {
|
|
3
|
+
/** Dotted path into the run input, for error messages. */
|
|
4
|
+
inputPath: string;
|
|
5
|
+
/** What the caller supplied: a CLI path or a dropped file's name. */
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
type ParsedCsvDataInput = {
|
|
9
|
+
/** Trimmed header names, in column order. */
|
|
10
|
+
headers: string[];
|
|
11
|
+
/** Trimmed data records, positional (one entry per header, ragged allowed). */
|
|
12
|
+
records: string[][];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* STRICT validation of the play's CSV DATA input (the row source):
|
|
16
|
+
*
|
|
17
|
+
* - parses with `relax_quotes: false` so an unclosed/ragged quote is a LOUD
|
|
18
|
+
* error naming the line/character (prod run 20260611t145823-710 swallowed an
|
|
19
|
+
* entire `"https://...`-no-closing-quote row into one giant linkedin_url),
|
|
20
|
+
* - detects EXACT-after-trim duplicate header names (prod run
|
|
21
|
+
* 20260611t145821-917 had two `linkedin_url` columns; the second silently
|
|
22
|
+
* won) — case-DIFFERENT duplicates are handled play-side and not rejected,
|
|
23
|
+
* - rejects a header-only CSV with zero data rows.
|
|
24
|
+
*
|
|
25
|
+
* Any violation throws a `DeeplineError` (code `PLAY_INPUT_FILE_PREFLIGHT`)
|
|
26
|
+
* before any staging or API call, so no run is created and nothing is billed.
|
|
27
|
+
*/
|
|
28
|
+
declare function parseCsvDataInput(source: CsvDataInputSource, content: string, options?: {
|
|
29
|
+
/**
|
|
30
|
+
* Called after each parsed record (header included) with the running
|
|
31
|
+
* count. Observation only: it cannot change, drop, or reorder records.
|
|
32
|
+
* The dashboard's parser worker uses it to report row progress.
|
|
33
|
+
*/
|
|
34
|
+
onRecord?: (recordCount: number) => void;
|
|
35
|
+
}): ParsedCsvDataInput;
|
|
36
|
+
|
|
37
|
+
export { type CsvDataInputSource, type ParsedCsvDataInput, parseCsvDataInput };
|