@anvia/core 0.1.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.
Files changed (93) hide show
  1. package/README.md +101 -0
  2. package/dist/agent/index.d.ts +70 -0
  3. package/dist/agent/index.js +31 -0
  4. package/dist/agent/index.js.map +1 -0
  5. package/dist/agent-C6h6YrRU.d.ts +218 -0
  6. package/dist/audio-generation/index.d.ts +32 -0
  7. package/dist/audio-generation/index.js +9 -0
  8. package/dist/audio-generation/index.js.map +1 -0
  9. package/dist/chunk-7QI6ZAFI.js +61 -0
  10. package/dist/chunk-7QI6ZAFI.js.map +1 -0
  11. package/dist/chunk-A7VDIZQN.js +145 -0
  12. package/dist/chunk-A7VDIZQN.js.map +1 -0
  13. package/dist/chunk-B24Q2ZYM.js +43 -0
  14. package/dist/chunk-B24Q2ZYM.js.map +1 -0
  15. package/dist/chunk-B4QHQN5K.js +37 -0
  16. package/dist/chunk-B4QHQN5K.js.map +1 -0
  17. package/dist/chunk-CP47FBJV.js +324 -0
  18. package/dist/chunk-CP47FBJV.js.map +1 -0
  19. package/dist/chunk-FI2BTRT5.js +86 -0
  20. package/dist/chunk-FI2BTRT5.js.map +1 -0
  21. package/dist/chunk-GNWMOSNR.js +113 -0
  22. package/dist/chunk-GNWMOSNR.js.map +1 -0
  23. package/dist/chunk-I77SDTFE.js +43 -0
  24. package/dist/chunk-I77SDTFE.js.map +1 -0
  25. package/dist/chunk-IA76K5UX.js +142 -0
  26. package/dist/chunk-IA76K5UX.js.map +1 -0
  27. package/dist/chunk-IQBY2GCF.js +1207 -0
  28. package/dist/chunk-IQBY2GCF.js.map +1 -0
  29. package/dist/chunk-KSIY7KJA.js +387 -0
  30. package/dist/chunk-KSIY7KJA.js.map +1 -0
  31. package/dist/chunk-LMBOJMNB.js +304 -0
  32. package/dist/chunk-LMBOJMNB.js.map +1 -0
  33. package/dist/chunk-S55WOHX5.js +9 -0
  34. package/dist/chunk-S55WOHX5.js.map +1 -0
  35. package/dist/chunk-SRGJPXKT.js +256 -0
  36. package/dist/chunk-SRGJPXKT.js.map +1 -0
  37. package/dist/chunk-WZTPK5HV.js +125 -0
  38. package/dist/chunk-WZTPK5HV.js.map +1 -0
  39. package/dist/chunk-X6FBOU2P.js +96 -0
  40. package/dist/chunk-X6FBOU2P.js.map +1 -0
  41. package/dist/chunk-XUUY2L2D.js +42 -0
  42. package/dist/chunk-XUUY2L2D.js.map +1 -0
  43. package/dist/completion/index.d.ts +36 -0
  44. package/dist/completion/index.js +29 -0
  45. package/dist/completion/index.js.map +1 -0
  46. package/dist/embeddings/index.d.ts +34 -0
  47. package/dist/embeddings/index.js +23 -0
  48. package/dist/embeddings/index.js.map +1 -0
  49. package/dist/evals/index.d.ts +153 -0
  50. package/dist/evals/index.js +30 -0
  51. package/dist/evals/index.js.map +1 -0
  52. package/dist/extractor/index.d.ts +45 -0
  53. package/dist/extractor/index.js +19 -0
  54. package/dist/extractor/index.js.map +1 -0
  55. package/dist/image-generation/index.d.ts +37 -0
  56. package/dist/image-generation/index.js +9 -0
  57. package/dist/image-generation/index.js.map +1 -0
  58. package/dist/index.d.ts +24 -0
  59. package/dist/index.js +183 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/loaders/index.d.ts +82 -0
  62. package/dist/loaders/index.js +287 -0
  63. package/dist/loaders/index.js.map +1 -0
  64. package/dist/mcp/index.d.ts +15 -0
  65. package/dist/mcp/index.js +9 -0
  66. package/dist/mcp/index.js.map +1 -0
  67. package/dist/observability/index.d.ts +93 -0
  68. package/dist/observability/index.js +7 -0
  69. package/dist/observability/index.js.map +1 -0
  70. package/dist/pipeline/index.d.ts +51 -0
  71. package/dist/pipeline/index.js +9 -0
  72. package/dist/pipeline/index.js.map +1 -0
  73. package/dist/skills/index.d.ts +12 -0
  74. package/dist/skills/index.js +16 -0
  75. package/dist/skills/index.js.map +1 -0
  76. package/dist/streaming/index.d.ts +6 -0
  77. package/dist/streaming/index.js +7 -0
  78. package/dist/streaming/index.js.map +1 -0
  79. package/dist/tool/index.d.ts +42 -0
  80. package/dist/tool/index.js +33 -0
  81. package/dist/tool/index.js.map +1 -0
  82. package/dist/tool-DhuBQ3yb.d.ts +35 -0
  83. package/dist/transcription/index.d.ts +35 -0
  84. package/dist/transcription/index.js +9 -0
  85. package/dist/transcription/index.js.map +1 -0
  86. package/dist/types-B5B8Sdl4.d.ts +64 -0
  87. package/dist/types-BrxLd7ay.d.ts +250 -0
  88. package/dist/types-HvopERm0.d.ts +30 -0
  89. package/dist/vector-store/index.d.ts +111 -0
  90. package/dist/vector-store/index.js +15 -0
  91. package/dist/vector-store/index.js.map +1 -0
  92. package/dist/zod-schema-DJTEgQBq.d.ts +40 -0
  93. package/package.json +102 -0
