@halo-sdk/stream 1.0.0 → 1.0.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.
package/README.md CHANGED
@@ -1,6 +1,62 @@
1
1
  # @halo-sdk/stream
2
2
 
3
- Streaming utilities for Halo AI SDK.
3
+ Streaming utilities for Halo AI SDK — SSE Response compatible with Vercel AI SDK.
4
4
 
5
- - `toDataStream` — convert `AsyncGenerator<TurnChunk>` to SSE Response (Vercel AI SDK compatible)
6
- - `createHaloStream` — custom stream factory
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @halo-sdk/stream
9
+ ```
10
+
11
+ Requires `@halo-sdk/core` as a peer dependency.
12
+
13
+ ## toDataStream
14
+
15
+ Convert a Halo `streamText()` result to an SSE Response compatible with `useChat`:
16
+
17
+ ```ts
18
+ import { Halo } from "@halo-sdk/core";
19
+ import { toDataStream } from "@halo-sdk/stream";
20
+
21
+ // In Next.js API route:
22
+ export async function POST(req: Request) {
23
+ const { messages } = await req.json();
24
+
25
+ const agent = halo.agent({
26
+ messages: [{ role: "system", content: "You are helpful." }],
27
+ });
28
+
29
+ return agent.streamText(messages).toDataStream();
30
+ // → SSE Response with 0:/9:/d: protocol
31
+ }
32
+ ```
33
+
34
+ ### SSE Protocol
35
+
36
+ | Prefix | Content |
37
+ | ------ | -------------------------- |
38
+ | `0:` | Text delta |
39
+ | `9:` | Tool call (delta or ready) |
40
+ | `d:` | Done with usage stats |
41
+
42
+ Fully compatible with the Vercel AI SDK `useChat` hook.
43
+
44
+ ## createHaloStream
45
+
46
+ Low-level stream factory for custom streaming use cases:
47
+
48
+ ```ts
49
+ import { createHaloStream } from "@halo-sdk/stream";
50
+
51
+ const stream = createHaloStream(async (ctrl) => {
52
+ ctrl.writeText("Hello ");
53
+ ctrl.writeText("world!");
54
+ ctrl.close({ promptTokens: 10, completionTokens: 5 });
55
+ });
56
+
57
+ // stream is a ReadableStream<string>
58
+ ```
59
+
60
+ ## Documentation
61
+
62
+ See the [Halo SDK docs](https://halo-sdk.github.io/halo-ai/en/api-reference/to-data-stream) for full API reference.
package/dist/index.cjs ADDED
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ createHaloStream: () => createHaloStream,
24
+ toDataStream: () => toDataStream
25
+ });
26
+ module.exports = __toCommonJS(index_exports);
27
+
28
+ // src/stream.ts
29
+ function toDataStream(source, opts) {
30
+ const stream = new ReadableStream({
31
+ async start(controller) {
32
+ const encoder = new TextEncoder();
33
+ try {
34
+ for await (const chunk of source) {
35
+ switch (chunk.type) {
36
+ case "text-delta":
37
+ controller.enqueue(encoder.encode(`0:${JSON.stringify(chunk.delta)}
38
+ `));
39
+ break;
40
+ case "tool-call-delta":
41
+ controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}
42
+ `));
43
+ break;
44
+ case "tool-call-ready":
45
+ controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}
46
+ `));
47
+ break;
48
+ case "done":
49
+ controller.enqueue(encoder.encode(`d:${JSON.stringify({ usage: chunk.usage })}
50
+ `));
51
+ break;
52
+ }
53
+ }
54
+ } catch (err) {
55
+ controller.error(err);
56
+ } finally {
57
+ controller.close();
58
+ }
59
+ }
60
+ });
61
+ return new Response(stream, {
62
+ headers: {
63
+ "Content-Type": "text/event-stream",
64
+ "Cache-Control": "no-cache",
65
+ Connection: "keep-alive",
66
+ ...opts?.headers
67
+ }
68
+ });
69
+ }
70
+ function createHaloStream(fn) {
71
+ return new ReadableStream({
72
+ async start(controller) {
73
+ const encoder = new TextEncoder();
74
+ await fn({
75
+ writeText(delta) {
76
+ controller.enqueue(encoder.encode(delta));
77
+ },
78
+ writeToolCall(call) {
79
+ controller.enqueue(encoder.encode(JSON.stringify(call)));
80
+ },
81
+ close(_usage) {
82
+ controller.close();
83
+ },
84
+ error(err) {
85
+ controller.error(err);
86
+ }
87
+ });
88
+ }
89
+ });
90
+ }
91
+ // Annotate the CommonJS export names for ESM import in node:
92
+ 0 && (module.exports = {
93
+ createHaloStream,
94
+ toDataStream
95
+ });
96
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/stream.ts"],"sourcesContent":["export { toDataStream, createHaloStream } from \"./stream.js\";\n","import type { TurnChunk, ToolCall, Usage } from \"@halo-sdk/core\";\n\n/**\n * Wraps an AsyncGenerator<TurnChunk> as an SSE Response.\n * Format compatible with Vercel AI SDK's 0:/d: protocol.\n */\nexport function toDataStream(\n source: AsyncGenerator<TurnChunk>,\n opts?: { headers?: Record<string, string> },\n): Response {\n const stream = new ReadableStream({\n async start(controller) {\n const encoder = new TextEncoder();\n try {\n for await (const chunk of source) {\n switch (chunk.type) {\n case \"text-delta\":\n controller.enqueue(encoder.encode(`0:${JSON.stringify(chunk.delta)}\\n`));\n break;\n case \"tool-call-delta\":\n controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}\\n`));\n break;\n case \"tool-call-ready\":\n controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}\\n`));\n break;\n case \"done\":\n controller.enqueue(encoder.encode(`d:${JSON.stringify({ usage: chunk.usage })}\\n`));\n break;\n }\n }\n } catch (err) {\n controller.error(err);\n } finally {\n controller.close();\n }\n },\n });\n\n return new Response(stream, {\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n ...opts?.headers,\n },\n });\n}\n\n/**\n * Custom stream entry. Does not go through HaloAgent.\n */\nexport function createHaloStream(\n fn: (ctrl: {\n writeText: (delta: string) => void;\n writeToolCall: (call: ToolCall) => void;\n close: (usage?: Usage) => void;\n error: (err: Error) => void;\n }) => Promise<void>,\n): ReadableStream {\n return new ReadableStream({\n async start(controller) {\n const encoder = new TextEncoder();\n await fn({\n writeText(delta) {\n controller.enqueue(encoder.encode(delta));\n },\n writeToolCall(call) {\n controller.enqueue(encoder.encode(JSON.stringify(call)));\n },\n close(_usage) {\n controller.close();\n },\n error(err) {\n controller.error(err);\n },\n });\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACMO,SAAS,aACd,QACA,MACU;AACV,QAAM,SAAS,IAAI,eAAe;AAAA,IAChC,MAAM,MAAM,YAAY;AACtB,YAAM,UAAU,IAAI,YAAY;AAChC,UAAI;AACF,yBAAiB,SAAS,QAAQ;AAChC,kBAAQ,MAAM,MAAM;AAAA,YAClB,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,MAAM,KAAK,CAAC;AAAA,CAAI,CAAC;AACvE;AAAA,YACF,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC;AAAA,CAAI,CAAC;AACnE;AAAA,YACF,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC;AAAA,CAAI,CAAC;AACnE;AAAA,YACF,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,EAAE,OAAO,MAAM,MAAM,CAAC,CAAC;AAAA,CAAI,CAAC;AAClF;AAAA,UACJ;AAAA,QACF;AAAA,MACF,SAAS,KAAK;AACZ,mBAAW,MAAM,GAAG;AAAA,MACtB,UAAE;AACA,mBAAW,MAAM;AAAA,MACnB;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO,IAAI,SAAS,QAAQ;AAAA,IAC1B,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,GAAG,MAAM;AAAA,IACX;AAAA,EACF,CAAC;AACH;AAKO,SAAS,iBACd,IAMgB;AAChB,SAAO,IAAI,eAAe;AAAA,IACxB,MAAM,MAAM,YAAY;AACtB,YAAM,UAAU,IAAI,YAAY;AAChC,YAAM,GAAG;AAAA,QACP,UAAU,OAAO;AACf,qBAAW,QAAQ,QAAQ,OAAO,KAAK,CAAC;AAAA,QAC1C;AAAA,QACA,cAAc,MAAM;AAClB,qBAAW,QAAQ,QAAQ,OAAO,KAAK,UAAU,IAAI,CAAC,CAAC;AAAA,QACzD;AAAA,QACA,MAAM,QAAQ;AACZ,qBAAW,MAAM;AAAA,QACnB;AAAA,QACA,MAAM,KAAK;AACT,qBAAW,MAAM,GAAG;AAAA,QACtB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
package/dist/index.js CHANGED
@@ -1,2 +1,68 @@
1
- export { toDataStream, createHaloStream } from "./stream.js";
1
+ // src/stream.ts
2
+ function toDataStream(source, opts) {
3
+ const stream = new ReadableStream({
4
+ async start(controller) {
5
+ const encoder = new TextEncoder();
6
+ try {
7
+ for await (const chunk of source) {
8
+ switch (chunk.type) {
9
+ case "text-delta":
10
+ controller.enqueue(encoder.encode(`0:${JSON.stringify(chunk.delta)}
11
+ `));
12
+ break;
13
+ case "tool-call-delta":
14
+ controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}
15
+ `));
16
+ break;
17
+ case "tool-call-ready":
18
+ controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}
19
+ `));
20
+ break;
21
+ case "done":
22
+ controller.enqueue(encoder.encode(`d:${JSON.stringify({ usage: chunk.usage })}
23
+ `));
24
+ break;
25
+ }
26
+ }
27
+ } catch (err) {
28
+ controller.error(err);
29
+ } finally {
30
+ controller.close();
31
+ }
32
+ }
33
+ });
34
+ return new Response(stream, {
35
+ headers: {
36
+ "Content-Type": "text/event-stream",
37
+ "Cache-Control": "no-cache",
38
+ Connection: "keep-alive",
39
+ ...opts?.headers
40
+ }
41
+ });
42
+ }
43
+ function createHaloStream(fn) {
44
+ return new ReadableStream({
45
+ async start(controller) {
46
+ const encoder = new TextEncoder();
47
+ await fn({
48
+ writeText(delta) {
49
+ controller.enqueue(encoder.encode(delta));
50
+ },
51
+ writeToolCall(call) {
52
+ controller.enqueue(encoder.encode(JSON.stringify(call)));
53
+ },
54
+ close(_usage) {
55
+ controller.close();
56
+ },
57
+ error(err) {
58
+ controller.error(err);
59
+ }
60
+ });
61
+ }
62
+ });
63
+ }
64
+ export {
65
+ createHaloStream,
66
+ toDataStream
67
+ };
2
68
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"sources":["../src/stream.ts"],"sourcesContent":["import type { TurnChunk, ToolCall, Usage } from \"@halo-sdk/core\";\n\n/**\n * Wraps an AsyncGenerator<TurnChunk> as an SSE Response.\n * Format compatible with Vercel AI SDK's 0:/d: protocol.\n */\nexport function toDataStream(\n source: AsyncGenerator<TurnChunk>,\n opts?: { headers?: Record<string, string> },\n): Response {\n const stream = new ReadableStream({\n async start(controller) {\n const encoder = new TextEncoder();\n try {\n for await (const chunk of source) {\n switch (chunk.type) {\n case \"text-delta\":\n controller.enqueue(encoder.encode(`0:${JSON.stringify(chunk.delta)}\\n`));\n break;\n case \"tool-call-delta\":\n controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}\\n`));\n break;\n case \"tool-call-ready\":\n controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}\\n`));\n break;\n case \"done\":\n controller.enqueue(encoder.encode(`d:${JSON.stringify({ usage: chunk.usage })}\\n`));\n break;\n }\n }\n } catch (err) {\n controller.error(err);\n } finally {\n controller.close();\n }\n },\n });\n\n return new Response(stream, {\n headers: {\n \"Content-Type\": \"text/event-stream\",\n \"Cache-Control\": \"no-cache\",\n Connection: \"keep-alive\",\n ...opts?.headers,\n },\n });\n}\n\n/**\n * Custom stream entry. Does not go through HaloAgent.\n */\nexport function createHaloStream(\n fn: (ctrl: {\n writeText: (delta: string) => void;\n writeToolCall: (call: ToolCall) => void;\n close: (usage?: Usage) => void;\n error: (err: Error) => void;\n }) => Promise<void>,\n): ReadableStream {\n return new ReadableStream({\n async start(controller) {\n const encoder = new TextEncoder();\n await fn({\n writeText(delta) {\n controller.enqueue(encoder.encode(delta));\n },\n writeToolCall(call) {\n controller.enqueue(encoder.encode(JSON.stringify(call)));\n },\n close(_usage) {\n controller.close();\n },\n error(err) {\n controller.error(err);\n },\n });\n },\n });\n}\n"],"mappings":";AAMO,SAAS,aACd,QACA,MACU;AACV,QAAM,SAAS,IAAI,eAAe;AAAA,IAChC,MAAM,MAAM,YAAY;AACtB,YAAM,UAAU,IAAI,YAAY;AAChC,UAAI;AACF,yBAAiB,SAAS,QAAQ;AAChC,kBAAQ,MAAM,MAAM;AAAA,YAClB,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,MAAM,KAAK,CAAC;AAAA,CAAI,CAAC;AACvE;AAAA,YACF,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC;AAAA,CAAI,CAAC;AACnE;AAAA,YACF,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,CAAC,KAAK,CAAC,CAAC;AAAA,CAAI,CAAC;AACnE;AAAA,YACF,KAAK;AACH,yBAAW,QAAQ,QAAQ,OAAO,KAAK,KAAK,UAAU,EAAE,OAAO,MAAM,MAAM,CAAC,CAAC;AAAA,CAAI,CAAC;AAClF;AAAA,UACJ;AAAA,QACF;AAAA,MACF,SAAS,KAAK;AACZ,mBAAW,MAAM,GAAG;AAAA,MACtB,UAAE;AACA,mBAAW,MAAM;AAAA,MACnB;AAAA,IACF;AAAA,EACF,CAAC;AAED,SAAO,IAAI,SAAS,QAAQ;AAAA,IAC1B,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,MACjB,YAAY;AAAA,MACZ,GAAG,MAAM;AAAA,IACX;AAAA,EACF,CAAC;AACH;AAKO,SAAS,iBACd,IAMgB;AAChB,SAAO,IAAI,eAAe;AAAA,IACxB,MAAM,MAAM,YAAY;AACtB,YAAM,UAAU,IAAI,YAAY;AAChC,YAAM,GAAG;AAAA,QACP,UAAU,OAAO;AACf,qBAAW,QAAQ,QAAQ,OAAO,KAAK,CAAC;AAAA,QAC1C;AAAA,QACA,cAAc,MAAM;AAClB,qBAAW,QAAQ,QAAQ,OAAO,KAAK,UAAU,IAAI,CAAC,CAAC;AAAA,QACzD;AAAA,QACA,MAAM,QAAQ;AACZ,qBAAW,MAAM;AAAA,QACnB;AAAA,QACA,MAAM,KAAK;AACT,qBAAW,MAAM,GAAG;AAAA,QACtB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,CAAC;AACH;","names":[]}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@halo-sdk/stream",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Streaming utilities for Halo AI SDK — SSE Response for Vercel AI SDK compatibility",
5
- "license": "MIT",
6
5
  "keywords": [
7
6
  "ai",
8
7
  "llm",
9
- "streaming",
10
8
  "sse",
9
+ "streaming",
11
10
  "vercel-ai-sdk"
12
11
  ],
