@loomwork/llm 0.0.0-stage → 0.1.1

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.
Files changed (79) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +8 -0
  3. package/README.md +80 -2
  4. package/dist/assembleStream.d.ts +95 -0
  5. package/dist/assembleStream.d.ts.map +1 -0
  6. package/dist/assembleStream.js +180 -0
  7. package/dist/assembleStream.js.map +1 -0
  8. package/dist/capabilities.d.ts +43 -0
  9. package/dist/capabilities.d.ts.map +1 -0
  10. package/dist/capabilities.js +77 -0
  11. package/dist/capabilities.js.map +1 -0
  12. package/dist/createLlmEffect.d.ts +110 -0
  13. package/dist/createLlmEffect.d.ts.map +1 -0
  14. package/dist/createLlmEffect.js +177 -0
  15. package/dist/createLlmEffect.js.map +1 -0
  16. package/dist/errors.d.ts +96 -0
  17. package/dist/errors.d.ts.map +1 -0
  18. package/dist/errors.js +280 -0
  19. package/dist/errors.js.map +1 -0
  20. package/dist/index.d.ts +24 -0
  21. package/dist/index.d.ts.map +1 -0
  22. package/dist/index.js +71 -0
  23. package/dist/index.js.map +1 -0
  24. package/dist/parts.d.ts +220 -0
  25. package/dist/parts.d.ts.map +1 -0
  26. package/dist/parts.js +231 -0
  27. package/dist/parts.js.map +1 -0
  28. package/dist/providers/AnthropicProvider.d.ts +53 -0
  29. package/dist/providers/AnthropicProvider.d.ts.map +1 -0
  30. package/dist/providers/AnthropicProvider.js +443 -0
  31. package/dist/providers/AnthropicProvider.js.map +1 -0
  32. package/dist/providers/GeminiProvider.d.ts +66 -0
  33. package/dist/providers/GeminiProvider.d.ts.map +1 -0
  34. package/dist/providers/GeminiProvider.js +281 -0
  35. package/dist/providers/GeminiProvider.js.map +1 -0
  36. package/dist/providers/OpenAiProvider.d.ts +56 -0
  37. package/dist/providers/OpenAiProvider.d.ts.map +1 -0
  38. package/dist/providers/OpenAiProvider.js +402 -0
  39. package/dist/providers/OpenAiProvider.js.map +1 -0
  40. package/dist/providers/extraHeaders.d.ts +7 -0
  41. package/dist/providers/extraHeaders.d.ts.map +1 -0
  42. package/dist/providers/extraHeaders.js +40 -0
  43. package/dist/providers/extraHeaders.js.map +1 -0
  44. package/dist/providers/systemPrompt.d.ts +10 -0
  45. package/dist/providers/systemPrompt.d.ts.map +1 -0
  46. package/dist/providers/systemPrompt.js +22 -0
  47. package/dist/providers/systemPrompt.js.map +1 -0
  48. package/dist/reasoning.d.ts +154 -0
  49. package/dist/reasoning.d.ts.map +1 -0
  50. package/dist/reasoning.js +256 -0
  51. package/dist/reasoning.js.map +1 -0
  52. package/dist/resolveContent.d.ts +74 -0
  53. package/dist/resolveContent.d.ts.map +1 -0
  54. package/dist/resolveContent.js +335 -0
  55. package/dist/resolveContent.js.map +1 -0
  56. package/dist/types.d.ts +152 -0
  57. package/dist/types.d.ts.map +1 -0
  58. package/dist/types.js +3 -0
  59. package/dist/types.js.map +1 -0
  60. package/dist/untrusted.d.ts +91 -0
  61. package/dist/untrusted.d.ts.map +1 -0
  62. package/dist/untrusted.js +385 -0
  63. package/dist/untrusted.js.map +1 -0
  64. package/package.json +54 -3
  65. package/src/assembleStream.ts +219 -0
  66. package/src/capabilities.ts +96 -0
  67. package/src/createLlmEffect.ts +287 -0
  68. package/src/errors.ts +269 -0
  69. package/src/index.ts +137 -0
  70. package/src/parts.ts +409 -0
  71. package/src/providers/AnthropicProvider.ts +550 -0
  72. package/src/providers/GeminiProvider.ts +380 -0
  73. package/src/providers/OpenAiProvider.ts +511 -0
  74. package/src/providers/extraHeaders.ts +41 -0
  75. package/src/providers/systemPrompt.ts +19 -0
  76. package/src/reasoning.ts +386 -0
  77. package/src/resolveContent.ts +425 -0
  78. package/src/types.ts +175 -0
  79. package/src/untrusted.ts +440 -0
