@mcp-abap-adt/llm-agent 24.1.0 → 25.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.
@@ -44,6 +44,12 @@ export interface BaseAgentLlmBridge {
44
44
  maxTokens?: number;
45
45
  topP?: number;
46
46
  stop?: string[];
47
+ /**
48
+ * The caller's deadline. Carried all the way to the provider's SDK call,
49
+ * which is the only place it can actually stop anything: an adapter that
50
+ * merely stops waiting leaves the request running with nobody holding it.
51
+ */
52
+ signal?: AbortSignal;
47
53
  }): Promise<{
48
54
  content: string;
49
55
  raw?: unknown;
@@ -53,6 +59,12 @@ export interface BaseAgentLlmBridge {
53
59
  maxTokens?: number;
54
60
  topP?: number;
55
61
  stop?: string[];
62
+ /**
63
+ * The caller's deadline. Carried all the way to the provider's SDK call,
64
+ * which is the only place it can actually stop anything: an adapter that
65
+ * merely stops waiting leaves the request running with nobody holding it.
66
+ */
67
+ signal?: AbortSignal;
56
68
  }): AsyncGenerator<{
57
69
  content: string;
58
70
  raw?: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-contracts.d.ts","sourceRoot":"","sources":["../../src/interfaces/agent-contracts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,OAAO,EAAE,MAAM,EAAE,IAAI,SAAuB;CAIzD;AAED,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,YAAY,GACZ,iBAAiB,GACjB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,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E,OAAO,EAAE,CAAC;IAC1B;;;qEAGiE;IACjE,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAMD;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,aAAa,CACX,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB;;;;WAIG;QACH,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC/C,eAAe,CACb,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,OAAO,EAAE,EAChB,OAAO,CAAC,EAAE;QACR,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;QAChB;;;;WAIG;QACH,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,cAAc,CACf;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,gBAAgB,EACrD,IAAI,EACJ,OAAO,CACR,CAAC;CACH"}
@@ -0,0 +1,95 @@
1
+ /**
2
+ * What a provider does when a call fails for a reason nobody named an interval
3
+ * for: a `500`, a `502`, a dropped connection, a socket that answers nothing.
4
+ *
5
+ * The sibling of `IThrottleStrategy`, and deliberately not the same seam.
6
+ * Throttling is the SERVER governing the pace: it returns `429`, it names a
7
+ * delay in `Retry-After`, and the only honest thing to do is observe that
8
+ * delay or report it. Here nobody names anything. A `502` says the request
9
+ * failed; it says nothing at all about when the next one might work.
10
+ *
11
+ * So any waiting here rests on a number, and this library has none to give.
12
+ * How long to wait, and how many times, depends on who is waiting at the other
13
+ * end — a batch job and a caller on a sixty-second connection want opposite
14
+ * things, and the difference is invisible from in here. The consumer decides,
15
+ * the same way it decides about throttling.
16
+ *
17
+ * Two ship:
18
+ *
19
+ * - `ReportFailure` — never waits. The failure goes up as it arrived, and the
20
+ * caller decides. This is what happens when nothing is configured.
21
+ * - `RetryWithBackoff` — the classic policy, with its numbers named by whoever
22
+ * constructs it rather than defaulted in here.
23
+ */
24
+ /** What the transport said, for a strategy to decide on. */
25
+ export interface FailureContext {
26
+ /** HTTP status, when the failure carried one. */
27
+ status?: number;
28
+ /** Which attempt just failed. 1-based. */
29
+ attempt: number;
30
+ /** How long this call has already spent waiting between attempts. */
31
+ waitedMs: number;
32
+ /** Whether anything was already streamed to the caller before the failure. */
33
+ midStream: boolean;
34
+ /** The failure itself, for a strategy that needs to look closer. */
35
+ error: unknown;
36
+ }
37
+ /** Wait this long, then either try again or give up. */
38
+ export interface FailureDecision {
39
+ waitMs: number;
40
+ retry: boolean;
41
+ /** Why, for the log and for the error the caller finally sees. */
42
+ reason?: string;
43
+ }
44
+ export interface IFailureStrategy {
45
+ readonly name: string;
46
+ decide(ctx: FailureContext): FailureDecision;
47
+ }
48
+ /**
49
+ * Never retry. What happens when nothing is configured.
50
+ *
51
+ * The failure goes up untouched, and the caller — who knows whether anyone is
52
+ * waiting on the other end, and whether the work is worth repeating — decides
53
+ * whether to ask again.
54
+ */
55
+ export declare class ReportFailure implements IFailureStrategy {
56
+ readonly name = "report-failure";
57
+ decide(): FailureDecision;
58
+ }
59
+ /**
60
+ * Try again a fixed number of times, doubling the wait each time.
61
+ *
62
+ * The policy this library used to install on everyone by default. It still
63
+ * ships, because it is a reasonable thing to want; what changed is that its
64
+ * numbers now belong to whoever writes them down. There are no defaults here
65
+ * on purpose — a default would be this library guessing again, one layer in.
66
+ *
67
+ * `statuses` is the set worth repeating. A `500` or `502` is usually the
68
+ * provider having a bad second; a `400` is the request itself, and repeating
69
+ * it just fails again more slowly. A failure carrying no status is not
70
+ * retried: without one there is nothing to tell a blip from a bug.
71
+ *
72
+ * `midStreamHints` opts into the harder case — a stream that failed after it
73
+ * had already yielded. Retrying that replays the whole stream, so it happens
74
+ * only for failures whose message matches one of these, and never by default.
75
+ */
76
+ export declare class RetryWithBackoff implements IFailureStrategy {
77
+ readonly name = "retry-with-backoff";
78
+ private readonly attempts;
79
+ private readonly firstWaitMs;
80
+ private readonly statuses;
81
+ private readonly midStreamHints;
82
+ constructor(options: {
83
+ /** How many times to try again after the first failure. */
84
+ attempts: number;
85
+ /** The first wait. Each subsequent one doubles it. */
86
+ firstWaitMs: number;
87
+ /** Statuses worth repeating. */
88
+ statuses: readonly number[];
89
+ /** Message fragments that make a mid-stream failure worth replaying. */
90
+ midStreamHints?: readonly string[];
91
+ });
92
+ decide({ status, attempt, midStream, error, }: FailureContext): FailureDecision;
93
+ private matchesHint;
94
+ }
95
+ //# sourceMappingURL=failure-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failure-strategy.d.ts","sourceRoot":"","sources":["../../src/interfaces/failure-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,SAAS,EAAE,OAAO,CAAC;IACnB,oEAAoE;IACpE,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,wDAAwD;AACxD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,GAAG,EAAE,cAAc,GAAG,eAAe,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,qBAAa,aAAc,YAAW,gBAAgB;IACpD,QAAQ,CAAC,IAAI,oBAAoB;IAEjC,MAAM,IAAI,eAAe;CAG1B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,gBAAiB,YAAW,gBAAgB;IACvD,QAAQ,CAAC,IAAI,wBAAwB;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAoB;gBAEvC,OAAO,EAAE;QACnB,2DAA2D;QAC3D,QAAQ,EAAE,MAAM,CAAC;QACjB,sDAAsD;QACtD,WAAW,EAAE,MAAM,CAAC;QACpB,gCAAgC;QAChC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;QAC5B,wEAAwE;QACxE,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACpC;IAOD,MAAM,CAAC,EACL,MAAM,EACN,OAAO,EACP,SAAS,EACT,KAAK,GACN,EAAE,cAAc,GAAG,eAAe;IAuBnC,OAAO,CAAC,WAAW;CAKpB"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * What a provider does when a call fails for a reason nobody named an interval
3
+ * for: a `500`, a `502`, a dropped connection, a socket that answers nothing.
4
+ *
5
+ * The sibling of `IThrottleStrategy`, and deliberately not the same seam.
6
+ * Throttling is the SERVER governing the pace: it returns `429`, it names a
7
+ * delay in `Retry-After`, and the only honest thing to do is observe that
8
+ * delay or report it. Here nobody names anything. A `502` says the request
9
+ * failed; it says nothing at all about when the next one might work.
10
+ *
11
+ * So any waiting here rests on a number, and this library has none to give.
12
+ * How long to wait, and how many times, depends on who is waiting at the other
13
+ * end — a batch job and a caller on a sixty-second connection want opposite
14
+ * things, and the difference is invisible from in here. The consumer decides,
15
+ * the same way it decides about throttling.
16
+ *
17
+ * Two ship:
18
+ *
19
+ * - `ReportFailure` — never waits. The failure goes up as it arrived, and the
20
+ * caller decides. This is what happens when nothing is configured.
21
+ * - `RetryWithBackoff` — the classic policy, with its numbers named by whoever
22
+ * constructs it rather than defaulted in here.
23
+ */
24
+ import { isRetryableStatus } from '../resilience/status.js';
25
+ /**
26
+ * Never retry. What happens when nothing is configured.
27
+ *
28
+ * The failure goes up untouched, and the caller — who knows whether anyone is
29
+ * waiting on the other end, and whether the work is worth repeating — decides
30
+ * whether to ask again.
31
+ */
32
+ export class ReportFailure {
33
+ name = 'report-failure';
34
+ decide() {
35
+ return { waitMs: 0, retry: false, reason: 'reported' };
36
+ }
37
+ }
38
+ /**
39
+ * Try again a fixed number of times, doubling the wait each time.
40
+ *
41
+ * The policy this library used to install on everyone by default. It still
42
+ * ships, because it is a reasonable thing to want; what changed is that its
43
+ * numbers now belong to whoever writes them down. There are no defaults here
44
+ * on purpose — a default would be this library guessing again, one layer in.
45
+ *
46
+ * `statuses` is the set worth repeating. A `500` or `502` is usually the
47
+ * provider having a bad second; a `400` is the request itself, and repeating
48
+ * it just fails again more slowly. A failure carrying no status is not
49
+ * retried: without one there is nothing to tell a blip from a bug.
50
+ *
51
+ * `midStreamHints` opts into the harder case — a stream that failed after it
52
+ * had already yielded. Retrying that replays the whole stream, so it happens
53
+ * only for failures whose message matches one of these, and never by default.
54
+ */
55
+ export class RetryWithBackoff {
56
+ name = 'retry-with-backoff';
57
+ attempts;
58
+ firstWaitMs;
59
+ statuses;
60
+ midStreamHints;
61
+ constructor(options) {
62
+ this.attempts = options.attempts;
63
+ this.firstWaitMs = options.firstWaitMs;
64
+ this.statuses = new Set(options.statuses);
65
+ this.midStreamHints = options.midStreamHints ?? [];
66
+ }
67
+ decide({ status, attempt, midStream, error, }) {
68
+ if (attempt > this.attempts) {
69
+ return { waitMs: 0, retry: false, reason: 'attempts' };
70
+ }
71
+ const worthRepeating = midStream
72
+ ? this.matchesHint(error)
73
+ : status !== undefined
74
+ ? this.statuses.has(status)
75
+ : // No structured status: fall back to the shared word-boundary match on
76
+ // the message, because every provider rewraps its transport error and
77
+ // the status is often only in the prose by the time it reaches here.
78
+ isRetryableStatus(error, [...this.statuses]);
79
+ if (!worthRepeating) {
80
+ return {
81
+ waitMs: 0,
82
+ retry: false,
83
+ reason: midStream ? 'mid-stream' : 'not-transient',
84
+ };
85
+ }
86
+ // attempt is 1-based, so the first retry waits exactly firstWaitMs.
87
+ return { waitMs: this.firstWaitMs * 2 ** (attempt - 1), retry: true };
88
+ }
89
+ matchesHint(error) {
90
+ if (this.midStreamHints.length === 0)
91
+ return false;
92
+ const message = error instanceof Error ? error.message : String(error);
93
+ return this.midStreamHints.some((hint) => message.includes(hint));
94
+ }
95
+ }
96
+ //# sourceMappingURL=failure-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"failure-strategy.js","sourceRoot":"","sources":["../../src/interfaces/failure-strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AA6B5D;;;;;;GAMG;AACH,MAAM,OAAO,aAAa;IACf,IAAI,GAAG,gBAAgB,CAAC;IAEjC,MAAM;QACJ,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IACzD,CAAC;CACF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,gBAAgB;IAClB,IAAI,GAAG,oBAAoB,CAAC;IACpB,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,QAAQ,CAAsB;IAC9B,cAAc,CAAoB;IAEnD,YAAY,OASX;QACC,IAAI,C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AM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACnD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
@@ -34,8 +34,9 @@ export interface McpConnectionConfig {
34
34
  * Default = no-op (contributes nothing). A consumer may use this to convey a
35
35
  * "willing to wait longer" hint or other per-request metadata. */
36
36
  requestHeadersStrategy?: IMcpRequestHeadersStrategy;
37
- /** Default per-call MCP request timeout in ms (default 120000 = 2 min).
38
- * Per-tool overrides via toolTimeouts. */
37
+ /** Per-call MCP request timeout in ms (default 3600000 = 1 h — a ceiling meant
38
+ * not to be reached, since the SDK applies its own 60s when none is given).
39
+ * A real limit belongs in toolTimeouts, per tool. */
39
40
  timeout?: number;
40
41
  /** Per-tool MCP request-timeout overrides in ms, keyed by tool name.
41
42
  * Takes precedence over timeout. */
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-connection-strategy.d.ts","sourceRoot":"","sources":["../../src/interfaces/mcp-connection-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,MAAM,WAAW,mBAAmB;IAClC,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB;mFAC+E;IAC/E,iBAAiB,CAAC,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C,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,MAAM,gBAAgB,GAAG,CAC7B,MAAM,EAAE,mBAAmB,KACxB,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAErC,MAAM,WAAW,yBAAyB;IACxC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Resolving an HTTP status from a thrown value.
3
+ *
4
+ * A leaf module on purpose: it imports nothing, so both the retry decorators
5
+ * and the strategies in `interfaces/` can share one classification without a
6
+ * cycle between the two layers. Which statuses are worth repeating is a
7
+ * decision and lives in a strategy; what status this error carries is a fact
8
+ * and lives here.
9
+ */
10
+ /**
11
+ * Resolve an HTTP status from an unknown thrown value: own status/statusCode,
12
+ * then the same walking `cause`, bounded by depth and a visited set so a cyclic
13
+ * chain cannot hang. Returns undefined when no numeric status is present.
14
+ */
15
+ export declare function extractStatusCode(err: unknown): number | undefined;
16
+ /**
17
+ * Whether a thrown value matches one of a set of HTTP status codes.
18
+ *
19
+ * A structured status (own `status`/`statusCode`, or the same on `cause`) is
20
+ * authoritative. Only when none is present does it fall back to the message,
21
+ * and there it matches on **word boundaries** — a bare `includes('429')` also
22
+ * fires on `4290`, an id, or a byte count, turning a hard error into a
23
+ * multi-second backoff stall.
24
+ *
25
+ * Shared by the embedder decorator and the LLM failure strategy so the
26
+ * classification cannot drift between them.
27
+ */
28
+ export declare function isRetryableStatus(err: unknown, retryOn: readonly number[]): boolean;
29
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/resilience/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAgBlE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,SAAS,MAAM,EAAE,GACzB,OAAO,CAKT"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Resolving an HTTP status from a thrown value.
3
+ *
4
+ * A leaf module on purpose: it imports nothing, so both the retry decorators
5
+ * and the strategies in `interfaces/` can share one classification without a
6
+ * cycle between the two layers. Which statuses are worth repeating is a
7
+ * decision and lives in a strategy; what status this error carries is a fact
8
+ * and lives here.
9
+ */
10
+ const MAX_CAUSE_DEPTH = 5;
11
+ /**
12
+ * Resolve an HTTP status from an unknown thrown value: own status/statusCode,
13
+ * then the same walking `cause`, bounded by depth and a visited set so a cyclic
14
+ * chain cannot hang. Returns undefined when no numeric status is present.
15
+ */
16
+ export function extractStatusCode(err) {
17
+ const visited = new Set();
18
+ let cur = err;
19
+ for (let depth = 0; depth < MAX_CAUSE_DEPTH; depth++) {
20
+ if (typeof cur !== 'object' || cur === null || visited.has(cur))
21
+ return;
22
+ visited.add(cur);
23
+ const rec = cur;
24
+ if (typeof rec.status === 'number')
25
+ return rec.status;
26
+ if (typeof rec.statusCode === 'number')
27
+ return rec.statusCode;
28
+ cur = rec.cause;
29
+ }
30
+ return undefined;
31
+ }
32
+ /**
33
+ * Whether a thrown value matches one of a set of HTTP status codes.
34
+ *
35
+ * A structured status (own `status`/`statusCode`, or the same on `cause`) is
36
+ * authoritative. Only when none is present does it fall back to the message,
37
+ * and there it matches on **word boundaries** — a bare `includes('429')` also
38
+ * fires on `4290`, an id, or a byte count, turning a hard error into a
39
+ * multi-second backoff stall.
40
+ *
41
+ * Shared by the embedder decorator and the LLM failure strategy so the
42
+ * classification cannot drift between them.
43
+ */
44
+ export function isRetryableStatus(err, retryOn) {
45
+ const status = extractStatusCode(err);
46
+ if (status !== undefined)
47
+ return retryOn.includes(status);
48
+ const msg = err instanceof Error ? err.message : String(err);
49
+ return retryOn.some((code) => new RegExp(`\\b${code}\\b`).test(msg));
50
+ }
51
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/resilience/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC;AAE1B;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC5C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAW,CAAC;IACnC,IAAI,GAAG,GAAY,GAAG,CAAC;IACvB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,eAAe,EAAE,KAAK,EAAE,EAAE,CAAC;QACrD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO;QACxE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,MAAM,GAAG,GAAG,GAIX,CAAC;QACF,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAC,MAAM,CAAC;QACtD,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ;YAAE,OAAO,GAAG,CAAC,UAAU,CAAC;QAC9D,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC;IAClB,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/B,GAAY,EACZ,OAA0B;IAE1B,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AACvE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcp-abap-adt/llm-agent",
3
- "version": "24.1.0",
3
+ "version": "25.0.0",
4
4
  "description": "Core interfaces, types, and lightweight default implementations for LLM agent orchestration.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",