@nodetool-ai/execution 0.8.2 → 0.8.4-a24.1
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/.nodetool-build-stamp +1 -1
- package/dist/app-debug/runtime.d.ts.map +1 -1
- package/dist/app-debug/runtime.js +5 -1
- package/dist/app-debug/runtime.js.map +1 -1
- package/dist/app-debug/simulate.d.ts.map +1 -1
- package/dist/app-debug/simulate.js +10 -1
- package/dist/app-debug/simulate.js.map +1 -1
- package/dist/debug/types.d.ts +3 -1
- package/dist/debug/types.d.ts.map +1 -1
- package/dist/debug/verdict.d.ts +26 -1
- package/dist/debug/verdict.d.ts.map +1 -1
- package/dist/debug/verdict.js +36 -0
- package/dist/debug/verdict.js.map +1 -1
- package/dist/executor-resolver.d.ts +0 -7
- package/dist/executor-resolver.d.ts.map +1 -1
- package/dist/executor-resolver.js +12 -0
- package/dist/executor-resolver.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/js-script-debug/report.d.ts.map +1 -1
- package/dist/js-script-debug/report.js +9 -24
- package/dist/js-script-debug/report.js.map +1 -1
- package/dist/js-script-debug/type-check.d.ts +2 -3
- package/dist/js-script-debug/type-check.d.ts.map +1 -1
- package/dist/js-script-debug/type-check.js +36 -14
- package/dist/js-script-debug/type-check.js.map +1 -1
- package/dist/missing-packs.d.ts +15 -0
- package/dist/missing-packs.d.ts.map +1 -0
- package/dist/missing-packs.js +70 -0
- package/dist/missing-packs.js.map +1 -0
- package/dist/partial-run.d.ts +62 -0
- package/dist/partial-run.d.ts.map +1 -0
- package/dist/partial-run.js +309 -0
- package/dist/partial-run.js.map +1 -0
- package/dist/run-trace-store.d.ts +2 -2
- package/dist/run-trace-store.d.ts.map +1 -1
- package/dist/run-trace-store.js +30 -2
- package/dist/run-trace-store.js.map +1 -1
- package/dist/service/active-runs.d.ts +21 -0
- package/dist/service/active-runs.d.ts.map +1 -0
- package/dist/service/active-runs.js +42 -0
- package/dist/service/active-runs.js.map +1 -0
- package/dist/service/app-operation.d.ts +2 -1
- package/dist/service/app-operation.d.ts.map +1 -1
- package/dist/service/app-operation.js +3 -1
- package/dist/service/app-operation.js.map +1 -1
- package/dist/service/index.d.ts +2 -1
- package/dist/service/index.d.ts.map +1 -1
- package/dist/service/index.js +1 -0
- package/dist/service/index.js.map +1 -1
- package/dist/service/workflow-run.d.ts +46 -4
- package/dist/service/workflow-run.d.ts.map +1 -1
- package/dist/service/workflow-run.js +194 -32
- package/dist/service/workflow-run.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +13 -0
- package/dist/session.js.map +1 -1
- package/dist/sketch-debug/report.d.ts.map +1 -1
- package/dist/sketch-debug/report.js +16 -25
- package/dist/sketch-debug/report.js.map +1 -1
- package/dist/timeline-debug/frame-geometry.d.ts +3 -1
- package/dist/timeline-debug/frame-geometry.d.ts.map +1 -1
- package/dist/timeline-debug/frame-geometry.js +8 -1
- package/dist/timeline-debug/frame-geometry.js.map +1 -1
- package/dist/timeline-debug/report.d.ts.map +1 -1
- package/dist/timeline-debug/report.js +16 -25
- package/dist/timeline-debug/report.js.map +1 -1
- package/dist/types.d.ts +4 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +28 -13
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @nodetool-ai/execution – Public API
|
|
3
3
|
*/
|
|
4
4
|
export { ExecutionSession } from "./session.js";
|
|
5
|
+
export { findMissingPacks } from "./missing-packs.js";
|
|
5
6
|
export { DurableGenerationLifecycle, createDurableGenerationLifecycle, createFalGenerationLifecycleHooks } from "./generation-lifecycle.js";
|
|
6
7
|
export { DurableGenerationRecoveryWorker } from "./generation-recovery-worker.js";
|
|
7
8
|
export { decodeFalOutputs, deterministicFalStorageKey } from "./fal-output-decoder.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@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BAAwB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/report.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/report.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAEV,mBAAmB,EACnB,mBAAmB,EAEnB,yBAAyB,EAE1B,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,eAAe,CAAC;AA2DvB,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,YAAY,CAAC,EAAE,yBAAyB,EAAE,CAAC;IAC3C,kDAAkD;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,mBAAmB,CAAC,CA2B9B"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* decides what the run means.
|
|
7
7
|
*/
|
|
8
8
|
import { JS_SCRIPT_DEFAULT_TIMEOUT_SECONDS } from "@nodetool-ai/protocol/api-schemas/js-scripts.js";
|
|
9
|
+
import { buildDocumentVerdict } from "../debug/verdict.js";
|
|
9
10
|
import { validateJsScriptDoc } from "./validate.js";
|
|
10
11
|
import { isFiniteNumber, isString } from "../predicates.js";
|
|
11
12
|
/**
|
|
@@ -39,30 +40,14 @@ const describe = (issue) => issue.path
|
|
|
39
40
|
? `[${issue.code}] ${issue.path}: ${issue.message}`
|
|
40
41
|
: `[${issue.code}] ${issue.message}`;
|
|
41
42
|
function buildVerdict(validation, interactions, finalValidation) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
...(finalValidation?.warnings ?? []).map((issue) => `After edits — ${describe(issue)}`)
|
|
51
|
-
];
|
|
52
|
-
const ok = issues.length === 0;
|
|
53
|
-
const headline = ok
|
|
54
|
-
? `Script is sound — ${interactions.length} interaction(s) ran clean` +
|
|
55
|
-
(warnings.length > 0 ? `, ${warnings.length} warning(s)` : "") +
|
|
56
|
-
"."
|
|
57
|
-
: `Script has ${issues.length} problem(s)` +
|
|
58
|
-
(failedSteps.length > 0
|
|
59
|
-
? `, ${failedSteps.length} failed interaction(s)`
|
|
60
|
-
: "") +
|
|
61
|
-
(warnings.length > 0 ? `, ${warnings.length} warning(s)` : "") +
|
|
62
|
-
` — ${issues[0]}`;
|
|
63
|
-
return warnings.length > 0
|
|
64
|
-
? { ok, headline, issues, warnings }
|
|
65
|
-
: { ok, headline, issues };
|
|
43
|
+
return buildDocumentVerdict({
|
|
44
|
+
subject: "Script",
|
|
45
|
+
soundLabel: "Script is sound",
|
|
46
|
+
describe,
|
|
47
|
+
validation,
|
|
48
|
+
finalValidation,
|
|
49
|
+
interactions
|
|
50
|
+
});
|
|
66
51
|
}
|
|
67
52
|
export async function buildJsScriptDebugReport(input) {
|
|
68
53
|
const options = input.options ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/js-script-debug/report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;
|
|
1
|
+
{"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/js-script-debug/report.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,iCAAiC,EAAE,MAAM,iDAAiD,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAU3D,OAAO,EACL,m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CAAC;QACnC,MAAM,CAAC,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC;IACvC,CAAC;IACD,IAAI,eAAe,EAAE,CAAC;QACpB,MAAM,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -8,9 +8,8 @@ export type PackDtsSources = ReadonlyMap<string, string>;
|
|
|
8
8
|
* script's own file, each naming the message TypeScript gives — which names
|
|
9
9
|
* the offending property (`caret` on an object-literal type mismatch) the
|
|
10
10
|
* way every other check in this module names the identifier it complains
|
|
11
|
-
* about.
|
|
12
|
-
*
|
|
13
|
-
* on top of the AST-level one in `validateCodeNodeBody`.
|
|
11
|
+
* about. A compiler load failure returns a warning, since this check is
|
|
12
|
+
* additive on top of the AST-level one in `validateCodeNodeBody`.
|
|
14
13
|
*/
|
|
15
14
|
export declare function typeCheckAgainstPackDts(code: string, packDtsSources: PackDtsSources): Promise<JsScriptDebugIssue[]>;
|
|
16
15
|
//# sourceMappingURL=type-check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-check.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/type-check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"type-check.d.ts","sourceRoot":"","sources":["../../src/js-script-debug/type-check.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,oIAAoI;AACpI,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AA0DzD;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAqF/B"}
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
18
18
|
import { tmpdir } from "node:os";
|
|
19
19
|
import { join } from "node:path";
|
|
20
|
+
import { importOptionalModule } from "@nodetool-ai/config";
|
|
21
|
+
import { SANDBOX_CAPABILITY_PACK, sandboxCapabilityModuleName } from "@nodetool-ai/protocol";
|
|
20
22
|
/**
|
|
21
23
|
* Names the QuickJS sandbox and the Code/script node put in scope, loosely
|
|
22
24
|
* typed so the checker never reports one as undefined — mirrors
|
|
@@ -53,6 +55,23 @@ declare function fromHex(text: string): Uint8Array;
|
|
|
53
55
|
declare function assetToSandbox(value: unknown): Promise<unknown>;
|
|
54
56
|
declare function sandboxToAsset(value: unknown): Promise<unknown>;
|
|
55
57
|
`;
|
|
58
|
+
/**
|
|
59
|
+
* "Cannot find module" (a named import, then a side-effect import). Only packs
|
|
60
|
+
* that ship a `.d.ts` are on the paths here, so every other import — a pack
|
|
61
|
+
* with no types, a host-mounted `@nodetool-ai/sandbox-nodetool/*` facade —
|
|
62
|
+
* fails to resolve in this program while resolving fine in the sandbox.
|
|
63
|
+
* Whether a specifier exists is the catalog check's job
|
|
64
|
+
* (`code_package_unavailable`); this check only holds a typed pack to its
|
|
65
|
+
* own declarations, and an unresolved import is `any` to it.
|
|
66
|
+
*/
|
|
67
|
+
const UNRESOLVED_MODULE_CODES = new Set([2307, 2882]);
|
|
68
|
+
let capabilityModules;
|
|
69
|
+
function availableCapabilityModules() {
|
|
70
|
+
capabilityModules ??= importOptionalModule("@nodetool-ai/agents")
|
|
71
|
+
.then((platform) => platform.DECLARED_CAPABILITY_MODULES)
|
|
72
|
+
.catch(() => []);
|
|
73
|
+
return capabilityModules;
|
|
74
|
+
}
|
|
56
75
|
/**
|
|
57
76
|
* Type-check `code` (a script or Code-node body) as an ES module against the
|
|
58
77
|
* `.d.ts` files in `packDtsSources`, keyed by the specifier a script imports
|
|
@@ -60,36 +79,35 @@ declare function sandboxToAsset(value: unknown): Promise<unknown>;
|
|
|
60
79
|
* script's own file, each naming the message TypeScript gives — which names
|
|
61
80
|
* the offending property (`caret` on an object-literal type mismatch) the
|
|
62
81
|
* way every other check in this module names the identifier it complains
|
|
63
|
-
* about.
|
|
64
|
-
*
|
|
65
|
-
* on top of the AST-level one in `validateCodeNodeBody`.
|
|
82
|
+
* about. A compiler load failure returns a warning, since this check is
|
|
83
|
+
* additive on top of the AST-level one in `validateCodeNodeBody`.
|
|
66
84
|
*/
|
|
67
85
|
export async function typeCheckAgainstPackDts(code, packDtsSources) {
|
|
68
86
|
if (code.trim() === "" || packDtsSources.size === 0)
|
|
69
87
|
return [];
|
|
70
88
|
let ts;
|
|
71
89
|
try {
|
|
72
|
-
|
|
90
|
+
const compiler = await importOptionalModule("typescript");
|
|
91
|
+
ts = compiler.default ?? compiler;
|
|
73
92
|
}
|
|
74
93
|
catch (error) {
|
|
75
|
-
//
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// package (`packages/execution/package.json`), and this dynamic import is
|
|
80
|
-
// the only place it is ever loaded — a validate call with no pack
|
|
81
|
-
// `.d.ts` sources, and every other caller of this package, never touches
|
|
82
|
-
// the module at all.
|
|
94
|
+
// The optional compiler cannot prevent the AST checks from running.
|
|
95
|
+
const missing = error instanceof Error &&
|
|
96
|
+
"code" in error &&
|
|
97
|
+
(error.code === "ERR_MODULE_NOT_FOUND" || error.code === "MODULE_NOT_FOUND");
|
|
83
98
|
return [
|
|
84
99
|
{
|
|
85
100
|
severity: "warning",
|
|
86
101
|
code: "type_check_unavailable",
|
|
87
|
-
message:
|
|
102
|
+
message: missing
|
|
103
|
+
? "Type checking was skipped because typescript is not installed. Install the optional TypeScript compiler with \"npm install typescript@npm:@typescript/typescript6@6.0.2\"."
|
|
104
|
+
: `Could not load the TypeScript compiler, so the script's imports were not type-checked against any installed pack's .d.ts: ${error instanceof Error ? error.message : String(error)}`
|
|
88
105
|
}
|
|
89
106
|
];
|
|
90
107
|
}
|
|
91
108
|
const dir = await mkdtemp(join(tmpdir(), "nodetool-jsscript-types-"));
|
|
92
109
|
try {
|
|
110
|
+
const availableModules = await availableCapabilityModules();
|
|
93
111
|
const globalsPath = join(dir, "sandbox-globals.d.ts");
|
|
94
112
|
const scriptPath = join(dir, "script.ts");
|
|
95
113
|
await writeFile(globalsPath, SANDBOX_GLOBALS_DTS, "utf8");
|
|
@@ -118,7 +136,11 @@ export async function typeCheckAgainstPackDts(code, packDtsSources) {
|
|
|
118
136
|
}
|
|
119
137
|
const diagnostics = ts
|
|
120
138
|
.getPreEmitDiagnostics(program)
|
|
121
|
-
.filter((diagnostic) => diagnostic.file?.fileName === scriptPath
|
|
139
|
+
.filter((diagnostic) => diagnostic.file?.fileName === scriptPath &&
|
|
140
|
+
(!UNRESOLVED_MODULE_CODES.has(diagnostic.code) || (() => {
|
|
141
|
+
const specifier = diagnostic.file.text.slice(diagnostic.start, (diagnostic.start ?? 0) + (diagnostic.length ?? 0)).replace(/^["']|["']$/g, "");
|
|
142
|
+
return (specifier === SANDBOX_CAPABILITY_PACK || specifier.startsWith(`${SANDBOX_CAPABILITY_PACK}/`)) && !availableModules.includes(sandboxCapabilityModuleName(specifier) ?? "");
|
|
143
|
+
})()));
|
|
122
144
|
return diagnostics.map((diagnostic) => {
|
|
123
145
|
const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, " ");
|
|
124
146
|
if (diagnostic.file !== undefined && diagnostic.start !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-check.js","sourceRoot":"","sources":["../../src/js-script-debug/type-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"type-check.js","sourceRoot":"","sources":["../../src/js-script-debug/type-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;A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AAK,SAAS,EAAE,CAAC;gBACpE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,6BAA6B,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;gBACjF,OAAO;oBACL,QAAQ,EAAE,OAAgB;oBAC1B,IAAI,EAAE,sBAAsB;oBAC5B,OAAO,EAAE,QAAQ,IAAI,GAAG,CAAC,KAAK,OAAO,EAAE;iBACxC,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,QAAQ,EAAE,OAAgB,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,CAAC;QAC/E,CAAC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type NodeCatalogIndex } from "@nodetool-ai/node-catalog";
|
|
2
|
+
import type { NodeRegistry } from "@nodetool-ai/node-sdk";
|
|
3
|
+
import type { MissingPackDetails } from "@nodetool-ai/protocol";
|
|
4
|
+
export interface MissingPackLookupOptions {
|
|
5
|
+
readonly loadWorkflow?: (id: string) => Promise<{
|
|
6
|
+
graph: unknown;
|
|
7
|
+
} | null>;
|
|
8
|
+
readonly catalog?: NodeCatalogIndex;
|
|
9
|
+
readonly installedPackIds?: ReadonlySet<string>;
|
|
10
|
+
}
|
|
11
|
+
type PackRegistry = Pick<NodeRegistry, "availability" | "catalogEntry"> & Partial<Pick<NodeRegistry, "list" | "getNodePackageId">>;
|
|
12
|
+
/** Collect absent packs before running nested graphs or referenced workflows. */
|
|
13
|
+
export declare function findMissingPacks(graph: unknown, registry: PackRegistry, options?: MissingPackLookupOptions): Promise<MissingPackDetails | null>;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=missing-packs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-packs.d.ts","sourceRoot":"","sources":["../src/missing-packs.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,KAAK,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC;IAC3E,QAAQ,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC;IACpC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACjD;AAED,KAAK,YAAY,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAAC,CAAC,CAAC;AAEnI,iFAAiF;AACjF,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAqDpC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createMissingPackError, readCatalogIndex } from "@nodetool-ai/node-catalog";
|
|
2
|
+
import { isRecord } from "./predicates.js";
|
|
3
|
+
/** Collect absent packs before running nested graphs or referenced workflows. */
|
|
4
|
+
export async function findMissingPacks(graph, registry, options = {}) {
|
|
5
|
+
const catalog = options.catalog ?? readCatalogIndex();
|
|
6
|
+
const byId = new Map(catalog.packs.map((pack) => [pack.id, pack]));
|
|
7
|
+
const pending = [graph];
|
|
8
|
+
const seenGraphs = new Set();
|
|
9
|
+
const seenWorkflows = new Set();
|
|
10
|
+
const requiredPacks = new Set();
|
|
11
|
+
const nodeTypes = new Set();
|
|
12
|
+
for (let cursor = 0; cursor < pending.length; cursor++) {
|
|
13
|
+
const current = pending[cursor];
|
|
14
|
+
if (!isRecord(current) || seenGraphs.has(current) || !Array.isArray(current.nodes)) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
seenGraphs.add(current);
|
|
18
|
+
for (const node of current.nodes) {
|
|
19
|
+
if (!isRecord(node) || typeof node.type !== "string") {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const owner = registry.catalogEntry(node.type)?.pack;
|
|
23
|
+
if (owner && registry.availability(node.type) === "catalog") {
|
|
24
|
+
requiredPacks.add(owner);
|
|
25
|
+
nodeTypes.add(node.type);
|
|
26
|
+
}
|
|
27
|
+
const properties = isRecord(node.properties) ? node.properties : isRecord(node.data) ? node.data : {};
|
|
28
|
+
if (node.type === "nodetool.workflows.subgraph.Subgraph") {
|
|
29
|
+
pending.push(properties.graph);
|
|
30
|
+
}
|
|
31
|
+
else if (node.type === "nodetool.workflows.workflow_node.Workflow") {
|
|
32
|
+
const inline = isRecord(properties.workflow_json) ? properties.workflow_json.graph : undefined;
|
|
33
|
+
if (isRecord(inline) && Array.isArray(inline.nodes)) {
|
|
34
|
+
pending.push(inline);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof properties.workflow_id === "string" && properties.workflow_id && options.loadWorkflow && !seenWorkflows.has(properties.workflow_id)) {
|
|
37
|
+
seenWorkflows.add(properties.workflow_id);
|
|
38
|
+
const workflow = await options.loadWorkflow(properties.workflow_id);
|
|
39
|
+
if (workflow) {
|
|
40
|
+
pending.push(workflow.graph);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (requiredPacks.size === 0) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
const installed = options.installedPackIds ?? new Set((registry.list?.() ?? []).flatMap((type) => {
|
|
50
|
+
const owner = registry.getNodePackageId?.(type) ?? registry.catalogEntry(type)?.pack ?? catalog.owners[type];
|
|
51
|
+
return owner ? [owner] : [];
|
|
52
|
+
}));
|
|
53
|
+
const queue = [...requiredPacks];
|
|
54
|
+
for (let cursor = 0; cursor < queue.length; cursor++) {
|
|
55
|
+
const pack = byId.get(queue[cursor] ?? "");
|
|
56
|
+
if (!pack) {
|
|
57
|
+
throw new Error(`Unknown node catalog pack: ${queue[cursor]}`);
|
|
58
|
+
}
|
|
59
|
+
for (const id of pack.requires) {
|
|
60
|
+
if (!requiredPacks.has(id) && !installed.has(id)) {
|
|
61
|
+
requiredPacks.add(id);
|
|
62
|
+
queue.push(id);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// The catalog factory supplies the active host's install-mode guidance.
|
|
67
|
+
const details = createMissingPackError([...requiredPacks], [...nodeTypes], undefined, catalog).details;
|
|
68
|
+
return { ...details, packs: details.packs.filter((pack) => requiredPacks.has(pack.id)) };
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=missing-packs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"missing-packs.js","sourceRoot":"","sources":["../src/missing-packs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAyB,MAAM,2BAA2B,CAAC;AAG5G,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAU3C,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAc,EACd,QAAsB,EACtB,OAAO,GAA6B,EAAE;IAEtC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,gBAAgB,EAAE,CAAC;IACtD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,I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SAAS,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC;IACvG,OAAO,EAAE,GAAG,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC3F,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { GraphData, NodeDescriptor } from "@nodetool-ai/protocol";
|
|
2
|
+
import type { NodeMetadata } from "@nodetool-ai/node-sdk";
|
|
3
|
+
/** A previous generation of one node, as the run reuses it. */
|
|
4
|
+
export interface PreviousGeneration {
|
|
5
|
+
/** Output values keyed by output handle. */
|
|
6
|
+
outputs: Record<string, unknown>;
|
|
7
|
+
jobId: string | null;
|
|
8
|
+
assetIds: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface PartialRunDeps {
|
|
11
|
+
getMetadata: (nodeType: string) => NodeMetadata | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* The node's previous generation, or null when it has none. Omit to run
|
|
14
|
+
* every upstream node again.
|
|
15
|
+
*/
|
|
16
|
+
loadPreviousGeneration?: (node: NodeDescriptor, metadata: NodeMetadata) => Promise<PreviousGeneration | null>;
|
|
17
|
+
}
|
|
18
|
+
/** One upstream node whose saved output replaced its run. */
|
|
19
|
+
export interface ReusedNode {
|
|
20
|
+
node_id: string;
|
|
21
|
+
job_id: string | null;
|
|
22
|
+
asset_ids: string[];
|
|
23
|
+
}
|
|
24
|
+
export type PartialRunPlan = {
|
|
25
|
+
kind: "graph";
|
|
26
|
+
graph: GraphData;
|
|
27
|
+
/** Every node the narrowed graph runs. */
|
|
28
|
+
ran: string[];
|
|
29
|
+
reused: ReusedNode[];
|
|
30
|
+
} | {
|
|
31
|
+
kind: "unknown_nodes";
|
|
32
|
+
ids: string[];
|
|
33
|
+
};
|
|
34
|
+
/** The ids in `nodeIds` that name no node of `graph`. */
|
|
35
|
+
export declare function unknownNodeIds(graph: GraphData, nodeIds: readonly string[]): string[];
|
|
36
|
+
/**
|
|
37
|
+
* A named output must match exactly. An unnamed edge may use the sole output.
|
|
38
|
+
*/
|
|
39
|
+
export declare function generationOutputFor(outputs: Record<string, unknown>, handle: string | null | undefined): unknown;
|
|
40
|
+
export declare function planPartialRun(graph: GraphData, nodeIds: readonly string[], deps: PartialRunDeps): Promise<PartialRunPlan>;
|
|
41
|
+
/** The asset fields a generation is rebuilt from. */
|
|
42
|
+
export interface GenerationAssetRow {
|
|
43
|
+
id: string;
|
|
44
|
+
job_id: string | null;
|
|
45
|
+
content_type: string;
|
|
46
|
+
size: number | null;
|
|
47
|
+
metadata: Record<string, unknown> | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Rebuild a node's previous generation from the assets its auto-save wrote
|
|
51
|
+
* (`autoSaveAssets` in the websocket package), newest first. One generation is
|
|
52
|
+
* every asset one `generation_complete` produced: the same job and the same
|
|
53
|
+
* `generation_index`. Returns null when nothing usable is saved, so the node
|
|
54
|
+
* runs again:
|
|
55
|
+
*
|
|
56
|
+
* - `pinnedId` (the editor's `selected_generation`) names an asset not in
|
|
57
|
+
* `rows`;
|
|
58
|
+
* - a text generation was saved with a truncated inline copy;
|
|
59
|
+
* - a structured generation was too large to keep inline.
|
|
60
|
+
*/
|
|
61
|
+
export declare function previousGenerationFromAssets(rows: readonly GenerationAssetRow[], metadata: NodeMetadata, pinnedId?: string): PreviousGeneration | null;
|
|
62
|
+
//# sourceMappingURL=partial-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partial-run.d.ts","sourceRoot":"","sources":["../src/partial-run.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAQ,SAAS,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAgB,MAAM,uBAAuB,CAAC;AAExE,+DAA+D;AAC/D,MAAM,WAAW,kB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