@nodetool-ai/runtime-core 0.8.11 → 0.8.14

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.
@@ -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,CAAC;IAC1B,2BAA2B;IAC3B,YAAY,EAAE,OAAO,CAAC;IACtB,yBAAyB;IACzB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,2BAA2B;IAC3B,cAAc,EAAE,OAAO,CAAC;IACxB,qBAAqB;IACrB,YAAY,EAAE,OAAO,CAAC;I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C,MAAM,EAAE,OAAO,CAAC,CAAC,KAClC,IAAI,CAAC;CACX;AAED,2EAA2E;AAC3E,MAAM,WAAW,mBAAmB,CAAC,KAAK,SAAS,gBAAgB;IACjE,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,WAAW,CAAC,KAAK,CAAC,CAAC;IACnE,QAAQ,CAAC,eAAe,EACpB,CAAC,CAAC,IAAI,EAAE,0BAA0B,KAAK,KAAK,CAAC,cAAc,CAAC,CAAC,GAC7D,IAAI,CAAC;IACT,QAAQ,CAAC,kBAAkB,EAAE,CAC3B,EAAE,EAAE,CAAC,IAAI,EAAE,0BAA0B,KAAK,KAAK,CAAC,cAAc,CAAC,KAC5D,IAAI,CAAC;IACV,QAAQ,CAAC,eAAe,EACpB,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC,GAC/D,IAAI,CAAC;IACT,QAAQ,CAAC,kBAAkB,EAAE,CAC3B,EAAE,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,KAC9D,IAAI,CAAC;CACX;AAED,kEAAkE;AAClE,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,gBAAgB,GAAG,gBAAgB,CAC5E,SAAQ,cAAc,CAAC,KAAK,CAAC,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,CAAC,KAAK,CAAC,EAC3B,iBAAiB,CAAC,KAAK,CAAC,EACxB,mBAAmB,CAAC,KAAK,CAAC;CAAG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=node-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node-context.js","sourceRoot":"","sources":["../src/node-context.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { type StorageAdapter, type StorageListResult, type StorageStat } from "@nodetool-ai/storage";
1
+ import { type StorageAdapter, type StorageListResult, type StorageStat, type StoreIfAbsentOptions } from "@nodetool-ai/storage";
2
2
  /**
3
3
  * A `StorageAdapter` that carves a key prefix out of another one.
4
4
  *
@@ -20,6 +20,11 @@ export declare class PrefixedStorageAdapter implements StorageAdapter {
20
20
  /** Strip the prefix from a key the inner adapter reported. */
21
21
  private unscope;
22
22
  store(key: string, data: Uint8Array, contentType?: string): Promise<string>;
23
+ /**
24
+ * Exclusive create under the prefix. Null when the key is taken, and also
25
+ * the inner adapter's own answer when it has no such operation.
26
+ */
27
+ storeIfAbsent(key: string, data: Uint8Array, contentType?: string, options?: StoreIfAbsentOptions): Promise<string | null>;
23
28
  retrieve(uri: string): Promise<Uint8Array | null>;
24
29
  exists(uri: string): Promise<boolean>;
25
30
  uriForKey(key: string): string;
