@langchain/quickjs 0.3.0 → 0.5.0
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/index.cjs +583 -393
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -97
- package/dist/index.d.ts +79 -97
- package/dist/index.js +581 -387
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import * as _$langchain from "langchain";
|
|
2
1
|
import { AgentMiddleware } from "langchain";
|
|
3
2
|
import { z } from "zod/v4";
|
|
4
3
|
import { StructuredToolInterface } from "@langchain/core/tools";
|
|
5
|
-
import { AnyBackendProtocol, BackendFactory, SkillMetadata } from "deepagents";
|
|
6
4
|
|
|
7
5
|
//#region src/types.d.ts
|
|
8
6
|
/**
|
|
9
|
-
* Configuration options for the
|
|
7
|
+
* Configuration options for the Code Interpreter middleware.
|
|
10
8
|
*/
|
|
11
|
-
interface
|
|
9
|
+
interface CodeInterpreterMiddlewareOptions {
|
|
12
10
|
/**
|
|
13
11
|
* Enable programmatic tool calling from within the REPL.
|
|
14
12
|
*
|
|
@@ -39,11 +37,6 @@ interface REPLMiddlewareOptions {
|
|
|
39
37
|
* @default null (uses built-in prompt)
|
|
40
38
|
*/
|
|
41
39
|
systemPrompt?: string | null;
|
|
42
|
-
/**
|
|
43
|
-
* Backend the REPL reads skill module sources from. When provided alongside
|
|
44
|
-
* `SkillsMiddleware`, skills with a `module:` key become dynamic-importable.
|
|
45
|
-
*/
|
|
46
|
-
skillsBackend?: AnyBackendProtocol | BackendFactory;
|
|
47
40
|
/**
|
|
48
41
|
* Maximum number of `tools.*` bridge calls allowed per `eval()` invocation.
|
|
49
42
|
*
|
|
@@ -78,6 +71,43 @@ interface REPLMiddlewareOptions {
|
|
|
78
71
|
* @default true
|
|
79
72
|
*/
|
|
80
73
|
captureConsole?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Expose the built-in `task()` global for subagent orchestration.
|
|
76
|
+
*
|
|
77
|
+
* When `true` (default) and subagent specs are available, a `task()`
|
|
78
|
+
* global is installed in the REPL that dispatches subagents
|
|
79
|
+
* programmatically with a fixed concurrency cap of 32.
|
|
80
|
+
* Set to `false` to require subagent dispatch through the normal
|
|
81
|
+
* `task` tool path.
|
|
82
|
+
*
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
subagents?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Configuration for the built-in subagent primitive.
|
|
89
|
+
*
|
|
90
|
+
* When provided to a ReplSession, a frozen `subagent()` global is
|
|
91
|
+
* installed in the QuickJS context. Calls are gated by a concurrency
|
|
92
|
+
* queue and forwarded to the dispatch callback.
|
|
93
|
+
*/
|
|
94
|
+
interface SubagentBridgeOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Callback that invokes a subagent. Receives validated input from
|
|
97
|
+
* the QuickJS guest and returns the subagent's output — a string
|
|
98
|
+
* for text responses or an object for structured (responseSchema)
|
|
99
|
+
* responses.
|
|
100
|
+
*/
|
|
101
|
+
dispatch: (input: {
|
|
102
|
+
description: string;
|
|
103
|
+
subagentType: string;
|
|
104
|
+
responseSchema?: Record<string, unknown>;
|
|
105
|
+
}) => Promise<unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* Maximum number of concurrent subagent calls within a single eval.
|
|
108
|
+
* Excess calls queue and resolve as permits free up.
|
|
109
|
+
*/
|
|
110
|
+
maxConcurrency: number;
|
|
81
111
|
}
|
|
82
112
|
/**
|
|
83
113
|
* Options for creating a ReplSession.
|
|
@@ -86,10 +116,11 @@ interface ReplSessionOptions {
|
|
|
86
116
|
memoryLimitBytes?: number;
|
|
87
117
|
maxStackSizeBytes?: number;
|
|
88
118
|
tools?: StructuredToolInterface[];
|
|
89
|
-
skillsEnabled?: boolean;
|
|
90
119
|
maxPtcCalls?: number | null;
|
|
91
120
|
maxResultChars?: number;
|
|
92
121
|
captureConsole?: boolean;
|
|
122
|
+
sessionId?: string;
|
|
123
|
+
subagentBridge?: SubagentBridgeOptions;
|
|
93
124
|
}
|
|
94
125
|
/**
|
|
95
126
|
* Result of a single REPL evaluation.
|
|
@@ -105,31 +136,18 @@ interface ReplResult {
|
|
|
105
136
|
logs: string[];
|
|
106
137
|
logsDroppedChars: number;
|
|
107
138
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Metadata + backend pair the session needs to resolve skill imports.
|
|
110
|
-
*/
|
|
111
|
-
interface SkillsContext {
|
|
112
|
-
/**
|
|
113
|
-
* Per-eval snapshot of `state.skillsMetadata`.
|
|
114
|
-
*/
|
|
115
|
-
metadata: SkillMetadata[];
|
|
116
|
-
/**
|
|
117
|
-
* Backend the session fetches skill source files from.
|
|
118
|
-
*/
|
|
119
|
-
backend: AnyBackendProtocol;
|
|
120
|
-
}
|
|
121
139
|
//#endregion
|
|
122
140
|
//#region src/middleware.d.ts
|
|
123
141
|
/**
|
|
124
|
-
* Create the
|
|
142
|
+
* Create the Code Interpreter middleware.
|
|
125
143
|
*/
|
|
126
|
-
declare function
|
|
144
|
+
declare function createCodeInterpreterMiddleware(options?: CodeInterpreterMiddlewareOptions): AgentMiddleware<undefined, undefined, unknown, readonly [import("langchain").DynamicStructuredTool<z.ZodObject<{
|
|
127
145
|
code: z.ZodString;
|
|
128
146
|
}, z.core.$strip>, {
|
|
129
147
|
code: string;
|
|
130
148
|
}, {
|
|
131
149
|
code: string;
|
|
132
|
-
}, string, unknown, string>]>;
|
|
150
|
+
}, string, unknown, string>], readonly []>;
|
|
133
151
|
//#endregion
|
|
134
152
|
//#region src/errors.d.ts
|
|
135
153
|
/**
|
|
@@ -179,28 +197,22 @@ declare class ReplSession {
|
|
|
179
197
|
private context;
|
|
180
198
|
private consoleBuffer;
|
|
181
199
|
private options;
|
|
182
|
-
private skillsContext;
|
|
183
|
-
private skillsLoaded;
|
|
184
|
-
private skillsFailed;
|
|
185
200
|
private readonly maxPtcCalls;
|
|
186
201
|
private ptcCallsRemaining;
|
|
187
|
-
|
|
188
|
-
private
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
*/
|
|
192
|
-
private ensureSkillLoaded;
|
|
193
|
-
private resolveSpecifier;
|
|
202
|
+
private subagentQueue;
|
|
203
|
+
private bridgeDispatchRef;
|
|
204
|
+
/** Allowed keys in the subagent input object. */
|
|
205
|
+
private static readonly SUBAGENT_ALLOWED_KEYS;
|
|
194
206
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Wire the QuickJS module loader and normalizer on this session's runtime.
|
|
207
|
+
* Reset the shared WASM module. Forces the next session to instantiate
|
|
208
|
+
* a fresh module. Only needed in tests where module state must be
|
|
209
|
+
* isolated between test files.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
202
212
|
*/
|
|
203
|
-
|
|
213
|
+
static resetSharedModule(): void;
|
|
214
|
+
constructor(id: string, options?: ReplSessionOptions);
|
|
215
|
+
private ensureStarted;
|
|
204
216
|
/**
|
|
205
217
|
* Initialise the per-eval PTC counter. Called at the top of every `eval()`.
|
|
206
218
|
*/
|
|
@@ -232,12 +244,6 @@ declare class ReplSession {
|
|
|
232
244
|
* Dispose and remove the session with the given key, if it exists.
|
|
233
245
|
*/
|
|
234
246
|
static deleteSession(key: string): void;
|
|
235
|
-
/**
|
|
236
|
-
* Push the current skills metadata + backend into the session.
|
|
237
|
-
* Called by the middleware once per `eval` invocation, before eval runs.
|
|
238
|
-
* Pass `undefined` to clear the context (no skill imports will resolve).
|
|
239
|
-
*/
|
|
240
|
-
setSkillsContext(ctx?: SkillsContext): void;
|
|
241
247
|
/**
|
|
242
248
|
* Evaluate code in this session.
|
|
243
249
|
*
|
|
@@ -262,6 +268,23 @@ declare class ReplSession {
|
|
|
262
268
|
static clearCache(): void;
|
|
263
269
|
private setupConsole;
|
|
264
270
|
private injectTools;
|
|
271
|
+
/**
|
|
272
|
+
* Install the `task` global on the QuickJS context.
|
|
273
|
+
*
|
|
274
|
+
* Registers the host function directly as `globalThis.task`,
|
|
275
|
+
* then freezes it via `evalCode`. Structured results (when
|
|
276
|
+
* responseSchema is provided) are marshaled into native QuickJS
|
|
277
|
+
* objects on the host side — no JS wrapper needed.
|
|
278
|
+
*/
|
|
279
|
+
/**
|
|
280
|
+
* Replace the active bridge dispatch with a fresh one.
|
|
281
|
+
*
|
|
282
|
+
* Call this before each eval so the dispatch closure carries
|
|
283
|
+
* the current invocation's config (tracing callbacks, run ID, etc.)
|
|
284
|
+
* rather than the stale config from session creation.
|
|
285
|
+
*/
|
|
286
|
+
updateBridgeDispatch(dispatch: SubagentBridgeOptions["dispatch"]): void;
|
|
287
|
+
private injectSubagentBridge;
|
|
265
288
|
}
|
|
266
289
|
//#endregion
|
|
267
290
|
//#region src/utils.d.ts
|
|
@@ -273,10 +296,6 @@ declare function toCamelCase(name: string): string;
|
|
|
273
296
|
* Format the result of a REPL evaluation for the agent.
|
|
274
297
|
*/
|
|
275
298
|
declare function formatReplResult(result: ReplResult): string;
|
|
276
|
-
/**
|
|
277
|
-
* Render a pre-eval error when referenced skills are not available on the agent.
|
|
278
|
-
*/
|
|
279
|
-
declare function formatSkillNotAvailable(missing: readonly string[]): string;
|
|
280
299
|
//#endregion
|
|
281
300
|
//#region src/transform.d.ts
|
|
282
301
|
/**
|
|
@@ -310,51 +329,14 @@ declare function transformForEval(code: string): string;
|
|
|
310
329
|
*/
|
|
311
330
|
declare function stripTypeSyntax(code: string): string;
|
|
312
331
|
//#endregion
|
|
313
|
-
//#region src/
|
|
314
|
-
/**
|
|
315
|
-
* File extensions the loader will enumerate from a skill directory.
|
|
316
|
-
*/
|
|
317
|
-
declare const SKILL_MODULE_EXTENSIONS: string[];
|
|
318
|
-
/**
|
|
319
|
-
* Hard cap on total bytes pulled for one skill's bundle (1 MiB).
|
|
320
|
-
*/
|
|
321
|
-
declare const MAX_SKILL_BUNDLE_BYTES: number;
|
|
322
|
-
/**
|
|
323
|
-
* Install-ready state for a single skill, produced by `loadSkill`.
|
|
324
|
-
*/
|
|
325
|
-
interface LoadedSkill {
|
|
326
|
-
/**
|
|
327
|
-
* Spec-validated kebab-case skill name.
|
|
328
|
-
*/
|
|
329
|
-
name: string;
|
|
330
|
-
/**
|
|
331
|
-
* Bare specifier the skill installs under: `"@/skills/<name>"`.
|
|
332
|
-
*/
|
|
333
|
-
specifier: string;
|
|
334
|
-
/**
|
|
335
|
-
* Relative POSIX path of the entrypoint file (e.g. `"index.ts"`).
|
|
336
|
-
*/
|
|
337
|
-
entryRel: string;
|
|
338
|
-
/**
|
|
339
|
-
* File contents keyed by relative POSIX path, with TS syntax stripped.
|
|
340
|
-
*/
|
|
341
|
-
files: Map<string, string>;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Build a `LoadedSkill` from a skill's metadata and a backend handle.
|
|
345
|
-
*
|
|
346
|
-
* Enumerates code files under the skill directory, downloads them,
|
|
347
|
-
* strips TypeScript syntax, and validates the entrypoint is present.
|
|
348
|
-
*/
|
|
349
|
-
declare function loadSkill(metadata: SkillMetadata, backend: AnyBackendProtocol): Promise<LoadedSkill>;
|
|
332
|
+
//#region src/subagent-dispatch.d.ts
|
|
350
333
|
/**
|
|
351
|
-
*
|
|
334
|
+
* Validate that a response schema does not exceed size, depth, or
|
|
335
|
+
* property-count limits.
|
|
352
336
|
*
|
|
353
|
-
*
|
|
354
|
-
* before evaluation starts. Dynamic imports with computed specifiers are
|
|
355
|
-
* not detected.
|
|
337
|
+
* @throws Error if any limit is exceeded.
|
|
356
338
|
*/
|
|
357
|
-
declare function
|
|
339
|
+
declare function validateResponseSchema(schema: Record<string, unknown>): void;
|
|
358
340
|
//#endregion
|
|
359
|
-
export { DEFAULT_EXECUTION_TIMEOUT, DEFAULT_MAX_PTC_CALLS, DEFAULT_MAX_STACK_SIZE, DEFAULT_MEMORY_LIMIT,
|
|
341
|
+
export { type CodeInterpreterMiddlewareOptions, DEFAULT_EXECUTION_TIMEOUT, DEFAULT_MAX_PTC_CALLS, DEFAULT_MAX_STACK_SIZE, DEFAULT_MEMORY_LIMIT, PTCCallBudgetExceededError, type ReplResult, ReplSession, type ReplSessionOptions, type SubagentBridgeOptions, createCodeInterpreterMiddleware, formatReplResult, stripTypeSyntax, toCamelCase, transformForEval, validateResponseSchema };
|
|
360
342
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import * as _$langchain from "langchain";
|
|
2
1
|
import { AgentMiddleware } from "langchain";
|
|
3
2
|
import { z } from "zod/v4";
|
|
4
|
-
import { AnyBackendProtocol, BackendFactory, SkillMetadata } from "deepagents";
|
|
5
3
|
import { StructuredToolInterface } from "@langchain/core/tools";
|
|
6
4
|
|
|
7
5
|
//#region src/types.d.ts
|
|
8
6
|
/**
|
|
9
|
-
* Configuration options for the
|
|
7
|
+
* Configuration options for the Code Interpreter middleware.
|
|
10
8
|
*/
|
|
11
|
-
interface
|
|
9
|
+
interface CodeInterpreterMiddlewareOptions {
|
|
12
10
|
/**
|
|
13
11
|
* Enable programmatic tool calling from within the REPL.
|
|
14
12
|
*
|
|
@@ -39,11 +37,6 @@ interface REPLMiddlewareOptions {
|
|
|
39
37
|
* @default null (uses built-in prompt)
|
|
40
38
|
*/
|
|
41
39
|
systemPrompt?: string | null;
|
|
42
|
-
/**
|
|
43
|
-
* Backend the REPL reads skill module sources from. When provided alongside
|
|
44
|
-
* `SkillsMiddleware`, skills with a `module:` key become dynamic-importable.
|
|
45
|
-
*/
|
|
46
|
-
skillsBackend?: AnyBackendProtocol | BackendFactory;
|
|
47
40
|
/**
|
|
48
41
|
* Maximum number of `tools.*` bridge calls allowed per `eval()` invocation.
|
|
49
42
|
*
|
|
@@ -78,6 +71,43 @@ interface REPLMiddlewareOptions {
|
|
|
78
71
|
* @default true
|
|
79
72
|
*/
|
|
80
73
|
captureConsole?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Expose the built-in `task()` global for subagent orchestration.
|
|
76
|
+
*
|
|
77
|
+
* When `true` (default) and subagent specs are available, a `task()`
|
|
78
|
+
* global is installed in the REPL that dispatches subagents
|
|
79
|
+
* programmatically with a fixed concurrency cap of 32.
|
|
80
|
+
* Set to `false` to require subagent dispatch through the normal
|
|
81
|
+
* `task` tool path.
|
|
82
|
+
*
|
|
83
|
+
* @default true
|
|
84
|
+
*/
|
|
85
|
+
subagents?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Configuration for the built-in subagent primitive.
|
|
89
|
+
*
|
|
90
|
+
* When provided to a ReplSession, a frozen `subagent()` global is
|
|
91
|
+
* installed in the QuickJS context. Calls are gated by a concurrency
|
|
92
|
+
* queue and forwarded to the dispatch callback.
|
|
93
|
+
*/
|
|
94
|
+
interface SubagentBridgeOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Callback that invokes a subagent. Receives validated input from
|
|
97
|
+
* the QuickJS guest and returns the subagent's output — a string
|
|
98
|
+
* for text responses or an object for structured (responseSchema)
|
|
99
|
+
* responses.
|
|
100
|
+
*/
|
|
101
|
+
dispatch: (input: {
|
|
102
|
+
description: string;
|
|
103
|
+
subagentType: string;
|
|
104
|
+
responseSchema?: Record<string, unknown>;
|
|
105
|
+
}) => Promise<unknown>;
|
|
106
|
+
/**
|
|
107
|
+
* Maximum number of concurrent subagent calls within a single eval.
|
|
108
|
+
* Excess calls queue and resolve as permits free up.
|
|
109
|
+
*/
|
|
110
|
+
maxConcurrency: number;
|
|
81
111
|
}
|
|
82
112
|
/**
|
|
83
113
|
* Options for creating a ReplSession.
|
|
@@ -86,10 +116,11 @@ interface ReplSessionOptions {
|
|
|
86
116
|
memoryLimitBytes?: number;
|
|
87
117
|
maxStackSizeBytes?: number;
|
|
88
118
|
tools?: StructuredToolInterface[];
|
|
89
|
-
skillsEnabled?: boolean;
|
|
90
119
|
maxPtcCalls?: number | null;
|
|
91
120
|
maxResultChars?: number;
|
|
92
121
|
captureConsole?: boolean;
|
|
122
|
+
sessionId?: string;
|
|
123
|
+
subagentBridge?: SubagentBridgeOptions;
|
|
93
124
|
}
|
|
94
125
|
/**
|
|
95
126
|
* Result of a single REPL evaluation.
|
|
@@ -105,31 +136,18 @@ interface ReplResult {
|
|
|
105
136
|
logs: string[];
|
|
106
137
|
logsDroppedChars: number;
|
|
107
138
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Metadata + backend pair the session needs to resolve skill imports.
|
|
110
|
-
*/
|
|
111
|
-
interface SkillsContext {
|
|
112
|
-
/**
|
|
113
|
-
* Per-eval snapshot of `state.skillsMetadata`.
|
|
114
|
-
*/
|
|
115
|
-
metadata: SkillMetadata[];
|
|
116
|
-
/**
|
|
117
|
-
* Backend the session fetches skill source files from.
|
|
118
|
-
*/
|
|
119
|
-
backend: AnyBackendProtocol;
|
|
120
|
-
}
|
|
121
139
|
//#endregion
|
|
122
140
|
//#region src/middleware.d.ts
|
|
123
141
|
/**
|
|
124
|
-
* Create the
|
|
142
|
+
* Create the Code Interpreter middleware.
|
|
125
143
|
*/
|
|
126
|
-
declare function
|
|
144
|
+
declare function createCodeInterpreterMiddleware(options?: CodeInterpreterMiddlewareOptions): AgentMiddleware<undefined, undefined, unknown, readonly [import("langchain").DynamicStructuredTool<z.ZodObject<{
|
|
127
145
|
code: z.ZodString;
|
|
128
146
|
}, z.core.$strip>, {
|
|
129
147
|
code: string;
|
|
130
148
|
}, {
|
|
131
149
|
code: string;
|
|
132
|
-
}, string, unknown, string>]>;
|
|
150
|
+
}, string, unknown, string>], readonly []>;
|
|
133
151
|
//#endregion
|
|
134
152
|
//#region src/errors.d.ts
|
|
135
153
|
/**
|
|
@@ -179,28 +197,22 @@ declare class ReplSession {
|
|
|
179
197
|
private context;
|
|
180
198
|
private consoleBuffer;
|
|
181
199
|
private options;
|
|
182
|
-
private skillsContext;
|
|
183
|
-
private skillsLoaded;
|
|
184
|
-
private skillsFailed;
|
|
185
200
|
private readonly maxPtcCalls;
|
|
186
201
|
private ptcCallsRemaining;
|
|
187
|
-
|
|
188
|
-
private
|
|
189
|
-
/**
|
|
190
|
-
|
|
191
|
-
*/
|
|
192
|
-
private ensureSkillLoaded;
|
|
193
|
-
private resolveSpecifier;
|
|
202
|
+
private subagentQueue;
|
|
203
|
+
private bridgeDispatchRef;
|
|
204
|
+
/** Allowed keys in the subagent input object. */
|
|
205
|
+
private static readonly SUBAGENT_ALLOWED_KEYS;
|
|
194
206
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Wire the QuickJS module loader and normalizer on this session's runtime.
|
|
207
|
+
* Reset the shared WASM module. Forces the next session to instantiate
|
|
208
|
+
* a fresh module. Only needed in tests where module state must be
|
|
209
|
+
* isolated between test files.
|
|
210
|
+
*
|
|
211
|
+
* @internal
|
|
202
212
|
*/
|
|
203
|
-
|
|
213
|
+
static resetSharedModule(): void;
|
|
214
|
+
constructor(id: string, options?: ReplSessionOptions);
|
|
215
|
+
private ensureStarted;
|
|
204
216
|
/**
|
|
205
217
|
* Initialise the per-eval PTC counter. Called at the top of every `eval()`.
|
|
206
218
|
*/
|
|
@@ -232,12 +244,6 @@ declare class ReplSession {
|
|
|
232
244
|
* Dispose and remove the session with the given key, if it exists.
|
|
233
245
|
*/
|
|
234
246
|
static deleteSession(key: string): void;
|
|
235
|
-
/**
|
|
236
|
-
* Push the current skills metadata + backend into the session.
|
|
237
|
-
* Called by the middleware once per `eval` invocation, before eval runs.
|
|
238
|
-
* Pass `undefined` to clear the context (no skill imports will resolve).
|
|
239
|
-
*/
|
|
240
|
-
setSkillsContext(ctx?: SkillsContext): void;
|
|
241
247
|
/**
|
|
242
248
|
* Evaluate code in this session.
|
|
243
249
|
*
|
|
@@ -262,6 +268,23 @@ declare class ReplSession {
|
|
|
262
268
|
static clearCache(): void;
|
|
263
269
|
private setupConsole;
|
|
264
270
|
private injectTools;
|
|
271
|
+
/**
|
|
272
|
+
* Install the `task` global on the QuickJS context.
|
|
273
|
+
*
|
|
274
|
+
* Registers the host function directly as `globalThis.task`,
|
|
275
|
+
* then freezes it via `evalCode`. Structured results (when
|
|
276
|
+
* responseSchema is provided) are marshaled into native QuickJS
|
|
277
|
+
* objects on the host side — no JS wrapper needed.
|
|
278
|
+
*/
|
|
279
|
+
/**
|
|
280
|
+
* Replace the active bridge dispatch with a fresh one.
|
|
281
|
+
*
|
|
282
|
+
* Call this before each eval so the dispatch closure carries
|
|
283
|
+
* the current invocation's config (tracing callbacks, run ID, etc.)
|
|
284
|
+
* rather than the stale config from session creation.
|
|
285
|
+
*/
|
|
286
|
+
updateBridgeDispatch(dispatch: SubagentBridgeOptions["dispatch"]): void;
|
|
287
|
+
private injectSubagentBridge;
|
|
265
288
|
}
|
|
266
289
|
//#endregion
|
|
267
290
|
//#region src/utils.d.ts
|
|
@@ -273,10 +296,6 @@ declare function toCamelCase(name: string): string;
|
|
|
273
296
|
* Format the result of a REPL evaluation for the agent.
|
|
274
297
|
*/
|
|
275
298
|
declare function formatReplResult(result: ReplResult): string;
|
|
276
|
-
/**
|
|
277
|
-
* Render a pre-eval error when referenced skills are not available on the agent.
|
|
278
|
-
*/
|
|
279
|
-
declare function formatSkillNotAvailable(missing: readonly string[]): string;
|
|
280
299
|
//#endregion
|
|
281
300
|
//#region src/transform.d.ts
|
|
282
301
|
/**
|
|
@@ -310,51 +329,14 @@ declare function transformForEval(code: string): string;
|
|
|
310
329
|
*/
|
|
311
330
|
declare function stripTypeSyntax(code: string): string;
|
|
312
331
|
//#endregion
|
|
313
|
-
//#region src/
|
|
314
|
-
/**
|
|
315
|
-
* File extensions the loader will enumerate from a skill directory.
|
|
316
|
-
*/
|
|
317
|
-
declare const SKILL_MODULE_EXTENSIONS: string[];
|
|
318
|
-
/**
|
|
319
|
-
* Hard cap on total bytes pulled for one skill's bundle (1 MiB).
|
|
320
|
-
*/
|
|
321
|
-
declare const MAX_SKILL_BUNDLE_BYTES: number;
|
|
322
|
-
/**
|
|
323
|
-
* Install-ready state for a single skill, produced by `loadSkill`.
|
|
324
|
-
*/
|
|
325
|
-
interface LoadedSkill {
|
|
326
|
-
/**
|
|
327
|
-
* Spec-validated kebab-case skill name.
|
|
328
|
-
*/
|
|
329
|
-
name: string;
|
|
330
|
-
/**
|
|
331
|
-
* Bare specifier the skill installs under: `"@/skills/<name>"`.
|
|
332
|
-
*/
|
|
333
|
-
specifier: string;
|
|
334
|
-
/**
|
|
335
|
-
* Relative POSIX path of the entrypoint file (e.g. `"index.ts"`).
|
|
336
|
-
*/
|
|
337
|
-
entryRel: string;
|
|
338
|
-
/**
|
|
339
|
-
* File contents keyed by relative POSIX path, with TS syntax stripped.
|
|
340
|
-
*/
|
|
341
|
-
files: Map<string, string>;
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Build a `LoadedSkill` from a skill's metadata and a backend handle.
|
|
345
|
-
*
|
|
346
|
-
* Enumerates code files under the skill directory, downloads them,
|
|
347
|
-
* strips TypeScript syntax, and validates the entrypoint is present.
|
|
348
|
-
*/
|
|
349
|
-
declare function loadSkill(metadata: SkillMetadata, backend: AnyBackendProtocol): Promise<LoadedSkill>;
|
|
332
|
+
//#region src/subagent-dispatch.d.ts
|
|
350
333
|
/**
|
|
351
|
-
*
|
|
334
|
+
* Validate that a response schema does not exceed size, depth, or
|
|
335
|
+
* property-count limits.
|
|
352
336
|
*
|
|
353
|
-
*
|
|
354
|
-
* before evaluation starts. Dynamic imports with computed specifiers are
|
|
355
|
-
* not detected.
|
|
337
|
+
* @throws Error if any limit is exceeded.
|
|
356
338
|
*/
|
|
357
|
-
declare function
|
|
339
|
+
declare function validateResponseSchema(schema: Record<string, unknown>): void;
|
|
358
340
|
//#endregion
|
|
359
|
-
export { DEFAULT_EXECUTION_TIMEOUT, DEFAULT_MAX_PTC_CALLS, DEFAULT_MAX_STACK_SIZE, DEFAULT_MEMORY_LIMIT,
|
|
341
|
+
export { type CodeInterpreterMiddlewareOptions, DEFAULT_EXECUTION_TIMEOUT, DEFAULT_MAX_PTC_CALLS, DEFAULT_MAX_STACK_SIZE, DEFAULT_MEMORY_LIMIT, PTCCallBudgetExceededError, type ReplResult, ReplSession, type ReplSessionOptions, type SubagentBridgeOptions, createCodeInterpreterMiddleware, formatReplResult, stripTypeSyntax, toCamelCase, transformForEval, validateResponseSchema };
|
|
360
342
|
//# sourceMappingURL=index.d.ts.map
|