package/dist/errors.js ADDED
@@ -0,0 +1,280 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StreamLimiter = exports.LlmResponseInvalidError = exports.LlmResponseLimitError = exports.DEFAULT_MAX_LINE_BYTES = exports.DEFAULT_MAX_STREAM_BYTES = exports.DEFAULT_MAX_RESPONSE_BYTES = exports.LlmStreamError = exports.ERROR_BODY_READ_TIMEOUT_MS = exports.MAX_ERROR_BODY_BYTES = exports.LlmHttpError = void 0;
4
+ exports.drainBody = drainBody;
5
+ exports.readBoundedErrorJson = readBoundedErrorJson;
6
+ exports.resolveLimit = resolveLimit;
7
+ exports.readBoundedJson = readBoundedJson;
8
+ const LABEL = {
9
+ anthropic: "Anthropic",
10
+ openai: "OpenAI",
11
+ gemini: "Gemini",
12
+ };
13
+ /**
14
+ * Release the body of a non-2xx response without reading it: an unconsumed body keeps the
15
+ * connection (undici) busy. Never reads the text, and a failing cancel must not mask the status.
16
+ */
17
+ async function drainBody(resp) {
18
+ await resp.body?.cancel().catch(() => undefined);
19
+ }
20
+ /**
21
+ * A provider's HTTP API answered with a non-2xx status. `status` is what a caller should branch
22
+ * on. The response body is deliberately NOT kept: it can echo the prompt, so it is never put in
23
+ * the message or on the error.
24
+ */
25
+ class LlmHttpError extends Error {
26
+ status;
27
+ provider;
28
+ /** Set to `false` for a 3xx (a redirect, never followed): retrying cannot help. */
29
+ retryable;
30
+ /**
31
+ * Why the request failed, when the status alone cannot say. Closed: `"auth"` means the
32
+ * credential was refused (401/403, or a 400 the provider's own error code names as a bad key), a
33
+ * configuration fault rather than a malformed request. Absent otherwise.
34
+ */
35
+ kind;
36
+ constructor(provider, status, kind) {
37
+ super(`${LABEL[provider]} API error ${status}`);
38
+ this.name = "LlmHttpError";
39
+ this.status = status;
40
+ this.provider = provider;
41
+ // A redirect is never followed (it would re-send the body and credentials elsewhere), and
42
+ // asking again changes nothing: the base URL is misconfigured or the path is intercepted.
43
+ if (status >= 300 && status < 400)
44
+ this.retryable = false;
45
+ if (kind === "auth" || status === 401 || status === 403)
46
+ this.kind = "auth";
47
+ }
48
+ }
49
+ exports.LlmHttpError = LlmHttpError;
50
+ /** The most of a non-2xx body that is ever read to look for a provider error code. */
51
+ exports.MAX_ERROR_BODY_BYTES = 16 * 1024;
52
+ /** The longest the error-body read may take; a server that stalls after the headers is given up on. */
53
+ exports.ERROR_BODY_READ_TIMEOUT_MS = 2000;
54
+ /**
55
+ * Read at most `maxBytes` of a non-2xx body, for at most `timeoutMs` (and no longer than `signal`
56
+ * allows), and parse it as JSON. The body is always consumed or cancelled and its reader released
57
+ * before this returns, so the caller need not drain it. Returns `undefined` for anything else (over
58
+ * the bound, too slow, aborted, unreadable, not JSON): the caller only ever looks for a fixed error
59
+ * code in the result and keeps nothing of it.
60
+ */
61
+ async function readBoundedErrorJson(resp, signal, maxBytes = exports.MAX_ERROR_BODY_BYTES, timeoutMs = exports.ERROR_BODY_READ_TIMEOUT_MS) {
62
+ const reader = resp.body?.getReader?.();
63
+ if (!reader) {
64
+ await drainBody(resp);
65
+ return undefined;
66
+ }
67
+ let onAbort;
68
+ const stop = new Promise((resolve) => {
69
+ onAbort = () => resolve("stop");
70
+ if (signal?.aborted)
71
+ onAbort();
72
+ else
73
+ signal?.addEventListener("abort", onAbort, { once: true });
74
+ });
75
+ const timer = setTimeout(() => onAbort?.(), timeoutMs);
76
+ let finished = false;
77
+ try {
78
+ const parts = [];
79
+ let total = 0;
80
+ while (true) {
81
+ const next = await Promise.race([reader.read(), stop]);
82
+ if (next === "stop")
83
+ return undefined;
84
+ if (next.done) {
85
+ finished = true;
86
+ break;
87
+ }
88
+ total += next.value.byteLength;
89
+ if (total > maxBytes)
90
+ return undefined;
91
+ parts.push(next.value);
92
+ }
93
+ const all = new Uint8Array(total);
94
+ let off = 0;
95
+ for (const p of parts) {
96
+ all.set(p, off);
97
+ off += p.byteLength;
98
+ }
99
+ return JSON.parse(new TextDecoder().decode(all));
100
+ }
101
+ catch {
102
+ return undefined;
103
+ }
104
+ finally {
105
+ clearTimeout(timer);
106
+ if (onAbort)
107
+ signal?.removeEventListener("abort", onAbort);
108
+ // Not awaited: a stalled source must not delay the caller's throw.
109
+ if (!finished)
110
+ reader.cancel().catch(() => undefined);
111
+ try {
112
+ reader.releaseLock();
113
+ }
114
+ catch {
115
+ // A read is still pending on an older runtime; the cancel above settles it.
116
+ }
117
+ }
118
+ }
119
+ /**
120
+ * A provider reported an error INSIDE a 200 stream (Anthropic `event: error`, an OpenAI-compatible
121
+ * `{"error": ...}` chunk). Carries only the provider and the error type or code, and only when it is
122
+ * a plain identifier: the message text can echo the prompt, so it is never kept.
123
+ */
124
+ class LlmStreamError extends Error {
125
+ provider;
126
+ code;
127
+ constructor(provider, code) {
128
+ const safe = typeof code === "string" && /^[A-Za-z0-9_.-]{1,64}$/.test(code) ? code : "unknown";
129
+ super(`${LABEL[provider]} stream error: ${safe}`);
130
+ this.name = "LlmStreamError";
131
+ this.provider = provider;
132
+ this.code = safe;
133
+ }
134
+ }
135
+ exports.LlmStreamError = LlmStreamError;
136
+ /** Default cap on a complete response body (bytes), and on the total bytes of a stream. */
137
+ exports.DEFAULT_MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
138
+ /**
139
+ * Default cap on the TOTAL bytes of a stream. Much larger than the complete-body cap: an SSE
140
+ * chunk is ~250-300 B per token on the wire, so a long answer legitimately needs tens of MiB, and
141
+ * memory is bounded by the per-line cap, not by this.
142
+ */
143
+ exports.DEFAULT_MAX_STREAM_BYTES = 128 * 1024 * 1024;
144
+ /** Default cap on one line of a stream, in UTF-8 bytes. */
145
+ exports.DEFAULT_MAX_LINE_BYTES = 1024 * 1024;
146
+ /** UTF-8 byte length of a string, without allocating. */
147
+ function utf8Length(str) {
148
+ let n = 0;
149
+ for (let i = 0; i < str.length; i++) {
150
+ const c = str.charCodeAt(i);
151
+ if (c < 0x80)
152
+ n += 1;
153
+ else if (c < 0x800)
154
+ n += 2;
155
+ else if (c >= 0xd800 && c <= 0xdbff && i + 1 < str.length) {
156
+ n += 4;
157
+ i++;
158
+ }
159
+ else
160
+ n += 3;
161
+ }
162
+ return n;
163
+ }
164
+ /**
165
+ * A provider's response exceeded the configured size cap (`maxResponseBytes` / `maxStreamBytes` / `maxLineBytes`).
166
+ * Carries only the provider and which limit was hit: never any of the body.
167
+ */
168
+ class LlmResponseLimitError extends Error {
169
+ provider;
170
+ reason;
171
+ constructor(provider, reason) {
172
+ super(`${LABEL[provider]} response too large (${reason})`);
173
+ this.name = "LlmResponseLimitError";
174
+ this.provider = provider;
175
+ this.reason = reason;
176
+ }
177
+ }
178
+ exports.LlmResponseLimitError = LlmResponseLimitError;
179
+ /**
180
+ * A 2xx response whose body is not valid JSON. Fixed message, no `cause`: the parser's own error
181
+ * quotes the start of the body, which can hold anything the endpoint sent.
182
+ */
183
+ class LlmResponseInvalidError extends Error {
184
+ provider;
185
+ constructor(provider) {
186
+ super(`${LABEL[provider]} response is not valid JSON`);
187
+ this.name = "LlmResponseInvalidError";
188
+ this.provider = provider;
189
+ }
190
+ }
191
+ exports.LlmResponseInvalidError = LlmResponseInvalidError;
192
+ /** Reject a non-positive or non-integer cap at construction. */
193
+ function resolveLimit(value, fallback, name) {
194
+ if (value === undefined)
195
+ return fallback;
196
+ if (!Number.isInteger(value) || value < 1)
197
+ throw new RangeError(`${name} must be a positive integer`);
198
+ return value;
199
+ }
200
+ /**
201
+ * Read a complete JSON body with a byte cap. Over the cap the body is cancelled and an
202
+ * {@link LlmResponseLimitError} is thrown (no body text). Streams the bytes, so a hostile endpoint
203
+ * cannot make the process buffer more than the cap (plus one chunk).
204
+ */
205
+ async function readBoundedJson(resp, provider, maxBytes) {
206
+ const declared = Number(resp.headers?.get("content-length"));
207
+ if (Number.isFinite(declared) && declared > maxBytes) {
208
+ await drainBody(resp);
209
+ throw new LlmResponseLimitError(provider, "body");
210
+ }
211
+ // No stream to read (an empty body, or a non-network `Response` stand-in): nothing to bound.
212
+ if (!resp.body) {
213
+ try {
214
+ return await resp.json();
215
+ }
216
+ catch {
217
+ throw new LlmResponseInvalidError(provider);
218
+ }
219
+ }
220
+ const reader = resp.body.getReader();
221
+ const parts = [];
222
+ let total = 0;
223
+ try {
224
+ while (true) {
225
+ const { done, value } = await reader.read();
226
+ if (done)
227
+ break;
228
+ total += value.byteLength;
229
+ if (total > maxBytes) {
230
+ await reader.cancel().catch(() => undefined);
231
+ throw new LlmResponseLimitError(provider, "body");
232
+ }
233
+ parts.push(value);
234
+ }
235
+ }
236
+ finally {
237
+ reader.releaseLock?.();
238
+ }
239
+ const all = new Uint8Array(total);
240
+ let off = 0;
241
+ for (const p of parts) {
242
+ all.set(p, off);
243
+ off += p.byteLength;
244
+ }
245
+ try {
246
+ return JSON.parse(new TextDecoder().decode(all));
247
+ }
248
+ catch {
249
+ throw new LlmResponseInvalidError(provider);
250
+ }
251
+ }
252
+ /** Byte and line accounting for an SSE stream; each check throws {@link LlmResponseLimitError}. */
253
+ class StreamLimiter {
254
+ provider;
255
+ maxBytes;
256
+ maxLine;
257
+ total = 0;
258
+ constructor(provider, maxBytes, maxLine) {
259
+ this.provider = provider;
260
+ this.maxBytes = maxBytes;
261
+ this.maxLine = maxLine;
262
+ }
263
+ chunk(value) {
264
+ this.total += value.byteLength;
265
+ if (this.total > this.maxBytes)
266
+ throw new LlmResponseLimitError(this.provider, "stream");
267
+ }
268
+ /** `lines` are the complete lines of this chunk, `rest` the unfinished tail. */
269
+ lines(lines, rest) {
270
+ // UTF-8 is at most 3 bytes per UTF-16 unit: only measure what could be over the cap.
271
+ const over = (l) => l.length * 3 > this.maxLine && utf8Length(l) > this.maxLine;
272
+ if (over(rest))
273
+ throw new LlmResponseLimitError(this.provider, "line");
274
+ for (const l of lines)
275
+ if (over(l))
276
+ throw new LlmResponseLimitError(this.provider, "line");
277
+ }
278
+ }
279
+ exports.StreamLimiter = StreamLimiter;
280
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":";;;AAYA,8BAEC;AA8CD,oDAqDC;AA4ED,oCAKC;AAOD,0CA8CC;AArPD,MAAM,KAAK,GAAoC;IAC7C,SAAS,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AFf,aAAQ,GAAR,QAAQ,CAAiB;QACzB,aAAQ,GAAR,QAAQ,CAAQ;QAChB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IACJ,KAAK,CAAC,KAAiB;QACrB,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC;QAC/B,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC3F,CAAC;IACD,gFAAgF;IAChF,KAAK,CAAC,KAAwB,EAAE,IAAY;QAC1C,qFAAqF;QACrF,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC;QACxF,IAAI,IAAI,CAAC,IAAI,CAAC;YAAE,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACvE,KAAK,MAAM,CAAC,IAAI,KAAK;YAAE,IAAI,IAAI,CAAC,CAAC,CAAC;gBAAE,MAAM,IAAI,qBAAqB,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7F,CAAC;CACF;AAlBD,sCAkBC"}
@@ -0,0 +1,24 @@
1
+ export { LlmHttpError, LlmResponseInvalidError, LlmResponseLimitError, LlmStreamError, } from "./errors";
2
+ export type { LlmHttpErrorKind, LlmHttpProvider, LlmResponseLimitReason } from "./errors";
3
+ export type { LlmContent, LlmMessage, LlmMessageInput, LlmToolSpec, LlmToolSpecInput, LlmRequest, LlmRequestInput, LlmToolCall, LlmResponse, LlmCapturedResponse, LlmStreamChunk, LlmProvider, LlmReasoning, LlmReasoningKind, LlmReasoningPart, } from "./types";
4
+ export type { CapturedReasoningPart, LlmReasoningCaptured, LlmReasoningOptions, ReasoningAttemptRead, ReasoningLogReader, ReasoningPartRead, ReasoningPartStatus, ReasoningQuery, ReasoningReadLimits, ReasoningReader, ReasoningStepRead, ReasoningStore, } from "./reasoning";
5
+ export { LLM_REASONING_CAPTURED, captureReasoning, readReasoning, readReasoningBounded, openReasoningText, reasoningDigest, reasoningStoreResolver, sealReasoningText, textFreeReasoning, } from "./reasoning";
6
+ export type { LlmAudioPart, LlmBinarySource, LlmContentPart, LlmContentPartInput, LlmContentRef, LlmFilePart, LlmImagePart, LlmLayoutEntry, LlmMediaPart, LlmMediaPartInput, LlmMessageContent, LlmMessageContentInput, LlmModality, LlmResultPart, LlmResultPartInput, LlmTextPart, LlmTextPartInput, LlmToolResultPart, LlmToolResultPartInput, LlmToolUsePart, } from "./parts";
7
+ export { TaintedContentError, assistantMessageOf, base64ByteLength, hasReasoningParts, hasStructuredParts, layoutOf, textOf, toParts, withoutReasoningParts, } from "./parts";
8
+ export type { LlmCapabilities, MediaTypeSet } from "./capabilities";
9
+ export { UnsupportedModalityError, assertRequestSupported, capabilitiesForModel, mediaTypeAccepted, requestMediaParts, } from "./capabilities";
10
+ export type { ContentResolveContext, ContentResolver } from "./resolveContent";
11
+ export { MAX_RESOLVED_BYTES, UnresolvedContentError, inlineData, resolveRequestContent, } from "./resolveContent";
12
+ export { InvalidLlmRequestError, MAX_INLINE_BYTES, MAX_INLINE_TOTAL_BYTES, TOOL_INPUT_NODE_CAP, OversizedInlinePartError, UNTRUSTED_CONTENT_SYSTEM_NOTE, UntrustedContentError, exceedsNodeCap, fence, fenceUntrustedMedia, guardRequest, stripUntrusted, untrustedFence, validateMediaPart, } from "./untrusted";
13
+ export type { GuardOptions } from "./untrusted";
14
+ export { AnthropicProvider } from "./providers/AnthropicProvider";
15
+ export type { AnthropicProviderConfig } from "./providers/AnthropicProvider";
16
+ export { OpenAiProvider } from "./providers/OpenAiProvider";
17
+ export type { OpenAiProviderConfig } from "./providers/OpenAiProvider";
18
+ export { GEMINI_CAPABILITIES, GEMINI_MEDIA_MODELS, GeminiProvider, } from "./providers/GeminiProvider";
19
+ export type { GeminiProviderConfig } from "./providers/GeminiProvider";
20
+ export { LLM_INTERRUPTED, MalformedStreamError, assembleStream, collectStream, } from "./assembleStream";
21
+ export type { CollectStreamOptions, InterruptedGeneration, StreamProgress, } from "./assembleStream";
22
+ export { createLlmEffect } from "./createLlmEffect";
23
+ export type { CreateLlmEffectOptions } from "./createLlmEffect";
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,GACf,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAC1F,YAAY,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,YAAY,EACZ,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EAC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AoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,oBAAoB,EACpB,qBAAqB,EACrB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GeminiProvider = exports.GEMINI_MEDIA_MODELS = exports.GEMINI_CAPABILITIES = exports.OpenAiProvider = exports.AnthropicProvider = exports.validateMediaPart = exports.untrustedFence = exports.stripUntrusted = exports.guardRequest = exports.fenceUntrustedMedia = exports.fence = exports.exceedsNodeCap = exports.UntrustedContentError = exports.UNTRUSTED_CONTENT_SYSTEM_NOTE = exports.OversizedInlinePartError = exports.TOOL_INPUT_NODE_CAP = exports.MAX_INLINE_TOTAL_BYTES = exports.MAX_INLINE_BYTES = exports.InvalidLlmRequestError = exports.resolveRequestContent = exports.inlineData = exports.UnresolvedContentError = exports.MAX_RESOLVED_BYTES = exports.requestMediaParts = exports.mediaTypeAccepted = exports.capabilitiesForModel = exports.assertRequestSupported = exports.UnsupportedModalityError = exports.withoutReasoningParts = exports.toParts = exports.textOf = exports.layoutOf = exports.hasStructuredParts = exports.hasReasoningParts = exports.base64ByteLength = exports.assistantMessageOf = exports.TaintedContentError = exports.textFreeReasoning = exports.sealReasoningText = exports.reasoningStoreResolver = exports.reasoningDigest = exports.openReasoningText = exports.readReasoningBounded = exports.readReasoning = exports.captureReasoning = exports.LLM_REASONING_CAPTURED = exports.LlmStreamError = exports.LlmResponseLimitError = exports.LlmResponseInvalidError = exports.LlmHttpError = void 0;
4
+ exports.createLlmEffect = exports.collectStream = exports.assembleStream = exports.MalformedStreamError = exports.LLM_INTERRUPTED = void 0;
5
+ var errors_1 = require("./errors");
6
+ Object.defineProperty(exports, "LlmHttpError", { enumerable: true, get: function () { return errors_1.LlmHttpError; } });
7
+ Object.defineProperty(exports, "LlmResponseInvalidError", { enumerable: true, get: function () { return errors_1.LlmResponseInvalidError; } });
8
+ Object.defineProperty(exports, "LlmResponseLimitError", { enumerable: true, get: function () { return errors_1.LlmResponseLimitError; } });
9
+ Object.defineProperty(exports, "LlmStreamError", { enumerable: true, get: function () { return errors_1.LlmStreamError; } });
10
+ var reasoning_1 = require("./reasoning");
11
+ Object.defineProperty(exports, "LLM_REASONING_CAPTURED", { enumerable: true, get: function () { return reasoning_1.LLM_REASONING_CAPTURED; } });
12
+ Object.defineProperty(exports, "captureReasoning", { enumerable: true, get: function () { return reasoning_1.captureReasoning; } });
13
+ Object.defineProperty(exports, "readReasoning", { enumerable: true, get: function () { return reasoning_1.readReasoning; } });
14
+ Object.defineProperty(exports, "readReasoningBounded", { enumerable: true, get: function () { return reasoning_1.readReasoningBounded; } });
15
+ Object.defineProperty(exports, "openReasoningText", { enumerable: true, get: function () { return reasoning_1.openReasoningText; } });
16
+ Object.defineProperty(exports, "reasoningDigest", { enumerable: true, get: function () { return reasoning_1.reasoningDigest; } });
17
+ Object.defineProperty(exports, "reasoningStoreResolver", { enumerable: true, get: function () { return reasoning_1.reasoningStoreResolver; } });
18
+ Object.defineProperty(exports, "sealReasoningText", { enumerable: true, get: function () { return reasoning_1.sealReasoningText; } });
19
+ Object.defineProperty(exports, "textFreeReasoning", { enumerable: true, get: function () { return reasoning_1.textFreeReasoning; } });
20
+ var parts_1 = require("./parts");
21
+ Object.defineProperty(exports, "TaintedContentError", { enumerable: true, get: function () { return parts_1.TaintedContentError; } });
22
+ Object.defineProperty(exports, "assistantMessageOf", { enumerable: true, get: function () { return parts_1.assistantMessageOf; } });
23
+ Object.defineProperty(exports, "base64ByteLength", { enumerable: true, get: function () { return parts_1.base64ByteLength; } });
24
+ Object.defineProperty(exports, "hasReasoningParts", { enumerable: true, get: function () { return parts_1.hasReasoningParts; } });
25
+ Object.defineProperty(exports, "hasStructuredParts", { enumerable: true, get: function () { return parts_1.hasStructuredParts; } });
26
+ Object.defineProperty(exports, "layoutOf", { enumerable: true, get: function () { return parts_1.layoutOf; } });
27
+ Object.defineProperty(exports, "textOf", { enumerable: true, get: function () { return parts_1.textOf; } });
28
+ Object.defineProperty(exports, "toParts", { enumerable: true, get: function () { return parts_1.toParts; } });
29
+ Object.defineProperty(exports, "withoutReasoningParts", { enumerable: true, get: function () { return parts_1.withoutReasoningParts; } });
30
+ var capabilities_1 = require("./capabilities");
31
+ Object.defineProperty(exports, "UnsupportedModalityError", { enumerable: true, get: function () { return capabilities_1.UnsupportedModalityError; } });
32
+ Object.defineProperty(exports, "assertRequestSupported", { enumerable: true, get: function () { return capabilities_1.assertRequestSupported; } });
33
+ Object.defineProperty(exports, "capabilitiesForModel", { enumerable: true, get: function () { return capabilities_1.capabilitiesForModel; } });
34
+ Object.defineProperty(exports, "mediaTypeAccepted", { enumerable: true, get: function () { return capabilities_1.mediaTypeAccepted; } });
35
+ Object.defineProperty(exports, "requestMediaParts", { enumerable: true, get: function () { return capabilities_1.requestMediaParts; } });
36
+ var resolveContent_1 = require("./resolveContent");
37
+ Object.defineProperty(exports, "MAX_RESOLVED_BYTES", { enumerable: true, get: function () { return resolveContent_1.MAX_RESOLVED_BYTES; } });
38
+ Object.defineProperty(exports, "UnresolvedContentError", { enumerable: true, get: function () { return resolveContent_1.UnresolvedContentError; } });
39
+ Object.defineProperty(exports, "inlineData", { enumerable: true, get: function () { return resolveContent_1.inlineData; } });
40
+ Object.defineProperty(exports, "resolveRequestContent", { enumerable: true, get: function () { return resolveContent_1.resolveRequestContent; } });
41
+ var untrusted_1 = require("./untrusted");
42
+ Object.defineProperty(exports, "InvalidLlmRequestError", { enumerable: true, get: function () { return untrusted_1.InvalidLlmRequestError; } });
43
+ Object.defineProperty(exports, "MAX_INLINE_BYTES", { enumerable: true, get: function () { return untrusted_1.MAX_INLINE_BYTES; } });
44
+ Object.defineProperty(exports, "MAX_INLINE_TOTAL_BYTES", { enumerable: true, get: function () { return untrusted_1.MAX_INLINE_TOTAL_BYTES; } });
45
+ Object.defineProperty(exports, "TOOL_INPUT_NODE_CAP", { enumerable: true, get: function () { return untrusted_1.TOOL_INPUT_NODE_CAP; } });
46
+ Object.defineProperty(exports, "OversizedInlinePartError", { enumerable: true, get: function () { return untrusted_1.OversizedInlinePartError; } });
47
+ Object.defineProperty(exports, "UNTRUSTED_CONTENT_SYSTEM_NOTE", { enumerable: true, get: function () { return untrusted_1.UNTRUSTED_CONTENT_SYSTEM_NOTE; } });
48
+ Object.defineProperty(exports, "UntrustedContentError", { enumerable: true, get: function () { return untrusted_1.UntrustedContentError; } });
49
+ Object.defineProperty(exports, "exceedsNodeCap", { enumerable: true, get: function () { return untrusted_1.exceedsNodeCap; } });
50
+ Object.defineProperty(exports, "fence", { enumerable: true, get: function () { return untrusted_1.fence; } });
51
+ Object.defineProperty(exports, "fenceUntrustedMedia", { enumerable: true, get: function () { return untrusted_1.fenceUntrustedMedia; } });
52
+ Object.defineProperty(exports, "guardRequest", { enumerable: true, get: function () { return untrusted_1.guardRequest; } });
53
+ Object.defineProperty(exports, "stripUntrusted", { enumerable: true, get: function () { return untrusted_1.stripUntrusted; } });
54
+ Object.defineProperty(exports, "untrustedFence", { enumerable: true, get: function () { return untrusted_1.untrustedFence; } });
55
+ Object.defineProperty(exports, "validateMediaPart", { enumerable: true, get: function () { return untrusted_1.validateMediaPart; } });
56
+ var AnthropicProvider_1 = require("./providers/AnthropicProvider");
57
+ Object.defineProperty(exports, "AnthropicProvider", { enumerable: true, get: function () { return AnthropicProvider_1.AnthropicProvider; } });
58
+ var OpenAiProvider_1 = require("./providers/OpenAiProvider");
59
+ Object.defineProperty(exports, "OpenAiProvider", { enumerable: true, get: function () { return OpenAiProvider_1.OpenAiProvider; } });
60
+ var GeminiProvider_1 = require("./providers/GeminiProvider");
61
+ Object.defineProperty(exports, "GEMINI_CAPABILITIES", { enumerable: true, get: function () { return GeminiProvider_1.GEMINI_CAPABILITIES; } });
62
+ Object.defineProperty(exports, "GEMINI_MEDIA_MODELS", { enumerable: true, get: function () { return GeminiProvider_1.GEMINI_MEDIA_MODELS; } });
63
+ Object.defineProperty(exports, "GeminiProvider", { enumerable: true, get: function () { return GeminiProvider_1.GeminiProvider; } });
64
+ var assembleStream_1 = require("./assembleStream");
65
+ Object.defineProperty(exports, "LLM_INTERRUPTED", { enumerable: true, get: function () { return assembleStream_1.LLM_INTERRUPTED; } });
66
+ Object.defineProperty(exports, "MalformedStreamError", { enumerable: true, get: function () { return assembleStream_1.MalformedStreamError; } });
67
+ Object.defineProperty(exports, "assembleStream", { enumerable: true, get: function () { return assembleStream_1.assembleStream; } });
68
+ Object.defineProperty(exports, "collectStream", { enumerable: true, get: function () { return assembleStream_1.collectStream; } });
69
+ var createLlmEffect_1 = require("./createLlmEffect");
70
+ Object.defineProperty(exports, "createLlmEffect", { enumerable: true, get: function () { return createLlmEffect_1.createLlmEffect; } });
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,mCAKkB;AAJhB,sGAAA,YAAY,OAAA;AACZ,iHAAA,uBAAuB,OAAA;AACvB,+GAAA,qBAAqB,OAAA;AACrB,wGAAA,cAAc,OAAA;AAkChB,yCAUqB;AATnB,mHAAA,sBAAsB,OAAA;AACtB,6GAAA,gBAAgB,OAAA;AAChB,0GAAA,aAAa,OAAA;AACb,iHAAA,oBAAoB,OAAA;AACpB,8GAAA,iBAAiB,OAAA;AACjB,4GAAA,eAAe,OAAA;AACf,mHAAA,sBAAsB,OAAA;AACtB,8GAAA,iBAAiB,OAAA;AACjB,8GAAA,iBAAiB,OAAA;AAwBnB,iCAUiB;AATf,4GAAA,mBAAmB,OAAA;AACnB,2GAAA,kBAAkB,OAAA;AAClB,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work/classify";
2
+ /**
3
+ * A claim-check for large bytes held in a content store (ADR 0046).
4
+ *
5
+ * Deliberately NOT the store's own `{ __loomContent }` marker: the resolving event
6
+ * store would substitute that marker with a JSON-decoded value on read, which is
7
+ * wrong for raw media bytes. This is an opaque address the caller resolves (see
8
+ * `CreateLlmEffectOptions.resolveContent`) at call time, so the log carries the
9
+ * address and never the bytes.
10
+ */
11
+ export interface LlmContentRef {
12
+ /** The content address, e.g. `"sha256:<hex>"`. */
13
+ readonly address: string;
14
+ /** Byte length, informational. */
15
+ readonly size?: number;
16
+ }
17
+ /** Where a media part's bytes are. */
18
+ export type LlmBinarySource = {
19
+ readonly kind: "ref";
20
+ readonly ref: LlmContentRef;
21
+ }
22
+ /** Small inline bytes, base64. Capped (see `MAX_INLINE_BYTES`) so the log never carries real media. */
23
+ | {
24
+ readonly kind: "data";
25
+ readonly data: string;
26
+ };
27
+ export interface LlmTextPart {
28
+ type: "text";
29
+ text: string;
30
+ }
31
+ /** Provenance for a media part whose bytes came from an untrusted party (see `guardRequest`). */
32
+ export interface LlmUntrustedMark {
33
+ untrusted?: {
34
+ origin: string;
35
+ };
36
+ }
37
+ export interface LlmImagePart extends LlmUntrustedMark {
38
+ type: "image";
39
+ /** e.g. `image/png`. */
40
+ mediaType: string;
41
+ source: LlmBinarySource;
42
+ }
43
+ export interface LlmAudioPart extends LlmUntrustedMark {
44
+ type: "audio";
45
+ mediaType: string;
46
+ source: LlmBinarySource;
47
+ }
48
+ export interface LlmFilePart extends LlmUntrustedMark {
49
+ type: "file";
50
+ mediaType: string;
51
+ source: LlmBinarySource;
52
+ name?: string;
53
+ }
54
+ export type LlmMediaPart = LlmImagePart | LlmAudioPart | LlmFilePart;
55
+ export type LlmModality = LlmMediaPart["type"];
56
+ /** A tool call the model made (assistant messages only). */
57
+ export interface LlmToolUsePart {
58
+ type: "tool_use";
59
+ id: string;
60
+ name: string;
61
+ input: unknown;
62
+ /** Provider-opaque continuation bytes that belong to this call (Gemini `thoughtSignature`). Sent back unchanged; never dropped with reasoning parts (ADR 0133 D5). */
63
+ signature?: string;
64
+ }
65
+ /**
66
+ * What the model returned as reasoning, in its RECORDED form (ADR 0133 D2): kind, provider,
67
+ * opaque signature, and a reference to the readable text in a sidecar store. Never readable text
68
+ * in a step value or a transcript. Assistant messages only.
69
+ */
70
+ export interface LlmReasoningPart {
71
+ type: "reasoning";
72
+ kind: LlmReasoningKind;
73
+ /** The provider that produced it: a part is only sent back to this provider. */
74
+ provider: string;
75
+ signature?: string;
76
+ /** Where the text lives (sidecar store), when it was captured and is non-empty. */
77
+ textRef?: LlmContentRef;
78
+ /** SHA-256 hex of the text, so a resolved text can be checked. */
79
+ digest?: string;
80
+ /** The model returned readable text that was NOT kept (no store, or capture off). Such a part cannot be reproduced for continuation, so the drop rule (ADR 0133 D5) drops it. */
81
+ omitted?: true;
82
+ /**
83
+ * REQUEST-TIME ONLY: the readable text `resolveRequestContent` fetched from `textRef`, for the
84
+ * provider to map back unchanged. Never present on a recorded value.
85
+ */
86
+ text?: string;
87
+ }
88
+ /** What the provider returned. Never upgrade a `summary` to `text` (ADR 0133 D2). */
89
+ export type LlmReasoningKind = "text" | "summary" | "redacted";
90
+ /** Reasoning on a response, as the provider returned it. Lives only on `LlmResponse`, never in a step value. */
91
+ export interface LlmReasoning {
92
+ kind: LlmReasoningKind;
93
+ /** Readable text; "" for an omitted-display block; absent for `redacted`. */
94
+ text?: string;
95
+ /** Provider-opaque continuation bytes (signature, redacted data). Never read by loom. */
96
+ signature?: string;
97
+ /** The provider that produced it (`"anthropic"`, `"gemini"`, ...): parts are only sent back to it. */
98
+ provider: string;
99
+ }
100
+ /** What a tool result may contain: text and media. */
101
+ export type LlmResultPart = LlmTextPart | LlmMediaPart;
102
+ /** The answer to a tool call (user messages only). */
103
+ export interface LlmToolResultPart {
104
+ type: "tool_result";
105
+ /** The `id` of the `tool_use` this answers. */
106
+ toolUseId: string;
107
+ content: string | LlmResultPart[];
108
+ isError?: boolean;
109
+ }
110
+ export type LlmContentPart = LlmTextPart | LlmMediaPart | LlmToolUsePart | LlmToolResultPart | LlmReasoningPart;
111
+ export type LlmMessageContent = string | LlmContentPart[];
112
+ /** A content slot that may still carry provenance. */
113
+ export type LlmContent = string | TaintedValue<string>;
114
+ export interface LlmTextPartInput {
115
+ type: "text";
116
+ text: LlmContent;
117
+ }
118
+ /**
119
+ * A media part whose bytes came from an untrusted party. `untrusted` is the media
120
+ * analogue of `tainted()` on text: `guardRequest` refuses it outside a `user`
121
+ * message, refuses one that names a stored `ref`, and leaves the mark on the part; the provider
122
+ * mappers bracket it with the same fence tags as text (`fenceUntrustedMedia`) where their wire
123
+ * shape allows — the fence must travel with the media, which not every wire keeps in one message.
124
+ */
125
+ export type LlmMediaPartInput = LlmMediaPart;
126
+ export type LlmResultPartInput = LlmTextPartInput | LlmMediaPartInput;
127
+ export interface LlmToolResultPartInput {
128
+ type: "tool_result";
129
+ toolUseId: string;
130
+ content: LlmContent | LlmResultPartInput[];
131
+ isError?: boolean;
132
+ }
133
+ export type LlmContentPartInput = LlmTextPartInput | LlmMediaPartInput | LlmToolUsePart | LlmToolResultPartInput | LlmReasoningPart;
134
+ export type LlmMessageContentInput = LlmContent | LlmContentPartInput[];
135
+ /** Normalise message content to its parts form (a string becomes one text part). */
136
+ export declare function toParts(content: LlmMessageContent): LlmContentPart[];
137
+ /**
138
+ * Thrown by {@link textOf} when handed a `tainted()` wrapper (`{ __loomTainted, value }`) instead
139
+ * of message content. A wrapper is neither a string nor parts; reading it as text would either
140
+ * crash obscurely or, worse, silently drop the provenance. The message never echoes the content.
141
+ */
142
+ export declare class TaintedContentError extends Error {
143
+ /** The `origin` recorded when the content was tainted. */
144
+ readonly origin: string;
145
+ constructor(origin: string);
146
+ }
147
+ /**
148
+ * The text of a message: the string itself, or its text parts joined (including text
149
+ * inside `tool_result`s, which is what a text-only consumer wants to read). Media and
150
+ * `tool_use` parts contribute nothing.
151
+ *
152
+ * Throws {@link TaintedContentError} on a `tainted()` wrapper - at the top level, in a text part's
153
+ * `text`, or in a `tool_result`'s `content` (or its text parts): unwrap it on purpose first.
154
+ */
155
+ export declare function textOf(content: LlmMessageContent): string;
156
+ /** Whether a message carries any non-text part. */
157
+ export declare function hasStructuredParts(content: LlmMessageContent): boolean;
158
+ /**
159
+ * ADR 0133 D5 - where each block sat in the vendor's response, when that is NOT the canonical order
160
+ * (reasoning parts, then ONE text, then the tool calls). A provider whose signatures bind block
161
+ * order (Anthropic preserved thinking) needs the sequence back exactly: `thinking, text, tool_use,
162
+ * thinking, tool_use` must not become `thinking, thinking, text, tool_use, tool_use`.
163
+ *
164
+ * An entry is `"reasoning"` (the next recorded reasoning part), `{ call }` (the tool call with that
165
+ * id) or `{ text }` (the next `n` characters of the response's `content`). Positions only, no new
166
+ * content, so nothing readable is added to a step value.
167
+ */
168
+ export type LlmLayoutEntry = "reasoning" | {
169
+ call: string;
170
+ } | {
171
+ text: number;
172
+ };
173
+ /**
174
+ * The layout to record for a response, or `undefined` when none is needed: no reasoning (the shape
175
+ * stays exactly today's, G2) or the canonical order. Zero-length text blocks are dropped (a provider
176
+ * rejects an empty text block, so there is nothing to reproduce).
177
+ */
178
+ export declare function layoutOf(entries: readonly LlmLayoutEntry[]): LlmLayoutEntry[] | undefined;
179
+ /**
180
+ * The `assistant` message that records a model response — text (when any) then one
181
+ * `tool_use` part per call — so the next turn's `tool_result`s have something to
182
+ * answer. A response with neither text nor calls yields an empty text part rather than
183
+ * an empty array (providers reject empty content).
184
+ *
185
+ * With a `layout` (ADR 0133 D5) the parts come back in the vendor's own order, text blocks at their
186
+ * positions. A layout that does not fit the response (malformed, text lengths not summing to `content`,
187
+ * or a reasoning count that differs) drops every reasoning part rather than reorder them; a named call
188
+ * that is missing drops the reasoning parts after it; calls it does not name go at the end.
189
+ */
190
+ export declare function assistantMessageOf(response: {
191
+ content: string;
192
+ toolCalls?: readonly {
193
+ id: string;
194
+ name: string;
195
+ input: unknown;
196
+ signature?: string;
197
+ }[];
198
+ /** ADR 0133 - recorded reasoning parts (`LlmReasoningPart`), carried first. Raw `LlmReasoning` is not accepted: readable text never enters a transcript. */
199
+ reasoning?: readonly object[];
200
+ /** ADR 0133 D5 - the vendor's block order, when not canonical. */
201
+ layout?: readonly LlmLayoutEntry[];
202
+ }): {
203
+ role: "assistant";
204
+ content: LlmContentPart[];
205
+ };
206
+ /**
207
+ * ADR 0133 D5 - the same message without its `reasoning` parts (the edit-point drop). Returns the
208
+ * SAME object when it holds none, so callers can compare by identity; tool-call signatures are never
209
+ * touched. A message left empty keeps the shape `assistantMessageOf` gives an empty turn.
210
+ */
211
+ export declare function withoutReasoningParts<M extends {
212
+ content: unknown;
213
+ }>(message: M): M;
214
+ /** Whether a message holds a `reasoning` part. */
215
+ export declare function hasReasoningParts(message: {
216
+ content: unknown;
217
+ }): boolean;
218
+ /** Decoded byte length of a base64 string, or `undefined` if it is not valid base64. */
219
+ export declare function base64ByteLength(data: string): number | undefined;
220
+ //# sourceMappingURL=parts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../src/parts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,MAAM,oBAAoB,CAAC;AAgBlE;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,sCAAsC;AACtC,MAAM,MAAM,eAAe,GACvB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAA;CAAE;AACvD,uGAAuG;GACrG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,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