linkque-cli-v2 1.0.5 → 1.0.7
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 +1 -1
- package/linkquejs.js +23 -2212
- package/package.json +4 -1
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/anthropic-messages-B5T6TFD2.js +7172 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/azure-openai-responses-S7HNQOSE.js +229 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-2NGJGNYB.js +1765 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-3S3TOEBZ.js +608 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-46SEH6ER.js +78 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-6MHDOBWO.js +12 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-6WHNFJT4.js +31278 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-7BQRUS4C.js +671 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-7QWAKKTY.js +7054 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-CT4G24PS.js +8 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-DYEQRE6N.js +343 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-E2P6TIFG.js +31 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-FHNQ6DPF.js +14 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-FJ2BZPIM.js +60308 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-HTG7JBF2.js +38 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-I64V3ICJ.js +11166 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-IAT272TH.js +12121 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-IKZ25GJD.js +497 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-MKS245OU.js +3570 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-NKEOCGYU.js +76 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-OXGCUIKV.js +33 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-RYONFGPP.js +317 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-UEVQXSKG.js +4765 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-UFVAKOTZ.js +17 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-VS2QQHAK.js +46 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-XMVFOHGJ.js +31 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-XUFLSZM4.js +5319 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-Y6UTJIT4.js +23 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/chunk-YDKZZ6EH.js +3584 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/dist-QD3CV4KC.js +1224 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/google-generative-ai-IOXNKFEV.js +412 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/google-vertex-U4ZV5IXZ.js +461 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/mistral-conversations-G3K7SSWR.js +30344 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/multipart-parser-2VJ7LVQD.js +170 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/multipart-parser-AJMV6U6H.js +178 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/multipart-parser-PULXGNYO.js +368 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/openai-codex-responses-4JJLPTCS.js +1308 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/openai-completions-PH4WW6E7.js +977 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/openai-responses-KGWAX6HR.js +264 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/openrouter-images-LMBZZQ76.js +138 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/otel-7GSG7QQO.js +6657 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/pi-messages-ZX3KUWSZ.js +309 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/chat.js +2348 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/handler/clientCapability.js +16 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/runtime/protocol.js +17 -0
- package/vendor/linkque-agent-appwrite-integrate/dist/esm/src-NGZW4JXI.js +1396 -0
- package/vendor/linkque-agent-appwrite-integrate/package.json +1 -0
- package/worker.js +16 -6
|
@@ -0,0 +1,671 @@
|
|
|
1
|
+
import {
|
|
2
|
+
$ZodError,
|
|
3
|
+
NEVER,
|
|
4
|
+
any,
|
|
5
|
+
array,
|
|
6
|
+
boolean,
|
|
7
|
+
int,
|
|
8
|
+
literal,
|
|
9
|
+
nullable,
|
|
10
|
+
object,
|
|
11
|
+
prettifyError,
|
|
12
|
+
record,
|
|
13
|
+
string,
|
|
14
|
+
union,
|
|
15
|
+
unknown
|
|
16
|
+
} from "./chunk-I64V3ICJ.js";
|
|
17
|
+
|
|
18
|
+
// ../../node_modules/@mistralai/mistralai/esm/lib/primitives.js
|
|
19
|
+
function remap(inp, mappings) {
|
|
20
|
+
let out = {};
|
|
21
|
+
if (!Object.keys(mappings).length) {
|
|
22
|
+
out = inp;
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
for (const [k, v] of Object.entries(inp)) {
|
|
26
|
+
const j = mappings[k];
|
|
27
|
+
if (j === null) {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
out[j ?? k] = v;
|
|
31
|
+
}
|
|
32
|
+
return out;
|
|
33
|
+
}
|
|
34
|
+
function compactMap(values) {
|
|
35
|
+
const out = {};
|
|
36
|
+
for (const [k, v] of Object.entries(values)) {
|
|
37
|
+
if (typeof v !== "undefined") {
|
|
38
|
+
out[k] = v;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/errors/sdkvalidationerror.js
|
|
45
|
+
var SDKValidationError = class extends Error {
|
|
46
|
+
/**
|
|
47
|
+
* The raw value that failed validation.
|
|
48
|
+
*/
|
|
49
|
+
rawValue;
|
|
50
|
+
/**
|
|
51
|
+
* The raw message that failed validation.
|
|
52
|
+
*/
|
|
53
|
+
rawMessage;
|
|
54
|
+
// Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError`
|
|
55
|
+
static [Symbol.hasInstance](instance) {
|
|
56
|
+
if (!(instance instanceof Error))
|
|
57
|
+
return false;
|
|
58
|
+
if (!("rawValue" in instance))
|
|
59
|
+
return false;
|
|
60
|
+
if (!("rawMessage" in instance))
|
|
61
|
+
return false;
|
|
62
|
+
if (!("pretty" in instance))
|
|
63
|
+
return false;
|
|
64
|
+
if (typeof instance.pretty !== "function")
|
|
65
|
+
return false;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
constructor(message, cause, rawValue) {
|
|
69
|
+
super(`${message}: ${cause}`);
|
|
70
|
+
this.name = "SDKValidationError";
|
|
71
|
+
this.cause = cause;
|
|
72
|
+
this.rawValue = rawValue;
|
|
73
|
+
this.rawMessage = message;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Return a pretty-formatted error message if the underlying validation error
|
|
77
|
+
* is a ZodError or some other recognized error type, otherwise return the
|
|
78
|
+
* default error message.
|
|
79
|
+
*/
|
|
80
|
+
pretty() {
|
|
81
|
+
if (this.cause instanceof $ZodError) {
|
|
82
|
+
return `${this.rawMessage}
|
|
83
|
+
${formatZodError(this.cause)}`;
|
|
84
|
+
} else {
|
|
85
|
+
return this.toString();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
function formatZodError(err) {
|
|
90
|
+
return prettifyError(err);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ../../node_modules/@mistralai/mistralai/esm/types/fp.js
|
|
94
|
+
function OK(value) {
|
|
95
|
+
return { ok: true, value };
|
|
96
|
+
}
|
|
97
|
+
function ERR(error) {
|
|
98
|
+
return { ok: false, error };
|
|
99
|
+
}
|
|
100
|
+
async function unwrapAsync(pr) {
|
|
101
|
+
const r = await pr;
|
|
102
|
+
if (!r.ok) {
|
|
103
|
+
throw r.error;
|
|
104
|
+
}
|
|
105
|
+
return r.value;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ../../node_modules/@mistralai/mistralai/esm/lib/schemas.js
|
|
109
|
+
function safeParse(rawValue, fn, errorMessage) {
|
|
110
|
+
try {
|
|
111
|
+
return OK(fn(rawValue));
|
|
112
|
+
} catch (err) {
|
|
113
|
+
return ERR(new SDKValidationError(errorMessage, err, rawValue));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/usageinfo.js
|
|
118
|
+
var UsageInfo$inboundSchema = object({
|
|
119
|
+
prompt_tokens: int().default(0),
|
|
120
|
+
completion_tokens: int().default(0),
|
|
121
|
+
total_tokens: int().default(0),
|
|
122
|
+
prompt_audio_seconds: nullable(int()).optional()
|
|
123
|
+
}).catchall(any()).transform((v) => {
|
|
124
|
+
return remap(v, {
|
|
125
|
+
"prompt_tokens": "promptTokens",
|
|
126
|
+
"completion_tokens": "completionTokens",
|
|
127
|
+
"total_tokens": "totalTokens",
|
|
128
|
+
"prompt_audio_seconds": "promptAudioSeconds"
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
var UsageInfo$outboundSchema = object({
|
|
132
|
+
promptTokens: int().default(0),
|
|
133
|
+
completionTokens: int().default(0),
|
|
134
|
+
totalTokens: int().default(0),
|
|
135
|
+
promptAudioSeconds: nullable(int()).optional()
|
|
136
|
+
}).catchall(any()).transform((v) => {
|
|
137
|
+
return {
|
|
138
|
+
...remap(v, {
|
|
139
|
+
promptTokens: "prompt_tokens",
|
|
140
|
+
completionTokens: "completion_tokens",
|
|
141
|
+
totalTokens: "total_tokens",
|
|
142
|
+
promptAudioSeconds: "prompt_audio_seconds"
|
|
143
|
+
})
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// ../../node_modules/@mistralai/mistralai/esm/types/unrecognized.js
|
|
148
|
+
function unrecognized(value) {
|
|
149
|
+
globalCount++;
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
var globalCount = 0;
|
|
153
|
+
var refCount = 0;
|
|
154
|
+
function startCountingUnrecognized() {
|
|
155
|
+
refCount++;
|
|
156
|
+
const start = globalCount;
|
|
157
|
+
return {
|
|
158
|
+
/**
|
|
159
|
+
* Ends counting and returns the delta.
|
|
160
|
+
* @param delta - If provided, only this amount is added to the parent counter
|
|
161
|
+
* (used for nested unions where we only want to record the winning option's count).
|
|
162
|
+
* If not provided, records all counts since start().
|
|
163
|
+
*/
|
|
164
|
+
end: (delta) => {
|
|
165
|
+
const count = globalCount - start;
|
|
166
|
+
globalCount = start + (delta ?? count);
|
|
167
|
+
if (--refCount === 0)
|
|
168
|
+
globalCount = 0;
|
|
169
|
+
return count;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ../../node_modules/@mistralai/mistralai/esm/types/enums.js
|
|
175
|
+
function inboundSchema(enumObj) {
|
|
176
|
+
const options = Object.values(enumObj);
|
|
177
|
+
return union([
|
|
178
|
+
...options.map((x) => literal(x)),
|
|
179
|
+
string().transform((x) => unrecognized(x))
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
function inboundSchemaInt(enumObj) {
|
|
183
|
+
const options = Object.values(enumObj).filter((v) => typeof v === "number");
|
|
184
|
+
return union([
|
|
185
|
+
...options.map((x) => literal(x)),
|
|
186
|
+
int().transform((x) => unrecognized(x))
|
|
187
|
+
]);
|
|
188
|
+
}
|
|
189
|
+
function outboundSchema(_) {
|
|
190
|
+
return string();
|
|
191
|
+
}
|
|
192
|
+
function outboundSchemaInt(_) {
|
|
193
|
+
return int();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ../../node_modules/@mistralai/mistralai/esm/types/discriminatedUnion.js
|
|
197
|
+
var UNKNOWN = Symbol("UNKNOWN");
|
|
198
|
+
function isUnknown(value) {
|
|
199
|
+
return typeof value === "object" && value !== null && UNKNOWN in value;
|
|
200
|
+
}
|
|
201
|
+
function discriminatedUnion(inputPropertyName, options, opts = {}) {
|
|
202
|
+
const { unknownValue = "UNKNOWN", outputPropertyName } = opts;
|
|
203
|
+
return unknown().transform((input) => {
|
|
204
|
+
const fallback = Object.defineProperties({
|
|
205
|
+
raw: input,
|
|
206
|
+
[outputPropertyName ?? inputPropertyName]: unknownValue,
|
|
207
|
+
isUnknown: true
|
|
208
|
+
}, { [UNKNOWN]: { value: true, enumerable: false, configurable: false } });
|
|
209
|
+
const isObject = typeof input === "object" && input !== null;
|
|
210
|
+
if (!isObject)
|
|
211
|
+
return fallback;
|
|
212
|
+
const discriminator = input[inputPropertyName];
|
|
213
|
+
if (typeof discriminator !== "string")
|
|
214
|
+
return fallback;
|
|
215
|
+
if (!(discriminator in options))
|
|
216
|
+
return fallback;
|
|
217
|
+
const schema = options[discriminator];
|
|
218
|
+
if (!schema)
|
|
219
|
+
return fallback;
|
|
220
|
+
const unrecognizedCtr = startCountingUnrecognized();
|
|
221
|
+
const result = schema.safeParse(input);
|
|
222
|
+
if (!result.success) {
|
|
223
|
+
unrecognizedCtr.end(0);
|
|
224
|
+
return fallback;
|
|
225
|
+
}
|
|
226
|
+
unrecognizedCtr.end();
|
|
227
|
+
if (outputPropertyName) {
|
|
228
|
+
result.data[outputPropertyName] = discriminator;
|
|
229
|
+
}
|
|
230
|
+
return result.data;
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// ../../node_modules/@mistralai/mistralai/esm/types/rfcdate.js
|
|
235
|
+
var dateRE = /^\d{4}-\d{2}-\d{2}$/;
|
|
236
|
+
var RFCDate = class _RFCDate {
|
|
237
|
+
serialized;
|
|
238
|
+
/**
|
|
239
|
+
* Creates a new RFCDate instance using today's date.
|
|
240
|
+
*/
|
|
241
|
+
static today() {
|
|
242
|
+
return new _RFCDate(/* @__PURE__ */ new Date());
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Creates a new RFCDate instance using the provided input.
|
|
246
|
+
* If a string is used then in must be in the format YYYY-MM-DD.
|
|
247
|
+
*
|
|
248
|
+
* @param date A Date object or a date string in YYYY-MM-DD format
|
|
249
|
+
* @example
|
|
250
|
+
* new RFCDate("2022-01-01")
|
|
251
|
+
* @example
|
|
252
|
+
* new RFCDate(new Date())
|
|
253
|
+
*/
|
|
254
|
+
constructor(date) {
|
|
255
|
+
if (typeof date === "string" && !dateRE.test(date)) {
|
|
256
|
+
throw new RangeError("RFCDate: date strings must be in the format YYYY-MM-DD: " + date);
|
|
257
|
+
}
|
|
258
|
+
const value = new Date(date);
|
|
259
|
+
if (isNaN(+value)) {
|
|
260
|
+
throw new RangeError("RFCDate: invalid date provided: " + date);
|
|
261
|
+
}
|
|
262
|
+
this.serialized = value.toISOString().slice(0, "YYYY-MM-DD".length);
|
|
263
|
+
if (!dateRE.test(this.serialized)) {
|
|
264
|
+
throw new TypeError(`RFCDate: failed to build valid date with given value: ${date} serialized to ${this.serialized}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
toJSON() {
|
|
268
|
+
return this.toString();
|
|
269
|
+
}
|
|
270
|
+
toString() {
|
|
271
|
+
return this.serialized;
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// ../../node_modules/@mistralai/mistralai/esm/types/smartUnion.js
|
|
276
|
+
function smartUnion(options) {
|
|
277
|
+
return unknown().transform((input, ctx) => {
|
|
278
|
+
const candidates = [];
|
|
279
|
+
const errors = options.map(() => []);
|
|
280
|
+
const parentUnrecognizedCtr = startCountingUnrecognized();
|
|
281
|
+
for (const [i, option] of options.entries()) {
|
|
282
|
+
const unrecognizedCtr = startCountingUnrecognized();
|
|
283
|
+
const result = option.safeParse(input);
|
|
284
|
+
const inexactCount = unrecognizedCtr.end();
|
|
285
|
+
const zeroDefaultCount = 0;
|
|
286
|
+
if (result.success) {
|
|
287
|
+
candidates.push({
|
|
288
|
+
data: result.data,
|
|
289
|
+
inexactCount,
|
|
290
|
+
zeroDefaultCount,
|
|
291
|
+
fieldCount: -1
|
|
292
|
+
// We'll count this later if needed
|
|
293
|
+
});
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
errors[i].push(...result.error.issues);
|
|
297
|
+
}
|
|
298
|
+
if (candidates.length === 0) {
|
|
299
|
+
parentUnrecognizedCtr.end(0);
|
|
300
|
+
ctx.addIssue({ input, code: "invalid_union", errors });
|
|
301
|
+
return NEVER;
|
|
302
|
+
}
|
|
303
|
+
let best = candidates[0];
|
|
304
|
+
for (const candidate of candidates) {
|
|
305
|
+
if (candidates.length > 1) {
|
|
306
|
+
candidate.fieldCount = countFieldsRecursive(candidate.data);
|
|
307
|
+
}
|
|
308
|
+
best = better(candidate, best);
|
|
309
|
+
}
|
|
310
|
+
parentUnrecognizedCtr.end(best.inexactCount);
|
|
311
|
+
return best.data;
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
function better(a, b) {
|
|
315
|
+
const aIsExact = a.inexactCount === 0;
|
|
316
|
+
const bIsExact = b.inexactCount === 0;
|
|
317
|
+
if (aIsExact !== bIsExact) {
|
|
318
|
+
return aIsExact ? a : b;
|
|
319
|
+
}
|
|
320
|
+
const actualFieldCountA = a.fieldCount - a.zeroDefaultCount;
|
|
321
|
+
const actualFieldCountB = b.fieldCount - b.zeroDefaultCount;
|
|
322
|
+
if (actualFieldCountA !== actualFieldCountB) {
|
|
323
|
+
return actualFieldCountA > actualFieldCountB ? a : b;
|
|
324
|
+
}
|
|
325
|
+
return a.inexactCount < b.inexactCount ? a : b;
|
|
326
|
+
}
|
|
327
|
+
function countFieldsRecursive(parsed) {
|
|
328
|
+
let fieldCount = 0;
|
|
329
|
+
const queue = [parsed];
|
|
330
|
+
let index = 0;
|
|
331
|
+
while (index < queue.length) {
|
|
332
|
+
const value = queue[index++];
|
|
333
|
+
if (value === void 0 || isUnknown(value)) {
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
const type = typeof value;
|
|
337
|
+
if (value === null || type === "number" || type === "string" || type === "boolean" || type === "bigint" || value instanceof Date || value instanceof RFCDate) {
|
|
338
|
+
fieldCount++;
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
if (Array.isArray(value)) {
|
|
342
|
+
queue.push(...value);
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
if (type === "object") {
|
|
346
|
+
queue.push(...Object.values(value));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
return fieldCount;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/audiochunk.js
|
|
353
|
+
var AudioChunk$inboundSchema = object({
|
|
354
|
+
type: literal("input_audio"),
|
|
355
|
+
input_audio: string()
|
|
356
|
+
}).transform((v) => {
|
|
357
|
+
return remap(v, {
|
|
358
|
+
"input_audio": "inputAudio"
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
var AudioChunk$outboundSchema = object({
|
|
362
|
+
type: literal("input_audio"),
|
|
363
|
+
inputAudio: string()
|
|
364
|
+
}).transform((v) => {
|
|
365
|
+
return remap(v, {
|
|
366
|
+
inputAudio: "input_audio"
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/documenturlchunk.js
|
|
371
|
+
var DocumentURLChunk$inboundSchema = object({
|
|
372
|
+
type: literal("document_url").default("document_url"),
|
|
373
|
+
document_url: string(),
|
|
374
|
+
document_name: nullable(string()).optional()
|
|
375
|
+
}).transform((v) => {
|
|
376
|
+
return remap(v, {
|
|
377
|
+
"document_url": "documentUrl",
|
|
378
|
+
"document_name": "documentName"
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
var DocumentURLChunk$outboundSchema = object({
|
|
382
|
+
type: literal("document_url").default("document_url"),
|
|
383
|
+
documentUrl: string(),
|
|
384
|
+
documentName: nullable(string()).optional()
|
|
385
|
+
}).transform((v) => {
|
|
386
|
+
return remap(v, {
|
|
387
|
+
documentUrl: "document_url",
|
|
388
|
+
documentName: "document_name"
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/filechunk.js
|
|
393
|
+
var FileChunk$inboundSchema = object({
|
|
394
|
+
type: literal("file").default("file"),
|
|
395
|
+
file_id: string()
|
|
396
|
+
}).transform((v) => {
|
|
397
|
+
return remap(v, {
|
|
398
|
+
"file_id": "fileId"
|
|
399
|
+
});
|
|
400
|
+
});
|
|
401
|
+
var FileChunk$outboundSchema = object({
|
|
402
|
+
type: literal("file").default("file"),
|
|
403
|
+
fileId: string()
|
|
404
|
+
}).transform((v) => {
|
|
405
|
+
return remap(v, {
|
|
406
|
+
fileId: "file_id"
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/imagedetail.js
|
|
411
|
+
var ImageDetail = {
|
|
412
|
+
Low: "low",
|
|
413
|
+
Auto: "auto",
|
|
414
|
+
High: "high"
|
|
415
|
+
};
|
|
416
|
+
var ImageDetail$inboundSchema = inboundSchema(ImageDetail);
|
|
417
|
+
var ImageDetail$outboundSchema = outboundSchema(ImageDetail);
|
|
418
|
+
|
|
419
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/imageurl.js
|
|
420
|
+
var ImageURL$inboundSchema = object({
|
|
421
|
+
url: string(),
|
|
422
|
+
detail: nullable(ImageDetail$inboundSchema).optional()
|
|
423
|
+
});
|
|
424
|
+
var ImageURL$outboundSchema = object({
|
|
425
|
+
url: string(),
|
|
426
|
+
detail: nullable(ImageDetail$outboundSchema).optional()
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/imageurlchunk.js
|
|
430
|
+
var ImageUrlUnion$inboundSchema = smartUnion([ImageURL$inboundSchema, string()]);
|
|
431
|
+
var ImageUrlUnion$outboundSchema = smartUnion([ImageURL$outboundSchema, string()]);
|
|
432
|
+
var ImageURLChunk$inboundSchema = object({
|
|
433
|
+
type: literal("image_url").default("image_url"),
|
|
434
|
+
image_url: smartUnion([ImageURL$inboundSchema, string()])
|
|
435
|
+
}).transform((v) => {
|
|
436
|
+
return remap(v, {
|
|
437
|
+
"image_url": "imageUrl"
|
|
438
|
+
});
|
|
439
|
+
});
|
|
440
|
+
var ImageURLChunk$outboundSchema = object({
|
|
441
|
+
type: literal("image_url").default("image_url"),
|
|
442
|
+
imageUrl: smartUnion([ImageURL$outboundSchema, string()])
|
|
443
|
+
}).transform((v) => {
|
|
444
|
+
return remap(v, {
|
|
445
|
+
imageUrl: "image_url"
|
|
446
|
+
});
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/referencechunk.js
|
|
450
|
+
var ReferenceId$inboundSchema = smartUnion([int(), string()]);
|
|
451
|
+
var ReferenceId$outboundSchema = smartUnion([int(), string()]);
|
|
452
|
+
var ReferenceChunk$inboundSchema = object({
|
|
453
|
+
type: literal("reference").default("reference"),
|
|
454
|
+
reference_ids: array(smartUnion([int(), string()]))
|
|
455
|
+
}).transform((v) => {
|
|
456
|
+
return remap(v, {
|
|
457
|
+
"reference_ids": "referenceIds"
|
|
458
|
+
});
|
|
459
|
+
});
|
|
460
|
+
var ReferenceChunk$outboundSchema = object({
|
|
461
|
+
type: literal("reference").default("reference"),
|
|
462
|
+
referenceIds: array(smartUnion([int(), string()]))
|
|
463
|
+
}).transform((v) => {
|
|
464
|
+
return remap(v, {
|
|
465
|
+
referenceIds: "reference_ids"
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/textchunk.js
|
|
470
|
+
var TextChunk$inboundSchema = object({
|
|
471
|
+
type: literal("text").default("text"),
|
|
472
|
+
text: string()
|
|
473
|
+
});
|
|
474
|
+
var TextChunk$outboundSchema = object({
|
|
475
|
+
type: literal("text").default("text"),
|
|
476
|
+
text: string()
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/builtinconnectors.js
|
|
480
|
+
var BuiltInConnectors = {
|
|
481
|
+
WebSearch: "web_search",
|
|
482
|
+
WebSearchPremium: "web_search_premium",
|
|
483
|
+
CodeInterpreter: "code_interpreter",
|
|
484
|
+
ImageGeneration: "image_generation",
|
|
485
|
+
DocumentLibrary: "document_library"
|
|
486
|
+
};
|
|
487
|
+
var BuiltInConnectors$inboundSchema = inboundSchema(BuiltInConnectors);
|
|
488
|
+
var BuiltInConnectors$outboundSchema = outboundSchema(BuiltInConnectors);
|
|
489
|
+
|
|
490
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/toolreferencechunk.js
|
|
491
|
+
var ToolReferenceChunkTool$inboundSchema = smartUnion([BuiltInConnectors$inboundSchema, string()]);
|
|
492
|
+
var ToolReferenceChunkTool$outboundSchema = smartUnion([BuiltInConnectors$outboundSchema, string()]);
|
|
493
|
+
var ToolReferenceChunk$inboundSchema = object({
|
|
494
|
+
type: literal("tool_reference").default("tool_reference"),
|
|
495
|
+
tool: smartUnion([BuiltInConnectors$inboundSchema, string()]),
|
|
496
|
+
title: string(),
|
|
497
|
+
url: nullable(string()).optional(),
|
|
498
|
+
favicon: nullable(string()).optional(),
|
|
499
|
+
description: nullable(string()).optional()
|
|
500
|
+
});
|
|
501
|
+
var ToolReferenceChunk$outboundSchema = object({
|
|
502
|
+
type: literal("tool_reference").default("tool_reference"),
|
|
503
|
+
tool: smartUnion([BuiltInConnectors$outboundSchema, string()]),
|
|
504
|
+
title: string(),
|
|
505
|
+
url: nullable(string()).optional(),
|
|
506
|
+
favicon: nullable(string()).optional(),
|
|
507
|
+
description: nullable(string()).optional()
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/thinkchunk.js
|
|
511
|
+
var Thinking$inboundSchema = smartUnion([
|
|
512
|
+
ToolReferenceChunk$inboundSchema,
|
|
513
|
+
TextChunk$inboundSchema,
|
|
514
|
+
ReferenceChunk$inboundSchema
|
|
515
|
+
]);
|
|
516
|
+
var Thinking$outboundSchema = smartUnion([
|
|
517
|
+
ToolReferenceChunk$outboundSchema,
|
|
518
|
+
TextChunk$outboundSchema,
|
|
519
|
+
ReferenceChunk$outboundSchema
|
|
520
|
+
]);
|
|
521
|
+
var ThinkChunk$inboundSchema = object({
|
|
522
|
+
type: literal("thinking").default("thinking"),
|
|
523
|
+
thinking: array(smartUnion([
|
|
524
|
+
ToolReferenceChunk$inboundSchema,
|
|
525
|
+
TextChunk$inboundSchema,
|
|
526
|
+
ReferenceChunk$inboundSchema
|
|
527
|
+
])),
|
|
528
|
+
signature: nullable(string()).optional(),
|
|
529
|
+
closed: boolean().optional()
|
|
530
|
+
});
|
|
531
|
+
var ThinkChunk$outboundSchema = object({
|
|
532
|
+
type: literal("thinking").default("thinking"),
|
|
533
|
+
thinking: array(smartUnion([
|
|
534
|
+
ToolReferenceChunk$outboundSchema,
|
|
535
|
+
TextChunk$outboundSchema,
|
|
536
|
+
ReferenceChunk$outboundSchema
|
|
537
|
+
])),
|
|
538
|
+
signature: nullable(string()).optional(),
|
|
539
|
+
closed: boolean().optional()
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/contentchunk.js
|
|
543
|
+
var ContentChunk$inboundSchema = discriminatedUnion("type", {
|
|
544
|
+
image_url: ImageURLChunk$inboundSchema.and(object({ type: literal("image_url") })),
|
|
545
|
+
document_url: DocumentURLChunk$inboundSchema.and(object({ type: literal("document_url") })),
|
|
546
|
+
text: TextChunk$inboundSchema.and(object({ type: literal("text") })),
|
|
547
|
+
reference: ReferenceChunk$inboundSchema.and(object({ type: literal("reference") })),
|
|
548
|
+
file: FileChunk$inboundSchema.and(object({ type: literal("file") })),
|
|
549
|
+
thinking: ThinkChunk$inboundSchema.and(object({ type: literal("thinking") })),
|
|
550
|
+
input_audio: AudioChunk$inboundSchema
|
|
551
|
+
});
|
|
552
|
+
var ContentChunk$outboundSchema = union([
|
|
553
|
+
ImageURLChunk$outboundSchema.and(object({ type: literal("image_url") })),
|
|
554
|
+
DocumentURLChunk$outboundSchema.and(object({ type: literal("document_url") })),
|
|
555
|
+
TextChunk$outboundSchema.and(object({ type: literal("text") })),
|
|
556
|
+
ReferenceChunk$outboundSchema.and(object({ type: literal("reference") })),
|
|
557
|
+
FileChunk$outboundSchema.and(object({ type: literal("file") })),
|
|
558
|
+
ThinkChunk$outboundSchema.and(object({ type: literal("thinking") })),
|
|
559
|
+
AudioChunk$outboundSchema
|
|
560
|
+
]);
|
|
561
|
+
|
|
562
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/functioncall.js
|
|
563
|
+
var Arguments$inboundSchema = smartUnion([record(string(), any()), string()]);
|
|
564
|
+
var Arguments$outboundSchema = smartUnion([record(string(), any()), string()]);
|
|
565
|
+
var FunctionCall$inboundSchema = object({
|
|
566
|
+
name: string(),
|
|
567
|
+
arguments: smartUnion([record(string(), any()), string()])
|
|
568
|
+
});
|
|
569
|
+
var FunctionCall$outboundSchema = object({
|
|
570
|
+
name: string(),
|
|
571
|
+
arguments: smartUnion([record(string(), any()), string()])
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/toolcall.js
|
|
575
|
+
var ToolCall$inboundSchema = object({
|
|
576
|
+
id: string().default("null"),
|
|
577
|
+
type: string().optional(),
|
|
578
|
+
function: FunctionCall$inboundSchema,
|
|
579
|
+
index: int().default(0)
|
|
580
|
+
});
|
|
581
|
+
var ToolCall$outboundSchema = object({
|
|
582
|
+
id: string().default("null"),
|
|
583
|
+
type: string().optional(),
|
|
584
|
+
function: FunctionCall$outboundSchema,
|
|
585
|
+
index: int().default(0)
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/deltamessage.js
|
|
589
|
+
var DeltaMessageContent$inboundSchema = smartUnion([string(), array(ContentChunk$inboundSchema)]);
|
|
590
|
+
var DeltaMessage$inboundSchema = object({
|
|
591
|
+
role: nullable(string()).optional(),
|
|
592
|
+
content: nullable(smartUnion([string(), array(ContentChunk$inboundSchema)])).optional(),
|
|
593
|
+
tool_calls: nullable(array(ToolCall$inboundSchema)).optional(),
|
|
594
|
+
tool_call_id: nullable(string()).optional(),
|
|
595
|
+
index: nullable(int()).optional(),
|
|
596
|
+
metadata: nullable(record(string(), any())).optional()
|
|
597
|
+
}).transform((v) => {
|
|
598
|
+
return remap(v, {
|
|
599
|
+
"tool_calls": "toolCalls",
|
|
600
|
+
"tool_call_id": "toolCallId"
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
|
|
604
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/completionresponsestreamchoice.js
|
|
605
|
+
var CompletionResponseStreamChoiceFinishReason = {
|
|
606
|
+
Stop: "stop",
|
|
607
|
+
Length: "length",
|
|
608
|
+
Error: "error",
|
|
609
|
+
ToolCalls: "tool_calls"
|
|
610
|
+
};
|
|
611
|
+
var CompletionResponseStreamChoiceFinishReason$inboundSchema = inboundSchema(CompletionResponseStreamChoiceFinishReason);
|
|
612
|
+
var CompletionResponseStreamChoice$inboundSchema = object({
|
|
613
|
+
index: int(),
|
|
614
|
+
delta: DeltaMessage$inboundSchema,
|
|
615
|
+
finish_reason: nullable(CompletionResponseStreamChoiceFinishReason$inboundSchema)
|
|
616
|
+
}).transform((v) => {
|
|
617
|
+
return remap(v, {
|
|
618
|
+
"finish_reason": "finishReason"
|
|
619
|
+
});
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
// ../../node_modules/@mistralai/mistralai/esm/models/components/completionchunk.js
|
|
623
|
+
var CompletionChunk$inboundSchema = object({
|
|
624
|
+
id: string(),
|
|
625
|
+
object: string().optional(),
|
|
626
|
+
created: int().optional(),
|
|
627
|
+
model: string(),
|
|
628
|
+
usage: UsageInfo$inboundSchema.optional(),
|
|
629
|
+
choices: array(CompletionResponseStreamChoice$inboundSchema)
|
|
630
|
+
});
|
|
631
|
+
function completionChunkFromJSON(jsonString) {
|
|
632
|
+
return safeParse(jsonString, (x) => CompletionChunk$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CompletionChunk' from JSON`);
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
export {
|
|
636
|
+
formatZodError,
|
|
637
|
+
OK,
|
|
638
|
+
ERR,
|
|
639
|
+
unwrapAsync,
|
|
640
|
+
safeParse,
|
|
641
|
+
remap,
|
|
642
|
+
compactMap,
|
|
643
|
+
inboundSchema,
|
|
644
|
+
inboundSchemaInt,
|
|
645
|
+
outboundSchema,
|
|
646
|
+
outboundSchemaInt,
|
|
647
|
+
discriminatedUnion,
|
|
648
|
+
smartUnion,
|
|
649
|
+
DocumentURLChunk$inboundSchema,
|
|
650
|
+
DocumentURLChunk$outboundSchema,
|
|
651
|
+
FileChunk$outboundSchema,
|
|
652
|
+
ImageURLChunk$inboundSchema,
|
|
653
|
+
ImageURLChunk$outboundSchema,
|
|
654
|
+
TextChunk$inboundSchema,
|
|
655
|
+
TextChunk$outboundSchema,
|
|
656
|
+
BuiltInConnectors$inboundSchema,
|
|
657
|
+
BuiltInConnectors$outboundSchema,
|
|
658
|
+
ToolReferenceChunk$inboundSchema,
|
|
659
|
+
ToolReferenceChunk$outboundSchema,
|
|
660
|
+
ThinkChunk$inboundSchema,
|
|
661
|
+
ThinkChunk$outboundSchema,
|
|
662
|
+
ContentChunk$inboundSchema,
|
|
663
|
+
ContentChunk$outboundSchema,
|
|
664
|
+
ToolCall$inboundSchema,
|
|
665
|
+
ToolCall$outboundSchema,
|
|
666
|
+
DeltaMessage$inboundSchema,
|
|
667
|
+
UsageInfo$inboundSchema,
|
|
668
|
+
UsageInfo$outboundSchema,
|
|
669
|
+
CompletionChunk$inboundSchema,
|
|
670
|
+
completionChunkFromJSON
|
|
671
|
+
};
|