noumen 0.2.0 → 0.3.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/README.md +95 -16
- package/dist/a2a/index.d.ts +5 -5
- package/dist/a2a/index.js +3 -3
- package/dist/a2a/index.js.map +1 -1
- package/dist/acp/index.d.ts +5 -5
- package/dist/acp/index.js +4 -4
- package/dist/acp/index.js.map +1 -1
- package/dist/{agent-BrkbZyOT.d.ts → agent-1nFVUP9E.d.ts} +319 -15
- package/dist/{cache-DVqaCX8v.d.ts → cache-DsRqxx6v.d.ts} +1 -1
- package/dist/{chunk-BGG2E6JD.js → chunk-3HEYCV26.js} +1 -1
- package/dist/chunk-3SK5GCI6.js +75 -0
- package/dist/chunk-3SK5GCI6.js.map +1 -0
- package/dist/{chunk-NBDFQYUZ.js → chunk-4HW6LN6D.js} +4784 -2411
- package/dist/chunk-4HW6LN6D.js.map +1 -0
- package/dist/{chunk-7ZMN7XJE.js → chunk-5JN4SPI7.js} +6 -6
- package/dist/chunk-5JN4SPI7.js.map +1 -0
- package/dist/{chunk-CPFHEPW4.js → chunk-CS6WNDCF.js} +73 -41
- package/dist/chunk-CS6WNDCF.js.map +1 -0
- package/dist/chunk-EKOGVTBT.js +472 -0
- package/dist/chunk-EKOGVTBT.js.map +1 -0
- package/dist/{chunk-KY6ZPWHO.js → chunk-HEQQQGK5.js} +47 -28
- package/dist/chunk-HEQQQGK5.js.map +1 -0
- package/dist/{chunk-QTJ7VTJY.js → chunk-HL6JCRZJ.js} +1599 -481
- package/dist/chunk-HL6JCRZJ.js.map +1 -0
- package/dist/chunk-L3L3FG5T.js +16 -0
- package/dist/chunk-L3L3FG5T.js.map +1 -0
- package/dist/cli/index.js +36 -30
- package/dist/cli/index.js.map +1 -1
- package/dist/client/index.d.ts +2 -2
- package/dist/{headless-Q7XHHZIW.js → headless-FFU2DESQ.js} +3 -4
- package/dist/headless-FFU2DESQ.js.map +1 -0
- package/dist/index.d.ts +218 -68
- package/dist/index.js +37 -23
- package/dist/lsp/index.d.ts +4 -4
- package/dist/mcp/index.d.ts +5 -5
- package/dist/mcp/index.js +2 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/{provider-factory-34MSWJZ3.js → provider-factory-KCLIF34X.js} +2 -2
- package/dist/providers/anthropic.d.ts +2 -2
- package/dist/providers/anthropic.js +5 -3
- package/dist/providers/anthropic.js.map +1 -1
- package/dist/providers/bedrock.d.ts +2 -2
- package/dist/providers/bedrock.js +5 -3
- package/dist/providers/bedrock.js.map +1 -1
- package/dist/providers/gemini.d.ts +2 -1
- package/dist/providers/gemini.js +133 -95
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/ollama.d.ts +13 -0
- package/dist/{ollama-YNXAYP3R.js → providers/ollama.js} +6 -4
- package/dist/providers/ollama.js.map +1 -0
- package/dist/providers/openai.d.ts +4 -1
- package/dist/providers/openai.js +2 -1
- package/dist/providers/openrouter.d.ts +1 -1
- package/dist/providers/openrouter.js +2 -1
- package/dist/providers/openrouter.js.map +1 -1
- package/dist/providers/vertex.d.ts +4 -2
- package/dist/providers/vertex.js +6 -3
- package/dist/providers/vertex.js.map +1 -1
- package/dist/{resolve-XM52G7YE.js → resolve-4JA2BBDA.js} +2 -2
- package/dist/server/index.d.ts +35 -20
- package/dist/server/index.js +276 -207
- package/dist/server/index.js.map +1 -1
- package/dist/{server-Cg1yWGaV.d.ts → server-CHMxuWKq.d.ts} +1 -1
- package/dist/{types-DwdzmXfs.d.ts → types-CD0rUKKT.d.ts} +2 -0
- package/dist/{types-3c88cRKH.d.ts → types-LrU4LRmX.d.ts} +28 -0
- package/dist/{types-CwKKucOF.d.ts → types-RPKUTu1k.d.ts} +27 -2
- package/dist/uuid-RVN2T26F.js +8 -0
- package/dist/uuid-RVN2T26F.js.map +1 -0
- package/dist/zod-7YXKWYMC.js +12 -0
- package/dist/zod-7YXKWYMC.js.map +1 -0
- package/package.json +19 -13
- package/dist/chunk-2ZTGQLYK.js +0 -356
- package/dist/chunk-2ZTGQLYK.js.map +0 -1
- package/dist/chunk-7ZMN7XJE.js.map +0 -1
- package/dist/chunk-CPFHEPW4.js.map +0 -1
- package/dist/chunk-KY6ZPWHO.js.map +0 -1
- package/dist/chunk-NBDFQYUZ.js.map +0 -1
- package/dist/chunk-QTJ7VTJY.js.map +0 -1
- package/dist/headless-Q7XHHZIW.js.map +0 -1
- package/dist/ollama-YNXAYP3R.js.map +0 -1
- /package/dist/{chunk-BGG2E6JD.js.map → chunk-3HEYCV26.js.map} +0 -0
- /package/dist/{provider-factory-34MSWJZ3.js.map → provider-factory-KCLIF34X.js.map} +0 -0
- /package/dist/{resolve-XM52G7YE.js.map → resolve-4JA2BBDA.js.map} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as AIProvider, S as StreamEvent, b as ChatMessage, E as Entry, U as UUID, d as FileCheckpointSnapshot, f as ContentReplacementRecord$1, g as SessionInfo, M as ModelPricing, h as UsageRecord, i as CostSummary, j as ModelUsageSummary, k as ChatCompletionUsage, l as ThinkingConfig, m as MemoryConfig, O as OutputFormat, e as ContentPart, R as RunOptions, c as CheckpointConfig, n as ToolResult } from './types-
|
|
2
|
-
import { j as VirtualComputer, E as ExecOptions, C as CommandResult, V as VirtualFs, T as Tool, H as HookDefinition, S as SubagentConfig, k as SubagentRun, l as TaskStore, e as LspServerManager, m as FileCheckpointManager, n as FileStateCacheConfig, L as LspServerConfig } from './types-
|
|
3
|
-
import { C as CacheControlConfig } from './cache-
|
|
1
|
+
import { A as AIProvider, S as StreamEvent, b as ChatMessage, E as Entry, U as UUID, d as FileCheckpointSnapshot, f as ContentReplacementRecord$1, g as SessionInfo, M as ModelPricing, h as UsageRecord, i as CostSummary, j as ModelUsageSummary, k as ChatCompletionUsage, l as ThinkingConfig, m as MemoryConfig, O as OutputFormat, e as ContentPart, R as RunOptions, c as CheckpointConfig, n as ToolResult } from './types-LrU4LRmX.js';
|
|
2
|
+
import { j as VirtualComputer, E as ExecOptions, C as CommandResult, V as VirtualFs, T as Tool, H as HookDefinition, S as SubagentConfig, k as SubagentRun, l as TaskStore, e as LspServerManager, m as FileCheckpointManager, n as FileStateCacheConfig, L as LspServerConfig } from './types-RPKUTu1k.js';
|
|
3
|
+
import { C as CacheControlConfig } from './cache-DsRqxx6v.js';
|
|
4
4
|
import { M as McpServerConfig, T as TokenStorage } from './types-2kTLUCnD.js';
|
|
5
|
-
import { c as PermissionHandler, d as PermissionConfig } from './types-
|
|
5
|
+
import { c as PermissionHandler, d as PermissionConfig } from './types-CD0rUKKT.js';
|
|
6
6
|
|
|
7
7
|
type ProviderName = "openai" | "anthropic" | "gemini" | "openrouter" | "bedrock" | "vertex" | "ollama";
|
|
8
8
|
declare const DEFAULT_MODELS: Record<string, string>;
|
|
@@ -168,6 +168,54 @@ declare class E2BComputer implements VirtualComputer {
|
|
|
168
168
|
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* Minimal subset of the Freestyle VM interface used by FreestyleComputer and
|
|
173
|
+
* FreestyleFs. Avoids a hard import of `freestyle-sandboxes` at the module
|
|
174
|
+
* level — the real SDK is only loaded dynamically during `FreestyleSandbox`
|
|
175
|
+
* auto-creation.
|
|
176
|
+
*/
|
|
177
|
+
interface FreestyleVmInstance {
|
|
178
|
+
exec(command: string, opts?: {
|
|
179
|
+
cwd?: string;
|
|
180
|
+
timeout?: number;
|
|
181
|
+
}): Promise<{
|
|
182
|
+
stdout: string | null;
|
|
183
|
+
stderr: string | null;
|
|
184
|
+
statusCode: number | null;
|
|
185
|
+
}>;
|
|
186
|
+
fs: {
|
|
187
|
+
readTextFile(path: string): Promise<string>;
|
|
188
|
+
writeTextFile(path: string, content: string): Promise<void>;
|
|
189
|
+
readDir(path: string): Promise<Array<{
|
|
190
|
+
name: string;
|
|
191
|
+
kind: string;
|
|
192
|
+
}>>;
|
|
193
|
+
};
|
|
194
|
+
suspend(): Promise<unknown>;
|
|
195
|
+
start(): Promise<unknown>;
|
|
196
|
+
}
|
|
197
|
+
interface FreestyleComputerOptions {
|
|
198
|
+
/** A Freestyle VM instance. */
|
|
199
|
+
vm: FreestyleVmInstance;
|
|
200
|
+
/** Default working directory for commands. */
|
|
201
|
+
defaultCwd?: string;
|
|
202
|
+
/** Default timeout in ms for commands (default: 30000). */
|
|
203
|
+
defaultTimeout?: number;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* VirtualComputer backed by command execution in a Freestyle VM.
|
|
207
|
+
*
|
|
208
|
+
* Requires `freestyle-sandboxes` as an optional peer dependency.
|
|
209
|
+
* The user is responsible for VM lifecycle when using explicit mode.
|
|
210
|
+
*/
|
|
211
|
+
declare class FreestyleComputer implements VirtualComputer {
|
|
212
|
+
private vm;
|
|
213
|
+
private defaultCwd;
|
|
214
|
+
private defaultTimeout;
|
|
215
|
+
constructor(opts: FreestyleComputerOptions);
|
|
216
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
217
|
+
}
|
|
218
|
+
|
|
171
219
|
/**
|
|
172
220
|
* Bundled sandbox: a `VirtualFs` and `VirtualComputer` paired together.
|
|
173
221
|
*
|
|
@@ -178,6 +226,29 @@ declare class E2BComputer implements VirtualComputer {
|
|
|
178
226
|
interface Sandbox {
|
|
179
227
|
fs: VirtualFs;
|
|
180
228
|
computer: VirtualComputer;
|
|
229
|
+
/** Optional cleanup — called by Agent.close() to tear down OS-level sandbox state. */
|
|
230
|
+
dispose?(): Promise<void>;
|
|
231
|
+
/**
|
|
232
|
+
* Lazily provision the underlying sandbox resource. Idempotent — repeated
|
|
233
|
+
* calls return the same single-flight promise.
|
|
234
|
+
*
|
|
235
|
+
* When `sandboxId` is provided the sandbox reconnects to an existing
|
|
236
|
+
* resource instead of creating a new one. This is used during session
|
|
237
|
+
* resume: the stored sandbox identifier is read from session metadata
|
|
238
|
+
* and passed here so the agent reattaches to its previous container.
|
|
239
|
+
*
|
|
240
|
+
* When omitted a fresh resource is provisioned (for factories that
|
|
241
|
+
* support auto-creation) or the call is a no-op (for factories that
|
|
242
|
+
* were given a pre-created resource up front).
|
|
243
|
+
*/
|
|
244
|
+
init?(sandboxId?: string): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Return the opaque identifier for this sandbox instance so it can be
|
|
247
|
+
* persisted in session metadata and used to reconnect later via `init()`.
|
|
248
|
+
* Returns `undefined` before `init()` has resolved or for sandboxes
|
|
249
|
+
* that don't support reconnection.
|
|
250
|
+
*/
|
|
251
|
+
sandboxId?(): string | undefined;
|
|
181
252
|
}
|
|
182
253
|
interface UnsandboxedLocalOptions {
|
|
183
254
|
/** Working directory for both file resolution and command execution. */
|
|
@@ -221,21 +292,76 @@ declare function LocalSandbox(opts?: LocalSandboxOptions): Sandbox;
|
|
|
221
292
|
interface SpritesSandboxOptions {
|
|
222
293
|
/** sprites.dev API token. */
|
|
223
294
|
token: string;
|
|
224
|
-
/**
|
|
225
|
-
|
|
295
|
+
/**
|
|
296
|
+
* Name of an existing sprite container. When provided the sandbox
|
|
297
|
+
* attaches to this sprite directly — no auto-creation occurs and
|
|
298
|
+
* `dispose()` will **not** delete it (lifecycle is yours to manage).
|
|
299
|
+
*
|
|
300
|
+
* When omitted a new sprite is provisioned on the first `init()` call
|
|
301
|
+
* (via `POST /v1/sprites`). The auto-created sprite is deleted when
|
|
302
|
+
* `dispose()` is called, and its name is available via `sandboxId()`
|
|
303
|
+
* for session persistence.
|
|
304
|
+
*/
|
|
305
|
+
spriteName?: string;
|
|
226
306
|
/** Base URL for sprites API (default: https://api.sprites.dev). */
|
|
227
307
|
baseURL?: string;
|
|
228
308
|
/** Working directory inside the sprite (default: /home/sprite). */
|
|
229
309
|
workingDir?: string;
|
|
310
|
+
/**
|
|
311
|
+
* Optional prefix for auto-generated sprite names (default: "noumen-").
|
|
312
|
+
* Only used when `spriteName` is omitted.
|
|
313
|
+
*/
|
|
314
|
+
namePrefix?: string;
|
|
230
315
|
}
|
|
231
316
|
/**
|
|
232
317
|
* Create a `Sandbox` backed by a remote sprites.dev container.
|
|
233
318
|
* Full isolation — the agent has no access to the host machine.
|
|
319
|
+
*
|
|
320
|
+
* **Auto-creation:** When `spriteName` is omitted the sandbox is created
|
|
321
|
+
* lazily on the first `init()` call via the Sprites REST API. The sprite
|
|
322
|
+
* name is available through `sandboxId()` so callers can persist it in
|
|
323
|
+
* session metadata for reconnection on resume. Pass the stored name back
|
|
324
|
+
* through `init(storedId)` to reattach instead of creating a new sprite.
|
|
325
|
+
*
|
|
326
|
+
* **Explicit ID:** When `spriteName` is provided the sandbox attaches to
|
|
327
|
+
* that sprite immediately on `init()`. `dispose()` is a no-op in this
|
|
328
|
+
* case — the caller owns the sprite's lifecycle.
|
|
329
|
+
*
|
|
330
|
+
* @example
|
|
331
|
+
* ```ts
|
|
332
|
+
* // Auto-create — sprite provisioned on first init()
|
|
333
|
+
* const sandbox = SpritesSandbox({ token: process.env.SPRITES_TOKEN! });
|
|
334
|
+
*
|
|
335
|
+
* // Explicit — attach to pre-existing sprite, no auto-lifecycle
|
|
336
|
+
* const sandbox = SpritesSandbox({
|
|
337
|
+
* token: process.env.SPRITES_TOKEN!,
|
|
338
|
+
* spriteName: "my-sprite",
|
|
339
|
+
* });
|
|
340
|
+
* ```
|
|
234
341
|
*/
|
|
235
342
|
declare function SpritesSandbox(opts: SpritesSandboxOptions): Sandbox;
|
|
236
343
|
interface DockerSandboxOptions {
|
|
237
|
-
/**
|
|
238
|
-
|
|
344
|
+
/**
|
|
345
|
+
* A pre-existing dockerode Container instance. When provided the sandbox
|
|
346
|
+
* attaches to this container directly — no auto-creation occurs and
|
|
347
|
+
* `dispose()` will **not** stop or remove it.
|
|
348
|
+
*
|
|
349
|
+
* When omitted, a new container is created from `image` on the first
|
|
350
|
+
* `init()` call via a dynamic import of `dockerode`. The auto-created
|
|
351
|
+
* container is stopped and removed when `dispose()` is called.
|
|
352
|
+
*/
|
|
353
|
+
container?: DockerContainer;
|
|
354
|
+
/**
|
|
355
|
+
* Docker image to use for auto-creation (e.g. `"ubuntu:22.04"`).
|
|
356
|
+
* Required when `container` is omitted; ignored when `container` is provided.
|
|
357
|
+
*/
|
|
358
|
+
image?: string;
|
|
359
|
+
/** Command to run in the auto-created container (default: `["sleep", "infinity"]`). */
|
|
360
|
+
cmd?: string[];
|
|
361
|
+
/** Environment variables for the auto-created container. */
|
|
362
|
+
env?: string[];
|
|
363
|
+
/** Extra options passed to dockerode `createContainer`. */
|
|
364
|
+
dockerOptions?: Record<string, unknown>;
|
|
239
365
|
/** Working directory inside the container. */
|
|
240
366
|
cwd?: string;
|
|
241
367
|
/** Default timeout (ms) for shell commands. */
|
|
@@ -244,11 +370,50 @@ interface DockerSandboxOptions {
|
|
|
244
370
|
/**
|
|
245
371
|
* Create a `Sandbox` backed by a Docker container.
|
|
246
372
|
* Requires `dockerode` as an optional peer dependency.
|
|
373
|
+
*
|
|
374
|
+
* **Auto-creation:** When `container` is omitted and `image` is provided,
|
|
375
|
+
* the container is created and started lazily on the first `init()` call.
|
|
376
|
+
* The container ID is available through `sandboxId()` for session
|
|
377
|
+
* persistence. Pass the stored ID back through `init(storedId)` to
|
|
378
|
+
* reattach to an existing container on resume.
|
|
379
|
+
*
|
|
380
|
+
* **Explicit container:** When `container` is provided, `init()` binds
|
|
381
|
+
* it immediately. `dispose()` is a no-op — the caller owns the
|
|
382
|
+
* container's lifecycle.
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* ```ts
|
|
386
|
+
* // Auto-create from image
|
|
387
|
+
* const sandbox = DockerSandbox({ image: "ubuntu:22.04", cwd: "/workspace" });
|
|
388
|
+
*
|
|
389
|
+
* // Explicit container (lifecycle managed externally)
|
|
390
|
+
* const sandbox = DockerSandbox({ container: myDockerodeContainer });
|
|
391
|
+
* ```
|
|
247
392
|
*/
|
|
248
393
|
declare function DockerSandbox(opts: DockerSandboxOptions): Sandbox;
|
|
249
394
|
interface E2BSandboxOptions {
|
|
250
|
-
/**
|
|
251
|
-
|
|
395
|
+
/**
|
|
396
|
+
* A pre-existing E2B Sandbox instance (e.g. from `Sandbox.create()`).
|
|
397
|
+
* When provided the sandbox attaches to this instance — no auto-creation
|
|
398
|
+
* occurs and `dispose()` will **not** kill it.
|
|
399
|
+
*
|
|
400
|
+
* When omitted, a new E2B sandbox is created on the first `init()` call
|
|
401
|
+
* via a dynamic import of the `e2b` package. The auto-created sandbox
|
|
402
|
+
* is killed when `dispose()` is called.
|
|
403
|
+
*/
|
|
404
|
+
sandbox?: E2BSandboxInstance;
|
|
405
|
+
/**
|
|
406
|
+
* E2B template to use for auto-creation (default: `"base"`).
|
|
407
|
+
* Only used when `sandbox` is omitted.
|
|
408
|
+
*/
|
|
409
|
+
template?: string;
|
|
410
|
+
/**
|
|
411
|
+
* E2B API key. Falls back to the `E2B_API_KEY` environment variable
|
|
412
|
+
* when omitted. Only used during auto-creation.
|
|
413
|
+
*/
|
|
414
|
+
apiKey?: string;
|
|
415
|
+
/** Timeout (ms) for the auto-created E2B sandbox (default: E2B SDK default). */
|
|
416
|
+
timeoutMs?: number;
|
|
252
417
|
/** Working directory inside the sandbox. */
|
|
253
418
|
cwd?: string;
|
|
254
419
|
/** Default timeout (ms) for shell commands. */
|
|
@@ -257,8 +422,110 @@ interface E2BSandboxOptions {
|
|
|
257
422
|
/**
|
|
258
423
|
* Create a `Sandbox` backed by an E2B cloud sandbox.
|
|
259
424
|
* Requires `e2b` as an optional peer dependency.
|
|
425
|
+
*
|
|
426
|
+
* **Auto-creation:** When `sandbox` is omitted the E2B sandbox is
|
|
427
|
+
* provisioned lazily on the first `init()` call via the E2B SDK.
|
|
428
|
+
* The sandbox ID is available through `sandboxId()` for session
|
|
429
|
+
* persistence. Pass the stored ID back through `init(storedId)` to
|
|
430
|
+
* reconnect to the same sandbox on resume (via `Sandbox.connect()`).
|
|
431
|
+
*
|
|
432
|
+
* **Explicit instance:** When `sandbox` is provided, `init()` binds
|
|
433
|
+
* it immediately. `dispose()` is a no-op — the caller owns the
|
|
434
|
+
* sandbox's lifecycle.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```ts
|
|
438
|
+
* // Auto-create — sandbox provisioned on first init()
|
|
439
|
+
* const sandbox = E2BSandbox({ template: "base" });
|
|
440
|
+
*
|
|
441
|
+
* // Explicit — attach to pre-existing instance
|
|
442
|
+
* const sandbox = E2BSandbox({ sandbox: await E2BSdk.Sandbox.create() });
|
|
443
|
+
* ```
|
|
260
444
|
*/
|
|
261
445
|
declare function E2BSandbox(opts: E2BSandboxOptions): Sandbox;
|
|
446
|
+
interface FreestyleSandboxOptions {
|
|
447
|
+
/**
|
|
448
|
+
* A pre-existing Freestyle VM instance. When provided the sandbox
|
|
449
|
+
* attaches to this VM directly — no auto-creation occurs and
|
|
450
|
+
* `dispose()` will **not** suspend or delete it.
|
|
451
|
+
*
|
|
452
|
+
* When omitted, a new VM is created on the first `init()` call via
|
|
453
|
+
* a dynamic import of the `freestyle-sandboxes` package.
|
|
454
|
+
*/
|
|
455
|
+
vm?: FreestyleVmInstance;
|
|
456
|
+
/**
|
|
457
|
+
* Freestyle API key. Falls back to the `FREESTYLE_API_KEY` environment
|
|
458
|
+
* variable when omitted. Only used during auto-creation.
|
|
459
|
+
*/
|
|
460
|
+
apiKey?: string;
|
|
461
|
+
/** Snapshot ID to create the VM from. Only used during auto-creation. */
|
|
462
|
+
snapshotId?: string;
|
|
463
|
+
/**
|
|
464
|
+
* A `VmSpec` instance or configuration object passed through to
|
|
465
|
+
* `freestyle.vms.create()`. Only used during auto-creation.
|
|
466
|
+
*/
|
|
467
|
+
spec?: unknown;
|
|
468
|
+
/**
|
|
469
|
+
* Idle timeout in seconds for the auto-created VM (default: 600).
|
|
470
|
+
* The VM auto-suspends after this many seconds of network inactivity.
|
|
471
|
+
*/
|
|
472
|
+
idleTimeoutSeconds?: number;
|
|
473
|
+
/** Working directory inside the VM. */
|
|
474
|
+
cwd?: string;
|
|
475
|
+
/** Default timeout (ms) for shell commands. */
|
|
476
|
+
defaultTimeout?: number;
|
|
477
|
+
/** Files to provision at creation time. */
|
|
478
|
+
additionalFiles?: Record<string, {
|
|
479
|
+
content: string;
|
|
480
|
+
encoding?: string;
|
|
481
|
+
}>;
|
|
482
|
+
/** Git repos to clone at creation time. */
|
|
483
|
+
gitRepos?: Array<{
|
|
484
|
+
repo: string;
|
|
485
|
+
path: string;
|
|
486
|
+
rev?: string;
|
|
487
|
+
}>;
|
|
488
|
+
/**
|
|
489
|
+
* What to do with auto-created VMs on `dispose()`:
|
|
490
|
+
* - `"suspend"` (default) — suspends the VM, preserving full memory
|
|
491
|
+
* state for near-instant resume on reconnect.
|
|
492
|
+
* - `"delete"` — permanently deletes the VM and frees all resources.
|
|
493
|
+
*/
|
|
494
|
+
disposeStrategy?: "suspend" | "delete";
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Create a `Sandbox` backed by a Freestyle VM.
|
|
498
|
+
* Requires `freestyle-sandboxes` as an optional peer dependency.
|
|
499
|
+
*
|
|
500
|
+
* **Auto-creation:** When `vm` is omitted a new Freestyle VM is
|
|
501
|
+
* provisioned lazily on the first `init()` call. The VM ID is available
|
|
502
|
+
* through `sandboxId()` for session persistence. Pass the stored ID back
|
|
503
|
+
* through `init(storedId)` to reconnect (this also wakes suspended VMs).
|
|
504
|
+
*
|
|
505
|
+
* By default, auto-created VMs are **suspended** on `dispose()` rather
|
|
506
|
+
* than deleted. This preserves full memory state and allows near-instant
|
|
507
|
+
* resume. Set `disposeStrategy: "delete"` for full cleanup.
|
|
508
|
+
*
|
|
509
|
+
* **Explicit instance:** When `vm` is provided, `init()` binds it
|
|
510
|
+
* immediately. `dispose()` is a no-op — the caller owns the VM's
|
|
511
|
+
* lifecycle.
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* ```ts
|
|
515
|
+
* // Auto-create — VM provisioned on first init()
|
|
516
|
+
* const sandbox = FreestyleSandbox({ cwd: "/workspace" });
|
|
517
|
+
*
|
|
518
|
+
* // Auto-create from a snapshot
|
|
519
|
+
* const sandbox = FreestyleSandbox({
|
|
520
|
+
* snapshotId: "abc123",
|
|
521
|
+
* cwd: "/workspace",
|
|
522
|
+
* });
|
|
523
|
+
*
|
|
524
|
+
* // Explicit — attach to pre-existing VM
|
|
525
|
+
* const sandbox = FreestyleSandbox({ vm: existingVm });
|
|
526
|
+
* ```
|
|
527
|
+
*/
|
|
528
|
+
declare function FreestyleSandbox(opts: FreestyleSandboxOptions): Sandbox;
|
|
262
529
|
|
|
263
530
|
interface SkillDefinition {
|
|
264
531
|
name: string;
|
|
@@ -427,10 +694,22 @@ declare function enforceToolResultBudget(messages: ChatMessage[], config: ToolRe
|
|
|
427
694
|
declare class SessionStorage {
|
|
428
695
|
private fs;
|
|
429
696
|
private sessionDir;
|
|
697
|
+
private writeLock;
|
|
430
698
|
constructor(fs: VirtualFs, sessionDir: string);
|
|
699
|
+
/**
|
|
700
|
+
* Serialize writes through a simple promise chain so parallel
|
|
701
|
+
* appendEntry calls don't interleave large JSONL records.
|
|
702
|
+
*/
|
|
703
|
+
private serializedWrite;
|
|
431
704
|
private getTranscriptPath;
|
|
432
705
|
ensureDir(): Promise<void>;
|
|
433
706
|
appendEntry(sessionId: string, entry: Entry): Promise<void>;
|
|
707
|
+
/**
|
|
708
|
+
* Append multiple entries atomically as a single write.
|
|
709
|
+
* All entries are serialized into one string and written in one appendFile
|
|
710
|
+
* call, preventing partial writes on crash.
|
|
711
|
+
*/
|
|
712
|
+
appendEntriesBatch(sessionId: string, entries: Entry[]): Promise<void>;
|
|
434
713
|
appendMessage(sessionId: string, message: ChatMessage, parentUuid?: UUID | null): Promise<UUID>;
|
|
435
714
|
appendCompactBoundary(sessionId: string): Promise<UUID>;
|
|
436
715
|
appendSummary(sessionId: string, summaryMessage: ChatMessage, parentUuid?: UUID | null): Promise<UUID>;
|
|
@@ -439,9 +718,15 @@ declare class SessionStorage {
|
|
|
439
718
|
appendSnipBoundary(sessionId: string, removedUuids: string[]): Promise<void>;
|
|
440
719
|
appendContentReplacement(sessionId: string, replacements: ContentReplacementRecord$1[]): Promise<void>;
|
|
441
720
|
appendMetadata(sessionId: string, key: string, value: unknown): Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* Re-append custom-title and key metadata entries after a compact boundary
|
|
723
|
+
* so they remain discoverable in the active-entries window.
|
|
724
|
+
*/
|
|
725
|
+
reAppendMetadataAfterCompact(sessionId: string): Promise<void>;
|
|
442
726
|
loadMessages(sessionId: string): Promise<ChatMessage[]>;
|
|
443
727
|
loadAllEntries(sessionId: string): Promise<Entry[]>;
|
|
444
728
|
sessionExists(sessionId: string): Promise<boolean>;
|
|
729
|
+
deleteSession(sessionId: string): Promise<void>;
|
|
445
730
|
listSessions(): Promise<SessionInfo[]>;
|
|
446
731
|
}
|
|
447
732
|
|
|
@@ -462,7 +747,9 @@ interface ReactiveCompactResult {
|
|
|
462
747
|
* Returns `null` if there are not enough messages to meaningfully compact
|
|
463
748
|
* or truncate (less than 2 messages).
|
|
464
749
|
*/
|
|
465
|
-
declare function tryReactiveCompact(provider: AIProvider, model: string, messages: ChatMessage[], storage: SessionStorage, sessionId: string
|
|
750
|
+
declare function tryReactiveCompact(provider: AIProvider, model: string, messages: ChatMessage[], storage: SessionStorage, sessionId: string, opts?: {
|
|
751
|
+
signal?: AbortSignal;
|
|
752
|
+
}): Promise<ReactiveCompactResult | null>;
|
|
466
753
|
|
|
467
754
|
/**
|
|
468
755
|
* Disk-backed tool result storage.
|
|
@@ -664,8 +951,10 @@ declare function createAutoCompactTracking(maxFailures?: number): AutoCompactTra
|
|
|
664
951
|
*
|
|
665
952
|
* @param tokensFreed — tokens already reclaimed by microcompact/budget in
|
|
666
953
|
* this turn; subtracted from the estimate so we don't over-eagerly compact.
|
|
954
|
+
* @param querySource — the source of the current query; prevents recursive
|
|
955
|
+
* compaction when called from a compact or session_memory context.
|
|
667
956
|
*/
|
|
668
|
-
declare function shouldAutoCompact(messages: ChatMessage[], config: AutoCompactConfig, lastUsage?: ChatCompletionUsage, anchorMessageIndex?: number, tokensFreed?: number): boolean;
|
|
957
|
+
declare function shouldAutoCompact(messages: ChatMessage[], config: AutoCompactConfig, lastUsage?: ChatCompletionUsage, anchorMessageIndex?: number, tokensFreed?: number, querySource?: string): boolean;
|
|
669
958
|
/**
|
|
670
959
|
* Check whether the circuit breaker allows another auto-compact attempt.
|
|
671
960
|
*/
|
|
@@ -701,6 +990,8 @@ interface ThreadConfig {
|
|
|
701
990
|
hooks?: HookDefinition[];
|
|
702
991
|
spawnSubagent?: (config: SubagentConfig) => SubagentRun;
|
|
703
992
|
streamingToolExecution?: boolean;
|
|
993
|
+
/** Truncate individual tool results exceeding this character count. Default: 100000. */
|
|
994
|
+
maxResultChars?: number;
|
|
704
995
|
userInputHandler?: (question: string) => Promise<string>;
|
|
705
996
|
taskStore?: TaskStore;
|
|
706
997
|
lspManager?: LspServerManager;
|
|
@@ -729,6 +1020,8 @@ interface ThreadConfig {
|
|
|
729
1020
|
outputFormat?: OutputFormat;
|
|
730
1021
|
/** Default structured output mode for all runs on this thread. */
|
|
731
1022
|
structuredOutputMode?: "alongside_tools" | "final_response";
|
|
1023
|
+
/** When true, assert normalization invariants after every API message preparation. */
|
|
1024
|
+
debug?: boolean;
|
|
732
1025
|
}
|
|
733
1026
|
declare class Thread {
|
|
734
1027
|
readonly sessionId: string;
|
|
@@ -753,10 +1046,13 @@ declare class Thread {
|
|
|
753
1046
|
private budgetState;
|
|
754
1047
|
private hasAttemptedReactiveCompact;
|
|
755
1048
|
private microcompactTokensFreed;
|
|
1049
|
+
private querySource;
|
|
756
1050
|
private resumeRequested;
|
|
757
1051
|
private fileStateCache;
|
|
758
1052
|
private contentReplacementState;
|
|
759
1053
|
private denialTracker;
|
|
1054
|
+
/** Tracks file paths read by ReadFile for post-compact reinjection. */
|
|
1055
|
+
private recentlyReadFiles;
|
|
760
1056
|
constructor(config: ThreadConfig, opts?: ThreadOptions);
|
|
761
1057
|
run(prompt: string | ContentPart[], opts?: RunOptions): AsyncGenerator<StreamEvent, void, unknown>;
|
|
762
1058
|
/**
|
|
@@ -785,6 +1081,7 @@ declare class Thread {
|
|
|
785
1081
|
setModel(model: string): void;
|
|
786
1082
|
setProvider(provider: AIProvider, model?: string): void;
|
|
787
1083
|
getModel(): string;
|
|
1084
|
+
getCwd(): string;
|
|
788
1085
|
abort(): void;
|
|
789
1086
|
}
|
|
790
1087
|
|
|
@@ -917,6 +1214,7 @@ declare class Agent {
|
|
|
917
1214
|
private resolvedProvider;
|
|
918
1215
|
private fs;
|
|
919
1216
|
private computer;
|
|
1217
|
+
private sandbox;
|
|
920
1218
|
private sessionDir;
|
|
921
1219
|
private skills;
|
|
922
1220
|
private skillsPaths;
|
|
@@ -968,13 +1266,15 @@ declare class Agent {
|
|
|
968
1266
|
private historySnipConfig;
|
|
969
1267
|
private outputFormat;
|
|
970
1268
|
private structuredOutputMode;
|
|
1269
|
+
private providerPromise;
|
|
1270
|
+
private initPromise;
|
|
971
1271
|
constructor(opts: AgentOptions);
|
|
972
1272
|
private ensureProvider;
|
|
973
1273
|
private getProvider;
|
|
974
1274
|
private getSkills;
|
|
975
1275
|
private getAllTools;
|
|
976
1276
|
private createSpawnSubagent;
|
|
977
|
-
createThread(opts?: ThreadOptions): Thread
|
|
1277
|
+
createThread(opts?: ThreadOptions): Promise<Thread>;
|
|
978
1278
|
listSessions(): Promise<SessionInfo[]>;
|
|
979
1279
|
getCostSummary(): CostSummary | null;
|
|
980
1280
|
/**
|
|
@@ -982,7 +1282,7 @@ declare class Agent {
|
|
|
982
1282
|
* messages (respecting compact boundaries), file checkpoint state, and
|
|
983
1283
|
* cost tracking state from the persisted JSONL transcript.
|
|
984
1284
|
*/
|
|
985
|
-
resumeThread(sessionId: string, opts?: Omit<ThreadOptions, "sessionId" | "resume">): Thread
|
|
1285
|
+
resumeThread(sessionId: string, opts?: Omit<ThreadOptions, "sessionId" | "resume">): Promise<Thread>;
|
|
986
1286
|
/**
|
|
987
1287
|
* One-shot streaming: creates an ephemeral thread and yields events.
|
|
988
1288
|
* Auto-resolves string providers on first call (no need to call `init()`).
|
|
@@ -1012,6 +1312,7 @@ declare class Agent {
|
|
|
1012
1312
|
* mcpServers, or lsp, so that createThread() has everything available synchronously.
|
|
1013
1313
|
*/
|
|
1014
1314
|
init(): Promise<void>;
|
|
1315
|
+
private doInit;
|
|
1015
1316
|
/**
|
|
1016
1317
|
* Run health checks on the provider, sandbox, MCP servers, and LSP servers.
|
|
1017
1318
|
* Returns a structured report — useful for debugging integration issues.
|
|
@@ -1019,10 +1320,13 @@ declare class Agent {
|
|
|
1019
1320
|
* @param timeoutMs Per-check timeout in milliseconds (default 10 000).
|
|
1020
1321
|
*/
|
|
1021
1322
|
diagnose(timeoutMs?: number): Promise<DiagnoseResult>;
|
|
1323
|
+
private get sandboxIndexPath();
|
|
1324
|
+
private loadSandboxId;
|
|
1325
|
+
private storeSandboxId;
|
|
1022
1326
|
/**
|
|
1023
1327
|
* Disconnect all MCP clients. Call when done with this Agent instance.
|
|
1024
1328
|
*/
|
|
1025
1329
|
close(): Promise<void>;
|
|
1026
1330
|
}
|
|
1027
1331
|
|
|
1028
|
-
export { type
|
|
1332
|
+
export { type RunCallbacks as $, Agent as A, type BudgetState as B, type ContextFile as C, type DockerContainer as D, type E2BSandboxInstance as E, type FreestyleVmInstance as F, E2BComputer as G, type E2BComputerOptions as H, E2BSandbox as I, type E2BSandboxOptions as J, FreestyleComputer as K, type FreestyleComputerOptions as L, FreestyleSandbox as M, type FreestyleSandboxOptions as N, LocalSandbox as O, type ProjectContextConfig as P, type LocalSandboxOptions as Q, type RetryConfig as R, type Sandbox as S, type ThreadConfig as T, type MicrocompactConfig as U, type MicrocompactResult as V, type ProviderName as W, type ReactiveCompactConfig as X, type ReactiveCompactResult as Y, type ResolveProviderOptions as Z, type RetryEvent as _, type SkillDefinition as a, type RunResult as a0, SUPPORTED_PROVIDERS as a1, type SandboxConfig as a2, SandboxedLocalComputer as a3, type SandboxedLocalComputerOptions as a4, type SnipConfig as a5, type SnipResult as a6, SpritesSandbox as a7, type SpritesSandboxOptions as a8, Thread as a9, recordAutoCompactFailure as aA, recordAutoCompactSuccess as aB, resolveProvider as aC, shouldAutoCompact as aD, snipMessagesByUuids as aE, tryReactiveCompact as aF, webSearchToolPlaceholder as aG, type ThreadOptions as aa, type ToolResultBudgetConfig as ab, type ToolResultBudgetResult as ac, type ContentReplacementRecord as ad, type ToolResultSpillResult as ae, type ToolResultStorageConfig as af, type TracingConfig as ag, UnsandboxedLocal as ah, type UnsandboxedLocalOptions as ai, type WebSearchConfig as aj, type WebSearchResult as ak, applyPersistedReplacements as al, applySnipRemovals as am, canAutoCompact as an, createAutoCompactConfig as ao, createAutoCompactTracking as ap, createBudgetState as aq, createContentReplacementState as ar, createWebSearchTool as as, detectProvider as at, enforceToolResultBudget as au, enforceToolResultStorageBudget as av, microcompactMessages as aw, persistToolResult as ax, projectSnippedView as ay, reconstructContentReplacementState as az, SessionStorage as b, type ContextScope as c, type RetryContext as d, type RetryEngineOptions as e, type Span as f, type SpanAttributeValue as g, SpanStatusCode as h, type Tracer as i, type SpanOptions as j, type StoredCostState as k, type AgentOptions as l, type AutoCompactConfig as m, type AutoCompactTrackingState as n, CLEARED_PLACEHOLDER as o, COMPACTABLE_TOOLS as p, type ContentReplacementState as q, CostTracker as r, DEFAULT_MODELS as s, DEFAULT_RETRY_CONFIG as t, type DiagnoseCheckResult as u, type DiagnoseResult as v, DockerComputer as w, type DockerComputerOptions as x, DockerSandbox as y, type DockerSandboxOptions as z };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/utils/zod.ts
|
|
2
|
+
var cache = /* @__PURE__ */ new WeakMap();
|
|
3
|
+
function zodToJsonSchema(schema) {
|
|
4
|
+
const hit = cache.get(schema);
|
|
5
|
+
if (hit) return hit;
|
|
6
|
+
const zod = schema._zod ? schema : void 0;
|
|
7
|
+
if (!zod) {
|
|
8
|
+
throw new Error(
|
|
9
|
+
"zodToJsonSchema requires a Zod v4 schema. Install zod and pass a z.object(\u2026) schema."
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
let toJSONSchema;
|
|
13
|
+
try {
|
|
14
|
+
const sAny = schema;
|
|
15
|
+
if (typeof sAny._toJSONSchema === "function") {
|
|
16
|
+
const result = sAny._toJSONSchema();
|
|
17
|
+
cache.set(schema, result);
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
toJSONSchema = globalThis.__noumen_toJSONSchema;
|
|
21
|
+
} catch {
|
|
22
|
+
}
|
|
23
|
+
if (toJSONSchema) {
|
|
24
|
+
const result = toJSONSchema(schema);
|
|
25
|
+
cache.set(schema, result);
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
throw new Error(
|
|
29
|
+
"Could not convert Zod schema to JSON Schema. Call `registerZodToJsonSchema(toJSONSchema)` from zod/v4 or upgrade to Zod v4."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function registerZodToJsonSchema(fn) {
|
|
33
|
+
globalThis.__noumen_toJSONSchema = fn;
|
|
34
|
+
}
|
|
35
|
+
function formatZodValidationError(toolName, issues) {
|
|
36
|
+
if (!issues || !issues.issues.length) {
|
|
37
|
+
return `${toolName}: validation failed with unknown error`;
|
|
38
|
+
}
|
|
39
|
+
const parts = [];
|
|
40
|
+
const missing = issues.issues.filter(
|
|
41
|
+
(i) => i.code === "invalid_type" && i.message.includes("required")
|
|
42
|
+
);
|
|
43
|
+
const unrecognized = issues.issues.filter(
|
|
44
|
+
(i) => i.code === "unrecognized_keys"
|
|
45
|
+
);
|
|
46
|
+
const other = issues.issues.filter(
|
|
47
|
+
(i) => !missing.includes(i) && !unrecognized.includes(i)
|
|
48
|
+
);
|
|
49
|
+
if (missing.length) {
|
|
50
|
+
parts.push(
|
|
51
|
+
`Missing required parameter${missing.length > 1 ? "s" : ""}: ${missing.map((m) => formatPath(m.path)).join(", ")}`
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
if (unrecognized.length) {
|
|
55
|
+
parts.push(
|
|
56
|
+
`Unrecognized parameter${unrecognized.length > 1 ? "s" : ""}: ${unrecognized.map((u) => u.message).join(", ")}`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
for (const issue of other) {
|
|
60
|
+
const path = formatPath(issue.path);
|
|
61
|
+
parts.push(`${path ? path + ": " : ""}${issue.message}`);
|
|
62
|
+
}
|
|
63
|
+
return `${toolName} failed due to the following ${parts.length > 1 ? "issues" : "issue"}:
|
|
64
|
+
${parts.join("\n")}`;
|
|
65
|
+
}
|
|
66
|
+
function formatPath(path) {
|
|
67
|
+
return path.map((p, i) => typeof p === "number" ? `[${p}]` : i > 0 ? `.${p}` : p).join("");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export {
|
|
71
|
+
zodToJsonSchema,
|
|
72
|
+
registerZodToJsonSchema,
|
|
73
|
+
formatZodValidationError
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=chunk-3SK5GCI6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/zod.ts"],"sourcesContent":["/**\n * Zod integration utilities. Users bring their own `zod` dependency — these\n * helpers accept duck-typed schemas so we don't force a hard dependency.\n */\n\nexport type JsonSchemaType = Record<string, unknown>;\n\n/**\n * Minimal interface matching Zod v4's safeParse return. Allows noumen to\n * validate tool input without depending on zod directly.\n */\nexport interface SafeParseResult {\n success: boolean;\n data?: unknown;\n error?: {\n issues: Array<{\n code: string;\n path: (string | number)[];\n message: string;\n }>;\n };\n}\n\nexport interface ZodLikeSchema {\n safeParse(data: unknown): SafeParseResult;\n}\n\nconst cache = new WeakMap<object, JsonSchemaType>();\n\n/**\n * Convert a Zod v4 schema to JSON Schema. Caches by schema identity.\n * Requires `zod/v4` to be installed — calls its native `toJSONSchema`.\n */\nexport function zodToJsonSchema(schema: ZodLikeSchema): JsonSchemaType {\n const hit = cache.get(schema);\n if (hit) return hit;\n\n const zod = (schema as unknown as { _zod?: unknown })._zod\n ? schema\n : undefined;\n\n if (!zod) {\n throw new Error(\n \"zodToJsonSchema requires a Zod v4 schema. Install zod and pass a z.object(…) schema.\",\n );\n }\n\n let toJSONSchema: ((s: unknown) => JsonSchemaType) | undefined;\n try {\n // Dynamic import isn't possible synchronously, so we look for the\n // schema's own conversion method first (Zod v4 attaches _toJSONSchema).\n const sAny = schema as unknown as Record<string, unknown>;\n if (typeof sAny._toJSONSchema === \"function\") {\n const result = sAny._toJSONSchema() as JsonSchemaType;\n cache.set(schema, result);\n return result;\n }\n // Fallback: try the module-level toJSONSchema from zod/v4\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n toJSONSchema = (globalThis as unknown as Record<string, unknown>)\n .__noumen_toJSONSchema as typeof toJSONSchema;\n } catch {\n // not available\n }\n\n if (toJSONSchema) {\n const result = toJSONSchema(schema) as JsonSchemaType;\n cache.set(schema, result);\n return result;\n }\n\n throw new Error(\n \"Could not convert Zod schema to JSON Schema. \" +\n \"Call `registerZodToJsonSchema(toJSONSchema)` from zod/v4 or upgrade to Zod v4.\",\n );\n}\n\n/**\n * Register the `toJSONSchema` function from `zod/v4` so `zodToJsonSchema` can use it.\n *\n * ```ts\n * import { toJSONSchema } from \"zod/v4\";\n * import { registerZodToJsonSchema } from \"noumen\";\n * registerZodToJsonSchema(toJSONSchema);\n * ```\n */\nexport function registerZodToJsonSchema(\n fn: (schema: unknown) => JsonSchemaType,\n): void {\n (globalThis as unknown as Record<string, unknown>).__noumen_toJSONSchema = fn;\n}\n\n/**\n * Format a Zod validation error into a human-readable string suitable\n * for feeding back to the model as a tool_result error.\n */\nexport function formatZodValidationError(\n toolName: string,\n issues: SafeParseResult[\"error\"],\n): string {\n if (!issues || !issues.issues.length) {\n return `${toolName}: validation failed with unknown error`;\n }\n\n const parts: string[] = [];\n\n const missing = issues.issues.filter(\n (i) => i.code === \"invalid_type\" && i.message.includes(\"required\"),\n );\n const unrecognized = issues.issues.filter(\n (i) => i.code === \"unrecognized_keys\",\n );\n const other = issues.issues.filter(\n (i) =>\n !missing.includes(i) && !unrecognized.includes(i),\n );\n\n if (missing.length) {\n parts.push(\n `Missing required parameter${missing.length > 1 ? \"s\" : \"\"}: ${missing.map((m) => formatPath(m.path)).join(\", \")}`,\n );\n }\n if (unrecognized.length) {\n parts.push(\n `Unrecognized parameter${unrecognized.length > 1 ? \"s\" : \"\"}: ${unrecognized.map((u) => u.message).join(\", \")}`,\n );\n }\n for (const issue of other) {\n const path = formatPath(issue.path);\n parts.push(`${path ? path + \": \" : \"\"}${issue.message}`);\n }\n\n return `${toolName} failed due to the following ${parts.length > 1 ? \"issues\" : \"issue\"}:\\n${parts.join(\"\\n\")}`;\n}\n\nfunction formatPath(path: (string | number)[]): string {\n return path\n .map((p, i) => (typeof p === \"number\" ? `[${p}]` : i > 0 ? `.${p}` : p))\n .join(\"\");\n}\n"],"mappings":";AA2BA,IAAM,QAAQ,oBAAI,QAAgC;AAM3C,SAAS,gBAAgB,QAAuC;AACrE,QAAM,MAAM,MAAM,IAAI,MAAM;AAC5B,MAAI,IAAK,QAAO;AAEhB,QAAM,MAAO,OAAyC,OAClD,SACA;AAEJ,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI;AACJ,MAAI;AAGF,UAAM,OAAO;AACb,QAAI,OAAO,KAAK,kBAAkB,YAAY;AAC5C,YAAM,SAAS,KAAK,cAAc;AAClC,YAAM,IAAI,QAAQ,MAAM;AACxB,aAAO;AAAA,IACT;AAGA,mBAAgB,WACb;AAAA,EACL,QAAQ;AAAA,EAER;AAEA,MAAI,cAAc;AAChB,UAAM,SAAS,aAAa,MAAM;AAClC,UAAM,IAAI,QAAQ,MAAM;AACxB,WAAO;AAAA,EACT;AAEA,QAAM,IAAI;AAAA,IACR;AAAA,EAEF;AACF;AAWO,SAAS,wBACd,IACM;AACN,EAAC,WAAkD,wBAAwB;AAC7E;AAMO,SAAS,yBACd,UACA,QACQ;AACR,MAAI,CAAC,UAAU,CAAC,OAAO,OAAO,QAAQ;AACpC,WAAO,GAAG,QAAQ;AAAA,EACpB;AAEA,QAAM,QAAkB,CAAC;AAEzB,QAAM,UAAU,OAAO,OAAO;AAAA,IAC5B,CAAC,MAAM,EAAE,SAAS,kBAAkB,EAAE,QAAQ,SAAS,UAAU;AAAA,EACnE;AACA,QAAM,eAAe,OAAO,OAAO;AAAA,IACjC,CAAC,MAAM,EAAE,SAAS;AAAA,EACpB;AACA,QAAM,QAAQ,OAAO,OAAO;AAAA,IAC1B,CAAC,MACC,CAAC,QAAQ,SAAS,CAAC,KAAK,CAAC,aAAa,SAAS,CAAC;AAAA,EACpD;AAEA,MAAI,QAAQ,QAAQ;AAClB,UAAM;AAAA,MACJ,6BAA6B,QAAQ,SAAS,IAAI,MAAM,EAAE,KAAK,QAAQ,IAAI,CAAC,MAAM,WAAW,EAAE,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC;AAAA,IAClH;AAAA,EACF;AACA,MAAI,aAAa,QAAQ;AACvB,UAAM;AAAA,MACJ,yBAAyB,aAAa,SAAS,IAAI,MAAM,EAAE,KAAK,aAAa,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;AAAA,IAC/G;AAAA,EACF;AACA,aAAW,SAAS,OAAO;AACzB,UAAM,OAAO,WAAW,MAAM,IAAI;AAClC,UAAM,KAAK,GAAG,OAAO,OAAO,OAAO,EAAE,GAAG,MAAM,OAAO,EAAE;AAAA,EACzD;AAEA,SAAO,GAAG,QAAQ,gCAAgC,MAAM,SAAS,IAAI,WAAW,OAAO;AAAA,EAAM,MAAM,KAAK,IAAI,CAAC;AAC/G;AAEA,SAAS,WAAW,MAAmC;AACrD,SAAO,KACJ,IAAI,CAAC,GAAG,MAAO,OAAO,MAAM,WAAW,IAAI,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAE,EACtE,KAAK,EAAE;AACZ;","names":[]}
|