@nodetool-ai/runtime-core 0.8.11 → 0.8.13
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/README.md +61 -0
- package/dist/.nodetool-build-stamp +1 -1
- package/dist/cost-ledger.d.ts +21 -0
- package/dist/cost-ledger.d.ts.map +1 -0
- package/dist/cost-ledger.js +48 -0
- package/dist/cost-ledger.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/model-interfaces.d.ts +257 -0
- package/dist/model-interfaces.d.ts.map +1 -0
- package/dist/model-interfaces.js +2 -0
- package/dist/model-interfaces.js.map +1 -0
- package/dist/node-context.d.ts +240 -0
- package/dist/node-context.d.ts.map +1 -0
- package/dist/node-context.js +2 -0
- package/dist/node-context.js.map +1 -0
- package/package.json +11 -4
package/README.md
CHANGED
|
@@ -7,3 +7,64 @@ does not load media codecs, browser automation or local inference.
|
|
|
7
7
|
Install `@nodetool-ai/runtime-core` to use `OpenAITextProvider`,
|
|
8
8
|
`createLocalWorkspace` and `RunCancellation`. Hosts supply the authenticated
|
|
9
9
|
owner, secret resolver and usage accounting through `ExecutionContext`.
|
|
10
|
+
|
|
11
|
+
## Node context contract
|
|
12
|
+
|
|
13
|
+
`NodeContext` (`src/node-context.ts`) lists the context members node code may
|
|
14
|
+
use, with their signatures, grouped by concern. `ProcessingContext` in
|
|
15
|
+
`@nodetool-ai/runtime` implements `NodeContext<RuntimeNodeContextTypes>`, so the
|
|
16
|
+
compiler checks the TypeScript side. Types this package cannot import, such as
|
|
17
|
+
`BaseProvider` and `Message`, are slots in `NodeContextTypes` that the runtime
|
|
18
|
+
binds. Unbound, they are `unknown`. The persistence port the context forwards
|
|
19
|
+
to (`ProcessingContextModelInterfaces` and its record types) lives in
|
|
20
|
+
`src/model-interfaces.ts`.
|
|
21
|
+
|
|
22
|
+
`node-context-members.json` is generated from the interface. The native
|
|
23
|
+
runner's guest context is tested against it (see
|
|
24
|
+
[the graph-runner README](../../native/graph-runner/README.md#node-context-contract)).
|
|
25
|
+
|
|
26
|
+
To add a member that node code needs:
|
|
27
|
+
|
|
28
|
+
1. Add it to the matching group interface in `src/node-context.ts`, with the
|
|
29
|
+
signature `ProcessingContext` has.
|
|
30
|
+
2. Run `node packages/runtime-core/scripts/node-context-members.mjs` from the
|
|
31
|
+
repository root to regenerate the JSON.
|
|
32
|
+
3. Implement it in the guest context, or declare it in
|
|
33
|
+
`native/graph-runner/guest/context-unavailable.mjs` with a reason.
|
|
34
|
+
|
|
35
|
+
`npm run check:node-context --workspace=packages/runtime-core` fails when the
|
|
36
|
+
JSON is stale, or when node code uses a `ProcessingContext` member the
|
|
37
|
+
interface lacks. The second check reads the built declarations, so run
|
|
38
|
+
`npm run build:packages` first. Without `--check`,
|
|
39
|
+
`node packages/runtime-core/scripts/node-context-usage.mjs` prints each member
|
|
40
|
+
with its call sites and packages.
|
|
41
|
+
|
|
42
|
+
### Shared context logic
|
|
43
|
+
|
|
44
|
+
Member logic that does not depend on the host lives in modules that both
|
|
45
|
+
`ProcessingContext` and the native runner's guest context call, so the two do
|
|
46
|
+
not keep separate copies:
|
|
47
|
+
|
|
48
|
+
| Module | Members |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `src/cost-ledger.ts` (`@nodetool-ai/runtime-core/cost-ledger`) | `addToTotalCost`, `getTotalCost` |
|
|
51
|
+
| `packages/runtime/src/node-context/message-media.ts` | `resolveMessageMediaUris` |
|
|
52
|
+
| `packages/runtime/src/node-context/provider-dispatch.ts` | `providerSupportsStreamingTTS`, the provider call of each capability |
|
|
53
|
+
| `packages/runtime/src/node-context/generation.ts` | `runGeneration`, `runProviderPrediction`, `streamProviderPrediction`, `textToSpeechEncoded`, `textToMusic`, `audioToAudio` |
|
|
54
|
+
|
|
55
|
+
A module goes in this package when it needs only types from here. The
|
|
56
|
+
modules in `packages/runtime/src/node-context/` use runtime types such as
|
|
57
|
+
`BaseProvider` and `Message`. Every one of them must load in QuickJS: no Node
|
|
58
|
+
builtins, no file system, no `process` and no side effects at load time.
|
|
59
|
+
|
|
60
|
+
Each function takes a host as its first argument.
|
|
61
|
+
`packages/runtime/src/node-context/context-host.ts` defines the host
|
|
62
|
+
interfaces: `MediaHost` (stored bytes and entity lookups), `ProviderHost`,
|
|
63
|
+
`ProviderCallHost` (media, the run signal and message resolution) and
|
|
64
|
+
`GenerationHost` (the run, its lifecycle callbacks, the registry of live
|
|
65
|
+
generations and the app-run flag). `ProcessingContext` passes itself, or for
|
|
66
|
+
the generation envelope an adapter over its private lifecycle state, and its
|
|
67
|
+
methods delegate. The guest context passes its own context, whose primitives
|
|
68
|
+
reach the C++ host. To move another member's logic into a shared module, add
|
|
69
|
+
the primitives it needs to the matching host interface and implement them on
|
|
70
|
+
both sides.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
2026-11-
|
|
1
|
+
2026-11-13T22:29:03.853Z
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The cost totals of one run context: the running total that
|
|
3
|
+
* `addToTotalCost` and `getTotalCost` read and write, and the per-operation
|
|
4
|
+
* entries behind `trackOperationCost`. `ProcessingContext` in
|
|
5
|
+
* `@nodetool-ai/runtime` and the native runner's guest context both keep
|
|
6
|
+
* their totals in one. It has no host dependencies.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CostLedger {
|
|
9
|
+
private totalCost;
|
|
10
|
+
private entries;
|
|
11
|
+
/** Adds a cost to the total. A cost that is not a finite number counts as 0. */
|
|
12
|
+
add(cost: number): void;
|
|
13
|
+
/** Adds a cost to the total and records it as an operation entry. */
|
|
14
|
+
track(operation: string, cost: number, metadata?: Record<string, unknown>): void;
|
|
15
|
+
reset(): void;
|
|
16
|
+
get total(): number;
|
|
17
|
+
get operations(): ReadonlyArray<Record<string, unknown>>;
|
|
18
|
+
/** An independent ledger with the same total and copies of the entries. */
|
|
19
|
+
clone(): CostLedger;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=cost-ledger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-ledger.d.ts","sourceRoot":"","sources":["../src/cost-ledger.ts"],"names":[],"mappings":"AACA;;;;;;GAMG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,OAAO,CAAsC;IAErD,gFAAgF;IAChF,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEtB;IAED,qEAAqE;IACrE,KAAK,CACH,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,IAAI,CASN;IAED,KAAK,IAAI,IAAI,CAGZ;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,UAAU,IAAI,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEvD;IAED,2EAA2E;IAC3E,KAAK,IAAI,UAAU,CAKlB;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* oxlint-disable anti-slop/no-unsafe-dictionary-type -- the entries keep the shape ProcessingContext.trackOperationCost and getOperationCosts expose: caller metadata spread into an open record. Narrowing it changes that public contract. */
|
|
2
|
+
/**
|
|
3
|
+
* The cost totals of one run context: the running total that
|
|
4
|
+
* `addToTotalCost` and `getTotalCost` read and write, and the per-operation
|
|
5
|
+
* entries behind `trackOperationCost`. `ProcessingContext` in
|
|
6
|
+
* `@nodetool-ai/runtime` and the native runner's guest context both keep
|
|
7
|
+
* their totals in one. It has no host dependencies.
|
|
8
|
+
*/
|
|
9
|
+
export class CostLedger {
|
|
10
|
+
totalCost = 0;
|
|
11
|
+
entries = [];
|
|
12
|
+
/** Adds a cost to the total. A cost that is not a finite number counts as 0. */
|
|
13
|
+
add(cost) {
|
|
14
|
+
this.totalCost += finiteCost(cost);
|
|
15
|
+
}
|
|
16
|
+
/** Adds a cost to the total and records it as an operation entry. */
|
|
17
|
+
track(operation, cost, metadata) {
|
|
18
|
+
const safeCost = finiteCost(cost);
|
|
19
|
+
this.totalCost += safeCost;
|
|
20
|
+
this.entries.push({
|
|
21
|
+
operation,
|
|
22
|
+
cost: safeCost,
|
|
23
|
+
timestamp: new Date().toISOString(),
|
|
24
|
+
...(metadata ?? {})
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
reset() {
|
|
28
|
+
this.totalCost = 0;
|
|
29
|
+
this.entries = [];
|
|
30
|
+
}
|
|
31
|
+
get total() {
|
|
32
|
+
return this.totalCost;
|
|
33
|
+
}
|
|
34
|
+
get operations() {
|
|
35
|
+
return this.entries;
|
|
36
|
+
}
|
|
37
|
+
/** An independent ledger with the same total and copies of the entries. */
|
|
38
|
+
clone() {
|
|
39
|
+
const next = new CostLedger();
|
|
40
|
+
next.totalCost = this.totalCost;
|
|
41
|
+
next.entries = this.entries.map((entry) => ({ ...entry }));
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function finiteCost(cost) {
|
|
46
|
+
return Number.isFinite(cost) ? cost : 0;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=cost-ledger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cost-ledger.js","sourceRoot":"","sources":["../src/cost-ledger.ts"],"names":[],"mappings":"AAAA,gPAAgP;AAChP;;;;;;GAMG;AACH,MAAM,OAAO,UAAU;IACb,SAAS,GAAG,CAAC,CAAC;IACd,OAAO,GAAmC,EAAE,CAAC;IAErD,gFAAgF;IAChF,GAAG,CAAC,IAAY;QACd,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,qEAAqE;IACrE,KAAK,CACH,SAAiB,EACjB,IAAY,EACZ,QAAkC;QAElC,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC;QAC3B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;YAChB,SAAS;YACT,IAAI,EAAE,QAAQ;YACd,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACnC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC;SACpB,CAAC,CAAC;IACL,CAAC;IAED,KAAK;QACH,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,2EAA2E;IAC3E,KAAK;QACH,MAAM,IAAI,GAAG,IAAI,UAAU,EAAE,CAAC;QAC9B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,7 @@ export * from "./workspace.js";
|
|
|
3
3
|
export * from "./text-provider.js";
|
|
4
4
|
export * from "./context.js";
|
|
5
5
|
export * from "./storage-workspace.js";
|
|
6
|
+
export * from "./model-interfaces.js";
|
|
7
|
+
export * from "./node-context.js";
|
|
8
|
+
export * from "./cost-ledger.js";
|
|
6
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,4 +3,7 @@ export * from "./workspace.js";
|
|
|
3
3
|
export * from "./text-provider.js";
|
|
4
4
|
export * from "./context.js";
|
|
5
5
|
export * from "./storage-workspace.js";
|
|
6
|
+
export * from "./model-interfaces.js";
|
|
7
|
+
export * from "./node-context.js";
|
|
8
|
+
export * from "./cost-ledger.js";
|
|
6
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The persistence port a node context forwards to. The host installs these
|
|
3
|
+
* functions, and the context binds `userId` from the run.
|
|
4
|
+
*/
|
|
5
|
+
import type { Entity, EntityKind, EntitySource } from "@nodetool-ai/protocol";
|
|
6
|
+
export interface MessageCreateRequestLike {
|
|
7
|
+
thread_id: string;
|
|
8
|
+
role: string;
|
|
9
|
+
content?: unknown;
|
|
10
|
+
tool_calls?: unknown;
|
|
11
|
+
workflow_id?: string | null;
|
|
12
|
+
name?: string | null;
|
|
13
|
+
tool_call_id?: string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface ThreadMessagesResultLike {
|
|
16
|
+
messages: Array<Record<string, unknown>>;
|
|
17
|
+
next: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface AssetCreateParamsLike {
|
|
20
|
+
userId: string;
|
|
21
|
+
workflowId: string | null;
|
|
22
|
+
jobId: string;
|
|
23
|
+
projectId?: string | null;
|
|
24
|
+
name: string;
|
|
25
|
+
contentType: string;
|
|
26
|
+
content: Uint8Array;
|
|
27
|
+
parentId?: string | null;
|
|
28
|
+
nodeId?: string | null;
|
|
29
|
+
/** Stored on the asset row; the generation seam stamps `generation_id`. */
|
|
30
|
+
metadata?: Record<string, unknown> | null;
|
|
31
|
+
}
|
|
32
|
+
/** A non-folder asset surfaced when listing a folder's contents. */
|
|
33
|
+
export interface FolderAssetEntry {
|
|
34
|
+
id: string;
|
|
35
|
+
content_type: string;
|
|
36
|
+
name: string;
|
|
37
|
+
}
|
|
38
|
+
/** An asset's identity + metadata, as surfaced by `getAssetInfo`. */
|
|
39
|
+
export interface AssetInfoEntry {
|
|
40
|
+
id: string;
|
|
41
|
+
content_type: string;
|
|
42
|
+
name: string;
|
|
43
|
+
metadata: Record<string, unknown> | null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A record the host's persistence layer answers with.
|
|
47
|
+
*
|
|
48
|
+
* The row and response types live in `@nodetool-ai/models`, which sits above
|
|
49
|
+
* `runtime`, so the port names the field every caller reads — the record's
|
|
50
|
+
* identity — and each caller re-reads the document fields it knows how to
|
|
51
|
+
* interpret.
|
|
52
|
+
*/
|
|
53
|
+
export interface PersistedRecordLike {
|
|
54
|
+
id: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ProcessingContextModelInterfaces {
|
|
57
|
+
/** Read a non-secret setting owned by the current user. */
|
|
58
|
+
getSetting?: (args: {
|
|
59
|
+
userId: string;
|
|
60
|
+
key: string;
|
|
61
|
+
}) => Promise<string | null>;
|
|
62
|
+
getJob?: (args: {
|
|
63
|
+
userId: string;
|
|
64
|
+
jobId: string;
|
|
65
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
66
|
+
/**
|
|
67
|
+
* HOLDOUT (anti-slop/no-unknown-returns): narrowing this to the created
|
|
68
|
+
* record's shape breaks the `as Record<string, unknown>` assertions on the
|
|
69
|
+
* result in `image-nodes` and `audio-nodes` — an interface without an index
|
|
70
|
+
* signature is not comparable to that type. Typing it honestly means editing
|
|
71
|
+
* those call sites too.
|
|
72
|
+
*/
|
|
73
|
+
createAsset?: (args: AssetCreateParamsLike) => Promise<unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* Replace an existing asset's bytes in place, keeping its id. Returns `null`
|
|
76
|
+
* when the asset does not exist or is not owned by the user.
|
|
77
|
+
*
|
|
78
|
+
* An editing loop needs this: creating a new asset per save would give the
|
|
79
|
+
* caller a different id after every edit, and the handles it already handed
|
|
80
|
+
* out would point at a stale version.
|
|
81
|
+
*/
|
|
82
|
+
updateAssetBytes?: (args: {
|
|
83
|
+
userId: string;
|
|
84
|
+
assetId: string;
|
|
85
|
+
content: Uint8Array;
|
|
86
|
+
contentType?: string;
|
|
87
|
+
name?: string;
|
|
88
|
+
}) => Promise<AssetInfoEntry | null>;
|
|
89
|
+
/**
|
|
90
|
+
* Recursively list the non-folder assets contained in `folderId`. Returns
|
|
91
|
+
* `null` when the id is not a folder (or does not exist) so callers can tell
|
|
92
|
+
* "not a folder" apart from "empty folder" (`[]`).
|
|
93
|
+
*/
|
|
94
|
+
listFolderAssets?: (args: {
|
|
95
|
+
userId: string;
|
|
96
|
+
folderId: string;
|
|
97
|
+
}) => Promise<FolderAssetEntry[] | null>;
|
|
98
|
+
/**
|
|
99
|
+
* Look up one owned asset's identity + metadata (no bytes). Returns `null`
|
|
100
|
+
* when the asset does not exist or is not owned by the user.
|
|
101
|
+
*/
|
|
102
|
+
getAssetInfo?: (args: {
|
|
103
|
+
userId: string;
|
|
104
|
+
assetId: string;
|
|
105
|
+
}) => Promise<AssetInfoEntry | null>;
|
|
106
|
+
createMessage?: (args: {
|
|
107
|
+
userId: string;
|
|
108
|
+
req: MessageCreateRequestLike;
|
|
109
|
+
}) => Promise<PersistedRecordLike>;
|
|
110
|
+
getMessages?: (args: {
|
|
111
|
+
userId: string;
|
|
112
|
+
threadId: string;
|
|
113
|
+
limit?: number;
|
|
114
|
+
startKey?: string | null;
|
|
115
|
+
reverse?: boolean;
|
|
116
|
+
}) => Promise<ThreadMessagesResultLike>;
|
|
117
|
+
/** Load a persisted sketch (image document) by id; null when missing or not owned. */
|
|
118
|
+
getImageDocument?: (args: {
|
|
119
|
+
userId: string;
|
|
120
|
+
id: string;
|
|
121
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
122
|
+
/** Create a persisted sketch (image document); returns the created document response. */
|
|
123
|
+
createImageDocument?: (args: {
|
|
124
|
+
userId: string;
|
|
125
|
+
name: string;
|
|
126
|
+
projectId?: string;
|
|
127
|
+
width: number;
|
|
128
|
+
height: number;
|
|
129
|
+
document: unknown;
|
|
130
|
+
}) => Promise<PersistedRecordLike>;
|
|
131
|
+
/** Load a persisted timeline sequence by id; null when missing or not owned. */
|
|
132
|
+
getTimelineSequence?: (args: {
|
|
133
|
+
userId: string;
|
|
134
|
+
id: string;
|
|
135
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
136
|
+
/** Create a persisted timeline sequence from a full sequence document. */
|
|
137
|
+
createTimelineSequence?: (args: {
|
|
138
|
+
userId: string;
|
|
139
|
+
sequence: unknown;
|
|
140
|
+
}) => Promise<PersistedRecordLike>;
|
|
141
|
+
/** Replace a persisted timeline sequence's document; null when missing or not owned. */
|
|
142
|
+
updateTimelineSequence?: (args: {
|
|
143
|
+
userId: string;
|
|
144
|
+
id: string;
|
|
145
|
+
sequence: unknown;
|
|
146
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
147
|
+
/** Load a persisted script by id; null when missing or not owned. */
|
|
148
|
+
getScript?: (args: {
|
|
149
|
+
userId: string;
|
|
150
|
+
id: string;
|
|
151
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
152
|
+
/** Create a persisted script from a name + document. */
|
|
153
|
+
createScript?: (args: {
|
|
154
|
+
userId: string;
|
|
155
|
+
name?: string;
|
|
156
|
+
projectId?: string;
|
|
157
|
+
document: unknown;
|
|
158
|
+
}) => Promise<PersistedRecordLike>;
|
|
159
|
+
/** Replace a persisted script's document (and optional timeline link); null when missing or not owned. */
|
|
160
|
+
updateScript?: (args: {
|
|
161
|
+
userId: string;
|
|
162
|
+
id: string;
|
|
163
|
+
document?: unknown;
|
|
164
|
+
timelineId?: string | null;
|
|
165
|
+
baseUpdatedAt?: string;
|
|
166
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
167
|
+
/** Load a persisted storyboard by id; null when missing or not owned. */
|
|
168
|
+
getStoryboard?: (args: {
|
|
169
|
+
userId: string;
|
|
170
|
+
id: string;
|
|
171
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
172
|
+
/** The caller's storyboards, optionally narrowed by project. */
|
|
173
|
+
listStoryboards?: (args: {
|
|
174
|
+
userId: string;
|
|
175
|
+
projectId?: string;
|
|
176
|
+
limit?: number;
|
|
177
|
+
}) => Promise<PersistedRecordLike[]>;
|
|
178
|
+
/**
|
|
179
|
+
* The copy a previous run derived from `templateId` for that `recastKey`;
|
|
180
|
+
* null when there is none. Scoped rather than listed, because a listing is
|
|
181
|
+
* windowed and a batch bigger than the window would keep re-deriving — and
|
|
182
|
+
* re-rendering — copies it already has.
|
|
183
|
+
*/
|
|
184
|
+
findRecastStoryboard?: (args: {
|
|
185
|
+
userId: string;
|
|
186
|
+
projectId?: string;
|
|
187
|
+
templateId: string;
|
|
188
|
+
recastKey: string;
|
|
189
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
190
|
+
/** Create a persisted storyboard from a name + document. */
|
|
191
|
+
createStoryboard?: (args: {
|
|
192
|
+
userId: string;
|
|
193
|
+
name?: string;
|
|
194
|
+
projectId?: string;
|
|
195
|
+
document: unknown;
|
|
196
|
+
}) => Promise<PersistedRecordLike>;
|
|
197
|
+
/** Replace a persisted storyboard's document (and optional timeline link); null when missing or not owned. */
|
|
198
|
+
updateStoryboard?: (args: {
|
|
199
|
+
userId: string;
|
|
200
|
+
id: string;
|
|
201
|
+
document?: unknown;
|
|
202
|
+
timelineId?: string | null;
|
|
203
|
+
baseUpdatedAt?: string;
|
|
204
|
+
}) => Promise<PersistedRecordLike | null>;
|
|
205
|
+
/** The caller's entity library, optionally narrowed by project, kind, tags or name. */
|
|
206
|
+
listEntities?: (args: {
|
|
207
|
+
userId: string;
|
|
208
|
+
projectId?: string;
|
|
209
|
+
kind?: EntityKind;
|
|
210
|
+
tags?: string[];
|
|
211
|
+
nameContains?: string;
|
|
212
|
+
limit?: number;
|
|
213
|
+
}) => Promise<Entity[]>;
|
|
214
|
+
/** Read one owned entity by id; null when missing, not owned, or not tagged. */
|
|
215
|
+
getEntity?: (args: {
|
|
216
|
+
userId: string;
|
|
217
|
+
id: string;
|
|
218
|
+
}) => Promise<Entity | null>;
|
|
219
|
+
/**
|
|
220
|
+
* Create or update one entity, identified by `source.key` when given and by
|
|
221
|
+
* (project, kind, name) otherwise. A re-run of the same graph therefore
|
|
222
|
+
* updates the entity it made last time instead of growing the library.
|
|
223
|
+
*/
|
|
224
|
+
upsertEntity?: (args: EntityUpsertArgs) => Promise<EntityUpsertResult>;
|
|
225
|
+
}
|
|
226
|
+
/** The arguments {@link ProcessingContextModelInterfaces.upsertEntity} takes. */
|
|
227
|
+
export interface EntityUpsertArgs {
|
|
228
|
+
userId: string;
|
|
229
|
+
projectId?: string;
|
|
230
|
+
kind: EntityKind;
|
|
231
|
+
name: string;
|
|
232
|
+
descriptor: string;
|
|
233
|
+
/** The image asset the entity shows; also the row a new entity is tagged on. */
|
|
234
|
+
imageAssetId: string;
|
|
235
|
+
description?: string;
|
|
236
|
+
tags?: string[];
|
|
237
|
+
voiceId?: string | null;
|
|
238
|
+
/** Stored verbatim on the marker, so a re-run finds its own row. */
|
|
239
|
+
source?: EntitySource;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* What an upsert did. The host owns the match rule (`source.key`, then
|
|
243
|
+
* project/kind/name), so it is the only place that can say whether the row is
|
|
244
|
+
* new — a caller re-deriving that from a probe duplicates the rule and drifts
|
|
245
|
+
* from it the moment the host's changes.
|
|
246
|
+
*/
|
|
247
|
+
export interface EntityUpsertResult {
|
|
248
|
+
entity: Entity;
|
|
249
|
+
created: boolean;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The arguments one model interface takes, minus the `userId` every context
|
|
253
|
+
* forwarder binds from the run. Derived so the shape is declared once, on the
|
|
254
|
+
* interface.
|
|
255
|
+
*/
|
|
256
|
+
export type ModelInterfaceArgs<K extends keyof ProcessingContextModelInterfaces> = Omit<Parameters<NonNullable<ProcessingContextModelInterfaces[K]>>[0], "userId">;
|
|
257
|
+
//# sourceMappingURL=model-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-interfaces.d.ts","sourceRoot":"","sources":["../src/model-interfaces.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MA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,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC7E;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACxE;AAED,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,oEAAoE;IACpE,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,gCAAgC,IAC7E,IAAI,CACF,UAAU,CAAC,WAAW,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAC/D,QAAQ,CACT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-interfaces.js","sourceRoot":"","sources":["../src/model-interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The context members node code may use. `ProcessingContext` in
|
|
3
|
+
* `@nodetool-ai/runtime` implements this interface, and the native runner's
|
|
4
|
+
* guest context is checked against the member list generated from it
|
|
5
|
+
* (`node-context-members.json`). `scripts/node-context-usage.mjs --check`
|
|
6
|
+
* fails when node code uses a context member this interface does not declare.
|
|
7
|
+
*
|
|
8
|
+
* Members are function-typed properties rather than methods so that an
|
|
9
|
+
* implementation is checked with strict parameter variance.
|
|
10
|
+
*/
|
|
11
|
+
import type { Entity, ProcessingMessage, ProviderCost } from "@nodetool-ai/protocol";
|
|
12
|
+
import type { StorageAdapter } from "@nodetool-ai/storage";
|
|
13
|
+
import type { AssetInfoEntry, EntityUpsertResult, FolderAssetEntry, MessageCreateRequestLike, ModelInterfaceArgs, PersistedRecordLike, ProcessingContextModelInterfaces, ThreadMessagesResultLike } from "./model-interfaces.js";
|
|
14
|
+
import type { Workspace } from "./workspace.js";
|
|
15
|
+
/**
|
|
16
|
+
* Controls how asset-like values (ImageRef / AudioRef / VideoRef) are
|
|
17
|
+
* materialized when {@link NodeContextAssets.normalizeOutputValue} runs.
|
|
18
|
+
*
|
|
19
|
+
* Pick the mode by where the consumer lives:
|
|
20
|
+
* - `native`: in-process JS/TS code that knows how to handle the live
|
|
21
|
+
* object as-is (DSL, tests, kernel-internal handoffs). Inline `data`
|
|
22
|
+
* bytes stay attached.
|
|
23
|
+
* - `data_uri`: anything that renders a `data:image/png;base64,...` URI
|
|
24
|
+
* inline (markdown, simple HTML).
|
|
25
|
+
* - `temp_url`: HTTP-fetching client over a short-lived URL — bytes are
|
|
26
|
+
* uploaded to the temp storage adapter and `data` is dropped.
|
|
27
|
+
* - `storage_url`: same as `temp_url` but persistent storage.
|
|
28
|
+
* - `workspace`: write the bytes to a file inside `workspaceDir` and
|
|
29
|
+
* return that file URI.
|
|
30
|
+
* - `raw`: keep bytes embedded in the asset's `data` field.
|
|
31
|
+
*
|
|
32
|
+
* NOTE: this used to be called `"python"` (mirroring the Python enum,
|
|
33
|
+
* where it accurately meant "Python-native object"). The rename to
|
|
34
|
+
* `"native"` makes the contract language-agnostic and matches what the
|
|
35
|
+
* mode actually does in the TS runtime.
|
|
36
|
+
*/
|
|
37
|
+
export type AssetOutputMode = "native" | "data_uri" | "temp_url" | "storage_url" | "workspace" | "raw";
|
|
38
|
+
/**
|
|
39
|
+
* Types that `@nodetool-ai/runtime` and `@nodetool-ai/execution-core` own and
|
|
40
|
+
* this package cannot import. `RuntimeNodeContextTypes` in
|
|
41
|
+
* `@nodetool-ai/runtime` binds each slot to the type named in its comment, so
|
|
42
|
+
* `NodeContext<RuntimeNodeContextTypes>` has the full runtime signatures.
|
|
43
|
+
* Without a binding the slots are `unknown`.
|
|
44
|
+
*/
|
|
45
|
+
export interface NodeContextTypes {
|
|
46
|
+
/** `BaseProvider` */
|
|
47
|
+
provider: unknown;
|
|
48
|
+
/** `Message` */
|
|
49
|
+
message: unknown;
|
|
50
|
+
/** `ProviderCapability` */
|
|
51
|
+
providerCapability: string;
|
|
52
|
+
/** `ProviderPredictionRequest` */
|
|
53
|
+
providerRequest: unknown;
|
|
54
|
+
/** `GenerationRequest` */
|
|
55
|
+
generationRequest: unknown;
|
|
56
|
+
/** `GenerationResult` */
|
|
57
|
+
generationResult: unknown;
|
|
58
|
+
/** `EncodedAudioResult` */
|
|
59
|
+
encodedAudio: unknown;
|
|
60
|
+
/** `EndpointProgress` */
|
|
61
|
+
endpointProgress: unknown;
|
|
62
|
+
/** `EndpointCallResult` */
|
|
63
|
+
endpointResult: unknown;
|
|
64
|
+
/** `InjectedTool` */
|
|
65
|
+
injectedTool: unknown;
|
|
66
|
+
/** `SandboxModuleCatalog` */
|
|
67
|
+
sandboxModuleCatalog: unknown;
|
|
68
|
+
/** `NodeExecutor` from `@nodetool-ai/execution-core` */
|
|
69
|
+
nodeExecutor: unknown;
|
|
70
|
+
/** `NodeContextCopyOptions` plus the run-trace and generation hooks */
|
|
71
|
+
copyOptions: NodeContextCopyOptions;
|
|
72
|
+
}
|
|
73
|
+
/** The variable channel `getChannel` returns (`VariableChannel` in runtime). */
|
|
74
|
+
export interface NodeChannel<T = unknown> {
|
|
75
|
+
readonly closed: boolean;
|
|
76
|
+
readonly hasValue: boolean;
|
|
77
|
+
send(value: T): void;
|
|
78
|
+
close(): void;
|
|
79
|
+
first(): Promise<T | undefined>;
|
|
80
|
+
stream(): AsyncGenerator<T>;
|
|
81
|
+
}
|
|
82
|
+
/** The `copy` options that need no runtime types. */
|
|
83
|
+
export interface NodeContextCopyOptions {
|
|
84
|
+
shareMemory?: boolean;
|
|
85
|
+
inheritMessageListeners?: boolean;
|
|
86
|
+
jobId?: string;
|
|
87
|
+
workflowId?: string | null;
|
|
88
|
+
workspace?: Workspace | null;
|
|
89
|
+
}
|
|
90
|
+
/** The node a subgraph runner asks an executor for. */
|
|
91
|
+
export interface NodeContextExecutorRequest {
|
|
92
|
+
id: string;
|
|
93
|
+
type: string;
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}
|
|
96
|
+
/** Type information a subgraph runner resolves for a node type. */
|
|
97
|
+
export interface NodeContextResolvedType {
|
|
98
|
+
nodeType: string;
|
|
99
|
+
propertyTypes?: Record<string, string>;
|
|
100
|
+
outputs?: Record<string, string>;
|
|
101
|
+
supportsDynamicInputs?: boolean;
|
|
102
|
+
descriptorDefaults?: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
/** Identity and lifetime of the run. */
|
|
105
|
+
export interface NodeContextRun<Types extends NodeContextTypes> {
|
|
106
|
+
readonly jobId: string;
|
|
107
|
+
readonly workflowId: string | null;
|
|
108
|
+
signal: AbortSignal;
|
|
109
|
+
triggerEvent: {
|
|
110
|
+
node_id: string;
|
|
111
|
+
payload: unknown;
|
|
112
|
+
input_id: string;
|
|
113
|
+
} | null;
|
|
114
|
+
readonly persistOutputAssets: boolean;
|
|
115
|
+
readonly sandboxModuleCatalog: Types["sandboxModuleCatalog"] | null;
|
|
116
|
+
}
|
|
117
|
+
/** Secrets and user settings. */
|
|
118
|
+
export interface NodeContextSecrets {
|
|
119
|
+
readonly getSecret: (key: string) => Promise<string | null>;
|
|
120
|
+
readonly getSetting: (key: string) => Promise<string | null>;
|
|
121
|
+
readonly getResolvedSecretValues: () => ReadonlySet<string>;
|
|
122
|
+
}
|
|
123
|
+
/** Run variables and the variable channels between nodes. */
|
|
124
|
+
export interface NodeContextVariables {
|
|
125
|
+
readonly get: <T = unknown>(key: string, defaultValue?: T) => T;
|
|
126
|
+
readonly set: (key: string, value: unknown) => void;
|
|
127
|
+
readonly getChannel: <T = unknown>(name: string) => NodeChannel<T>;
|
|
128
|
+
readonly registerChannelWriters: (name: string, count: number) => void;
|
|
129
|
+
readonly markChannelWriterDone: (name: string) => void;
|
|
130
|
+
readonly closeAllChannels: () => void;
|
|
131
|
+
readonly hasChannelWriters: (name: string) => boolean;
|
|
132
|
+
}
|
|
133
|
+
/** Processing messages and cost accounting. */
|
|
134
|
+
export interface NodeContextMessages {
|
|
135
|
+
readonly emit: (msg: ProcessingMessage) => void;
|
|
136
|
+
readonly postMessage: (msg: ProcessingMessage) => void;
|
|
137
|
+
readonly addMessageListener: (listener: (msg: ProcessingMessage) => void) => () => void;
|
|
138
|
+
readonly clearMessages: () => void;
|
|
139
|
+
readonly setProviderCost: (provider: string, amount: number, unit: string, details?: Pick<ProviderCost, "model" | "billing_unit" | "quantity" | "unit_price" | "currency" | "provider_request_id" | "input_tokens" | "output_tokens" | "cached_tokens">) => void;
|
|
140
|
+
readonly getProviderCost: () => ProviderCost | null;
|
|
141
|
+
readonly clearProviderCost: () => void;
|
|
142
|
+
readonly addToTotalCost: (cost: number) => void;
|
|
143
|
+
readonly getTotalCost: () => number;
|
|
144
|
+
}
|
|
145
|
+
/** Temp storage, the workspace, assets and output materialization. */
|
|
146
|
+
export interface NodeContextAssets {
|
|
147
|
+
readonly storage: StorageAdapter | null;
|
|
148
|
+
readonly workspace: Workspace | null;
|
|
149
|
+
readonly workspaceDir: string | null;
|
|
150
|
+
readonly createAsset: (args: Omit<ModelInterfaceArgs<"createAsset">, "workflowId" | "jobId" | "content"> & {
|
|
151
|
+
content?: Uint8Array | null;
|
|
152
|
+
/** Legacy name for `content`; used when `content` is absent. */
|
|
153
|
+
instructions?: Uint8Array | null;
|
|
154
|
+
}) => Promise<unknown>;
|
|
155
|
+
readonly resolveAssetBytes: (assetId: string, options?: {
|
|
156
|
+
requireOwnedAsset?: boolean;
|
|
157
|
+
}) => Promise<{
|
|
158
|
+
bytes: Uint8Array | null;
|
|
159
|
+
attempts: string[];
|
|
160
|
+
}>;
|
|
161
|
+
readonly getAssetInfo: (assetId: string) => Promise<AssetInfoEntry | null>;
|
|
162
|
+
readonly listFolderAssets: (folderId: string) => Promise<FolderAssetEntry[] | null>;
|
|
163
|
+
readonly localPath: (uri: string) => Promise<string | null>;
|
|
164
|
+
readonly normalizeOutputValue: (value: unknown, mode?: AssetOutputMode) => Promise<unknown>;
|
|
165
|
+
}
|
|
166
|
+
/** Persisted documents through the host's model interfaces. */
|
|
167
|
+
export interface NodeContextDocuments {
|
|
168
|
+
readonly hasModelInterface: (name: keyof ProcessingContextModelInterfaces) => boolean;
|
|
169
|
+
readonly createMessage: (req: MessageCreateRequestLike) => Promise<PersistedRecordLike>;
|
|
170
|
+
readonly getThreadMessages: (threadId: string, limit?: number, startKey?: string | null, reverse?: boolean) => Promise<ThreadMessagesResultLike>;
|
|
171
|
+
readonly getImageDocument: (id: string) => Promise<PersistedRecordLike | null>;
|
|
172
|
+
readonly createImageDocument: (args: ModelInterfaceArgs<"createImageDocument">) => Promise<PersistedRecordLike>;
|
|
173
|
+
readonly getTimelineSequence: (id: string) => Promise<PersistedRecordLike | null>;
|
|
174
|
+
readonly createTimelineSequence: (sequence: unknown) => Promise<PersistedRecordLike>;
|
|
175
|
+
readonly updateTimelineSequence: (id: string, sequence: unknown) => Promise<PersistedRecordLike | null>;
|
|
176
|
+
readonly getScript: (id: string) => Promise<PersistedRecordLike | null>;
|
|
177
|
+
readonly createScript: (args: ModelInterfaceArgs<"createScript">) => Promise<PersistedRecordLike>;
|
|
178
|
+
readonly updateScript: (id: string, args: Omit<ModelInterfaceArgs<"updateScript">, "id">) => Promise<PersistedRecordLike | null>;
|
|
179
|
+
readonly getStoryboard: (id: string) => Promise<PersistedRecordLike | null>;
|
|
180
|
+
readonly listStoryboards: (args?: ModelInterfaceArgs<"listStoryboards">) => Promise<PersistedRecordLike[]>;
|
|
181
|
+
readonly findRecastStoryboard: (args: ModelInterfaceArgs<"findRecastStoryboard">) => Promise<PersistedRecordLike | null>;
|
|
182
|
+
readonly createStoryboard: (args: ModelInterfaceArgs<"createStoryboard">) => Promise<PersistedRecordLike>;
|
|
183
|
+
readonly updateStoryboard: (id: string, args: Omit<ModelInterfaceArgs<"updateStoryboard">, "id">) => Promise<PersistedRecordLike | null>;
|
|
184
|
+
readonly listEntities: (args?: ModelInterfaceArgs<"listEntities">) => Promise<Entity[]>;
|
|
185
|
+
readonly getEntity: (id: string) => Promise<Entity | null>;
|
|
186
|
+
readonly upsertEntity: (args: ModelInterfaceArgs<"upsertEntity">) => Promise<EntityUpsertResult>;
|
|
187
|
+
}
|
|
188
|
+
/** Providers, generations and provider endpoints. */
|
|
189
|
+
export interface NodeContextProviders<Types extends NodeContextTypes> {
|
|
190
|
+
readonly getProvider: (providerId: string) => Promise<Types["provider"]>;
|
|
191
|
+
readonly runProviderPrediction: (req: Types["providerRequest"]) => Promise<unknown>;
|
|
192
|
+
readonly runGeneration: (req: Types["generationRequest"]) => Promise<Types["generationResult"]>;
|
|
193
|
+
readonly streamProviderPrediction: (req: Types["generationRequest"]) => AsyncGenerator<unknown>;
|
|
194
|
+
readonly callProviderEndpoint: (args: {
|
|
195
|
+
provider: string;
|
|
196
|
+
capability: Types["providerCapability"];
|
|
197
|
+
model: string;
|
|
198
|
+
input: Record<string, unknown>;
|
|
199
|
+
route?: string;
|
|
200
|
+
nodeId?: string;
|
|
201
|
+
onProgress?: (event: Types["endpointProgress"]) => void;
|
|
202
|
+
signal?: AbortSignal;
|
|
203
|
+
}) => Promise<Types["endpointResult"]>;
|
|
204
|
+
readonly uploadProviderMedia: (args: {
|
|
205
|
+
provider: string;
|
|
206
|
+
bytes: Uint8Array;
|
|
207
|
+
mimeType: string;
|
|
208
|
+
filename?: string;
|
|
209
|
+
signal?: AbortSignal;
|
|
210
|
+
}) => Promise<string>;
|
|
211
|
+
readonly downloadProviderMedia: (args: {
|
|
212
|
+
provider: string;
|
|
213
|
+
url: string;
|
|
214
|
+
signal?: AbortSignal;
|
|
215
|
+
}) => Promise<Uint8Array>;
|
|
216
|
+
readonly providerSupportsStreamingTTS: (providerId: string) => Promise<boolean>;
|
|
217
|
+
readonly textToSpeechEncoded: (req: Types["generationRequest"]) => Promise<Types["encodedAudio"] | null>;
|
|
218
|
+
readonly textToMusic: (req: Types["generationRequest"]) => Promise<Types["encodedAudio"]>;
|
|
219
|
+
readonly audioToAudio: (req: Types["generationRequest"]) => Promise<Types["encodedAudio"]>;
|
|
220
|
+
readonly resolveMessageMediaUris: (messages: Types["message"][]) => Promise<Types["message"][]>;
|
|
221
|
+
}
|
|
222
|
+
/** Tools and control events for agent nodes. */
|
|
223
|
+
export interface NodeContextAgents<Types extends NodeContextTypes> {
|
|
224
|
+
readonly getInjectedTool: (name: string) => Types["injectedTool"] | null;
|
|
225
|
+
readonly hasControlEventSupport: boolean;
|
|
226
|
+
readonly sendControlEvent: (targetNodeId: string, properties: Record<string, unknown>) => Promise<Record<string, unknown> | null>;
|
|
227
|
+
readonly setSendControlEvent: (fn: (targetNodeId: string, properties: Record<string, unknown>) => Promise<Record<string, unknown>>) => void;
|
|
228
|
+
}
|
|
229
|
+
/** What a node that runs an inner graph needs to drive a nested runner. */
|
|
230
|
+
export interface NodeContextSubgraph<Types extends NodeContextTypes> {
|
|
231
|
+
readonly copy: (opts?: Types["copyOptions"]) => NodeContext<Types>;
|
|
232
|
+
readonly resolveExecutor: ((node: NodeContextExecutorRequest) => Types["nodeExecutor"]) | null;
|
|
233
|
+
readonly setResolveExecutor: (fn: (node: NodeContextExecutorRequest) => Types["nodeExecutor"]) => void;
|
|
234
|
+
readonly resolveNodeType: ((nodeType: string) => Promise<NodeContextResolvedType | null>) | null;
|
|
235
|
+
readonly setResolveNodeType: (fn: (nodeType: string) => Promise<NodeContextResolvedType | null>) => void;
|
|
236
|
+
}
|
|
237
|
+
/** Every context member node code may use, grouped by concern. */
|
|
238
|
+
export interface NodeContext<Types extends NodeContextTypes = NodeContextTypes> extends NodeContextRun<Types>, NodeContextSecrets, NodeContextVariables, NodeContextMessages, NodeContextAssets, NodeContextDocuments, NodeContextProviders<Types>, NodeContextAgents<Types>, NodeContextSubgraph<Types> {
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=node-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-context.d.ts","sourceRoot":"","sources":["../src/node-context.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,YAAY,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,gCAAgC,EAChC,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,UAAU,GACV,UAAU,GACV,aAAa,GACb,WAAW,GACX,KAAK,CAAC;AAEV;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB;IACrB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,2BAA2B;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kCAAkC;IAClC,eAAe,EAAE,OAAO,CAAC;IACzB,0BAA0B;IAC1B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,yBAAyB;IACzB,gBAAgB,EAAE,OAAO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KAAK,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-context.js","sourceRoot":"","sources":["../src/node-context.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodetool-ai/runtime-core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.13",
|
|
4
4
|
"description": "Lean execution contracts, workspace interface, egress policy and remote text adapter",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "node ../../scripts/build-typescript-workspace.mjs",
|
|
13
13
|
"test": "node ../../scripts/run-vitest.mjs run",
|
|
14
|
-
"lint": "node ../../scripts/run-tsc.mjs --noEmit"
|
|
14
|
+
"lint": "node ../../scripts/run-tsc.mjs --noEmit",
|
|
15
|
+
"check:node-context": "node scripts/node-context-members.mjs --check && node scripts/node-context-usage.mjs --check"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"openai": "^6.35.0",
|
|
18
|
-
"@nodetool-ai/config": "0.8.
|
|
19
|
-
"@nodetool-ai/
|
|
19
|
+
"@nodetool-ai/config": "0.8.13",
|
|
20
|
+
"@nodetool-ai/protocol": "0.8.13",
|
|
21
|
+
"@nodetool-ai/storage": "0.8.13",
|
|
20
22
|
"@opentelemetry/api": "~1.9.0"
|
|
21
23
|
},
|
|
22
24
|
"devDependencies": {
|
|
@@ -34,6 +36,11 @@
|
|
|
34
36
|
"nodetool-dev": "./src/safe-url.ts",
|
|
35
37
|
"types": "./dist/safe-url.d.ts",
|
|
36
38
|
"import": "./dist/safe-url.js"
|
|
39
|
+
},
|
|
40
|
+
"./cost-ledger": {
|
|
41
|
+
"nodetool-dev": "./src/cost-ledger.ts",
|
|
42
|
+
"types": "./dist/cost-ledger.d.ts",
|
|
43
|
+
"import": "./dist/cost-ledger.js"
|
|
37
44
|
}
|
|
38
45
|
},
|
|
39
46
|
"license": "MIT",
|