12
+ "license": "MIT",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "https://github.com/halo-sdk/halo-ai",
@@ -24,23 +24,26 @@
24
24
  "exports": {
25
25
  ".": {
26
26
  "types": "./dist/index.d.ts",
27
- "import": "./dist/index.js"
27
+ "import": "./dist/index.js",
28
+ "require": "./dist/index.cjs"
28
29
  }
29
30
  },
30
31
  "publishConfig": {
31
32
  "access": "public"
32
33
  },
33
- "peerDependencies": {
34
- "@halo-sdk/core": ">=1.0.0"
35
- },
36
34
  "devDependencies": {
37
35
  "typescript": "^5.8.0",
38
36
  "vitest": "^3.0.0",
39
- "@halo-sdk/core": "1.0.0"
37
+ "@halo-sdk/core": "1.0.1"
38
+ },
39
+ "peerDependencies": {
40
+ "@halo-sdk/core": ">=1.0.1"
40
41
  },
41
42
  "scripts": {
42
- "build": "tsc",
43
- "dev": "tsc --watch",
43
+ "build": "tsc --build --emitDeclarationOnly && tsup",
44
+ "dev": "tsup --watch",
45
+ "clean": "del-cli dist *.tsbuildinfo",
46
+ "publint": "publint",
44
47
  "test": "vitest run",
45
48
  "test:watch": "vitest"
46
49
  }
