@anvia/core 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/index.d.ts +5 -13
- package/dist/agent/index.js +6 -6
- package/dist/{agent-CBz3CRxa.d.ts → agent-Q7FT1xmG.d.ts} +2 -22
- package/dist/{chunk-3YJXLOGO.js → chunk-47UWISJU.js} +4 -4
- package/dist/{chunk-I7TM7TKX.js → chunk-4BGN6PYF.js} +2 -2
- package/dist/{chunk-QABIBFKE.js → chunk-6GIREB6Z.js} +5 -10
- package/dist/chunk-6GIREB6Z.js.map +1 -0
- package/dist/{chunk-DC2GJDPR.js → chunk-BCA4VZ5W.js} +2 -2
- package/dist/{chunk-DPTZ2MK4.js → chunk-EOIQXFGK.js} +3 -15
- package/dist/chunk-EOIQXFGK.js.map +1 -0
- package/dist/{chunk-7LCKIULT.js → chunk-GKPJ6FUL.js} +2 -30
- package/dist/chunk-GKPJ6FUL.js.map +1 -0
- package/dist/{chunk-JNJBKSLA.js → chunk-MB55EXYB.js} +3 -7
- package/dist/{chunk-JNJBKSLA.js.map → chunk-MB55EXYB.js.map} +1 -1
- package/dist/{chunk-YBBD4HZ3.js → chunk-MNWK2USR.js} +119 -15
- package/dist/chunk-MNWK2USR.js.map +1 -0
- package/dist/embeddings/index.d.ts +6 -3
- package/dist/embeddings/index.js +7 -1
- package/dist/evals/index.d.ts +4 -4
- package/dist/evals/index.js +7 -7
- package/dist/extractor/index.d.ts +4 -4
- package/dist/extractor/index.js +7 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -10
- package/dist/internal/agent.d.ts +4 -4
- package/dist/internal/agent.js +5 -5
- package/dist/{middleware-Cp0tm6zE.d.ts → middleware-DfMc30in.d.ts} +3 -15
- package/dist/pipeline/index.d.ts +4 -4
- package/dist/request/index.d.ts +4 -4
- package/dist/request/index.js +4 -4
- package/dist/skills/index.js +4 -4
- package/dist/tool/index.d.ts +3 -3
- package/dist/tool/index.js +3 -5
- package/dist/types-BCTRUGex.d.ts +47 -0
- package/dist/{types-DMGvEFRf.d.ts → types-BrxxAtcJ.d.ts} +1 -1
- package/dist/vector-store/index.d.ts +3 -3
- package/dist/vector-store/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7LCKIULT.js.map +0 -1
- package/dist/chunk-DPTZ2MK4.js.map +0 -1
- package/dist/chunk-QABIBFKE.js.map +0 -1
- package/dist/chunk-YBBD4HZ3.js.map +0 -1
- package/dist/types-DHHZztGO.d.ts +0 -25
- /package/dist/{chunk-3YJXLOGO.js.map → chunk-47UWISJU.js.map} +0 -0
- /package/dist/{chunk-I7TM7TKX.js.map → chunk-4BGN6PYF.js.map} +0 -0
- /package/dist/{chunk-DC2GJDPR.js.map → chunk-BCA4VZ5W.js.map} +0 -0
|
@@ -73,17 +73,29 @@ async function embedTexts(model, texts) {
|
|
|
73
73
|
}
|
|
74
74
|
return embeddings;
|
|
75
75
|
}
|
|
76
|
+
async function embedSparseTexts(model, texts) {
|
|
77
|
+
if (texts.length === 0) {
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
const maxBatchSize = Math.max(1, Math.trunc(model.maxBatchSize ?? texts.length));
|
|
81
|
+
const batches = [];
|
|
82
|
+
for (let index = 0; index < texts.length; index += maxBatchSize) {
|
|
83
|
+
batches.push(texts.slice(index, index + maxBatchSize));
|
|
84
|
+
}
|
|
85
|
+
const results = await mapWithConcurrency(batches, 1, (batch) => model.embedTexts(batch));
|
|
86
|
+
const embeddings = results.flat();
|
|
87
|
+
if (embeddings.length !== texts.length) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`Sparse embedding model returned ${embeddings.length} embeddings for ${texts.length} texts`
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
return embeddings;
|
|
93
|
+
}
|
|
94
|
+
async function embedSparseQuery(model, query) {
|
|
95
|
+
return model.embedQuery(query);
|
|
96
|
+
}
|
|
76
97
|
async function embedDocuments(model, documents, options) {
|
|
77
|
-
const prepared = documents
|
|
78
|
-
const content = options.content(document, index);
|
|
79
|
-
const texts = Array.isArray(content) ? content : [content];
|
|
80
|
-
return {
|
|
81
|
-
id: options.id?.(document, index) ?? `doc${index}`,
|
|
82
|
-
document,
|
|
83
|
-
metadata: options.metadata?.(document, index),
|
|
84
|
-
texts
|
|
85
|
-
};
|
|
86
|
-
});
|
|
98
|
+
const prepared = prepareDocuments(documents, options);
|
|
87
99
|
const flatTexts = prepared.flatMap(
|
|
88
100
|
(item, documentIndex) => item.texts.map((text) => ({ documentIndex, text }))
|
|
89
101
|
);
|
|
@@ -110,11 +122,100 @@ async function embedDocuments(model, documents, options) {
|
|
|
110
122
|
byDocument.set(item.documentIndex, list);
|
|
111
123
|
}
|
|
112
124
|
return prepared.map((item, index) => {
|
|
113
|
-
const
|
|
125
|
+
const documentEmbeddings = byDocument.get(index) ?? [];
|
|
126
|
+
if (item.metadata === void 0) {
|
|
127
|
+
return { id: item.id, document: item.document, embeddings: documentEmbeddings };
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
id: item.id,
|
|
131
|
+
document: item.document,
|
|
132
|
+
metadata: item.metadata,
|
|
133
|
+
embeddings: documentEmbeddings
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
async function embedHybridDocuments(models, documents, options) {
|
|
138
|
+
const prepared = prepareDocuments(documents, options);
|
|
139
|
+
const flatTexts = prepared.flatMap(
|
|
140
|
+
(item, documentIndex) => item.texts.map((text) => ({ documentIndex, text }))
|
|
141
|
+
);
|
|
142
|
+
const concurrency = Math.max(1, Math.trunc(options.concurrency ?? 1));
|
|
143
|
+
const denseBatches = chunk(
|
|
144
|
+
flatTexts,
|
|
145
|
+
Math.max(1, Math.trunc(models.dense.maxBatchSize ?? (flatTexts.length || 1)))
|
|
146
|
+
);
|
|
147
|
+
const sparseBatches = chunk(
|
|
148
|
+
flatTexts,
|
|
149
|
+
Math.max(1, Math.trunc(models.sparse.maxBatchSize ?? (flatTexts.length || 1)))
|
|
150
|
+
);
|
|
151
|
+
const [denseResults, sparseResults] = await Promise.all([
|
|
152
|
+
mapWithConcurrency(denseBatches, concurrency, async (batch) => {
|
|
153
|
+
const batchEmbeddings = await models.dense.embedTexts(batch.map((item) => item.text));
|
|
154
|
+
if (batchEmbeddings.length !== batch.length) {
|
|
155
|
+
throw new Error(
|
|
156
|
+
`Embedding model returned ${batchEmbeddings.length} embeddings for ${batch.length} texts`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
return batch.map((item, index) => ({
|
|
160
|
+
documentIndex: item.documentIndex,
|
|
161
|
+
embedding: batchEmbeddings[index]
|
|
162
|
+
}));
|
|
163
|
+
}),
|
|
164
|
+
mapWithConcurrency(sparseBatches, concurrency, async (batch) => {
|
|
165
|
+
const batchEmbeddings = await models.sparse.embedTexts(batch.map((item) => item.text));
|
|
166
|
+
if (batchEmbeddings.length !== batch.length) {
|
|
167
|
+
throw new Error(
|
|
168
|
+
`Sparse embedding model returned ${batchEmbeddings.length} embeddings for ${batch.length} texts`
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
return batch.map((item, index) => ({
|
|
172
|
+
documentIndex: item.documentIndex,
|
|
173
|
+
embedding: batchEmbeddings[index]
|
|
174
|
+
}));
|
|
175
|
+
})
|
|
176
|
+
]);
|
|
177
|
+
const denseByDocument = /* @__PURE__ */ new Map();
|
|
178
|
+
for (const item of denseResults.flat()) {
|
|
179
|
+
const list = denseByDocument.get(item.documentIndex) ?? [];
|
|
180
|
+
list.push(item.embedding);
|
|
181
|
+
denseByDocument.set(item.documentIndex, list);
|
|
182
|
+
}
|
|
183
|
+
const sparseByDocument = /* @__PURE__ */ new Map();
|
|
184
|
+
for (const item of sparseResults.flat()) {
|
|
185
|
+
const list = sparseByDocument.get(item.documentIndex) ?? [];
|
|
186
|
+
list.push(item.embedding);
|
|
187
|
+
sparseByDocument.set(item.documentIndex, list);
|
|
188
|
+
}
|
|
189
|
+
return prepared.map((item, index) => {
|
|
190
|
+
const embeddings = denseByDocument.get(index) ?? [];
|
|
191
|
+
const sparseEmbeddings = sparseByDocument.get(index) ?? [];
|
|
192
|
+
if (embeddings.length !== sparseEmbeddings.length) {
|
|
193
|
+
throw new Error(
|
|
194
|
+
`Hybrid embedding produced ${embeddings.length} dense and ${sparseEmbeddings.length} sparse vectors for document ${item.id}`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
114
197
|
if (item.metadata === void 0) {
|
|
115
|
-
return { id: item.id, document: item.document, embeddings
|
|
198
|
+
return { id: item.id, document: item.document, embeddings, sparseEmbeddings };
|
|
116
199
|
}
|
|
117
|
-
return {
|
|
200
|
+
return {
|
|
201
|
+
id: item.id,
|
|
202
|
+
document: item.document,
|
|
203
|
+
metadata: item.metadata,
|
|
204
|
+
embeddings,
|
|
205
|
+
sparseEmbeddings
|
|
206
|
+
};
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
function prepareDocuments(documents, options) {
|
|
210
|
+
return documents.map((document, index) => {
|
|
211
|
+
const content = options.content(document, index);
|
|
212
|
+
const texts = Array.isArray(content) ? content : [content];
|
|
213
|
+
return {
|
|
214
|
+
id: options.id?.(document, index) ?? `doc${index}`,
|
|
215
|
+
document,
|
|
216
|
+
metadata: options.metadata?.(document, index),
|
|
217
|
+
texts
|
|
218
|
+
};
|
|
118
219
|
});
|
|
119
220
|
}
|
|
120
221
|
function chunk(items, size) {
|
|
@@ -134,6 +235,9 @@ export {
|
|
|
134
235
|
chebyshevDistance,
|
|
135
236
|
embedText,
|
|
136
237
|
embedTexts,
|
|
137
|
-
|
|
238
|
+
embedSparseTexts,
|
|
239
|
+
embedSparseQuery,
|
|
240
|
+
embedDocuments,
|
|
241
|
+
embedHybridDocuments
|
|
138
242
|
};
|
|
139
|
-
//# sourceMappingURL=chunk-
|
|
243
|
+
//# sourceMappingURL=chunk-MNWK2USR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/embeddings/distance.ts","../src/embeddings/embed.ts"],"sourcesContent":["export function dotProduct(left: number[], right: number[]): number {\n assertSameDimensions(left, right);\n return left.reduce((sum, value, index) => sum + value * (right[index] as number), 0);\n}\n\nexport function cosineSimilarity(left: number[], right: number[]): number {\n assertSameDimensions(left, right);\n const leftMagnitude = magnitude(left);\n const rightMagnitude = magnitude(right);\n if (leftMagnitude === 0 || rightMagnitude === 0) {\n return 0;\n }\n return dotProduct(left, right) / (leftMagnitude * rightMagnitude);\n}\n\nexport function angularDistance(left: number[], right: number[]): number {\n const similarity = Math.max(-1, Math.min(1, cosineSimilarity(left, right)));\n return Math.acos(similarity) / Math.PI;\n}\n\nexport function euclideanDistance(left: number[], right: number[]): number {\n assertSameDimensions(left, right);\n return Math.sqrt(\n left.reduce((sum, value, index) => sum + (value - (right[index] as number)) ** 2, 0),\n );\n}\n\nexport function manhattanDistance(left: number[], right: number[]): number {\n assertSameDimensions(left, right);\n return left.reduce((sum, value, index) => sum + Math.abs(value - (right[index] as number)), 0);\n}\n\nexport function chebyshevDistance(left: number[], right: number[]): number {\n assertSameDimensions(left, right);\n return left.reduce(\n (max, value, index) => Math.max(max, Math.abs(value - (right[index] as number))),\n 0,\n );\n}\n\nfunction magnitude(vector: number[]): number {\n return Math.sqrt(vector.reduce((sum, value) => sum + value ** 2, 0));\n}\n\nfunction assertSameDimensions(left: number[], right: number[]): void {\n if (left.length !== right.length) {\n throw new Error(`Vector dimension mismatch: ${left.length} !== ${right.length}`);\n }\n}\n","import { mapWithConcurrency } from \"../internal/concurrency\";\nimport type {\n EmbedDocumentsOptions,\n EmbeddedDocument,\n Embedding,\n EmbeddingModel,\n EmbedHybridDocumentsOptions,\n SparseEmbedding,\n SparseEmbeddingModel,\n VectorMetadata,\n} from \"./types\";\n\nexport async function embedText(model: EmbeddingModel, text: string): Promise<Embedding> {\n const embeddings = await embedTexts(model, [text]);\n const embedding = embeddings[0];\n if (embedding === undefined) {\n throw new Error(\"Embedding model returned no embeddings\");\n }\n return embedding;\n}\n\nexport async function embedTexts(model: EmbeddingModel, texts: string[]): Promise<Embedding[]> {\n if (texts.length === 0) {\n return [];\n }\n\n const maxBatchSize = Math.max(1, Math.trunc(model.maxBatchSize ?? texts.length));\n const batches: string[][] = [];\n for (let index = 0; index < texts.length; index += maxBatchSize) {\n batches.push(texts.slice(index, index + maxBatchSize));\n }\n\n const results = await mapWithConcurrency(batches, 1, (batch) => model.embedTexts(batch));\n const embeddings = results.flat();\n if (embeddings.length !== texts.length) {\n throw new Error(\n `Embedding model returned ${embeddings.length} embeddings for ${texts.length} texts`,\n );\n }\n return embeddings;\n}\n\nexport async function embedSparseTexts(\n model: SparseEmbeddingModel,\n texts: string[],\n): Promise<SparseEmbedding[]> {\n if (texts.length === 0) {\n return [];\n }\n\n const maxBatchSize = Math.max(1, Math.trunc(model.maxBatchSize ?? texts.length));\n const batches: string[][] = [];\n for (let index = 0; index < texts.length; index += maxBatchSize) {\n batches.push(texts.slice(index, index + maxBatchSize));\n }\n\n const results = await mapWithConcurrency(batches, 1, (batch) => model.embedTexts(batch));\n const embeddings = results.flat();\n if (embeddings.length !== texts.length) {\n throw new Error(\n `Sparse embedding model returned ${embeddings.length} embeddings for ${texts.length} texts`,\n );\n }\n return embeddings;\n}\n\nexport async function embedSparseQuery(\n model: SparseEmbeddingModel,\n query: string,\n): Promise<SparseEmbedding> {\n return model.embedQuery(query);\n}\n\nexport async function embedDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(\n model: EmbeddingModel,\n documents: T[],\n options: EmbedDocumentsOptions<T, Metadata>,\n): Promise<Array<EmbeddedDocument<T, Metadata>>> {\n const prepared = prepareDocuments(documents, options);\n\n const flatTexts = prepared.flatMap((item, documentIndex) =>\n item.texts.map((text) => ({ documentIndex, text })),\n );\n const embeddings = await mapWithConcurrency(\n chunk(flatTexts, Math.max(1, Math.trunc(model.maxBatchSize ?? (flatTexts.length || 1)))),\n Math.max(1, Math.trunc(options.concurrency ?? 1)),\n async (batch) => {\n const batchEmbeddings = await model.embedTexts(batch.map((item) => item.text));\n if (batchEmbeddings.length !== batch.length) {\n throw new Error(\n `Embedding model returned ${batchEmbeddings.length} embeddings for ${batch.length} texts`,\n );\n }\n return batch.map((item, index) => ({\n documentIndex: item.documentIndex,\n embedding: batchEmbeddings[index] as Embedding,\n }));\n },\n );\n\n const byDocument = new Map<number, Embedding[]>();\n for (const item of embeddings.flat()) {\n const list = byDocument.get(item.documentIndex) ?? [];\n list.push(item.embedding);\n byDocument.set(item.documentIndex, list);\n }\n\n return prepared.map((item, index) => {\n const documentEmbeddings = byDocument.get(index) ?? [];\n if (item.metadata === undefined) {\n return { id: item.id, document: item.document, embeddings: documentEmbeddings };\n }\n return {\n id: item.id,\n document: item.document,\n metadata: item.metadata,\n embeddings: documentEmbeddings,\n };\n });\n}\n\nexport async function embedHybridDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(\n models: EmbedHybridDocumentsOptions,\n documents: T[],\n options: EmbedDocumentsOptions<T, Metadata>,\n): Promise<Array<EmbeddedDocument<T, Metadata>>> {\n const prepared = prepareDocuments(documents, options);\n const flatTexts = prepared.flatMap((item, documentIndex) =>\n item.texts.map((text) => ({ documentIndex, text })),\n );\n const concurrency = Math.max(1, Math.trunc(options.concurrency ?? 1));\n\n const denseBatches = chunk(\n flatTexts,\n Math.max(1, Math.trunc(models.dense.maxBatchSize ?? (flatTexts.length || 1))),\n );\n const sparseBatches = chunk(\n flatTexts,\n Math.max(1, Math.trunc(models.sparse.maxBatchSize ?? (flatTexts.length || 1))),\n );\n\n const [denseResults, sparseResults] = await Promise.all([\n mapWithConcurrency(denseBatches, concurrency, async (batch) => {\n const batchEmbeddings = await models.dense.embedTexts(batch.map((item) => item.text));\n if (batchEmbeddings.length !== batch.length) {\n throw new Error(\n `Embedding model returned ${batchEmbeddings.length} embeddings for ${batch.length} texts`,\n );\n }\n return batch.map((item, index) => ({\n documentIndex: item.documentIndex,\n embedding: batchEmbeddings[index] as Embedding,\n }));\n }),\n mapWithConcurrency(sparseBatches, concurrency, async (batch) => {\n const batchEmbeddings = await models.sparse.embedTexts(batch.map((item) => item.text));\n if (batchEmbeddings.length !== batch.length) {\n throw new Error(\n `Sparse embedding model returned ${batchEmbeddings.length} embeddings for ${batch.length} texts`,\n );\n }\n return batch.map((item, index) => ({\n documentIndex: item.documentIndex,\n embedding: batchEmbeddings[index] as SparseEmbedding,\n }));\n }),\n ]);\n\n const denseByDocument = new Map<number, Embedding[]>();\n for (const item of denseResults.flat()) {\n const list = denseByDocument.get(item.documentIndex) ?? [];\n list.push(item.embedding);\n denseByDocument.set(item.documentIndex, list);\n }\n\n const sparseByDocument = new Map<number, SparseEmbedding[]>();\n for (const item of sparseResults.flat()) {\n const list = sparseByDocument.get(item.documentIndex) ?? [];\n list.push(item.embedding);\n sparseByDocument.set(item.documentIndex, list);\n }\n\n return prepared.map((item, index) => {\n const embeddings = denseByDocument.get(index) ?? [];\n const sparseEmbeddings = sparseByDocument.get(index) ?? [];\n if (embeddings.length !== sparseEmbeddings.length) {\n throw new Error(\n `Hybrid embedding produced ${embeddings.length} dense and ${sparseEmbeddings.length} sparse vectors for document ${item.id}`,\n );\n }\n if (item.metadata === undefined) {\n return { id: item.id, document: item.document, embeddings, sparseEmbeddings };\n }\n return {\n id: item.id,\n document: item.document,\n metadata: item.metadata,\n embeddings,\n sparseEmbeddings,\n };\n });\n}\n\nfunction prepareDocuments<T, Metadata extends VectorMetadata>(\n documents: T[],\n options: EmbedDocumentsOptions<T, Metadata>,\n) {\n return documents.map((document, index) => {\n const content = options.content(document, index);\n const texts = Array.isArray(content) ? content : [content];\n return {\n id: options.id?.(document, index) ?? `doc${index}`,\n document,\n metadata: options.metadata?.(document, index),\n texts,\n };\n });\n}\n\nfunction chunk<T>(items: T[], size: number): T[][] {\n const chunks: T[][] = [];\n for (let index = 0; index < items.length; index += size) {\n chunks.push(items.slice(index, index + size));\n }\n return chunks;\n}\n"],"mappings":";;;;;AAAO,SAAS,WAAW,MAAgB,OAA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AAA,QACR,6BAA6B,WAAW,MAAM,cAAc,iBAAiB,MAAM,gCAAgC,KAAK,EAAE;AAAA,MAC5H;AAAA,IACF;AACA,QAAI,KAAK,aAAa,QAAW;AAC/B,aAAO,EAAE,IAAI,KAAK,IAAI,UAAU,KAAK,UAAU,YAAY,iBAAiB;AAAA,IAC9E;AACA,WAAO;AAAA,MACL,IAAI,KAAK;AAAA,MACT,UAAU,KAAK;AAAA,MACf,UAAU,KAAK;AAAA,MACf;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,SAAS,iBACP,WACA,SACA;AACA,SAAO,UAAU,IAAI,CAAC,UAAU,UAAU;AACxC,UAAM,UAAU,QAAQ,QAAQ,UAAU,KAAK;AAC/C,UAAM,QAAQ,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AACzD,WAAO;AAAA,MACL,IAAI,QAAQ,KAAK,UAAU,KAAK,KAAK,MAAM,KAAK;AAAA,MAChD;AAAA,MACA,UAAU,QAAQ,WAAW,UAAU,KAAK;AAAA,MAC5C;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAEA,SAAS,MAAS,OAAY,MAAqB;AACjD,QAAM,SAAgB,CAAC;AACvB,WAAS,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,MAAM;AACvD,WAAO,KAAK,MAAM,MAAM,OAAO,QAAQ,IAAI,CAAC;AAAA,EAC9C;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VectorMetadata, E as EmbeddingModel, b as EmbedDocumentsOptions, c as EmbeddedDocument, d as Embedding } from '../types-
|
|
2
|
-
export { a as VectorMetadataValue } from '../types-
|
|
1
|
+
import { V as VectorMetadata, E as EmbeddingModel, b as EmbedDocumentsOptions, c as EmbeddedDocument, d as EmbedHybridDocumentsOptions, S as SparseEmbeddingModel, e as SparseEmbedding, f as Embedding } from '../types-BCTRUGex.js';
|
|
2
|
+
export { g as SparseVector, a as VectorMetadataValue } from '../types-BCTRUGex.js';
|
|
3
3
|
|
|
4
4
|
declare function dotProduct(left: number[], right: number[]): number;
|
|
5
5
|
declare function cosineSimilarity(left: number[], right: number[]): number;
|
|
@@ -10,6 +10,9 @@ declare function chebyshevDistance(left: number[], right: number[]): number;
|
|
|
10
10
|
|
|
11
11
|
declare function embedText(model: EmbeddingModel, text: string): Promise<Embedding>;
|
|
12
12
|
declare function embedTexts(model: EmbeddingModel, texts: string[]): Promise<Embedding[]>;
|
|
13
|
+
declare function embedSparseTexts(model: SparseEmbeddingModel, texts: string[]): Promise<SparseEmbedding[]>;
|
|
14
|
+
declare function embedSparseQuery(model: SparseEmbeddingModel, query: string): Promise<SparseEmbedding>;
|
|
13
15
|
declare function embedDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(model: EmbeddingModel, documents: T[], options: EmbedDocumentsOptions<T, Metadata>): Promise<Array<EmbeddedDocument<T, Metadata>>>;
|
|
16
|
+
declare function embedHybridDocuments<T, Metadata extends VectorMetadata = VectorMetadata>(models: EmbedHybridDocumentsOptions, documents: T[], options: EmbedDocumentsOptions<T, Metadata>): Promise<Array<EmbeddedDocument<T, Metadata>>>;
|
|
14
17
|
|
|
15
|
-
export { EmbedDocumentsOptions, EmbeddedDocument, Embedding, EmbeddingModel, VectorMetadata, angularDistance, chebyshevDistance, cosineSimilarity, dotProduct, embedDocuments, embedText, embedTexts, euclideanDistance, manhattanDistance };
|
|
18
|
+
export { EmbedDocumentsOptions, EmbedHybridDocumentsOptions, EmbeddedDocument, Embedding, EmbeddingModel, SparseEmbedding, SparseEmbeddingModel, VectorMetadata, angularDistance, chebyshevDistance, cosineSimilarity, dotProduct, embedDocuments, embedHybridDocuments, embedSparseQuery, embedSparseTexts, embedText, embedTexts, euclideanDistance, manhattanDistance };
|
package/dist/embeddings/index.js
CHANGED
|
@@ -4,11 +4,14 @@ import {
|
|
|
4
4
|
cosineSimilarity,
|
|
5
5
|
dotProduct,
|
|
6
6
|
embedDocuments,
|
|
7
|
+
embedHybridDocuments,
|
|
8
|
+
embedSparseQuery,
|
|
9
|
+
embedSparseTexts,
|
|
7
10
|
embedText,
|
|
8
11
|
embedTexts,
|
|
9
12
|
euclideanDistance,
|
|
10
13
|
manhattanDistance
|
|
11
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-MNWK2USR.js";
|
|
12
15
|
import "../chunk-OIMLU4SF.js";
|
|
13
16
|
export {
|
|
14
17
|
angularDistance,
|
|
@@ -16,6 +19,9 @@ export {
|
|
|
16
19
|
cosineSimilarity,
|
|
17
20
|
dotProduct,
|
|
18
21
|
embedDocuments,
|
|
22
|
+
embedHybridDocuments,
|
|
23
|
+
embedSparseQuery,
|
|
24
|
+
embedSparseTexts,
|
|
19
25
|
embedText,
|
|
20
26
|
embedTexts,
|
|
21
27
|
euclideanDistance,
|
package/dist/evals/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { A as Agent } from '../agent-
|
|
1
|
+
import { A as Agent } from '../agent-Q7FT1xmG.js';
|
|
2
2
|
import { i as JsonValue, M as Message, C as CompletionModel } from '../types-XjIh933x.js';
|
|
3
3
|
import { P as PromptResponse } from '../index-XTUEMWhU.js';
|
|
4
4
|
import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
|
|
5
|
-
import { E as EmbeddingModel } from '../types-
|
|
5
|
+
import { E as EmbeddingModel } from '../types-BCTRUGex.js';
|
|
6
6
|
import '../guardrails/index.js';
|
|
7
7
|
import '../types-BCA8p0sb.js';
|
|
8
8
|
import '../types-DBHzPsbx.js';
|
|
9
9
|
import '../tool-Dhwg__1L.js';
|
|
10
|
-
import '../middleware-
|
|
11
|
-
import '../types-
|
|
10
|
+
import '../middleware-DfMc30in.js';
|
|
11
|
+
import '../types-BrxxAtcJ.js';
|
|
12
12
|
import 'zod';
|
|
13
13
|
|
|
14
14
|
type EvalOutcome<Score = unknown> = {
|
package/dist/evals/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ExtractorBuilder
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-47UWISJU.js";
|
|
4
|
+
import "../chunk-EOIQXFGK.js";
|
|
5
|
+
import "../chunk-6GIREB6Z.js";
|
|
6
|
+
import "../chunk-GKPJ6FUL.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
8
|
import "../chunk-XUUY2L2D.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-MB55EXYB.js";
|
|
10
|
+
import "../chunk-4BGN6PYF.js";
|
|
11
11
|
import "../chunk-2ODTMRHP.js";
|
|
12
12
|
import "../chunk-ZNTIUOKL.js";
|
|
13
13
|
import "../chunk-TGLNXVII.js";
|
|
@@ -18,7 +18,7 @@ import "../chunk-WQKHFADH.js";
|
|
|
18
18
|
import {
|
|
19
19
|
cosineSimilarity,
|
|
20
20
|
embedText
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-MNWK2USR.js";
|
|
22
22
|
import {
|
|
23
23
|
mapWithConcurrency
|
|
24
24
|
} from "../chunk-OIMLU4SF.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as Agent } from '../agent-
|
|
1
|
+
import { A as Agent } from '../agent-Q7FT1xmG.js';
|
|
2
2
|
import { Z as ZodSchema } from '../zod-schema-C7F4clpm.js';
|
|
3
3
|
import { U as Usage, M as Message, C as CompletionModel, i as JsonValue, z as ToolChoice } from '../types-XjIh933x.js';
|
|
4
4
|
import '../guardrails/index.js';
|
|
@@ -6,9 +6,9 @@ import '../types-BCA8p0sb.js';
|
|
|
6
6
|
import '../types-DBHzPsbx.js';
|
|
7
7
|
import '../index-XTUEMWhU.js';
|
|
8
8
|
import '../tool-Dhwg__1L.js';
|
|
9
|
-
import '../middleware-
|
|
10
|
-
import '../types-
|
|
11
|
-
import '../types-
|
|
9
|
+
import '../middleware-DfMc30in.js';
|
|
10
|
+
import '../types-BCTRUGex.js';
|
|
11
|
+
import '../types-BrxxAtcJ.js';
|
|
12
12
|
import 'zod';
|
|
13
13
|
|
|
14
14
|
type ExtractionResponse<T> = {
|
package/dist/extractor/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
ExtractionError,
|
|
3
3
|
Extractor,
|
|
4
4
|
ExtractorBuilder
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-47UWISJU.js";
|
|
6
|
+
import "../chunk-EOIQXFGK.js";
|
|
7
|
+
import "../chunk-6GIREB6Z.js";
|
|
8
|
+
import "../chunk-GKPJ6FUL.js";
|
|
9
9
|
import "../chunk-YK4WAAS4.js";
|
|
10
10
|
import "../chunk-XUUY2L2D.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-MB55EXYB.js";
|
|
12
|
+
import "../chunk-4BGN6PYF.js";
|
|
13
13
|
import "../chunk-2ODTMRHP.js";
|
|
14
14
|
import "../chunk-ZNTIUOKL.js";
|
|
15
15
|
import "../chunk-TGLNXVII.js";
|
|
@@ -17,7 +17,7 @@ import "../chunk-MTGNA4OS.js";
|
|
|
17
17
|
import "../chunk-F56AMXMQ.js";
|
|
18
18
|
import "../chunk-PJDL5UT2.js";
|
|
19
19
|
import "../chunk-WQKHFADH.js";
|
|
20
|
-
import "../chunk-
|
|
20
|
+
import "../chunk-MNWK2USR.js";
|
|
21
21
|
import "../chunk-OIMLU4SF.js";
|
|
22
22
|
import "../chunk-CWUJUSOS.js";
|
|
23
23
|
export {
|
package/dist/index.d.ts
CHANGED
|
@@ -6,20 +6,20 @@ export { cancelPrompt, createHook, requestToolApproval, runControl, skipTool, to
|
|
|
6
6
|
export { M as MemoryCompactionConflictError, a as MemoryCompactionError, c as createSummaryMemoryCompactor, i as isMemoryCompactionSummary } from './errors-Bf661V89.js';
|
|
7
7
|
export { M as MemoryCompactionCommitInput, a as MemoryCompactionCommitResult, b as MemoryCompactionOptions, c as MemoryCompactionSnapshot, d as MemoryCompactionStore, e as MemoryCompactor, f as MemoryCompactorInput, g as MemoryCompactorResult, h as MemoryConversation, i as MemoryConversationListOptions, j as MemoryConversationMessage, k as MemoryConversationSummary, l as MemoryInspector, m as MemoryStore, R as ResolvedMemoryCompactionOptions, S as SummaryMemoryCompactorOptions } from './types-DBHzPsbx.js';
|
|
8
8
|
export { MaxTurnsError, PromptCancelledError, ToolApprovalRequiredError } from './request/index.js';
|
|
9
|
-
export { C as CompletionRetryContext, a as CompletionRetryOptions } from './agent-
|
|
9
|
+
export { C as CompletionRetryContext, a as CompletionRetryOptions } from './agent-Q7FT1xmG.js';
|
|
10
10
|
export { A as AgentChildStreamEvent, a as AgentChildStreamEventWithToolCallDeltas, b as AgentChildStreamEventWithoutToolCallDeltas, c as AgentErrorStreamEvent, d as AgentStreamEvent, e as AgentStreamEventWithToolCallDeltas, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, h as AgentToolCallDeltaEvent, P as PromptResponse } from './index-XTUEMWhU.js';
|
|
11
11
|
export { Z as ZodSchema } from './zod-schema-C7F4clpm.js';
|
|
12
12
|
export { loadSkills, skill } from './skills/index.js';
|
|
13
13
|
export { S as SkillValidationError } from './types-fBv8mhvP.js';
|
|
14
14
|
export { C as CreateToolOptions, c as createThinkTool, a as createTool } from './think-tool-CpCKo8Q8.js';
|
|
15
15
|
export { A as AnyTool, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent } from './tool-Dhwg__1L.js';
|
|
16
|
-
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as
|
|
16
|
+
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolOutputMiddlewareArgs, f as ToolOutputMiddlewareResult, g as ToolResultMiddlewareArgs, h as createMiddleware } from './middleware-DfMc30in.js';
|
|
17
17
|
export { CreateUIAttachment, UIAttachment, UIError, UIMessage, UIMessagePart, UIMessageRole, UIStreamEvent, UIStreamRequest, coreMessagesToUIMessages, uiMessagesToCoreMessages } from './ui/index.js';
|
|
18
18
|
import './types-BCA8p0sb.js';
|
|
19
19
|
import './types-BBEf34DP.js';
|
|
20
20
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
21
21
|
import '@modelcontextprotocol/sdk/client/stdio.js';
|
|
22
22
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
23
|
-
import './types-
|
|
24
|
-
import './types-
|
|
23
|
+
import './types-BrxxAtcJ.js';
|
|
24
|
+
import './types-BCTRUGex.js';
|
|
25
25
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SkillValidationError,
|
|
3
3
|
loadSkills,
|
|
4
4
|
skill
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BCA4VZ5W.js";
|
|
6
6
|
import {
|
|
7
7
|
coreMessagesToUIMessages,
|
|
8
8
|
uiMessagesToCoreMessages
|
|
@@ -11,23 +11,22 @@ import "./chunk-CQNNSZPG.js";
|
|
|
11
11
|
import "./chunk-XWUC7CIT.js";
|
|
12
12
|
import {
|
|
13
13
|
AgentBuilder
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-EOIQXFGK.js";
|
|
15
|
+
import "./chunk-6GIREB6Z.js";
|
|
16
16
|
import {
|
|
17
17
|
MaxTurnsError,
|
|
18
18
|
PromptCancelledError,
|
|
19
19
|
ToolApprovalRequiredError
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-GKPJ6FUL.js";
|
|
21
21
|
import "./chunk-YK4WAAS4.js";
|
|
22
22
|
import "./chunk-XUUY2L2D.js";
|
|
23
23
|
import {
|
|
24
24
|
createMiddleware,
|
|
25
|
-
createThinkTool
|
|
26
|
-
|
|
27
|
-
} from "./chunk-JNJBKSLA.js";
|
|
25
|
+
createThinkTool
|
|
26
|
+
} from "./chunk-MB55EXYB.js";
|
|
28
27
|
import {
|
|
29
28
|
createTool
|
|
30
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-4BGN6PYF.js";
|
|
31
30
|
import {
|
|
32
31
|
cancelPrompt,
|
|
33
32
|
createHook,
|
|
@@ -60,7 +59,7 @@ import {
|
|
|
60
59
|
isProviderTool
|
|
61
60
|
} from "./chunk-PJDL5UT2.js";
|
|
62
61
|
import "./chunk-WQKHFADH.js";
|
|
63
|
-
import "./chunk-
|
|
62
|
+
import "./chunk-MNWK2USR.js";
|
|
64
63
|
import "./chunk-OIMLU4SF.js";
|
|
65
64
|
import {
|
|
66
65
|
allow,
|
|
@@ -95,7 +94,6 @@ export {
|
|
|
95
94
|
createSummaryMemoryCompactor,
|
|
96
95
|
createThinkTool,
|
|
97
96
|
createTool,
|
|
98
|
-
createToolMiddleware,
|
|
99
97
|
defineGuardrailPolicy,
|
|
100
98
|
defineInputGuardrail,
|
|
101
99
|
defineOutputGuardrail,
|
package/dist/internal/agent.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { A as Agent, e as AgentEventAppendInput, f as AgentEventRecord, c as AgentEventStore, g as AgentEventStoreInclude, d as AgentEventStoreOptions, j as AgentEventStoreRegistration, k as AgentOptions, h as AgentSession, i as AgentToolOptions, l as DEFAULT_MAX_TURNS, D as DynamicContextOptions, m as DynamicContextRegistration, b as DynamicToolOptions, n as DynamicToolRegistration } from '../agent-
|
|
1
|
+
export { A as Agent, e as AgentEventAppendInput, f as AgentEventRecord, c as AgentEventStore, g as AgentEventStoreInclude, d as AgentEventStoreOptions, j as AgentEventStoreRegistration, k as AgentOptions, h as AgentSession, i as AgentToolOptions, l as DEFAULT_MAX_TURNS, D as DynamicContextOptions, m as DynamicContextRegistration, b as DynamicToolOptions, n as DynamicToolRegistration } from '../agent-Q7FT1xmG.js';
|
|
2
2
|
import '../types-XjIh933x.js';
|
|
3
3
|
import '../guardrails/index.js';
|
|
4
4
|
import '../types-BCA8p0sb.js';
|
|
5
5
|
import '../types-DBHzPsbx.js';
|
|
6
6
|
import '../index-XTUEMWhU.js';
|
|
7
7
|
import '../tool-Dhwg__1L.js';
|
|
8
|
-
import '../middleware-
|
|
9
|
-
import '../types-
|
|
10
|
-
import '../types-
|
|
8
|
+
import '../middleware-DfMc30in.js';
|
|
9
|
+
import '../types-BCTRUGex.js';
|
|
10
|
+
import '../types-BrxxAtcJ.js';
|
package/dist/internal/agent.js
CHANGED
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
Agent,
|
|
3
3
|
AgentSession,
|
|
4
4
|
DEFAULT_MAX_TURNS
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-6GIREB6Z.js";
|
|
6
|
+
import "../chunk-GKPJ6FUL.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
8
|
import "../chunk-XUUY2L2D.js";
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-MB55EXYB.js";
|
|
10
|
+
import "../chunk-4BGN6PYF.js";
|
|
11
11
|
import "../chunk-2ODTMRHP.js";
|
|
12
12
|
import "../chunk-TGLNXVII.js";
|
|
13
13
|
import "../chunk-MTGNA4OS.js";
|
|
14
14
|
import "../chunk-F56AMXMQ.js";
|
|
15
15
|
import "../chunk-PJDL5UT2.js";
|
|
16
16
|
import "../chunk-WQKHFADH.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-MNWK2USR.js";
|
|
18
18
|
import "../chunk-OIMLU4SF.js";
|
|
19
19
|
import "../chunk-CWUJUSOS.js";
|
|
20
20
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as ToolDefinition, d as CompletionRequest, e as CompletionResponse, i as JsonValue, q as ToolResultContent } from './types-XjIh933x.js';
|
|
2
|
-
import { V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument } from './types-
|
|
2
|
+
import { V as VectorMetadata, E as EmbeddingModel, c as EmbeddedDocument } from './types-BCTRUGex.js';
|
|
3
3
|
import { A as AnyTool, f as ToolCallContext, N as NormalizedToolOutput } from './tool-Dhwg__1L.js';
|
|
4
|
-
import { a as VectorSearchIndex } from './types-
|
|
4
|
+
import { a as VectorSearchIndex } from './types-BrxxAtcJ.js';
|
|
5
5
|
|
|
6
6
|
declare class ToolSet {
|
|
7
7
|
private readonly tools;
|
|
@@ -84,19 +84,7 @@ interface AgentMiddleware<RawResponse = unknown> {
|
|
|
84
84
|
onCompletionResponse?(args: CompletionResponseMiddlewareArgs<RawResponse>): MaybePromise<CompletionResponseMiddlewareResult<RawResponse>>;
|
|
85
85
|
onToolInput?(args: ToolInputMiddlewareArgs): MaybePromise<ToolInputMiddlewareResult>;
|
|
86
86
|
onToolOutput?(args: ToolOutputMiddlewareArgs): MaybePromise<ToolOutputMiddlewareResult>;
|
|
87
|
-
/**
|
|
88
|
-
* @deprecated Use `onToolOutput` instead.
|
|
89
|
-
*/
|
|
90
|
-
onResult?(args: ToolResultMiddlewareArgs): string | undefined | Promise<string | undefined>;
|
|
91
87
|
}
|
|
92
|
-
/**
|
|
93
|
-
* @deprecated Use `AgentMiddleware` instead.
|
|
94
|
-
*/
|
|
95
|
-
type ToolMiddleware<RawResponse = unknown> = AgentMiddleware<RawResponse>;
|
|
96
88
|
declare function createMiddleware<RawResponse = unknown>(middleware: AgentMiddleware<RawResponse>): AgentMiddleware<RawResponse>;
|
|
97
|
-
/**
|
|
98
|
-
* @deprecated Use `createMiddleware` instead.
|
|
99
|
-
*/
|
|
100
|
-
declare function createToolMiddleware<RawResponse = unknown>(middleware: ToolMiddleware<RawResponse>): ToolMiddleware<RawResponse>;
|
|
101
89
|
|
|
102
|
-
export { type AgentMiddleware as A, type CompletionRequestMiddlewareArgs as C, type DynamicToolIndex as D, type EmbedToolsOptions as E, type ToolInputMiddlewareArgs as T, type CompletionRequestMiddlewareResult as a, type CompletionResponseMiddlewareArgs as b, type CompletionResponseMiddlewareResult as c, type ToolInputMiddlewareResult as d, type
|
|
90
|
+
export { type AgentMiddleware as A, type CompletionRequestMiddlewareArgs as C, type DynamicToolIndex as D, type EmbedToolsOptions as E, type ToolInputMiddlewareArgs as T, type CompletionRequestMiddlewareResult as a, type CompletionResponseMiddlewareArgs as b, type CompletionResponseMiddlewareResult as c, type ToolInputMiddlewareResult as d, type ToolOutputMiddlewareArgs as e, type ToolOutputMiddlewareResult as f, type ToolResultMiddlewareArgs as g, createMiddleware as h, type ToolSearchDocument as i, ToolSet as j, createToolIndex as k, embedTools as l, isDynamicToolIndex as m };
|
package/dist/pipeline/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { A as Agent } from '../agent-
|
|
2
|
+
import { A as Agent } from '../agent-Q7FT1xmG.js';
|
|
3
3
|
import { J as JsonObject, C as CompletionModel } from '../types-XjIh933x.js';
|
|
4
4
|
import { Extractor } from '../extractor/index.js';
|
|
5
5
|
import '../guardrails/index.js';
|
|
@@ -7,9 +7,9 @@ import '../types-BCA8p0sb.js';
|
|
|
7
7
|
import '../types-DBHzPsbx.js';
|
|
8
8
|
import '../index-XTUEMWhU.js';
|
|
9
9
|
import '../tool-Dhwg__1L.js';
|
|
10
|
-
import '../middleware-
|
|
11
|
-
import '../types-
|
|
12
|
-
import '../types-
|
|
10
|
+
import '../middleware-DfMc30in.js';
|
|
11
|
+
import '../types-BCTRUGex.js';
|
|
12
|
+
import '../types-BrxxAtcJ.js';
|
|
13
13
|
import '../zod-schema-C7F4clpm.js';
|
|
14
14
|
|
|
15
15
|
/** Minimal interface for anything that can run as a pipeline stage. */
|
package/dist/request/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { M as Message } from '../types-XjIh933x.js';
|
|
2
2
|
import { d as ToolApprovalRequest } from '../tool-Dhwg__1L.js';
|
|
3
|
-
export { C as CompletionRetryContext, a as CompletionRetryOptions, P as PromptRequest } from '../agent-
|
|
3
|
+
export { C as CompletionRetryContext, a as CompletionRetryOptions, P as PromptRequest } from '../agent-Q7FT1xmG.js';
|
|
4
4
|
export { A as AgentChildStreamEvent, a as AgentChildStreamEventWithToolCallDeltas, b as AgentChildStreamEventWithoutToolCallDeltas, l as AgentDeltaEvent, c as AgentErrorStreamEvent, d as AgentStreamEvent, e as AgentStreamEventWithToolCallDeltas, f as AgentStreamEventWithoutToolCallDeltas, g as AgentStreamOptions, h as AgentToolCallDeltaEvent, P as PromptResponse } from '../index-XTUEMWhU.js';
|
|
5
5
|
import '../guardrails/index.js';
|
|
6
6
|
import '../types-BCA8p0sb.js';
|
|
7
7
|
import '../types-DBHzPsbx.js';
|
|
8
|
-
import '../middleware-
|
|
9
|
-
import '../types-
|
|
10
|
-
import '../types-
|
|
8
|
+
import '../middleware-DfMc30in.js';
|
|
9
|
+
import '../types-BCTRUGex.js';
|
|
10
|
+
import '../types-BrxxAtcJ.js';
|
|
11
11
|
|
|
12
12
|
declare class MaxTurnsError extends Error {
|
|
13
13
|
readonly maxTurns: number;
|
package/dist/request/index.js
CHANGED
|
@@ -3,17 +3,17 @@ import {
|
|
|
3
3
|
PromptCancelledError,
|
|
4
4
|
PromptRequest,
|
|
5
5
|
ToolApprovalRequiredError
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-GKPJ6FUL.js";
|
|
7
7
|
import "../chunk-XUUY2L2D.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-MB55EXYB.js";
|
|
9
|
+
import "../chunk-4BGN6PYF.js";
|
|
10
10
|
import "../chunk-2ODTMRHP.js";
|
|
11
11
|
import "../chunk-TGLNXVII.js";
|
|
12
12
|
import "../chunk-MTGNA4OS.js";
|
|
13
13
|
import "../chunk-F56AMXMQ.js";
|
|
14
14
|
import "../chunk-PJDL5UT2.js";
|
|
15
15
|
import "../chunk-WQKHFADH.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-MNWK2USR.js";
|
|
17
17
|
import "../chunk-OIMLU4SF.js";
|
|
18
18
|
import "../chunk-CWUJUSOS.js";
|
|
19
19
|
export {
|
package/dist/skills/index.js
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
SkillValidationError,
|
|
3
3
|
loadSkills,
|
|
4
4
|
skill
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-BCA4VZ5W.js";
|
|
6
6
|
import "../chunk-CQNNSZPG.js";
|
|
7
7
|
import "../chunk-YK4WAAS4.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-MB55EXYB.js";
|
|
9
|
+
import "../chunk-4BGN6PYF.js";
|
|
10
10
|
import "../chunk-PJDL5UT2.js";
|
|
11
11
|
import "../chunk-WQKHFADH.js";
|
|
12
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-MNWK2USR.js";
|
|
13
13
|
import "../chunk-OIMLU4SF.js";
|
|
14
14
|
export {
|
|
15
15
|
SkillValidationError,
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { b as CreateThinkToolOptions, C as CreateToolOptions, c as createThinkTool, a as createTool } from '../think-tool-CpCKo8Q8.js';
|
|
2
|
-
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as
|
|
2
|
+
export { A as AgentMiddleware, C as CompletionRequestMiddlewareArgs, a as CompletionRequestMiddlewareResult, b as CompletionResponseMiddlewareArgs, c as CompletionResponseMiddlewareResult, D as DynamicToolIndex, E as EmbedToolsOptions, T as ToolInputMiddlewareArgs, d as ToolInputMiddlewareResult, e as ToolOutputMiddlewareArgs, f as ToolOutputMiddlewareResult, g as ToolResultMiddlewareArgs, i as ToolSearchDocument, j as ToolSet, h as createMiddleware, k as createToolIndex, l as embedTools, m as isDynamicToolIndex } from '../middleware-DfMc30in.js';
|
|
3
3
|
export { A as AnyTool, N as NormalizedToolOutput, T as Tool, a as ToolApprovalContext, b as ToolApprovalDecision, c as ToolApprovalPolicy, d as ToolApprovalRequest, h as ToolApprovalRunContext, e as ToolApprovalsOptions, f as ToolCallContext, g as ToolCallStreamEvent, i as ToolOutput, n as normalizeToolResultOutput, p as parseToolArgs, t as toolResultContentToText } from '../tool-Dhwg__1L.js';
|
|
4
4
|
export { x as isToolResultContentArray, y as serializeToolOutput } from '../types-XjIh933x.js';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import '../zod-schema-C7F4clpm.js';
|
|
7
|
-
import '../types-
|
|
8
|
-
import '../types-
|
|
7
|
+
import '../types-BCTRUGex.js';
|
|
8
|
+
import '../types-BrxxAtcJ.js';
|
|
9
9
|
|
|
10
10
|
declare class ToolCallError extends Error {
|
|
11
11
|
readonly cause?: unknown | undefined;
|
package/dist/tool/index.js
CHANGED
|
@@ -7,22 +7,21 @@ import {
|
|
|
7
7
|
createMiddleware,
|
|
8
8
|
createThinkTool,
|
|
9
9
|
createToolIndex,
|
|
10
|
-
createToolMiddleware,
|
|
11
10
|
embedTools,
|
|
12
11
|
isDynamicToolIndex,
|
|
13
12
|
normalizeToolResultOutput,
|
|
14
13
|
parseToolArgs,
|
|
15
14
|
toolResultContentToText
|
|
16
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-MB55EXYB.js";
|
|
17
16
|
import {
|
|
18
17
|
createTool
|
|
19
|
-
} from "../chunk-
|
|
18
|
+
} from "../chunk-4BGN6PYF.js";
|
|
20
19
|
import {
|
|
21
20
|
isToolResultContentArray,
|
|
22
21
|
serializeToolResultOutput
|
|
23
22
|
} from "../chunk-PJDL5UT2.js";
|
|
24
23
|
import "../chunk-WQKHFADH.js";
|
|
25
|
-
import "../chunk-
|
|
24
|
+
import "../chunk-MNWK2USR.js";
|
|
26
25
|
import "../chunk-OIMLU4SF.js";
|
|
27
26
|
export {
|
|
28
27
|
ToolCallError,
|
|
@@ -34,7 +33,6 @@ export {
|
|
|
34
33
|
createThinkTool,
|
|
35
34
|
createTool,
|
|
36
35
|
createToolIndex,
|
|
37
|
-
createToolMiddleware,
|
|
38
36
|
embedTools,
|
|
39
37
|
isDynamicToolIndex,
|
|
40
38
|
isToolResultContentArray,
|