@@ -0,0 +1,287 @@
1
+ // src/loaders/index.ts
2
+ import { readdir, readFile } from "fs/promises";
3
+ import { isAbsolute, join } from "path";
4
+ import { glob } from "tinyglobby";
5
+ var FileLoader = class _FileLoader {
6
+ constructor(source, mode, skipErrors) {
7
+ this.source = source;
8
+ this.mode = mode;
9
+ this.skipErrors = skipErrors;
10
+ }
11
+ source;
12
+ mode;
13
+ skipErrors;
14
+ static withGlob(pattern) {
15
+ return new _FileLoader(
16
+ async function* () {
17
+ for (const path of await sortedGlob(pattern)) {
18
+ yield ok({ path });
19
+ }
20
+ },
21
+ "source",
22
+ false
23
+ );
24
+ }
25
+ static withDir(directory) {
26
+ return new _FileLoader(
27
+ async function* () {
28
+ const entries = await readdir(directory, { withFileTypes: true });
29
+ const files = entries.filter((entry) => entry.isFile()).map((entry) => join(directory, entry.name)).sort((left, right) => left.localeCompare(right));
30
+ for (const path of files) {
31
+ yield ok({ path });
32
+ }
33
+ },
34
+ "source",
35
+ false
36
+ );
37
+ }
38
+ static fromBytes(bytes) {
39
+ return _FileLoader.fromBytesMany([bytes]);
40
+ }
41
+ static fromBytesMany(bytes) {
42
+ return new _FileLoader(
43
+ async function* () {
44
+ for (const value of bytes) {
45
+ yield ok({ path: "<memory>", bytes: toUint8Array(value) });
46
+ }
47
+ },
48
+ "source",
49
+ false
50
+ );
51
+ }
52
+ read() {
53
+ return new _FileLoader(this.source, "read", this.skipErrors);
54
+ }
55
+ readWithPath() {
56
+ return new _FileLoader(this.source, "readWithPath", this.skipErrors);
57
+ }
58
+ ignoreErrors() {
59
+ return new _FileLoader(this.source, this.mode, true);
60
+ }
61
+ async *[Symbol.asyncIterator]() {
62
+ for await (const item of this.source()) {
63
+ const result = await mapFileResult(item, this.mode);
64
+ if (!result.ok && this.skipErrors) {
65
+ continue;
66
+ }
67
+ yield this.skipErrors && result.ok ? result.value : result;
68
+ }
69
+ }
70
+ };
71
+ var PdfFileLoader = class _PdfFileLoader {
72
+ constructor(source, mode, skipErrors) {
73
+ this.source = source;
74
+ this.mode = mode;
75
+ this.skipErrors = skipErrors;
76
+ }
77
+ source;
78
+ mode;
79
+ skipErrors;
80
+ static withGlob(pattern) {
81
+ return new _PdfFileLoader(
82
+ async function* () {
83
+ for (const path of await sortedGlob(pattern)) {
84
+ yield ok({ path });
85
+ }
86
+ },
87
+ "source",
88
+ false
89
+ );
90
+ }
91
+ static withDir(directory) {
92
+ return new _PdfFileLoader(
93
+ async function* () {
94
+ const entries = await readdir(directory, { withFileTypes: true });
95
+ const files = entries.filter((entry) => entry.isFile()).map((entry) => join(directory, entry.name)).sort((left, right) => left.localeCompare(right));
96
+ for (const path of files) {
97
+ yield ok({ path });
98
+ }
99
+ },
100
+ "source",
101
+ false
102
+ );
103
+ }
104
+ static fromBytes(bytes) {
105
+ return _PdfFileLoader.fromBytesMany([bytes]);
106
+ }
107
+ static fromBytesMany(bytes) {
108
+ return new _PdfFileLoader(
109
+ async function* () {
110
+ for (const value of bytes) {
111
+ yield ok({ path: "<memory>", bytes: toUint8Array(value) });
112
+ }
113
+ },
114
+ "source",
115
+ false
116
+ );
117
+ }
118
+ read() {
119
+ return new _PdfFileLoader(this.source, "read", this.skipErrors);
120
+ }
121
+ readWithPath() {
122
+ return new _PdfFileLoader(this.source, "readWithPath", this.skipErrors);
123
+ }
124
+ byPage() {
125
+ const mode = this.mode === "readWithPath" ? "byPageWithPath" : "byPage";
126
+ return new _PdfFileLoader(this.source, mode, this.skipErrors);
127
+ }
128
+ ignoreErrors() {
129
+ return new _PdfFileLoader(this.source, this.mode, true);
130
+ }
131
+ async *[Symbol.asyncIterator]() {
132
+ for await (const item of this.source()) {
133
+ const results = await mapPdfResult(item, this.mode);
134
+ for (const result of results) {
135
+ if (!result.ok && this.skipErrors) {
136
+ continue;
137
+ }
138
+ yield this.skipErrors && result.ok ? result.value : result;
139
+ }
140
+ }
141
+ }
142
+ };
143
+ function fileToDocument(file) {
144
+ return {
145
+ id: file.path,
146
+ text: file.text,
147
+ additionalProps: {
148
+ source: file.path,
149
+ mediaType: "text/plain"
150
+ }
151
+ };
152
+ }
153
+ async function fileLoaderToDocuments(loader) {
154
+ const documents = [];
155
+ for await (const file of loader) {
156
+ documents.push(fileToDocument(file));
157
+ }
158
+ return documents;
159
+ }
160
+ function pdfToDocument(pdf) {
161
+ return {
162
+ id: pdf.path,
163
+ text: pdf.text,
164
+ additionalProps: {
165
+ source: pdf.path,
166
+ mediaType: "application/pdf"
167
+ }
168
+ };
169
+ }
170
+ async function pdfLoaderToDocuments(loader) {
171
+ const documents = [];
172
+ for await (const pdf of loader) {
173
+ documents.push(pdfToDocument(pdf));
174
+ }
175
+ return documents;
176
+ }
177
+ function pdfPageToDocument(page) {
178
+ return {
179
+ id: `${page.path}#page=${page.pageNumber}`,
180
+ text: page.text,
181
+ additionalProps: {
182
+ source: page.path,
183
+ mediaType: "application/pdf",
184
+ pageNumber: String(page.pageNumber)
185
+ }
186
+ };
187
+ }
188
+ async function pdfPageLoaderToDocuments(loader) {
189
+ const documents = [];
190
+ for await (const page of loader) {
191
+ documents.push(pdfPageToDocument(page));
192
+ }
193
+ return documents;
194
+ }
195
+ function ok(value) {
196
+ return { ok: true, value };
197
+ }
198
+ function err(error) {
199
+ return { ok: false, error };
200
+ }
201
+ async function sortedGlob(pattern) {
202
+ return (await glob(pattern, { absolute: isAbsolute(pattern), onlyFiles: true })).sort(
203
+ (left, right) => left.localeCompare(right)
204
+ );
205
+ }
206
+ async function mapFileResult(item, mode) {
207
+ if (!item.ok) {
208
+ return item;
209
+ }
210
+ if (mode === "source") {
211
+ return item;
212
+ }
213
+ try {
214
+ const text = await readFileSource(item.value);
215
+ return mode === "read" ? ok(text) : ok({ path: item.value.path, text });
216
+ } catch (error) {
217
+ return err(error);
218
+ }
219
+ }
220
+ async function mapPdfResult(item, mode) {
221
+ if (!item.ok) {
222
+ return [item];
223
+ }
224
+ if (mode === "source") {
225
+ return [item];
226
+ }
227
+ try {
228
+ const pages = await readPdfPages(item.value);
229
+ if (mode === "read") {
230
+ return [ok(pages.map((page) => page.text).join(""))];
231
+ }
232
+ if (mode === "readWithPath") {
233
+ return [ok({ path: item.value.path, text: pages.map((page) => page.text).join("") })];
234
+ }
235
+ if (mode === "byPageWithPath") {
236
+ return pages.map((page) => ok({ path: item.value.path, ...page }));
237
+ }
238
+ return pages.map(ok);
239
+ } catch (error) {
240
+ return [err(error)];
241
+ }
242
+ }
243
+ async function readFileSource(source) {
244
+ if ("bytes" in source) {
245
+ return new TextDecoder().decode(source.bytes);
246
+ }
247
+ return readFile(source.path, "utf8");
248
+ }
249
+ async function readPdfPages(source) {
250
+ const pdfjs = await import("pdfjs-dist/legacy/build/pdf.mjs");
251
+ const bytes = "bytes" in source ? source.bytes : toUint8Array(await readFile(source.path));
252
+ const document = await pdfjs.getDocument({ data: bytes }).promise;
253
+ const pages = [];
254
+ try {
255
+ for (let index = 1; index <= document.numPages; index += 1) {
256
+ const page = await document.getPage(index);
257
+ const content = await page.getTextContent();
258
+ const text = content.items.flatMap(
259
+ (item) => typeof item === "object" && item !== null && "str" in item ? [String(item.str)] : []
260
+ ).join("\n");
261
+ pages.push({ pageNumber: index - 1, text: text.length > 0 ? `${text}
262
+ ` : "" });
263
+ }
264
+ } finally {
265
+ await document.destroy();
266
+ }
267
+ return pages;
268
+ }
269
+ function toUint8Array(bytes) {
270
+ if (bytes instanceof Uint8Array) {
271
+ return new Uint8Array(
272
+ bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength)
273
+ );
274
+ }
275
+ return new Uint8Array(bytes);
276
+ }
277
+ export {
278
+ FileLoader,
279
+ PdfFileLoader,
280
+ fileLoaderToDocuments,
281
+ fileToDocument,
282
+ pdfLoaderToDocuments,
283
+ pdfPageLoaderToDocuments,
284
+ pdfPageToDocument,
285
+ pdfToDocument
286
+ };
287
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/loaders/index.ts"],"sourcesContent":["import { readdir, readFile } from \"node:fs/promises\";\nimport { isAbsolute, join } from \"node:path\";\nimport { glob } from \"tinyglobby\";\nimport type { Document } from \"../completion\";\n\nexport type LoaderResult<T> = { ok: true; value: T } | { ok: false; error: unknown };\n\nexport type FileSource = { path: string } | { path: \"<memory>\"; bytes: Uint8Array };\nexport type FileReadWithPath = { path: string; text: string };\n\nexport type PdfSource = { path: string } | { path: \"<memory>\"; bytes: Uint8Array };\nexport type PdfReadWithPath = { path: string; text: string };\nexport type PdfPage = { pageNumber: number; text: string };\nexport type PdfPageWithPath = { path: string; pageNumber: number; text: string };\n\ntype FileMode = \"source\" | \"read\" | \"readWithPath\";\ntype PdfMode = \"source\" | \"read\" | \"readWithPath\" | \"byPage\" | \"byPageWithPath\";\n\nexport class FileLoader<T = LoaderResult<FileSource>> implements AsyncIterable<T> {\n private constructor(\n private readonly source: () => AsyncIterable<LoaderResult<FileSource>>,\n private readonly mode: FileMode,\n private readonly skipErrors: boolean,\n ) {}\n\n static withGlob(pattern: string): FileLoader<LoaderResult<FileSource>> {\n return new FileLoader(\n async function* () {\n for (const path of await sortedGlob(pattern)) {\n yield ok({ path });\n }\n },\n \"source\",\n false,\n );\n }\n\n static withDir(directory: string): FileLoader<LoaderResult<FileSource>> {\n return new FileLoader(\n async function* () {\n const entries = await readdir(directory, { withFileTypes: true });\n const files = entries\n .filter((entry) => entry.isFile())\n .map((entry) => join(directory, entry.name))\n .sort((left, right) => left.localeCompare(right));\n for (const path of files) {\n yield ok({ path });\n }\n },\n \"source\",\n false,\n );\n }\n\n static fromBytes(bytes: Uint8Array | ArrayBuffer): FileLoader<LoaderResult<FileSource>> {\n return FileLoader.fromBytesMany([bytes]);\n }\n\n static fromBytesMany(\n bytes: Array<Uint8Array | ArrayBuffer>,\n ): FileLoader<LoaderResult<FileSource>> {\n return new FileLoader(\n async function* () {\n for (const value of bytes) {\n yield ok({ path: \"<memory>\", bytes: toUint8Array(value) });\n }\n },\n \"source\",\n false,\n );\n }\n\n read(): FileLoader<LoaderResult<string>> {\n return new FileLoader(this.source, \"read\", this.skipErrors);\n }\n\n readWithPath(): FileLoader<LoaderResult<FileReadWithPath>> {\n return new FileLoader(this.source, \"readWithPath\", this.skipErrors);\n }\n\n ignoreErrors(): FileLoader<UnwrapLoaderResult<T>> {\n return new FileLoader(this.source, this.mode, true) as FileLoader<UnwrapLoaderResult<T>>;\n }\n\n async *[Symbol.asyncIterator](): AsyncIterator<T> {\n for await (const item of this.source()) {\n const result = await mapFileResult(item, this.mode);\n if (!result.ok && this.skipErrors) {\n continue;\n }\n yield (this.skipErrors && result.ok ? result.value : result) as T;\n }\n }\n}\n\nexport class PdfFileLoader<T = LoaderResult<PdfSource>> implements AsyncIterable<T> {\n private constructor(\n private readonly source: () => AsyncIterable<LoaderResult<PdfSource>>,\n private readonly mode: PdfMode,\n private readonly skipErrors: boolean,\n ) {}\n\n static withGlob(pattern: string): PdfFileLoader<LoaderResult<PdfSource>> {\n return new PdfFileLoader(\n async function* () {\n for (const path of await sortedGlob(pattern)) {\n yield ok({ path });\n }\n },\n \"source\",\n false,\n );\n }\n\n static withDir(directory: string): PdfFileLoader<LoaderResult<PdfSource>> {\n return new PdfFileLoader(\n async function* () {\n const entries = await readdir(directory, { withFileTypes: true });\n const files = entries\n .filter((entry) => entry.isFile())\n .map((entry) => join(directory, entry.name))\n .sort((left, right) => left.localeCompare(right));\n for (const path of files) {\n yield ok({ path });\n }\n },\n \"source\",\n false,\n );\n }\n\n static fromBytes(bytes: Uint8Array | ArrayBuffer): PdfFileLoader<LoaderResult<PdfSource>> {\n return PdfFileLoader.fromBytesMany([bytes]);\n }\n\n static fromBytesMany(\n bytes: Array<Uint8Array | ArrayBuffer>,\n ): PdfFileLoader<LoaderResult<PdfSource>> {\n return new PdfFileLoader(\n async function* () {\n for (const value of bytes) {\n yield ok({ path: \"<memory>\", bytes: toUint8Array(value) });\n }\n },\n \"source\",\n false,\n );\n }\n\n read(): PdfFileLoader<LoaderResult<string>> {\n return new PdfFileLoader(this.source, \"read\", this.skipErrors);\n }\n\n readWithPath(): PdfFileLoader<LoaderResult<PdfReadWithPath>> {\n return new PdfFileLoader(this.source, \"readWithPath\", this.skipErrors);\n }\n\n byPage(\n this: PdfFileLoader<LoaderResult<PdfReadWithPath>>,\n ): PdfFileLoader<LoaderResult<PdfPageWithPath>>;\n byPage(this: PdfFileLoader<PdfReadWithPath>): PdfFileLoader<PdfPageWithPath>;\n byPage(): PdfFileLoader<LoaderResult<PdfPage>>;\n byPage(): PdfFileLoader<LoaderResult<PdfPage> | LoaderResult<PdfPageWithPath> | PdfPageWithPath> {\n const mode = this.mode === \"readWithPath\" ? \"byPageWithPath\" : \"byPage\";\n return new PdfFileLoader(this.source, mode, this.skipErrors);\n }\n\n ignoreErrors(): PdfFileLoader<UnwrapLoaderResult<T>> {\n return new PdfFileLoader(this.source, this.mode, true) as PdfFileLoader<UnwrapLoaderResult<T>>;\n }\n\n async *[Symbol.asyncIterator](): AsyncIterator<T> {\n for await (const item of this.source()) {\n const results = await mapPdfResult(item, this.mode);\n for (const result of results) {\n if (!result.ok && this.skipErrors) {\n continue;\n }\n yield (this.skipErrors && result.ok ? result.value : result) as T;\n }\n }\n }\n}\n\nexport function fileToDocument(file: FileReadWithPath): Document {\n return {\n id: file.path,\n text: file.text,\n additionalProps: {\n source: file.path,\n mediaType: \"text/plain\",\n },\n };\n}\n\nexport async function fileLoaderToDocuments(\n loader: AsyncIterable<FileReadWithPath>,\n): Promise<Document[]> {\n const documents: Document[] = [];\n for await (const file of loader) {\n documents.push(fileToDocument(file));\n }\n return documents;\n}\n\nexport function pdfToDocument(pdf: PdfReadWithPath): Document {\n return {\n id: pdf.path,\n text: pdf.text,\n additionalProps: {\n source: pdf.path,\n mediaType: \"application/pdf\",\n },\n };\n}\n\nexport async function pdfLoaderToDocuments(\n loader: AsyncIterable<PdfReadWithPath>,\n): Promise<Document[]> {\n const documents: Document[] = [];\n for await (const pdf of loader) {\n documents.push(pdfToDocument(pdf));\n }\n return documents;\n}\n\nexport function pdfPageToDocument(page: PdfPageWithPath): Document {\n return {\n id: `${page.path}#page=${page.pageNumber}`,\n text: page.text,\n additionalProps: {\n source: page.path,\n mediaType: \"application/pdf\",\n pageNumber: String(page.pageNumber),\n },\n };\n}\n\nexport async function pdfPageLoaderToDocuments(\n loader: AsyncIterable<PdfPageWithPath>,\n): Promise<Document[]> {\n const documents: Document[] = [];\n for await (const page of loader) {\n documents.push(pdfPageToDocument(page));\n }\n return documents;\n}\n\ntype LoaderValue<T> = T extends { ok: true; value: infer Value } ? Value : never;\ntype UnwrapLoaderResult<T> = [LoaderValue<T>] extends [never] ? T : LoaderValue<T>;\n\nfunction ok<T>(value: T): LoaderResult<T> {\n return { ok: true, value };\n}\n\nfunction err(error: unknown): LoaderResult<never> {\n return { ok: false, error };\n}\n\nasync function sortedGlob(pattern: string): Promise<string[]> {\n return (await glob(pattern, { absolute: isAbsolute(pattern), onlyFiles: true })).sort(\n (left, right) => left.localeCompare(right),\n );\n}\n\nasync function mapFileResult(\n item: LoaderResult<FileSource>,\n mode: FileMode,\n): Promise<LoaderResult<FileSource | string | FileReadWithPath>> {\n if (!item.ok) {\n return item;\n }\n if (mode === \"source\") {\n return item;\n }\n try {\n const text = await readFileSource(item.value);\n return mode === \"read\" ? ok(text) : ok({ path: item.value.path, text });\n } catch (error) {\n return err(error);\n }\n}\n\nasync function mapPdfResult(\n item: LoaderResult<PdfSource>,\n mode: PdfMode,\n): Promise<Array<LoaderResult<PdfSource | string | PdfReadWithPath | PdfPage | PdfPageWithPath>>> {\n if (!item.ok) {\n return [item];\n }\n if (mode === \"source\") {\n return [item];\n }\n try {\n const pages = await readPdfPages(item.value);\n if (mode === \"read\") {\n return [ok(pages.map((page) => page.text).join(\"\"))];\n }\n if (mode === \"readWithPath\") {\n return [ok({ path: item.value.path, text: pages.map((page) => page.text).join(\"\") })];\n }\n if (mode === \"byPageWithPath\") {\n return pages.map((page) => ok({ path: item.value.path, ...page }));\n }\n return pages.map(ok);\n } catch (error) {\n return [err(error)];\n }\n}\n\nasync function readFileSource(source: FileSource): Promise<string> {\n if (\"bytes\" in source) {\n return new TextDecoder().decode(source.bytes);\n }\n return readFile(source.path, \"utf8\");\n}\n\nasync function readPdfPages(source: PdfSource): Promise<PdfPage[]> {\n const pdfjs = await import(\"pdfjs-dist/legacy/build/pdf.mjs\");\n const bytes = \"bytes\" in source ? source.bytes : toUint8Array(await readFile(source.path));\n const document = await pdfjs.getDocument({ data: bytes }).promise;\n const pages: PdfPage[] = [];\n try {\n for (let index = 1; index <= document.numPages; index += 1) {\n const page = await document.getPage(index);\n const content = await page.getTextContent();\n const text = content.items\n .flatMap((item) =>\n typeof item === \"object\" && item !== null && \"str\" in item ? [String(item.str)] : [],\n )\n .join(\"\\n\");\n pages.push({ pageNumber: index - 1, text: text.length > 0 ? `${text}\\n` : \"\" });\n }\n } finally {\n await document.destroy();\n }\n return pages;\n}\n\nfunction toUint8Array(bytes: Uint8Array | ArrayBuffer): Uint8Array {\n if (bytes instanceof Uint8Array) {\n return new Uint8Array(\n bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength),\n );\n }\n return new Uint8Array(bytes);\n}\n"],"mappings":";AAAA,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY,YAAY;AACjC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MAAM,MAAM,YAAY,EAAE,MAAM,MAAM,CAAC,EAAE;AAC1D,QAAM,QAAmB,CAAC;AAC1B,MAAI;AACF,aAAS,QAAQ,GAAG,SAAS,SAAS,UAAU,SAAS,GAAG;AAC1D,YAAM,OAAO,MAAM,SAAS,QAAQ,KAAK;AACzC,YAAM,UAAU,MAAM,KAAK,eAAe;AAC1C,YAAM,OAAO,QAAQ,MAClB;AAAA,QAAQ,CAAC,SACR,OAAO,SAAS,YAAY,SAAS,QAAQ,SAAS,OAAO,CAAC,OAAO,KAAK,GAAG,CAAC,IAAI,CAAC;AAAA,MACrF,EACC,KAAK,IAAI;AACZ,YAAM,KAAK,EAAE,YAAY,QAAQ,GAAG,MAAM,KAAK,SAAS,IAAI,GAAG,IAAI;AAAA,IAAO,GAAG,CAAC;AAAA,IAChF;AAAA,EACF,UAAE;AACA,UAAM,SAAS,QAAQ;AAAA,EACzB;AACA,SAAO;AACT;AAEA,SAAS,aAAa,OAA6C;AACjE,MAAI,iBAAiB,YAAY;AAC/B,WAAO,IAAI;AAAA,MACT,MAAM,OAAO,MAAM,MAAM,YAAY,MAAM,aAAa,MAAM,UAAU;AAAA,IAC1E;AAAA,EACF;AACA,SAAO,IAAI,WAAW,KAAK;AAC7B;","names":[]}
@@ -0,0 +1,15 @@
1
+ import { a as McpConnection, c as McpServer, d as McpStdioOptions, b as McpHttpOptions } from '../types-B5B8Sdl4.js';
2
+ export { M as McpClient, e as McpToolCallContent, f as McpToolCallResult, g as McpToolDefinition } from '../types-B5B8Sdl4.js';
3
+ import '@modelcontextprotocol/sdk/client/stdio.js';
4
+ import '@modelcontextprotocol/sdk/client/streamableHttp.js';
5
+ import '../types-BrxLd7ay.js';
6
+ import '../tool-DhuBQ3yb.js';
7
+
8
+ declare function connectMcp(connection: McpConnection): Promise<McpServer>;
9
+
10
+ declare const mcp: {
11
+ stdio(options: McpStdioOptions): McpConnection;
12
+ http(options: McpHttpOptions): McpConnection;
13
+ };
14
+
15
+ export { McpConnection, McpHttpOptions, McpServer, McpStdioOptions, connectMcp, mcp };
@@ -0,0 +1,9 @@
1
+ import {
2
+ connectMcp,
3
+ mcp
4
+ } from "../chunk-WZTPK5HV.js";
5
+ export {
6
+ connectMcp,
7
+ mcp
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,93 @@
1
+ import { M as Message, d as CompletionRequest, e as CompletionResponse, n as ToolCall, U as Usage } from '../types-BrxLd7ay.js';
2
+
3
+ type AgentTraceInfo = {
4
+ traceId?: string | undefined;
5
+ observationId?: string | undefined;
6
+ };
7
+ type AgentTraceOptions = {
8
+ name?: string | undefined;
9
+ userId?: string | undefined;
10
+ sessionId?: string | undefined;
11
+ metadata?: Record<string, unknown> | undefined;
12
+ tags?: string[] | undefined;
13
+ version?: string | undefined;
14
+ traceId?: string | undefined;
15
+ failOnObserverError?: boolean | undefined;
16
+ };
17
+ type AgentRunStartArgs = {
18
+ agentName?: string | undefined;
19
+ agentDescription?: string | undefined;
20
+ instructions?: string | undefined;
21
+ trace?: AgentTraceOptions | undefined;
22
+ prompt: Message;
23
+ history: Message[];
24
+ maxTurns: number;
25
+ };
26
+ type AgentRunEndArgs = {
27
+ output: string;
28
+ usage: Usage;
29
+ messages: Message[];
30
+ };
31
+ type AgentRunErrorArgs = {
32
+ error: unknown;
33
+ usage: Usage;
34
+ messages: Message[];
35
+ };
36
+ type AgentGenerationStartArgs = {
37
+ turn: number;
38
+ request: CompletionRequest;
39
+ };
40
+ type AgentGenerationEndArgs<RawResponse = unknown> = {
41
+ turn: number;
42
+ response: CompletionResponse<RawResponse>;
43
+ firstDeltaMs?: number | undefined;
44
+ };
45
+ type AgentGenerationErrorArgs = {
46
+ turn: number;
47
+ error: unknown;
48
+ };
49
+ type AgentToolStartArgs = {
50
+ turn: number;
51
+ toolCall: ToolCall;
52
+ toolName: string;
53
+ args: string;
54
+ internalCallId: string;
55
+ toolCallId?: string | undefined;
56
+ };
57
+ type AgentToolEndArgs = AgentToolStartArgs & {
58
+ result: string;
59
+ skipped: boolean;
60
+ };
61
+ type AgentToolErrorArgs = AgentToolStartArgs & {
62
+ error: unknown;
63
+ };
64
+ interface AgentGenerationObserver {
65
+ end(args: AgentGenerationEndArgs): void | Promise<void>;
66
+ error?(args: AgentGenerationErrorArgs): void | Promise<void>;
67
+ }
68
+ interface AgentToolObserver {
69
+ end(args: AgentToolEndArgs): void | Promise<void>;
70
+ error?(args: AgentToolErrorArgs): void | Promise<void>;
71
+ }
72
+ interface AgentRunObserver {
73
+ readonly trace?: AgentTraceInfo | undefined;
74
+ startGeneration?(args: AgentGenerationStartArgs): AgentGenerationObserver | undefined | Promise<AgentGenerationObserver | undefined>;
75
+ startTool?(args: AgentToolStartArgs): AgentToolObserver | undefined | Promise<AgentToolObserver | undefined>;
76
+ end(args: AgentRunEndArgs): void | Promise<void>;
77
+ error?(args: AgentRunErrorArgs): void | Promise<void>;
78
+ }
79
+ interface AgentObserver {
80
+ startRun(args: AgentRunStartArgs): AgentRunObserver | undefined | Promise<AgentRunObserver | undefined>;
81
+ flush?(): void | Promise<void>;
82
+ shutdown?(): void | Promise<void>;
83
+ }
84
+ type AgentObserverRegistration = {
85
+ observer: AgentObserver;
86
+ failOnObserverError?: boolean | undefined;
87
+ };
88
+ type ObserveOptions = {
89
+ failOnObserverError?: boolean | undefined;
90
+ };
91
+ declare function createObserver(observer: AgentObserver): AgentObserver;
92
+
93
+ export { type AgentGenerationEndArgs, type AgentGenerationErrorArgs, type AgentGenerationObserver, type AgentGenerationStartArgs, type AgentObserver, type AgentObserverRegistration, type AgentRunEndArgs, type AgentRunErrorArgs, type AgentRunObserver, type AgentRunStartArgs, type AgentToolEndArgs, type AgentToolErrorArgs, type AgentToolObserver, type AgentToolStartArgs, type AgentTraceInfo, type AgentTraceOptions, type ObserveOptions, createObserver };
@@ -0,0 +1,7 @@
1
+ import {
2
+ createObserver
3
+ } from "../chunk-S55WOHX5.js";
4
+ export {
5
+ createObserver
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,51 @@
1
+ import { A as Agent } from '../agent-C6h6YrRU.js';
2
+ import { b as CompletionModel } from '../types-BrxLd7ay.js';
3
+ import { Extractor } from '../extractor/index.js';
4
+ import '../observability/index.js';
5
+ import '../zod-schema-DJTEgQBq.js';
6
+ import '../embeddings/index.js';
7
+ import '../vector-store/index.js';
8
+ import '../tool-DhuBQ3yb.js';
9
+ import 'zod';
10
+
11
+ /** Minimal interface for anything that can run as a pipeline stage. */
12
+ interface PipelineOp<Input = unknown, Output = unknown> {
13
+ run(input: Input): Output | Promise<Output>;
14
+ }
15
+ interface PipelineBatchOptions {
16
+ /** Maximum number of inputs processed at the same time. */
17
+ concurrency: number;
18
+ }
19
+ type AwaitedOutput<Op> = Op extends PipelineOp<unknown, infer Output> ? Awaited<Output> : never;
20
+ type ParallelOutput<Branches extends Record<string, PipelineOp<unknown, unknown>>> = {
21
+ [Key in keyof Branches]: AwaitedOutput<Branches[Key]>;
22
+ };
23
+ /** Runnable pipeline returned by `PipelineBuilder.build()`. */
24
+ declare class Pipeline<Input, Output> implements PipelineOp<Input, Awaited<Output>> {
25
+ private readonly executor;
26
+ constructor(executor: (input: Input) => Output | Promise<Output>);
27
+ /** Run one input through the built pipeline and return the final stage output. */
28
+ run(input: Input): Promise<Awaited<Output>>;
29
+ /** Run many inputs through the same pipeline with bounded concurrency. */
30
+ batch<I extends Iterable<Input>>(inputs: I, options: PipelineBatchOptions): Promise<Array<Awaited<Output>>>;
31
+ }
32
+ /** Builds a typed pipeline from an original input type to an inferred output type. */
33
+ declare class PipelineBuilder<Input, Output = Input> {
34
+ private readonly executor;
35
+ constructor(executor?: (input: Input) => Output | Promise<Output>);
36
+ /** Add a synchronous or asynchronous transform stage. */
37
+ step<Next>(fn: (input: Awaited<Output>) => Next | Promise<Next>): PipelineBuilder<Input, Awaited<Next>>;
38
+ /** Compose another pipeline operation after the current stage. */
39
+ use<Next>(op: PipelineOp<Awaited<Output>, Next>): PipelineBuilder<Input, Awaited<Next>>;
40
+ /** Run named branch operations concurrently from the current value. */
41
+ parallel<Branches extends Record<string, PipelineOp<Awaited<Output>, unknown>>>(branches: Branches): PipelineBuilder<Input, ParallelOutput<Branches>>;
42
+ /** Send the current value to an agent as text and continue with the agent output. */
43
+ prompt(agent: Agent<CompletionModel>): PipelineBuilder<Input, string>;
44
+ /** Send the current value to an extractor as text and continue with typed schema data. */
45
+ extract<T>(extractor: Extractor<T, CompletionModel>): PipelineBuilder<Input, T>;
46
+ /** Finish the builder and return a runnable pipeline. */
47
+ build(): Pipeline<Input, Awaited<Output>>;
48
+ private runStep;
49
+ }
50
+
51
+ export { Pipeline, type PipelineBatchOptions, PipelineBuilder, type PipelineOp };
@@ -0,0 +1,9 @@
1
+ import {
2
+ Pipeline,
3
+ PipelineBuilder
4
+ } from "../chunk-FI2BTRT5.js";
5
+ export {
6
+ Pipeline,
7
+ PipelineBuilder
8
+ };
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,12 @@
1
+ import { a as SkillLoader, b as SkillSet } from '../types-HvopERm0.js';
2
+ export { S as Skill, c as SkillValidationError, d as SkillValidationIssue } from '../types-HvopERm0.js';
3
+ import '../tool-DhuBQ3yb.js';
4
+ import '../types-BrxLd7ay.js';
5
+
6
+ declare function loadSkills(loaders: SkillLoader | SkillLoader[]): Promise<SkillSet>;
7
+
8
+ declare const skill: {
9
+ local(path: string): SkillLoader;
10
+ };
11
+
12
+ export { SkillLoader, SkillSet, loadSkills, skill };
@@ -0,0 +1,16 @@
1
+ import {
2
+ SkillValidationError,
3
+ loadSkills,
4
+ skill
5
+ } from "../chunk-KSIY7KJA.js";
6
+ import "../chunk-X6FBOU2P.js";
7
+ import "../chunk-SRGJPXKT.js";
8
+ import "../chunk-GNWMOSNR.js";
9
+ import "../chunk-B4QHQN5K.js";
10
+ import "../chunk-A7VDIZQN.js";
11
+ export {
12
+ SkillValidationError,
13
+ loadSkills,
14
+ skill
15
+ };
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,6 @@
1
+ type ReadableStreamOptions = {
2
+ format?: "jsonl";
3
+ };
4
+ declare function toReadableStream<T>(events: AsyncIterable<T>, _options?: ReadableStreamOptions): ReadableStream<Uint8Array>;
5
+
6
+ export { type ReadableStreamOptions, toReadableStream };
@@ -0,0 +1,7 @@
1
+ import {
2
+ toReadableStream
3
+ } from "../chunk-XUUY2L2D.js";
4
+ export {
5
+ toReadableStream
6
+ };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,42 @@
1
+ import { z } from 'zod';
2
+ import { Z as ZodSchema } from '../zod-schema-DJTEgQBq.js';
3
+ export { D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolSearchDocument, a as ToolSet, c as createToolIndex, e as embedTools, i as isDynamicToolIndex } from '../zod-schema-DJTEgQBq.js';
4
+ import { b as ToolApprovalPolicy, T as Tool } from '../tool-DhuBQ3yb.js';
5
+ export { A as AnyTool, a as ToolApprovalContext, c as ToolApprovalRunContext, p as parseToolArgs, s as serializeToolOutput } from '../tool-DhuBQ3yb.js';
6
+ import '../types-BrxLd7ay.js';
7
+ import '../embeddings/index.js';
8
+ import '../vector-store/index.js';
9
+
10
+ type CreateToolOptions<InputSchema extends ZodSchema, OutputSchema extends ZodSchema | undefined = undefined> = {
11
+ name: string;
12
+ description: string;
13
+ input: InputSchema;
14
+ output?: OutputSchema;
15
+ approval?: ToolApprovalPolicy<z.output<InputSchema>>;
16
+ execute(args: z.output<InputSchema>): OutputSchema extends ZodSchema ? z.input<OutputSchema> | Promise<z.input<OutputSchema>> : unknown | Promise<unknown>;
17
+ };
18
+ type ToolOutput<OutputSchema extends ZodSchema | undefined> = OutputSchema extends ZodSchema ? z.output<OutputSchema> : unknown;
19
+ declare function createTool<InputSchema extends ZodSchema, OutputSchema extends ZodSchema | undefined = undefined>(options: CreateToolOptions<InputSchema, OutputSchema>): Tool<z.output<InputSchema>, ToolOutput<OutputSchema>>;
20
+
21
+ declare class ToolCallError extends Error {
22
+ readonly cause?: unknown | undefined;
23
+ constructor(message: string, cause?: unknown | undefined);
24
+ }
25
+ declare class ToolNotFoundError extends Error {
26
+ readonly toolName: string;
27
+ constructor(toolName: string);
28
+ }
29
+ declare class ToolJsonError extends Error {
30
+ readonly cause?: unknown | undefined;
31
+ constructor(message: string, cause?: unknown | undefined);
32
+ }
33
+
34
+ type CreateThinkToolOptions = {
35
+ name?: string;
36
+ description?: string;
37
+ };
38
+ declare function createThinkTool(options?: CreateThinkToolOptions): Tool<{
39
+ thought: string;
40
+ }, string>;
41
+
42
+ export { type CreateThinkToolOptions, type CreateToolOptions, Tool, ToolApprovalPolicy, ToolCallError, ToolJsonError, ToolNotFoundError, createThinkTool, createTool };
@@ -0,0 +1,33 @@
1
+ import {
2
+ createThinkTool,
3
+ createToolIndex,
4
+ embedTools,
5
+ isDynamicToolIndex
6
+ } from "../chunk-X6FBOU2P.js";
7
+ import "../chunk-SRGJPXKT.js";
8
+ import {
9
+ ToolCallError,
10
+ ToolJsonError,
11
+ ToolNotFoundError,
12
+ ToolSet,
13
+ parseToolArgs,
14
+ serializeToolOutput
15
+ } from "../chunk-GNWMOSNR.js";
16
+ import {
17
+ createTool
18
+ } from "../chunk-B4QHQN5K.js";
19
+ import "../chunk-A7VDIZQN.js";
20
+ export {
21
+ ToolCallError,
22
+ ToolJsonError,
23
+ ToolNotFoundError,
24
+ ToolSet,
25
+ createThinkTool,
26
+ createTool,
27
+ createToolIndex,
28
+ embedTools,
29
+ isDynamicToolIndex,
30
+ parseToolArgs,
31
+ serializeToolOutput
32
+ };
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}