@namzu/sdk 1.3.0 → 2.0.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 +106 -0
- package/dist/compaction/__tests__/verifier-empty-reply.test.d.ts +12 -0
- package/dist/compaction/__tests__/verifier-empty-reply.test.d.ts.map +1 -0
- package/dist/compaction/__tests__/verifier-empty-reply.test.js +73 -0
- package/dist/compaction/__tests__/verifier-empty-reply.test.js.map +1 -0
- package/dist/compaction/verifier.d.ts.map +1 -1
- package/dist/compaction/verifier.js +10 -1
- package/dist/compaction/verifier.js.map +1 -1
- package/dist/config/__tests__/compaction-budget-schema.test.d.ts +18 -0
- package/dist/config/__tests__/compaction-budget-schema.test.d.ts.map +1 -0
- package/dist/config/__tests__/compaction-budget-schema.test.js +96 -0
- package/dist/config/__tests__/compaction-budget-schema.test.js.map +1 -0
- package/dist/config/runtime.d.ts.map +1 -1
- package/dist/config/runtime.js +20 -11
- package/dist/config/runtime.js.map +1 -1
- package/dist/manager/run/persistence.d.ts +2 -1
- package/dist/manager/run/persistence.d.ts.map +1 -1
- package/dist/manager/run/persistence.js +3 -1
- package/dist/manager/run/persistence.js.map +1 -1
- package/dist/provider/__tests__/errors.test.d.ts +2 -0
- package/dist/provider/__tests__/errors.test.d.ts.map +1 -0
- package/dist/provider/__tests__/errors.test.js +61 -0
- package/dist/provider/__tests__/errors.test.js.map +1 -0
- package/dist/provider/errors.d.ts +108 -0
- package/dist/provider/errors.d.ts.map +1 -0
- package/dist/provider/errors.js +311 -0
- package/dist/provider/errors.js.map +1 -0
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.d.ts.map +1 -1
- package/dist/provider/index.js +1 -0
- package/dist/provider/index.js.map +1 -1
- package/dist/public-runtime.d.ts +11 -11
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +11 -11
- package/dist/public-runtime.js.map +1 -1
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +45 -12
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/registry/tool/execute.test.js +104 -7
- package/dist/registry/tool/execute.test.js.map +1 -1
- package/dist/registry/toolset/catalog.d.ts.map +1 -1
- package/dist/registry/toolset/catalog.js +17 -4
- package/dist/registry/toolset/catalog.js.map +1 -1
- package/dist/registry/toolset/catalog.test.js +101 -0
- package/dist/registry/toolset/catalog.test.js.map +1 -1
- package/dist/runtime/query/__tests__/capability-negotiation.test.js +79 -0
- package/dist/runtime/query/__tests__/capability-negotiation.test.js.map +1 -1
- package/dist/runtime/query/__tests__/deferred-tools.test.js +100 -0
- package/dist/runtime/query/__tests__/deferred-tools.test.js.map +1 -1
- package/dist/runtime/query/__tests__/long-document-flow.test.js +12 -12
- package/dist/runtime/query/__tests__/long-document-flow.test.js.map +1 -1
- package/dist/runtime/query/__tests__/stream-recovery.test.js +55 -2
- package/dist/runtime/query/__tests__/stream-recovery.test.js.map +1 -1
- package/dist/runtime/query/executor.js +2 -2
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +10 -0
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction-safe-cut.test.d.ts +32 -0
- package/dist/runtime/query/iteration/phases/compaction-safe-cut.test.d.ts.map +1 -0
- package/dist/runtime/query/iteration/phases/compaction-safe-cut.test.js +152 -0
- package/dist/runtime/query/iteration/phases/compaction-safe-cut.test.js.map +1 -0
- package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/compaction.js +52 -12
- package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +11 -5
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +11 -1
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/tools/builtins/__tests__/edit.test.js +216 -10
- package/dist/tools/builtins/__tests__/edit.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/payload-budget.test.js +30 -16
- package/dist/tools/builtins/__tests__/payload-budget.test.js.map +1 -1
- package/dist/tools/builtins/__tests__/write-file.test.js +37 -13
- package/dist/tools/builtins/__tests__/write-file.test.js.map +1 -1
- package/dist/tools/builtins/atomic-write-file.d.ts +13 -0
- package/dist/tools/builtins/atomic-write-file.d.ts.map +1 -0
- package/dist/tools/builtins/atomic-write-file.js +46 -0
- package/dist/tools/builtins/atomic-write-file.js.map +1 -0
- package/dist/tools/builtins/bash.js +2 -2
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/edit.d.ts +2 -5
- package/dist/tools/builtins/edit.d.ts.map +1 -1
- package/dist/tools/builtins/edit.js +105 -125
- package/dist/tools/builtins/edit.js.map +1 -1
- package/dist/tools/builtins/file-mutation-lock.d.ts +7 -0
- package/dist/tools/builtins/file-mutation-lock.d.ts.map +1 -0
- package/dist/tools/builtins/file-mutation-lock.js +25 -0
- package/dist/tools/builtins/file-mutation-lock.js.map +1 -0
- package/dist/tools/builtins/index.js +2 -2
- package/dist/tools/builtins/index.js.map +1 -1
- package/dist/tools/builtins/write-file.d.ts +1 -2
- package/dist/tools/builtins/write-file.d.ts.map +1 -1
- package/dist/tools/builtins/write-file.js +66 -40
- package/dist/tools/builtins/write-file.js.map +1 -1
- package/dist/tools/coordinator/__tests__/task-list.test.js +14 -0
- package/dist/tools/coordinator/__tests__/task-list.test.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts +6 -8
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/agent.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +11 -32
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/defineTool.d.ts +3 -0
- package/dist/tools/defineTool.d.ts.map +1 -1
- package/dist/tools/defineTool.js +3 -0
- package/dist/tools/defineTool.js.map +1 -1
- package/dist/types/provider/chat.d.ts +9 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/error.d.ts +22 -0
- package/dist/types/provider/error.d.ts.map +1 -0
- package/dist/types/provider/error.js +2 -0
- package/dist/types/provider/error.js.map +1 -0
- package/dist/types/provider/index.d.ts +1 -0
- package/dist/types/provider/index.d.ts.map +1 -1
- package/dist/types/run/entity.d.ts +2 -0
- package/dist/types/run/entity.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +2 -0
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/sandbox/index.d.ts +4 -0
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/tool/index.d.ts +20 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/compaction/__tests__/verifier-empty-reply.test.ts +96 -0
- package/src/compaction/verifier.ts +10 -1
- package/src/config/__tests__/compaction-budget-schema.test.ts +114 -0
- package/src/config/runtime.ts +20 -11
- package/src/manager/run/persistence.ts +3 -1
- package/src/provider/__tests__/errors.test.ts +85 -0
- package/src/provider/errors.ts +344 -0
- package/src/provider/index.ts +15 -0
- package/src/public-runtime.ts +53 -10
- package/src/registry/tool/execute.test.ts +121 -7
- package/src/registry/tool/execute.ts +50 -12
- package/src/registry/toolset/catalog.test.ts +118 -0
- package/src/registry/toolset/catalog.ts +26 -4
- package/src/runtime/query/__tests__/capability-negotiation.test.ts +88 -0
- package/src/runtime/query/__tests__/deferred-tools.test.ts +111 -0
- package/src/runtime/query/__tests__/long-document-flow.test.ts +12 -12
- package/src/runtime/query/__tests__/stream-recovery.test.ts +65 -2
- package/src/runtime/query/executor.ts +2 -2
- package/src/runtime/query/iteration/index.ts +15 -0
- package/src/runtime/query/iteration/phases/compaction-safe-cut.test.ts +186 -0
- package/src/runtime/query/iteration/phases/compaction.ts +54 -12
- package/src/runtime/query/iteration/stream-turn.ts +11 -6
- package/src/runtime/query/result.ts +11 -1
- package/src/tools/builtins/__tests__/edit.test.ts +270 -10
- package/src/tools/builtins/__tests__/payload-budget.test.ts +40 -20
- package/src/tools/builtins/__tests__/write-file.test.ts +52 -13
- package/src/tools/builtins/atomic-write-file.ts +58 -0
- package/src/tools/builtins/bash.ts +2 -2
- package/src/tools/builtins/edit.ts +116 -162
- package/src/tools/builtins/file-mutation-lock.ts +27 -0
- package/src/tools/builtins/index.ts +2 -2
- package/src/tools/builtins/write-file.ts +68 -44
- package/src/tools/coordinator/__tests__/task-list.test.ts +16 -0
- package/src/tools/coordinator/agent.ts +6 -8
- package/src/tools/coordinator/index.ts +11 -34
- package/src/tools/defineTool.ts +6 -0
- package/src/types/provider/chat.ts +14 -1
- package/src/types/provider/error.ts +29 -0
- package/src/types/provider/index.ts +5 -0
- package/src/types/run/entity.ts +2 -0
- package/src/types/run/events.ts +7 -1
- package/src/types/sandbox/index.ts +4 -0
- package/src/types/tool/index.ts +20 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One classified error for every provider failure.
|
|
3
|
+
*
|
|
4
|
+
* Before this, a failure from any of the seven drivers reached the caller as an
|
|
5
|
+
* opaque string, so nothing downstream could decide whether it was worth
|
|
6
|
+
* retrying, whether it was the caller's fault, or whether the context window had
|
|
7
|
+
* simply run out. Two drivers built that string by interpolating the response
|
|
8
|
+
* body; three more inherited a vendor SDK error whose message IS the response
|
|
9
|
+
* body. Either way, a credential the upstream echoed back landed in a message
|
|
10
|
+
* that gets logged.
|
|
11
|
+
*
|
|
12
|
+
* So the contract here is deliberately narrow:
|
|
13
|
+
*
|
|
14
|
+
* - the message is built from the STATUS LINE and the classified `kind`. The
|
|
15
|
+
* response body is read to classify and then dropped. It is never
|
|
16
|
+
* interpolated, never re-thrown, and never attached as `cause` — a `cause`
|
|
17
|
+
* survives every logger that serializes an error chain, which defeats the
|
|
18
|
+
* point.
|
|
19
|
+
* - `retryAfterMs` is DATA. Nothing in this module sleeps, backs off or
|
|
20
|
+
* retries. A retry loop inside a driver burns the run's wall clock and hides
|
|
21
|
+
* the failure from the layer that should decide.
|
|
22
|
+
*/
|
|
23
|
+
import type { ProviderErrorKind, ProviderRequestErrorInit } from '../types/provider/error.js';
|
|
24
|
+
export type { ProviderErrorInfo, ProviderErrorKind, ProviderRequestErrorInit, } from '../types/provider/error.js';
|
|
25
|
+
/**
|
|
26
|
+
* A provider request that failed, classified.
|
|
27
|
+
*
|
|
28
|
+
* `name` is set explicitly rather than inherited, because the classifier is
|
|
29
|
+
* matched structurally across a package boundary (a driver in one package throws
|
|
30
|
+
* it; the runtime in another reads it) and `instanceof` is unreliable when two
|
|
31
|
+
* copies of the SDK end up in one process.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ProviderRequestError extends Error {
|
|
34
|
+
readonly kind: ProviderErrorKind;
|
|
35
|
+
readonly providerId: string;
|
|
36
|
+
readonly status?: number;
|
|
37
|
+
readonly retryAfterMs?: number;
|
|
38
|
+
constructor(init: ProviderRequestErrorInit);
|
|
39
|
+
}
|
|
40
|
+
/** Is this a classified provider failure, whichever SDK copy threw it? */
|
|
41
|
+
export declare function isProviderRequestError(err: unknown): err is ProviderRequestError;
|
|
42
|
+
/**
|
|
43
|
+
* Did the caller's own AbortSignal terminate this request?
|
|
44
|
+
*
|
|
45
|
+
* Provider SDKs do not agree on the object they reject with: some preserve
|
|
46
|
+
* `signal.reason`, while others replace it with `AbortError` or
|
|
47
|
+
* `APIUserAbortError`. Reclassifying any of those as a network failure breaks
|
|
48
|
+
* the runtime's Stop/cancel path, which depends on the abort escaping the
|
|
49
|
+
* provider boundary.
|
|
50
|
+
*
|
|
51
|
+
* The signal must itself be aborted. That condition distinguishes a caller Stop
|
|
52
|
+
* from an SDK timeout which may also use an `AbortError`-shaped rejection.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isCallerAbortError(error: unknown, signal?: AbortSignal): boolean;
|
|
55
|
+
/** Does this response body say the request did not fit the window? */
|
|
56
|
+
export declare function bodySaysContextOverflow(body: string | undefined | null): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* `Retry-After` in milliseconds. The header is either delta-seconds or an
|
|
59
|
+
* HTTP-date; both are specified, and vendors use both.
|
|
60
|
+
*
|
|
61
|
+
* Returns undefined for anything unparseable or for a date already in the past —
|
|
62
|
+
* a negative delay is worse than none, because a caller would treat it as
|
|
63
|
+
* "retry immediately" against a provider that just asked it to wait.
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseRetryAfterMs(headerValue: string | null | undefined, now?: number): number | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Classify an HTTP failure. `body` is used ONLY to separate a context overflow
|
|
68
|
+
* from an ordinary bad request, and is not retained.
|
|
69
|
+
*/
|
|
70
|
+
export declare function classifyProviderHttpStatus(status: number, body?: string | null): ProviderErrorKind;
|
|
71
|
+
/**
|
|
72
|
+
* Classify an error thrown by a vendor SDK and replace it.
|
|
73
|
+
*
|
|
74
|
+
* This exists because wrapping our OWN `!response.ok` throws is not enough. The
|
|
75
|
+
* Anthropic, OpenAI and ollama clients each build their error message FROM the
|
|
76
|
+
* response body, so a credential the upstream echoed back is already inside
|
|
77
|
+
* `err.message` before our code sees it. Proven with a planted fake token on all
|
|
78
|
+
* three.
|
|
79
|
+
*
|
|
80
|
+
* So the vendor error is read for its status and scanned for an overflow
|
|
81
|
+
* signature, and then **dropped entirely** — not re-thrown, not wrapped, and not
|
|
82
|
+
* attached as `cause`. A `cause` is exactly what a structured logger walks, so
|
|
83
|
+
* keeping one for debuggability would reintroduce the leak it is meant to close.
|
|
84
|
+
*
|
|
85
|
+
* `name` is checked too, because AWS models its failures as distinct classes
|
|
86
|
+
* (`ThrottlingException`, `ValidationException`, `AccessDeniedException`) rather
|
|
87
|
+
* than as status codes.
|
|
88
|
+
*/
|
|
89
|
+
export declare function providerVendorError(input: {
|
|
90
|
+
readonly providerId: string;
|
|
91
|
+
readonly error: unknown;
|
|
92
|
+
readonly retryAfter?: string | null;
|
|
93
|
+
readonly now?: number;
|
|
94
|
+
}): ProviderRequestError;
|
|
95
|
+
/**
|
|
96
|
+
* Build a classified error from a failed HTTP response.
|
|
97
|
+
*
|
|
98
|
+
* Callers pass the body they already read for classification; this function
|
|
99
|
+
* does not return it, store it, or put it in the message.
|
|
100
|
+
*/
|
|
101
|
+
export declare function providerHttpError(input: {
|
|
102
|
+
readonly providerId: string;
|
|
103
|
+
readonly status: number;
|
|
104
|
+
readonly body?: string | null;
|
|
105
|
+
readonly retryAfter?: string | null;
|
|
106
|
+
readonly now?: number;
|
|
107
|
+
}): ProviderRequestError;
|
|
108
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/provider/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,YAAY,EACX,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,4BAA4B,CAAA;AAWnC;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,SAAgB,IAAI,EAAE,iBAAiB,CAAA;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAA;IAClC,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;IAC/B,SAAgB,YAAY,CAAC,EAAE,MAAM,CAAA;gBAEzB,IAAI,EAAE,wBAAwB;CAQ1C;AAED,0EAA0E;AAC1E,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,oBAAoB,CAOhF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAKhF;AAwCD,sEAAsE;AACtE,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAGhF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACtC,GAAG,GAAE,MAAmB,GACtB,MAAM,GAAG,SAAS,CAepB;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACzC,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAClB,iBAAiB,CAanB;AAyED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAC1C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,oBAAoB,CAwCvB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACxC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,oBAAoB,CASvB"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One classified error for every provider failure.
|
|
3
|
+
*
|
|
4
|
+
* Before this, a failure from any of the seven drivers reached the caller as an
|
|
5
|
+
* opaque string, so nothing downstream could decide whether it was worth
|
|
6
|
+
* retrying, whether it was the caller's fault, or whether the context window had
|
|
7
|
+
* simply run out. Two drivers built that string by interpolating the response
|
|
8
|
+
* body; three more inherited a vendor SDK error whose message IS the response
|
|
9
|
+
* body. Either way, a credential the upstream echoed back landed in a message
|
|
10
|
+
* that gets logged.
|
|
11
|
+
*
|
|
12
|
+
* So the contract here is deliberately narrow:
|
|
13
|
+
*
|
|
14
|
+
* - the message is built from the STATUS LINE and the classified `kind`. The
|
|
15
|
+
* response body is read to classify and then dropped. It is never
|
|
16
|
+
* interpolated, never re-thrown, and never attached as `cause` — a `cause`
|
|
17
|
+
* survives every logger that serializes an error chain, which defeats the
|
|
18
|
+
* point.
|
|
19
|
+
* - `retryAfterMs` is DATA. Nothing in this module sleeps, backs off or
|
|
20
|
+
* retries. A retry loop inside a driver burns the run's wall clock and hides
|
|
21
|
+
* the failure from the layer that should decide.
|
|
22
|
+
*/
|
|
23
|
+
const PROVIDER_ERROR_KINDS = [
|
|
24
|
+
'throttle',
|
|
25
|
+
'network',
|
|
26
|
+
'auth',
|
|
27
|
+
'context_overflow',
|
|
28
|
+
'bad_request',
|
|
29
|
+
'server',
|
|
30
|
+
];
|
|
31
|
+
/**
|
|
32
|
+
* A provider request that failed, classified.
|
|
33
|
+
*
|
|
34
|
+
* `name` is set explicitly rather than inherited, because the classifier is
|
|
35
|
+
* matched structurally across a package boundary (a driver in one package throws
|
|
36
|
+
* it; the runtime in another reads it) and `instanceof` is unreliable when two
|
|
37
|
+
* copies of the SDK end up in one process.
|
|
38
|
+
*/
|
|
39
|
+
export class ProviderRequestError extends Error {
|
|
40
|
+
kind;
|
|
41
|
+
providerId;
|
|
42
|
+
status;
|
|
43
|
+
retryAfterMs;
|
|
44
|
+
constructor(init) {
|
|
45
|
+
super(buildProviderErrorMessage(init));
|
|
46
|
+
this.name = 'ProviderRequestError';
|
|
47
|
+
this.kind = init.kind;
|
|
48
|
+
this.providerId = init.providerId;
|
|
49
|
+
if (init.status !== undefined)
|
|
50
|
+
this.status = init.status;
|
|
51
|
+
if (init.retryAfterMs !== undefined)
|
|
52
|
+
this.retryAfterMs = init.retryAfterMs;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Is this a classified provider failure, whichever SDK copy threw it? */
|
|
56
|
+
export function isProviderRequestError(err) {
|
|
57
|
+
return (err instanceof Error &&
|
|
58
|
+
err.name === 'ProviderRequestError' &&
|
|
59
|
+
typeof err.providerId === 'string' &&
|
|
60
|
+
PROVIDER_ERROR_KINDS.includes(err.kind));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Did the caller's own AbortSignal terminate this request?
|
|
64
|
+
*
|
|
65
|
+
* Provider SDKs do not agree on the object they reject with: some preserve
|
|
66
|
+
* `signal.reason`, while others replace it with `AbortError` or
|
|
67
|
+
* `APIUserAbortError`. Reclassifying any of those as a network failure breaks
|
|
68
|
+
* the runtime's Stop/cancel path, which depends on the abort escaping the
|
|
69
|
+
* provider boundary.
|
|
70
|
+
*
|
|
71
|
+
* The signal must itself be aborted. That condition distinguishes a caller Stop
|
|
72
|
+
* from an SDK timeout which may also use an `AbortError`-shaped rejection.
|
|
73
|
+
*/
|
|
74
|
+
export function isCallerAbortError(error, signal) {
|
|
75
|
+
if (!signal?.aborted)
|
|
76
|
+
return false;
|
|
77
|
+
if (error === signal.reason)
|
|
78
|
+
return true;
|
|
79
|
+
if (!(error instanceof Error))
|
|
80
|
+
return false;
|
|
81
|
+
return error.name === 'AbortError' || error.name === 'APIUserAbortError';
|
|
82
|
+
}
|
|
83
|
+
const KIND_SENTENCE = {
|
|
84
|
+
throttle: 'rate limited by the provider',
|
|
85
|
+
network: 'could not reach the provider',
|
|
86
|
+
auth: 'the provider rejected the request credentials',
|
|
87
|
+
context_overflow: 'the request exceeded the model context window',
|
|
88
|
+
bad_request: 'the provider rejected the request as invalid',
|
|
89
|
+
server: 'the provider failed to complete the request',
|
|
90
|
+
};
|
|
91
|
+
function buildProviderErrorMessage(init) {
|
|
92
|
+
const status = init.status !== undefined ? ` (HTTP ${init.status})` : '';
|
|
93
|
+
const detail = init.detail ? `: ${init.detail}` : '';
|
|
94
|
+
return `${init.providerId}${status} — ${KIND_SENTENCE[init.kind]}${detail}`;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Body fragments that mean "the request did not fit", across the vendors we
|
|
98
|
+
* drive. Matched case-insensitively against the raw body, which is then
|
|
99
|
+
* discarded.
|
|
100
|
+
*
|
|
101
|
+
* A 400 is otherwise `bad_request`: an overflow is the one 400 a caller can act
|
|
102
|
+
* on automatically (compact and retry), and mistaking a genuine schema error for
|
|
103
|
+
* an overflow would send the run into a pointless compaction loop.
|
|
104
|
+
*/
|
|
105
|
+
const OVERFLOW_BODY_PATTERNS = [
|
|
106
|
+
/prompt is too long/i,
|
|
107
|
+
/context[_ ]length[_ ]exceeded/i,
|
|
108
|
+
/maximum context length/i,
|
|
109
|
+
/too long for requested model/i,
|
|
110
|
+
/input is too long/i,
|
|
111
|
+
/(?:input|prompt|context).{0,80}exceeds the maximum/i,
|
|
112
|
+
/reduce the (?:input|prompt|context) length/i,
|
|
113
|
+
// Ollama phrases it the other way round — "input length exceeds context
|
|
114
|
+
// length" — so a pattern anchored on "exceeded" misses it entirely.
|
|
115
|
+
/exceeds?\s+(?:the\s+)?(?:model'?s?\s+)?context\s+(?:length|window|size)/i,
|
|
116
|
+
/context\s+(?:length|window|size)\s+exceed/i,
|
|
117
|
+
];
|
|
118
|
+
/** Does this response body say the request did not fit the window? */
|
|
119
|
+
export function bodySaysContextOverflow(body) {
|
|
120
|
+
if (!body)
|
|
121
|
+
return false;
|
|
122
|
+
return OVERFLOW_BODY_PATTERNS.some((re) => re.test(body));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* `Retry-After` in milliseconds. The header is either delta-seconds or an
|
|
126
|
+
* HTTP-date; both are specified, and vendors use both.
|
|
127
|
+
*
|
|
128
|
+
* Returns undefined for anything unparseable or for a date already in the past —
|
|
129
|
+
* a negative delay is worse than none, because a caller would treat it as
|
|
130
|
+
* "retry immediately" against a provider that just asked it to wait.
|
|
131
|
+
*/
|
|
132
|
+
export function parseRetryAfterMs(headerValue, now = Date.now()) {
|
|
133
|
+
if (!headerValue)
|
|
134
|
+
return undefined;
|
|
135
|
+
const trimmed = headerValue.trim();
|
|
136
|
+
if (trimmed === '')
|
|
137
|
+
return undefined;
|
|
138
|
+
if (/^\d+(\.\d+)?$/.test(trimmed)) {
|
|
139
|
+
const seconds = Number(trimmed);
|
|
140
|
+
if (!Number.isFinite(seconds) || seconds < 0)
|
|
141
|
+
return undefined;
|
|
142
|
+
return Math.round(seconds * 1000);
|
|
143
|
+
}
|
|
144
|
+
const at = Date.parse(trimmed);
|
|
145
|
+
if (Number.isNaN(at))
|
|
146
|
+
return undefined;
|
|
147
|
+
const delta = at - now;
|
|
148
|
+
return delta > 0 ? delta : undefined;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Classify an HTTP failure. `body` is used ONLY to separate a context overflow
|
|
152
|
+
* from an ordinary bad request, and is not retained.
|
|
153
|
+
*/
|
|
154
|
+
export function classifyProviderHttpStatus(status, body) {
|
|
155
|
+
if (status === 401 || status === 403)
|
|
156
|
+
return 'auth';
|
|
157
|
+
if (status === 429)
|
|
158
|
+
return 'throttle';
|
|
159
|
+
if (status === 408 || status === 425)
|
|
160
|
+
return 'network';
|
|
161
|
+
if (status >= 500)
|
|
162
|
+
return 'server';
|
|
163
|
+
if (status === 413) {
|
|
164
|
+
return bodySaysContextOverflow(body) ? 'context_overflow' : 'bad_request';
|
|
165
|
+
}
|
|
166
|
+
if (status >= 400) {
|
|
167
|
+
return bodySaysContextOverflow(body) ? 'context_overflow' : 'bad_request';
|
|
168
|
+
}
|
|
169
|
+
// A non-failure status reaching here is a caller bug, not a provider one.
|
|
170
|
+
return 'server';
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Vendor error TYPES, as the vendors name them in their own payloads. This is a
|
|
174
|
+
* defined vocabulary, not prose, which is what makes it safe to classify on:
|
|
175
|
+
* Anthropic sends `{"error":{"type":"overloaded_error"}}` and OpenAI sends
|
|
176
|
+
* `{"error":{"code":"context_length_exceeded"}}`.
|
|
177
|
+
*
|
|
178
|
+
* It matters for MID-STREAM failures above all. Those arrive after a 200, so
|
|
179
|
+
* there is no status to classify from, and without this an upstream overload
|
|
180
|
+
* would be filed as `network` — "we could not reach the provider" — when the
|
|
181
|
+
* provider answered and then gave up. The distinction is the whole point of the
|
|
182
|
+
* taxonomy: one is worth retrying elsewhere, the other is worth retrying here.
|
|
183
|
+
*/
|
|
184
|
+
const VENDOR_TYPE_KINDS = [
|
|
185
|
+
[/overloaded_error|api_error|service_unavailable/i, 'server'],
|
|
186
|
+
[/rate_limit_error|rate_limit_exceeded/i, 'throttle'],
|
|
187
|
+
[/authentication_error|permission_error|invalid_api_key|unauthorized/i, 'auth'],
|
|
188
|
+
[/timeout_error|connection_error/i, 'network'],
|
|
189
|
+
];
|
|
190
|
+
/** The kind a vendor's own error-type vocabulary implies, if it says one. */
|
|
191
|
+
function vendorTypeKind(message) {
|
|
192
|
+
for (const [re, kind] of VENDOR_TYPE_KINDS) {
|
|
193
|
+
if (re.test(message))
|
|
194
|
+
return kind;
|
|
195
|
+
}
|
|
196
|
+
return undefined;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Status code off a vendor SDK's own error object, whatever it calls the field.
|
|
200
|
+
* Anthropic and OpenAI use `status`; the ollama client uses `status_code`; AWS
|
|
201
|
+
* puts it under `$metadata.httpStatusCode`.
|
|
202
|
+
*/
|
|
203
|
+
function vendorErrorStatus(err) {
|
|
204
|
+
if (typeof err !== 'object' || err === null)
|
|
205
|
+
return undefined;
|
|
206
|
+
const e = err;
|
|
207
|
+
for (const candidate of [e.status, e.statusCode, e.status_code, e.$metadata?.httpStatusCode]) {
|
|
208
|
+
if (typeof candidate === 'number' && Number.isFinite(candidate))
|
|
209
|
+
return candidate;
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* `retry-after` off a vendor SDK error's captured response headers. The
|
|
215
|
+
* Anthropic and OpenAI clients both attach them (as a `Headers` instance or a
|
|
216
|
+
* plain object depending on version); the ollama client throws them away, which
|
|
217
|
+
* is why `retryAfterMs` is genuinely unavailable on that driver.
|
|
218
|
+
*/
|
|
219
|
+
function vendorRetryAfter(err) {
|
|
220
|
+
if (typeof err !== 'object' || err === null)
|
|
221
|
+
return undefined;
|
|
222
|
+
// AWS keeps the response one level down, on `$response`; the Anthropic and
|
|
223
|
+
// OpenAI clients attach `headers` directly.
|
|
224
|
+
const headers = err.headers ??
|
|
225
|
+
err.$response?.headers;
|
|
226
|
+
if (!headers)
|
|
227
|
+
return undefined;
|
|
228
|
+
if (typeof headers.get === 'function') {
|
|
229
|
+
return headers.get('retry-after') ?? undefined;
|
|
230
|
+
}
|
|
231
|
+
const record = headers;
|
|
232
|
+
for (const key of ['retry-after', 'Retry-After', 'retryAfter']) {
|
|
233
|
+
const value = record[key];
|
|
234
|
+
if (typeof value === 'string')
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Classify an error thrown by a vendor SDK and replace it.
|
|
241
|
+
*
|
|
242
|
+
* This exists because wrapping our OWN `!response.ok` throws is not enough. The
|
|
243
|
+
* Anthropic, OpenAI and ollama clients each build their error message FROM the
|
|
244
|
+
* response body, so a credential the upstream echoed back is already inside
|
|
245
|
+
* `err.message` before our code sees it. Proven with a planted fake token on all
|
|
246
|
+
* three.
|
|
247
|
+
*
|
|
248
|
+
* So the vendor error is read for its status and scanned for an overflow
|
|
249
|
+
* signature, and then **dropped entirely** — not re-thrown, not wrapped, and not
|
|
250
|
+
* attached as `cause`. A `cause` is exactly what a structured logger walks, so
|
|
251
|
+
* keeping one for debuggability would reintroduce the leak it is meant to close.
|
|
252
|
+
*
|
|
253
|
+
* `name` is checked too, because AWS models its failures as distinct classes
|
|
254
|
+
* (`ThrottlingException`, `ValidationException`, `AccessDeniedException`) rather
|
|
255
|
+
* than as status codes.
|
|
256
|
+
*/
|
|
257
|
+
export function providerVendorError(input) {
|
|
258
|
+
const { error } = input;
|
|
259
|
+
const status = vendorErrorStatus(error);
|
|
260
|
+
const name = error instanceof Error ? error.name : '';
|
|
261
|
+
const message = error instanceof Error ? error.message : '';
|
|
262
|
+
let kind;
|
|
263
|
+
if (/ThrottlingException|TooManyRequests|ServiceQuotaExceeded/i.test(name)) {
|
|
264
|
+
kind = 'throttle';
|
|
265
|
+
}
|
|
266
|
+
else if (/AccessDenied|Unauthorized|Forbidden|Authentication/i.test(name)) {
|
|
267
|
+
kind = 'auth';
|
|
268
|
+
}
|
|
269
|
+
else if (/ValidationException/i.test(name)) {
|
|
270
|
+
kind = bodySaysContextOverflow(message) ? 'context_overflow' : 'bad_request';
|
|
271
|
+
}
|
|
272
|
+
else if (/ServiceUnavailable|InternalServer|ModelTimeout|ModelStreamError|ModelError|ModelNotReady/i.test(name)) {
|
|
273
|
+
kind = 'server';
|
|
274
|
+
}
|
|
275
|
+
else if (status !== undefined) {
|
|
276
|
+
kind = classifyProviderHttpStatus(status, message);
|
|
277
|
+
}
|
|
278
|
+
else if (bodySaysContextOverflow(message)) {
|
|
279
|
+
kind = 'context_overflow';
|
|
280
|
+
}
|
|
281
|
+
else {
|
|
282
|
+
// No status: a mid-stream failure, or a transport error. The vendor's own
|
|
283
|
+
// error-type vocabulary is the only signal left; absent that, the request
|
|
284
|
+
// genuinely did not get an answer.
|
|
285
|
+
kind = vendorTypeKind(message) ?? 'network';
|
|
286
|
+
}
|
|
287
|
+
const retryAfterMs = parseRetryAfterMs(input.retryAfter ?? vendorRetryAfter(error), input.now ?? Date.now());
|
|
288
|
+
return new ProviderRequestError({
|
|
289
|
+
kind,
|
|
290
|
+
providerId: input.providerId,
|
|
291
|
+
...(status !== undefined ? { status } : {}),
|
|
292
|
+
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Build a classified error from a failed HTTP response.
|
|
297
|
+
*
|
|
298
|
+
* Callers pass the body they already read for classification; this function
|
|
299
|
+
* does not return it, store it, or put it in the message.
|
|
300
|
+
*/
|
|
301
|
+
export function providerHttpError(input) {
|
|
302
|
+
const kind = classifyProviderHttpStatus(input.status, input.body);
|
|
303
|
+
const retryAfterMs = parseRetryAfterMs(input.retryAfter, input.now ?? Date.now());
|
|
304
|
+
return new ProviderRequestError({
|
|
305
|
+
kind,
|
|
306
|
+
providerId: input.providerId,
|
|
307
|
+
status: input.status,
|
|
308
|
+
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/provider/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,MAAM,oBAAoB,GAAiC;IAC1D,UAAU;IACV,SAAS;IACT,MAAM;IACN,kBAAkB;IAClB,aAAa;IACb,QAAQ;CACR,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC9B,IAAI,CAAmB;IACvB,UAAU,CAAQ;IAClB,MAAM,CAAS;IACf,YAAY,CAAS;IAErC,YAAY,IAA8B;QACzC,KAAK,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QACjC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACxD,IAAI,IAAI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GAAG,cAAc,CAAC,OAAO,CAAC,IAAI,SAAS,CAAA;IAC5C,CAAC;IAED,MAAM,YAAY,GAAG,iBAAiB,CACrC,KAAK,CAAC,UAAU,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAC3C,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CACvB,CAAA;IACD,OAAO,IAAI,oBAAoB,CAAC;QAC/B,IAAI;QACJ,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvD,CAAC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAMjC;IACA,MAAM,IAAI,GAAG,0BAA0B,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IACjE,MAAM,YAAY,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IACjF,OAAO,IAAI,oBAAoB,CAAC;QAC/B,IAAI;QACJ,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvD,CAAC,CAAA;AACH,CAAC"}
|
package/dist/provider/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { ProviderRequestError, isCallerAbortError, isProviderRequestError, classifyProviderHttpStatus, bodySaysContextOverflow, parseRetryAfterMs, providerHttpError, providerVendorError, } from './errors.js';
|
|
2
|
+
export type { ProviderErrorInfo, ProviderErrorKind, ProviderRequestErrorInit, } from './errors.js';
|
|
1
3
|
export { ProviderRegistry, UnknownProviderError, DuplicateProviderError, LazyProviderLoadError, LazyProviderSyncCreateError, } from './registry.js';
|
|
2
4
|
export { MockLLMProvider } from './mock.js';
|
|
3
5
|
export { registerMock, MOCK_CAPABILITIES } from './mock-register.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EACN,gCAAgC,EAChC,2BAA2B,GAC3B,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,aAAa,CAAA;AACpB,YAAY,EACX,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,aAAa,CAAA;AACpB,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EACN,gCAAgC,EAChC,2BAA2B,GAC3B,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA"}
|
package/dist/provider/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { ProviderRequestError, isCallerAbortError, isProviderRequestError, classifyProviderHttpStatus, bodySaysContextOverflow, parseRetryAfterMs, providerHttpError, providerVendorError, } from './errors.js';
|
|
1
2
|
export { ProviderRegistry, UnknownProviderError, DuplicateProviderError, LazyProviderLoadError, LazyProviderSyncCreateError, } from './registry.js';
|
|
2
3
|
export { MockLLMProvider } from './mock.js';
|
|
3
4
|
export { registerMock, MOCK_CAPABILITIES } from './mock-register.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EACN,gCAAgC,EAChC,2BAA2B,GAC3B,MAAM,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GACnB,MAAM,aAAa,CAAA;AAMpB,OAAO,EACN,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EACN,gCAAgC,EAChC,2BAA2B,GAC3B,MAAM,mBAAmB,CAAA"}
|
package/dist/public-runtime.d.ts
CHANGED
|
@@ -4,24 +4,24 @@ export * from './constants/index.js';
|
|
|
4
4
|
export { CreateMessageSchema, CreateRunSchema, CreateStatelessRunSchema, MessageIdSchema, PaginationSchema, ProjectIdSchema, RunConfigSchema, RunIdSchema, zodErrorToApiError, } from './contracts/schemas.js';
|
|
5
5
|
export * from './contracts/a2a.js';
|
|
6
6
|
export * from './utils/id.js';
|
|
7
|
-
export { accumulateCost, calculateCost, formatCost, ZERO_COST } from './utils/cost.js';
|
|
7
|
+
export { accumulateCost, calculateCost, formatCost, ZERO_COST, } from './utils/cost.js';
|
|
8
8
|
export { toErrorMessage } from './utils/error.js';
|
|
9
9
|
export { configureLogger, getRootLogger, Logger } from './utils/logger.js';
|
|
10
10
|
export { buildToolResultHashes, hashToolResult } from './utils/hash.js';
|
|
11
|
-
export { compressShellOutput, compressShellOutputFull } from './utils/shell-compress.js';
|
|
11
|
+
export { compressShellOutput, compressShellOutputFull, } from './utils/shell-compress.js';
|
|
12
12
|
export { createChildAbortController } from './utils/abort.js';
|
|
13
13
|
export { memoizeAsync } from './utils/memoize.js';
|
|
14
14
|
export { extractFinalResponse } from './utils/conversation.js';
|
|
15
15
|
export { resolveTaskModel } from './router/task-router.js';
|
|
16
16
|
export { drainQuery, query } from './runtime/query/index.js';
|
|
17
17
|
export { ContextCache } from './runtime/query/context-cache.js';
|
|
18
|
-
export { CheckpointManager, projectEmergencyToCheckpoint } from './runtime/query/checkpoint.js';
|
|
18
|
+
export { CheckpointManager, projectEmergencyToCheckpoint, } from './runtime/query/checkpoint.js';
|
|
19
19
|
export { prepareReplayState } from './runtime/query/replay/prepare.js';
|
|
20
20
|
export { listCheckpoints } from './runtime/query/replay/list.js';
|
|
21
21
|
export { DecisionParser, FallbackResolver } from './runtime/decision/index.js';
|
|
22
22
|
export { buildLimitConfig, checkLimitsDetailed, createRunReporter, } from './run/index.js';
|
|
23
|
-
export { assembleSystemPrompt, mergePersonas, withSessionContext } from './persona/index.js';
|
|
24
|
-
export { discoverSkills, loadSkill, resolveSkillChain, SkillRegistry } from './skills/index.js';
|
|
23
|
+
export { assembleSystemPrompt, mergePersonas, withSessionContext, } from './persona/index.js';
|
|
24
|
+
export { discoverSkills, loadSkill, resolveSkillChain, SkillRegistry, } from './skills/index.js';
|
|
25
25
|
export { AdvisorRegistry, AdvisoryContext, AdvisoryExecutor, TriggerEvaluator, } from './advisory/index.js';
|
|
26
26
|
export { AbstractAgent, ConcurrentInvocationError, defineAgent, InvocationLock, PipelineAgent, ReactiveAgent, RouterAgent, SupervisorAgent, } from './agents/index.js';
|
|
27
27
|
export { ActivityStore, DiskCheckpointStore, DiskMemoryStore, DiskTaskStore, InMemoryMemoryIndex, InMemoryMemoryStore, InMemoryStore, InMemoryTaskStore, RunDiskStore, } from './store/index.js';
|
|
@@ -30,13 +30,13 @@ export { discoverAllPluginDirs, discoverPlugins, loadPluginManifest, PluginLifec
|
|
|
30
30
|
export { AgentManager, EmergencySaveManager, PlanManager, RunPersistence, ThreadManager, } from './manager/index.js';
|
|
31
31
|
export { InMemoryThreadStore } from './store/thread/memory.js';
|
|
32
32
|
export { LocalTaskGateway } from './gateway/local.js';
|
|
33
|
-
export { DuplicateProviderError, LazyProviderLoadError, LazyProviderSyncCreateError, MOCK_CAPABILITIES, MockLLMProvider, PERMISSIVE_PROVIDER_CAPABILITIES, ProviderRegistry, registerMock, resolveProviderCapabilities, UnknownProviderError, } from './provider/index.js';
|
|
34
|
-
export { LocalSandboxProvider, SandboxProviderFactory } from './sandbox/index.js';
|
|
33
|
+
export { bodySaysContextOverflow, classifyProviderHttpStatus, DuplicateProviderError, isCallerAbortError, isProviderRequestError, LazyProviderLoadError, LazyProviderSyncCreateError, MOCK_CAPABILITIES, MockLLMProvider, parseRetryAfterMs, PERMISSIVE_PROVIDER_CAPABILITIES, providerHttpError, providerVendorError, ProviderRegistry, ProviderRequestError, registerMock, resolveProviderCapabilities, UnknownProviderError, } from './provider/index.js';
|
|
34
|
+
export { LocalSandboxProvider, SandboxProviderFactory, } from './sandbox/index.js';
|
|
35
35
|
export { InMemoryCredentialVault } from './vault/index.js';
|
|
36
36
|
export { assembleRAGContext, cosineSimilarity, DEFAULT_CHUNKING_CONFIG, DEFAULT_RAG_CONTEXT_CONFIG, DEFAULT_RETRIEVAL_CONFIG, DefaultIngestionPipeline, DefaultKnowledgeBase, DefaultRetriever, InMemoryVectorStore, OpenRouterEmbeddingProvider, TextChunker, } from './rag/index.js';
|
|
37
37
|
export { BaseConnector, BaseExecutionContext, ConnectorManager, ConnectorRegistry, EnvironmentConnectorManager, ExecutionContextFactory, HttpConnector, HttpSseTransport, HybridExecutionContext, LocalExecutionContext, MCPClient, MCPConnectorBridge, MCPServer, MCPToolDiscovery, mcpJsonSchemaToZod, mcpToolResultToToolResult, mcpToolToToolDefinition, RemoteExecutionContext, ScopedConnectorRegistry, StdioTransport, StreamableHttpTransport, TenantConnectorManager, toolDefinitionToMCPTool, toolResultToMCPToolResult, WebhookConnector, zodToMCPJsonSchema, } from './connector/index.js';
|
|
38
38
|
export { a2aMessageToCreateRun, a2aMessageToInput, buildAgentCard, extractTextFromA2AMessage, isTerminalState, mapRunToA2AEvent, mapSessionToA2AEvent, messageToA2A, runStatusToA2AState, runToA2ATask, } from './bridge/a2a/index.js';
|
|
39
|
-
export { mapRunToStreamEvent, mapSessionToStreamEvent } from './bridge/sse/index.js';
|
|
39
|
+
export { mapRunToStreamEvent, mapSessionToStreamEvent, } from './bridge/sse/index.js';
|
|
40
40
|
export { AgentBus, CircuitBreaker, EditOwnershipTracker, FileLockManager, } from './bus/index.js';
|
|
41
41
|
export { defaultSandboxedGateConfig, defaultSandboxedShellGateConfig, evaluateRule, VerificationGate, } from './verification/index.js';
|
|
42
42
|
export { buildProbeContext, createProbeRegistry, probe, ProbeNameCollisionError, ProbeRegistry, ProbeVetoError, } from './probe/index.js';
|
|
@@ -56,10 +56,10 @@ export { ArchivalManager, ArchiveNotConfiguredError, ArchiveNotFoundError, DiskA
|
|
|
56
56
|
export { AncestryCycleError, TenantIsolationError, WorkspaceBackendError, } from './session/errors.js';
|
|
57
57
|
export { DiskSessionStore, getAncestry, getChildren, InMemorySessionStore, orderChildren, } from './store/session/index.js';
|
|
58
58
|
export { A2AProtocolError } from './types/a2a/index.js';
|
|
59
|
-
export { isTerminalActivityStatus, resolveActivityTracking } from './types/activity/index.js';
|
|
59
|
+
export { isTerminalActivityStatus, resolveActivityTracking, } from './types/activity/index.js';
|
|
60
60
|
export { isTerminalAgentTaskState } from './types/agent/task.js';
|
|
61
|
-
export { accumulateTokenUsage, isTerminalStatus } from './types/common/index.js';
|
|
62
|
-
export { assertComputerUseActionType, assertDisplayServer } from './types/computer-use/index.js';
|
|
61
|
+
export { accumulateTokenUsage, isTerminalStatus, } from './types/common/index.js';
|
|
62
|
+
export { assertComputerUseActionType, assertDisplayServer, } from './types/computer-use/index.js';
|
|
63
63
|
export { isConnectorActive } from './types/connector/core.js';
|
|
64
64
|
export { CONNECTOR_SCOPE_ORDER } from './types/connector/scope.js';
|
|
65
65
|
export { RoutingResponseSchema } from './types/decision/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public-runtime.d.ts","sourceRoot":"","sources":["../src/public-runtime.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EACN,sBAAsB,EACtB,yBAAyB,EACzB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,GACtB,MAAM,qBAAqB,CAAA;AAI5B,cAAc,sBAAsB,CAAA;AAIpC,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,WAAW,EACX,kBAAkB,GAClB,MA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E,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EACN,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GACjB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EACN,4BAA4B,EAC5B,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,2BAA2B,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EACN,wBAAwB,EACxB,mBAAmB,GACnB,MAAM,0BAA0B,CAAA;AAKjC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAM9E,OAAO,EACN,oBAAoB,EACpB,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAC3B,mBAAmB,GACnB,MAAM,uBAAuB,CAAA"}
|
package/dist/public-runtime.js
CHANGED
|
@@ -18,11 +18,11 @@ export * from './contracts/a2a.js';
|
|
|
18
18
|
// ─── ID generators + parsers ─────────────────────────────────────────────
|
|
19
19
|
export * from './utils/id.js';
|
|
20
20
|
// ─── utility helpers ─────────────────────────────────────────────────────
|
|
21
|
-
export { accumulateCost, calculateCost, formatCost, ZERO_COST } from './utils/cost.js';
|
|
21
|
+
export { accumulateCost, calculateCost, formatCost, ZERO_COST, } from './utils/cost.js';
|
|
22
22
|
export { toErrorMessage } from './utils/error.js';
|
|
23
23
|
export { configureLogger, getRootLogger } from './utils/logger.js';
|
|
24
24
|
export { buildToolResultHashes, hashToolResult } from './utils/hash.js';
|
|
25
|
-
export { compressShellOutput, compressShellOutputFull } from './utils/shell-compress.js';
|
|
25
|
+
export { compressShellOutput, compressShellOutputFull, } from './utils/shell-compress.js';
|
|
26
26
|
export { createChildAbortController } from './utils/abort.js';
|
|
27
27
|
export { memoizeAsync } from './utils/memoize.js';
|
|
28
28
|
export { extractFinalResponse } from './utils/conversation.js';
|
|
@@ -30,14 +30,14 @@ export { extractFinalResponse } from './utils/conversation.js';
|
|
|
30
30
|
export { resolveTaskModel } from './router/task-router.js';
|
|
31
31
|
export { drainQuery, query } from './runtime/query/index.js';
|
|
32
32
|
export { ContextCache } from './runtime/query/context-cache.js';
|
|
33
|
-
export { CheckpointManager, projectEmergencyToCheckpoint } from './runtime/query/checkpoint.js';
|
|
33
|
+
export { CheckpointManager, projectEmergencyToCheckpoint, } from './runtime/query/checkpoint.js';
|
|
34
34
|
export { prepareReplayState } from './runtime/query/replay/prepare.js';
|
|
35
35
|
export { listCheckpoints } from './runtime/query/replay/list.js';
|
|
36
36
|
export { DecisionParser, FallbackResolver } from './runtime/decision/index.js';
|
|
37
37
|
export { buildLimitConfig, checkLimitsDetailed, createRunReporter, } from './run/index.js';
|
|
38
38
|
// ─── personas, skills, advisory ──────────────────────────────────────────
|
|
39
|
-
export { assembleSystemPrompt, mergePersonas, withSessionContext } from './persona/index.js';
|
|
40
|
-
export { discoverSkills, loadSkill, resolveSkillChain, SkillRegistry } from './skills/index.js';
|
|
39
|
+
export { assembleSystemPrompt, mergePersonas, withSessionContext, } from './persona/index.js';
|
|
40
|
+
export { discoverSkills, loadSkill, resolveSkillChain, SkillRegistry, } from './skills/index.js';
|
|
41
41
|
export { AdvisorRegistry, AdvisoryContext, AdvisoryExecutor, TriggerEvaluator, } from './advisory/index.js';
|
|
42
42
|
// ─── agents ──────────────────────────────────────────────────────────────
|
|
43
43
|
export { AbstractAgent, ConcurrentInvocationError, defineAgent, InvocationLock, PipelineAgent, ReactiveAgent, RouterAgent, SupervisorAgent, } from './agents/index.js';
|
|
@@ -49,8 +49,8 @@ export { AgentManager, EmergencySaveManager, PlanManager, RunPersistence, Thread
|
|
|
49
49
|
export { InMemoryThreadStore } from './store/thread/memory.js';
|
|
50
50
|
export { LocalTaskGateway } from './gateway/local.js';
|
|
51
51
|
// ─── providers, sandbox, vault ───────────────────────────────────────────
|
|
52
|
-
export { DuplicateProviderError, LazyProviderLoadError, LazyProviderSyncCreateError, MOCK_CAPABILITIES, MockLLMProvider, PERMISSIVE_PROVIDER_CAPABILITIES, ProviderRegistry, registerMock, resolveProviderCapabilities, UnknownProviderError, } from './provider/index.js';
|
|
53
|
-
export { LocalSandboxProvider, SandboxProviderFactory } from './sandbox/index.js';
|
|
52
|
+
export { bodySaysContextOverflow, classifyProviderHttpStatus, DuplicateProviderError, isCallerAbortError, isProviderRequestError, LazyProviderLoadError, LazyProviderSyncCreateError, MOCK_CAPABILITIES, MockLLMProvider, parseRetryAfterMs, PERMISSIVE_PROVIDER_CAPABILITIES, providerHttpError, providerVendorError, ProviderRegistry, ProviderRequestError, registerMock, resolveProviderCapabilities, UnknownProviderError, } from './provider/index.js';
|
|
53
|
+
export { LocalSandboxProvider, SandboxProviderFactory, } from './sandbox/index.js';
|
|
54
54
|
export { InMemoryCredentialVault } from './vault/index.js';
|
|
55
55
|
// ─── RAG runtime (generic; createRAGTool is in public-tools.ts) ──────────
|
|
56
56
|
export { assembleRAGContext, cosineSimilarity, DEFAULT_CHUNKING_CONFIG, DEFAULT_RAG_CONTEXT_CONFIG, DEFAULT_RETRIEVAL_CONFIG, DefaultIngestionPipeline, DefaultKnowledgeBase, DefaultRetriever, InMemoryVectorStore, OpenRouterEmbeddingProvider, TextChunker, } from './rag/index.js';
|
|
@@ -58,7 +58,7 @@ export { assembleRAGContext, cosineSimilarity, DEFAULT_CHUNKING_CONFIG, DEFAULT_
|
|
|
58
58
|
export { BaseConnector, BaseExecutionContext, ConnectorManager, ConnectorRegistry, EnvironmentConnectorManager, ExecutionContextFactory, HttpConnector, HttpSseTransport, HybridExecutionContext, LocalExecutionContext, MCPClient, MCPConnectorBridge, MCPServer, MCPToolDiscovery, mcpJsonSchemaToZod, mcpToolResultToToolResult, mcpToolToToolDefinition, RemoteExecutionContext, ScopedConnectorRegistry, StdioTransport, StreamableHttpTransport, TenantConnectorManager, toolDefinitionToMCPTool, toolResultToMCPToolResult, WebhookConnector, zodToMCPJsonSchema, } from './connector/index.js';
|
|
59
59
|
// ─── bridges (a2a + sse) ─────────────────────────────────────────────────
|
|
60
60
|
export { a2aMessageToCreateRun, a2aMessageToInput, buildAgentCard, extractTextFromA2AMessage, isTerminalState, mapRunToA2AEvent, mapSessionToA2AEvent, messageToA2A, runStatusToA2AState, runToA2ATask, } from './bridge/a2a/index.js';
|
|
61
|
-
export { mapRunToStreamEvent, mapSessionToStreamEvent } from './bridge/sse/index.js';
|
|
61
|
+
export { mapRunToStreamEvent, mapSessionToStreamEvent, } from './bridge/sse/index.js';
|
|
62
62
|
// ─── bus, verification ───────────────────────────────────────────────────
|
|
63
63
|
export { AgentBus, CircuitBreaker, EditOwnershipTracker, FileLockManager, } from './bus/index.js';
|
|
64
64
|
export { defaultSandboxedGateConfig, defaultSandboxedShellGateConfig, evaluateRule, VerificationGate, } from './verification/index.js';
|
|
@@ -89,10 +89,10 @@ export { AncestryCycleError, TenantIsolationError, WorkspaceBackendError, } from
|
|
|
89
89
|
export { DiskSessionStore, getAncestry, getChildren, InMemorySessionStore, orderChildren, } from './store/session/index.js';
|
|
90
90
|
// ─── runtime helpers colocated with shapes under `types/` (§1.5) ─────────
|
|
91
91
|
export { A2AProtocolError } from './types/a2a/index.js';
|
|
92
|
-
export { isTerminalActivityStatus, resolveActivityTracking } from './types/activity/index.js';
|
|
92
|
+
export { isTerminalActivityStatus, resolveActivityTracking, } from './types/activity/index.js';
|
|
93
93
|
export { isTerminalAgentTaskState } from './types/agent/task.js';
|
|
94
|
-
export { accumulateTokenUsage, isTerminalStatus } from './types/common/index.js';
|
|
95
|
-
export { assertComputerUseActionType, assertDisplayServer } from './types/computer-use/index.js';
|
|
94
|
+
export { accumulateTokenUsage, isTerminalStatus, } from './types/common/index.js';
|
|
95
|
+
export { assertComputerUseActionType, assertDisplayServer, } from './types/computer-use/index.js';
|
|
96
96
|
export { isConnectorActive } from './types/connector/core.js';
|
|
97
97
|
export { CONNECTOR_SCOPE_ORDER } from './types/connector/scope.js';
|
|
98
98
|
export { RoutingResponseSchema } from './types/decision/index.js';
|