llmz 0.9.0 → 1.0.2
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/DOCS.md +232 -1794
- package/ERRORS.md +101 -0
- package/README.md +96 -582
- package/dist/chat/chat.d.ts +63 -0
- package/dist/chat/component.d.ts +31 -0
- package/dist/chat/component.default.d.ts +58 -0
- package/dist/chat/response.d.ts +15 -0
- package/dist/compiler/compiler.d.ts +2 -7
- package/dist/compiler/plugins/dynamic-code.d.ts +7 -0
- package/dist/compiler/plugins/replace-comment.d.ts +2 -3
- package/dist/compiler/plugins/return-async.d.ts +5 -4
- package/dist/compiler/plugins/termination.d.ts +8 -0
- package/dist/compiler/plugins/tool-resolution.d.ts +4 -0
- package/dist/compiler/plugins/variable-extraction.d.ts +2 -8
- package/dist/component-CMFoCHyu.cjs +649 -0
- package/dist/component-DncqP4fB.js +614 -0
- package/dist/context.d.ts +71 -378
- package/dist/custom-client-C-WXvLD9.js +1655 -0
- package/dist/custom-client-Cgt9_0r1.cjs +1732 -0
- package/dist/custom-client.d.ts +12 -2
- package/dist/errors/catalog.d.ts +294 -0
- package/dist/errors/hooks.d.ts +2 -0
- package/dist/errors-C6ppQUZX.cjs +893 -0
- package/dist/errors-Crk5P8jo.js +636 -0
- package/dist/errors.d.ts +24 -36
- package/dist/execute-CiYvPs5Q.js +2061 -0
- package/dist/execute-DTTfacsi.cjs +2062 -0
- package/dist/{exit-DUM96DN1.cjs → exit-BOtKWPuT.cjs} +38 -28
- package/dist/{exit-CDdxDBRT.js → exit-DMPwCSba.js} +37 -27
- package/dist/exit.d.ts +19 -16
- package/dist/index.cjs +177 -1237
- package/dist/index.d.ts +25 -28
- package/dist/index.js +137 -1213
- package/dist/index.workerd.js +8974 -11145
- package/dist/inspect.d.ts +18 -4
- package/dist/inspection.d.ts +40 -0
- package/dist/native-0bq5ATZM.cjs +212 -0
- package/dist/native-n_718Z-T.js +177 -0
- package/dist/objects.d.ts +2 -57
- package/dist/prompts/native.d.ts +2 -0
- package/dist/prompts/prompt.d.ts +10 -101
- package/dist/quickjs-variant-21IO97PF.cjs +1080 -0
- package/dist/quickjs-variant-CtuGagsb.js +985 -0
- package/dist/result.d.ts +30 -861
- package/dist/runtime/execute.d.ts +3 -2
- package/dist/runtime/execution-activity.d.ts +11 -0
- package/dist/runtime/execution-diagnostics.d.ts +11 -0
- package/dist/runtime/execution-report.d.ts +51 -0
- package/dist/runtime/fixtures/chat.d.ts +8 -0
- package/dist/runtime/fixtures/long-search.d.ts +1 -1
- package/dist/runtime/fixtures/native-client.d.ts +33 -0
- package/dist/runtime/fixtures/protocol-languages.d.ts +1 -1
- package/dist/runtime/forced-inspection.d.ts +13 -0
- package/dist/runtime/forced-inspection.test.d.ts +1 -0
- package/dist/runtime/generate.d.ts +23 -20
- package/dist/runtime/generate.test.d.ts +1 -0
- package/dist/runtime/hook-provenance.test.d.ts +1 -0
- package/dist/runtime/inspection-hook.test.d.ts +1 -0
- package/dist/runtime/inspection-values.d.ts +14 -0
- package/dist/runtime/inspection-values.test.d.ts +1 -0
- package/dist/runtime/interruption-control-flow.test.d.ts +1 -0
- package/dist/runtime/interruption-settings.test.d.ts +1 -0
- package/dist/runtime/javascript-api.d.ts +62 -0
- package/dist/runtime/javascript-api.test.d.ts +1 -0
- package/dist/runtime/native-review.test.d.ts +1 -0
- package/dist/runtime/native-tools.d.ts +18 -0
- package/dist/runtime/native-tools.test.d.ts +1 -0
- package/dist/runtime/object-memory.test.d.ts +1 -0
- package/dist/runtime/single-tool.test.d.ts +1 -0
- package/dist/runtime/think-signal.test.d.ts +1 -0
- package/dist/runtime/token-budget.d.ts +22 -0
- package/dist/runtime/token-budget.test.d.ts +1 -0
- package/dist/runtime/tool-wrapper.d.ts +6 -5
- package/dist/runtime/traces.test.d.ts +1 -0
- package/dist/runtime/truncation.test.d.ts +1 -0
- package/dist/runtime/types.d.ts +47 -31
- package/dist/runtime/variable-recovery.test.d.ts +1 -0
- package/dist/runtime/vm-context.d.ts +6 -1
- package/dist/runtime/worker-completion.test.d.ts +1 -0
- package/dist/runtime-names.d.ts +4 -0
- package/dist/schema-CXlnbb3n.cjs +68 -0
- package/dist/schema-GE4ISPCR.js +45 -0
- package/dist/schema.d.ts +10 -0
- package/dist/schema.test.d.ts +1 -0
- package/dist/session/compactor.d.ts +51 -0
- package/dist/session/compactor.test.d.ts +1 -0
- package/dist/session/history.d.ts +36 -0
- package/dist/session/history.test.d.ts +1 -0
- package/dist/session/json.d.ts +3 -0
- package/dist/session/json.test.d.ts +1 -0
- package/dist/session/memory-codec.d.ts +9 -0
- package/dist/session/memory-codec.test.d.ts +1 -0
- package/dist/session/memory-render.d.ts +15 -0
- package/dist/session/memory-render.test.d.ts +1 -0
- package/dist/session/memory.d.ts +112 -0
- package/dist/session/memory.test.d.ts +1 -0
- package/dist/session/messages.d.ts +19 -0
- package/dist/session/messages.test.d.ts +1 -0
- package/dist/session/serialization.d.ts +36 -0
- package/dist/session/serialization.test.d.ts +1 -0
- package/dist/session/session-memory.test.d.ts +1 -0
- package/dist/session/session.d.ts +121 -0
- package/dist/session/session.test.d.ts +1 -0
- package/dist/session/speaker.test.d.ts +1 -0
- package/dist/{transcript.d.ts → session/transcript.d.ts} +4 -8
- package/dist/session/transcript.test.d.ts +1 -0
- package/dist/{tool-Bv8N4IPj.js → tool-DstssiAs.js} +144 -92
- package/dist/{tool-Dy6AJpJH.cjs → tool-_wK9hQOb.cjs} +146 -94
- package/dist/tool.d.ts +25 -17
- package/dist/truncate-BEKbdo3t.js +79 -0
- package/dist/truncate-uomAMGPs.cjs +102 -0
- package/dist/truncate.d.ts +24 -0
- package/dist/truncate.test.d.ts +1 -0
- package/dist/types.d.ts +33 -9
- package/dist/{typings-3lsqCbkn.cjs → typings-BA_XxAcY.cjs} +38 -193
- package/dist/{typings-CrBa7Tyy.js → typings-BEVDvtuk.js} +38 -175
- package/dist/typings-formatter.d.ts +1 -1
- package/dist/typings.d.ts +3 -0
- package/dist/{uniq-BYQ7GWwb.js → uniq-DfUeSNaX.js} +2 -2
- package/dist/{uniq-G872RWmE.cjs → uniq-DiXgysNV.cjs} +6 -18
- package/dist/{_baseIteratee-P_firB7b.js → utils-BOFzb8Ok.js} +1134 -16
- package/dist/{_baseIteratee-CF4qP2a8.cjs → utils-CTlsXvdj.cjs} +1281 -84
- package/dist/vm/drivers/node.d.ts +1 -1
- package/dist/vm/drivers/quickjs.d.ts +1 -1
- package/dist/vm/errors.d.ts +4 -4
- package/dist/vm/index.d.ts +3 -4
- package/dist/vm/instrument.d.ts +14 -6
- package/dist/vm/member-proxy.d.ts +4 -0
- package/dist/vm/member-proxy.test.d.ts +1 -0
- package/dist/vm/memory.test.d.ts +1 -0
- package/dist/vm/return-semantics.test.d.ts +1 -0
- package/dist/vm/types.d.ts +20 -3
- package/dist/{vm-BLsHw1da.js → vm-C7SfutHn.js} +1187 -180
- package/dist/{vm-D6s1zF6M.cjs → vm-gmekHc0i.cjs} +1221 -207
- package/package.json +13 -6
- package/dist/_baseForOwn-BfWDTL8L.cjs +0 -53
- package/dist/_baseForOwn-CFhWe_W6.js +0 -48
- package/dist/_getPrototype-CG7Dxrrz.js +0 -6
- package/dist/_getPrototype-DQDlNVVM.cjs +0 -10
- package/dist/_overArg-C5Hy7oCi.cjs +0 -196
- package/dist/_overArg-CRYbj1NH.js +0 -155
- package/dist/chat.d.ts +0 -401
- package/dist/common-BlRFtdf2.js +0 -807
- package/dist/common-BnvrDnIT.cjs +0 -860
- package/dist/compiler/plugins/track-tool-calls.d.ts +0 -33
- package/dist/compiler-C-OI9sim.cjs +0 -547
- package/dist/compiler-CW1VjQsn.js +0 -473
- package/dist/component-C6Agl2ns.cjs +0 -73
- package/dist/component-DGG7d_Mz.js +0 -44
- package/dist/component.d.ts +0 -88
- package/dist/component.default.d.ts +0 -278
- package/dist/custom-client-ChuZ63zp.js +0 -2658
- package/dist/custom-client-DAsGRnYc.cjs +0 -2729
- package/dist/dual-modes-DDkoCp3R.js +0 -3006
- package/dist/dual-modes-DPXiuvNe.cjs +0 -3090
- package/dist/errors-C962uJdS.cjs +0 -220
- package/dist/errors-Cg1G0Awu.js +0 -161
- package/dist/example-format.d.ts +0 -8
- package/dist/example.d.ts +0 -45
- package/dist/execute-BWcdv9so.js +0 -1059
- package/dist/execute-DM2-7y86.cjs +0 -1060
- package/dist/exit-parser.d.ts +0 -39
- package/dist/handlers.d.ts +0 -10
- package/dist/hoist.d.ts +0 -2
- package/dist/isEmpty-BhJRCqIF.js +0 -52
- package/dist/isEmpty-LY533Wmh.cjs +0 -57
- package/dist/isPlainObject-CSxXVKCk.cjs +0 -56
- package/dist/isPlainObject-D39AzPO2.js +0 -51
- package/dist/jsx-CIgdGGVs.js +0 -52
- package/dist/jsx-owqxrquU.cjs +0 -75
- package/dist/jsx.d.ts +0 -11
- package/dist/message-stream/index.d.ts +0 -9
- package/dist/message-stream/instructions.d.ts +0 -30
- package/dist/message-stream/normalizer.d.ts +0 -21
- package/dist/message-stream/parser.d.ts +0 -89
- package/dist/message-stream/registry.d.ts +0 -14
- package/dist/message-stream/replayable.d.ts +0 -27
- package/dist/message-stream/response-parser.d.ts +0 -24
- package/dist/message-stream/sanitize.d.ts +0 -10
- package/dist/message-stream/stream.d.ts +0 -54
- package/dist/message-stream/types.d.ts +0 -97
- package/dist/message-stream/validator.d.ts +0 -23
- package/dist/prompts/chat-mode/protocol.d.ts +0 -2
- package/dist/prompts/chat-mode/system.d.ts +0 -2
- package/dist/prompts/chat-mode/system.md.d.ts +0 -2
- package/dist/prompts/chat-mode/user.d.ts +0 -2
- package/dist/prompts/chat-mode/user.md.d.ts +0 -2
- package/dist/prompts/code-examples.d.ts +0 -2
- package/dist/prompts/common.d.ts +0 -7
- package/dist/prompts/dual-modes.d.ts +0 -2
- package/dist/prompts/execution-history.d.ts +0 -6
- package/dist/prompts/execution-state.d.ts +0 -3
- package/dist/prompts/protocol-basics.d.ts +0 -5
- package/dist/prompts/protocol.d.ts +0 -31
- package/dist/prompts/worker-mode/protocol.d.ts +0 -2
- package/dist/prompts/worker-mode/system.d.ts +0 -2
- package/dist/prompts/worker-mode/system.md.d.ts +0 -2
- package/dist/prompts/worker-mode/user.d.ts +0 -2
- package/dist/prompts/worker-mode/user.md.d.ts +0 -2
- package/dist/quickjs-variant-BYhMBpwU.js +0 -45
- package/dist/quickjs-variant-CsIwTVFC.cjs +0 -56
- package/dist/rolldown-runtime-EAsCxrDo.js +0 -14
- package/dist/runtime/fixtures/qwen-protocol-failures.d.ts +0 -29
- package/dist/runtime/interpret-result.d.ts +0 -22
- package/dist/snapshots.d.ts +0 -249
- package/dist/stack-traces-BIE_5Xwf.js +0 -21
- package/dist/stack-traces-ntw_qhoy.cjs +0 -26
- package/dist/truncator-CLkouTCO.cjs +0 -276
- package/dist/truncator-DZqEqnpD.js +0 -253
- package/dist/truncator.d.ts +0 -118
- package/dist/utils-3ESwP3yg.cjs +0 -1075
- package/dist/utils-UBeAFeEI.js +0 -950
- /package/dist/{citations.d.ts → chat/citations.d.ts} +0 -0
- /package/dist/{citations.test.d.ts → chat/citations.test.d.ts} +0 -0
- /package/dist/{component.default.test.d.ts → chat/component.default.test.d.ts} +0 -0
- /package/dist/{compiler/plugins/track-tool-calls.test.d.ts → chat/component.test.d.ts} +0 -0
- /package/dist/{example.test.d.ts → chat/response.test.d.ts} +0 -0
- /package/dist/{exit-parser.test.d.ts → compiler/plugins/dynamic-code.test.d.ts} +0 -0
- /package/dist/{handlers.test.d.ts → compiler/plugins/tool-resolution.test.d.ts} +0 -0
- /package/dist/{hoist.test.d.ts → errors/catalog.test.d.ts} +0 -0
- /package/dist/{message-stream/instructions.test.d.ts → exit.test.d.ts} +0 -0
- /package/dist/{message-stream/normalizer.test.d.ts → inspection.test.d.ts} +0 -0
- /package/dist/{message-stream/parser.test.d.ts → prompts/native.test.d.ts} +0 -0
- /package/dist/{message-stream/response-parser.test.d.ts → result.test.d.ts} +0 -0
- /package/dist/{message-stream/stream.test.d.ts → runtime/chat-completion.test.d.ts} +0 -0
- /package/dist/{message-stream/validator.test.d.ts → runtime/chat-delivery.test.d.ts} +0 -0
- /package/dist/{prompts/adherence.test.d.ts → runtime/chat-last-speaker.test.d.ts} +0 -0
- /package/dist/{prompts/catalogue-examples.test.d.ts → runtime/compatibility-regressions.test.d.ts} +0 -0
- /package/dist/{prompts/code-examples.test.d.ts → runtime/context-registration.test.d.ts} +0 -0
- /package/dist/{prompts/common.test.d.ts → runtime/empty-completion.test.d.ts} +0 -0
- /package/dist/{prompts/concrete-patterns.test.d.ts → runtime/error-recovery.test.d.ts} +0 -0
- /package/dist/{prompts/long-search.test.d.ts → runtime/errors.test.d.ts} +0 -0
- /package/dist/{prompts/protocol-simple.test.d.ts → runtime/execution-activity.test.d.ts} +0 -0
- /package/dist/{prompts/protocol.test.d.ts → runtime/execution-diagnostics.test.d.ts} +0 -0
- /package/dist/{prompts/sections.test.d.ts → runtime/execution-report.test.d.ts} +0 -0
- /package/dist/runtime/{interpret-result.test.d.ts → execution-safety.test.d.ts} +0 -0
- /package/dist/{transcript.test.d.ts → runtime/exit-control-flow.test.d.ts} +0 -0
- /package/dist/{truncator.test.d.ts → runtime/fixtures/long-search.test.d.ts} +0 -0
package/dist/custom-client.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
import { Model } from '@botpress/cognitive';
|
|
1
|
+
import { Model, type CognitiveMessage } from '@botpress/cognitive';
|
|
2
2
|
import { RuntimeCognitive } from './runtime/types.js';
|
|
3
3
|
export type RuntimeGenerateContentInput = Parameters<RuntimeCognitive['generateText']>[0];
|
|
4
4
|
export type RuntimeGenerateContentOptions = Parameters<RuntimeCognitive['generateText']>[1];
|
|
5
|
-
export type RuntimeGenerateContentOutput = Awaited<ReturnType<RuntimeCognitive['generateText']
|
|
5
|
+
export type RuntimeGenerateContentOutput = Awaited<ReturnType<RuntimeCognitive['generateText']>> & {
|
|
6
|
+
/** Full native assistant message, including opaque provider reasoning/signature fields. */
|
|
7
|
+
assistantMessage?: CognitiveMessage & Record<string, unknown>;
|
|
8
|
+
/** Opaque provider continuation state. The adapter must consume it on subsequent requests. */
|
|
9
|
+
continuation?: unknown;
|
|
10
|
+
};
|
|
6
11
|
/**
|
|
7
12
|
* Internal escape hatch for supplying a custom model client that bypasses Cognitive.
|
|
8
13
|
*
|
|
@@ -10,6 +15,11 @@ export type RuntimeGenerateContentOutput = Awaited<ReturnType<RuntimeCognitive['
|
|
|
10
15
|
* against arbitrary models). It is intentionally undocumented and offers no stability
|
|
11
16
|
* guarantees — the API may change or be removed without notice. Avoid it unless you
|
|
12
17
|
* fully understand the implications.
|
|
18
|
+
*
|
|
19
|
+
* Native clients must forward request tools/toolControl, return real toolCalls
|
|
20
|
+
* with unique IDs, and report successful completion metadata. Preserve provider
|
|
21
|
+
* reasoning/signature state using assistantMessage or continuation; flattened
|
|
22
|
+
* reasoning text is not a replacement for provider-required continuation data.
|
|
13
23
|
*/
|
|
14
24
|
export declare abstract class _CustomModelClient implements RuntimeCognitive {
|
|
15
25
|
private readonly ['$$COGNITIVE'];
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
declare const ERROR_BRAND: unique symbol;
|
|
2
|
+
/** Stable library failures. Control-flow signals (such as ThinkSignal) are not errors. */
|
|
3
|
+
export declare abstract class LLMzError<C extends string = string> extends Error {
|
|
4
|
+
readonly critical: boolean;
|
|
5
|
+
abstract readonly code: C;
|
|
6
|
+
protected constructor(message: string, critical: boolean, options?: ErrorOptions);
|
|
7
|
+
/** Shared across independently loaded copies of the library. */
|
|
8
|
+
get [ERROR_BRAND](): true;
|
|
9
|
+
static readonly is: (value: unknown) => value is LLMzError;
|
|
10
|
+
}
|
|
11
|
+
/** A schema validation issue, relative to the supplied argument or property. */
|
|
12
|
+
export type ValidationIssue = {
|
|
13
|
+
path: (string | number)[];
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
export type ToolInputIssue = ValidationIssue;
|
|
17
|
+
export declare class CodeExecutionError extends LLMzError<'EXECUTION_FAILED'> {
|
|
18
|
+
readonly source: string;
|
|
19
|
+
readonly stacktrace: string;
|
|
20
|
+
readonly originalErrorName?: string | undefined;
|
|
21
|
+
static readonly is: (value: unknown) => value is CodeExecutionError;
|
|
22
|
+
readonly code = "EXECUTION_FAILED";
|
|
23
|
+
constructor(message: string, source: string, stacktrace: string, originalErrorName?: string | undefined, cause?: Error);
|
|
24
|
+
}
|
|
25
|
+
export declare class InvalidCodeError extends LLMzError<'INVALID_CODE'> {
|
|
26
|
+
readonly source: string;
|
|
27
|
+
static readonly is: (value: unknown) => value is InvalidCodeError;
|
|
28
|
+
readonly code = "INVALID_CODE";
|
|
29
|
+
constructor(message: string, source: string, options?: ErrorOptions);
|
|
30
|
+
}
|
|
31
|
+
export declare class CodeFormattingError extends LLMzError<'CODE_FORMATTING_FAILED'> {
|
|
32
|
+
readonly source: string;
|
|
33
|
+
static readonly is: (value: unknown) => value is CodeFormattingError;
|
|
34
|
+
readonly code = "CODE_FORMATTING_FAILED";
|
|
35
|
+
constructor(message: string, source: string);
|
|
36
|
+
}
|
|
37
|
+
export declare class ToolInputError extends LLMzError<'INVALID_TOOL_INPUT'> {
|
|
38
|
+
readonly toolName: string;
|
|
39
|
+
readonly issues: ValidationIssue[];
|
|
40
|
+
readonly expectedInput: string;
|
|
41
|
+
static readonly is: (value: unknown) => value is ToolInputError;
|
|
42
|
+
readonly code = "INVALID_TOOL_INPUT";
|
|
43
|
+
constructor(toolName: string, issues: ValidationIssue[], expectedInput: string);
|
|
44
|
+
}
|
|
45
|
+
export declare class ExitInputError extends LLMzError<'INVALID_EXIT_INPUT'> {
|
|
46
|
+
readonly exitName: string;
|
|
47
|
+
readonly issues: ValidationIssue[];
|
|
48
|
+
readonly expectedInput: string;
|
|
49
|
+
static readonly is: (value: unknown) => value is ExitInputError;
|
|
50
|
+
readonly code = "INVALID_EXIT_INPUT";
|
|
51
|
+
constructor(exitName: string, issues: ValidationIssue[], expectedInput: string);
|
|
52
|
+
}
|
|
53
|
+
export declare class ObjectPropertyError extends LLMzError<'INVALID_OBJECT_PROPERTY'> {
|
|
54
|
+
readonly objectName: string;
|
|
55
|
+
readonly propertyName: string;
|
|
56
|
+
readonly issues: ValidationIssue[];
|
|
57
|
+
readonly expectedInput: string;
|
|
58
|
+
static readonly is: (value: unknown) => value is ObjectPropertyError;
|
|
59
|
+
readonly code = "INVALID_OBJECT_PROPERTY";
|
|
60
|
+
constructor(objectName: string, propertyName: string, issues: ValidationIssue[], expectedInput: string);
|
|
61
|
+
}
|
|
62
|
+
export declare class ComponentInputError extends LLMzError<'INVALID_COMPONENT_INPUT'> {
|
|
63
|
+
readonly componentName: string;
|
|
64
|
+
readonly issues: ValidationIssue[];
|
|
65
|
+
readonly expectedInput: string;
|
|
66
|
+
static readonly is: (value: unknown) => value is ComponentInputError;
|
|
67
|
+
readonly code = "INVALID_COMPONENT_INPUT";
|
|
68
|
+
constructor(componentName: string, issues: ValidationIssue[], expectedInput: string);
|
|
69
|
+
}
|
|
70
|
+
export declare class UnknownToolError extends LLMzError<'UNKNOWN_TOOL'> {
|
|
71
|
+
readonly toolName: string;
|
|
72
|
+
readonly availableTools: readonly string[];
|
|
73
|
+
static readonly is: (value: unknown) => value is UnknownToolError;
|
|
74
|
+
readonly code = "UNKNOWN_TOOL";
|
|
75
|
+
constructor(toolName: string, availableTools?: readonly string[], message?: string);
|
|
76
|
+
}
|
|
77
|
+
export declare class UnknownComponentError extends LLMzError<'UNKNOWN_COMPONENT'> {
|
|
78
|
+
readonly componentName: string;
|
|
79
|
+
readonly availableComponents: readonly string[];
|
|
80
|
+
static readonly is: (value: unknown) => value is UnknownComponentError;
|
|
81
|
+
readonly code = "UNKNOWN_COMPONENT";
|
|
82
|
+
constructor(componentName: string, availableComponents: readonly string[]);
|
|
83
|
+
}
|
|
84
|
+
export declare class UnknownExitError extends LLMzError<'UNKNOWN_EXIT'> {
|
|
85
|
+
readonly exitName: string;
|
|
86
|
+
readonly availableExits: readonly string[];
|
|
87
|
+
static readonly is: (value: unknown) => value is UnknownExitError;
|
|
88
|
+
readonly code = "UNKNOWN_EXIT";
|
|
89
|
+
constructor(exitName: string, availableExits: readonly string[]);
|
|
90
|
+
}
|
|
91
|
+
export declare class ReservedIdentifierError extends LLMzError<'RESERVED_IDENTIFIER'> {
|
|
92
|
+
readonly identifier: string;
|
|
93
|
+
readonly kind: 'variable' | 'tool' | 'object' | 'exit' | 'component' | 'binding';
|
|
94
|
+
static readonly is: (value: unknown) => value is ReservedIdentifierError;
|
|
95
|
+
readonly code = "RESERVED_IDENTIFIER";
|
|
96
|
+
constructor(identifier: string, kind: 'variable' | 'tool' | 'object' | 'exit' | 'component' | 'binding', critical?: boolean, message?: string);
|
|
97
|
+
}
|
|
98
|
+
export declare class ToolExecutionError extends LLMzError<'TOOL_EXECUTION_FAILED'> {
|
|
99
|
+
readonly toolName: string;
|
|
100
|
+
static readonly is: (value: unknown) => value is ToolExecutionError;
|
|
101
|
+
readonly code = "TOOL_EXECUTION_FAILED";
|
|
102
|
+
constructor(toolName: string, cause: unknown);
|
|
103
|
+
}
|
|
104
|
+
export declare class LoopExceededError extends LLMzError<'ITERATION_LIMIT'> {
|
|
105
|
+
readonly limit?: number | undefined;
|
|
106
|
+
static readonly is: (value: unknown) => value is LoopExceededError;
|
|
107
|
+
readonly code = "ITERATION_LIMIT";
|
|
108
|
+
constructor(limit?: number | undefined);
|
|
109
|
+
}
|
|
110
|
+
export declare class TokenOverflowError extends LLMzError<'TOKEN_OVERFLOW'> {
|
|
111
|
+
readonly tokens?: number | undefined;
|
|
112
|
+
readonly limit?: number | undefined;
|
|
113
|
+
readonly phase: 'input' | 'output';
|
|
114
|
+
static readonly is: (value: unknown) => value is TokenOverflowError;
|
|
115
|
+
readonly code = "TOKEN_OVERFLOW";
|
|
116
|
+
constructor(message: string, tokens?: number | undefined, limit?: number | undefined, phase?: 'input' | 'output');
|
|
117
|
+
}
|
|
118
|
+
export declare class MemoryCapacityError extends LLMzError<'MEMORY_CAPACITY'> {
|
|
119
|
+
readonly maxBytes: number;
|
|
120
|
+
static readonly is: (value: unknown) => value is MemoryCapacityError;
|
|
121
|
+
readonly code = "MEMORY_CAPACITY";
|
|
122
|
+
constructor(maxBytes: number);
|
|
123
|
+
}
|
|
124
|
+
/** A generated program tried to change read-only runtime state. */
|
|
125
|
+
export declare class AssignmentError extends LLMzError<'INVALID_ASSIGNMENT'> {
|
|
126
|
+
static readonly is: (value: unknown) => value is AssignmentError;
|
|
127
|
+
readonly code = "INVALID_ASSIGNMENT";
|
|
128
|
+
constructor(message: string, options?: ErrorOptions);
|
|
129
|
+
}
|
|
130
|
+
/** The provider failed, or returned an incomplete or malformed generation. */
|
|
131
|
+
export declare class CognitiveError extends LLMzError<'GENERATION_FAILED'> {
|
|
132
|
+
static readonly is: (value: unknown) => value is CognitiveError;
|
|
133
|
+
readonly code = "GENERATION_FAILED";
|
|
134
|
+
constructor(message: string, options?: ErrorOptions);
|
|
135
|
+
}
|
|
136
|
+
/** Summarization failed; canonical history is preserved. */
|
|
137
|
+
export declare class CompactionError extends LLMzError<'COMPACTION_FAILED'> {
|
|
138
|
+
static readonly is: (value: unknown) => value is CompactionError;
|
|
139
|
+
readonly code = "COMPACTION_FAILED";
|
|
140
|
+
constructor(message: string, options?: ErrorOptions);
|
|
141
|
+
}
|
|
142
|
+
/** Invalid tool definition. */
|
|
143
|
+
export declare class InvalidToolError extends LLMzError<'INVALID_TOOL'> {
|
|
144
|
+
static readonly is: (value: unknown) => value is InvalidToolError;
|
|
145
|
+
readonly code = "INVALID_TOOL";
|
|
146
|
+
constructor(message: string, options?: ErrorOptions);
|
|
147
|
+
}
|
|
148
|
+
/** Invalid object definition. */
|
|
149
|
+
export declare class InvalidObjectError extends LLMzError<'INVALID_OBJECT'> {
|
|
150
|
+
static readonly is: (value: unknown) => value is InvalidObjectError;
|
|
151
|
+
readonly code = "INVALID_OBJECT";
|
|
152
|
+
constructor(message: string, options?: ErrorOptions);
|
|
153
|
+
}
|
|
154
|
+
/** Invalid exit definition. */
|
|
155
|
+
export declare class InvalidExitError extends LLMzError<'INVALID_EXIT'> {
|
|
156
|
+
static readonly is: (value: unknown) => value is InvalidExitError;
|
|
157
|
+
readonly code = "INVALID_EXIT";
|
|
158
|
+
constructor(message: string, options?: ErrorOptions);
|
|
159
|
+
}
|
|
160
|
+
/** Invalid chat component definition. */
|
|
161
|
+
export declare class InvalidComponentError extends LLMzError<'INVALID_COMPONENT'> {
|
|
162
|
+
static readonly is: (value: unknown) => value is InvalidComponentError;
|
|
163
|
+
readonly code = "INVALID_COMPONENT";
|
|
164
|
+
constructor(message: string, options?: ErrorOptions);
|
|
165
|
+
}
|
|
166
|
+
/** Invalid execution, chat, or library configuration. */
|
|
167
|
+
export declare class InvalidConfigurationError extends LLMzError<'INVALID_CONFIG'> {
|
|
168
|
+
static readonly is: (value: unknown) => value is InvalidConfigurationError;
|
|
169
|
+
readonly code = "INVALID_CONFIG";
|
|
170
|
+
constructor(message: string, options?: ErrorOptions);
|
|
171
|
+
}
|
|
172
|
+
/** Invalid session input message. */
|
|
173
|
+
export declare class InvalidMessageError extends LLMzError<'INVALID_MESSAGE'> {
|
|
174
|
+
static readonly is: (value: unknown) => value is InvalidMessageError;
|
|
175
|
+
readonly code = "INVALID_MESSAGE";
|
|
176
|
+
constructor(message: string, options?: ErrorOptions);
|
|
177
|
+
}
|
|
178
|
+
/** Invalid external event name or payload. */
|
|
179
|
+
export declare class InvalidEventError extends LLMzError<'INVALID_EVENT'> {
|
|
180
|
+
static readonly is: (value: unknown) => value is InvalidEventError;
|
|
181
|
+
readonly code = "INVALID_EVENT";
|
|
182
|
+
constructor(message: string, options?: ErrorOptions);
|
|
183
|
+
}
|
|
184
|
+
/** Invalid persisted session or native history. */
|
|
185
|
+
export declare class InvalidSessionError extends LLMzError<'INVALID_SESSION'> {
|
|
186
|
+
static readonly is: (value: unknown) => value is InvalidSessionError;
|
|
187
|
+
readonly code = "INVALID_SESSION";
|
|
188
|
+
constructor(message: string, options?: ErrorOptions);
|
|
189
|
+
}
|
|
190
|
+
/** The operation is not allowed in the current session state. */
|
|
191
|
+
export declare class SessionStateError extends LLMzError<'SESSION_STATE'> {
|
|
192
|
+
static readonly is: (value: unknown) => value is SessionStateError;
|
|
193
|
+
readonly code = "SESSION_STATE";
|
|
194
|
+
constructor(message: string, options?: ErrorOptions);
|
|
195
|
+
}
|
|
196
|
+
/** A value cannot be retained in session memory. */
|
|
197
|
+
export declare class MemoryValueError extends LLMzError<'INVALID_MEMORY_VALUE'> {
|
|
198
|
+
static readonly is: (value: unknown) => value is MemoryValueError;
|
|
199
|
+
readonly code = "INVALID_MEMORY_VALUE";
|
|
200
|
+
constructor(message: string, options?: ErrorOptions);
|
|
201
|
+
}
|
|
202
|
+
/** The model returned an invalid native tool call. */
|
|
203
|
+
export declare class NativeProtocolError extends LLMzError<'INVALID_NATIVE_CALL'> {
|
|
204
|
+
static readonly is: (value: unknown) => value is NativeProtocolError;
|
|
205
|
+
readonly code = "INVALID_NATIVE_CALL";
|
|
206
|
+
constructor(message: string, options?: ErrorOptions);
|
|
207
|
+
}
|
|
208
|
+
/** Generated code used a closed or unawaited host operation. */
|
|
209
|
+
export declare class HostOperationError extends LLMzError<'HOST_OPERATION_FAILED'> {
|
|
210
|
+
static readonly is: (value: unknown) => value is HostOperationError;
|
|
211
|
+
readonly code = "HOST_OPERATION_FAILED";
|
|
212
|
+
constructor(message: string, options?: ErrorOptions);
|
|
213
|
+
}
|
|
214
|
+
/** Chat tried to wait for the user without delivering any message. */
|
|
215
|
+
export declare class MissingChatResponseError extends LLMzError<'MISSING_CHAT_RESPONSE'> {
|
|
216
|
+
static readonly is: (value: unknown) => value is MissingChatResponseError;
|
|
217
|
+
readonly code = "MISSING_CHAT_RESPONSE";
|
|
218
|
+
constructor(message: string, options?: ErrorOptions);
|
|
219
|
+
}
|
|
220
|
+
/** Message delivery failed; external delivery may have partially completed. */
|
|
221
|
+
export declare class DeliveryError extends LLMzError<'DELIVERY_FAILED'> {
|
|
222
|
+
static readonly is: (value: unknown) => value is DeliveryError;
|
|
223
|
+
readonly code = "DELIVERY_FAILED";
|
|
224
|
+
constructor(message: string, options?: ErrorOptions);
|
|
225
|
+
}
|
|
226
|
+
/** An execution hook failed; its external effects may be incomplete. */
|
|
227
|
+
export declare class HookError extends LLMzError<'HOOK_FAILED'> {
|
|
228
|
+
static readonly is: (value: unknown) => value is HookError;
|
|
229
|
+
readonly code = "HOOK_FAILED";
|
|
230
|
+
constructor(message: string, options?: ErrorOptions);
|
|
231
|
+
}
|
|
232
|
+
/** Execution was cancelled or timed out. */
|
|
233
|
+
export declare class ExecutionAbortedError extends LLMzError<'EXECUTION_ABORTED'> {
|
|
234
|
+
static readonly is: (value: unknown) => value is ExecutionAbortedError;
|
|
235
|
+
readonly code = "EXECUTION_ABORTED";
|
|
236
|
+
constructor(message: string, options?: ErrorOptions);
|
|
237
|
+
}
|
|
238
|
+
/** An unexpected library failure; inspect cause for the original exception. */
|
|
239
|
+
export declare class InternalError extends LLMzError<'INTERNAL_ERROR'> {
|
|
240
|
+
static readonly is: (value: unknown) => value is InternalError;
|
|
241
|
+
readonly code = "INTERNAL_ERROR";
|
|
242
|
+
constructor(message: string, options?: ErrorOptions);
|
|
243
|
+
}
|
|
244
|
+
/** @internal Constructor registry for VM diagnostics. */
|
|
245
|
+
export declare const errorClasses: {
|
|
246
|
+
CodeExecutionError: typeof CodeExecutionError;
|
|
247
|
+
InvalidCodeError: typeof InvalidCodeError;
|
|
248
|
+
CodeFormattingError: typeof CodeFormattingError;
|
|
249
|
+
ToolInputError: typeof ToolInputError;
|
|
250
|
+
ExitInputError: typeof ExitInputError;
|
|
251
|
+
ObjectPropertyError: typeof ObjectPropertyError;
|
|
252
|
+
ComponentInputError: typeof ComponentInputError;
|
|
253
|
+
UnknownToolError: typeof UnknownToolError;
|
|
254
|
+
UnknownExitError: typeof UnknownExitError;
|
|
255
|
+
UnknownComponentError: typeof UnknownComponentError;
|
|
256
|
+
ReservedIdentifierError: typeof ReservedIdentifierError;
|
|
257
|
+
ToolExecutionError: typeof ToolExecutionError;
|
|
258
|
+
LoopExceededError: typeof LoopExceededError;
|
|
259
|
+
TokenOverflowError: typeof TokenOverflowError;
|
|
260
|
+
MemoryCapacityError: typeof MemoryCapacityError;
|
|
261
|
+
AssignmentError: typeof AssignmentError;
|
|
262
|
+
CognitiveError: typeof CognitiveError;
|
|
263
|
+
CompactionError: typeof CompactionError;
|
|
264
|
+
InvalidToolError: typeof InvalidToolError;
|
|
265
|
+
InvalidObjectError: typeof InvalidObjectError;
|
|
266
|
+
InvalidExitError: typeof InvalidExitError;
|
|
267
|
+
InvalidComponentError: typeof InvalidComponentError;
|
|
268
|
+
InvalidConfigurationError: typeof InvalidConfigurationError;
|
|
269
|
+
InvalidMessageError: typeof InvalidMessageError;
|
|
270
|
+
InvalidEventError: typeof InvalidEventError;
|
|
271
|
+
InvalidSessionError: typeof InvalidSessionError;
|
|
272
|
+
SessionStateError: typeof SessionStateError;
|
|
273
|
+
MemoryValueError: typeof MemoryValueError;
|
|
274
|
+
NativeProtocolError: typeof NativeProtocolError;
|
|
275
|
+
HostOperationError: typeof HostOperationError;
|
|
276
|
+
DeliveryError: typeof DeliveryError;
|
|
277
|
+
MissingChatResponseError: typeof MissingChatResponseError;
|
|
278
|
+
HookError: typeof HookError;
|
|
279
|
+
ExecutionAbortedError: typeof ExecutionAbortedError;
|
|
280
|
+
InternalError: typeof InternalError;
|
|
281
|
+
};
|
|
282
|
+
/** Discriminated union of every library error. */
|
|
283
|
+
export type LLMzFailure = InstanceType<(typeof errorClasses)[keyof typeof errorClasses]>;
|
|
284
|
+
export type ErrorCode = LLMzFailure['code'];
|
|
285
|
+
/** Test an unknown exception, optionally narrowing to a stable error code. */
|
|
286
|
+
export declare function isLLMzError<C extends ErrorCode>(error: unknown, code: C): error is Extract<LLMzFailure, {
|
|
287
|
+
code: C;
|
|
288
|
+
}>;
|
|
289
|
+
export declare function isLLMzError(error: unknown): error is LLMzFailure;
|
|
290
|
+
/** Critical errors end execution; they are never sent back to the model for retry. */
|
|
291
|
+
export declare function isCriticalError(error: unknown): error is LLMzFailure & {
|
|
292
|
+
critical: true;
|
|
293
|
+
};
|
|
294
|
+
export {};
|