@aippy/runtime 0.2.7-dev.0 → 0.2.7-dev.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/config/bridge.d.ts +23 -0
- package/dist/ai/config/helper.d.ts +43 -0
- package/dist/ai/config/index.d.ts +11 -0
- package/dist/ai/config/parser.d.ts +60 -0
- package/dist/ai/config/types.d.ts +80 -0
- package/dist/ai/errors.d.ts +4 -0
- package/dist/ai/index.d.ts +8 -7
- package/dist/ai/index.js +22 -19
- package/dist/ai/openai/index.d.ts +2 -2
- package/dist/ai/openai/provider.d.ts +3 -3
- package/dist/ai/ui/config.d.ts +2 -58
- package/dist/ai/ui/endpoints.d.ts +0 -4
- package/dist/ai/ui/index.d.ts +3 -5
- package/dist/ai/ui/types.d.ts +0 -25
- package/dist/bridge-D2d8hnO_.js +395 -0
- package/dist/container-message-DGrno17o.js +31 -0
- package/dist/core/container-message.d.ts +81 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +18 -16
- package/dist/device/index.js +1 -1
- package/dist/helper-CRGxnlsu.js +261 -0
- package/dist/index/index.js +105 -90
- package/dist/{native-bridge-JAmH-zTN.js → native-bridge-BnvipFJc.js} +1 -1
- package/dist/user/bridge.d.ts +82 -0
- package/dist/user/hooks.d.ts +36 -0
- package/dist/user/index.d.ts +4 -3
- package/dist/user/index.js +35 -25
- package/dist/user/types.d.ts +2 -0
- package/dist/userSessionInfo-SbuNZ7JR.js +229 -0
- package/package.json +4 -2
- package/dist/bridge-DdAH4txB.js +0 -222
- package/dist/errors-DWRVLkVz.js +0 -152
- package/dist/userSessionInfo-CBk9ywXi.js +0 -186
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AIConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Sends AI configuration to app container via postMessage
|
|
4
|
+
*
|
|
5
|
+
* Supports two scenarios:
|
|
6
|
+
* - iOS WebView: Uses `webkit.messageHandlers.aippyListener.postMessage()`
|
|
7
|
+
* - Iframe: Uses `window.parent.postMessage()`
|
|
8
|
+
*
|
|
9
|
+
* This is a one-way communication - we send the config but don't listen for updates
|
|
10
|
+
* because AI config is static (loaded at startup), not reactive like tweaks.
|
|
11
|
+
*
|
|
12
|
+
* @param config - The AI configuration to send
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { sendAIConfigToContainer, loadAIConfig } from '@aippy/runtime/ai';
|
|
17
|
+
* import aiConfigJson from '@/config/aiConfig.json';
|
|
18
|
+
*
|
|
19
|
+
* const config = loadAIConfig(aiConfigJson);
|
|
20
|
+
* sendAIConfigToContainer(config);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function sendAIConfigToContainer(config: AIConfig): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Configuration helper functions
|
|
3
|
+
*
|
|
4
|
+
* Provides convenient utilities for loading and accessing AI configuration
|
|
5
|
+
* from aiConfig.json files generated by LLMs.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Type for the values object returned by createAIConfig
|
|
9
|
+
* Provides direct property access to configuration values
|
|
10
|
+
*/
|
|
11
|
+
export interface AIConfigValues {
|
|
12
|
+
readonly [key: string]: unknown;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates an AI configuration helper that loads, validates, and provides
|
|
16
|
+
* convenient access to configuration values.
|
|
17
|
+
*
|
|
18
|
+
* This function:
|
|
19
|
+
* 1. Loads and validates the configuration
|
|
20
|
+
* 2. Sends it to the app container (for aippy app editing)
|
|
21
|
+
* 3. Returns an object with direct property access to config values
|
|
22
|
+
*
|
|
23
|
+
* **Recommended usage**: Call this once at app initialization and export
|
|
24
|
+
* the result for use throughout your app.
|
|
25
|
+
*
|
|
26
|
+
* @param configJson - The AI configuration JSON (usually from `import aiConfigJson from '@/config/aiConfig.json'`)
|
|
27
|
+
* @returns An object with direct property access to configuration values
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // app.tsx or main.tsx
|
|
32
|
+
* import aiConfigJson from '@/config/aiConfig.json';
|
|
33
|
+
* import { createAIConfig } from '@aippy/runtime/ai';
|
|
34
|
+
*
|
|
35
|
+
* export const aiConfig = createAIConfig(aiConfigJson);
|
|
36
|
+
*
|
|
37
|
+
* // In your AI code - direct property access
|
|
38
|
+
* import { aiConfig } from './app';
|
|
39
|
+
* const model = aiConfig.model; // string | undefined
|
|
40
|
+
* const temperature = aiConfig.temperature; // number | undefined
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function createAIConfig(configJson: unknown): AIConfigValues;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Configuration module
|
|
3
|
+
*
|
|
4
|
+
* Provides types, validation, and utilities for working with aiConfig.json
|
|
5
|
+
* files generated by LLMs when creating AI-powered applications.
|
|
6
|
+
*/
|
|
7
|
+
export type { AIConfig, AIConfigValue, AIConfigItem, NumberAIConfigItem, BooleanAIConfigItem, TextAIConfigItem, EnumAIConfigItem, AIConfigError, } from './types';
|
|
8
|
+
export type { AIConfigValues } from './helper';
|
|
9
|
+
export { AIConfigValidationError, validateAIConfig, parseAIConfig, loadAIConfig, getAIConfigValue, } from './parser';
|
|
10
|
+
export { sendAIConfigToContainer } from './bridge';
|
|
11
|
+
export { createAIConfig } from './helper';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { AIConfig, AIConfigError } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Custom error class for AI configuration validation failures
|
|
4
|
+
*/
|
|
5
|
+
export declare class AIConfigValidationError extends Error {
|
|
6
|
+
readonly errors: AIConfigError[];
|
|
7
|
+
constructor(message: string, errors: AIConfigError[]);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Validates an AI configuration object
|
|
11
|
+
*
|
|
12
|
+
* @param config - The configuration object to validate
|
|
13
|
+
* @throws {AIConfigValidationError} If validation fails
|
|
14
|
+
*/
|
|
15
|
+
export declare function validateAIConfig(config: unknown): asserts config is AIConfig;
|
|
16
|
+
/**
|
|
17
|
+
* Parses and validates AI configuration from a JSON string
|
|
18
|
+
*
|
|
19
|
+
* @param json - JSON string to parse
|
|
20
|
+
* @returns Validated AIConfig object
|
|
21
|
+
* @throws {AIConfigValidationError} If JSON is invalid or validation fails
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const json = '{"model": {"index": 0, "name": "Model", ...}}';
|
|
26
|
+
* const config = parseAIConfig(json);
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseAIConfig(json: string): AIConfig;
|
|
30
|
+
/**
|
|
31
|
+
* Loads and validates AI configuration from a configuration object
|
|
32
|
+
*
|
|
33
|
+
* Typically used with: `import aiConfig from '@/config/aiConfig.json'`
|
|
34
|
+
*
|
|
35
|
+
* @param config - Configuration object (usually from JSON import)
|
|
36
|
+
* @returns Validated AIConfig object
|
|
37
|
+
* @throws {AIConfigValidationError} If validation fails
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* import aiConfigJson from '@/config/aiConfig.json';
|
|
42
|
+
* const config = loadAIConfig(aiConfigJson);
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function loadAIConfig(config: unknown): AIConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Gets a configuration value by key
|
|
48
|
+
*
|
|
49
|
+
* @param config - The AIConfig object
|
|
50
|
+
* @param key - Configuration key to retrieve
|
|
51
|
+
* @returns The value of the configuration item
|
|
52
|
+
* @throws {Error} If the key is not found
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* const model = getAIConfigValue<string>(config, 'model');
|
|
57
|
+
* const temperature = getAIConfigValue<number>(config, 'temperature');
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare function getAIConfigValue<T = unknown>(config: AIConfig, key: string): T;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Configuration types for aiConfig.json
|
|
3
|
+
*
|
|
4
|
+
* These types define the structure of the AI configuration file that LLMs
|
|
5
|
+
* generate when creating AI-powered applications.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Base interface for all AI configuration items
|
|
9
|
+
*/
|
|
10
|
+
export interface AIConfigItem {
|
|
11
|
+
/** Display order (lower index = higher priority) */
|
|
12
|
+
index: number;
|
|
13
|
+
/** User-friendly display name */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Description of the parameter */
|
|
16
|
+
description: string;
|
|
17
|
+
/** Optional group name for organizing related parameters */
|
|
18
|
+
group?: string;
|
|
19
|
+
/** Type of the configuration item */
|
|
20
|
+
type: 'number' | 'boolean' | 'text' | 'enum';
|
|
21
|
+
/** Current value */
|
|
22
|
+
value: number | string | boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Number type configuration item
|
|
26
|
+
*/
|
|
27
|
+
export interface NumberAIConfigItem extends AIConfigItem {
|
|
28
|
+
type: 'number';
|
|
29
|
+
/** Minimum allowed value */
|
|
30
|
+
min?: number;
|
|
31
|
+
/** Maximum allowed value */
|
|
32
|
+
max?: number;
|
|
33
|
+
/** Step size for adjustments */
|
|
34
|
+
step?: number;
|
|
35
|
+
value: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Boolean type configuration item
|
|
39
|
+
*/
|
|
40
|
+
export interface BooleanAIConfigItem extends AIConfigItem {
|
|
41
|
+
type: 'boolean';
|
|
42
|
+
value: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Text type configuration item
|
|
46
|
+
*/
|
|
47
|
+
export interface TextAIConfigItem extends AIConfigItem {
|
|
48
|
+
type: 'text';
|
|
49
|
+
value: string;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Enum type configuration item
|
|
53
|
+
* Used for parameters with a fixed set of valid values (e.g., model names, image sizes)
|
|
54
|
+
*/
|
|
55
|
+
export interface EnumAIConfigItem extends AIConfigItem {
|
|
56
|
+
type: 'enum';
|
|
57
|
+
/** Array of valid option values */
|
|
58
|
+
options: string[];
|
|
59
|
+
value: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Union type of all possible AI configuration item types
|
|
63
|
+
*/
|
|
64
|
+
export type AIConfigValue = NumberAIConfigItem | BooleanAIConfigItem | TextAIConfigItem | EnumAIConfigItem;
|
|
65
|
+
/**
|
|
66
|
+
* AI Configuration object structure
|
|
67
|
+
* Maps configuration keys to their respective configuration items
|
|
68
|
+
*/
|
|
69
|
+
export interface AIConfig {
|
|
70
|
+
[key: string]: AIConfigValue;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validation error information
|
|
74
|
+
*/
|
|
75
|
+
export interface AIConfigError {
|
|
76
|
+
/** Configuration key that has the error */
|
|
77
|
+
key: string;
|
|
78
|
+
/** Error message describing the issue */
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
package/dist/ai/errors.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { AISDKError } from 'ai';
|
|
2
2
|
/**
|
|
3
3
|
* Normalizes a backend error response into an AISDKError.
|
|
4
|
+
*
|
|
5
|
+
* If the backend error response includes container message data (e.g., `appMessage` field),
|
|
6
|
+
* it will be automatically sent to the app container for user-facing UI (e.g., payment dialog,
|
|
7
|
+
* error popup, success notification).
|
|
4
8
|
*/
|
|
5
9
|
export declare function normalizeError(response: Response, body?: unknown): AISDKError;
|
|
6
10
|
/**
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* ## Path 1: OpenAI-Compatible Provider (AI SDK Core)
|
|
7
7
|
*
|
|
8
|
-
* Use `
|
|
8
|
+
* Use `aippyAIProvider()` provider with AI SDK Core functions:
|
|
9
9
|
* - generateText / streamText
|
|
10
10
|
* - generateObject / streamObject
|
|
11
11
|
* - embed / embedMany
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
15
|
* import { streamText } from 'ai';
|
|
16
|
-
* import {
|
|
16
|
+
* import { aippyAIProvider } from '@aippy/runtime/ai';
|
|
17
17
|
*
|
|
18
|
-
* const provider =
|
|
18
|
+
* const provider = aippyAIProvider();
|
|
19
19
|
* const result = await streamText({
|
|
20
20
|
* model: provider('gpt-5'),
|
|
21
21
|
* prompt: 'Hello!',
|
|
@@ -26,8 +26,6 @@
|
|
|
26
26
|
*
|
|
27
27
|
* Use config builders with @ai-sdk/react hooks:
|
|
28
28
|
* - useChat → aippyChatConfig()
|
|
29
|
-
* - useCompletion → aippyCompletionConfig()
|
|
30
|
-
* - useObject → aippyObjectConfig()
|
|
31
29
|
*
|
|
32
30
|
* ```tsx
|
|
33
31
|
* import { useChat } from '@ai-sdk/react';
|
|
@@ -38,8 +36,11 @@
|
|
|
38
36
|
*
|
|
39
37
|
* @module
|
|
40
38
|
*/
|
|
41
|
-
export {
|
|
39
|
+
export { aippyAIProvider, type AippyProvider } from './openai';
|
|
42
40
|
export type { AippyOpenAIConfig } from './openai';
|
|
43
|
-
|
|
41
|
+
/** @deprecated Use aippyAIProvider() instead */
|
|
42
|
+
export { aippyAIProvider as aippy } from './openai';
|
|
43
|
+
export { aippyChatConfig, type AippyUseChatOptions, type AippyUIConfig, type AippyChatConfig, UI_CHAT_ENDPOINT, } from './ui';
|
|
44
44
|
export { DEFAULT_BASE_URL, DEFAULT_UI_BASE_URL, DEFAULT_CHAT_MODEL, DEFAULT_CHAT_SYSTEM, } from './shared';
|
|
45
45
|
export { normalizeError, missingTokenError, abortedError, networkError, parseError, } from './errors';
|
|
46
|
+
export { type AIConfig, type AIConfigValue, type AIConfigItem, type NumberAIConfigItem, type BooleanAIConfigItem, type TextAIConfigItem, type EnumAIConfigItem, type AIConfigError, type AIConfigValues, AIConfigValidationError, validateAIConfig, parseAIConfig, loadAIConfig, getAIConfigValue, sendAIConfigToContainer, createAIConfig, } from './config';
|
package/dist/ai/index.js
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as i, D as A, d as n, e, c as E, U as C, f as p, a as g, a as t, b as I, j as T, i as _, l as f, m as U, g as d, n as D, h as L, p as l, s as m, v as F } from "../helper-CRGxnlsu.js";
|
|
2
2
|
import "react";
|
|
3
|
-
import "../bridge-
|
|
3
|
+
import "../bridge-D2d8hnO_.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
i as AIConfigValidationError,
|
|
6
|
+
A as DEFAULT_BASE_URL,
|
|
7
|
+
n as DEFAULT_CHAT_MODEL,
|
|
8
|
+
e as DEFAULT_CHAT_SYSTEM,
|
|
9
|
+
E as DEFAULT_UI_BASE_URL,
|
|
10
|
+
C as UI_CHAT_ENDPOINT,
|
|
11
|
+
p as abortedError,
|
|
12
|
+
g as aippy,
|
|
13
|
+
t as aippyAIProvider,
|
|
14
|
+
I as aippyChatConfig,
|
|
15
|
+
T as createAIConfig,
|
|
16
|
+
_ as getAIConfigValue,
|
|
17
|
+
f as loadAIConfig,
|
|
18
|
+
U as missingTokenError,
|
|
19
|
+
d as networkError,
|
|
20
|
+
D as normalizeError,
|
|
21
|
+
L as parseAIConfig,
|
|
22
|
+
l as parseError,
|
|
23
|
+
m as sendAIConfigToContainer,
|
|
24
|
+
F as validateAIConfig
|
|
22
25
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OpenAI-compatible module for Aippy AI SDK.
|
|
3
3
|
*
|
|
4
|
-
* Provides the `
|
|
4
|
+
* Provides the `aippyAIProvider()` provider factory for use with AI SDK Core functions:
|
|
5
5
|
* - generateText / streamText
|
|
6
6
|
* - generateObject / streamObject
|
|
7
7
|
* - embed / embedMany
|
|
8
8
|
* - generateImage
|
|
9
9
|
*/
|
|
10
|
-
export {
|
|
10
|
+
export { aippyAIProvider, type AippyProvider } from './provider';
|
|
11
11
|
export type { AippyOpenAIConfig } from '../shared/config';
|
|
@@ -19,9 +19,9 @@ export type AippyProvider = OpenAICompatibleProvider<string, string, string, str
|
|
|
19
19
|
* @example
|
|
20
20
|
* ```ts
|
|
21
21
|
* import { generateText, streamText, embed, generateImage } from 'ai';
|
|
22
|
-
* import {
|
|
22
|
+
* import { aippyAIProvider } from '@aippy/runtime/ai';
|
|
23
23
|
*
|
|
24
|
-
* const provider =
|
|
24
|
+
* const provider = aippyAIProvider();
|
|
25
25
|
*
|
|
26
26
|
* // Text generation
|
|
27
27
|
* const text = await generateText({
|
|
@@ -48,4 +48,4 @@ export type AippyProvider = OpenAICompatibleProvider<string, string, string, str
|
|
|
48
48
|
* });
|
|
49
49
|
* ```
|
|
50
50
|
*/
|
|
51
|
-
export declare function
|
|
51
|
+
export declare function aippyAIProvider(config?: AippyOpenAIConfig): AippyProvider;
|
package/dist/ai/ui/config.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { AippyUseChatOptions, UseObjectOptions, UseObjectConfigWithSchema } from './types';
|
|
1
|
+
import { AippyChatConfig } from '../shared';
|
|
2
|
+
import { AippyUseChatOptions } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* Creates configuration for the useChat hook.
|
|
6
5
|
*
|
|
@@ -24,58 +23,3 @@ import { AippyUseChatOptions, UseObjectOptions, UseObjectConfigWithSchema } from
|
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
25
|
export declare function aippyChatConfig(config?: AippyChatConfig): AippyUseChatOptions;
|
|
27
|
-
/**
|
|
28
|
-
* Creates configuration for the useCompletion hook.
|
|
29
|
-
*
|
|
30
|
-
* @param config - Optional configuration to override defaults
|
|
31
|
-
* @returns Promise resolving to configuration object to spread into useCompletion()
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```tsx
|
|
35
|
-
* import { useCompletion } from '@ai-sdk/react';
|
|
36
|
-
* import { aippyCompletionConfig } from '@aippy/runtime/ai';
|
|
37
|
-
*
|
|
38
|
-
* const config = await aippyCompletionConfig();
|
|
39
|
-
* const { completion, input, handleSubmit } = useCompletion(config);
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function aippyCompletionConfig(config?: AippyUIConfig): UseCompletionOptions;
|
|
43
|
-
/**
|
|
44
|
-
* Configuration options for aippyObjectConfig.
|
|
45
|
-
*/
|
|
46
|
-
export interface AippyObjectConfigOptions extends AippyUIConfig {
|
|
47
|
-
/**
|
|
48
|
-
* Schema identifier registered on the backend.
|
|
49
|
-
* Required for useObject to work with the Aippy backend.
|
|
50
|
-
*/
|
|
51
|
-
schemaId: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Creates configuration for the useObject hook.
|
|
55
|
-
*
|
|
56
|
-
* Note: Unlike useChat/useCompletion, useObject requires a schema.
|
|
57
|
-
* With the Aippy backend, we use schemaId to reference a pre-registered
|
|
58
|
-
* schema on the server (instead of passing the schema directly).
|
|
59
|
-
*
|
|
60
|
-
* @param options - Configuration including required schemaId
|
|
61
|
-
* @returns Promise resolving to configuration object to spread into useObject()
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* import { useObject } from '@ai-sdk/react';
|
|
66
|
-
* import { aippyObjectConfig } from '@aippy/runtime/ai';
|
|
67
|
-
*
|
|
68
|
-
* // The schemaId must match a schema registered on your backend
|
|
69
|
-
* const config = await aippyObjectConfig({ schemaId: 'user-profile' });
|
|
70
|
-
* const { object, submit } = useObject(config);
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare function aippyObjectConfig(options: AippyObjectConfigOptions): Promise<UseObjectConfigWithSchema>;
|
|
74
|
-
/**
|
|
75
|
-
* Creates base configuration for useObject without schemaId.
|
|
76
|
-
* Use this when you want to pass schemaId separately.
|
|
77
|
-
*
|
|
78
|
-
* @param config - Optional configuration to override defaults
|
|
79
|
-
* @returns Promise resolving to base configuration object (api + headers only)
|
|
80
|
-
*/
|
|
81
|
-
export declare function aippyObjectBaseConfig(config?: AippyUIConfig): Promise<UseObjectOptions>;
|
|
@@ -10,7 +10,3 @@
|
|
|
10
10
|
*/
|
|
11
11
|
/** Endpoint for useChat hook */
|
|
12
12
|
export declare const UI_CHAT_ENDPOINT = "/chat";
|
|
13
|
-
/** Endpoint for useCompletion hook */
|
|
14
|
-
export declare const UI_COMPLETION_ENDPOINT = "/completion";
|
|
15
|
-
/** Endpoint for useObject hook */
|
|
16
|
-
export declare const UI_OBJECT_ENDPOINT = "/object";
|
package/dist/ai/ui/index.d.ts
CHANGED
|
@@ -3,13 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides configuration builders for @ai-sdk/react hooks:
|
|
5
5
|
* - useChat → aippyChatConfig()
|
|
6
|
-
* - useCompletion → aippyCompletionConfig()
|
|
7
|
-
* - useObject → aippyObjectConfig()
|
|
8
6
|
*
|
|
9
7
|
* These hooks communicate with the Aippy backend using
|
|
10
8
|
* AI SDK Data Stream Protocol (SSE with x-vercel-ai-ui-message-stream: v1).
|
|
11
9
|
*/
|
|
12
|
-
export { aippyChatConfig
|
|
13
|
-
export type { AippyUseChatOptions
|
|
14
|
-
export { UI_CHAT_ENDPOINT
|
|
10
|
+
export { aippyChatConfig } from './config';
|
|
11
|
+
export type { AippyUseChatOptions } from './types';
|
|
12
|
+
export { UI_CHAT_ENDPOINT } from './endpoints';
|
|
15
13
|
export type { AippyUIConfig, AippyChatConfig } from '../shared/config';
|
package/dist/ai/ui/types.d.ts
CHANGED
|
@@ -18,29 +18,4 @@ export interface AippyUseChatOptions<UI_MESSAGE extends UIMessage = UIMessage> {
|
|
|
18
18
|
/** Transport for custom API communication */
|
|
19
19
|
transport: ChatTransport<UI_MESSAGE>;
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Base configuration for useObject hook.
|
|
23
|
-
*
|
|
24
|
-
* Similar to UseCompletionOptions but for useObject hook.
|
|
25
|
-
* We define this separately since useObject is from @ai-sdk/react, not 'ai'.
|
|
26
|
-
*/
|
|
27
|
-
export interface UseObjectOptions {
|
|
28
|
-
/** API endpoint URL */
|
|
29
|
-
api: string;
|
|
30
|
-
/** Headers to include in requests */
|
|
31
|
-
headers: Record<string, string>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Extended configuration for useObject with schemaId.
|
|
35
|
-
*
|
|
36
|
-
* This is Aippy-specific: we use schemaId to reference a pre-registered
|
|
37
|
-
* schema on the backend instead of passing the schema directly.
|
|
38
|
-
*/
|
|
39
|
-
export interface UseObjectConfigWithSchema extends UseObjectOptions {
|
|
40
|
-
/**
|
|
41
|
-
* Schema identifier registered on the backend.
|
|
42
|
-
* This will be included in the request body.
|
|
43
|
-
*/
|
|
44
|
-
schemaId: string;
|
|
45
|
-
}
|
|
46
21
|
export type { UseChatBody };
|