@ubean/ai 0.4.4 → 0.4.6
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/gateway.d.ts +9 -9
- package/dist/index.d.ts +6 -6
- package/dist/runtime/vue.d.ts +10 -10
- package/dist/vite.d.ts +4 -4
- package/package.json +5 -5
package/dist/gateway.d.ts
CHANGED
|
@@ -5,20 +5,20 @@ import { m as ProviderDefinition } from "./types-B5I0sGbf.js";
|
|
|
5
5
|
* Default base URL is `https://api.deepseek.com/v1`.
|
|
6
6
|
* Requires `DEEPSEEK_API_KEY` (or `UBEAN_AI_API_KEY`) env variable or manual `apiKey`.
|
|
7
7
|
*/
|
|
8
|
-
declare const deepseek: ProviderDefinition;
|
|
8
|
+
export declare const deepseek: ProviderDefinition;
|
|
9
9
|
/**
|
|
10
10
|
* OpenRouter (https://openrouter.ai/).
|
|
11
11
|
* Base URL `https://openrouter.ai/api/v1`.
|
|
12
12
|
* Requires `OPENROUTER_API_KEY`.
|
|
13
13
|
*/
|
|
14
|
-
declare const openrouter: ProviderDefinition;
|
|
14
|
+
export declare const openrouter: ProviderDefinition;
|
|
15
15
|
/**
|
|
16
16
|
* OmniRoute (https://github.com/diegosouzapw/OmniRoute) — the Free AI Gateway.
|
|
17
17
|
* This assumes you are running OmniRoute locally or have deployed it.
|
|
18
18
|
* Default base URL is the default local endpoint `http://localhost:8080/v1`.
|
|
19
19
|
* If you are running OmniRoute elsewhere, override `baseURL` when registering.
|
|
20
20
|
*/
|
|
21
|
-
declare const omniRoute: ProviderDefinition;
|
|
21
|
+
export declare const omniRoute: ProviderDefinition;
|
|
22
22
|
/**
|
|
23
23
|
* OpenAI (https://platform.openai.com/).
|
|
24
24
|
* Base URL `https://api.openai.com/v1`.
|
|
@@ -27,26 +27,26 @@ declare const omniRoute: ProviderDefinition;
|
|
|
27
27
|
* Note: you can also use this provider via `@ai-sdk/openai` directly; this
|
|
28
28
|
* definition is for when you are routing OpenAI through a proxy/gateway.
|
|
29
29
|
*/
|
|
30
|
-
declare const openai: ProviderDefinition;
|
|
30
|
+
export declare const openai: ProviderDefinition;
|
|
31
31
|
/**
|
|
32
32
|
* Anthropic via OpenAI-compatible endpoint.
|
|
33
33
|
* Anthropic's native endpoint is not OpenAI-compatible out of the box, but
|
|
34
34
|
* many gateways (including OmniRoute) expose it as such.
|
|
35
35
|
*/
|
|
36
|
-
declare const anthropic: ProviderDefinition;
|
|
36
|
+
export declare const anthropic: ProviderDefinition;
|
|
37
37
|
/**
|
|
38
38
|
* Google Gemini via OpenAI-compatible endpoint.
|
|
39
39
|
* Gemini's native endpoint is not OpenAI-compatible out of the box; this
|
|
40
40
|
* definition is for when you are using a gateway that exposes it as such.
|
|
41
41
|
*/
|
|
42
|
-
declare const google: ProviderDefinition;
|
|
42
|
+
export declare const google: ProviderDefinition;
|
|
43
43
|
/**
|
|
44
44
|
* Groq (https://groq.com/).
|
|
45
45
|
* OpenAI-compatible endpoint out of the box.
|
|
46
46
|
* Requires `GROQ_API_KEY`.
|
|
47
47
|
*/
|
|
48
|
-
declare const groq: ProviderDefinition;
|
|
48
|
+
export declare const groq: ProviderDefinition;
|
|
49
49
|
/** All built-in gateway providers exported from this module. */
|
|
50
|
-
declare const allGatewayProviders: ProviderDefinition[];
|
|
50
|
+
export declare const allGatewayProviders: ProviderDefinition[];
|
|
51
51
|
//#endregion
|
|
52
|
-
export {
|
|
52
|
+
export type { ProviderDefinition };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { _ as UbeanAIProviderOptions, a as AgentStreamChunk, c as AgentToolConte
|
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/core.d.ts
|
|
4
4
|
/** Register a provider (idempotent by id). */
|
|
5
|
-
declare function defineProvider(definition: ProviderDefinition): void;
|
|
5
|
+
export declare function defineProvider(definition: ProviderDefinition): void;
|
|
6
6
|
/** Configure the fallback provider used when a model string has no provider segment. */
|
|
7
|
-
declare function configureAI(options: {
|
|
7
|
+
export declare function configureAI(options: {
|
|
8
8
|
defaultProvider?: string;
|
|
9
9
|
}): void;
|
|
10
10
|
/**
|
|
@@ -12,14 +12,14 @@ declare function configureAI(options: {
|
|
|
12
12
|
* Falls back to the configured default provider, then to an env-driven
|
|
13
13
|
* OpenAI-compatible provider (mirrors devtools' DeepSeek defaults).
|
|
14
14
|
*/
|
|
15
|
-
declare function resolveModel(model: string): ResolvedModel;
|
|
15
|
+
export declare function resolveModel(model: string): ResolvedModel;
|
|
16
16
|
/** Declare a typed ubean tool. Returns the tool unchanged (type-safe identity). */
|
|
17
|
-
declare function defineAgentTool<T extends AgentTool['input']>(tool: AgentTool<T>): AgentTool<T>;
|
|
17
|
+
export declare function defineAgentTool<T extends AgentTool['input']>(tool: AgentTool<T>): AgentTool<T>;
|
|
18
18
|
/**
|
|
19
19
|
* Build a declarative agent. The loop is delegated to the AI SDK's
|
|
20
20
|
* `streamText`/`generateText` (with `stopWhen: stepCountIs(maxSteps)`); this
|
|
21
21
|
* only returns the ubean-idiomatic surface (`run`/`stream`/`asHandler`).
|
|
22
22
|
*/
|
|
23
|
-
declare function defineAgent<T = unknown>(config: AgentConfig): UbeanAgent<T>;
|
|
23
|
+
export declare function defineAgent<T = unknown>(config: AgentConfig): UbeanAgent<T>;
|
|
24
24
|
//#endregion
|
|
25
|
-
export { type AgentAssistantMessage, type AgentConfig, type AgentInput, type AgentRunResult, type AgentStreamChunk, type AgentTool, type AgentToolCall, type AgentToolContext, type AgentToolResult, type AgentToolSet, type AgentUsage, type AgentUserMessage, type ModelString, type ProviderDefinition, type ProviderKind, type ResolvedModel, type UbeanAIProviderOptions, type UbeanAgent,
|
|
25
|
+
export { type AgentAssistantMessage, type AgentConfig, type AgentInput, type AgentRunResult, type AgentStreamChunk, type AgentTool, type AgentToolCall, type AgentToolContext, type AgentToolResult, type AgentToolSet, type AgentUsage, type AgentUserMessage, type ModelString, type ProviderDefinition, type ProviderKind, type ResolvedModel, type UbeanAIProviderOptions, type UbeanAgent, v };
|
package/dist/runtime/vue.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { a as AgentStreamChunk, i as AgentRunResult, l as AgentToolResult, r as
|
|
|
2
2
|
import { ComputedRef, Ref } from "vue";
|
|
3
3
|
//#region src/runtime/vue.d.ts
|
|
4
4
|
/** A single chat message managed by `useChat`. */
|
|
5
|
-
interface ChatMessage {
|
|
5
|
+
export interface ChatMessage {
|
|
6
6
|
id: string;
|
|
7
7
|
role: 'user' | 'assistant';
|
|
8
8
|
content: string;
|
|
@@ -12,8 +12,8 @@ interface ChatMessage {
|
|
|
12
12
|
toolResults?: AgentToolResult[];
|
|
13
13
|
createdAt?: number;
|
|
14
14
|
}
|
|
15
|
-
type ChatStatus = 'ready' | 'streaming' | 'error';
|
|
16
|
-
interface UseChatOptions {
|
|
15
|
+
export type ChatStatus = 'ready' | 'streaming' | 'error';
|
|
16
|
+
export interface UseChatOptions {
|
|
17
17
|
/** SSE endpoint. Defaults to a relative `./chat` route if not provided. */
|
|
18
18
|
url?: string;
|
|
19
19
|
/** Initial conversation history. */
|
|
@@ -24,11 +24,11 @@ interface UseChatOptions {
|
|
|
24
24
|
fetch?: typeof fetch;
|
|
25
25
|
}
|
|
26
26
|
/** Set the provider config used by `useAIProvider` (called by the Vite plugin). */
|
|
27
|
-
declare function setAIProviderConfig(config: {
|
|
27
|
+
export declare function setAIProviderConfig(config: {
|
|
28
28
|
defaultProvider?: string;
|
|
29
29
|
defaultModel?: string;
|
|
30
30
|
}): void;
|
|
31
|
-
interface UseChatReturn {
|
|
31
|
+
export interface UseChatReturn {
|
|
32
32
|
/** Reactive message list. */
|
|
33
33
|
messages: Ref<ChatMessage[]>;
|
|
34
34
|
/** 'ready' | 'streaming' | 'error'. */
|
|
@@ -54,8 +54,8 @@ interface UseChatReturn {
|
|
|
54
54
|
* SSR-safe chat composable. Maintains reactive message state and streams
|
|
55
55
|
* `AgentStreamChunk` SSE frames from the `asHandler()` endpoint.
|
|
56
56
|
*/
|
|
57
|
-
declare function useChat(options?: UseChatOptions): UseChatReturn;
|
|
58
|
-
interface UseAgentReturn<T = unknown> {
|
|
57
|
+
export declare function useChat(options?: UseChatOptions): UseChatReturn;
|
|
58
|
+
export interface UseAgentReturn<T = unknown> {
|
|
59
59
|
isStreaming: Ref<boolean>;
|
|
60
60
|
error: Ref<Error | null>;
|
|
61
61
|
result: Ref<AgentRunResult<T> | null>;
|
|
@@ -64,11 +64,11 @@ interface UseAgentReturn<T = unknown> {
|
|
|
64
64
|
stream: (input: AgentInput) => Promise<void>;
|
|
65
65
|
}
|
|
66
66
|
/** Drive a `UbeanAgent` directly from a component with reactive state. */
|
|
67
|
-
declare function useAgent<T = unknown>(agent: UbeanAgent<T>): UseAgentReturn<T>;
|
|
67
|
+
export declare function useAgent<T = unknown>(agent: UbeanAgent<T>): UseAgentReturn<T>;
|
|
68
68
|
/** Read the current fallback provider/model config (set by the Vite plugin). */
|
|
69
|
-
declare function useAIProvider(): {
|
|
69
|
+
export declare function useAIProvider(): {
|
|
70
70
|
defaultProvider?: string;
|
|
71
71
|
defaultModel?: string;
|
|
72
72
|
};
|
|
73
73
|
//#endregion
|
|
74
|
-
export {
|
|
74
|
+
export type { AgentInput, AgentRunResult, AgentStreamChunk, AgentToolCall, AgentToolResult, UbeanAgent };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { m as ProviderDefinition } from "./types-B5I0sGbf.js";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/vite.d.ts
|
|
4
|
-
interface UbeanAiOptions {
|
|
4
|
+
export interface UbeanAiOptions {
|
|
5
5
|
/** Master switch. Disabled plugin returns a noop. */
|
|
6
6
|
enabled?: boolean;
|
|
7
7
|
/** Provider presets to register on the server kernel. */
|
|
@@ -12,7 +12,7 @@ interface UbeanAiOptions {
|
|
|
12
12
|
autoImport?: boolean;
|
|
13
13
|
}
|
|
14
14
|
/** Type-safe helper for defining AI options (pass-through). */
|
|
15
|
-
declare function defineAiConfig(options: UbeanAiOptions): UbeanAiOptions;
|
|
16
|
-
declare function ubeanAiPlugin(userOptions?: UbeanAiOptions): Plugin;
|
|
15
|
+
export declare function defineAiConfig(options: UbeanAiOptions): UbeanAiOptions;
|
|
16
|
+
export declare function ubeanAiPlugin(userOptions?: UbeanAiOptions): Plugin;
|
|
17
17
|
//#endregion
|
|
18
|
-
export {
|
|
18
|
+
export { ubeanAiPlugin as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ubean/ai",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "AI large-model integration for the ubean framework: defineAgent + defineAgentTool + Vue runtime (thin orchestration over the Vercel AI SDK)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -28,16 +28,16 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ubean/build": "0.4.
|
|
31
|
+
"@ubean/build": "0.4.6",
|
|
32
32
|
"@valibot/to-json-schema": "^1.7.1",
|
|
33
33
|
"valibot": "^1.4.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "^26.5.0",
|
|
37
37
|
"hono": "4.13.7",
|
|
38
|
-
"typescript": "
|
|
39
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.
|
|
40
|
-
"vite-plus": "0.3.
|
|
38
|
+
"typescript": "npm:typescript-native-bridge@latest",
|
|
39
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
|
|
40
|
+
"vite-plus": "0.3.1",
|
|
41
41
|
"vue": "^3.5.42"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|