@deepagents/context 6.1.2 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -1
- package/dist/browser.js +9 -2
- package/dist/browser.js.map +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1187 -516
- package/dist/index.js.map +4 -4
- package/dist/lib/agent.d.ts +78 -37
- package/dist/lib/agent.d.ts.map +1 -1
- package/dist/lib/chat.d.ts +16 -17
- package/dist/lib/chat.d.ts.map +1 -1
- package/dist/lib/engine.d.ts.map +1 -1
- package/dist/lib/fragments/plan-shared.d.ts +46 -0
- package/dist/lib/fragments/plan-shared.d.ts.map +1 -0
- package/dist/lib/fragments/plan.d.ts.map +1 -1
- package/dist/lib/fragments/socratic-inquiry.d.ts +4 -0
- package/dist/lib/fragments/socratic-inquiry.d.ts.map +1 -0
- package/dist/lib/fragments/socratic-plan.d.ts +13 -0
- package/dist/lib/fragments/socratic-plan.d.ts.map +1 -0
- package/dist/lib/fragments/socratic.d.ts +2 -5
- package/dist/lib/fragments/socratic.d.ts.map +1 -1
- package/dist/lib/sandbox/agent-os-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/apple-container-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/bash-tool.d.ts +1 -1
- package/dist/lib/sandbox/bash-tool.d.ts.map +1 -1
- package/dist/lib/sandbox/cli-process.d.ts +6 -0
- package/dist/lib/sandbox/cli-process.d.ts.map +1 -1
- package/dist/lib/sandbox/container-engine.d.ts +1 -0
- package/dist/lib/sandbox/container-engine.d.ts.map +1 -1
- package/dist/lib/sandbox/container-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/daytona-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/docker-sandbox.d.ts +7 -0
- package/dist/lib/sandbox/docker-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/index.d.ts +1 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -1
- package/dist/lib/sandbox/microsandbox-sandbox.d.ts +13 -17
- package/dist/lib/sandbox/microsandbox-sandbox.d.ts.map +1 -1
- package/dist/lib/sandbox/read-file-tool/binary.d.ts +13 -0
- package/dist/lib/sandbox/read-file-tool/binary.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/format.d.ts +17 -0
- package/dist/lib/sandbox/read-file-tool/format.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/image.d.ts +4 -0
- package/dist/lib/sandbox/read-file-tool/image.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/index.d.ts +6 -0
- package/dist/lib/sandbox/read-file-tool/index.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/ooxml.d.ts +4 -0
- package/dist/lib/sandbox/read-file-tool/ooxml.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/pdf.d.ts +4 -0
- package/dist/lib/sandbox/read-file-tool/pdf.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file-tool/text.d.ts +10 -0
- package/dist/lib/sandbox/read-file-tool/text.d.ts.map +1 -0
- package/dist/lib/sandbox/read-file.d.ts +8 -0
- package/dist/lib/sandbox/read-file.d.ts.map +1 -0
- package/dist/lib/sandbox/types.d.ts +19 -5
- package/dist/lib/sandbox/types.d.ts.map +1 -1
- package/dist/lib/sandbox/virtual-sandbox.d.ts.map +1 -1
- package/dist/lib/stream-buffer.d.ts +1 -1
- package/dist/lib/stream-buffer.d.ts.map +1 -1
- package/dist/lib/telemetry/console-telemetry.d.ts +0 -1
- package/dist/lib/telemetry/console-telemetry.d.ts.map +1 -1
- package/dist/lib/telemetry/file/file-telemetry.d.ts +5 -3
- package/dist/lib/telemetry/file/file-telemetry.d.ts.map +1 -1
- package/dist/lib/telemetry/file/index.js +16 -11
- package/dist/lib/telemetry/file/index.js.map +2 -2
- package/dist/lib/telemetry/index.js +3 -4
- package/dist/lib/telemetry/index.js.map +2 -2
- package/dist/lib/telemetry/safe-serialize.d.ts +2 -2
- package/dist/lib/telemetry/safe-serialize.d.ts.map +1 -1
- package/dist/lib/tracing/index.js +4 -4
- package/dist/lib/tracing/index.js.map +2 -2
- package/package.json +9 -8
|
@@ -12,6 +12,7 @@ export * from './strace/file-changes.ts';
|
|
|
12
12
|
export * from './gcs.ts';
|
|
13
13
|
export * from './installers/index.ts';
|
|
14
14
|
export * from './microsandbox-sandbox.ts';
|
|
15
|
+
export * from './read-file.ts';
|
|
15
16
|
export * from './shell-quote.ts';
|
|
16
17
|
export * from './subcommand.ts';
|
|
17
18
|
export * from './types.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,UAAU,CAAC;AACzB,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
|
|
@@ -3,24 +3,16 @@ import type { DisposableSandbox, SandboxReadinessOptions } from './types.ts';
|
|
|
3
3
|
export declare const MICROSANDBOX_DEFAULT_DESTINATION = "/workspace";
|
|
4
4
|
export interface MicrosandboxSandboxOptions extends SandboxReadinessOptions {
|
|
5
5
|
/**
|
|
6
|
-
* Stable sandbox name. When provided,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
6
|
+
* Stable sandbox name. When provided, the SDK connects to the running
|
|
7
|
+
* sandbox of this name, resumes it if stopped (rootfs state intact), or
|
|
8
|
+
* creates it. `dispose()` follows SDK lifecycle ownership and never removes
|
|
9
|
+
* a named sandbox. Configure the builder with `detached(true)` when the
|
|
10
|
+
* sandbox must outlive the client that creates or resumes it.
|
|
11
11
|
*
|
|
12
12
|
* When omitted, an ephemeral sandbox with a generated name is created and
|
|
13
13
|
* fully removed on `dispose()`.
|
|
14
14
|
*/
|
|
15
15
|
name?: string;
|
|
16
|
-
/** OCI image to boot (default `'bash:5.3-alpine3.24'`). Ignored when attaching. */
|
|
17
|
-
image?: string;
|
|
18
|
-
/** Number of virtual CPUs. */
|
|
19
|
-
cpus?: number;
|
|
20
|
-
/** Memory in MiB. */
|
|
21
|
-
memory?: number;
|
|
22
|
-
/** Environment variables baked into the sandbox at boot. */
|
|
23
|
-
env?: Record<string, string>;
|
|
24
16
|
/**
|
|
25
17
|
* Default working directory, created at boot (default `'/workspace'`).
|
|
26
18
|
* Microsandbox images default to `/`, and common images ship no
|
|
@@ -36,10 +28,14 @@ export interface MicrosandboxSandboxOptions extends SandboxReadinessOptions {
|
|
|
36
28
|
/** Per-command timeout in milliseconds for `executeCommand`. */
|
|
37
29
|
commandTimeout?: number;
|
|
38
30
|
/**
|
|
39
|
-
*
|
|
40
|
-
* (
|
|
41
|
-
*
|
|
42
|
-
*
|
|
31
|
+
* Fluent access to the SDK builder for everything the factory does not
|
|
32
|
+
* own: image (default `'bash:5.3-alpine3.24'`), cpus, memory, env,
|
|
33
|
+
* volumes, network policy, secrets, user, idle timeout, ….
|
|
34
|
+
*
|
|
35
|
+
* The factory applies its own setters after this callback — `workdir`,
|
|
36
|
+
* the persistence implied by `name`, and the required Bash shell — so
|
|
37
|
+
* `configure` cannot change what the lifecycle logic relies on. Runs on
|
|
38
|
+
* every connect; existing sandbox configuration wins when connecting.
|
|
43
39
|
*/
|
|
44
40
|
configure?: (builder: SandboxBuilder) => SandboxBuilder;
|
|
45
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"microsandbox-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/microsandbox-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,cAAc,
|
|
1
|
+
{"version":3,"file":"microsandbox-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/microsandbox-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,cAAc,EACf,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAEV,iBAAiB,EAIjB,uBAAuB,EAExB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,gCAAgC,eAAe,CAAC;AAU7D,MAAM,WAAW,0BAA2B,SAAQ,uBAAuB;IACzE;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;OASG;IACH,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,cAAc,CAAC;CACzD;AAED;;;;GAIG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;gBACrC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAK3C;AAED,qBAAa,6BAA8B,SAAQ,wBAAwB;gBAC7D,KAAK,CAAC,EAAE,KAAK;CAO1B;AAED,qBAAa,yBAA0B,SAAQ,wBAAwB;gBACzD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI3C;AAED,qBAAa,wBAAyB,SAAQ,wBAAwB;gBACxD,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK;CAI3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,iBAAiB,CAAC,CAgE5B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bytes no earlier format claimed but that are not text either: stills the
|
|
3
|
+
* model cannot view (HEIC), video, audio, or anything with a NUL byte up
|
|
4
|
+
* front. Refusing here keeps decoded garbage out of the prompt and tells the
|
|
5
|
+
* model how to turn the file into something readFile does render.
|
|
6
|
+
*/
|
|
7
|
+
export declare const binaryFileFormat: {
|
|
8
|
+
read({ bytes, path: filePath, options }: import("./format.ts").FileFormatInput): {
|
|
9
|
+
type: "error-text";
|
|
10
|
+
value: string;
|
|
11
|
+
} | undefined;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=binary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binary.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/binary.ts"],"names":[],"mappings":"AASA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB;;;;;CAcP,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ToolResultOutput } from '@ai-sdk/provider-utils';
|
|
2
|
+
import type { ToolExecutionOptions } from 'ai';
|
|
3
|
+
import type { ReadFileToolInput } from '../types.ts';
|
|
4
|
+
export interface FileFormatInput extends ReadFileToolInput {
|
|
5
|
+
bytes: Uint8Array;
|
|
6
|
+
options: ToolExecutionOptions<Record<string, unknown>>;
|
|
7
|
+
}
|
|
8
|
+
export interface FileFormat {
|
|
9
|
+
read(input: FileFormatInput): ToolResultOutput | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function formatBytes(bytes: number): string;
|
|
12
|
+
export declare function attachment(input: FileFormatInput, { label, maxBytes, mediaType, }: {
|
|
13
|
+
label: string;
|
|
14
|
+
maxBytes: number;
|
|
15
|
+
mediaType: string;
|
|
16
|
+
}): ToolResultOutput;
|
|
17
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,IAAI,CAAC;AAG/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,gBAAgB,GAAG,SAAS,CAAC;CAC5D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED,wBAAgB,UAAU,CACxB,KAAK,EAAE,eAAe,EACtB,EACE,KAAK,EACL,QAAQ,EACR,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,GACA,gBAAgB,CAsBlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/image.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,eAAe;;CAcN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAgCnE,wBAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,WAAW,GACZ,EAAE;IACD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,YAAY,CA6Bf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ooxml.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/ooxml.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,eAAe;;CAYN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/pdf.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;CAaJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/lib/sandbox/read-file-tool/text.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;;CA6BL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReadFileContent, ReadFileEncoding, ReadFileOptions } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Shape the bytes a backend read into what `Sandbox.readFile` promised for
|
|
4
|
+
* `options.encoding`. Every backend reads bytes and ends here, so this is the
|
|
5
|
+
* one place the conditional return type is asserted.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readFileContent<Encoding extends ReadFileEncoding>(bytes: Uint8Array, options: ReadFileOptions<Encoding> | undefined): ReadFileContent<Encoding>;
|
|
8
|
+
//# sourceMappingURL=read-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-file.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/read-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,eAAe,EAChB,MAAM,YAAY,CAAC;AAIpB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,gBAAgB,EAC/D,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,SAAS,GAC7C,eAAe,CAAC,QAAQ,CAAC,CAI3B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ToolResultOutput } from '@ai-sdk/provider-utils';
|
|
1
2
|
import type { Tool } from 'ai';
|
|
2
3
|
export interface CommandResult {
|
|
3
4
|
stdout: string;
|
|
@@ -18,17 +19,29 @@ export interface CommandResult {
|
|
|
18
19
|
export interface ExecuteCommandOptions {
|
|
19
20
|
signal?: AbortSignal;
|
|
20
21
|
}
|
|
22
|
+
export type ReadFileEncoding = 'utf-8' | 'binary';
|
|
23
|
+
export interface ReadFileOptions<Encoding extends ReadFileEncoding = 'utf-8'> {
|
|
24
|
+
/** `'utf-8'` (default) decodes text; `'binary'` returns the raw bytes. */
|
|
25
|
+
encoding?: Encoding;
|
|
26
|
+
}
|
|
27
|
+
export type ReadFileContent<Encoding extends ReadFileEncoding> = Encoding extends 'binary' ? Uint8Array : string;
|
|
21
28
|
export interface Sandbox {
|
|
22
29
|
/**
|
|
23
30
|
* Execute `command` with Bash semantics. Process-backed implementations must
|
|
24
31
|
* invoke `bash -lc` directly and fail clearly when Bash is unavailable.
|
|
25
32
|
*/
|
|
26
33
|
executeCommand(command: string, options?: ExecuteCommandOptions): Promise<CommandResult>;
|
|
27
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Read the file at `path` as UTF-8 text, or as raw bytes with
|
|
36
|
+
* `{ encoding: 'binary' }`. Rejects when nothing readable is at `path`.
|
|
37
|
+
*/
|
|
38
|
+
readFile<Encoding extends ReadFileEncoding = 'utf-8'>(path: string, options?: ReadFileOptions<Encoding>): Promise<ReadFileContent<Encoding>>;
|
|
28
39
|
writeFiles(files: Array<{
|
|
29
40
|
path: string;
|
|
30
41
|
content: string | Buffer;
|
|
31
42
|
}>): Promise<void>;
|
|
43
|
+
/** Whether a file or directory exists at `path`; resolves `false` (never rejects) when missing. */
|
|
44
|
+
exists(path: string): Promise<boolean>;
|
|
32
45
|
}
|
|
33
46
|
export interface SpawnOptions {
|
|
34
47
|
signal?: AbortSignal;
|
|
@@ -99,9 +112,10 @@ export interface BashToolInput {
|
|
|
99
112
|
export type BashToolResult = CommandResult;
|
|
100
113
|
export interface ReadFileToolInput {
|
|
101
114
|
path: string;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
115
|
+
/** 1-based line number to start at for text files. */
|
|
116
|
+
offset?: number;
|
|
117
|
+
/** Number of text lines to return from `offset`. */
|
|
118
|
+
limit?: number;
|
|
105
119
|
}
|
|
106
120
|
export interface WriteFileToolInput {
|
|
107
121
|
path: string;
|
|
@@ -143,7 +157,7 @@ export interface CreateBashToolOptions {
|
|
|
143
157
|
experimentalTeeTransform?: boolean;
|
|
144
158
|
}
|
|
145
159
|
export type WrappedBashTool = Tool<BashToolInput, BashToolResult>;
|
|
146
|
-
export type ReadFileTool = Tool<ReadFileToolInput,
|
|
160
|
+
export type ReadFileTool = Tool<ReadFileToolInput, ToolResultOutput>;
|
|
147
161
|
export type WriteFileTool = Tool<WriteFileToolInput, WriteFileToolResult>;
|
|
148
162
|
export interface BashToolkit {
|
|
149
163
|
bash: WrappedBashTool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC,CAAC;CACJ;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,cAAc,CACZ,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE/B,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,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,iBAAiB,EAAE,gBAAgB,CAAC,CAAC;AACrE,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,kBAAkB,EAAE,mBAAmB,CAAC,CAAC;AAE1E,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,eAAe,CAAC;IACtB,KAAK,EAAE;QACL,IAAI,EAAE,eAAe,CAAC;QACtB,QAAQ,EAAE,YAAY,CAAC;QACvB,SAAS,EAAE,aAAa,CAAC;KAC1B,CAAC;IACF,OAAO,EAAE,iBAAiB,CAAC;CAC5B;AAED,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/virtual-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"virtual-sandbox.d.ts","sourceRoot":"","sources":["../../../src/lib/sandbox/virtual-sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AAGnB,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE7E,MAAM,WAAW,2BAA4B,SAAQ,uBAAuB;IAC1E,EAAE,EAAE,WAAW,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACvC,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CA2D5B"}
|
|
@@ -6,7 +6,7 @@ export interface PersistedWriterOptions {
|
|
|
6
6
|
streamId: string;
|
|
7
7
|
/**
|
|
8
8
|
* How chunks are persisted relative to the stream:
|
|
9
|
-
* - 'buffered' (default): batch up to `flushSize` chunks
|
|
9
|
+
* - 'buffered' (default): batch up to `flushSize` chunks; data events flush promptly
|
|
10
10
|
* - 'immediate': persist each chunk before forwarding (higher latency, no data loss)
|
|
11
11
|
*/
|
|
12
12
|
strategy?: 'buffered' | 'immediate';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-buffer.d.ts","sourceRoot":"","sources":["../../src/lib/stream-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAEhD,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK7E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACpC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"stream-buffer.d.ts","sourceRoot":"","sources":["../../src/lib/stream-buffer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,IAAI,CAAC;AAEhD,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK7E,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IACpC,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,eAAe,CAAC,CAmG1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console-telemetry.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/console-telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAQpC,MAAM,WAAW,uBAAuB;IACtC,
|
|
1
|
+
{"version":3,"file":"console-telemetry.d.ts","sourceRoot":"","sources":["../../../src/lib/telemetry/console-telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAQpC,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,OAAO,CAAC,CAAC;CACzC;AAED,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,uBAA4B,GACpC,SAAS,CAYX"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Telemetry } from 'ai';
|
|
2
2
|
export interface FileTelemetryOptions {
|
|
3
3
|
path: string;
|
|
4
|
-
includeTimestamp?: boolean;
|
|
5
|
-
append?: boolean;
|
|
6
4
|
onWriteError?: (error: unknown) => void | PromiseLike<void>;
|
|
7
5
|
}
|
|
8
|
-
export declare function createFileTelemetry(options: FileTelemetryOptions): Telemetry
|
|
6
|
+
export declare function createFileTelemetry(options: FileTelemetryOptions): Telemetry & {
|
|
7
|
+
readonly traces: {
|
|
8
|
+
readonly path: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
9
11
|
//# sourceMappingURL=file-telemetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-telemetry.d.ts","sourceRoot":"","sources":["../../../../src/lib/telemetry/file/file-telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"file-telemetry.d.ts","sourceRoot":"","sources":["../../../../src/lib/telemetry/file/file-telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAWpC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;CAC7D;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,oBAAoB,GAC5B,SAAS,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAiC5D"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// packages/context/src/lib/telemetry/file/file-telemetry.ts
|
|
2
|
-
import { appendFile, mkdir
|
|
3
|
-
import { dirname } from "node:path";
|
|
2
|
+
import { appendFile, mkdir } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
4
5
|
|
|
5
6
|
// packages/context/src/lib/telemetry/redact-telemetry-event.ts
|
|
6
7
|
var REDACTED = "[Redacted]";
|
|
@@ -154,9 +155,9 @@ function createTelemetryIntegration(write) {
|
|
|
154
155
|
}
|
|
155
156
|
|
|
156
157
|
// packages/context/src/lib/telemetry/safe-serialize.ts
|
|
157
|
-
function createTelemetryLogRecord(event, data
|
|
158
|
+
function createTelemetryLogRecord(event, data) {
|
|
158
159
|
return {
|
|
159
|
-
|
|
160
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
160
161
|
event,
|
|
161
162
|
data: normalizeTelemetryValue(data)
|
|
162
163
|
};
|
|
@@ -277,29 +278,33 @@ function errorMessage(error) {
|
|
|
277
278
|
|
|
278
279
|
// packages/context/src/lib/telemetry/file/file-telemetry.ts
|
|
279
280
|
function createFileTelemetry(options) {
|
|
280
|
-
const
|
|
281
|
+
const path = resolve(options.path);
|
|
281
282
|
const reportWriteError = async (error) => {
|
|
282
283
|
try {
|
|
283
284
|
await options.onWriteError?.(error);
|
|
284
285
|
} catch {
|
|
285
286
|
}
|
|
286
287
|
};
|
|
287
|
-
const initialize = mkdir(dirname(
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
const initialize = mkdir(dirname(path), { recursive: true }).then(
|
|
289
|
+
() => void 0,
|
|
290
|
+
reportWriteError
|
|
291
|
+
);
|
|
290
292
|
let queue = initialize;
|
|
291
293
|
const write = (_level, event, data) => {
|
|
292
|
-
const record = createTelemetryLogRecord(event, data
|
|
294
|
+
const record = createTelemetryLogRecord(event, data);
|
|
293
295
|
const line = `${stringifyTelemetryLogRecord(record)}
|
|
294
296
|
`;
|
|
295
297
|
const pendingWrite = queue.then(async () => {
|
|
296
|
-
await appendFile(
|
|
298
|
+
await appendFile(path, line);
|
|
297
299
|
});
|
|
298
300
|
queue = pendingWrite.catch(() => {
|
|
299
301
|
});
|
|
300
302
|
return pendingWrite.catch(reportWriteError);
|
|
301
303
|
};
|
|
302
|
-
return
|
|
304
|
+
return {
|
|
305
|
+
...createTelemetryIntegration(write),
|
|
306
|
+
traces: { path: pathToFileURL(path).href }
|
|
307
|
+
};
|
|
303
308
|
}
|
|
304
309
|
export {
|
|
305
310
|
createFileTelemetry
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/telemetry/file/file-telemetry.ts", "../../../../src/lib/telemetry/redact-telemetry-event.ts", "../../../../src/lib/telemetry/create-telemetry-integration.ts", "../../../../src/lib/telemetry/safe-serialize.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Telemetry } from 'ai';\nimport { appendFile, mkdir, writeFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\n\nimport { createTelemetryIntegration } from '../create-telemetry-integration.ts';\nimport {\n createTelemetryLogRecord,\n stringifyTelemetryLogRecord,\n} from '../safe-serialize.ts';\n\nexport interface FileTelemetryOptions {\n path: string;\n includeTimestamp?: boolean;\n append?: boolean;\n onWriteError?: (error: unknown) => void | PromiseLike<void>;\n}\n\nexport function createFileTelemetry(options: FileTelemetryOptions): Telemetry {\n const includeTimestamp = options.includeTimestamp ?? true;\n const reportWriteError = async (error: unknown): Promise<void> => {\n try {\n await options.onWriteError?.(error);\n } catch {\n // Telemetry must never affect the observed operation.\n }\n };\n const initialize = mkdir(dirname(options.path), { recursive: true })\n .then(async () => {\n if (options.append === false) await writeFile(options.path, '');\n })\n .catch(reportWriteError);\n let queue: Promise<void> = initialize;\n\n const write = (\n _level: 'log' | 'error',\n event: string,\n data: unknown,\n ): Promise<void> => {\n const record = createTelemetryLogRecord(event, data, includeTimestamp);\n const line = `${stringifyTelemetryLogRecord(record)}\\n`;\n const pendingWrite = queue.then(async () => {\n await appendFile(options.path, line);\n });\n queue = pendingWrite.catch(() => {});\n return pendingWrite.catch(reportWriteError);\n };\n\n return createTelemetryIntegration(write);\n}\n", "const REDACTED = '[Redacted]';\n\nconst INPUT_FIELDS = [\n 'system',\n 'prompt',\n 'instructions',\n 'messages',\n 'tools',\n 'toolChoice',\n 'activeTools',\n 'toolOrder',\n 'headers',\n 'providerOptions',\n 'runtimeContext',\n 'toolsContext',\n 'toolContext',\n 'promptMessages',\n 'stepTools',\n 'stepToolChoice',\n 'request',\n 'values',\n 'value',\n 'query',\n 'documents',\n 'schema',\n 'schemaDescription',\n 'schemaName',\n] as const;\n\nconst OUTPUT_FIELDS = [\n 'content',\n 'text',\n 'reasoning',\n 'reasoningText',\n 'files',\n 'sources',\n 'toolCalls',\n 'staticToolCalls',\n 'dynamicToolCalls',\n 'toolResults',\n 'staticToolResults',\n 'dynamicToolResults',\n 'response',\n 'responseMessages',\n 'providerMetadata',\n 'steps',\n 'finalStep',\n 'object',\n 'objectText',\n 'embedding',\n 'embeddings',\n 'ranking',\n 'rankings',\n 'results',\n 'error',\n] as const;\n\nconst OUTPUT_SPECIFICATION_EVENTS = new Set([\n 'onStart',\n 'onStepStart',\n 'onObjectStepStart',\n]);\n\nexport function redactTelemetryEvent(event: string, data: unknown): unknown {\n if (!isRecord(data)) return data;\n const recordInputs = data.recordInputs !== false;\n const recordOutputs = data.recordOutputs !== false;\n if (recordInputs && recordOutputs) return data;\n\n const redacted = { ...data };\n if (!recordInputs) {\n redactFields(redacted, INPUT_FIELDS);\n if (\n OUTPUT_SPECIFICATION_EVENTS.has(event) &&\n Object.hasOwn(redacted, 'output')\n ) {\n redacted.output = REDACTED;\n }\n if (Object.hasOwn(redacted, 'toolCall')) {\n redacted.toolCall = redactToolCallInput(redacted.toolCall);\n }\n if (Object.hasOwn(redacted, 'toolOutput')) {\n redacted.toolOutput = redactToolOutput(redacted.toolOutput, true, false);\n }\n if (Object.hasOwn(redacted, 'steps')) {\n redacted.steps = redactStepInputs(redacted.steps);\n }\n if (Object.hasOwn(redacted, 'finalStep')) {\n redacted.finalStep = redactStepInputs(redacted.finalStep);\n }\n }\n if (!recordOutputs) {\n redactFields(redacted, OUTPUT_FIELDS);\n if (\n !OUTPUT_SPECIFICATION_EVENTS.has(event) &&\n Object.hasOwn(redacted, 'output')\n ) {\n redacted.output = REDACTED;\n }\n if (Object.hasOwn(redacted, 'toolOutput')) {\n redacted.toolOutput = redactToolOutput(redacted.toolOutput, false, true);\n }\n }\n return redacted;\n}\n\nfunction redactFields(\n value: Record<string, unknown>,\n fields: readonly string[],\n): void {\n for (const field of fields) {\n if (Object.hasOwn(value, field)) value[field] = REDACTED;\n }\n}\n\nfunction redactToolCallInput(value: unknown): unknown {\n if (!isRecord(value) || !Object.hasOwn(value, 'input')) return value;\n return { ...value, input: REDACTED };\n}\n\nfunction redactToolOutput(\n value: unknown,\n redactInput: boolean,\n redactOutput: boolean,\n): unknown {\n if (!isRecord(value)) return value;\n const redacted = { ...value };\n if (redactInput && Object.hasOwn(redacted, 'input')) {\n redacted.input = REDACTED;\n }\n if (redactOutput) {\n if (Object.hasOwn(redacted, 'output')) redacted.output = REDACTED;\n if (Object.hasOwn(redacted, 'error')) redacted.error = REDACTED;\n }\n return redacted;\n}\n\nfunction redactStepInputs(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(redactStepInputs);\n if (!isRecord(value)) return value;\n const redacted = { ...value };\n redactFields(redacted, INPUT_FIELDS);\n return redacted;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n", "import type { Telemetry } from 'ai';\n\nimport { redactTelemetryEvent } from './redact-telemetry-event.ts';\n\ntype TelemetryLogLevel = 'log' | 'error';\n\ntype TelemetryEventWriter = (\n level: TelemetryLogLevel,\n event: string,\n data: unknown,\n) => void | PromiseLike<void>;\n\nexport function createTelemetryIntegration(\n write: TelemetryEventWriter,\n): Telemetry {\n const emit = (level: TelemetryLogLevel, event: string, data: unknown) =>\n write(level, event, redactTelemetryEvent(event, data));\n const log = (event: string, data: unknown) => emit('log', event, data);\n\n return {\n onStart: (event) => log('onStart', event),\n onStepStart: (event) => log('onStepStart', event),\n onLanguageModelCallStart: (event) => log('onLanguageModelCallStart', event),\n onLanguageModelCallEnd: (event) => log('onLanguageModelCallEnd', event),\n onToolExecutionStart: (event) => log('onToolExecutionStart', event),\n onToolExecutionEnd: (event) => log('onToolExecutionEnd', event),\n onStepEnd: (event) => log('onStepEnd', event),\n onObjectStepStart: (event) => log('onObjectStepStart', event),\n onObjectStepEnd: (event) => log('onObjectStepEnd', event),\n onEmbedStart: (event) => log('onEmbedStart', event),\n onEmbedEnd: (event) => log('onEmbedEnd', event),\n onRerankStart: (event) => log('onRerankStart', event),\n onRerankEnd: (event) => log('onRerankEnd', event),\n onEnd: (event) => log('onEnd', event),\n onAbort: (event) => log('onAbort', event),\n onError: (error) => emit('error', 'onError', error),\n };\n}\n", "export interface TelemetryLogRecord {\n timestamp?: string;\n event: string;\n data: unknown;\n}\n\nexport function createTelemetryLogRecord(\n event: string,\n data: unknown,\n includeTimestamp: boolean,\n): TelemetryLogRecord {\n return {\n ...(includeTimestamp ? { timestamp: new Date().toISOString() } : {}),\n event,\n data: normalizeTelemetryValue(data),\n };\n}\n\nexport function stringifyTelemetryLogRecord(\n record: TelemetryLogRecord,\n indentation?: number,\n): string {\n return JSON.stringify(record, null, indentation);\n}\n\nfunction normalizeTelemetryValue(value: unknown): unknown {\n return normalize(value, new WeakSet());\n}\n\nfunction normalize(value: unknown, ancestors: WeakSet<object>): unknown {\n if (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'boolean'\n ) {\n return value;\n }\n if (typeof value === 'number') {\n if (Number.isNaN(value)) return '[NaN]';\n if (value === Infinity) return '[Infinity]';\n if (value === -Infinity) return '[-Infinity]';\n if (Object.is(value, -0)) return '[-0]';\n return value;\n }\n if (typeof value === 'undefined') return '[Undefined]';\n if (typeof value === 'bigint') return `${value}n`;\n if (typeof value === 'symbol') return String(value);\n if (typeof value === 'function') {\n return `[Function${value.name ? ` ${value.name}` : ''}]`;\n }\n if (ancestors.has(value)) return '[Circular]';\n\n ancestors.add(value);\n try {\n if (value instanceof Error) return normalizeError(value, ancestors);\n if (value instanceof Date) {\n return Number.isNaN(value.getTime())\n ? '[Invalid Date]'\n : value.toISOString();\n }\n if (value instanceof RegExp) return String(value);\n if (value instanceof URL) return value.href;\n if (value instanceof Map) {\n return {\n $type: 'Map',\n entries: [...value.entries()].map(([key, entryValue]) => [\n normalize(key, ancestors),\n normalize(entryValue, ancestors),\n ]),\n };\n }\n if (value instanceof Set) {\n return {\n $type: 'Set',\n values: [...value].map((entry) => normalize(entry, ancestors)),\n };\n }\n if (value instanceof ArrayBuffer) {\n return {\n $type: 'ArrayBuffer',\n values: [...new Uint8Array(value)],\n };\n }\n if (ArrayBuffer.isView(value)) {\n const bytes = new Uint8Array(\n value.buffer,\n value.byteOffset,\n value.byteLength,\n );\n return {\n $type: value.constructor.name,\n values: [...bytes],\n };\n }\n if (Array.isArray(value)) {\n return value.map((entry) => normalize(entry, ancestors));\n }\n return normalizeObject(value, ancestors);\n } catch (error) {\n return `[Unserializable: ${errorMessage(error)}]`;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction normalizeError(\n error: Error,\n ancestors: WeakSet<object>,\n): Record<string, unknown> {\n const normalized = Object.create(null) as Record<string, unknown>;\n normalized.name = error.name;\n normalized.message = error.message;\n if (error.stack != null) normalized.stack = error.stack;\n if (error.cause !== undefined) {\n normalized.cause = normalize(error.cause, ancestors);\n }\n for (const [key, descriptor] of Object.entries(\n Object.getOwnPropertyDescriptors(error),\n )) {\n if (['name', 'message', 'stack', 'cause'].includes(key)) continue;\n normalized[key] = normalizeDescriptor(descriptor, ancestors);\n }\n return normalized;\n}\n\nfunction normalizeObject(\n value: object,\n ancestors: WeakSet<object>,\n): Record<string, unknown> {\n const normalized = Object.create(null) as Record<string, unknown>;\n const prototype = Object.getPrototypeOf(value) as {\n constructor?: { name?: string };\n } | null;\n const typeName = prototype?.constructor?.name;\n if (typeName && typeName !== 'Object') normalized.$type = typeName;\n\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor == null) continue;\n normalized[typeof key === 'symbol' ? String(key) : key] =\n normalizeDescriptor(descriptor, ancestors);\n }\n return normalized;\n}\n\nfunction normalizeDescriptor(\n descriptor: PropertyDescriptor,\n ancestors: WeakSet<object>,\n): unknown {\n if ('value' in descriptor) return normalize(descriptor.value, ancestors);\n const accessors = [\n descriptor.get == null ? null : 'Getter',\n descriptor.set == null ? null : 'Setter',\n ].filter(Boolean);\n return `[${accessors.join('/')}]`;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],
|
|
5
|
-
"mappings": ";AACA,SAAS,YAAY,
|
|
4
|
+
"sourcesContent": ["import type { Telemetry } from 'ai';\nimport { appendFile, mkdir } from 'node:fs/promises';\nimport { dirname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport { createTelemetryIntegration } from '../create-telemetry-integration.ts';\nimport {\n createTelemetryLogRecord,\n stringifyTelemetryLogRecord,\n} from '../safe-serialize.ts';\n\nexport interface FileTelemetryOptions {\n path: string;\n onWriteError?: (error: unknown) => void | PromiseLike<void>;\n}\n\nexport function createFileTelemetry(\n options: FileTelemetryOptions,\n): Telemetry & { readonly traces: { readonly path: string } } {\n const path = resolve(options.path);\n const reportWriteError = async (error: unknown): Promise<void> => {\n try {\n await options.onWriteError?.(error);\n } catch {\n // Telemetry must never affect the observed operation.\n }\n };\n const initialize = mkdir(dirname(path), { recursive: true }).then(\n () => undefined,\n reportWriteError,\n );\n let queue: Promise<void> = initialize;\n\n const write = (\n _level: 'log' | 'error',\n event: string,\n data: unknown,\n ): Promise<void> => {\n const record = createTelemetryLogRecord(event, data);\n const line = `${stringifyTelemetryLogRecord(record)}\\n`;\n const pendingWrite = queue.then(async () => {\n await appendFile(path, line);\n });\n queue = pendingWrite.catch(() => {});\n return pendingWrite.catch(reportWriteError);\n };\n\n return {\n ...createTelemetryIntegration(write),\n traces: { path: pathToFileURL(path).href },\n };\n}\n", "const REDACTED = '[Redacted]';\n\nconst INPUT_FIELDS = [\n 'system',\n 'prompt',\n 'instructions',\n 'messages',\n 'tools',\n 'toolChoice',\n 'activeTools',\n 'toolOrder',\n 'headers',\n 'providerOptions',\n 'runtimeContext',\n 'toolsContext',\n 'toolContext',\n 'promptMessages',\n 'stepTools',\n 'stepToolChoice',\n 'request',\n 'values',\n 'value',\n 'query',\n 'documents',\n 'schema',\n 'schemaDescription',\n 'schemaName',\n] as const;\n\nconst OUTPUT_FIELDS = [\n 'content',\n 'text',\n 'reasoning',\n 'reasoningText',\n 'files',\n 'sources',\n 'toolCalls',\n 'staticToolCalls',\n 'dynamicToolCalls',\n 'toolResults',\n 'staticToolResults',\n 'dynamicToolResults',\n 'response',\n 'responseMessages',\n 'providerMetadata',\n 'steps',\n 'finalStep',\n 'object',\n 'objectText',\n 'embedding',\n 'embeddings',\n 'ranking',\n 'rankings',\n 'results',\n 'error',\n] as const;\n\nconst OUTPUT_SPECIFICATION_EVENTS = new Set([\n 'onStart',\n 'onStepStart',\n 'onObjectStepStart',\n]);\n\nexport function redactTelemetryEvent(event: string, data: unknown): unknown {\n if (!isRecord(data)) return data;\n const recordInputs = data.recordInputs !== false;\n const recordOutputs = data.recordOutputs !== false;\n if (recordInputs && recordOutputs) return data;\n\n const redacted = { ...data };\n if (!recordInputs) {\n redactFields(redacted, INPUT_FIELDS);\n if (\n OUTPUT_SPECIFICATION_EVENTS.has(event) &&\n Object.hasOwn(redacted, 'output')\n ) {\n redacted.output = REDACTED;\n }\n if (Object.hasOwn(redacted, 'toolCall')) {\n redacted.toolCall = redactToolCallInput(redacted.toolCall);\n }\n if (Object.hasOwn(redacted, 'toolOutput')) {\n redacted.toolOutput = redactToolOutput(redacted.toolOutput, true, false);\n }\n if (Object.hasOwn(redacted, 'steps')) {\n redacted.steps = redactStepInputs(redacted.steps);\n }\n if (Object.hasOwn(redacted, 'finalStep')) {\n redacted.finalStep = redactStepInputs(redacted.finalStep);\n }\n }\n if (!recordOutputs) {\n redactFields(redacted, OUTPUT_FIELDS);\n if (\n !OUTPUT_SPECIFICATION_EVENTS.has(event) &&\n Object.hasOwn(redacted, 'output')\n ) {\n redacted.output = REDACTED;\n }\n if (Object.hasOwn(redacted, 'toolOutput')) {\n redacted.toolOutput = redactToolOutput(redacted.toolOutput, false, true);\n }\n }\n return redacted;\n}\n\nfunction redactFields(\n value: Record<string, unknown>,\n fields: readonly string[],\n): void {\n for (const field of fields) {\n if (Object.hasOwn(value, field)) value[field] = REDACTED;\n }\n}\n\nfunction redactToolCallInput(value: unknown): unknown {\n if (!isRecord(value) || !Object.hasOwn(value, 'input')) return value;\n return { ...value, input: REDACTED };\n}\n\nfunction redactToolOutput(\n value: unknown,\n redactInput: boolean,\n redactOutput: boolean,\n): unknown {\n if (!isRecord(value)) return value;\n const redacted = { ...value };\n if (redactInput && Object.hasOwn(redacted, 'input')) {\n redacted.input = REDACTED;\n }\n if (redactOutput) {\n if (Object.hasOwn(redacted, 'output')) redacted.output = REDACTED;\n if (Object.hasOwn(redacted, 'error')) redacted.error = REDACTED;\n }\n return redacted;\n}\n\nfunction redactStepInputs(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(redactStepInputs);\n if (!isRecord(value)) return value;\n const redacted = { ...value };\n redactFields(redacted, INPUT_FIELDS);\n return redacted;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n", "import type { Telemetry } from 'ai';\n\nimport { redactTelemetryEvent } from './redact-telemetry-event.ts';\n\ntype TelemetryLogLevel = 'log' | 'error';\n\ntype TelemetryEventWriter = (\n level: TelemetryLogLevel,\n event: string,\n data: unknown,\n) => void | PromiseLike<void>;\n\nexport function createTelemetryIntegration(\n write: TelemetryEventWriter,\n): Telemetry {\n const emit = (level: TelemetryLogLevel, event: string, data: unknown) =>\n write(level, event, redactTelemetryEvent(event, data));\n const log = (event: string, data: unknown) => emit('log', event, data);\n\n return {\n onStart: (event) => log('onStart', event),\n onStepStart: (event) => log('onStepStart', event),\n onLanguageModelCallStart: (event) => log('onLanguageModelCallStart', event),\n onLanguageModelCallEnd: (event) => log('onLanguageModelCallEnd', event),\n onToolExecutionStart: (event) => log('onToolExecutionStart', event),\n onToolExecutionEnd: (event) => log('onToolExecutionEnd', event),\n onStepEnd: (event) => log('onStepEnd', event),\n onObjectStepStart: (event) => log('onObjectStepStart', event),\n onObjectStepEnd: (event) => log('onObjectStepEnd', event),\n onEmbedStart: (event) => log('onEmbedStart', event),\n onEmbedEnd: (event) => log('onEmbedEnd', event),\n onRerankStart: (event) => log('onRerankStart', event),\n onRerankEnd: (event) => log('onRerankEnd', event),\n onEnd: (event) => log('onEnd', event),\n onAbort: (event) => log('onAbort', event),\n onError: (error) => emit('error', 'onError', error),\n };\n}\n", "export interface TelemetryLogRecord {\n timestamp: string;\n event: string;\n data: unknown;\n}\n\nexport function createTelemetryLogRecord(\n event: string,\n data: unknown,\n): TelemetryLogRecord {\n return {\n timestamp: new Date().toISOString(),\n event,\n data: normalizeTelemetryValue(data),\n };\n}\n\nexport function stringifyTelemetryLogRecord(\n record: TelemetryLogRecord,\n indentation?: number,\n): string {\n return JSON.stringify(record, null, indentation);\n}\n\nfunction normalizeTelemetryValue(value: unknown): unknown {\n return normalize(value, new WeakSet());\n}\n\nfunction normalize(value: unknown, ancestors: WeakSet<object>): unknown {\n if (\n value === null ||\n typeof value === 'string' ||\n typeof value === 'boolean'\n ) {\n return value;\n }\n if (typeof value === 'number') {\n if (Number.isNaN(value)) return '[NaN]';\n if (value === Infinity) return '[Infinity]';\n if (value === -Infinity) return '[-Infinity]';\n if (Object.is(value, -0)) return '[-0]';\n return value;\n }\n if (typeof value === 'undefined') return '[Undefined]';\n if (typeof value === 'bigint') return `${value}n`;\n if (typeof value === 'symbol') return String(value);\n if (typeof value === 'function') {\n return `[Function${value.name ? ` ${value.name}` : ''}]`;\n }\n if (ancestors.has(value)) return '[Circular]';\n\n ancestors.add(value);\n try {\n if (value instanceof Error) return normalizeError(value, ancestors);\n if (value instanceof Date) {\n return Number.isNaN(value.getTime())\n ? '[Invalid Date]'\n : value.toISOString();\n }\n if (value instanceof RegExp) return String(value);\n if (value instanceof URL) return value.href;\n if (value instanceof Map) {\n return {\n $type: 'Map',\n entries: [...value.entries()].map(([key, entryValue]) => [\n normalize(key, ancestors),\n normalize(entryValue, ancestors),\n ]),\n };\n }\n if (value instanceof Set) {\n return {\n $type: 'Set',\n values: [...value].map((entry) => normalize(entry, ancestors)),\n };\n }\n if (value instanceof ArrayBuffer) {\n return {\n $type: 'ArrayBuffer',\n values: [...new Uint8Array(value)],\n };\n }\n if (ArrayBuffer.isView(value)) {\n const bytes = new Uint8Array(\n value.buffer,\n value.byteOffset,\n value.byteLength,\n );\n return {\n $type: value.constructor.name,\n values: [...bytes],\n };\n }\n if (Array.isArray(value)) {\n return value.map((entry) => normalize(entry, ancestors));\n }\n return normalizeObject(value, ancestors);\n } catch (error) {\n return `[Unserializable: ${errorMessage(error)}]`;\n } finally {\n ancestors.delete(value);\n }\n}\n\nfunction normalizeError(\n error: Error,\n ancestors: WeakSet<object>,\n): Record<string, unknown> {\n const normalized = Object.create(null) as Record<string, unknown>;\n normalized.name = error.name;\n normalized.message = error.message;\n if (error.stack != null) normalized.stack = error.stack;\n if (error.cause !== undefined) {\n normalized.cause = normalize(error.cause, ancestors);\n }\n for (const [key, descriptor] of Object.entries(\n Object.getOwnPropertyDescriptors(error),\n )) {\n if (['name', 'message', 'stack', 'cause'].includes(key)) continue;\n normalized[key] = normalizeDescriptor(descriptor, ancestors);\n }\n return normalized;\n}\n\nfunction normalizeObject(\n value: object,\n ancestors: WeakSet<object>,\n): Record<string, unknown> {\n const normalized = Object.create(null) as Record<string, unknown>;\n const prototype = Object.getPrototypeOf(value) as {\n constructor?: { name?: string };\n } | null;\n const typeName = prototype?.constructor?.name;\n if (typeName && typeName !== 'Object') normalized.$type = typeName;\n\n for (const key of Reflect.ownKeys(value)) {\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n if (descriptor == null) continue;\n normalized[typeof key === 'symbol' ? String(key) : key] =\n normalizeDescriptor(descriptor, ancestors);\n }\n return normalized;\n}\n\nfunction normalizeDescriptor(\n descriptor: PropertyDescriptor,\n ancestors: WeakSet<object>,\n): unknown {\n if ('value' in descriptor) return normalize(descriptor.value, ancestors);\n const accessors = [\n descriptor.get == null ? null : 'Getter',\n descriptor.set == null ? null : 'Setter',\n ].filter(Boolean);\n return `[${accessors.join('/')}]`;\n}\n\nfunction errorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],
|
|
5
|
+
"mappings": ";AACA,SAAS,YAAY,aAAa;AAClC,SAAS,SAAS,eAAe;AACjC,SAAS,qBAAqB;;;ACH9B,IAAM,WAAW;AAEjB,IAAM,eAAe;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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
}
|
|
151
151
|
|
|
152
152
|
// packages/context/src/lib/telemetry/safe-serialize.ts
|
|
153
|
-
function createTelemetryLogRecord(event, data
|
|
153
|
+
function createTelemetryLogRecord(event, data) {
|
|
154
154
|
return {
|
|
155
|
-
|
|
155
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
156
156
|
event,
|
|
157
157
|
data: normalizeTelemetryValue(data)
|
|
158
158
|
};
|
|
@@ -274,10 +274,9 @@ function errorMessage(error) {
|
|
|
274
274
|
// packages/context/src/lib/telemetry/console-telemetry.ts
|
|
275
275
|
function createConsoleTelemetry(options = {}) {
|
|
276
276
|
const logger = options.logger ?? console;
|
|
277
|
-
const includeTimestamp = options.includeTimestamp ?? true;
|
|
278
277
|
const indentation = options.pretty ?? true ? 2 : void 0;
|
|
279
278
|
const write = (method, event, data) => {
|
|
280
|
-
const record = createTelemetryLogRecord(event, data
|
|
279
|
+
const record = createTelemetryLogRecord(event, data);
|
|
281
280
|
try {
|
|
282
281
|
logger[method](stringifyTelemetryLogRecord(record, indentation));
|
|
283
282
|
} catch {
|