package/dist/stream.js DELETED
@@ -1,68 +0,0 @@
1
- /**
2
- * Wraps an AsyncGenerator<TurnChunk> as an SSE Response.
3
- * Format compatible with Vercel AI SDK's 0:/d: protocol.
4
- */
5
- export function toDataStream(source, opts) {
6
- const stream = new ReadableStream({
7
- async start(controller) {
8
- const encoder = new TextEncoder();
9
- try {
10
- for await (const chunk of source) {
11
- switch (chunk.type) {
12
- case "text-delta":
13
- controller.enqueue(encoder.encode(`0:${JSON.stringify(chunk.delta)}\n`));
14
- break;
15
- case "tool-call-delta":
16
- controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}\n`));
17
- break;
18
- case "tool-call-ready":
19
- controller.enqueue(encoder.encode(`9:${JSON.stringify([chunk])}\n`));
20
- break;
21
- case "done":
22
- controller.enqueue(encoder.encode(`d:${JSON.stringify({ usage: chunk.usage })}\n`));
23
- break;
24
- }
25
- }
26
- }
27
- catch (err) {
28
- controller.error(err);
29
- }
30
- finally {
31
- controller.close();
32
- }
33
- },
34
- });
35
- return new Response(stream, {
36
- headers: {
37
- "Content-Type": "text/event-stream",
38
- "Cache-Control": "no-cache",
39
- Connection: "keep-alive",
40
- ...opts?.headers,
41
- },
42
- });
43
- }
44
- /**
45
- * Custom stream entry. Does not go through HaloAgent.
46
- */
47
- export function createHaloStream(fn) {
48
- return new ReadableStream({
49
- async start(controller) {
50
- const encoder = new TextEncoder();
51
- await fn({
52
- writeText(delta) {
53
- controller.enqueue(encoder.encode(delta));
54
- },
55
- writeToolCall(call) {
56
- controller.enqueue(encoder.encode(JSON.stringify(call)));
57
- },
58
- close(_usage) {
59
- controller.close();
60
- },
61
- error(err) {
62
- controller.error(err);
63
- },
64
- });
65
- },
66
- });
67
- }
68
- //# sourceMappingURL=stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,MAAiC,EACjC,IAA2C;IAE3C,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC;QAChC,KAAK,CAAC,KAAK,CAAC,UAAU;YACpB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;oBACjC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;wBACnB,KAAK,YAAY;4BACf,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;4BACzE,MAAM;wBACR,KAAK,iBAAiB;4BACpB,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI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