@voltro/ai 0.85.0 → 0.87.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/CHANGELOG.md +5987 -0
- package/THIRD-PARTY-NOTICES.md +4723 -519
- package/dist/agent.js +64 -2
- package/dist/agentConstants.js +4 -0
- package/dist/agentExecutor.js +55 -0
- package/dist/aiSettings.js +11 -0
- package/dist/api.js +199 -0
- package/dist/appTools.js +80 -0
- package/dist/budget.js +201 -0
- package/dist/callEvidence.js +51 -0
- package/dist/copilot.js +126 -0
- package/dist/cost.js +242 -0
- package/dist/embed.js +41 -0
- package/dist/embeddingProvider.js +69 -0
- package/dist/eval.js +130 -0
- package/dist/events.d.ts +4 -0
- package/dist/events.js +81 -2
- package/dist/executableModalities.js +13 -0
- package/dist/gateway.js +58 -0
- package/dist/gatewayCatalog.js +47 -0
- package/dist/gatewayMedia.js +88 -0
- package/dist/index.d.ts +60 -2
- package/dist/index.js +42 -2750
- package/dist/inferenceDispatch.js +493 -0
- package/dist/inferenceQueue.js +96 -0
- package/dist/jsonOutputValidation.js +27 -0
- package/dist/mcpClient.js +332 -0
- package/dist/mcpTools.js +80 -0
- package/dist/media.js +182 -0
- package/dist/mediaBytes.js +19 -0
- package/dist/mediaCall.js +13 -0
- package/dist/mediaTaskProvider.js +16 -0
- package/dist/middleware.js +32 -0
- package/dist/observe.js +52 -0
- package/dist/prompts.js +103 -0
- package/dist/provider.js +319 -0
- package/dist/realtimeEvent.js +97 -0
- package/dist/realtimeSession.js +154 -0
- package/dist/rerank.js +61 -0
- package/dist/resumableStream.js +321 -0
- package/dist/retrieveReranked.js +16 -0
- package/dist/runAndPersist.js +147 -0
- package/dist/semanticCache.js +66 -0
- package/dist/speechProvider.js +16 -0
- package/dist/streamRegistry.js +14 -0
- package/dist/streamText.js +170 -0
- package/dist/streamTranscribe.js +74 -0
- package/dist/streamWakeups.js +44 -0
- package/dist/structuredEvidence.js +48 -0
- package/dist/test.js +1 -1
- package/dist/threads.js +92 -0
- package/dist/tools.js +68 -0
- package/dist/transcribe.js +64 -0
- package/dist/transcriptionEvent.js +46 -0
- package/dist/workflow.d.ts +2 -0
- package/dist/workflow.js +115 -110
- package/package.json +6 -5
- package/dist/agentDescriptor-DhoiXVqO.js +0 -63
- package/dist/agentEvent-Bl4egdM5.js +0 -211
- package/dist/inferenceQueue-DcEulZep.js +0 -1077
- package/dist/provider-BnemgE4D.js +0 -409
package/dist/events.js
CHANGED
|
@@ -1,2 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { TranscriptionStreamError as e, TranscriptionStreamEvent as t } from "./transcriptionEvent.js";
|
|
2
|
+
import { RealtimeClientEvent as n, RealtimeServerEvent as r } from "./realtimeEvent.js";
|
|
3
|
+
import { Schema as i } from "effect";
|
|
4
|
+
//#region src/agentEvent.ts
|
|
5
|
+
var a = i.Literals([
|
|
6
|
+
"provider",
|
|
7
|
+
"tool",
|
|
8
|
+
"timeout",
|
|
9
|
+
"cancelled",
|
|
10
|
+
"decode",
|
|
11
|
+
"internal"
|
|
12
|
+
]), o = i.Struct({
|
|
13
|
+
inputTokens: i.optional(i.Number),
|
|
14
|
+
outputTokens: i.optional(i.Number),
|
|
15
|
+
totalTokens: i.optional(i.Number)
|
|
16
|
+
}), s = i.Union([
|
|
17
|
+
i.Struct({
|
|
18
|
+
_tag: i.Literal("token"),
|
|
19
|
+
text: i.String
|
|
20
|
+
}),
|
|
21
|
+
i.Struct({
|
|
22
|
+
_tag: i.Literal("reasoning"),
|
|
23
|
+
text: i.String
|
|
24
|
+
}),
|
|
25
|
+
i.Struct({
|
|
26
|
+
_tag: i.Literal("toolCall"),
|
|
27
|
+
id: i.String,
|
|
28
|
+
name: i.String,
|
|
29
|
+
input: i.Unknown,
|
|
30
|
+
execution: i.optional(i.Literal("client"))
|
|
31
|
+
}),
|
|
32
|
+
i.Struct({
|
|
33
|
+
_tag: i.Literal("toolResult"),
|
|
34
|
+
id: i.String,
|
|
35
|
+
name: i.String,
|
|
36
|
+
output: i.optional(i.Unknown),
|
|
37
|
+
error: i.optional(i.String)
|
|
38
|
+
}),
|
|
39
|
+
i.Struct({
|
|
40
|
+
_tag: i.Literal("source"),
|
|
41
|
+
sourceType: i.Literals(["url", "document"]),
|
|
42
|
+
id: i.String,
|
|
43
|
+
url: i.optional(i.String),
|
|
44
|
+
title: i.optional(i.String),
|
|
45
|
+
mediaType: i.optional(i.String),
|
|
46
|
+
filename: i.optional(i.String),
|
|
47
|
+
providerMetadata: i.optional(i.Unknown)
|
|
48
|
+
}),
|
|
49
|
+
i.Struct({
|
|
50
|
+
_tag: i.Literal("file"),
|
|
51
|
+
mediaType: i.String,
|
|
52
|
+
data: i.String,
|
|
53
|
+
providerMetadata: i.optional(i.Unknown)
|
|
54
|
+
}),
|
|
55
|
+
i.Struct({
|
|
56
|
+
_tag: i.Literal("stepMetadata"),
|
|
57
|
+
step: i.Int.pipe(i.check(i.isGreaterThanOrEqualTo(0))),
|
|
58
|
+
providerMetadata: i.Unknown
|
|
59
|
+
}),
|
|
60
|
+
i.Struct({
|
|
61
|
+
_tag: i.Literal("message"),
|
|
62
|
+
role: i.String,
|
|
63
|
+
content: i.String
|
|
64
|
+
}),
|
|
65
|
+
i.Struct({
|
|
66
|
+
_tag: i.Literal("error"),
|
|
67
|
+
code: a,
|
|
68
|
+
message: i.String,
|
|
69
|
+
retryable: i.Boolean
|
|
70
|
+
}),
|
|
71
|
+
i.Struct({
|
|
72
|
+
_tag: i.Literal("done"),
|
|
73
|
+
finishReason: i.String,
|
|
74
|
+
usage: o
|
|
75
|
+
})
|
|
76
|
+
]), c = i.Struct({
|
|
77
|
+
seq: i.Number,
|
|
78
|
+
event: s
|
|
79
|
+
});
|
|
80
|
+
//#endregion
|
|
81
|
+
export { a as AgentErrorCode, s as AgentEvent, n as RealtimeClientEvent, r as RealtimeServerEvent, c as SeqEvent, e as TranscriptionStreamError, t as TranscriptionStreamEvent };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/executableModalities.ts
|
|
2
|
+
var e = {
|
|
3
|
+
language: "generateText / generateObject / streamText",
|
|
4
|
+
embedding: "embed / embedMany",
|
|
5
|
+
image: "generateImage",
|
|
6
|
+
video: "generateVideo",
|
|
7
|
+
speech: "generateSpeech",
|
|
8
|
+
reranking: "rerank",
|
|
9
|
+
transcription: "transcribe",
|
|
10
|
+
realtime: "defineRealtimeSession / resolveRealtimeModel"
|
|
11
|
+
}, t = () => new Set(Object.keys(e)), n = (e) => t().has(e.modality);
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as MODALITY_PRIMITIVE, n as canExecute, t as executableModalities };
|
package/dist/gateway.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { capabilitiesOf as e, contextWindowOf as t, dataPolicyOf as n, knowledgeCutoffOf as r, maxOutputTokensOf as i, modalitiesOf as a, modalityOf as o, releasedAtOf as s } from "./gatewayCatalog.js";
|
|
2
|
+
import { createGateway as c, gateway as l } from "@ai-sdk/gateway";
|
|
3
|
+
//#region src/gateway.ts
|
|
4
|
+
var u = (e) => {
|
|
5
|
+
if (e === void 0) return;
|
|
6
|
+
let t = Number(e);
|
|
7
|
+
return Number.isFinite(t) ? t * 1e6 : void 0;
|
|
8
|
+
}, d = (e) => {
|
|
9
|
+
let t = u(e.pricing?.input), n = u(e.pricing?.output), r = u(e.pricing?.cachedInputTokens ?? void 0);
|
|
10
|
+
return {
|
|
11
|
+
id: e.id,
|
|
12
|
+
name: e.name,
|
|
13
|
+
...e.description == null ? {} : { description: e.description },
|
|
14
|
+
modality: o({ model_type: e.modelType }),
|
|
15
|
+
...t !== void 0 && n !== void 0 ? { pricing: {
|
|
16
|
+
inputPer1M: t,
|
|
17
|
+
outputPer1M: n,
|
|
18
|
+
...r === void 0 ? {} : { cachedInputPer1M: r }
|
|
19
|
+
} } : {}
|
|
20
|
+
};
|
|
21
|
+
}, f = async (e = {}) => {
|
|
22
|
+
let t = (await (e.gatewayProvider ?? (e.apiKey !== void 0 || e.baseURL !== void 0 ? c({
|
|
23
|
+
...e.apiKey === void 0 ? {} : { apiKey: e.apiKey },
|
|
24
|
+
...e.baseURL === void 0 ? {} : { baseURL: e.baseURL }
|
|
25
|
+
}) : l)).getAvailableModels()).models.map(d);
|
|
26
|
+
return e.modality === void 0 ? t : t.filter((t) => t.modality === e.modality);
|
|
27
|
+
}, p = "https://ai-gateway.vercel.sh/v1", m = async (e = {}) => {
|
|
28
|
+
let t = (e.baseURL ?? p).replace(/\/+$/, ""), n = e.apiKey ?? process.env.AI_GATEWAY_API_KEY, r = await (e.fetchImpl ?? fetch)(`${t}/models`, { headers: {
|
|
29
|
+
accept: "application/json",
|
|
30
|
+
...n === void 0 ? {} : { authorization: `Bearer ${n}` }
|
|
31
|
+
} });
|
|
32
|
+
if (!r.ok) throw Error(`gateway catalog: GET ${t}/models answered ${r.status}. Set AI_GATEWAY_API_KEY, or pass \`apiKey\`.`);
|
|
33
|
+
let i = await r.json(), a = (Array.isArray(i.data) ? i.data : Array.isArray(i.models) ? i.models : []).map(h);
|
|
34
|
+
return e.modality === void 0 ? a : a.filter((t) => t.modality === e.modality);
|
|
35
|
+
}, h = (c) => {
|
|
36
|
+
let l = c.pricing ?? {}, d = u(l.input), f = u(l.output), p = u(l.cachedInputTokens), m = t(c), h = i(c), g = s(c), _ = r(c);
|
|
37
|
+
return {
|
|
38
|
+
id: String(c.id ?? ""),
|
|
39
|
+
name: String(c.name ?? c.id ?? ""),
|
|
40
|
+
...typeof c.description == "string" && c.description !== "" ? { description: c.description } : {},
|
|
41
|
+
modality: o(c),
|
|
42
|
+
...d !== void 0 && f !== void 0 ? { pricing: {
|
|
43
|
+
inputPer1M: d,
|
|
44
|
+
outputPer1M: f,
|
|
45
|
+
...p === void 0 ? {} : { cachedInputPer1M: p }
|
|
46
|
+
} } : {},
|
|
47
|
+
capabilities: e(c),
|
|
48
|
+
modalities: a(c),
|
|
49
|
+
...m === void 0 ? {} : { contextWindow: m },
|
|
50
|
+
...h === void 0 ? {} : { maxOutputTokens: h },
|
|
51
|
+
...g === void 0 ? {} : { releasedAt: g },
|
|
52
|
+
..._ === void 0 ? {} : { knowledgeCutoff: _ },
|
|
53
|
+
dataPolicy: n(c),
|
|
54
|
+
raw: c
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { h as fromRaw, f as getAvailableModels, m as readGatewayCatalog, d as toModelInfo };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/gatewayCatalog.ts
|
|
2
|
+
var e = (e) => Array.isArray(e) ? e.filter((e) => typeof e == "string") : [], t = (e) => typeof e == "number" && Number.isFinite(e) ? e : void 0, n = (e) => e === "all" || e === "some" ? e : "none", r = (e) => {
|
|
3
|
+
let n = t(e);
|
|
4
|
+
if (n === void 0) return;
|
|
5
|
+
let r = /* @__PURE__ */ new Date(n * 1e3);
|
|
6
|
+
return Number.isNaN(r.getTime()) ? void 0 : r.toISOString();
|
|
7
|
+
}, i = (t) => {
|
|
8
|
+
let n = new Set(e(t.tags)), r = new Set(e(t.supported_parameters)), i = t.modalities ?? {}, a = new Set(e(i.input)), o = new Set(e(i.output));
|
|
9
|
+
return {
|
|
10
|
+
vision: n.has("vision") || a.has("image"),
|
|
11
|
+
reasoning: n.has("reasoning") || r.has("reasoning"),
|
|
12
|
+
toolUse: n.has("tool-use") || r.has("tools"),
|
|
13
|
+
structuredOutput: n.has("structured-output") || r.has("response_format"),
|
|
14
|
+
webSearch: n.has("web-search") || r.has("web_search_options"),
|
|
15
|
+
caching: n.has("caching") || r.has("prompt_cache_key"),
|
|
16
|
+
imageOut: o.has("image"),
|
|
17
|
+
audioOut: o.has("audio"),
|
|
18
|
+
videoOut: o.has("video"),
|
|
19
|
+
audioIn: a.has("audio"),
|
|
20
|
+
videoIn: a.has("video"),
|
|
21
|
+
fileInput: a.has("file") || a.has("pdf")
|
|
22
|
+
};
|
|
23
|
+
}, a = (t) => {
|
|
24
|
+
let n = t.modalities ?? {};
|
|
25
|
+
return {
|
|
26
|
+
input: e(n.input),
|
|
27
|
+
output: e(n.output)
|
|
28
|
+
};
|
|
29
|
+
}, o = (e) => ({
|
|
30
|
+
zeroRetention: n(e.zdr),
|
|
31
|
+
noTraining: n(e.no_training)
|
|
32
|
+
}), s = (e) => t(e.context_window), c = (e) => t(e.max_tokens), l = (e) => r(e.released), u = (e) => typeof e.knowledge == "string" && e.knowledge !== "" ? e.knowledge : void 0, d = (e) => {
|
|
33
|
+
let t = e.model_type;
|
|
34
|
+
return typeof t == "string" && [
|
|
35
|
+
"language",
|
|
36
|
+
"embedding",
|
|
37
|
+
"image",
|
|
38
|
+
"video",
|
|
39
|
+
"realtime",
|
|
40
|
+
"reranking",
|
|
41
|
+
"speech",
|
|
42
|
+
"transcription",
|
|
43
|
+
"evaluation"
|
|
44
|
+
].includes(t) ? t : "unknown";
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { i as capabilitiesOf, s as contextWindowOf, o as dataPolicyOf, u as knowledgeCutoffOf, c as maxOutputTokensOf, a as modalitiesOf, d as modalityOf, l as releasedAtOf };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createGateway as e } from "@ai-sdk/gateway";
|
|
2
|
+
//#region src/gatewayMedia.ts
|
|
3
|
+
var t = (e, t) => {
|
|
4
|
+
let n = Object.fromEntries(Object.entries(t).filter(([, e]) => e !== void 0));
|
|
5
|
+
return {
|
|
6
|
+
...e,
|
|
7
|
+
fetch: async (t, r) => {
|
|
8
|
+
let i = e.fetch ?? globalThis.fetch;
|
|
9
|
+
if (Object.keys(n).length === 0) return i(t, r);
|
|
10
|
+
if (r?.method !== "POST" || typeof r.body != "string") throw Error("Gateway media: expected a JSON POST to preserve the requested parameters");
|
|
11
|
+
let a;
|
|
12
|
+
try {
|
|
13
|
+
a = JSON.parse(r.body);
|
|
14
|
+
} catch {
|
|
15
|
+
throw Error("Gateway media: expected a JSON object to preserve the requested parameters");
|
|
16
|
+
}
|
|
17
|
+
if (typeof a != "object" || !a || Array.isArray(a)) throw Error("Gateway media: expected a JSON object to preserve the requested parameters");
|
|
18
|
+
return i(t, {
|
|
19
|
+
...r,
|
|
20
|
+
body: JSON.stringify({
|
|
21
|
+
...a,
|
|
22
|
+
...n
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, n = (e, t) => {
|
|
28
|
+
let n = Reflect.get(e, t, e);
|
|
29
|
+
return typeof n == "function" && t !== "constructor" ? n.bind(e) : n;
|
|
30
|
+
}, r = (r, i) => {
|
|
31
|
+
let a = e(r).image(i), o = (n) => e(t(r, {
|
|
32
|
+
seed: n.seed,
|
|
33
|
+
size: n.size,
|
|
34
|
+
aspectRatio: n.aspectRatio
|
|
35
|
+
})).image(i).doGenerate(n);
|
|
36
|
+
return new Proxy(a, { get: (e, t) => t === "doGenerate" ? o : n(e, t) });
|
|
37
|
+
}, i = (r, i) => {
|
|
38
|
+
let a = e(r).video(i), o = a.doGenerate === void 0 ? void 0 : (n) => {
|
|
39
|
+
let a = e(t(r, {
|
|
40
|
+
seed: n.seed,
|
|
41
|
+
duration: n.duration,
|
|
42
|
+
fps: n.fps,
|
|
43
|
+
aspectRatio: n.aspectRatio,
|
|
44
|
+
resolution: n.resolution
|
|
45
|
+
})).video(i);
|
|
46
|
+
if (!a.doGenerate) throw Error("Gateway video does not implement doGenerate");
|
|
47
|
+
return a.doGenerate(n);
|
|
48
|
+
}, s = a.doStart === void 0 ? void 0 : (n) => {
|
|
49
|
+
let a = e(t(r, {
|
|
50
|
+
seed: n.seed,
|
|
51
|
+
duration: n.duration,
|
|
52
|
+
fps: n.fps,
|
|
53
|
+
aspectRatio: n.aspectRatio,
|
|
54
|
+
resolution: n.resolution
|
|
55
|
+
})).video(i);
|
|
56
|
+
if (!a.doStart) throw Error("Gateway video does not implement doStart");
|
|
57
|
+
return a.doStart(n);
|
|
58
|
+
};
|
|
59
|
+
return new Proxy(a, { get: (e, t) => t === "doGenerate" ? o : t === "doStart" ? s : n(e, t) });
|
|
60
|
+
}, a = 134217728, o = (e, t = process.env) => {
|
|
61
|
+
if (e !== void 0) return e;
|
|
62
|
+
let n = Number(t.VOLTRO_AI_MEDIA_MAX_RESPONSE_BYTES);
|
|
63
|
+
return Number.isFinite(n) && n > 0 ? Math.floor(n) : a;
|
|
64
|
+
}, s = (e) => `gateway media response exceeded maxResponseBytes (${e}); it was not read further. Raise \`maxResponseBytes\` on the gateway provider config, or VOLTRO_AI_MEDIA_MAX_RESPONSE_BYTES.`, c = (e) => Response.json({ error: {
|
|
65
|
+
message: s(e),
|
|
66
|
+
type: "response_too_large"
|
|
67
|
+
} }, { status: 413 }), l = async (e, t) => {
|
|
68
|
+
let n = Number(e.headers.get("content-length"));
|
|
69
|
+
if (Number.isFinite(n) && n > t) return e.body?.cancel(), c(t);
|
|
70
|
+
if (e.body === null) return e;
|
|
71
|
+
let r = e.body.getReader(), i = [], a = 0;
|
|
72
|
+
for (;;) {
|
|
73
|
+
let { done: e, value: n } = await r.read();
|
|
74
|
+
if (e) break;
|
|
75
|
+
if (a += n.byteLength, a > t) return r.cancel(), c(t);
|
|
76
|
+
i.push(new Uint8Array(n));
|
|
77
|
+
}
|
|
78
|
+
return new Response(new Blob(i), {
|
|
79
|
+
status: e.status,
|
|
80
|
+
statusText: e.statusText,
|
|
81
|
+
headers: e.headers
|
|
82
|
+
});
|
|
83
|
+
}, u = (e, t) => ({
|
|
84
|
+
...e,
|
|
85
|
+
fetch: async (n, r) => l(await (e.fetch ?? globalThis.fetch)(n, r), t)
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export { a as DEFAULT_MEDIA_MAX_RESPONSE_BYTES, u as boundedGatewaySettings, r as gatewayImageModel, i as gatewayVideoModel, o as mediaResponseBudget, s as mediaResponseTooLargeMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,8 @@ export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
108
108
|
readonly id: Schema.String;
|
|
109
109
|
readonly name: Schema.String;
|
|
110
110
|
readonly input: Schema.Unknown;
|
|
111
|
+
/** Present when the caller must execute this pending call. */
|
|
112
|
+
readonly execution: Schema.optional<Schema.Literal<"client">>;
|
|
111
113
|
}>, Schema.Struct<{
|
|
112
114
|
readonly _tag: Schema.Literal<"toolResult">;
|
|
113
115
|
readonly id: Schema.String;
|
|
@@ -621,6 +623,8 @@ export declare interface AnyTool {
|
|
|
621
623
|
readonly output?: Schema.Top;
|
|
622
624
|
readonly execute?: (input: never) => Effect.Effect<unknown, never, unknown>;
|
|
623
625
|
readonly handler?: ToolHandler<never, unknown>;
|
|
626
|
+
/** Client tools return a pending call to the caller; never run on the server. */
|
|
627
|
+
readonly execution?: 'server' | 'client';
|
|
624
628
|
readonly timeoutMs?: number;
|
|
625
629
|
}
|
|
626
630
|
|
|
@@ -1174,6 +1178,8 @@ export declare const defineTool: <A, I, O>(def: {
|
|
|
1174
1178
|
readonly output?: Schema.Top;
|
|
1175
1179
|
readonly execute?: (input: A) => Effect.Effect<O, never, unknown>;
|
|
1176
1180
|
readonly handler?: ToolHandler<A, O>;
|
|
1181
|
+
/** Client tools return a pending call to the caller; never run on the server. */
|
|
1182
|
+
readonly execution?: "server" | "client";
|
|
1177
1183
|
readonly timeoutMs?: number;
|
|
1178
1184
|
}) => AnyTool;
|
|
1179
1185
|
|
|
@@ -1208,6 +1214,13 @@ export declare const dispatchInferences: (deps: InferenceDispatchDeps, options?:
|
|
|
1208
1214
|
*/
|
|
1209
1215
|
export declare const embed: (text: string, config?: EmbeddingProviderConfig) => Effect.Effect<ReadonlyArray<number>, AiError>;
|
|
1210
1216
|
|
|
1217
|
+
/**
|
|
1218
|
+
* The embedding provider a call without a config resolves to, and whether
|
|
1219
|
+
* anybody chose it (`AI_EMBED_PROVIDER`, declared in `defineEnv` or set).
|
|
1220
|
+
* `chosen: false` is the mock fallback.
|
|
1221
|
+
*/
|
|
1222
|
+
export declare const embeddingProviderChoice: (env?: Readonly<Record<string, string | undefined>>) => ProviderChoice;
|
|
1223
|
+
|
|
1211
1224
|
export declare interface EmbeddingProviderConfig {
|
|
1212
1225
|
readonly name: EmbeddingProviderName;
|
|
1213
1226
|
/** Model id. For 'openai': e.g. 'text-embedding-3-small'; for 'gateway' a
|
|
@@ -1231,13 +1244,24 @@ export declare interface EmbeddingProviderConfig {
|
|
|
1231
1244
|
}
|
|
1232
1245
|
|
|
1233
1246
|
/**
|
|
1234
|
-
* Read the embedding-provider config from env
|
|
1235
|
-
*
|
|
1247
|
+
* Read the embedding-provider config from env — a value declared in
|
|
1248
|
+
* `defineEnv` (its `default` included) before the raw variable:
|
|
1249
|
+
* AI_EMBED_PROVIDER=mock|openai|voyage|cohere|gateway (default: mock —
|
|
1250
|
+
* refused in production)
|
|
1236
1251
|
* AI_EMBED_MODEL=<model-id> (default per provider)
|
|
1237
1252
|
* AI_EMBED_MOCK_DIM=<n> (mock-only, default 8)
|
|
1238
1253
|
*/
|
|
1239
1254
|
export declare const embeddingProviderFromEnv: (env?: Record<string, string | undefined>) => EmbeddingProviderConfig;
|
|
1240
1255
|
|
|
1256
|
+
/**
|
|
1257
|
+
* The env var an embedding provider's SDK reads its key from, for the
|
|
1258
|
+
* providers whose SDK this package resolves by default — `openai` through
|
|
1259
|
+
* `@ai-sdk/openai`, `gateway` through `@ai-sdk/gateway`. `undefined` for the
|
|
1260
|
+
* mock, and for the optional `voyage` / `cohere` packages, whose variable the
|
|
1261
|
+
* boot gate cannot vouch for.
|
|
1262
|
+
*/
|
|
1263
|
+
export declare const embeddingProviderKeyEnvVar: (name: string) => string | undefined;
|
|
1264
|
+
|
|
1241
1265
|
export declare type EmbeddingProviderName = 'mock' | 'openai' | 'voyage' | 'cohere' | 'gateway';
|
|
1242
1266
|
|
|
1243
1267
|
/**
|
|
@@ -2504,6 +2528,7 @@ export declare type MessagePart = {
|
|
|
2504
2528
|
readonly type: 'tool';
|
|
2505
2529
|
readonly toolCallId: string;
|
|
2506
2530
|
readonly toolName: string;
|
|
2531
|
+
readonly execution?: 'client';
|
|
2507
2532
|
/** 'input-available' once the model emitted args; 'output-available' once the tool ran. */
|
|
2508
2533
|
readonly state: 'input-available' | 'output-available' | 'output-error';
|
|
2509
2534
|
readonly input?: unknown;
|
|
@@ -2851,6 +2876,22 @@ export declare interface PromptVersionRow {
|
|
|
2851
2876
|
/** Every registered version of one prompt, newest revision first. */
|
|
2852
2877
|
export declare const promptVersionsFor: (store: DataStore, promptId: string) => Effect.Effect<ReadonlyArray<PromptVersionRow>>;
|
|
2853
2878
|
|
|
2879
|
+
/** The provider a call without `provider` resolves to, and whether anybody
|
|
2880
|
+
* chose it — `useMockAi`, `AI_PROVIDER`, or the app's `defineEnv` declaration.
|
|
2881
|
+
* `chosen: false` is the mock fallback. */
|
|
2882
|
+
export declare interface ProviderChoice {
|
|
2883
|
+
readonly name: string;
|
|
2884
|
+
readonly chosen: boolean;
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
/**
|
|
2888
|
+
* Which provider is in effect. ONE resolution, exported, so the boot gate that
|
|
2889
|
+
* checks the provider's key checks the provider the calls actually use — the
|
|
2890
|
+
* gate read raw `AI_PROVIDER` while an app's declared default was the value it
|
|
2891
|
+
* meant.
|
|
2892
|
+
*/
|
|
2893
|
+
export declare const providerChoice: (env?: Readonly<Record<string, string | undefined>>) => ProviderChoice;
|
|
2894
|
+
|
|
2854
2895
|
/**
|
|
2855
2896
|
* A resolved provider choice — a DISCRIMINATED UNION on `name`. Each provider
|
|
2856
2897
|
* only carries the fields that apply to it: the mock-only `mockText` / `script`
|
|
@@ -2932,6 +2973,19 @@ export declare type ProviderConfig = {
|
|
|
2932
2973
|
*/
|
|
2933
2974
|
export declare type ProviderFallbacks = ReadonlyArray<ProviderConfig>;
|
|
2934
2975
|
|
|
2976
|
+
/**
|
|
2977
|
+
* Read the provider config. The process-global override (set by `useMockAi`)
|
|
2978
|
+
* wins over env. Otherwise honours, a value declared in `defineEnv` (its
|
|
2979
|
+
* `default` included) before the raw variable:
|
|
2980
|
+
* AI_PROVIDER=mock|anthropic|openai|gateway (default: mock — refused in
|
|
2981
|
+
* a production process, where nobody chose it)
|
|
2982
|
+
* AI_MODEL=<model-id> (default per provider: 'claude-opus-4-8' for
|
|
2983
|
+
* anthropic, 'gpt-5.5' for openai, 'mock' for mock;
|
|
2984
|
+
* REQUIRED for gateway — a `creator/model` id)
|
|
2985
|
+
*
|
|
2986
|
+
* Provider keys are read by the underlying AI SDK packages from their standard
|
|
2987
|
+
* env vars: ANTHROPIC_API_KEY, OPENAI_API_KEY, AI_GATEWAY_API_KEY.
|
|
2988
|
+
*/
|
|
2935
2989
|
export declare const providerFromEnv: (env?: Record<string, string | undefined>) => ProviderConfig;
|
|
2936
2990
|
|
|
2937
2991
|
/**
|
|
@@ -3813,6 +3867,8 @@ export declare const SeqEvent: Schema.Struct<{
|
|
|
3813
3867
|
readonly id: Schema.String;
|
|
3814
3868
|
readonly name: Schema.String;
|
|
3815
3869
|
readonly input: Schema.Unknown;
|
|
3870
|
+
/** Present when the caller must execute this pending call. */
|
|
3871
|
+
readonly execution: Schema.optional<Schema.Literal<"client">>;
|
|
3816
3872
|
}>, Schema.Struct<{
|
|
3817
3873
|
readonly _tag: Schema.Literal<"toolResult">;
|
|
3818
3874
|
readonly id: Schema.String;
|
|
@@ -4180,6 +4236,8 @@ export declare interface ToolDef<A, I, O> {
|
|
|
4180
4236
|
readonly execute?: (input: A) => Effect.Effect<O, never, unknown>;
|
|
4181
4237
|
/** File-convention body: receives `ctx`, returns Effect or Promise. */
|
|
4182
4238
|
readonly handler?: ToolHandler<A, O>;
|
|
4239
|
+
/** Client tools return a pending call to the caller; never run on the server. */
|
|
4240
|
+
readonly execution?: 'server' | 'client';
|
|
4183
4241
|
/** Per-call deadline; the tool fails with a timeout error past it. */
|
|
4184
4242
|
readonly timeoutMs?: number;
|
|
4185
4243
|
}
|