llmz 0.0.2 → 0.0.5
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/chat.d.ts +17 -0
- package/dist/chunk-3U57H7GT.js +608 -0
- package/dist/{chunk-RB2L33ZR.js → chunk-4EWY34YA.js} +24 -24
- package/dist/{chunk-R2N2UUKC.cjs → chunk-4I7UPBLN.cjs} +14 -8
- package/dist/{chunk-YPOOKE3A.cjs → chunk-4QTK5ALH.cjs} +59 -28
- package/dist/{chunk-BKGPO722.cjs → chunk-5NVNEEYW.cjs} +55 -55
- package/dist/{chunk-DFZ6GX5C.js → chunk-5TRUJES5.js} +1 -1
- package/dist/{chunk-E2B5DRIC.cjs → chunk-6WT5VZBG.cjs} +362 -26
- package/dist/{chunk-7S3UY52U.js → chunk-7WRN4E42.js} +36 -8
- package/dist/{chunk-E5W3P7EO.cjs → chunk-EJRCDWBA.cjs} +64 -7
- package/dist/{chunk-VP6WWAE2.cjs → chunk-FIVFS4HG.cjs} +2 -2
- package/dist/{chunk-3T465BEW.js → chunk-HP7RKM25.js} +63 -6
- package/dist/{chunk-YUDUY7XW.cjs → chunk-HYVKY3W6.cjs} +23 -24
- package/dist/{chunk-PQN6HW7A.cjs → chunk-IKSIOIIP.cjs} +3 -3
- package/dist/{chunk-ZUAFUOUR.cjs → chunk-JDABP4SD.cjs} +3 -3
- package/dist/{chunk-RJHDQL4C.js → chunk-JKVVQN2P.js} +1 -1
- package/dist/{chunk-MSTBEKOQ.js → chunk-JQBT7UWN.js} +3 -3
- package/dist/{chunk-BOLDQGES.cjs → chunk-KMZDFWYZ.cjs} +3 -3
- package/dist/chunk-MU4LFVY7.cjs +608 -0
- package/dist/{chunk-7FIPXMZR.js → chunk-ORQP26SZ.js} +1 -1
- package/dist/{chunk-ENFB45AI.cjs → chunk-P7J2WCBB.cjs} +7 -7
- package/dist/{chunk-DILHJIMP.js → chunk-QBXIE6EY.js} +49 -18
- package/dist/{chunk-UVSOAH2H.js → chunk-QT4QF3YA.js} +1 -1
- package/dist/{chunk-6QDFMQHA.js → chunk-S6FOL2HY.js} +8 -2
- package/dist/{chunk-ZSRC3TN4.js → chunk-UNMKB2DA.js} +9 -10
- package/dist/{chunk-3CGLDS5T.cjs → chunk-UQOBUJIQ.cjs} +38 -10
- package/dist/{chunk-QPSUMPLP.js → chunk-WLUVY5QU.js} +345 -9
- package/dist/citations.d.ts +63 -0
- package/dist/component-R2Y74VUI.js +16 -0
- package/dist/component-TSNW3SC7.cjs +16 -0
- package/dist/component.d.ts +26 -17
- package/dist/component.default.d.ts +314 -8
- package/dist/context.d.ts +9 -6
- package/dist/dual-modes-UHNDHNIF.cjs +12 -0
- package/dist/dual-modes-ZUQKPJFH.js +12 -0
- package/dist/exit-KJ4COC5N.cjs +8 -0
- package/dist/exit-OIYZLBVJ.js +8 -0
- package/dist/exit.d.ts +6 -0
- package/dist/getter.d.ts +1 -1
- package/dist/index.cjs +256 -160
- package/dist/index.d.ts +7 -4
- package/dist/index.js +242 -146
- package/dist/{jsx-CJ2RBODH.js → jsx-AEHVFB3L.js} +2 -3
- package/dist/jsx-AJAXBWFE.cjs +13 -0
- package/dist/llmz-VDA4M42R.cjs +604 -0
- package/dist/llmz-YE5N54IU.js +604 -0
- package/dist/llmz.d.ts +8 -10
- package/dist/snapshots.d.ts +9 -1
- package/dist/tool-LY77IWV2.js +11 -0
- package/dist/tool-SWJYOR2Z.cjs +11 -0
- package/dist/tool.d.ts +34 -9
- package/dist/truncator-NYN7BGKJ.cjs +10 -0
- package/dist/truncator-WAL2GCUY.js +10 -0
- package/dist/types.d.ts +9 -1
- package/dist/typings-AIV2OASX.js +10 -0
- package/dist/typings-XR6CYHW4.cjs +10 -0
- package/dist/{utils-TS23YJPE.js → utils-L5GLCS3C.js} +2 -3
- package/dist/utils-QC4I2L6R.cjs +37 -0
- package/dist/vm-GJ5R72AP.cjs +12 -0
- package/dist/vm-ZUQOSRRM.js +12 -0
- package/dist/vm.d.ts +1 -1
- package/package.json +8 -6
- package/dist/chunk-A7BDFLAE.cjs +0 -30
- package/dist/chunk-C2TSWGYC.cjs +0 -91
- package/dist/chunk-Q4DEJGXD.js +0 -344
- package/dist/chunk-QZGFCB4T.cjs +0 -344
- package/dist/chunk-UG2GCPHF.js +0 -91
- package/dist/chunk-YSQDPG26.js +0 -30
- package/dist/component-DWBRHLEN.cjs +0 -9
- package/dist/component-R3ZAVXUC.js +0 -9
- package/dist/dual-modes-2VDEOJ5D.js +0 -13
- package/dist/dual-modes-3MH5N6RY.cjs +0 -13
- package/dist/exit-GYMXZZ4I.js +0 -9
- package/dist/exit-PQHMJEOG.cjs +0 -9
- package/dist/jsx-PPLE5YTB.cjs +0 -14
- package/dist/llmz-EGTGPSTX.cjs +0 -1049
- package/dist/llmz-WY74UVE3.js +0 -1049
- package/dist/tool-AY47ML65.cjs +0 -12
- package/dist/tool-WVIPESKN.js +0 -12
- package/dist/truncator-MTONQESU.js +0 -11
- package/dist/truncator-ZKPOW2I3.cjs +0 -11
- package/dist/typings-HTYLRNIC.js +0 -11
- package/dist/typings-QRJGGNUM.cjs +0 -11
- package/dist/utils-UR4IMUHC.cjs +0 -38
- package/dist/vm-4JFSZAMR.cjs +0 -13
- package/dist/vm-SMMA664M.js +0 -13
- package/patches/source-map-js@1.2.1.patch +0 -16
package/dist/tool.d.ts
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
-
import { type JSONSchema } from '@bpinternal/zui';
|
|
1
|
+
import { type JSONSchema, TypeOf } from '@bpinternal/zui';
|
|
2
2
|
import { ZuiType } from './types.js';
|
|
3
|
-
|
|
3
|
+
type ToolRetryInput<I> = {
|
|
4
|
+
input: I;
|
|
5
|
+
attempt: number;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
};
|
|
8
|
+
export type ToolRetryFn<I> = (args: ToolRetryInput<I>) => boolean | Promise<boolean>;
|
|
9
|
+
type IsObject<T> = T extends object ? (T extends Function ? false : true) : false;
|
|
10
|
+
type SmartPartial<T> = IsObject<T> extends true ? Partial<T> : T;
|
|
11
|
+
type ToolCallContext = {
|
|
12
|
+
callId: string;
|
|
13
|
+
};
|
|
14
|
+
export declare class Tool<I extends ZuiType = ZuiType, O extends ZuiType = ZuiType> {
|
|
4
15
|
private _staticInputValues?;
|
|
5
16
|
name: string;
|
|
6
17
|
aliases: string[];
|
|
@@ -8,23 +19,37 @@ export declare class Tool<I = unknown, O = unknown> {
|
|
|
8
19
|
metadata: Record<string, unknown>;
|
|
9
20
|
input?: JSONSchema;
|
|
10
21
|
output?: JSONSchema;
|
|
11
|
-
|
|
22
|
+
retry?: ToolRetryFn<TypeOf<I>>;
|
|
23
|
+
MAX_RETRIES: number;
|
|
24
|
+
setStaticInputValues(values: SmartPartial<TypeOf<I>>): this;
|
|
12
25
|
get zInput(): import("@bpinternal/zui").ZodTypeAny;
|
|
13
26
|
get zOutput(): import("@bpinternal/zui").ZodTypeAny | import("@bpinternal/zui").ZodVoid;
|
|
14
27
|
rename(name: string): this;
|
|
15
|
-
clone
|
|
28
|
+
clone<IX extends ZuiType = I, OX extends ZuiType = O>(props?: Partial<{
|
|
29
|
+
name: string;
|
|
30
|
+
aliases?: string[];
|
|
31
|
+
description?: string;
|
|
32
|
+
metadata?: Record<string, unknown>;
|
|
33
|
+
input: IX | ((original: I | undefined) => IX);
|
|
34
|
+
output: OX | ((original: O | undefined) => OX);
|
|
35
|
+
staticInputValues?: SmartPartial<TypeOf<IX>>;
|
|
36
|
+
handler: (args: TypeOf<IX>, ctx: ToolCallContext) => Promise<TypeOf<OX>>;
|
|
37
|
+
retry: ToolRetryFn<TypeOf<IX>>;
|
|
38
|
+
}>): Tool<IX, OX>;
|
|
16
39
|
private _handler;
|
|
17
40
|
constructor(props: {
|
|
18
41
|
name: string;
|
|
19
42
|
aliases?: string[];
|
|
20
43
|
description?: string;
|
|
21
44
|
metadata?: Record<string, unknown>;
|
|
22
|
-
input?:
|
|
23
|
-
output?:
|
|
24
|
-
staticInputValues?: Partial<I
|
|
25
|
-
handler: (args: I) => Promise<O
|
|
45
|
+
input?: I;
|
|
46
|
+
output?: O;
|
|
47
|
+
staticInputValues?: Partial<TypeOf<I>>;
|
|
48
|
+
handler: (args: TypeOf<I>, ctx: ToolCallContext) => Promise<TypeOf<O>>;
|
|
49
|
+
retry?: ToolRetryFn<TypeOf<I>>;
|
|
26
50
|
});
|
|
27
|
-
execute(input: I): Promise<O
|
|
51
|
+
execute(input: TypeOf<I>, ctx: ToolCallContext): Promise<TypeOf<O>>;
|
|
28
52
|
getTypings(): Promise<string>;
|
|
29
53
|
static withUniqueNames: (tools: Tool<any, any>[]) => Tool<any, any>[];
|
|
30
54
|
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkFIVFS4HGcjs = require('./chunk-FIVFS4HG.cjs');
|
|
5
|
+
require('./chunk-P7J2WCBB.cjs');
|
|
6
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.truncateWrappedContent = _chunkFIVFS4HGcjs.truncateWrappedContent; exports.wrapContent = _chunkFIVFS4HGcjs.wrapContent;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Iteration, type Context } from './context.js';
|
|
2
2
|
import { type SnapshotSignal, type VMSignal } from './errors.js';
|
|
3
|
+
import { ExitResult } from './exit.js';
|
|
3
4
|
import { type Snapshot } from './snapshots.js';
|
|
4
5
|
export declare namespace Traces {
|
|
5
6
|
type Comment = TraceTemplate<'comment', {
|
|
@@ -13,6 +14,7 @@ export declare namespace Traces {
|
|
|
13
14
|
type ToolCall = TraceTemplate<'tool_call', {
|
|
14
15
|
success: true;
|
|
15
16
|
tool_name: string;
|
|
17
|
+
tool_call_id: string;
|
|
16
18
|
object?: string;
|
|
17
19
|
input: any;
|
|
18
20
|
output: any;
|
|
@@ -20,6 +22,7 @@ export declare namespace Traces {
|
|
|
20
22
|
} | {
|
|
21
23
|
success: false;
|
|
22
24
|
tool_name: string;
|
|
25
|
+
tool_call_id: string;
|
|
23
26
|
object?: string;
|
|
24
27
|
input: any;
|
|
25
28
|
error: any;
|
|
@@ -28,6 +31,7 @@ export declare namespace Traces {
|
|
|
28
31
|
type ToolSlow = TraceTemplate<'tool_slow', {
|
|
29
32
|
tool_name: string;
|
|
30
33
|
object?: string;
|
|
34
|
+
tool_call_id: string;
|
|
31
35
|
input: any;
|
|
32
36
|
duration: number;
|
|
33
37
|
}>;
|
|
@@ -47,6 +51,9 @@ export declare namespace Traces {
|
|
|
47
51
|
message: string;
|
|
48
52
|
stackTrace: string;
|
|
49
53
|
}>;
|
|
54
|
+
type LLMCallStart = TraceTemplate<'llm_call_started', {
|
|
55
|
+
model: string;
|
|
56
|
+
}>;
|
|
50
57
|
type LLMCallSuccess = TraceTemplate<'llm_call_success', {
|
|
51
58
|
model: string;
|
|
52
59
|
code: string;
|
|
@@ -66,7 +73,7 @@ export declare namespace Traces {
|
|
|
66
73
|
started_at: number;
|
|
67
74
|
ended_at?: number;
|
|
68
75
|
} & Content;
|
|
69
|
-
type Trace = Comment | Log | ToolCall | ToolSlow | PropertyMutation | YieldTrace | LLMCallSuccess | ThinkSignal | CodeExecution | CodeExecutionException | InvalidCodeExceptionTrace | AbortTrace;
|
|
76
|
+
type Trace = Comment | Log | ToolCall | ToolSlow | PropertyMutation | YieldTrace | LLMCallStart | LLMCallSuccess | ThinkSignal | CodeExecution | CodeExecutionException | InvalidCodeExceptionTrace | AbortTrace;
|
|
70
77
|
}
|
|
71
78
|
export type Trace = Traces.Trace;
|
|
72
79
|
export type VMExecutionResult = {
|
|
@@ -98,6 +105,7 @@ export type SuccessExecutionResult = {
|
|
|
98
105
|
status: 'success';
|
|
99
106
|
iterations: Iteration[];
|
|
100
107
|
context: Context;
|
|
108
|
+
result: ExitResult;
|
|
101
109
|
};
|
|
102
110
|
export type PartialExecutionResult = {
|
|
103
111
|
status: 'interrupted';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkHYVKY3W6cjs = require('./chunk-HYVKY3W6.cjs');
|
|
4
|
+
require('./chunk-JDABP4SD.cjs');
|
|
5
|
+
require('./chunk-IKSIOIIP.cjs');
|
|
6
|
+
require('./chunk-P7J2WCBB.cjs');
|
|
7
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.getTypings = _chunkHYVKY3W6cjs.getTypings;
|
|
@@ -15,9 +15,8 @@ import {
|
|
|
15
15
|
toPropertyKey,
|
|
16
16
|
toValidFunctionName,
|
|
17
17
|
toValidObjectName
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-YSQDPG26.js";
|
|
18
|
+
} from "./chunk-5TRUJES5.js";
|
|
19
|
+
import "./chunk-7WRN4E42.js";
|
|
21
20
|
export {
|
|
22
21
|
Identifier,
|
|
23
22
|
Tokens,
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkP7J2WCBBcjs = require('./chunk-P7J2WCBB.cjs');
|
|
19
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
exports.Identifier = _chunkP7J2WCBBcjs.Identifier; exports.Tokens = _chunkP7J2WCBBcjs.Tokens; exports.awaitObject = _chunkP7J2WCBBcjs.awaitObject; exports.convertObjectToZuiLiterals = _chunkP7J2WCBBcjs.convertObjectToZuiLiterals; exports.escapeString = _chunkP7J2WCBBcjs.escapeString; exports.getMultilineComment = _chunkP7J2WCBBcjs.getMultilineComment; exports.getTokenizer = _chunkP7J2WCBBcjs.getTokenizer; exports.init = _chunkP7J2WCBBcjs.init; exports.isJsonSchema = _chunkP7J2WCBBcjs.isJsonSchema; exports.isValidIdentifier = _chunkP7J2WCBBcjs.isValidIdentifier; exports.isValidMessageName = _chunkP7J2WCBBcjs.isValidMessageName; exports.isValidSchema = _chunkP7J2WCBBcjs.isValidSchema; exports.stripInvalidIdentifiers = _chunkP7J2WCBBcjs.stripInvalidIdentifiers; exports.toPropertyKey = _chunkP7J2WCBBcjs.toPropertyKey; exports.toValidFunctionName = _chunkP7J2WCBBcjs.toValidFunctionName; exports.toValidObjectName = _chunkP7J2WCBBcjs.toValidObjectName;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunk5NVNEEYWcjs = require('./chunk-5NVNEEYW.cjs');
|
|
5
|
+
require('./chunk-JDABP4SD.cjs');
|
|
6
|
+
require('./chunk-IKSIOIIP.cjs');
|
|
7
|
+
require('./chunk-KMZDFWYZ.cjs');
|
|
8
|
+
require('./chunk-UQOBUJIQ.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.USE_ISOLATED_VM = _chunk5NVNEEYWcjs.USE_ISOLATED_VM; exports.runAsyncFunction = _chunk5NVNEEYWcjs.runAsyncFunction;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
USE_ISOLATED_VM,
|
|
3
|
+
runAsyncFunction
|
|
4
|
+
} from "./chunk-4EWY34YA.js";
|
|
5
|
+
import "./chunk-JKVVQN2P.js";
|
|
6
|
+
import "./chunk-JQBT7UWN.js";
|
|
7
|
+
import "./chunk-ORQP26SZ.js";
|
|
8
|
+
import "./chunk-7WRN4E42.js";
|
|
9
|
+
export {
|
|
10
|
+
USE_ISOLATED_VM,
|
|
11
|
+
runAsyncFunction
|
|
12
|
+
};
|
package/dist/vm.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Trace, VMExecutionResult } from './types.js';
|
|
2
2
|
export declare const USE_ISOLATED_VM: boolean;
|
|
3
|
-
export declare function runAsyncFunction(context: any, code: string, traces?: Trace[], signal?: AbortSignal | null): Promise<VMExecutionResult>;
|
|
3
|
+
export declare function runAsyncFunction(context: any, code: string, traces?: Trace[], signal?: AbortSignal | null, timeout?: number): Promise<VMExecutionResult>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "llmz",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "LLMz – An LLM-native Typescript VM built on top of Zui",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.5",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"
|
|
14
|
+
"generate": "pnpm build:markdown",
|
|
15
|
+
"build": "tsup && pnpm tsc --emitDeclarationOnly",
|
|
15
16
|
"watch": "tsup --watch",
|
|
16
17
|
"test": "vitest run --config vitest.config.ts",
|
|
17
18
|
"test:update": "vitest -u run --config vitest.config.ts",
|
|
18
19
|
"test:watch": "vitest --config vitest.config.ts",
|
|
19
|
-
"build:markdown": "
|
|
20
|
+
"build:markdown": "node --loader ts-node/esm ./scripts/compile-markdown.mts"
|
|
20
21
|
},
|
|
21
22
|
"keywords": [],
|
|
22
23
|
"author": "",
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"@babel/standalone": "^7.26.4",
|
|
31
32
|
"@babel/traverse": "^7.26.4",
|
|
32
33
|
"@babel/types": "^7.26.3",
|
|
34
|
+
"@botpress/client": "1.15.1",
|
|
33
35
|
"bytes": "^3.1.2",
|
|
34
36
|
"exponential-backoff": "^3.1.1",
|
|
35
37
|
"handlebars": "^4.7.8",
|
|
@@ -41,7 +43,6 @@
|
|
|
41
43
|
"ulid": "^2.3.0"
|
|
42
44
|
},
|
|
43
45
|
"devDependencies": {
|
|
44
|
-
"@botpress/client": "1.12.0",
|
|
45
46
|
"@microsoft/api-extractor": "^7.49.0",
|
|
46
47
|
"@types/babel__core": "^7.20.5",
|
|
47
48
|
"@types/babel__generator": "^7.6.8",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"@types/lodash-es": "^4.17.12",
|
|
52
53
|
"@types/ms": "^0.7.34",
|
|
53
54
|
"@types/node": "^18.19.67",
|
|
55
|
+
"chalk": "^4.1.2",
|
|
54
56
|
"diff": "^8.0.1",
|
|
55
57
|
"dotenv": "^16.4.4",
|
|
56
58
|
"esbuild": "^0.16.12",
|
|
@@ -61,9 +63,9 @@
|
|
|
61
63
|
"tsx": "^4.19.2"
|
|
62
64
|
},
|
|
63
65
|
"peerDependencies": {
|
|
64
|
-
"@botpress/cognitive": "
|
|
66
|
+
"@botpress/cognitive": "0.1.23",
|
|
65
67
|
"@bpinternal/thicktoken": "^1.0.5",
|
|
66
|
-
"@bpinternal/zui": "^0.22.
|
|
68
|
+
"@bpinternal/zui": "^0.22.5"
|
|
67
69
|
},
|
|
68
70
|
"dependenciesMeta": {
|
|
69
71
|
"@bpinternal/zui": {
|
package/dist/chunk-A7BDFLAE.cjs
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
-
mod
|
|
25
|
-
));
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exports.__commonJS = __commonJS; exports.__toESM = __toESM;
|
package/dist/chunk-C2TSWGYC.cjs
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkQZGFCB4Tcjs = require('./chunk-QZGFCB4T.cjs');
|
|
5
|
-
|
|
6
|
-
// src/snapshots.ts
|
|
7
|
-
var _ulid = require('ulid');
|
|
8
|
-
var MAX_SNAPSHOT_SIZE_BYTES = 4e3;
|
|
9
|
-
var Snapshot = class _Snapshot {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
#status;
|
|
16
|
-
get status() {
|
|
17
|
-
return Object.freeze({ ...this.#status });
|
|
18
|
-
}
|
|
19
|
-
constructor(props) {
|
|
20
|
-
this.id = props.id;
|
|
21
|
-
this.stack = props.stack;
|
|
22
|
-
this.reason = props.reason;
|
|
23
|
-
this.variables = props.variables;
|
|
24
|
-
this.toolCall = props.toolCall;
|
|
25
|
-
this.#status = props.status;
|
|
26
|
-
}
|
|
27
|
-
static fromSignal(signal) {
|
|
28
|
-
const variables = Object.entries(signal.variables).map(([name, value]) => {
|
|
29
|
-
const type = _chunkQZGFCB4Tcjs.extractType.call(void 0, value);
|
|
30
|
-
const bytes = JSON.stringify(value || "").length;
|
|
31
|
-
const truncated = bytes > MAX_SNAPSHOT_SIZE_BYTES;
|
|
32
|
-
return truncated ? { name, type, bytes, truncated: true, preview: _nullishCoalesce(_chunkQZGFCB4Tcjs.inspect.call(void 0, value, name), () => ( "N/A")) } : { name, type, bytes, truncated: false, value };
|
|
33
|
-
});
|
|
34
|
-
return new _Snapshot({
|
|
35
|
-
id: "snapshot_" + _ulid.ulid.call(void 0, ),
|
|
36
|
-
reason: signal.message,
|
|
37
|
-
stack: signal.truncatedCode,
|
|
38
|
-
variables,
|
|
39
|
-
toolCall: signal.toolCall,
|
|
40
|
-
status: { type: "pending" }
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
toJSON() {
|
|
44
|
-
return {
|
|
45
|
-
id: this.id,
|
|
46
|
-
reason: this.reason,
|
|
47
|
-
stack: this.stack,
|
|
48
|
-
variables: this.variables,
|
|
49
|
-
toolCall: this.toolCall
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
static fromJSON(json) {
|
|
53
|
-
return new _Snapshot({
|
|
54
|
-
id: json.id,
|
|
55
|
-
reason: json.reason,
|
|
56
|
-
stack: json.stack,
|
|
57
|
-
variables: json.variables,
|
|
58
|
-
toolCall: json.toolCall,
|
|
59
|
-
status: json.status
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
clone() {
|
|
63
|
-
return new _Snapshot({
|
|
64
|
-
id: this.id,
|
|
65
|
-
reason: this.reason,
|
|
66
|
-
stack: this.stack,
|
|
67
|
-
variables: this.variables,
|
|
68
|
-
toolCall: this.toolCall,
|
|
69
|
-
status: this.#status
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
reset() {
|
|
73
|
-
this.#status = { type: "pending" };
|
|
74
|
-
}
|
|
75
|
-
resolve(value) {
|
|
76
|
-
if (this.#status.type !== "pending") {
|
|
77
|
-
throw new Error(`Cannot resolve snapshot because it is already settled: ${this.#status.type}`);
|
|
78
|
-
}
|
|
79
|
-
this.#status = { type: "resolved", value };
|
|
80
|
-
}
|
|
81
|
-
reject(error) {
|
|
82
|
-
if (this.#status.type !== "pending") {
|
|
83
|
-
throw new Error(`Cannot reject snapshot because it is already settled: ${this.#status.type}`);
|
|
84
|
-
}
|
|
85
|
-
this.#status = { type: "rejected", error };
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
exports.Snapshot = Snapshot;
|