@@ -1 +1 @@
1
- {"version":3,"file":"prefixed-storage-adapter.d.ts","sourceRoot":"","sources":["../src/prefixed-storage-adapter.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,qBAAa,sBAAuB,YAAW,cAAc;IAKzD,OAAO,CAAC,QAAQ,CAAC,KAAK;IAJxB,gDAAgD;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YACmB,KAAK,EAAE,cAAc,EACtC,MAAM,EAAE,MAAM,EAGf;IAED,OAAO,CAAC,KAAK;IAIb,8DAA8D;IAC9D,OAAO,CAAC,OAAO;IAKf,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1E;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAEhD;IAED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EAAE,oBAAoB,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAYxB;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAEhD;IAED,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpC;IAED,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7B;IAEK,IAAI,CACR,MAAM,EAAE,MAAM,EACd,IAAI,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GAChC,OAAO,CAAC,iBAAiB,CAAC,CAe5B;IAED,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpC;IAEK,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAKnD;IAED,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAE7C;CACF"}
@@ -30,6 +30,16 @@ export class PrefixedStorageAdapter {
30
30
  store(key, data, contentType) {
31
31
  return this.inner.store(this.scope(key), data, contentType);
32
32
  }
33
+ /**
34
+ * Exclusive create under the prefix. Null when the key is taken, and also
35
+ * the inner adapter's own answer when it has no such operation.
36
+ */
37
+ storeIfAbsent(key, data, contentType, options) {
38
+ if (!this.inner.storeIfAbsent) {
39
+ return Promise.reject(new Error("The storage behind this prefix has no exclusive create"));
40
+ }
41
+ return this.inner.storeIfAbsent(this.scope(key), data, contentType, options);
42
+ }
33
43
  retrieve(uri) {
34
44
  return this.inner.retrieve(uri);
35
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prefixed-storage-adapter.js","sourceRoot":"","sources":["../src/prefixed-storage-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAOxE;;;;;;;;;;;GAWG;AACH,MAAM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,EAAE,CAClD,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CACjD;SACF,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,GAAW;QACpB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QACrB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnC,CAAC;IAED,SAAS,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -6,30 +6,161 @@
6
6
  * two deployments on the same code path instead of on two that drift.
7
7
  */
8
8
  import type { StorageAdapter } from "@nodetool-ai/storage";
9
- import { type Workspace, type WorkspaceEntry, type WorkspaceStat } from "./workspace.js";
9
+ import { type Workspace, type WorkspaceEntry, type WorkspaceStat, type WriteNewOptions } from "./workspace.js";
10
+ /**
11
+ * Where `target` sits in `root` as written, before any link is resolved: a
12
+ * key, "" for the root itself, null when it is outside. Windows spellings of
13
+ * a drive path are read as the drive path. Exported for its tests, which pass
14
+ * `path.win32` on a POSIX host.
15
+ */
16
+ export declare function lexicalKeyWithin(root: string, target: string, path: Pick<typeof import("node:path"), "sep" | "resolve" | "relative" | "isAbsolute">, hostname: string): string | null;
17
+ /**
18
+ * How long a workspace keeps what it learned about a directory being another
19
+ * folder, in ms. Long enough that a run or a scan asks once per directory,
20
+ * short enough that a workspace held for a long time, such as the one of a
21
+ * chat thread, soon sees a project folder created inside it.
22
+ */
23
+ export declare const NESTED_FOLDER_MEMORY_MS = 10000;
24
+ /** What {@link assertLocalPathIsOwn} is asked about. */
25
+ export interface LocalPathUse {
26
+ /**
27
+ * The path will be created or written. Inside the folder, a link that
28
+ * leads out of it, or that the check cannot follow, is then refused as
29
+ * well: a link planted in a copied folder must not send a write to
30
+ * `~/.bashrc`. A read through such a link is the caller's choice.
31
+ */
32
+ write?: boolean;
33
+ }
34
+ /**
35
+ * Refuse the real path `target` when it is the folder of another project
36
+ * inside `workspace`, or lies in one, or is in the reserved directory. `root`
37
+ * is the real directory the workspace's keys are relative to: its folder, or
38
+ * the scratch directory its files are staged in. `shown` is the path the
39
+ * refusal names.
40
+ *
41
+ * For code that opens a real path itself instead of calling the workspace: a
42
+ * host binary, libav, `node:fs`. The rule is the workspace's own, asked
43
+ * through {@link NestedFolders}, so a folder known by its `.nodetool/`
44
+ * directory and one the host names are refused alike. A path elsewhere on
45
+ * the host passes: whether it may be opened at all is the caller's check.
46
+ *
47
+ * `target` must be the exact path that will be opened. A caller that reads
48
+ * its input more than one way (`workspace/x`, `x`, `C:/x`) resolves it once
49
+ * and hands that one result both here and to whatever opens it. The path is
50
+ * judged as written and as it really is, so another spelling of a path in
51
+ * the folder is refused as well: a link inside or outside the folder,
52
+ * `/proc/self/root/...`, a dangling link a create would follow, a macOS
53
+ * firmlink, or a Windows long path or administrative share.
54
+ *
55
+ * The check runs before the path is opened, so a link swapped in afterwards
56
+ * is not seen. A writer that must close that gap opens without following a
57
+ * link and checks the file it opened, as the save nodes do.
58
+ */
59
+ export declare function assertLocalPathIsOwn(workspace: Pick<Workspace, "isNestedFolder">, root: string, target: string, shown?: string, use?: LocalPathUse): Promise<void>;
60
+ /**
61
+ * Whether the real path `root`/`key` is, or lies in, a directory that holds
62
+ * a reserved directory: the folder of another project inside the workspace
63
+ * rooted at `root`. The root itself never counts.
64
+ *
65
+ * A floor under {@link assertLocalPathIsOwn} for a path that is resolved
66
+ * synchronously, or by a run that has a directory and no workspace. It reads
67
+ * the mark on disk only. A folder the host names without that mark, such as
68
+ * a game's workspace, is known to the workspace alone, so whatever opens the
69
+ * resolved path calls {@link assertLocalPathIsOwn} as well.
70
+ */
71
+ export declare function localPathIsInNestedFolder(root: string, key: string): boolean;
72
+ /**
73
+ * The directories of a workspace that the host records as folders of their
74
+ * own, as workspace keys. See {@link Workspace.isNestedFolder}.
75
+ */
76
+ export type NestedFolderSource = () => Iterable<string> | Promise<Iterable<string>>;
77
+ export interface StorageWorkspaceOptions {
78
+ localDir?: string | null;
79
+ /**
80
+ * Called the first time the workspace is asked about a nested folder, and
81
+ * again once {@link NESTED_FOLDER_MEMORY_MS} has passed. A host passes the
82
+ * folders its database records inside this one, so that a folder with no
83
+ * {@link RESERVED_WORKSPACE_DIR} directory, such as a game's workspace, is
84
+ * still known as another folder. The root is never one of them.
85
+ */
86
+ nestedFolders?: NestedFolderSource;
87
+ }
10
88
  export declare class StorageWorkspace implements Workspace {
11
89
  readonly storage: StorageAdapter;
12
90
  readonly localDir: string | null;
13
91
  private scratch;
14
- constructor(storage: StorageAdapter, opts?: {
15
- localDir?: string | null;
16
- });
92
+ private readonly nestedFolderSource;
93
+ private declaredNestedFolders;
94
+ /** Per directory key: whether it holds a reserved directory. */
95
+ private readonly reservedMarks;
96
+ /**
97
+ * The one rule for the folders of other projects in this workspace. It
98
+ * asks by key, where {@link isNestedFolder} takes a caller's path.
99
+ */
100
+ private readonly nested;
101
+ constructor(storage: StorageAdapter, opts?: StorageWorkspaceOptions);
102
+ /** The nested folders the host named, as lower-cased workspace keys. */
103
+ private declaredNested;
104
+ /**
105
+ * Whether the directory at `key` holds a reserved directory, remembered
106
+ * for {@link NESTED_FOLDER_MEMORY_MS}.
107
+ */
108
+ private hasReservedDirectory;
109
+ private readReservedDirectory;
110
+ /**
111
+ * On an object store a flat listing names every key below `under`, the
112
+ * reserved ones among them. It therefore says which directories there
113
+ * hold a reserved directory, and none of them is asked about again.
114
+ */
115
+ private rememberReservedMarks;
116
+ isNestedFolder(path: string): Promise<boolean>;
117
+ /**
118
+ * {@link isNestedFolder} for a normalized key. The root is never one.
119
+ *
120
+ * When the host cannot name its folders, or the storage cannot be asked,
121
+ * the answer is unknown and could be yes. That is a
122
+ * {@link WorkspaceFolderCheckError}, never "no".
123
+ */
124
+ private isNestedKey;
125
+ /**
126
+ * The entries of a flat listing below the key `under` that are this
127
+ * folder's own: in no reserved directory and in no nested folder.
128
+ */
129
+ private ownEntries;
130
+ /**
131
+ * Whether the real directory at `key` holds a reserved directory or a
132
+ * nested folder at any depth. Symbolic links are not followed.
133
+ */
134
+ private holdsOtherFolder;
135
+ /**
136
+ * Remove the real directory at `key` with everything in it but the
137
+ * reserved directories and the nested folders. A directory on the way to
138
+ * one stays, emptied of the rest. Returns whether the directory at `key`
139
+ * itself was removed.
140
+ */
141
+ private removeOwnDirectory;
17
142
  private rootReady;
18
143
  /** Create the workspace directory once, on first use. */
19
144
  private ensureRoot;
20
145
  key(path: string): string;
21
146
  /**
22
- * Refuse a path whose real location leaves the workspace.
147
+ * Refuse a path this workspace does not reach: one whose real location
148
+ * leaves the workspace, and one in the folder of another project inside it.
23
149
  *
24
- * Called on every operation that touches a local workspace. `key()` already
25
- * refuses a `..` that climbs out lexically; this is the half a symlink
26
- * defeats.
150
+ * Called on every operation. `key()` refuses a `..` that climbs out
151
+ * lexically and the reserved directory. A symlink defeats that, which only
152
+ * a local workspace has. A path in a nested folder is refused on every
153
+ * backend: its files belong to the other project.
154
+ *
155
+ * `asDirectory` is set by the operations that take a directory. They also
156
+ * refuse the nested folder itself, which a path to a file cannot be.
27
157
  */
28
158
  private assertContained;
29
159
  uri(path: string): string;
30
160
  read(path: string): Promise<Uint8Array | null>;
31
161
  readText(path: string): Promise<string | null>;
32
162
  write(path: string, data: Uint8Array | string, contentType?: string): Promise<void>;
163
+ writeNew(path: string, data: Uint8Array | string, contentType?: string, options?: WriteNewOptions): Promise<boolean>;
33
164
  exists(path: string): Promise<boolean>;
34
165
  stat(path: string): Promise<WorkspaceStat | null>;
35
166
  list(path?: string, opts?: {
@@ -40,11 +171,23 @@ export declare class StorageWorkspace implements Workspace {
40
171
  deleteAll(path: string): Promise<number>;
41
172
  mkdir(path: string): Promise<void>;
42
173
  copy(from: string, to: string): Promise<void>;
174
+ /**
175
+ * Move a file, or a directory with everything under it. A directory is
176
+ * never moved into itself or onto anything that exists, except onto a name
177
+ * that differs from its own only in case. A local directory is renamed in
178
+ * one step, so the files keep their bytes and modification times. On an
179
+ * object store each file is copied to its new key, then removed.
180
+ *
181
+ * A directory that holds a reserved directory or a nested folder at any
182
+ * depth is refused before anything moves, and so is a target in a nested
183
+ * folder.
184
+ */
43
185
  move(from: string, to: string): Promise<void>;
44
186
  materialize(path: string): Promise<string>;
45
187
  private stage;
46
188
  absorb(localPath: string, path: string): Promise<void>;
47
189
  private absorbFile;
190
+ absorbNew(localPath: string, path: string, contentType?: string): Promise<boolean>;
48
191
  scratchDir(): Promise<string>;
49
192
  cleanupScratch(): Promise<void>;
50
193
  }
@@ -56,7 +199,10 @@ export declare class StorageWorkspace implements Workspace {
56
199
  */
57
200
  export declare function createWorkspace(storage: StorageAdapter, opts?: {
58
201
  prefix?: string | null;
202
+ nestedFolders?: NestedFolderSource;
59
203
  }): Workspace;
60
204
  /** A workspace over a real directory. */
61
- export declare function createLocalWorkspace(dir: string): Workspace;
205
+ export declare function createLocalWorkspace(dir: string, opts?: {
206
+ nestedFolders?: NestedFolderSource;
207
+ }): Workspace;
62
208
  //# sourceMappingURL=storage-workspace.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage-workspace.d.ts","sourceRoot":"","sources":["../src/storage-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO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