@agentskit/adapters 0.13.13 → 0.14.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/README.md +33 -3
- package/dist/catalog/index.cjs +197 -60
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +1 -1
- package/dist/catalog/index.d.ts +1 -1
- package/dist/catalog/index.js +2 -1
- package/dist/catalog/index.js.map +1 -1
- package/dist/{chunk-77QS3QRT.js → chunk-4KZTWGRB.js} +249 -119
- package/dist/chunk-4KZTWGRB.js.map +1 -0
- package/dist/chunk-627FHZZY.js +101 -0
- package/dist/chunk-627FHZZY.js.map +1 -0
- package/dist/chunk-6CIB2QCH.js +81 -0
- package/dist/chunk-6CIB2QCH.js.map +1 -0
- package/dist/createAdapter-C-pKR1aO.d.cts +19 -0
- package/dist/createAdapter-C-pKR1aO.d.ts +19 -0
- package/dist/createAdapter.cjs +138 -15
- package/dist/createAdapter.cjs.map +1 -1
- package/dist/createAdapter.d.cts +1 -1
- package/dist/createAdapter.d.ts +1 -1
- package/dist/createAdapter.js +2 -1
- package/dist/index.cjs +1090 -319
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -13
- package/dist/index.d.ts +33 -13
- package/dist/index.js +686 -191
- package/dist/index.js.map +1 -1
- package/package.json +11 -6
- package/dist/chunk-6FPLWOVE.js +0 -26
- package/dist/chunk-6FPLWOVE.js.map +0 -1
- package/dist/chunk-77QS3QRT.js.map +0 -1
- package/dist/createAdapter-Dfnf3Iio.d.cts +0 -14
- package/dist/createAdapter-Dfnf3Iio.d.ts +0 -14
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @agentskit/adapters
|
|
2
2
|
|
|
3
|
-
<
|
|
3
|
+
Profile: <code>major-package</code>
|
|
4
|
+
|
|
5
|
+
<p align="center"><img alt="AgentsKit" src="https://raw.githubusercontent.com/AgentsKit-io/agentskit/main/apps/docs-next/public/brand/logo-wordmark.svg" width="180" /></p>
|
|
4
6
|
|
|
5
7
|
Connect to any LLM provider — and swap between them — without touching your app code.
|
|
6
8
|
|
|
@@ -13,6 +15,12 @@ Connect to any LLM provider — and swap between them — without touching your
|
|
|
13
15
|
|
|
14
16
|
**Tags:** `ai` · `agents` · `llm` · `agentskit` · `openai` · `anthropic` · `claude` · `gemini` · `chatgpt` · `ollama` · `embeddings` · `providers`
|
|
15
17
|
|
|
18
|
+
## Verified proof
|
|
19
|
+
|
|
20
|
+
- Package metadata and tests live under `packages/adapters/`.
|
|
21
|
+
- Package guide: https://www.agentskit.io/docs/packages/adapters
|
|
22
|
+
- Stability map: [docs/STABILITY.md](../../docs/STABILITY.md)
|
|
23
|
+
|
|
16
24
|
## How this fits the ecosystem
|
|
17
25
|
|
|
18
26
|
@agentskit/adapters is the provider layer: swap OpenAI, Anthropic, Gemini, Ollama, local models, and embedding providers without rewriting your agent.
|
|
@@ -33,14 +41,16 @@ Docs: [package guide](https://www.agentskit.io/docs/packages/adapters) · [agent
|
|
|
33
41
|
|
|
34
42
|
## Install
|
|
35
43
|
|
|
44
|
+
<!-- readme-command:install -->
|
|
36
45
|
```bash
|
|
37
46
|
npm install @agentskit/adapters
|
|
38
47
|
```
|
|
39
48
|
|
|
40
49
|
## Quick example
|
|
41
50
|
|
|
51
|
+
<!-- readme-example:quickstart -->
|
|
42
52
|
```ts
|
|
43
|
-
import { anthropic
|
|
53
|
+
import { anthropic } from '@agentskit/adapters'
|
|
44
54
|
import { createRuntime } from '@agentskit/runtime'
|
|
45
55
|
|
|
46
56
|
// Switch provider by swapping one import
|
|
@@ -72,10 +82,19 @@ const rag = createRAG({
|
|
|
72
82
|
|
|
73
83
|
- Providers: Anthropic, OpenAI, Gemini, Ollama, DeepSeek, Grok, Kimi, Mistral, Cohere, Together, Groq, Fireworks, OpenRouter, Hugging Face, LM Studio, vLLM, llama.cpp, LangChain, LangGraph, Vercel AI SDK, generic `ReadableStream`
|
|
74
84
|
- Embedders: `openaiEmbedder`, `geminiEmbedder`, `ollamaEmbedder`, `deepseekEmbedder`, `grokEmbedder`, `kimiEmbedder`, `createOpenAICompatibleEmbedder`
|
|
75
|
-
-
|
|
85
|
+
- Fetch-backed adapters run against the shared `Adapter` contract v1 suite (ADR 0001); SDK-backed adapters have provider-specific contract and resilience coverage
|
|
76
86
|
- Custom adapter authoring via `createAdapter()`
|
|
77
87
|
- Higher-order adapters: `createRouter` (cost/latency/classifier), `createEnsembleAdapter` (fan-out + merge), `createFallbackAdapter` (ordered try-next)
|
|
78
88
|
|
|
89
|
+
## Stream guarantees
|
|
90
|
+
|
|
91
|
+
- A stream terminates exactly once with `done` or `error`; terminal errors carry an `Error` in `metadata.error`.
|
|
92
|
+
- Provider streams that close before their native completion marker are treated as truncated, not successful.
|
|
93
|
+
- `abort(reason)` propagates to active fetch readers and SDK requests and terminates with the same error semantics.
|
|
94
|
+
- Native tool histories preserve call/result correlation. Parallel tool results are encoded in a single provider turn where required.
|
|
95
|
+
- Credentials stay in provider headers when the protocol supports them; Gemini API keys are never placed in request URLs.
|
|
96
|
+
- `vercelAI` consumes the Vercel AI SDK UI message stream v1 protocol, including its required response header and `[DONE]` marker.
|
|
97
|
+
|
|
79
98
|
## Higher-order adapters
|
|
80
99
|
|
|
81
100
|
```ts
|
|
@@ -158,3 +177,14 @@ MIT — see [LICENSE](../../LICENSE).
|
|
|
158
177
|
## Docs
|
|
159
178
|
|
|
160
179
|
[Full documentation](https://www.agentskit.io) · [GitHub](https://github.com/AgentsKit-io/agentskit)
|
|
180
|
+
|
|
181
|
+
## Maturity and compatibility
|
|
182
|
+
|
|
183
|
+
- Stability: **beta** — see [docs/STABILITY.md](../../docs/STABILITY.md)
|
|
184
|
+
- The implementation is hardened for a future freeze, but promotion still requires the 90-day beta window, two released minor lines, accepted package RFC, and repository evidence required by ADR 0024.
|
|
185
|
+
- **Node.js 20+** and **TypeScript** strict mode
|
|
186
|
+
- Published as `@agentskit/adapters`
|
|
187
|
+
|
|
188
|
+
## Contributing
|
|
189
|
+
|
|
190
|
+
See [CONTRIBUTING.md](../../CONTRIBUTING.md) and the monorepo [LICENSE](../../LICENSE).
|
package/dist/catalog/index.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var core = require('@agentskit/core');
|
|
4
|
+
|
|
3
5
|
// src/catalog/schema.ts
|
|
4
6
|
var catalogSnapshotSchema = {
|
|
5
7
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
@@ -153379,42 +153381,7 @@ function applyOverrides(snapshot, overrides) {
|
|
|
153379
153381
|
return { ...snapshot, providers };
|
|
153380
153382
|
}
|
|
153381
153383
|
|
|
153382
|
-
// src/
|
|
153383
|
-
function toProviderMessages(messages) {
|
|
153384
|
-
const knownToolCallIds = /* @__PURE__ */ new Set();
|
|
153385
|
-
const output = [];
|
|
153386
|
-
for (const message of messages) {
|
|
153387
|
-
if (message.role === "tool") {
|
|
153388
|
-
const id = message.toolCallId;
|
|
153389
|
-
if (!id || !knownToolCallIds.has(id)) continue;
|
|
153390
|
-
output.push({
|
|
153391
|
-
role: "tool",
|
|
153392
|
-
content: message.content,
|
|
153393
|
-
tool_call_id: id
|
|
153394
|
-
});
|
|
153395
|
-
continue;
|
|
153396
|
-
}
|
|
153397
|
-
if (message.role === "assistant" && message.toolCalls && message.toolCalls.length > 0) {
|
|
153398
|
-
for (const tc of message.toolCalls) knownToolCallIds.add(tc.id);
|
|
153399
|
-
output.push({
|
|
153400
|
-
role: "assistant",
|
|
153401
|
-
content: message.content || null,
|
|
153402
|
-
tool_calls: message.toolCalls.map((tc) => ({
|
|
153403
|
-
id: tc.id,
|
|
153404
|
-
type: "function",
|
|
153405
|
-
function: {
|
|
153406
|
-
name: tc.name,
|
|
153407
|
-
arguments: typeof tc.args === "string" ? tc.args : JSON.stringify(tc.args ?? {})
|
|
153408
|
-
}
|
|
153409
|
-
}))
|
|
153410
|
-
});
|
|
153411
|
-
continue;
|
|
153412
|
-
}
|
|
153413
|
-
if (message.role === "assistant" && !message.content) continue;
|
|
153414
|
-
output.push({ role: message.role, content: message.content });
|
|
153415
|
-
}
|
|
153416
|
-
return output;
|
|
153417
|
-
}
|
|
153384
|
+
// src/stream-lines.ts
|
|
153418
153385
|
async function* readSSELines(stream) {
|
|
153419
153386
|
const reader = stream.getReader();
|
|
153420
153387
|
const decoder = new TextDecoder();
|
|
@@ -153436,23 +153403,135 @@ async function* readSSELines(stream) {
|
|
|
153436
153403
|
reader.releaseLock();
|
|
153437
153404
|
}
|
|
153438
153405
|
}
|
|
153406
|
+
function isAbortError(err) {
|
|
153407
|
+
if (err instanceof DOMException && err.name === "AbortError") return true;
|
|
153408
|
+
if (err instanceof Error && err.name === "AbortError") return true;
|
|
153409
|
+
return false;
|
|
153410
|
+
}
|
|
153411
|
+
function adapterErrorChunk(message, options) {
|
|
153412
|
+
const error = new core.AdapterError({
|
|
153413
|
+
code: options?.code ?? core.ErrorCodes.AK_ADAPTER_STREAM_FAILED,
|
|
153414
|
+
message,
|
|
153415
|
+
cause: options?.cause
|
|
153416
|
+
});
|
|
153417
|
+
return {
|
|
153418
|
+
type: "error",
|
|
153419
|
+
content: message,
|
|
153420
|
+
metadata: { error }
|
|
153421
|
+
};
|
|
153422
|
+
}
|
|
153423
|
+
function parseCompleteToolArgs(args) {
|
|
153424
|
+
const raw = args.length > 0 ? args : "{}";
|
|
153425
|
+
try {
|
|
153426
|
+
JSON.parse(raw);
|
|
153427
|
+
return { ok: true, args: raw };
|
|
153428
|
+
} catch (cause) {
|
|
153429
|
+
return {
|
|
153430
|
+
ok: false,
|
|
153431
|
+
error: new core.AdapterError({
|
|
153432
|
+
code: core.ErrorCodes.AK_ADAPTER_STREAM_FAILED,
|
|
153433
|
+
message: "Incomplete or malformed tool-call arguments JSON",
|
|
153434
|
+
cause
|
|
153435
|
+
})
|
|
153436
|
+
};
|
|
153437
|
+
}
|
|
153438
|
+
}
|
|
153439
|
+
function raceAbort(promise, signal) {
|
|
153440
|
+
if (signal.aborted) {
|
|
153441
|
+
return Promise.reject(new DOMException("Aborted", "AbortError"));
|
|
153442
|
+
}
|
|
153443
|
+
return new Promise((resolve, reject) => {
|
|
153444
|
+
let settled = false;
|
|
153445
|
+
const onAbort = () => {
|
|
153446
|
+
if (settled) return;
|
|
153447
|
+
settled = true;
|
|
153448
|
+
signal.removeEventListener("abort", onAbort);
|
|
153449
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
153450
|
+
};
|
|
153451
|
+
signal.addEventListener("abort", onAbort);
|
|
153452
|
+
promise.then(
|
|
153453
|
+
(value) => {
|
|
153454
|
+
if (settled) return;
|
|
153455
|
+
settled = true;
|
|
153456
|
+
signal.removeEventListener("abort", onAbort);
|
|
153457
|
+
resolve(value);
|
|
153458
|
+
},
|
|
153459
|
+
(err) => {
|
|
153460
|
+
if (settled) return;
|
|
153461
|
+
settled = true;
|
|
153462
|
+
signal.removeEventListener("abort", onAbort);
|
|
153463
|
+
reject(err);
|
|
153464
|
+
}
|
|
153465
|
+
);
|
|
153466
|
+
});
|
|
153467
|
+
}
|
|
153468
|
+
async function abortableSleep(ms, signal, sleep) {
|
|
153469
|
+
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
|
|
153470
|
+
await raceAbort(sleep(ms), signal);
|
|
153471
|
+
if (signal.aborted) throw new DOMException("Aborted", "AbortError");
|
|
153472
|
+
}
|
|
153473
|
+
async function cancelBody(body) {
|
|
153474
|
+
if (!body) return;
|
|
153475
|
+
try {
|
|
153476
|
+
await body.cancel();
|
|
153477
|
+
} catch {
|
|
153478
|
+
}
|
|
153479
|
+
}
|
|
153480
|
+
|
|
153481
|
+
// src/openai-stream.ts
|
|
153482
|
+
var SUCCESS_FINISH_REASONS = /* @__PURE__ */ new Set(["stop", "tool_calls", "function_call"]);
|
|
153439
153483
|
async function* parseOpenAIStream(stream) {
|
|
153440
153484
|
const pendingToolCalls = /* @__PURE__ */ new Map();
|
|
153485
|
+
let finishReason;
|
|
153486
|
+
const terminalError = (message, extra) => {
|
|
153487
|
+
const chunk = adapterErrorChunk(message);
|
|
153488
|
+
return {
|
|
153489
|
+
...chunk,
|
|
153490
|
+
metadata: { ...chunk.metadata, ...extra, finishReason }
|
|
153491
|
+
};
|
|
153492
|
+
};
|
|
153493
|
+
const flushToolCalls = function* () {
|
|
153494
|
+
for (const [, toolCall] of pendingToolCalls) {
|
|
153495
|
+
const parsed = parseCompleteToolArgs(toolCall.args);
|
|
153496
|
+
if (!parsed.ok) {
|
|
153497
|
+
pendingToolCalls.clear();
|
|
153498
|
+
yield {
|
|
153499
|
+
type: "error",
|
|
153500
|
+
content: parsed.error.message,
|
|
153501
|
+
metadata: { error: parsed.error, finishReason }
|
|
153502
|
+
};
|
|
153503
|
+
return false;
|
|
153504
|
+
}
|
|
153505
|
+
yield {
|
|
153506
|
+
type: "tool_call",
|
|
153507
|
+
toolCall: { id: toolCall.id, name: toolCall.name, args: parsed.args }
|
|
153508
|
+
};
|
|
153509
|
+
}
|
|
153510
|
+
pendingToolCalls.clear();
|
|
153511
|
+
return true;
|
|
153512
|
+
};
|
|
153441
153513
|
for await (const data of readSSELines(stream)) {
|
|
153442
153514
|
if (data === "[DONE]") {
|
|
153443
|
-
|
|
153444
|
-
|
|
153515
|
+
if (finishReason !== void 0 && !SUCCESS_FINISH_REASONS.has(finishReason)) {
|
|
153516
|
+
pendingToolCalls.clear();
|
|
153517
|
+
yield terminalError(
|
|
153518
|
+
`OpenAI stream ended with non-success finish reason "${finishReason}".`,
|
|
153519
|
+
{ finishReason }
|
|
153520
|
+
);
|
|
153521
|
+
return;
|
|
153445
153522
|
}
|
|
153446
|
-
|
|
153523
|
+
if (!(yield* flushToolCalls())) return;
|
|
153447
153524
|
yield { type: "done" };
|
|
153448
153525
|
return;
|
|
153449
153526
|
}
|
|
153450
153527
|
try {
|
|
153451
153528
|
const event = JSON.parse(data);
|
|
153452
153529
|
const delta = event.choices?.[0]?.delta;
|
|
153453
|
-
|
|
153454
|
-
|
|
153455
|
-
|
|
153530
|
+
const candidateFinishReason = event.choices?.find(
|
|
153531
|
+
(choice) => typeof choice.finish_reason === "string"
|
|
153532
|
+
)?.finish_reason;
|
|
153533
|
+
if (typeof candidateFinishReason === "string") finishReason = candidateFinishReason;
|
|
153534
|
+
if (typeof delta?.content === "string") yield { type: "text", content: delta.content };
|
|
153456
153535
|
if (Array.isArray(delta?.tool_calls)) {
|
|
153457
153536
|
for (const toolCall of delta.tool_calls) {
|
|
153458
153537
|
const index = toolCall.index ?? 0;
|
|
@@ -153481,12 +153560,59 @@ async function* parseOpenAIStream(stream) {
|
|
|
153481
153560
|
} catch {
|
|
153482
153561
|
}
|
|
153483
153562
|
}
|
|
153484
|
-
|
|
153485
|
-
|
|
153563
|
+
if (finishReason !== void 0 && !SUCCESS_FINISH_REASONS.has(finishReason)) {
|
|
153564
|
+
pendingToolCalls.clear();
|
|
153565
|
+
yield terminalError(
|
|
153566
|
+
`OpenAI stream ended with non-success finish reason "${finishReason}".`,
|
|
153567
|
+
{ finishReason }
|
|
153568
|
+
);
|
|
153569
|
+
return;
|
|
153570
|
+
}
|
|
153571
|
+
if (!finishReason) {
|
|
153572
|
+
pendingToolCalls.clear();
|
|
153573
|
+
yield terminalError("OpenAI stream ended before a terminal marker.");
|
|
153574
|
+
return;
|
|
153486
153575
|
}
|
|
153487
|
-
|
|
153576
|
+
if (!(yield* flushToolCalls())) return;
|
|
153488
153577
|
yield { type: "done" };
|
|
153489
153578
|
}
|
|
153579
|
+
|
|
153580
|
+
// src/utils.ts
|
|
153581
|
+
function toProviderMessages(messages) {
|
|
153582
|
+
const knownToolCallIds = /* @__PURE__ */ new Set();
|
|
153583
|
+
const output = [];
|
|
153584
|
+
for (const message of messages) {
|
|
153585
|
+
if (message.role === "tool") {
|
|
153586
|
+
const id = message.toolCallId;
|
|
153587
|
+
if (!id || !knownToolCallIds.has(id)) continue;
|
|
153588
|
+
output.push({
|
|
153589
|
+
role: "tool",
|
|
153590
|
+
content: message.content,
|
|
153591
|
+
tool_call_id: id
|
|
153592
|
+
});
|
|
153593
|
+
continue;
|
|
153594
|
+
}
|
|
153595
|
+
if (message.role === "assistant" && message.toolCalls && message.toolCalls.length > 0) {
|
|
153596
|
+
for (const tc of message.toolCalls) knownToolCallIds.add(tc.id);
|
|
153597
|
+
output.push({
|
|
153598
|
+
role: "assistant",
|
|
153599
|
+
content: message.content || null,
|
|
153600
|
+
tool_calls: message.toolCalls.map((tc) => ({
|
|
153601
|
+
id: tc.id,
|
|
153602
|
+
type: "function",
|
|
153603
|
+
function: {
|
|
153604
|
+
name: tc.name,
|
|
153605
|
+
arguments: typeof tc.args === "string" ? tc.args : JSON.stringify(tc.args ?? {})
|
|
153606
|
+
}
|
|
153607
|
+
}))
|
|
153608
|
+
});
|
|
153609
|
+
continue;
|
|
153610
|
+
}
|
|
153611
|
+
if (message.role === "assistant" && !message.content) continue;
|
|
153612
|
+
output.push({ role: message.role, content: message.content });
|
|
153613
|
+
}
|
|
153614
|
+
return output;
|
|
153615
|
+
}
|
|
153490
153616
|
var DEFAULT_RETRY = {
|
|
153491
153617
|
maxAttempts: 3,
|
|
153492
153618
|
baseDelayMs: 500,
|
|
@@ -153496,7 +153622,7 @@ var DEFAULT_RETRY = {
|
|
|
153496
153622
|
if (response) {
|
|
153497
153623
|
return [408, 429, 500, 502, 503, 504].includes(response.status);
|
|
153498
153624
|
}
|
|
153499
|
-
if (error
|
|
153625
|
+
if (isAbortError(error)) return false;
|
|
153500
153626
|
return true;
|
|
153501
153627
|
}
|
|
153502
153628
|
};
|
|
@@ -153534,20 +153660,25 @@ async function fetchWithRetry(doFetch, signal, retryOpt = {}) {
|
|
|
153534
153660
|
const retryAfterMs = parseRetryAfter(response.headers.get("retry-after"));
|
|
153535
153661
|
const delay = retryAfterMs ?? computeDelay(attempt, opts);
|
|
153536
153662
|
retryOpt.onRetry?.({ attempt, delayMs: delay, reason: `HTTP ${response.status}` });
|
|
153537
|
-
await
|
|
153538
|
-
|
|
153539
|
-
});
|
|
153663
|
+
await cancelBody(response.body);
|
|
153664
|
+
await abortableSleep(delay, signal, sleep);
|
|
153540
153665
|
} catch (err) {
|
|
153541
153666
|
lastError = err;
|
|
153542
|
-
if (err
|
|
153667
|
+
if (isAbortError(err)) throw err;
|
|
153543
153668
|
if (attempt >= opts.maxAttempts || !opts.retryOn({ error: err, attempt })) throw err;
|
|
153544
153669
|
const delay = computeDelay(attempt, opts);
|
|
153545
|
-
retryOpt.onRetry?.({
|
|
153546
|
-
|
|
153670
|
+
retryOpt.onRetry?.({
|
|
153671
|
+
attempt,
|
|
153672
|
+
delayMs: delay,
|
|
153673
|
+
reason: err instanceof Error ? err.message : String(err)
|
|
153674
|
+
});
|
|
153675
|
+
await abortableSleep(delay, signal, sleep);
|
|
153547
153676
|
}
|
|
153548
153677
|
}
|
|
153549
153678
|
throw lastError ?? new Error("fetchWithRetry: exhausted attempts");
|
|
153550
153679
|
}
|
|
153680
|
+
|
|
153681
|
+
// src/stream-source.ts
|
|
153551
153682
|
function createStreamSource(doFetch, parse, errorLabel, retry) {
|
|
153552
153683
|
let abortController = new AbortController();
|
|
153553
153684
|
return {
|
|
@@ -153556,17 +153687,23 @@ function createStreamSource(doFetch, parse, errorLabel, retry) {
|
|
|
153556
153687
|
if (!controller) return;
|
|
153557
153688
|
try {
|
|
153558
153689
|
const response = await fetchWithRetry(doFetch, controller.signal, retry ?? {});
|
|
153559
|
-
if (!response.ok
|
|
153560
|
-
|
|
153690
|
+
if (!response.ok) {
|
|
153691
|
+
await cancelBody(response.body);
|
|
153692
|
+
yield adapterErrorChunk(`${errorLabel} error: ${response.status}`);
|
|
153693
|
+
return;
|
|
153694
|
+
}
|
|
153695
|
+
if (!response.body) {
|
|
153696
|
+
yield adapterErrorChunk(`${errorLabel} error: empty response body`);
|
|
153561
153697
|
return;
|
|
153562
153698
|
}
|
|
153563
|
-
|
|
153699
|
+
for await (const chunk of parse(response.body, response)) {
|
|
153700
|
+
if (controller.signal.aborted || abortController === null) return;
|
|
153701
|
+
yield chunk;
|
|
153702
|
+
}
|
|
153564
153703
|
} catch (err) {
|
|
153565
|
-
if (err
|
|
153566
|
-
|
|
153567
|
-
|
|
153568
|
-
content: err instanceof Error ? err.message : String(err)
|
|
153569
|
-
};
|
|
153704
|
+
if (isAbortError(err) || controller.signal.aborted || abortController === null) return;
|
|
153705
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
153706
|
+
yield adapterErrorChunk(message, { cause: err });
|
|
153570
153707
|
}
|
|
153571
153708
|
},
|
|
153572
153709
|
abort: () => {
|