@vite-hub/gateways 0.5.0 → 0.5.1
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/ai-sdk.d.ts +2 -3
- package/dist/ai-sdk.js +3 -4
- package/dist/{definition-BQbaNIoi.js → definition-IHIWW_eG.js} +2 -3
- package/dist/{diagnostics-KWRXsfZ3.js → diagnostics-CNIdO5-M.js} +2 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -6
- package/dist/internal.d.ts +2 -6
- package/dist/internal.js +3 -3
- package/dist/{jev-BI0dIeB8.js → jev-Kmwvxt8l.js} +2 -3
- package/dist/{presets-C7I0uIZc.js → presets-BowIdgYT.js} +6 -9
- package/dist/{presets-xSYbZBJS.d.ts → presets-CmCCGdfk.d.ts} +1 -9
- package/dist/testing.d.ts +2 -3
- package/dist/testing.js +3 -4
- package/dist/{types-CYigOOA5.d.ts → types-jSw-t3Dq.d.ts} +0 -6
- package/package.json +9 -9
package/dist/ai-sdk.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { o as AiGatewayCapabilities, t as AiGateway, u as AiGatewayRoute } from "./types-
|
|
1
|
+
import { o as AiGatewayCapabilities, t as AiGateway, u as AiGatewayRoute } from "./types-jSw-t3Dq.js";
|
|
2
2
|
import { LanguageModelV4 } from "@ai-sdk/provider";
|
|
3
|
-
//#region src/ai-sdk.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The model APIs that `languageModel()` can call, for the routes of a gateway:
|
|
6
5
|
* - `chat`: OpenAI Chat Completions at the `openai-compatible` URL, with `@ai-sdk/openai-compatible`. The `openai()`
|
|
@@ -33,4 +32,4 @@ export declare function languageModel<const TRoutes extends AiGatewayRoute, cons
|
|
|
33
32
|
apis: TApis;
|
|
34
33
|
routes: TRoutes;
|
|
35
34
|
}> & ServesModels<TRoutes>, modelId: string, options?: AiGatewayLanguageModelOptions<Extract<AiGatewayModelApi<TRoutes>, NoInfer<TApis>>>): LanguageModelV4;
|
|
36
|
-
|
|
35
|
+
export {};
|
package/dist/ai-sdk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { c as isRecord, i as aiGatewayOpenAIChat, n as aiGatewayLanguageModel, o as aiGatewayStructuredOutputs, s as aiGatewaySupports, u as resolveAiGatewayModelRoute } from "./definition-IHIWW_eG.js";
|
|
2
|
+
import { t as gatewayDiagnostics } from "./diagnostics-CNIdO5-M.js";
|
|
3
|
+
// src/ai-sdk.ts
|
|
4
4
|
const packages = {
|
|
5
5
|
"chat": "@ai-sdk/openai-compatible",
|
|
6
6
|
"messages": "@ai-sdk/anthropic",
|
|
@@ -153,5 +153,4 @@ function languageModel(gateway, modelId, options = {}) {
|
|
|
153
153
|
});
|
|
154
154
|
return Object.defineProperty(languageModel, aiGatewayLanguageModel, { value: modelRoute });
|
|
155
155
|
}
|
|
156
|
-
//#endregion
|
|
157
156
|
export { languageModel };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as gatewayDiagnostics } from "./diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as gatewayDiagnostics } from "./diagnostics-CNIdO5-M.js";
|
|
2
|
+
// src/definition.ts
|
|
3
3
|
const gatewayKeys = /* @__PURE__ */ new Set([
|
|
4
4
|
"apiKey",
|
|
5
5
|
"apiKeyEnv",
|
|
@@ -203,5 +203,4 @@ async function resolveAiGatewayModelRoute(gateway, route, context) {
|
|
|
203
203
|
headers
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
|
-
//#endregion
|
|
207
206
|
export { aiGatewayOptionalCredentials as a, isRecord as c, resolveAiGatewayRoute as d, resolveAiGatewaySecret as f, aiGatewayOpenAIChat as i, normalizeAiGateway as l, aiGatewayLanguageModel as n, aiGatewayStructuredOutputs as o, aiGatewayModelCredentials as r, aiGatewaySupports as s, aiGatewayAsks as t, resolveAiGatewayModelRoute as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
|
-
|
|
2
|
+
// src/public-diagnostics.ts
|
|
3
3
|
const publicCodes = /* @__PURE__ */ new Set([
|
|
4
4
|
"GATEWAYS_R0002",
|
|
5
5
|
"GATEWAYS_R0006",
|
|
@@ -18,8 +18,7 @@ function recordPublicAiGatewayDiagnostic(diagnostic) {
|
|
|
18
18
|
function getPublicAiGatewayDiagnostic(cause) {
|
|
19
19
|
return cause instanceof Error ? publicDiagnostics.get(cause) : void 0;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
//#region src/diagnostics.ts
|
|
21
|
+
// src/diagnostics.ts
|
|
23
22
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
24
23
|
const gatewayDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
25
24
|
docsBase: "https://vitehub.dev/docs/gateways/diagnostics",
|
|
@@ -119,5 +118,4 @@ const gatewayDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
});
|
|
122
|
-
//#endregion
|
|
123
121
|
export { getPublicAiGatewayDiagnostic as n, gatewayDiagnostics as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { A as
|
|
1
|
+
import { A as chatgpt, D as aiGatewayEnv, S as vercel, _ as litellm, a as CloudflareAccessOptions, b as openrouter, c as TypesafeGatewayOptions, f as cliproxy, g as emulate, h as defineAiGateway, i as AiModelGateway, k as ChatGPTGateway, l as VercelGatewayOptions, m as cloudflareAccess, n as AiGatewayPresetOptions, o as CloudflareGatewayOptions, p as cloudflare, r as AiHostedGatewayOptions, s as EmulateGatewayOptions, t as AiAskGatewayOptions, u as anthropic, v as ollama, w as AiGatewayEnvField, x as typesafe, y as openai } from "./presets-CmCCGdfk.js";
|
|
2
|
+
import { A as AskScoreAnswer, B as askWithModel, C as AskChoiceLabels, D as AskJson, E as AskIfQuestion, F as AskError, I as AskModel, L as AskOptions, M as AskScoreQuestion, N as AskSwitchQuestion, O as AskQuestion, P as ask, R as AskResult, S as AskChoiceCriteria, T as AskEntry, _ as AskAnswers, a as AiGatewayAskResult, b as AskChanceQuestion, c as AiGatewayDefinition, d as AiGatewaySealedSecret, f as AiGatewaySecret, g as AskAnswerType, h as AskAnswer, i as AiGatewayAskOptions, j as AskScoreCriteria, k as AskQuestions, l as AiGatewayDriver, m as AiGatewayValue, n as AiGatewayAsk, o as AiGatewayCapabilities, p as AiGatewayUsage, r as AiGatewayAskError, s as AiGatewayContext, t as AiGateway, u as AiGatewayRoute, v as AskChanceAnswer, w as AskChoiceQuestion, x as AskChoiceAnswer, y as AskChanceCriteria, z as AskSchema } from "./types-jSw-t3Dq.js";
|
|
3
3
|
export { type AiAskGatewayOptions, type AiGateway, type AiGatewayAsk, type AiGatewayAskError, type AiGatewayAskOptions, type AiGatewayAskResult, type AiGatewayCapabilities, type AiGatewayContext, type AiGatewayDefinition, type AiGatewayDriver, type AiGatewayEnvField, type AiGatewayPresetOptions, type AiGatewayRoute, type AiGatewaySealedSecret, type AiGatewaySecret, type AiGatewayUsage, type AiGatewayValue, type AiHostedGatewayOptions, type AiModelGateway, type AskAnswer, type AskAnswerType, type AskAnswers, type AskChanceAnswer, type AskChanceCriteria, type AskChanceQuestion, type AskChoiceAnswer, type AskChoiceCriteria, type AskChoiceLabels, type AskChoiceQuestion, type AskEntry, type AskError, type AskIfQuestion, type AskJson, type AskModel, type AskOptions, type AskQuestion, type AskQuestions, type AskResult, type AskSchema, type AskScoreAnswer, type AskScoreCriteria, type AskScoreQuestion, type AskSwitchQuestion, type ChatGPTGateway, type CloudflareAccessOptions, type CloudflareGatewayOptions, type EmulateGatewayOptions, type TypesafeGatewayOptions, type VercelGatewayOptions, aiGatewayEnv, anthropic, ask, askWithModel, chatgpt, cliproxy, cloudflare, cloudflareAccess, defineAiGateway, emulate, litellm, ollama, openai, openrouter, typesafe, vercel };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { a as cloudflareAccess, c as litellm, d as openrouter, f as typesafe, g as chatgpt, i as cloudflare, l as ollama, m as aiGatewayEnv, o as defineAiGateway, p as vercel, r as cliproxy, s as emulate, t as anthropic, u as openai } from "./presets-BowIdgYT.js";
|
|
2
|
+
import { t as gatewayDiagnostics } from "./diagnostics-CNIdO5-M.js";
|
|
3
|
+
// src/ask-model.ts
|
|
4
4
|
async function loadAi(caller = "askWithModel()") {
|
|
5
5
|
try {
|
|
6
6
|
return await import("ai");
|
|
@@ -247,8 +247,7 @@ async function askOnce(prompt, options) {
|
|
|
247
247
|
if (schema === void 0 && !data) return [gatewayDiagnostics.GATEWAYS_ASK_OUTPUT_INVALID({ finishReason: result.finishReason }), void 0];
|
|
248
248
|
return [void 0, data];
|
|
249
249
|
}
|
|
250
|
-
|
|
251
|
-
//#region src/ask.ts
|
|
250
|
+
// src/ask.ts
|
|
252
251
|
function isLabels(criteria) {
|
|
253
252
|
return Array.isArray(criteria);
|
|
254
253
|
}
|
|
@@ -331,5 +330,4 @@ const ask = Object.assign(askOnce, {
|
|
|
331
330
|
score,
|
|
332
331
|
switch: askSwitch
|
|
333
332
|
});
|
|
334
|
-
//#endregion
|
|
335
333
|
export { aiGatewayEnv, anthropic, ask, askWithModel, chatgpt, cliproxy, cloudflare, cloudflareAccess, defineAiGateway, emulate, litellm, ollama, openai, openrouter, typesafe, vercel };
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { c as AiGatewayDefinition, f as AiGatewaySecret, s as AiGatewayContext, u as AiGatewayRoute } from "./types-
|
|
2
|
-
import { C as AiGatewayTraceEvent, E as AiGatewayEnvPreset, O as aiGatewayEnvNames, T as AiGatewayEnvFieldName, d as askAiGateway, j as isChatGPTGateway } from "./presets-
|
|
1
|
+
import { c as AiGatewayDefinition, f as AiGatewaySecret, s as AiGatewayContext, u as AiGatewayRoute } from "./types-jSw-t3Dq.js";
|
|
2
|
+
import { C as AiGatewayTraceEvent, E as AiGatewayEnvPreset, O as aiGatewayEnvNames, T as AiGatewayEnvFieldName, d as askAiGateway, j as isChatGPTGateway } from "./presets-CmCCGdfk.js";
|
|
3
3
|
import { Diagnostic } from "nostics";
|
|
4
|
-
//#region src/definition.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Marks an AI gateway that answers Jev questions. A symbol key, so key checks and copies skip it. Such a gateway may
|
|
7
6
|
* have no model API base URL.
|
|
@@ -42,12 +41,9 @@ export declare function resolveAiGatewayRoute(gateway: AiGatewayDefinition, rout
|
|
|
42
41
|
* its optional headers, but not without all of them.
|
|
43
42
|
*/
|
|
44
43
|
export declare function resolveAiGatewayModelRoute(gateway: AiGatewayDefinition, route: AiGatewayRoute, context: AiGatewayContext): Promise<AiGatewayModelRoute>;
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/public-diagnostics.d.ts
|
|
47
44
|
/** Client-safe text captured when this package creates a known gateway diagnostic. */
|
|
48
45
|
export declare function getPublicAiGatewayDiagnostic(cause: unknown): {
|
|
49
46
|
message: string;
|
|
50
47
|
fix?: string;
|
|
51
48
|
} | undefined;
|
|
52
|
-
//#endregion
|
|
53
49
|
export { type AiGatewayEnvFieldName, type AiGatewayEnvPreset, type AiGatewayLanguageModelRoute, type AiGatewayModelRoute, type AiGatewayResolvedRoute, type AiGatewayTraceEvent, aiGatewayEnvNames, askAiGateway, isChatGPTGateway };
|
package/dist/internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { d as resolveAiGatewayRoute, f as resolveAiGatewaySecret, l as normalizeAiGateway, n as aiGatewayLanguageModel, s as aiGatewaySupports, t as aiGatewayAsks, u as resolveAiGatewayModelRoute } from "./definition-IHIWW_eG.js";
|
|
2
|
+
import { _ as isChatGPTGateway, h as aiGatewayEnvNames, n as askAiGateway } from "./presets-BowIdgYT.js";
|
|
3
|
+
import { n as getPublicAiGatewayDiagnostic } from "./diagnostics-CNIdO5-M.js";
|
|
4
4
|
export { aiGatewayAsks, aiGatewayEnvNames, aiGatewayLanguageModel, aiGatewaySupports, askAiGateway, getPublicAiGatewayDiagnostic, isChatGPTGateway, normalizeAiGateway, resolveAiGatewayModelRoute, resolveAiGatewayRoute, resolveAiGatewaySecret };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as gatewayDiagnostics } from "./diagnostics-
|
|
2
|
-
|
|
1
|
+
import { t as gatewayDiagnostics } from "./diagnostics-CNIdO5-M.js";
|
|
2
|
+
// src/jev.ts
|
|
3
3
|
async function loadAdvocaat() {
|
|
4
4
|
try {
|
|
5
5
|
return await import("advocaat");
|
|
@@ -417,5 +417,4 @@ async function askJev(context, state, questions) {
|
|
|
417
417
|
}
|
|
418
418
|
return [void 0, Object.fromEntries(Object.entries(output))];
|
|
419
419
|
}
|
|
420
|
-
//#endregion
|
|
421
420
|
export { cloudflareJevBaseURL as n, hasValidChoiceAnswer as r, askJev as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as gatewayDiagnostics } from "./diagnostics-
|
|
2
|
-
import { a as aiGatewayOptionalCredentials, c as isRecord, f as resolveAiGatewaySecret, i as aiGatewayOpenAIChat, l as normalizeAiGateway, o as aiGatewayStructuredOutputs, r as aiGatewayModelCredentials, t as aiGatewayAsks } from "./definition-
|
|
3
|
-
import { n as cloudflareJevBaseURL, t as askJev } from "./jev-
|
|
4
|
-
|
|
1
|
+
import { t as gatewayDiagnostics } from "./diagnostics-CNIdO5-M.js";
|
|
2
|
+
import { a as aiGatewayOptionalCredentials, c as isRecord, f as resolveAiGatewaySecret, i as aiGatewayOpenAIChat, l as normalizeAiGateway, o as aiGatewayStructuredOutputs, r as aiGatewayModelCredentials, t as aiGatewayAsks } from "./definition-IHIWW_eG.js";
|
|
3
|
+
import { n as cloudflareJevBaseURL, t as askJev } from "./jev-Kmwvxt8l.js";
|
|
4
|
+
// src/chatgpt.ts
|
|
5
5
|
/** Use a ChatGPT Connection with a Codex Driver or a model-backed Driver. Defaults to the `chatgpt` Connection. */
|
|
6
6
|
function chatgpt(options = {}) {
|
|
7
7
|
const connection = options.connection ?? "chatgpt";
|
|
@@ -19,8 +19,7 @@ function isChatGPTGateway(value) {
|
|
|
19
19
|
"connection"
|
|
20
20
|
].includes(key));
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
//#region src/env.ts
|
|
22
|
+
// src/env.ts
|
|
24
23
|
const aiGatewayEnv = {
|
|
25
24
|
anthropic: { apiKey: {
|
|
26
25
|
names: ["ANTHROPIC_API_KEY"],
|
|
@@ -123,8 +122,7 @@ async function readAiGatewayEnv(context, preset, field) {
|
|
|
123
122
|
if (context.env) return await context.env(preset, field);
|
|
124
123
|
return aiGatewayEnvNames(preset, field).map((name) => globalThis.process?.env?.[name]).find((value) => value !== void 0 && value !== "");
|
|
125
124
|
}
|
|
126
|
-
|
|
127
|
-
//#region src/presets.ts
|
|
125
|
+
// src/presets.ts
|
|
128
126
|
function origin(url, label) {
|
|
129
127
|
if (typeof url !== "string" || !url.trim()) throw gatewayDiagnostics.GATEWAYS_R0001({ message: `[vitehub] ${label}({ url }) must be a non-empty URL.` });
|
|
130
128
|
return url.trim().replace(/\/+$/, "").replace(/\/v1$/, "");
|
|
@@ -503,5 +501,4 @@ function cloudflare(options = {}) {
|
|
|
503
501
|
}
|
|
504
502
|
});
|
|
505
503
|
}
|
|
506
|
-
//#endregion
|
|
507
504
|
export { isChatGPTGateway as _, cloudflareAccess as a, litellm as c, openrouter as d, typesafe as f, chatgpt as g, aiGatewayEnvNames as h, cloudflare as i, ollama as l, aiGatewayEnv as m, askAiGateway as n, defineAiGateway as o, vercel as p, cliproxy as r, emulate as s, anthropic as t, openai as u };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { a as AiGatewayAskResult, c as AiGatewayDefinition, f as AiGatewaySecret, k as AskQuestions, m as AiGatewayValue, p as AiGatewayUsage, s as AiGatewayContext, t as AiGateway, u as AiGatewayRoute } from "./types-
|
|
2
|
-
//#region src/chatgpt.d.ts
|
|
1
|
+
import { a as AiGatewayAskResult, c as AiGatewayDefinition, f as AiGatewaySecret, k as AskQuestions, m as AiGatewayValue, p as AiGatewayUsage, s as AiGatewayContext, t as AiGateway, u as AiGatewayRoute } from "./types-jSw-t3Dq.js";
|
|
3
2
|
/** A runtime-owned ChatGPT plan route. It contains no credentials. */
|
|
4
3
|
interface ChatGPTGateway {
|
|
5
4
|
readonly kind: "chatgpt";
|
|
@@ -11,8 +10,6 @@ declare function chatgpt(options?: {
|
|
|
11
10
|
connection?: string;
|
|
12
11
|
}): ChatGPTGateway;
|
|
13
12
|
declare function isChatGPTGateway(value: unknown): value is ChatGPTGateway;
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/env.d.ts
|
|
16
13
|
/** One preset value that is read from the environment when the preset does not receive it. */
|
|
17
14
|
interface AiGatewayEnvField {
|
|
18
15
|
/** Vendor variable names in lookup order, after the `VITEHUB_` name. */
|
|
@@ -26,8 +23,6 @@ declare const aiGatewayEnv: Readonly<Record<AiGatewayEnvPreset, Readonly<Record<
|
|
|
26
23
|
type AiGatewayEnvFieldName<_TPreset extends AiGatewayEnvPreset = AiGatewayEnvPreset> = string;
|
|
27
24
|
/** The variables of one preset value in lookup order: `VITEHUB_<PRESET>_<FIELD>`, then the vendor names. */
|
|
28
25
|
declare function aiGatewayEnvNames<TPreset extends AiGatewayEnvPreset>(preset: TPreset, field: AiGatewayEnvFieldName<TPreset>): string[];
|
|
29
|
-
//#endregion
|
|
30
|
-
//#region src/jev.d.ts
|
|
31
26
|
/** One trace event of a Jev request. ViteHub Agents record these in the Invocation trace. */
|
|
32
27
|
interface AiGatewayTraceEvent {
|
|
33
28
|
attributes: Record<string, unknown>;
|
|
@@ -63,8 +58,6 @@ interface JevRoute {
|
|
|
63
58
|
name: string;
|
|
64
59
|
protocol: "typesafe" | "vercel";
|
|
65
60
|
}
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/presets.d.ts
|
|
68
61
|
/** Options shared by every gateway preset. */
|
|
69
62
|
interface AiGatewayPresetOptions {
|
|
70
63
|
/** API key. When it is not set, the preset reads its Server Env value, such as `CLIPROXY_API_KEY`. */
|
|
@@ -197,5 +190,4 @@ declare function cloudflare(options?: CloudflareGatewayOptions): AiGateway<{
|
|
|
197
190
|
ask: true;
|
|
198
191
|
routes: "openai-compatible";
|
|
199
192
|
}>;
|
|
200
|
-
//#endregion
|
|
201
193
|
export { chatgpt as A, AiGatewayTraceEvent as C, aiGatewayEnv as D, AiGatewayEnvPreset as E, aiGatewayEnvNames as O, vercel as S, AiGatewayEnvFieldName as T, litellm as _, CloudflareAccessOptions as a, openrouter as b, TypesafeGatewayOptions as c, askAiGateway as d, cliproxy as f, emulate as g, defineAiGateway as h, AiModelGateway as i, isChatGPTGateway as j, ChatGPTGateway as k, VercelGatewayOptions as l, cloudflareAccess as m, AiGatewayPresetOptions as n, CloudflareGatewayOptions as o, cloudflare as p, AiHostedGatewayOptions as r, EmulateGatewayOptions as s, AiAskGatewayOptions as t, anthropic as u, ollama as v, AiGatewayEnvField as w, typesafe as x, openai as y };
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { A as AskScoreAnswer, M as AskScoreQuestion, O as AskQuestion, S as AskChoiceCriteria, h as AskAnswer, j as AskScoreCriteria, k as AskQuestions, n as AiGatewayAsk, p as AiGatewayUsage, v as AskChanceAnswer, w as AskChoiceQuestion, x as AskChoiceAnswer } from "./types-
|
|
2
|
-
//#region src/testing.d.ts
|
|
1
|
+
import { A as AskScoreAnswer, M as AskScoreQuestion, O as AskQuestion, S as AskChoiceCriteria, h as AskAnswer, j as AskScoreCriteria, k as AskQuestions, n as AiGatewayAsk, p as AiGatewayUsage, v as AskChanceAnswer, w as AskChoiceQuestion, x as AskChoiceAnswer } from "./types-jSw-t3Dq.js";
|
|
3
2
|
/** One `gateway.ask()` call that `scriptedAsk()` received. */
|
|
4
3
|
export interface ScriptedAskCall {
|
|
5
4
|
questions: AskQuestions;
|
|
@@ -44,4 +43,4 @@ export declare function scriptedAsk(script: AskScript, options?: ScriptedAskOpti
|
|
|
44
43
|
ask: AiGatewayAsk;
|
|
45
44
|
};
|
|
46
45
|
};
|
|
47
|
-
|
|
46
|
+
export {};
|
package/dist/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as gatewayDiagnostics } from "./diagnostics-
|
|
2
|
-
import { r as hasValidChoiceAnswer } from "./jev-
|
|
3
|
-
|
|
1
|
+
import { t as gatewayDiagnostics } from "./diagnostics-CNIdO5-M.js";
|
|
2
|
+
import { r as hasValidChoiceAnswer } from "./jev-Kmwvxt8l.js";
|
|
3
|
+
// src/testing.ts
|
|
4
4
|
function invalid(problem) {
|
|
5
5
|
return gatewayDiagnostics.GATEWAYS_TESTING_ANSWER_INVALID({ problem });
|
|
6
6
|
}
|
|
@@ -149,5 +149,4 @@ function scriptedAsk(script, options = {}) {
|
|
|
149
149
|
gateway: { ask }
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
//#endregion
|
|
153
152
|
export { answers, scriptedAsk };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Diagnostic } from "nostics";
|
|
2
|
-
//#region src/ask-model.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* An AI SDK model instance or gateway model id. This structural boundary keeps the optional SDK out of root declarations.
|
|
5
4
|
* The SDK owns the call options and results; the adapter passes the model through without calling these hooks itself.
|
|
@@ -68,8 +67,6 @@ interface AskCall {
|
|
|
68
67
|
}): Promise<AskResult<AskSchemaOutput<TSchema>>>;
|
|
69
68
|
(prompt: string, options: AskOptions): Promise<AskResult<string>>;
|
|
70
69
|
}
|
|
71
|
-
//#endregion
|
|
72
|
-
//#region src/ask.d.ts
|
|
73
70
|
/** A JSON value that TypeSafe Jev can read. */
|
|
74
71
|
type AskJson = string | number | boolean | null | AskJson[] | {
|
|
75
72
|
[key: string]: AskJson;
|
|
@@ -198,8 +195,6 @@ declare const ask: AskCall & {
|
|
|
198
195
|
score: typeof score;
|
|
199
196
|
switch: typeof askSwitch;
|
|
200
197
|
};
|
|
201
|
-
//#endregion
|
|
202
|
-
//#region src/types.d.ts
|
|
203
198
|
/** What a gateway value resolver receives. */
|
|
204
199
|
interface AiGatewayContext {
|
|
205
200
|
/** Aborts a resolver that reads remote storage. */
|
|
@@ -315,5 +310,4 @@ type AiGateway<TCapabilities extends Partial<AiGatewayCapabilities> = Partial<Ai
|
|
|
315
310
|
} : {
|
|
316
311
|
ask?: AiGatewayAsk;
|
|
317
312
|
});
|
|
318
|
-
//#endregion
|
|
319
313
|
export { AskScoreAnswer as A, askWithModel as B, AskChoiceLabels as C, AskJson as D, AskIfQuestion as E, AskError as F, AskModel as I, AskOptions as L, AskScoreQuestion as M, AskSwitchQuestion as N, AskQuestion as O, ask as P, AskResult as R, AskChoiceCriteria as S, AskEntry as T, AskAnswers as _, AiGatewayAskResult as a, AskChanceQuestion as b, AiGatewayDefinition as c, AiGatewaySealedSecret as d, AiGatewaySecret as f, AskAnswerType as g, AskAnswer as h, AiGatewayAskOptions as i, AskScoreCriteria as j, AskQuestions as k, AiGatewayDriver as l, AiGatewayValue as m, AiGatewayAsk as n, AiGatewayCapabilities as o, AiGatewayUsage as p, AiGatewayAskError as r, AiGatewayContext as s, AiGateway as t, AiGatewayRoute as u, AskChanceAnswer as v, AskChoiceQuestion as w, AskChoiceAnswer as x, AskChanceCriteria as y, AskSchema as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/gateways",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "One AI gateway object for every consumer: route Codex, Claude Code, and AI SDK models, and ask TypeSafe Jev typed questions, through Vercel AI Gateway, Cloudflare AI Gateway, OpenRouter, LiteLLM, CLIProxyAPI, Ollama, OpenAI, Anthropic, or TypeSafe.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -63,20 +63,20 @@
|
|
|
63
63
|
"nostics": "1.4.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@ai-sdk/anthropic": "4.0.
|
|
67
|
-
"@ai-sdk/openai": "4.0.
|
|
68
|
-
"@ai-sdk/openai-compatible": "3.0.
|
|
69
|
-
"@ai-sdk/provider": "4.0.
|
|
66
|
+
"@ai-sdk/anthropic": "4.0.107",
|
|
67
|
+
"@ai-sdk/openai": "4.0.122",
|
|
68
|
+
"@ai-sdk/openai-compatible": "3.0.94",
|
|
69
|
+
"@ai-sdk/provider": "4.0.39",
|
|
70
70
|
"@emulators/ai": "0.14.0",
|
|
71
|
-
"@types/node": "^24.19.
|
|
71
|
+
"@types/node": "^24.19.2",
|
|
72
72
|
"@vite-hub/internal": "0.0.1",
|
|
73
73
|
"advocaat": "^0.0.6",
|
|
74
|
-
"ai": "7.0.
|
|
74
|
+
"ai": "7.0.179",
|
|
75
75
|
"emulate": "0.14.0",
|
|
76
76
|
"publint": "^0.3.25",
|
|
77
77
|
"typescript": "^6.0.3",
|
|
78
|
-
"vite-plus": "^
|
|
79
|
-
"vitest": "
|
|
78
|
+
"vite-plus": "^1.7.0",
|
|
79
|
+
"vitest": "5.1.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@ai-sdk/anthropic": "^4.0.0",
|