@graphorin/provider 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/adapters/index.d.ts +4 -0
- package/dist/adapters/index.js +6 -0
- package/dist/adapters/llamacpp-server.d.ts +69 -0
- package/dist/adapters/llamacpp-server.d.ts.map +1 -0
- package/dist/adapters/llamacpp-server.js +51 -0
- package/dist/adapters/llamacpp-server.js.map +1 -0
- package/dist/adapters/ollama.d.ts +43 -0
- package/dist/adapters/ollama.d.ts.map +1 -0
- package/dist/adapters/ollama.js +246 -0
- package/dist/adapters/ollama.js.map +1 -0
- package/dist/adapters/openai-compatible.d.ts +48 -0
- package/dist/adapters/openai-compatible.d.ts.map +1 -0
- package/dist/adapters/openai-compatible.js +28 -0
- package/dist/adapters/openai-compatible.js.map +1 -0
- package/dist/adapters/vercel.d.ts +135 -0
- package/dist/adapters/vercel.d.ts.map +1 -0
- package/dist/adapters/vercel.js +306 -0
- package/dist/adapters/vercel.js.map +1 -0
- package/dist/counters/anthropic.d.ts +36 -0
- package/dist/counters/anthropic.d.ts.map +1 -0
- package/dist/counters/anthropic.js +63 -0
- package/dist/counters/anthropic.js.map +1 -0
- package/dist/counters/bedrock.d.ts +27 -0
- package/dist/counters/bedrock.d.ts.map +1 -0
- package/dist/counters/bedrock.js +29 -0
- package/dist/counters/bedrock.js.map +1 -0
- package/dist/counters/dispatcher.d.ts +34 -0
- package/dist/counters/dispatcher.d.ts.map +1 -0
- package/dist/counters/dispatcher.js +78 -0
- package/dist/counters/dispatcher.js.map +1 -0
- package/dist/counters/global.d.ts +26 -0
- package/dist/counters/global.d.ts.map +1 -0
- package/dist/counters/global.js +31 -0
- package/dist/counters/global.js.map +1 -0
- package/dist/counters/google.d.ts +27 -0
- package/dist/counters/google.d.ts.map +1 -0
- package/dist/counters/google.js +29 -0
- package/dist/counters/google.js.map +1 -0
- package/dist/counters/heuristic.d.ts +37 -0
- package/dist/counters/heuristic.d.ts.map +1 -0
- package/dist/counters/heuristic.js +64 -0
- package/dist/counters/heuristic.js.map +1 -0
- package/dist/counters/index.d.ts +9 -0
- package/dist/counters/index.js +10 -0
- package/dist/counters/js-tiktoken.d.ts +63 -0
- package/dist/counters/js-tiktoken.d.ts.map +1 -0
- package/dist/counters/js-tiktoken.js +73 -0
- package/dist/counters/js-tiktoken.js.map +1 -0
- package/dist/counters/serialize.d.ts +37 -0
- package/dist/counters/serialize.d.ts.map +1 -0
- package/dist/counters/serialize.js +57 -0
- package/dist/counters/serialize.js.map +1 -0
- package/dist/errors/errors.d.ts +167 -0
- package/dist/errors/errors.d.ts.map +1 -0
- package/dist/errors/errors.js +182 -0
- package/dist/errors/errors.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +3 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/abort.js +34 -0
- package/dist/internal/abort.js.map +1 -0
- package/dist/internal/http.js +163 -0
- package/dist/internal/http.js.map +1 -0
- package/dist/internal/openai-shaped.js +308 -0
- package/dist/internal/openai-shaped.js.map +1 -0
- package/dist/internal/sse.js +104 -0
- package/dist/internal/sse.js.map +1 -0
- package/dist/internal/url-utils.js +24 -0
- package/dist/internal/url-utils.js.map +1 -0
- package/dist/middleware/compose.d.ts +85 -0
- package/dist/middleware/compose.d.ts.map +1 -0
- package/dist/middleware/compose.js +174 -0
- package/dist/middleware/compose.js.map +1 -0
- package/dist/middleware/index.d.ts +10 -0
- package/dist/middleware/index.js +11 -0
- package/dist/middleware/production-hook.d.ts +27 -0
- package/dist/middleware/production-hook.d.ts.map +1 -0
- package/dist/middleware/production-hook.js +21 -0
- package/dist/middleware/production-hook.js.map +1 -0
- package/dist/middleware/with-cost-limit.d.ts +46 -0
- package/dist/middleware/with-cost-limit.d.ts.map +1 -0
- package/dist/middleware/with-cost-limit.js +66 -0
- package/dist/middleware/with-cost-limit.js.map +1 -0
- package/dist/middleware/with-cost-tracking.d.ts +91 -0
- package/dist/middleware/with-cost-tracking.d.ts.map +1 -0
- package/dist/middleware/with-cost-tracking.js +95 -0
- package/dist/middleware/with-cost-tracking.js.map +1 -0
- package/dist/middleware/with-fallback.d.ts +25 -0
- package/dist/middleware/with-fallback.d.ts.map +1 -0
- package/dist/middleware/with-fallback.js +84 -0
- package/dist/middleware/with-fallback.js.map +1 -0
- package/dist/middleware/with-rate-limit.d.ts +36 -0
- package/dist/middleware/with-rate-limit.d.ts.map +1 -0
- package/dist/middleware/with-rate-limit.js +141 -0
- package/dist/middleware/with-rate-limit.js.map +1 -0
- package/dist/middleware/with-redaction.d.ts +60 -0
- package/dist/middleware/with-redaction.d.ts.map +1 -0
- package/dist/middleware/with-redaction.js +305 -0
- package/dist/middleware/with-redaction.js.map +1 -0
- package/dist/middleware/with-retry.d.ts +26 -0
- package/dist/middleware/with-retry.d.ts.map +1 -0
- package/dist/middleware/with-retry.js +157 -0
- package/dist/middleware/with-retry.js.map +1 -0
- package/dist/middleware/with-tracing.d.ts +21 -0
- package/dist/middleware/with-tracing.d.ts.map +1 -0
- package/dist/middleware/with-tracing.js +55 -0
- package/dist/middleware/with-tracing.js.map +1 -0
- package/dist/model-tier/classify.d.ts +34 -0
- package/dist/model-tier/classify.d.ts.map +1 -0
- package/dist/model-tier/classify.js +117 -0
- package/dist/model-tier/classify.js.map +1 -0
- package/dist/model-tier/index.d.ts +2 -0
- package/dist/model-tier/index.js +3 -0
- package/dist/provider.d.ts +51 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +64 -0
- package/dist/provider.js.map +1 -0
- package/dist/reasoning/apply-policy.d.ts +22 -0
- package/dist/reasoning/apply-policy.d.ts.map +1 -0
- package/dist/reasoning/apply-policy.js +47 -0
- package/dist/reasoning/apply-policy.js.map +1 -0
- package/dist/reasoning/classify-contract.d.ts +41 -0
- package/dist/reasoning/classify-contract.d.ts.map +1 -0
- package/dist/reasoning/classify-contract.js +59 -0
- package/dist/reasoning/classify-contract.js.map +1 -0
- package/dist/reasoning/index.d.ts +4 -0
- package/dist/reasoning/index.js +5 -0
- package/dist/reasoning/retention.d.ts +39 -0
- package/dist/reasoning/retention.d.ts.map +1 -0
- package/dist/reasoning/retention.js +33 -0
- package/dist/reasoning/retention.js.map +1 -0
- package/dist/tool-examples.d.ts +14 -0
- package/dist/tool-examples.d.ts.map +1 -0
- package/dist/tool-examples.js +35 -0
- package/dist/tool-examples.js.map +1 -0
- package/dist/trust/classify-local-provider.d.ts +47 -0
- package/dist/trust/classify-local-provider.d.ts.map +1 -0
- package/dist/trust/classify-local-provider.js +164 -0
- package/dist/trust/classify-local-provider.js.map +1 -0
- package/dist/trust/index.d.ts +3 -0
- package/dist/trust/index.js +3 -0
- package/package.json +128 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Message } from "@graphorin/core";
|
|
2
|
+
|
|
3
|
+
//#region src/counters/serialize.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Plain-text projection of a {@link Message}. The shape is what the
|
|
7
|
+
* counter actually feeds the tokenizer.
|
|
8
|
+
*
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
interface SerializedMessage {
|
|
12
|
+
readonly role: string;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
readonly toolCalls: ReadonlyArray<{
|
|
15
|
+
readonly name: string;
|
|
16
|
+
readonly args: string;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Project a `Message` into a flat string suitable for tokenizers that
|
|
21
|
+
* do not understand multimodal content. Image / audio / file parts
|
|
22
|
+
* are replaced with the canonical placeholder `[image]` / `[audio]` /
|
|
23
|
+
* `[file]` so byte counts stay deterministic.
|
|
24
|
+
*
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
declare function serialiseMessageForCount(msg: Message): SerializedMessage;
|
|
28
|
+
/**
|
|
29
|
+
* Render a `SerializedMessage` as a single string with role prefix.
|
|
30
|
+
* Useful for naive estimators that count by character length.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
declare function serializedToString(msg: SerializedMessage): string;
|
|
35
|
+
//#endregion
|
|
36
|
+
export { SerializedMessage, serialiseMessageForCount, serializedToString };
|
|
37
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","names":[],"sources":["../../src/counters/serialize.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAgBiB,iBAAA;;;sBAGK;;;;;;;;;;;;;iBAWN,wBAAA,MAA8B,UAAU;;;;;;;iBAgDxC,kBAAA,MAAwB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/counters/serialize.ts
|
|
2
|
+
/**
|
|
3
|
+
* Project a `Message` into a flat string suitable for tokenizers that
|
|
4
|
+
* do not understand multimodal content. Image / audio / file parts
|
|
5
|
+
* are replaced with the canonical placeholder `[image]` / `[audio]` /
|
|
6
|
+
* `[file]` so byte counts stay deterministic.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
function serialiseMessageForCount(msg) {
|
|
11
|
+
return {
|
|
12
|
+
role: msg.role,
|
|
13
|
+
text: serialiseContent(msg.content),
|
|
14
|
+
toolCalls: msg.toolCalls?.map((tc) => ({
|
|
15
|
+
name: tc.toolName,
|
|
16
|
+
args: typeof tc.args === "string" ? tc.args : JSON.stringify(tc.args)
|
|
17
|
+
})) ?? []
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function serialiseContent(content) {
|
|
21
|
+
if (typeof content === "string") return content;
|
|
22
|
+
const buffer = [];
|
|
23
|
+
for (const part of content) switch (part.type) {
|
|
24
|
+
case "text":
|
|
25
|
+
buffer.push(part.text);
|
|
26
|
+
break;
|
|
27
|
+
case "image":
|
|
28
|
+
buffer.push("[image]");
|
|
29
|
+
break;
|
|
30
|
+
case "audio":
|
|
31
|
+
buffer.push("[audio]");
|
|
32
|
+
break;
|
|
33
|
+
case "file":
|
|
34
|
+
buffer.push(`[file:${part.mimeType}]`);
|
|
35
|
+
break;
|
|
36
|
+
case "reasoning":
|
|
37
|
+
buffer.push(part.text);
|
|
38
|
+
break;
|
|
39
|
+
default: break;
|
|
40
|
+
}
|
|
41
|
+
return buffer.join("\n");
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Render a `SerializedMessage` as a single string with role prefix.
|
|
45
|
+
* Useful for naive estimators that count by character length.
|
|
46
|
+
*
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
49
|
+
function serializedToString(msg) {
|
|
50
|
+
const parts = [`[${msg.role}]`, msg.text];
|
|
51
|
+
for (const tc of msg.toolCalls) parts.push(`[tool-call:${tc.name}] ${tc.args}`);
|
|
52
|
+
return parts.join("\n");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { serialiseMessageForCount, serializedToString };
|
|
57
|
+
//# sourceMappingURL=serialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.js","names":["buffer: string[]"],"sources":["../../src/counters/serialize.ts"],"sourcesContent":["/**\n * Canonical text-only serialization of a Graphorin `Message`. Used by\n * counters that lack a vendor-native API (`JsTiktokenCounter`,\n * `HeuristicCounter`).\n *\n * @internal\n */\n\nimport type { Message, MessageContent } from '@graphorin/core';\n\n/**\n * Plain-text projection of a {@link Message}. The shape is what the\n * counter actually feeds the tokenizer.\n *\n * @internal\n */\nexport interface SerializedMessage {\n readonly role: string;\n readonly text: string;\n readonly toolCalls: ReadonlyArray<{ readonly name: string; readonly args: string }>;\n}\n\n/**\n * Project a `Message` into a flat string suitable for tokenizers that\n * do not understand multimodal content. Image / audio / file parts\n * are replaced with the canonical placeholder `[image]` / `[audio]` /\n * `[file]` so byte counts stay deterministic.\n *\n * @internal\n */\nexport function serialiseMessageForCount(msg: Message): SerializedMessage {\n const role = msg.role;\n const text = serialiseContent(msg.content);\n const toolCalls =\n (msg as { toolCalls?: ReadonlyArray<{ toolName: string; args: unknown }> }).toolCalls?.map(\n (tc) => ({\n name: tc.toolName,\n args: typeof tc.args === 'string' ? tc.args : JSON.stringify(tc.args),\n }),\n ) ?? [];\n return { role, text, toolCalls };\n}\n\nfunction serialiseContent(content: string | ReadonlyArray<MessageContent>): string {\n if (typeof content === 'string') return content;\n const buffer: string[] = [];\n for (const part of content) {\n switch (part.type) {\n case 'text':\n buffer.push(part.text);\n break;\n case 'image':\n buffer.push('[image]');\n break;\n case 'audio':\n buffer.push('[audio]');\n break;\n case 'file':\n buffer.push(`[file:${part.mimeType}]`);\n break;\n case 'reasoning':\n buffer.push(part.text);\n break;\n default:\n // Unknown content variants are silently skipped to keep the\n // counter forward-compatible.\n break;\n }\n }\n return buffer.join('\\n');\n}\n\n/**\n * Render a `SerializedMessage` as a single string with role prefix.\n * Useful for naive estimators that count by character length.\n *\n * @internal\n */\nexport function serializedToString(msg: SerializedMessage): string {\n const parts = [`[${msg.role}]`, msg.text];\n for (const tc of msg.toolCalls) {\n parts.push(`[tool-call:${tc.name}] ${tc.args}`);\n }\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;;;;AA8BA,SAAgB,yBAAyB,KAAiC;AAUxE,QAAO;EAAE,MATI,IAAI;EASF,MARF,iBAAiB,IAAI,QAAQ;EAQrB,WANlB,IAA2E,WAAW,KACpF,QAAQ;GACP,MAAM,GAAG;GACT,MAAM,OAAO,GAAG,SAAS,WAAW,GAAG,OAAO,KAAK,UAAU,GAAG,KAAK;GACtE,EACF,IAAI,EAAE;EACuB;;AAGlC,SAAS,iBAAiB,SAAyD;AACjF,KAAI,OAAO,YAAY,SAAU,QAAO;CACxC,MAAMA,SAAmB,EAAE;AAC3B,MAAK,MAAM,QAAQ,QACjB,SAAQ,KAAK,MAAb;EACE,KAAK;AACH,UAAO,KAAK,KAAK,KAAK;AACtB;EACF,KAAK;AACH,UAAO,KAAK,UAAU;AACtB;EACF,KAAK;AACH,UAAO,KAAK,UAAU;AACtB;EACF,KAAK;AACH,UAAO,KAAK,SAAS,KAAK,SAAS,GAAG;AACtC;EACF,KAAK;AACH,UAAO,KAAK,KAAK,KAAK;AACtB;EACF,QAGE;;AAGN,QAAO,OAAO,KAAK,KAAK;;;;;;;;AAS1B,SAAgB,mBAAmB,KAAgC;CACjE,MAAM,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,IAAI,KAAK;AACzC,MAAK,MAAM,MAAM,IAAI,UACnB,OAAM,KAAK,cAAc,GAAG,KAAK,IAAI,GAAG,OAAO;AAEjD,QAAO,MAAM,KAAK,KAAK"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
//#region src/errors/errors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Typed error hierarchy for `@graphorin/provider`. Every error class
|
|
4
|
+
* carries a stable `kind` discriminant (lowercase, kebab-case) plus an
|
|
5
|
+
* optional `hint` string pointing the user at the recommended fix.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Base class for every error thrown by `@graphorin/provider`. Consumers
|
|
11
|
+
* narrow on the discriminant `kind` rather than `instanceof` — both
|
|
12
|
+
* work, but discriminants are subclass-friendly.
|
|
13
|
+
*
|
|
14
|
+
* @stable
|
|
15
|
+
*/
|
|
16
|
+
declare class GraphorinProviderError extends Error {
|
|
17
|
+
readonly name: string;
|
|
18
|
+
/** Stable discriminant — `'middleware-ordering'`, `'rate-limit-exceeded'`, … */
|
|
19
|
+
readonly kind: string;
|
|
20
|
+
/** Optional remediation hint shown alongside the message. */
|
|
21
|
+
readonly hint?: string;
|
|
22
|
+
constructor(kind: string, message: string, options?: {
|
|
23
|
+
cause?: unknown;
|
|
24
|
+
hint?: string;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The middleware composer detected an out-of-order middleware. The
|
|
29
|
+
* `offendingPair` field carries the `[outer, inner]` middleware names
|
|
30
|
+
* that violated the canonical order so consumers can surface a precise
|
|
31
|
+
* fix in IDE diagnostics.
|
|
32
|
+
*
|
|
33
|
+
* @stable
|
|
34
|
+
*/
|
|
35
|
+
declare class MiddlewareOrderingError extends GraphorinProviderError {
|
|
36
|
+
readonly name = "MiddlewareOrderingError";
|
|
37
|
+
readonly offendingPair: readonly [string, string];
|
|
38
|
+
readonly canonicalOrder: readonly string[];
|
|
39
|
+
constructor(args: {
|
|
40
|
+
offendingPair: readonly [string, string];
|
|
41
|
+
canonicalOrder: readonly string[];
|
|
42
|
+
message?: string;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* `withRedaction` was missing at production startup. Thrown by the
|
|
47
|
+
* production hook applied to every composed provider when
|
|
48
|
+
* `process.env.NODE_ENV === 'production'`.
|
|
49
|
+
*
|
|
50
|
+
* @stable
|
|
51
|
+
*/
|
|
52
|
+
declare class MissingProductionMiddlewareError extends GraphorinProviderError {
|
|
53
|
+
readonly name = "MissingProductionMiddlewareError";
|
|
54
|
+
readonly missing: string;
|
|
55
|
+
constructor(missing: string);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* `withCostLimit` exceeded its configured ceiling. Carries the
|
|
59
|
+
* triggering scope (`session`, `agent`, `run`, …) so the caller can
|
|
60
|
+
* decide how to surface the breach.
|
|
61
|
+
*
|
|
62
|
+
* @stable
|
|
63
|
+
*/
|
|
64
|
+
declare class CostBudgetExceededError extends GraphorinProviderError {
|
|
65
|
+
readonly name = "CostBudgetExceededError";
|
|
66
|
+
readonly scope: string;
|
|
67
|
+
readonly limit: number;
|
|
68
|
+
readonly observed: number;
|
|
69
|
+
constructor(args: {
|
|
70
|
+
scope: string;
|
|
71
|
+
limit: number;
|
|
72
|
+
observed: number;
|
|
73
|
+
currency?: string;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* `withRateLimit` exhausted its bucket and the caller did not opt
|
|
78
|
+
* into `'queue'` mode.
|
|
79
|
+
*
|
|
80
|
+
* @stable
|
|
81
|
+
*/
|
|
82
|
+
declare class RateLimitExceededError extends GraphorinProviderError {
|
|
83
|
+
readonly name = "RateLimitExceededError";
|
|
84
|
+
readonly retryAfterMs: number;
|
|
85
|
+
constructor(retryAfterMs: number);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* `withRedaction` detected a hit AND the policy is configured for
|
|
89
|
+
* `failClosed: true`. The matched value is **never** part of the
|
|
90
|
+
* message — only the pattern name and field path.
|
|
91
|
+
*
|
|
92
|
+
* @stable
|
|
93
|
+
*/
|
|
94
|
+
declare class PromptRedactionError extends GraphorinProviderError {
|
|
95
|
+
readonly name = "PromptRedactionError";
|
|
96
|
+
readonly patternName: string;
|
|
97
|
+
readonly fieldPath: string;
|
|
98
|
+
readonly role?: string;
|
|
99
|
+
constructor(args: {
|
|
100
|
+
patternName: string;
|
|
101
|
+
fieldPath: string;
|
|
102
|
+
role?: string;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Raised when a `baseUrl`-driven local adapter is configured against
|
|
107
|
+
* a public host over plaintext HTTP. Adapters refuse to start unless
|
|
108
|
+
* `allowInsecureTransport: true` is supplied (and the override is
|
|
109
|
+
* audit-logged).
|
|
110
|
+
*
|
|
111
|
+
* @stable
|
|
112
|
+
*/
|
|
113
|
+
declare class LocalProviderInsecureTransportError extends GraphorinProviderError {
|
|
114
|
+
readonly name = "LocalProviderInsecureTransportError";
|
|
115
|
+
readonly baseUrl: string;
|
|
116
|
+
constructor(baseUrl: string);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Legacy alias preserved for one minor; prefer
|
|
120
|
+
* {@link LocalProviderInsecureTransportError}. Removed in v0.2.
|
|
121
|
+
*
|
|
122
|
+
* @deprecated Use {@link LocalProviderInsecureTransportError} instead.
|
|
123
|
+
*/
|
|
124
|
+
declare const OllamaInsecureTransportError: typeof LocalProviderInsecureTransportError;
|
|
125
|
+
type OllamaInsecureTransportError = LocalProviderInsecureTransportError;
|
|
126
|
+
/**
|
|
127
|
+
* Wrapped HTTP error returned by an adapter. Carries the original
|
|
128
|
+
* status code so middleware (`withRetry`, `withFallback`) can decide
|
|
129
|
+
* whether the error is retryable.
|
|
130
|
+
*
|
|
131
|
+
* @stable
|
|
132
|
+
*/
|
|
133
|
+
declare class ProviderHttpError extends GraphorinProviderError {
|
|
134
|
+
readonly name = "ProviderHttpError";
|
|
135
|
+
readonly status: number;
|
|
136
|
+
readonly providerName: string;
|
|
137
|
+
constructor(args: {
|
|
138
|
+
providerName: string;
|
|
139
|
+
status: number;
|
|
140
|
+
message: string;
|
|
141
|
+
cause?: unknown;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* The streaming response did not match the documented wire format
|
|
146
|
+
* (e.g. malformed SSE chunk, truncated JSON).
|
|
147
|
+
*
|
|
148
|
+
* @stable
|
|
149
|
+
*/
|
|
150
|
+
declare class ProviderStreamParseError extends GraphorinProviderError {
|
|
151
|
+
readonly name = "ProviderStreamParseError";
|
|
152
|
+
readonly providerName: string;
|
|
153
|
+
constructor(providerName: string, message: string, cause?: unknown);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The classifier dispatcher was given a non-Provider value. Programming
|
|
157
|
+
* error; fail-fast at the boundary.
|
|
158
|
+
*
|
|
159
|
+
* @stable
|
|
160
|
+
*/
|
|
161
|
+
declare class InvalidProviderError extends GraphorinProviderError {
|
|
162
|
+
readonly name = "InvalidProviderError";
|
|
163
|
+
constructor(message: string);
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError };
|
|
167
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","names":[],"sources":["../../src/errors/errors.ts"],"sourcesContent":[],"mappings":";;AAeA;AAwBA;AAiCA;AAyBA;AA2BA;AAmBA;AA6BA;AAyBA;AACA;AASA;AAoBA;AAkBA;;cAtOa,sBAAA,SAA+B,KAAA;;;;;;;;;;;;;;;;;;;cAwB/B,uBAAA,SAAgC,sBAAA;;;;;;;;;;;;;;;;;cAiChC,gCAAA,SAAyC,sBAAA;;;;;;;;;;;;cAyBzC,uBAAA,SAAgC,sBAAA;;;;;;;;;;;;;;;;;;cA2BhC,sBAAA,SAA+B,sBAAA;;;;;;;;;;;;cAmB/B,oBAAA,SAA6B,sBAAA;;;;;;;;;;;;;;;;;;;cA6B7B,mCAAA,SAA4C,sBAAA;;;;;;;;;;;cAyB5C,qCAA4B;KAC7B,4BAAA,GAA+B;;;;;;;;cAS9B,iBAAA,SAA0B,sBAAA;;;;;;;;;;;;;;;;;cAoB1B,wBAAA,SAAiC,sBAAA;;;;;;;;;;;cAkBjC,oBAAA,SAA6B,sBAAA"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
//#region src/errors/errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* Typed error hierarchy for `@graphorin/provider`. Every error class
|
|
4
|
+
* carries a stable `kind` discriminant (lowercase, kebab-case) plus an
|
|
5
|
+
* optional `hint` string pointing the user at the recommended fix.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Base class for every error thrown by `@graphorin/provider`. Consumers
|
|
11
|
+
* narrow on the discriminant `kind` rather than `instanceof` — both
|
|
12
|
+
* work, but discriminants are subclass-friendly.
|
|
13
|
+
*
|
|
14
|
+
* @stable
|
|
15
|
+
*/
|
|
16
|
+
var GraphorinProviderError = class extends Error {
|
|
17
|
+
name = "GraphorinProviderError";
|
|
18
|
+
/** Stable discriminant — `'middleware-ordering'`, `'rate-limit-exceeded'`, … */
|
|
19
|
+
kind;
|
|
20
|
+
/** Optional remediation hint shown alongside the message. */
|
|
21
|
+
hint;
|
|
22
|
+
constructor(kind, message, options) {
|
|
23
|
+
super(message, options?.cause !== void 0 ? { cause: options.cause } : void 0);
|
|
24
|
+
this.kind = kind;
|
|
25
|
+
if (options?.hint !== void 0) this.hint = options.hint;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The middleware composer detected an out-of-order middleware. The
|
|
30
|
+
* `offendingPair` field carries the `[outer, inner]` middleware names
|
|
31
|
+
* that violated the canonical order so consumers can surface a precise
|
|
32
|
+
* fix in IDE diagnostics.
|
|
33
|
+
*
|
|
34
|
+
* @stable
|
|
35
|
+
*/
|
|
36
|
+
var MiddlewareOrderingError = class extends GraphorinProviderError {
|
|
37
|
+
name = "MiddlewareOrderingError";
|
|
38
|
+
offendingPair;
|
|
39
|
+
canonicalOrder;
|
|
40
|
+
constructor(args) {
|
|
41
|
+
super("middleware-ordering", args.message ?? `Middleware order violation: '${args.offendingPair[0]}' must not wrap '${args.offendingPair[1]}'. Canonical order (outer → inner): ${args.canonicalOrder.join(" → ")}.`, { hint: "Reorder the middleware array passed to composeProviderMiddleware([...]) to match the canonical order; see @graphorin/provider/middleware for documentation." });
|
|
42
|
+
this.offendingPair = args.offendingPair;
|
|
43
|
+
this.canonicalOrder = args.canonicalOrder;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* `withRedaction` was missing at production startup. Thrown by the
|
|
48
|
+
* production hook applied to every composed provider when
|
|
49
|
+
* `process.env.NODE_ENV === 'production'`.
|
|
50
|
+
*
|
|
51
|
+
* @stable
|
|
52
|
+
*/
|
|
53
|
+
var MissingProductionMiddlewareError = class extends GraphorinProviderError {
|
|
54
|
+
name = "MissingProductionMiddlewareError";
|
|
55
|
+
missing;
|
|
56
|
+
constructor(missing) {
|
|
57
|
+
super("missing-production-middleware", `Production startup hook: required middleware '${missing}' is missing from the provider chain.`, { hint: `Compose '${missing}' as the innermost layer (closest to the underlying provider) before deploying. See @graphorin/provider/middleware for the canonical composition order.` });
|
|
58
|
+
this.missing = missing;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* `withCostLimit` exceeded its configured ceiling. Carries the
|
|
63
|
+
* triggering scope (`session`, `agent`, `run`, …) so the caller can
|
|
64
|
+
* decide how to surface the breach.
|
|
65
|
+
*
|
|
66
|
+
* @stable
|
|
67
|
+
*/
|
|
68
|
+
var CostBudgetExceededError = class extends GraphorinProviderError {
|
|
69
|
+
name = "CostBudgetExceededError";
|
|
70
|
+
scope;
|
|
71
|
+
limit;
|
|
72
|
+
observed;
|
|
73
|
+
constructor(args) {
|
|
74
|
+
super("cost-budget-exceeded", `Cost budget exceeded for '${args.scope}': observed ${args.observed.toFixed(4)} ${args.currency ?? "USD"} > limit ${args.limit.toFixed(4)} ${args.currency ?? "USD"}.`, { hint: "Raise the limit in withCostLimit({...}), tighten the prompt, or switch to a cheaper model tier." });
|
|
75
|
+
this.scope = args.scope;
|
|
76
|
+
this.limit = args.limit;
|
|
77
|
+
this.observed = args.observed;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* `withRateLimit` exhausted its bucket and the caller did not opt
|
|
82
|
+
* into `'queue'` mode.
|
|
83
|
+
*
|
|
84
|
+
* @stable
|
|
85
|
+
*/
|
|
86
|
+
var RateLimitExceededError = class extends GraphorinProviderError {
|
|
87
|
+
name = "RateLimitExceededError";
|
|
88
|
+
retryAfterMs;
|
|
89
|
+
constructor(retryAfterMs) {
|
|
90
|
+
super("rate-limit-exceeded", `Rate limit exceeded; retry after ${retryAfterMs}ms.`, { hint: "Slow down the request rate, raise the bucket size in withRateLimit({...}), or switch to mode: \"queue\"." });
|
|
91
|
+
this.retryAfterMs = retryAfterMs;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* `withRedaction` detected a hit AND the policy is configured for
|
|
96
|
+
* `failClosed: true`. The matched value is **never** part of the
|
|
97
|
+
* message — only the pattern name and field path.
|
|
98
|
+
*
|
|
99
|
+
* @stable
|
|
100
|
+
*/
|
|
101
|
+
var PromptRedactionError = class extends GraphorinProviderError {
|
|
102
|
+
name = "PromptRedactionError";
|
|
103
|
+
patternName;
|
|
104
|
+
fieldPath;
|
|
105
|
+
role;
|
|
106
|
+
constructor(args) {
|
|
107
|
+
super("prompt-redaction-fail-closed", `Outbound prompt-redaction policy is fail-closed and matched pattern '${args.patternName}' at '${args.fieldPath}'${args.role ? ` (role: ${args.role})` : ""}.`, { hint: "Sanitize the prompt before calling the provider, or disable failClosed in withRedaction({...}) for this environment." });
|
|
108
|
+
this.patternName = args.patternName;
|
|
109
|
+
this.fieldPath = args.fieldPath;
|
|
110
|
+
if (args.role !== void 0) this.role = args.role;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Raised when a `baseUrl`-driven local adapter is configured against
|
|
115
|
+
* a public host over plaintext HTTP. Adapters refuse to start unless
|
|
116
|
+
* `allowInsecureTransport: true` is supplied (and the override is
|
|
117
|
+
* audit-logged).
|
|
118
|
+
*
|
|
119
|
+
* @stable
|
|
120
|
+
*/
|
|
121
|
+
var LocalProviderInsecureTransportError = class extends GraphorinProviderError {
|
|
122
|
+
name = "LocalProviderInsecureTransportError";
|
|
123
|
+
baseUrl;
|
|
124
|
+
constructor(baseUrl) {
|
|
125
|
+
super("local-provider-insecure-transport", `Refusing to start: the provider baseUrl '${baseUrl}' is public AND plaintext (http://). Switch to https:// or set allowInsecureTransport: true to acknowledge the risk.`, { hint: "Public local-LLM endpoints must be served over TLS. Acceptable alternatives: terminate TLS in front of the model server, tunnel through SSH / WireGuard / Tailscale, or pass allowInsecureTransport: true (audit-logged)." });
|
|
126
|
+
this.baseUrl = baseUrl;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Legacy alias preserved for one minor; prefer
|
|
131
|
+
* {@link LocalProviderInsecureTransportError}. Removed in v0.2.
|
|
132
|
+
*
|
|
133
|
+
* @deprecated Use {@link LocalProviderInsecureTransportError} instead.
|
|
134
|
+
*/
|
|
135
|
+
const OllamaInsecureTransportError = LocalProviderInsecureTransportError;
|
|
136
|
+
/**
|
|
137
|
+
* Wrapped HTTP error returned by an adapter. Carries the original
|
|
138
|
+
* status code so middleware (`withRetry`, `withFallback`) can decide
|
|
139
|
+
* whether the error is retryable.
|
|
140
|
+
*
|
|
141
|
+
* @stable
|
|
142
|
+
*/
|
|
143
|
+
var ProviderHttpError = class extends GraphorinProviderError {
|
|
144
|
+
name = "ProviderHttpError";
|
|
145
|
+
status;
|
|
146
|
+
providerName;
|
|
147
|
+
constructor(args) {
|
|
148
|
+
super("provider-http", `[${args.providerName}] HTTP ${args.status}: ${args.message}`, { ...args.cause !== void 0 ? { cause: args.cause } : {} });
|
|
149
|
+
this.providerName = args.providerName;
|
|
150
|
+
this.status = args.status;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* The streaming response did not match the documented wire format
|
|
155
|
+
* (e.g. malformed SSE chunk, truncated JSON).
|
|
156
|
+
*
|
|
157
|
+
* @stable
|
|
158
|
+
*/
|
|
159
|
+
var ProviderStreamParseError = class extends GraphorinProviderError {
|
|
160
|
+
name = "ProviderStreamParseError";
|
|
161
|
+
providerName;
|
|
162
|
+
constructor(providerName, message, cause) {
|
|
163
|
+
super("provider-stream-parse", `[${providerName}] ${message}`, { ...cause !== void 0 ? { cause } : {} });
|
|
164
|
+
this.providerName = providerName;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* The classifier dispatcher was given a non-Provider value. Programming
|
|
169
|
+
* error; fail-fast at the boundary.
|
|
170
|
+
*
|
|
171
|
+
* @stable
|
|
172
|
+
*/
|
|
173
|
+
var InvalidProviderError = class extends GraphorinProviderError {
|
|
174
|
+
name = "InvalidProviderError";
|
|
175
|
+
constructor(message) {
|
|
176
|
+
super("invalid-provider", message, { hint: "Pass the value returned by createProvider(...) (or any adapter factory) instead of a raw object." });
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
export { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError };
|
|
182
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../src/errors/errors.ts"],"sourcesContent":["/**\n * Typed error hierarchy for `@graphorin/provider`. Every error class\n * carries a stable `kind` discriminant (lowercase, kebab-case) plus an\n * optional `hint` string pointing the user at the recommended fix.\n *\n * @packageDocumentation\n */\n\n/**\n * Base class for every error thrown by `@graphorin/provider`. Consumers\n * narrow on the discriminant `kind` rather than `instanceof` — both\n * work, but discriminants are subclass-friendly.\n *\n * @stable\n */\nexport class GraphorinProviderError extends Error {\n override readonly name: string = 'GraphorinProviderError';\n /** Stable discriminant — `'middleware-ordering'`, `'rate-limit-exceeded'`, … */\n readonly kind: string;\n /** Optional remediation hint shown alongside the message. */\n readonly hint?: string;\n\n constructor(kind: string, message: string, options?: { cause?: unknown; hint?: string }) {\n super(message, options?.cause !== undefined ? { cause: options.cause } : undefined);\n this.kind = kind;\n if (options?.hint !== undefined) {\n this.hint = options.hint;\n }\n }\n}\n\n/**\n * The middleware composer detected an out-of-order middleware. The\n * `offendingPair` field carries the `[outer, inner]` middleware names\n * that violated the canonical order so consumers can surface a precise\n * fix in IDE diagnostics.\n *\n * @stable\n */\nexport class MiddlewareOrderingError extends GraphorinProviderError {\n override readonly name = 'MiddlewareOrderingError';\n readonly offendingPair: readonly [string, string];\n readonly canonicalOrder: readonly string[];\n\n constructor(args: {\n offendingPair: readonly [string, string];\n canonicalOrder: readonly string[];\n message?: string;\n }) {\n super(\n 'middleware-ordering',\n args.message ??\n `Middleware order violation: '${args.offendingPair[0]}' must not wrap '${args.offendingPair[1]}'. ` +\n `Canonical order (outer → inner): ${args.canonicalOrder.join(' → ')}.`,\n {\n hint:\n 'Reorder the middleware array passed to composeProviderMiddleware([...]) to match the canonical order; ' +\n 'see @graphorin/provider/middleware for documentation.',\n },\n );\n this.offendingPair = args.offendingPair;\n this.canonicalOrder = args.canonicalOrder;\n }\n}\n\n/**\n * `withRedaction` was missing at production startup. Thrown by the\n * production hook applied to every composed provider when\n * `process.env.NODE_ENV === 'production'`.\n *\n * @stable\n */\nexport class MissingProductionMiddlewareError extends GraphorinProviderError {\n override readonly name = 'MissingProductionMiddlewareError';\n readonly missing: string;\n\n constructor(missing: string) {\n super(\n 'missing-production-middleware',\n `Production startup hook: required middleware '${missing}' is missing from the provider chain.`,\n {\n hint:\n `Compose '${missing}' as the innermost layer (closest to the underlying provider) before deploying. ` +\n 'See @graphorin/provider/middleware for the canonical composition order.',\n },\n );\n this.missing = missing;\n }\n}\n\n/**\n * `withCostLimit` exceeded its configured ceiling. Carries the\n * triggering scope (`session`, `agent`, `run`, …) so the caller can\n * decide how to surface the breach.\n *\n * @stable\n */\nexport class CostBudgetExceededError extends GraphorinProviderError {\n override readonly name = 'CostBudgetExceededError';\n readonly scope: string;\n readonly limit: number;\n readonly observed: number;\n\n constructor(args: { scope: string; limit: number; observed: number; currency?: string }) {\n super(\n 'cost-budget-exceeded',\n `Cost budget exceeded for '${args.scope}': observed ${args.observed.toFixed(4)} ${args.currency ?? 'USD'} ` +\n `> limit ${args.limit.toFixed(4)} ${args.currency ?? 'USD'}.`,\n {\n hint: 'Raise the limit in withCostLimit({...}), tighten the prompt, or switch to a cheaper model tier.',\n },\n );\n this.scope = args.scope;\n this.limit = args.limit;\n this.observed = args.observed;\n }\n}\n\n/**\n * `withRateLimit` exhausted its bucket and the caller did not opt\n * into `'queue'` mode.\n *\n * @stable\n */\nexport class RateLimitExceededError extends GraphorinProviderError {\n override readonly name = 'RateLimitExceededError';\n readonly retryAfterMs: number;\n\n constructor(retryAfterMs: number) {\n super('rate-limit-exceeded', `Rate limit exceeded; retry after ${retryAfterMs}ms.`, {\n hint: 'Slow down the request rate, raise the bucket size in withRateLimit({...}), or switch to mode: \"queue\".',\n });\n this.retryAfterMs = retryAfterMs;\n }\n}\n\n/**\n * `withRedaction` detected a hit AND the policy is configured for\n * `failClosed: true`. The matched value is **never** part of the\n * message — only the pattern name and field path.\n *\n * @stable\n */\nexport class PromptRedactionError extends GraphorinProviderError {\n override readonly name = 'PromptRedactionError';\n readonly patternName: string;\n readonly fieldPath: string;\n readonly role?: string;\n\n constructor(args: { patternName: string; fieldPath: string; role?: string }) {\n super(\n 'prompt-redaction-fail-closed',\n `Outbound prompt-redaction policy is fail-closed and matched pattern '${args.patternName}' ` +\n `at '${args.fieldPath}'${args.role ? ` (role: ${args.role})` : ''}.`,\n {\n hint: 'Sanitize the prompt before calling the provider, or disable failClosed in withRedaction({...}) for this environment.',\n },\n );\n this.patternName = args.patternName;\n this.fieldPath = args.fieldPath;\n if (args.role !== undefined) this.role = args.role;\n }\n}\n\n/**\n * Raised when a `baseUrl`-driven local adapter is configured against\n * a public host over plaintext HTTP. Adapters refuse to start unless\n * `allowInsecureTransport: true` is supplied (and the override is\n * audit-logged).\n *\n * @stable\n */\nexport class LocalProviderInsecureTransportError extends GraphorinProviderError {\n override readonly name = 'LocalProviderInsecureTransportError';\n readonly baseUrl: string;\n\n constructor(baseUrl: string) {\n super(\n 'local-provider-insecure-transport',\n `Refusing to start: the provider baseUrl '${baseUrl}' is public AND plaintext (http://). ` +\n `Switch to https:// or set allowInsecureTransport: true to acknowledge the risk.`,\n {\n hint:\n 'Public local-LLM endpoints must be served over TLS. Acceptable alternatives: terminate TLS in front of the model server, ' +\n 'tunnel through SSH / WireGuard / Tailscale, or pass allowInsecureTransport: true (audit-logged).',\n },\n );\n this.baseUrl = baseUrl;\n }\n}\n\n/**\n * Legacy alias preserved for one minor; prefer\n * {@link LocalProviderInsecureTransportError}. Removed in v0.2.\n *\n * @deprecated Use {@link LocalProviderInsecureTransportError} instead.\n */\nexport const OllamaInsecureTransportError = LocalProviderInsecureTransportError;\nexport type OllamaInsecureTransportError = LocalProviderInsecureTransportError;\n\n/**\n * Wrapped HTTP error returned by an adapter. Carries the original\n * status code so middleware (`withRetry`, `withFallback`) can decide\n * whether the error is retryable.\n *\n * @stable\n */\nexport class ProviderHttpError extends GraphorinProviderError {\n override readonly name = 'ProviderHttpError';\n readonly status: number;\n readonly providerName: string;\n\n constructor(args: { providerName: string; status: number; message: string; cause?: unknown }) {\n super('provider-http', `[${args.providerName}] HTTP ${args.status}: ${args.message}`, {\n ...(args.cause !== undefined ? { cause: args.cause } : {}),\n });\n this.providerName = args.providerName;\n this.status = args.status;\n }\n}\n\n/**\n * The streaming response did not match the documented wire format\n * (e.g. malformed SSE chunk, truncated JSON).\n *\n * @stable\n */\nexport class ProviderStreamParseError extends GraphorinProviderError {\n override readonly name = 'ProviderStreamParseError';\n readonly providerName: string;\n\n constructor(providerName: string, message: string, cause?: unknown) {\n super('provider-stream-parse', `[${providerName}] ${message}`, {\n ...(cause !== undefined ? { cause } : {}),\n });\n this.providerName = providerName;\n }\n}\n\n/**\n * The classifier dispatcher was given a non-Provider value. Programming\n * error; fail-fast at the boundary.\n *\n * @stable\n */\nexport class InvalidProviderError extends GraphorinProviderError {\n override readonly name = 'InvalidProviderError';\n\n constructor(message: string) {\n super('invalid-provider', message, {\n hint: 'Pass the value returned by createProvider(...) (or any adapter factory) instead of a raw object.',\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAeA,IAAa,yBAAb,cAA4C,MAAM;CAChD,AAAkB,OAAe;;CAEjC,AAAS;;CAET,AAAS;CAET,YAAY,MAAc,SAAiB,SAA8C;AACvF,QAAM,SAAS,SAAS,UAAU,SAAY,EAAE,OAAO,QAAQ,OAAO,GAAG,OAAU;AACnF,OAAK,OAAO;AACZ,MAAI,SAAS,SAAS,OACpB,MAAK,OAAO,QAAQ;;;;;;;;;;;AAa1B,IAAa,0BAAb,cAA6C,uBAAuB;CAClE,AAAkB,OAAO;CACzB,AAAS;CACT,AAAS;CAET,YAAY,MAIT;AACD,QACE,uBACA,KAAK,WACH,gCAAgC,KAAK,cAAc,GAAG,mBAAmB,KAAK,cAAc,GAAG,sCACzD,KAAK,eAAe,KAAK,MAAM,CAAC,IACxE,EACE,MACE,+JAEH,CACF;AACD,OAAK,gBAAgB,KAAK;AAC1B,OAAK,iBAAiB,KAAK;;;;;;;;;;AAW/B,IAAa,mCAAb,cAAsD,uBAAuB;CAC3E,AAAkB,OAAO;CACzB,AAAS;CAET,YAAY,SAAiB;AAC3B,QACE,iCACA,iDAAiD,QAAQ,wCACzD,EACE,MACE,YAAY,QAAQ,0JAEvB,CACF;AACD,OAAK,UAAU;;;;;;;;;;AAWnB,IAAa,0BAAb,cAA6C,uBAAuB;CAClE,AAAkB,OAAO;CACzB,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,MAA6E;AACvF,QACE,wBACA,6BAA6B,KAAK,MAAM,cAAc,KAAK,SAAS,QAAQ,EAAE,CAAC,GAAG,KAAK,YAAY,MAAM,WAC5F,KAAK,MAAM,QAAQ,EAAE,CAAC,GAAG,KAAK,YAAY,MAAM,IAC7D,EACE,MAAM,mGACP,CACF;AACD,OAAK,QAAQ,KAAK;AAClB,OAAK,QAAQ,KAAK;AAClB,OAAK,WAAW,KAAK;;;;;;;;;AAUzB,IAAa,yBAAb,cAA4C,uBAAuB;CACjE,AAAkB,OAAO;CACzB,AAAS;CAET,YAAY,cAAsB;AAChC,QAAM,uBAAuB,oCAAoC,aAAa,MAAM,EAClF,MAAM,4GACP,CAAC;AACF,OAAK,eAAe;;;;;;;;;;AAWxB,IAAa,uBAAb,cAA0C,uBAAuB;CAC/D,AAAkB,OAAO;CACzB,AAAS;CACT,AAAS;CACT,AAAS;CAET,YAAY,MAAiE;AAC3E,QACE,gCACA,wEAAwE,KAAK,YAAY,QAChF,KAAK,UAAU,GAAG,KAAK,OAAO,WAAW,KAAK,KAAK,KAAK,GAAG,IACpE,EACE,MAAM,wHACP,CACF;AACD,OAAK,cAAc,KAAK;AACxB,OAAK,YAAY,KAAK;AACtB,MAAI,KAAK,SAAS,OAAW,MAAK,OAAO,KAAK;;;;;;;;;;;AAYlD,IAAa,sCAAb,cAAyD,uBAAuB;CAC9E,AAAkB,OAAO;CACzB,AAAS;CAET,YAAY,SAAiB;AAC3B,QACE,qCACA,4CAA4C,QAAQ,uHAEpD,EACE,MACE,6NAEH,CACF;AACD,OAAK,UAAU;;;;;;;;;AAUnB,MAAa,+BAA+B;;;;;;;;AAU5C,IAAa,oBAAb,cAAuC,uBAAuB;CAC5D,AAAkB,OAAO;CACzB,AAAS;CACT,AAAS;CAET,YAAY,MAAkF;AAC5F,QAAM,iBAAiB,IAAI,KAAK,aAAa,SAAS,KAAK,OAAO,IAAI,KAAK,WAAW,EACpF,GAAI,KAAK,UAAU,SAAY,EAAE,OAAO,KAAK,OAAO,GAAG,EAAE,EAC1D,CAAC;AACF,OAAK,eAAe,KAAK;AACzB,OAAK,SAAS,KAAK;;;;;;;;;AAUvB,IAAa,2BAAb,cAA8C,uBAAuB;CACnE,AAAkB,OAAO;CACzB,AAAS;CAET,YAAY,cAAsB,SAAiB,OAAiB;AAClE,QAAM,yBAAyB,IAAI,aAAa,IAAI,WAAW,EAC7D,GAAI,UAAU,SAAY,EAAE,OAAO,GAAG,EAAE,EACzC,CAAC;AACF,OAAK,eAAe;;;;;;;;;AAUxB,IAAa,uBAAb,cAA0C,uBAAuB;CAC/D,AAAkB,OAAO;CAEzB,YAAY,SAAiB;AAC3B,QAAM,oBAAoB,SAAS,EACjC,MAAM,oGACP,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError } from "./errors.js";
|
|
2
|
+
export { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError } from "./errors.js";
|
|
2
|
+
|
|
3
|
+
export { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LlamaCppServerAdapterOptions, llamaCppServerAdapter } from "./adapters/llamacpp-server.js";
|
|
2
|
+
import { OllamaAdapterOptions, ollamaAdapter } from "./adapters/ollama.js";
|
|
3
|
+
import { OpenAICompatibleAdapterOptions, openAICompatibleAdapter } from "./adapters/openai-compatible.js";
|
|
4
|
+
import { VercelAdapterOptions, vercelAdapter } from "./adapters/vercel.js";
|
|
5
|
+
import { AnthropicAPICounter, AnthropicAPICounterOptions } from "./counters/anthropic.js";
|
|
6
|
+
import { BedrockAPICounter, BedrockAPICounterOptions } from "./counters/bedrock.js";
|
|
7
|
+
import { CreateDefaultCounterOptions, createDefaultCounter } from "./counters/dispatcher.js";
|
|
8
|
+
import { __resetGlobalTokenCounter, getGlobalTokenCounter, setGlobalTokenCounter } from "./counters/global.js";
|
|
9
|
+
import { GoogleAPICounter, GoogleAPICounterOptions } from "./counters/google.js";
|
|
10
|
+
import { HeuristicCounter, HeuristicCounterOptions } from "./counters/heuristic.js";
|
|
11
|
+
import { JsTiktokenCounter, JsTiktokenCounterOptions, __resetTiktokenCache } from "./counters/js-tiktoken.js";
|
|
12
|
+
import { SerializedMessage, serialiseMessageForCount, serializedToString } from "./counters/serialize.js";
|
|
13
|
+
import "./counters/index.js";
|
|
14
|
+
import { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError } from "./errors/errors.js";
|
|
15
|
+
import "./adapters/index.js";
|
|
16
|
+
import { CANONICAL_MIDDLEWARE_ORDER, MIDDLEWARE_KIND, composeProviderMiddleware, defineProviderMiddleware, getMiddlewareKind, providerHasMiddleware } from "./middleware/compose.js";
|
|
17
|
+
import { ProductionStartupHookOptions, assertProductionMiddleware } from "./middleware/production-hook.js";
|
|
18
|
+
import { WithCostLimitOptions, withCostLimit } from "./middleware/with-cost-limit.js";
|
|
19
|
+
import { CostAccumulator, CostTrackingTotals, WithCostTrackingOptions, createCostAccumulator, withCostTracking } from "./middleware/with-cost-tracking.js";
|
|
20
|
+
import { WithFallbackOptions, withFallback } from "./middleware/with-fallback.js";
|
|
21
|
+
import { WithRateLimitOptions, withRateLimit } from "./middleware/with-rate-limit.js";
|
|
22
|
+
import { PromptRedactionPolicy, PromptRedactionScanScope, PromptRedactionViolation, withRedaction } from "./middleware/with-redaction.js";
|
|
23
|
+
import { WithRetryOptions, withRetry } from "./middleware/with-retry.js";
|
|
24
|
+
import { WithTracingOptions, withTracing } from "./middleware/with-tracing.js";
|
|
25
|
+
import "./middleware/index.js";
|
|
26
|
+
import { CLASSIFIER_RULES, ClassifierRule, classifyModelTier } from "./model-tier/classify.js";
|
|
27
|
+
import "./model-tier/index.js";
|
|
28
|
+
import { CreateProviderOptions, createProvider } from "./provider.js";
|
|
29
|
+
import { ApplyReasoningPolicyInput, applyReasoningPolicy } from "./reasoning/apply-policy.js";
|
|
30
|
+
import { InferReasoningContractInput, REASONING_CONTRACT_RULES, ReasoningContractRule, inferReasoningContract } from "./reasoning/classify-contract.js";
|
|
31
|
+
import { REASONING_RETENTION_DEFAULTS, ResolveReasoningRetentionInput, resolveReasoningRetention } from "./reasoning/retention.js";
|
|
32
|
+
import "./reasoning/index.js";
|
|
33
|
+
import { foldToolExamples } from "./tool-examples.js";
|
|
34
|
+
import { LocalProviderClassification, PERMANENT_LOOPBACK_CLASSIFICATION, SENSITIVITY_DEFAULTS_PER_TRUST, classifyLocalProvider } from "./trust/classify-local-provider.js";
|
|
35
|
+
import { LocalProviderTrust, OllamaTrust } from "./trust/index.js";
|
|
36
|
+
|
|
37
|
+
//#region src/index.d.ts
|
|
38
|
+
/**
|
|
39
|
+
* @graphorin/provider — vendor-neutral LLM provider layer for the
|
|
40
|
+
* Graphorin framework.
|
|
41
|
+
*
|
|
42
|
+
* The package owns:
|
|
43
|
+
*
|
|
44
|
+
* - The `createProvider(...)` factory for wrapping adapter modules in
|
|
45
|
+
* a stable `Provider` shape.
|
|
46
|
+
* - Four adapters out of the box: the Vercel AI SDK adapter for the
|
|
47
|
+
* default cloud path, plus three local-LLM adapters (Ollama HTTP,
|
|
48
|
+
* llama-server HTTP, and a generic OpenAI-compatible adapter for
|
|
49
|
+
* LMStudio / LocalAI / vLLM / Together-style endpoints). All three
|
|
50
|
+
* `baseUrl`-driven adapters share the same {@link LocalProviderTrust}
|
|
51
|
+
* classifier.
|
|
52
|
+
* - The canonical-order middleware composer
|
|
53
|
+
* ({@link composeProviderMiddleware}) and the seven built-in
|
|
54
|
+
* middlewares (`withTracing`, `withRetry`, `withRateLimit`,
|
|
55
|
+
* `withCostLimit`, `withCostTracking`, `withFallback`,
|
|
56
|
+
* `withRedaction`).
|
|
57
|
+
* - The pluggable `TokenCounter` dispatcher (`createDefaultCounter`)
|
|
58
|
+
* plus the per-vendor strategies and a heuristic fallback.
|
|
59
|
+
* - The per-provider model-tier auto-classifier
|
|
60
|
+
* ({@link classifyModelTier}) that maps a `Provider`'s `modelId` to
|
|
61
|
+
* one of `'fast' | 'balanced' | 'smart'`.
|
|
62
|
+
*
|
|
63
|
+
* @packageDocumentation
|
|
64
|
+
*/
|
|
65
|
+
/** Canonical version constant. Mirrors the `package.json` version. */
|
|
66
|
+
declare const VERSION = "0.5.0";
|
|
67
|
+
//#endregion
|
|
68
|
+
export { AnthropicAPICounter, AnthropicAPICounterOptions, ApplyReasoningPolicyInput, BedrockAPICounter, BedrockAPICounterOptions, CANONICAL_MIDDLEWARE_ORDER, CLASSIFIER_RULES, ClassifierRule, CostAccumulator, CostBudgetExceededError, CostTrackingTotals, CreateDefaultCounterOptions, CreateProviderOptions, GoogleAPICounter, GoogleAPICounterOptions, GraphorinProviderError, HeuristicCounter, HeuristicCounterOptions, InferReasoningContractInput, InvalidProviderError, JsTiktokenCounter, JsTiktokenCounterOptions, LlamaCppServerAdapterOptions, LocalProviderClassification, LocalProviderInsecureTransportError, LocalProviderTrust, MIDDLEWARE_KIND, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaAdapterOptions, OllamaInsecureTransportError, OllamaTrust, OpenAICompatibleAdapterOptions, PERMANENT_LOOPBACK_CLASSIFICATION, ProductionStartupHookOptions, PromptRedactionError, PromptRedactionPolicy, PromptRedactionScanScope, PromptRedactionViolation, ProviderHttpError, ProviderStreamParseError, REASONING_CONTRACT_RULES, REASONING_RETENTION_DEFAULTS, RateLimitExceededError, ReasoningContractRule, ResolveReasoningRetentionInput, SENSITIVITY_DEFAULTS_PER_TRUST, SerializedMessage, VERSION, VercelAdapterOptions, WithCostLimitOptions, WithCostTrackingOptions, WithFallbackOptions, WithRateLimitOptions, WithRetryOptions, WithTracingOptions, __resetGlobalTokenCounter, __resetTiktokenCache, applyReasoningPolicy, assertProductionMiddleware, classifyLocalProvider, classifyModelTier, composeProviderMiddleware, createCostAccumulator, createDefaultCounter, createProvider, defineProviderMiddleware, foldToolExamples, getGlobalTokenCounter, getMiddlewareKind, inferReasoningContract, llamaCppServerAdapter, ollamaAdapter, openAICompatibleAdapter, providerHasMiddleware, resolveReasoningRetention, serialiseMessageForCount, serializedToString, setGlobalTokenCounter, vercelAdapter, withCostLimit, withCostTracking, withFallback, withRateLimit, withRedaction, withRetry, withTracing };
|
|
69
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA6Ba,OAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { CostBudgetExceededError, GraphorinProviderError, InvalidProviderError, LocalProviderInsecureTransportError, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, RateLimitExceededError } from "./errors/errors.js";
|
|
2
|
+
import { applyReasoningPolicy } from "./reasoning/apply-policy.js";
|
|
3
|
+
import { REASONING_RETENTION_DEFAULTS, resolveReasoningRetention } from "./reasoning/retention.js";
|
|
4
|
+
import { PERMANENT_LOOPBACK_CLASSIFICATION, SENSITIVITY_DEFAULTS_PER_TRUST, classifyLocalProvider } from "./trust/classify-local-provider.js";
|
|
5
|
+
import { llamaCppServerAdapter } from "./adapters/llamacpp-server.js";
|
|
6
|
+
import { ollamaAdapter } from "./adapters/ollama.js";
|
|
7
|
+
import { openAICompatibleAdapter } from "./adapters/openai-compatible.js";
|
|
8
|
+
import { REASONING_CONTRACT_RULES, inferReasoningContract } from "./reasoning/classify-contract.js";
|
|
9
|
+
import { vercelAdapter } from "./adapters/vercel.js";
|
|
10
|
+
import "./adapters/index.js";
|
|
11
|
+
import { serialiseMessageForCount, serializedToString } from "./counters/serialize.js";
|
|
12
|
+
import { JsTiktokenCounter, __resetTiktokenCache } from "./counters/js-tiktoken.js";
|
|
13
|
+
import { AnthropicAPICounter } from "./counters/anthropic.js";
|
|
14
|
+
import { BedrockAPICounter } from "./counters/bedrock.js";
|
|
15
|
+
import { GoogleAPICounter } from "./counters/google.js";
|
|
16
|
+
import { HeuristicCounter } from "./counters/heuristic.js";
|
|
17
|
+
import { createDefaultCounter } from "./counters/dispatcher.js";
|
|
18
|
+
import { __resetGlobalTokenCounter, getGlobalTokenCounter, setGlobalTokenCounter } from "./counters/global.js";
|
|
19
|
+
import "./counters/index.js";
|
|
20
|
+
import { CANONICAL_MIDDLEWARE_ORDER, MIDDLEWARE_KIND, composeProviderMiddleware, defineProviderMiddleware, getMiddlewareKind, providerHasMiddleware } from "./middleware/compose.js";
|
|
21
|
+
import { assertProductionMiddleware } from "./middleware/production-hook.js";
|
|
22
|
+
import { withCostLimit } from "./middleware/with-cost-limit.js";
|
|
23
|
+
import { createCostAccumulator, withCostTracking } from "./middleware/with-cost-tracking.js";
|
|
24
|
+
import { withFallback } from "./middleware/with-fallback.js";
|
|
25
|
+
import { withRateLimit } from "./middleware/with-rate-limit.js";
|
|
26
|
+
import { withRedaction } from "./middleware/with-redaction.js";
|
|
27
|
+
import { withRetry } from "./middleware/with-retry.js";
|
|
28
|
+
import { withTracing } from "./middleware/with-tracing.js";
|
|
29
|
+
import "./middleware/index.js";
|
|
30
|
+
import { CLASSIFIER_RULES, classifyModelTier } from "./model-tier/classify.js";
|
|
31
|
+
import "./model-tier/index.js";
|
|
32
|
+
import { foldToolExamples } from "./tool-examples.js";
|
|
33
|
+
import { createProvider } from "./provider.js";
|
|
34
|
+
import "./reasoning/index.js";
|
|
35
|
+
import "./trust/index.js";
|
|
36
|
+
|
|
37
|
+
//#region src/index.ts
|
|
38
|
+
/**
|
|
39
|
+
* @graphorin/provider — vendor-neutral LLM provider layer for the
|
|
40
|
+
* Graphorin framework.
|
|
41
|
+
*
|
|
42
|
+
* The package owns:
|
|
43
|
+
*
|
|
44
|
+
* - The `createProvider(...)` factory for wrapping adapter modules in
|
|
45
|
+
* a stable `Provider` shape.
|
|
46
|
+
* - Four adapters out of the box: the Vercel AI SDK adapter for the
|
|
47
|
+
* default cloud path, plus three local-LLM adapters (Ollama HTTP,
|
|
48
|
+
* llama-server HTTP, and a generic OpenAI-compatible adapter for
|
|
49
|
+
* LMStudio / LocalAI / vLLM / Together-style endpoints). All three
|
|
50
|
+
* `baseUrl`-driven adapters share the same {@link LocalProviderTrust}
|
|
51
|
+
* classifier.
|
|
52
|
+
* - The canonical-order middleware composer
|
|
53
|
+
* ({@link composeProviderMiddleware}) and the seven built-in
|
|
54
|
+
* middlewares (`withTracing`, `withRetry`, `withRateLimit`,
|
|
55
|
+
* `withCostLimit`, `withCostTracking`, `withFallback`,
|
|
56
|
+
* `withRedaction`).
|
|
57
|
+
* - The pluggable `TokenCounter` dispatcher (`createDefaultCounter`)
|
|
58
|
+
* plus the per-vendor strategies and a heuristic fallback.
|
|
59
|
+
* - The per-provider model-tier auto-classifier
|
|
60
|
+
* ({@link classifyModelTier}) that maps a `Provider`'s `modelId` to
|
|
61
|
+
* one of `'fast' | 'balanced' | 'smart'`.
|
|
62
|
+
*
|
|
63
|
+
* @packageDocumentation
|
|
64
|
+
*/
|
|
65
|
+
/** Canonical version constant. Mirrors the `package.json` version. */
|
|
66
|
+
const VERSION = "0.5.0";
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { AnthropicAPICounter, BedrockAPICounter, CANONICAL_MIDDLEWARE_ORDER, CLASSIFIER_RULES, CostBudgetExceededError, GoogleAPICounter, GraphorinProviderError, HeuristicCounter, InvalidProviderError, JsTiktokenCounter, LocalProviderInsecureTransportError, MIDDLEWARE_KIND, MiddlewareOrderingError, MissingProductionMiddlewareError, OllamaInsecureTransportError, PERMANENT_LOOPBACK_CLASSIFICATION, PromptRedactionError, ProviderHttpError, ProviderStreamParseError, REASONING_CONTRACT_RULES, REASONING_RETENTION_DEFAULTS, RateLimitExceededError, SENSITIVITY_DEFAULTS_PER_TRUST, VERSION, __resetGlobalTokenCounter, __resetTiktokenCache, applyReasoningPolicy, assertProductionMiddleware, classifyLocalProvider, classifyModelTier, composeProviderMiddleware, createCostAccumulator, createDefaultCounter, createProvider, defineProviderMiddleware, foldToolExamples, getGlobalTokenCounter, getMiddlewareKind, inferReasoningContract, llamaCppServerAdapter, ollamaAdapter, openAICompatibleAdapter, providerHasMiddleware, resolveReasoningRetention, serialiseMessageForCount, serializedToString, setGlobalTokenCounter, vercelAdapter, withCostLimit, withCostTracking, withFallback, withRateLimit, withRedaction, withRetry, withTracing };
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/**\n * @graphorin/provider — vendor-neutral LLM provider layer for the\n * Graphorin framework.\n *\n * The package owns:\n *\n * - The `createProvider(...)` factory for wrapping adapter modules in\n * a stable `Provider` shape.\n * - Four adapters out of the box: the Vercel AI SDK adapter for the\n * default cloud path, plus three local-LLM adapters (Ollama HTTP,\n * llama-server HTTP, and a generic OpenAI-compatible adapter for\n * LMStudio / LocalAI / vLLM / Together-style endpoints). All three\n * `baseUrl`-driven adapters share the same {@link LocalProviderTrust}\n * classifier.\n * - The canonical-order middleware composer\n * ({@link composeProviderMiddleware}) and the seven built-in\n * middlewares (`withTracing`, `withRetry`, `withRateLimit`,\n * `withCostLimit`, `withCostTracking`, `withFallback`,\n * `withRedaction`).\n * - The pluggable `TokenCounter` dispatcher (`createDefaultCounter`)\n * plus the per-vendor strategies and a heuristic fallback.\n * - The per-provider model-tier auto-classifier\n * ({@link classifyModelTier}) that maps a `Provider`'s `modelId` to\n * one of `'fast' | 'balanced' | 'smart'`.\n *\n * @packageDocumentation\n */\n\n/** Canonical version constant. Mirrors the `package.json` version. */\nexport const VERSION = '0.5.0';\n\nexport * from './adapters/index.js';\nexport * from './counters/index.js';\nexport * from './errors/index.js';\nexport * from './middleware/index.js';\nexport * from './model-tier/index.js';\nexport * from './provider.js';\nexport * from './reasoning/index.js';\nexport { foldToolExamples } from './tool-examples.js';\nexport * from './trust/index.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,UAAU"}
|