@voltro/ai 0.86.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 +5321 -0
- package/THIRD-PARTY-NOTICES.md +4725 -493
- package/dist/agentExecutor.js +42 -38
- package/dist/aiSettings.js +11 -0
- package/dist/embeddingProvider.js +39 -21
- package/dist/index.d.ts +49 -2
- package/dist/index.js +41 -41
- package/dist/provider.js +84 -68
- package/dist/resumableStream.js +1 -1
- package/dist/runAndPersist.js +46 -47
- package/package.json +6 -5
package/dist/agentExecutor.js
CHANGED
|
@@ -1,51 +1,55 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { providerFromEnv as e } from "./provider.js";
|
|
2
|
+
import { AgentThreadAccessDenied as t } from "./agent.js";
|
|
3
|
+
import { appendMessage as n, ensureThreadOwned as r, getMessages as i, getThread as a } from "./threads.js";
|
|
4
|
+
import { historyToModelMessages as o, runAssistant as s } from "./runAndPersist.js";
|
|
5
|
+
import { Effect as c } from "effect";
|
|
5
6
|
//#region src/agentExecutor.ts
|
|
6
|
-
var
|
|
7
|
-
_brand:
|
|
7
|
+
var l = "@voltro/ai/AgentExecutor", u = (e, t) => ({
|
|
8
|
+
_brand: l,
|
|
8
9
|
descriptor: e,
|
|
9
10
|
config: t
|
|
10
|
-
}),
|
|
11
|
+
}), d = (e) => typeof e == "object" && !!e && e._brand === l, f = (e, t) => {
|
|
11
12
|
let n = e.config.system;
|
|
12
13
|
if (n !== void 0) return typeof n == "function" ? n(t) : n;
|
|
13
|
-
},
|
|
14
|
+
}, p = (e, t) => {
|
|
14
15
|
let n = e.config.model;
|
|
15
16
|
return typeof n == "function" ? n(t) : n;
|
|
16
|
-
},
|
|
17
|
-
yield*
|
|
18
|
-
threadId:
|
|
19
|
-
subjectId:
|
|
20
|
-
tenantId:
|
|
17
|
+
}, m = (t, a, l) => c.gen(function* () {
|
|
18
|
+
yield* r(a, {
|
|
19
|
+
threadId: l.threadId,
|
|
20
|
+
subjectId: l.subjectId ?? null,
|
|
21
|
+
tenantId: l.tenantId ?? null
|
|
21
22
|
});
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
let u = l.promptOf ? l.promptOf(l.input) : String(l.input?.prompt ?? ""), d = f(t, l.input), m = p(t, l.input) ?? (yield* c.try({
|
|
24
|
+
try: () => e(),
|
|
25
|
+
catch: (e) => e instanceof Error ? e : Error(String(e))
|
|
26
|
+
}));
|
|
27
|
+
yield* n(a, {
|
|
28
|
+
threadId: l.threadId,
|
|
25
29
|
role: "user",
|
|
26
|
-
content:
|
|
27
|
-
tenantId:
|
|
28
|
-
order:
|
|
30
|
+
content: u,
|
|
31
|
+
tenantId: l.tenantId ?? null,
|
|
32
|
+
order: l.order
|
|
29
33
|
});
|
|
30
|
-
let
|
|
31
|
-
return yield*
|
|
32
|
-
threadId:
|
|
33
|
-
tenantId:
|
|
34
|
-
prompt:
|
|
35
|
-
...
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
|
|
39
|
-
...
|
|
40
|
-
...
|
|
41
|
-
...
|
|
42
|
-
order:
|
|
43
|
-
...
|
|
44
|
-
agent:
|
|
34
|
+
let h = yield* i(a, l.threadId), g = o(h);
|
|
35
|
+
return yield* s(a, {
|
|
36
|
+
threadId: l.threadId,
|
|
37
|
+
tenantId: l.tenantId ?? null,
|
|
38
|
+
prompt: u,
|
|
39
|
+
...g.length > 0 ? { messages: g } : {},
|
|
40
|
+
...d === void 0 ? {} : { system: d },
|
|
41
|
+
...t.config.tools === void 0 ? {} : { tools: t.config.tools },
|
|
42
|
+
provider: m,
|
|
43
|
+
...t.config.maxSteps === void 0 ? {} : { maxSteps: t.config.maxSteps },
|
|
44
|
+
...t.config.providerOptions === void 0 ? {} : { providerOptions: t.config.providerOptions },
|
|
45
|
+
...l.toolContext === void 0 ? {} : { toolContext: l.toolContext },
|
|
46
|
+
order: l.order + 1,
|
|
47
|
+
...l.throttleMs === void 0 ? {} : { throttleMs: l.throttleMs },
|
|
48
|
+
agent: t.descriptor.name
|
|
45
49
|
});
|
|
46
|
-
}),
|
|
47
|
-
let o = yield*
|
|
48
|
-
return o !== null && o.subjectId !== null && o.subjectId !==
|
|
50
|
+
}), h = (e, n, r = null) => c.gen(function* () {
|
|
51
|
+
let o = yield* a(e, n);
|
|
52
|
+
return o !== null && o.subjectId !== null && o.subjectId !== r ? yield* c.fail(new t({ threadId: n })) : yield* i(e, n);
|
|
49
53
|
});
|
|
50
54
|
//#endregion
|
|
51
|
-
export {
|
|
55
|
+
export { u as defineAgentExecutor, d as isAgentExecutor, h as loadAgentMessages, p as resolveAgentModel, f as resolveSystem, m as runAgentTurn };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readEnvValue as e } from "@voltro/env";
|
|
2
|
+
//#region src/aiSettings.ts
|
|
3
|
+
var t = (t, n) => {
|
|
4
|
+
let r = e(t);
|
|
5
|
+
if (typeof r == "string" && r !== "") return r;
|
|
6
|
+
if (typeof r == "number" || typeof r == "boolean") return String(r);
|
|
7
|
+
let i = n[t];
|
|
8
|
+
return i === void 0 || i === "" ? void 0 : i;
|
|
9
|
+
}, n = (e) => e.NODE_ENV === "production";
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as aiSetting, n as isProductionEnv };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aiSetting as e, isProductionEnv as t } from "./aiSettings.js";
|
|
2
|
+
import { createGateway as n, gateway as r } from "@ai-sdk/gateway";
|
|
2
3
|
//#region src/embeddingProvider.ts
|
|
3
|
-
var
|
|
4
|
+
var i = (e, t) => ({
|
|
4
5
|
specificationVersion: "v4",
|
|
5
6
|
provider: "mock",
|
|
6
7
|
modelId: e,
|
|
7
8
|
maxEmbeddingsPerCall: 2048,
|
|
8
9
|
supportsParallelCalls: !0,
|
|
9
10
|
doEmbed: async ({ values: e }) => ({
|
|
10
|
-
embeddings: e.map((e) =>
|
|
11
|
+
embeddings: e.map((e) => a(e, t)),
|
|
11
12
|
usage: { tokens: e.reduce((e, t) => e + t.length, 0) },
|
|
12
13
|
warnings: []
|
|
13
14
|
})
|
|
14
|
-
}),
|
|
15
|
+
}), a = (e, t) => {
|
|
15
16
|
let n = Array(t);
|
|
16
17
|
for (let r = 0; r < t; r++) {
|
|
17
18
|
let t = 2166136261 ^ r * 16777619;
|
|
@@ -19,18 +20,18 @@ var n = (e, t) => ({
|
|
|
19
20
|
n[r] = (t >>> 0) / 4294967295 * 2 - 1;
|
|
20
21
|
}
|
|
21
22
|
return n;
|
|
22
|
-
},
|
|
23
|
-
switch (
|
|
24
|
-
case "mock": return
|
|
25
|
-
case "openai": return (await
|
|
26
|
-
case "voyage": return (await
|
|
27
|
-
case "cohere": return (await
|
|
28
|
-
case "gateway": return (
|
|
29
|
-
...
|
|
30
|
-
...
|
|
31
|
-
}) :
|
|
23
|
+
}, o = async (e) => {
|
|
24
|
+
switch (e.name) {
|
|
25
|
+
case "mock": return i(e.model, e.mockDim ?? 8);
|
|
26
|
+
case "openai": return (await s("@ai-sdk/openai", "openai")).openai.textEmbeddingModel(e.model);
|
|
27
|
+
case "voyage": return (await s("voyage-ai-provider", "voyage")).voyage.textEmbeddingModel(e.model);
|
|
28
|
+
case "cohere": return (await s("@ai-sdk/cohere", "cohere")).cohere.textEmbeddingModel(e.model);
|
|
29
|
+
case "gateway": return (e.apiKey !== void 0 || e.baseURL !== void 0 ? n({
|
|
30
|
+
...e.apiKey === void 0 ? {} : { apiKey: e.apiKey },
|
|
31
|
+
...e.baseURL === void 0 ? {} : { baseURL: e.baseURL }
|
|
32
|
+
}) : r).embeddingModel(e.model);
|
|
32
33
|
}
|
|
33
|
-
},
|
|
34
|
+
}, s = async (e, t) => {
|
|
34
35
|
try {
|
|
35
36
|
return await import(
|
|
36
37
|
/* @vite-ignore */
|
|
@@ -39,13 +40,30 @@ var n = (e, t) => ({
|
|
|
39
40
|
} catch {
|
|
40
41
|
throw Error(`embedding provider '${t}' needs the '${e}' package — install it (pnpm add ${e}) or use AI_EMBED_PROVIDER=mock for tests/demos.`);
|
|
41
42
|
}
|
|
42
|
-
},
|
|
43
|
-
|
|
43
|
+
}, c = (e) => {
|
|
44
|
+
switch (e.toLowerCase()) {
|
|
45
|
+
case "openai": return "OPENAI_API_KEY";
|
|
46
|
+
case "gateway": return "AI_GATEWAY_API_KEY";
|
|
47
|
+
default: return;
|
|
48
|
+
}
|
|
49
|
+
}, l = (t = process.env) => {
|
|
50
|
+
let n = e("AI_EMBED_PROVIDER", t);
|
|
51
|
+
return n === void 0 ? {
|
|
52
|
+
name: "mock",
|
|
53
|
+
chosen: !1
|
|
54
|
+
} : {
|
|
55
|
+
name: n.toLowerCase(),
|
|
56
|
+
chosen: !0
|
|
57
|
+
};
|
|
58
|
+
}, u = (n = process.env) => {
|
|
59
|
+
let r = l(n);
|
|
60
|
+
if (!r.chosen && t(n)) throw Error("No embedding provider is chosen in this production process: AI_EMBED_PROVIDER is unset and this call passes no config, so it would embed with the mock provider, whose vectors carry no meaning. Set AI_EMBED_PROVIDER (openai | voyage | cohere | gateway) for every process that embeds, or declare it in `defineEnv` with a `default`, or pass a config to the call. Set AI_EMBED_PROVIDER=mock to embed with the mock deliberately.");
|
|
61
|
+
let i = r.name, a = i === "openai" ? "text-embedding-3-small" : i === "voyage" ? "voyage-3" : i === "cohere" ? "embed-english-v3.0" : i === "gateway" ? "openai/text-embedding-3-small" : "mock", o = e("AI_EMBED_MODEL", n) ?? a, s = e("AI_EMBED_MOCK_DIM", n), c = s === void 0 ? void 0 : Number(s);
|
|
44
62
|
return {
|
|
45
|
-
name:
|
|
46
|
-
model:
|
|
47
|
-
...
|
|
63
|
+
name: i,
|
|
64
|
+
model: o,
|
|
65
|
+
...c !== void 0 && Number.isFinite(c) ? { mockDim: c } : {}
|
|
48
66
|
};
|
|
49
67
|
};
|
|
50
68
|
//#endregion
|
|
51
|
-
export {
|
|
69
|
+
export { l as embeddingProviderChoice, u as embeddingProviderFromEnv, c as embeddingProviderKeyEnvVar, a as hashToVector, o as resolveEmbeddingModel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1214,6 +1214,13 @@ export declare const dispatchInferences: (deps: InferenceDispatchDeps, options?:
|
|
|
1214
1214
|
*/
|
|
1215
1215
|
export declare const embed: (text: string, config?: EmbeddingProviderConfig) => Effect.Effect<ReadonlyArray<number>, AiError>;
|
|
1216
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
|
+
|
|
1217
1224
|
export declare interface EmbeddingProviderConfig {
|
|
1218
1225
|
readonly name: EmbeddingProviderName;
|
|
1219
1226
|
/** Model id. For 'openai': e.g. 'text-embedding-3-small'; for 'gateway' a
|
|
@@ -1237,13 +1244,24 @@ export declare interface EmbeddingProviderConfig {
|
|
|
1237
1244
|
}
|
|
1238
1245
|
|
|
1239
1246
|
/**
|
|
1240
|
-
* Read the embedding-provider config from env
|
|
1241
|
-
*
|
|
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)
|
|
1242
1251
|
* AI_EMBED_MODEL=<model-id> (default per provider)
|
|
1243
1252
|
* AI_EMBED_MOCK_DIM=<n> (mock-only, default 8)
|
|
1244
1253
|
*/
|
|
1245
1254
|
export declare const embeddingProviderFromEnv: (env?: Record<string, string | undefined>) => EmbeddingProviderConfig;
|
|
1246
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
|
+
|
|
1247
1265
|
export declare type EmbeddingProviderName = 'mock' | 'openai' | 'voyage' | 'cohere' | 'gateway';
|
|
1248
1266
|
|
|
1249
1267
|
/**
|
|
@@ -2858,6 +2876,22 @@ export declare interface PromptVersionRow {
|
|
|
2858
2876
|
/** Every registered version of one prompt, newest revision first. */
|
|
2859
2877
|
export declare const promptVersionsFor: (store: DataStore, promptId: string) => Effect.Effect<ReadonlyArray<PromptVersionRow>>;
|
|
2860
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
|
+
|
|
2861
2895
|
/**
|
|
2862
2896
|
* A resolved provider choice — a DISCRIMINATED UNION on `name`. Each provider
|
|
2863
2897
|
* only carries the fields that apply to it: the mock-only `mockText` / `script`
|
|
@@ -2939,6 +2973,19 @@ export declare type ProviderConfig = {
|
|
|
2939
2973
|
*/
|
|
2940
2974
|
export declare type ProviderFallbacks = ReadonlyArray<ProviderConfig>;
|
|
2941
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
|
+
*/
|
|
2942
2989
|
export declare const providerFromEnv: (env?: Record<string, string | undefined>) => ProviderConfig;
|
|
2943
2990
|
|
|
2944
2991
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { applyMiddleware as e, clearAiMiddleware as t, defaultSettingsMiddleware as n, extractReasoningMiddleware as r, getAiMiddleware as i, loggingMiddleware as a, setAiMiddleware as o, simulateStreamingMiddleware as s } from "./middleware.js";
|
|
2
|
-
import { MockScript as c, getProviderOverride as l,
|
|
3
|
-
import { buildSdkTools as
|
|
4
|
-
import { AI_BUDGET_RESERVATIONS_TABLE as
|
|
5
|
-
import { AI_USAGE_TABLE as
|
|
6
|
-
import { aiCallAttributes as
|
|
7
|
-
import { AiCallEvidenceSchema as
|
|
8
|
-
import { AiError as
|
|
9
|
-
import { BUILTIN_SPEECH_PROVIDERS as
|
|
10
|
-
import { generateImage as
|
|
11
|
-
import { transcribe as
|
|
12
|
-
import { TranscriptionStreamError as
|
|
13
|
-
import { streamTranscribe as
|
|
14
|
-
import { RealtimeClientEvent as
|
|
15
|
-
import { defineRealtimeSession as
|
|
16
|
-
import { BUILTIN_MEDIA_PROVIDERS as
|
|
17
|
-
import { AgentErrorCode as
|
|
18
|
-
import { agentActor as
|
|
19
|
-
import { activeStreamCount as
|
|
20
|
-
import { streamText as
|
|
21
|
-
import { DEFAULT_STREAM_LOG_RETENTION_HOURS as
|
|
22
|
-
import { AGENT_MESSAGES_TABLE as
|
|
23
|
-
import { AgentThreadAccessDenied as
|
|
24
|
-
import { agentMessagesTable as
|
|
25
|
-
import { appendStreamingMessage as
|
|
26
|
-
import { defineAgentExecutor as
|
|
27
|
-
import { embeddingProviderFromEnv as
|
|
28
|
-
import { cosineSimilarity as
|
|
29
|
-
import { recordReads as
|
|
30
|
-
import { rerank as
|
|
31
|
-
import { retrieveReranked as
|
|
32
|
-
import { DEFAULT_PROMPT_RETENTION_HOURS as
|
|
33
|
-
import { MCP_BOUNDS_DEFAULTS as
|
|
34
|
-
import { describeExternalTool as
|
|
35
|
-
import { DEFAULT_JUDGE_THRESHOLD as
|
|
36
|
-
import { capabilitiesOf as
|
|
37
|
-
import { fromRaw as
|
|
38
|
-
import { MODALITY_PRIMITIVE as
|
|
39
|
-
import { COPILOT_MAX_LIMIT as
|
|
40
|
-
import { AI_INFERENCES_TABLE as
|
|
41
|
-
import { DEFAULT_INFERENCE_CONCURRENCY as
|
|
42
|
-
export {
|
|
2
|
+
import { MockScript as c, getProviderOverride as l, providerChoice as u, providerFromEnv as d, providerKeyEnvVar as f, resolveImageModel as p, resolveModel as m, resolveSpeechModel as h, resolveTranscriptionModel as g, resolveVideoModel as _, setProviderOverride as v } from "./provider.js";
|
|
3
|
+
import { buildSdkTools as y, defineTool as b, isTool as x, resolveToolModuleHandlers as S } from "./tools.js";
|
|
4
|
+
import { AI_BUDGET_RESERVATIONS_TABLE as C, AI_BUDGET_TABLE as w, AiBudgetExceeded as T, AiBudgetInvalidInput as E, AiBudgetReservationConflict as D, aiBudgetReservationsTable as O, aiBudgetTable as k, releaseAiBudget as A, requireAiBudget as j } from "./budget.js";
|
|
5
|
+
import { AI_USAGE_TABLE as M, AiUsageLedgerError as N, AiUsageReceiptConflict as P, MODEL_PRICING_DEFAULTS as F, aiSpendUsd as I, aiUsageTable as L, estimateCostUsd as R, gatewayCostUsd as z, isMeteredUsage as B, modelPricing as V, normaliseUsage as H, priceForModel as U, recordAiUsage as W, recordAiUsageBestEffort as G, setModelPricing as K } from "./cost.js";
|
|
6
|
+
import { aiCallAttributes as q, observeStream as J, withAiCallSpan as Y } from "./observe.js";
|
|
7
|
+
import { AiCallEvidenceSchema as X } from "./callEvidence.js";
|
|
8
|
+
import { AiError as Z, AiService as Q, aiGenerationError as $, defaultAiService as ee, generateObject as te, generateObjectJson as ne, generateObjectWithTools as re, generateText as ie, outputJsonSchema as ae } from "./api.js";
|
|
9
|
+
import { BUILTIN_SPEECH_PROVIDERS as oe, clearSpeechProviders as se, registerSpeechProvider as ce, registeredSpeechProviders as le, replacesBuiltinSpeechProvider as ue, speechProvider as de } from "./speechProvider.js";
|
|
10
|
+
import { generateImage as fe, generateSpeech as pe, generateVideo as me } from "./media.js";
|
|
11
|
+
import { transcribe as he } from "./transcribe.js";
|
|
12
|
+
import { TranscriptionStreamError as ge, TranscriptionStreamEvent as _e } from "./transcriptionEvent.js";
|
|
13
|
+
import { streamTranscribe as ve } from "./streamTranscribe.js";
|
|
14
|
+
import { RealtimeClientEvent as ye, RealtimeServerEvent as be } from "./realtimeEvent.js";
|
|
15
|
+
import { defineRealtimeSession as xe, resolveRealtimeModel as Se } from "./realtimeSession.js";
|
|
16
|
+
import { BUILTIN_MEDIA_PROVIDERS as Ce, clearMediaTaskProviders as we, mediaTaskProvider as Te, registerMediaTaskProvider as Ee, registeredMediaTaskProviders as De } from "./mediaTaskProvider.js";
|
|
17
|
+
import { AgentErrorCode as Oe, AgentEvent as ke, SeqEvent as Ae } from "./events.js";
|
|
18
|
+
import { agentActor as je, appToolDecision as Me, appTools as Ne, passesPolicy as Pe, synthesizeToolSpecs as Fe } from "./appTools.js";
|
|
19
|
+
import { activeStreamCount as Ie, cancelStream as Le, isStreamActive as Re, registerStream as ze, unregisterStream as Be } from "./streamRegistry.js";
|
|
20
|
+
import { streamText as Ve, streamTextWithFallback as He, streamTextWithRetry as Ue } from "./streamText.js";
|
|
21
|
+
import { DEFAULT_STREAM_LOG_RETENTION_HOURS as We, STREAM_EVENTS_TABLE as Ge, STREAM_STATE_TABLE as Ke, consumeResumableStream as qe, dataStoreResumableStreamStore as Je, gcResumableStreams as Ye, memoryResumableStreamStore as Xe, redisResumableStreamStore as Ze, resumableStream as Qe, resumableStreamText as $e, startResumableProducer as et, streamEventsTable as tt, streamStateTable as nt } from "./resumableStream.js";
|
|
22
|
+
import { AGENT_MESSAGES_TABLE as rt, AGENT_THREADS_TABLE as it } from "./agentConstants.js";
|
|
23
|
+
import { AgentThreadAccessDenied as at, agentInputSchema as ot, agentMessageSchema as st, agentRouteDescriptors as ct, defineAgent as lt, isAgentDescriptor as ut } from "./agent.js";
|
|
24
|
+
import { agentMessagesTable as dt, agentThreadsTable as ft, appendMessage as pt, createThread as mt, ensureThreadOwned as ht, getMessages as gt, getThread as _t } from "./threads.js";
|
|
25
|
+
import { appendStreamingMessage as vt, historyToModelMessages as yt, patchStreamingMessage as bt, runAssistant as xt } from "./runAndPersist.js";
|
|
26
|
+
import { defineAgentExecutor as St, isAgentExecutor as Ct, loadAgentMessages as wt, resolveAgentModel as Tt, resolveSystem as Et, runAgentTurn as Dt } from "./agentExecutor.js";
|
|
27
|
+
import { embeddingProviderChoice as Ot, embeddingProviderFromEnv as kt, embeddingProviderKeyEnvVar as At, hashToVector as jt, resolveEmbeddingModel as Mt } from "./embeddingProvider.js";
|
|
28
|
+
import { cosineSimilarity as Nt, embed as Pt, embedMany as Ft } from "./embed.js";
|
|
29
|
+
import { recordReads as It, semanticGenerateObject as Lt, semanticGenerateText as Rt } from "./semanticCache.js";
|
|
30
|
+
import { rerank as zt } from "./rerank.js";
|
|
31
|
+
import { retrieveReranked as Bt } from "./retrieveReranked.js";
|
|
32
|
+
import { DEFAULT_PROMPT_RETENTION_HOURS as Vt, PROMPTS_TABLE as Ht, PromptRenderError as Ut, definePrompt as Wt, isRenderedPrompt as Gt, promptDigest as Kt, promptVersionByDigest as qt, promptVersionDigest as Jt, promptVersionsFor as Yt, promptsTable as Xt, recordPromptVersion as Zt } from "./prompts.js";
|
|
33
|
+
import { MCP_BOUNDS_DEFAULTS as Qt, MCP_CLIENT_INFO as $t, MCP_CLIENT_PROTOCOL_VERSION as en, McpError as tn, flattenMcpContent as nn, httpMcpTransport as rn, isUsableMcpToolName as an, mcpCallTool as on, mcpInitialize as sn, mcpListTools as cn, parseHttpMcpBody as ln, resolveMcpBounds as un, sanitizeExternalText as dn, sanitizeInputSchema as fn, stdioMcpTransport as pn } from "./mcpClient.js";
|
|
34
|
+
import { describeExternalTool as mn, isExternalWrite as hn, makeMcpTool as gn, mcpToolDecision as _n, mcpToolTag as vn, mcpTools as yn, mcpToolset as bn, refreshMcpToolset as xn } from "./mcpTools.js";
|
|
35
|
+
import { DEFAULT_JUDGE_THRESHOLD as Sn, defineEval as Cn, evaluateAssertions as wn, isEvalDefinition as Tn, llmJudge as En, runEval as Dn, scoreCase as On } from "./eval.js";
|
|
36
|
+
import { capabilitiesOf as kn, contextWindowOf as An, dataPolicyOf as jn, knowledgeCutoffOf as Mn, maxOutputTokensOf as Nn, modalitiesOf as Pn, modalityOf as Fn, releasedAtOf as In } from "./gatewayCatalog.js";
|
|
37
|
+
import { fromRaw as Ln, getAvailableModels as Rn, readGatewayCatalog as zn, toModelInfo as Bn } from "./gateway.js";
|
|
38
|
+
import { MODALITY_PRIMITIVE as Vn, canExecute as Hn, executableModalities as Un } from "./executableModalities.js";
|
|
39
|
+
import { COPILOT_MAX_LIMIT as Wn, CopilotProposalSchema as Gn, CopilotRejected as Kn, buildCopilotSystemPrompt as qn, runDataCopilot as Jn, validateCopilotProposal as Yn } from "./copilot.js";
|
|
40
|
+
import { AI_INFERENCES_TABLE as Xn, DEFAULT_INFERENCE_ATTEMPTS as Zn, DEFAULT_INFERENCE_LEASE_MS as Qn, aiInferencesTable as $n, decideInferenceFailure as er, inferenceSignalName as tr, offloadedInferenceId as nr, toQueuedInference as rr } from "./inferenceQueue.js";
|
|
41
|
+
import { DEFAULT_INFERENCE_CONCURRENCY as ir, DEFAULT_INFERENCE_POLL_MS as ar, DEFAULT_INFERENCE_RETENTION_HOURS as or, dispatchInferences as sr } from "./inferenceDispatch.js";
|
|
42
|
+
export { rt as AGENT_MESSAGES_TABLE, it as AGENT_THREADS_TABLE, C as AI_BUDGET_RESERVATIONS_TABLE, w as AI_BUDGET_TABLE, Xn as AI_INFERENCES_TABLE, M as AI_USAGE_TABLE, Oe as AgentErrorCode, ke as AgentEvent, at as AgentThreadAccessDenied, T as AiBudgetExceeded, E as AiBudgetInvalidInput, D as AiBudgetReservationConflict, X as AiCallEvidenceSchema, Z as AiError, Q as AiService, N as AiUsageLedgerError, P as AiUsageReceiptConflict, Ce as BUILTIN_MEDIA_PROVIDERS, oe as BUILTIN_SPEECH_PROVIDERS, Wn as COPILOT_MAX_LIMIT, Gn as CopilotProposalSchema, Kn as CopilotRejected, Zn as DEFAULT_INFERENCE_ATTEMPTS, ir as DEFAULT_INFERENCE_CONCURRENCY, Qn as DEFAULT_INFERENCE_LEASE_MS, ar as DEFAULT_INFERENCE_POLL_MS, or as DEFAULT_INFERENCE_RETENTION_HOURS, Sn as DEFAULT_JUDGE_THRESHOLD, Vt as DEFAULT_PROMPT_RETENTION_HOURS, We as DEFAULT_STREAM_LOG_RETENTION_HOURS, Qt as MCP_BOUNDS_DEFAULTS, $t as MCP_CLIENT_INFO, en as MCP_CLIENT_PROTOCOL_VERSION, Vn as MODALITY_PRIMITIVE, F as MODEL_PRICING_DEFAULTS, tn as McpError, c as MockScript, Ht as PROMPTS_TABLE, Ut as PromptRenderError, ye as RealtimeClientEvent, be as RealtimeServerEvent, Ge as STREAM_EVENTS_TABLE, Ke as STREAM_STATE_TABLE, Ae as SeqEvent, ge as TranscriptionStreamError, _e as TranscriptionStreamEvent, Ie as activeStreamCount, je as agentActor, ot as agentInputSchema, st as agentMessageSchema, dt as agentMessagesTable, ct as agentRouteDescriptors, ft as agentThreadsTable, O as aiBudgetReservationsTable, k as aiBudgetTable, q as aiCallAttributes, $ as aiGenerationError, $n as aiInferencesTable, I as aiSpendUsd, L as aiUsageTable, Me as appToolDecision, Ne as appTools, pt as appendMessage, vt as appendStreamingMessage, e as applyMiddleware, qn as buildCopilotSystemPrompt, y as buildSdkTools, Hn as canExecute, Le as cancelStream, kn as capabilitiesOf, t as clearAiMiddleware, we as clearMediaTaskProviders, se as clearSpeechProviders, qe as consumeResumableStream, An as contextWindowOf, Nt as cosineSimilarity, mt as createThread, jn as dataPolicyOf, Je as dataStoreResumableStreamStore, er as decideInferenceFailure, ee as defaultAiService, n as defaultSettingsMiddleware, lt as defineAgent, St as defineAgentExecutor, Cn as defineEval, Wt as definePrompt, xe as defineRealtimeSession, b as defineTool, mn as describeExternalTool, sr as dispatchInferences, Pt as embed, Ft as embedMany, Ot as embeddingProviderChoice, kt as embeddingProviderFromEnv, At as embeddingProviderKeyEnvVar, ht as ensureThreadOwned, R as estimateCostUsd, wn as evaluateAssertions, Un as executableModalities, r as extractReasoningMiddleware, nn as flattenMcpContent, Ln as fromRaw, z as gatewayCostUsd, Ye as gcResumableStreams, fe as generateImage, te as generateObject, ne as generateObjectJson, re as generateObjectWithTools, pe as generateSpeech, ie as generateText, me as generateVideo, i as getAiMiddleware, Rn as getAvailableModels, gt as getMessages, l as getProviderOverride, _t as getThread, jt as hashToVector, yt as historyToModelMessages, rn as httpMcpTransport, tr as inferenceSignalName, ut as isAgentDescriptor, Ct as isAgentExecutor, Tn as isEvalDefinition, hn as isExternalWrite, B as isMeteredUsage, Gt as isRenderedPrompt, Re as isStreamActive, x as isTool, an as isUsableMcpToolName, Mn as knowledgeCutoffOf, En as llmJudge, wt as loadAgentMessages, a as loggingMiddleware, gn as makeMcpTool, Nn as maxOutputTokensOf, on as mcpCallTool, sn as mcpInitialize, cn as mcpListTools, _n as mcpToolDecision, vn as mcpToolTag, yn as mcpTools, bn as mcpToolset, Te as mediaTaskProvider, Xe as memoryResumableStreamStore, Pn as modalitiesOf, Fn as modalityOf, V as modelPricing, H as normaliseUsage, J as observeStream, nr as offloadedInferenceId, ae as outputJsonSchema, ln as parseHttpMcpBody, Pe as passesPolicy, bt as patchStreamingMessage, U as priceForModel, Kt as promptDigest, qt as promptVersionByDigest, Jt as promptVersionDigest, Yt as promptVersionsFor, Xt as promptsTable, u as providerChoice, d as providerFromEnv, f as providerKeyEnvVar, zn as readGatewayCatalog, W as recordAiUsage, G as recordAiUsageBestEffort, Zt as recordPromptVersion, It as recordReads, Ze as redisResumableStreamStore, xn as refreshMcpToolset, Ee as registerMediaTaskProvider, ce as registerSpeechProvider, ze as registerStream, De as registeredMediaTaskProviders, le as registeredSpeechProviders, A as releaseAiBudget, In as releasedAtOf, ue as replacesBuiltinSpeechProvider, j as requireAiBudget, zt as rerank, Tt as resolveAgentModel, Mt as resolveEmbeddingModel, p as resolveImageModel, un as resolveMcpBounds, m as resolveModel, Se as resolveRealtimeModel, h as resolveSpeechModel, Et as resolveSystem, S as resolveToolModuleHandlers, g as resolveTranscriptionModel, _ as resolveVideoModel, Qe as resumableStream, $e as resumableStreamText, Bt as retrieveReranked, Dt as runAgentTurn, xt as runAssistant, Jn as runDataCopilot, Dn as runEval, dn as sanitizeExternalText, fn as sanitizeInputSchema, On as scoreCase, Lt as semanticGenerateObject, Rt as semanticGenerateText, o as setAiMiddleware, K as setModelPricing, v as setProviderOverride, s as simulateStreamingMiddleware, de as speechProvider, et as startResumableProducer, pn as stdioMcpTransport, tt as streamEventsTable, nt as streamStateTable, Ve as streamText, He as streamTextWithFallback, Ue as streamTextWithRetry, ve as streamTranscribe, Fe as synthesizeToolSpecs, Bn as toModelInfo, rr as toQueuedInference, he as transcribe, Be as unregisterStream, Yn as validateCopilotProposal, Y as withAiCallSpan };
|