veryfront 0.0.9 → 0.0.10
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/index.js +238 -45
- package/dist/ai/index.js.map +4 -4
- package/dist/ai/react.d.ts +103 -2
- package/dist/cli.js +3912 -865
- package/dist/components.js +42 -38
- package/dist/components.js.map +4 -4
- package/dist/config.js +8 -0
- package/dist/config.js.map +3 -3
- package/dist/data.js +19 -2
- package/dist/data.js.map +4 -4
- package/dist/index.js +70 -52
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/ai/react.d.ts
CHANGED
|
@@ -1,3 +1,104 @@
|
|
|
1
1
|
// AI React hooks type definitions
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { Message } from 'ai';
|
|
3
|
+
import type { ReactNode, ChangeEvent, FormEvent } from 'react';
|
|
4
|
+
|
|
5
|
+
// UseChat Types
|
|
6
|
+
export interface UseChatOptions {
|
|
7
|
+
api: string;
|
|
8
|
+
initialMessages?: Message[];
|
|
9
|
+
body?: Record<string, unknown>;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
credentials?: RequestCredentials;
|
|
12
|
+
onResponse?: (response: Response) => void;
|
|
13
|
+
onFinish?: (message: Message) => void;
|
|
14
|
+
onError?: (error: Error) => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface UseChatResult {
|
|
18
|
+
messages: Message[];
|
|
19
|
+
input: string;
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
error: Error | null;
|
|
22
|
+
setInput: (input: string) => void;
|
|
23
|
+
append: (message: Omit<Message, "id" | "timestamp">) => Promise<void>;
|
|
24
|
+
reload: () => Promise<void>;
|
|
25
|
+
stop: () => void;
|
|
26
|
+
setMessages: (messages: Message[]) => void;
|
|
27
|
+
data?: unknown;
|
|
28
|
+
handleInputChange: (e: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
29
|
+
handleSubmit: (e: FormEvent) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export declare function useChat(options: UseChatOptions): UseChatResult;
|
|
33
|
+
|
|
34
|
+
// UseCompletion Types
|
|
35
|
+
export interface UseCompletionOptions {
|
|
36
|
+
api: string;
|
|
37
|
+
body?: Record<string, unknown>;
|
|
38
|
+
headers?: Record<string, string>;
|
|
39
|
+
onResponse?: (response: Response) => void;
|
|
40
|
+
onFinish?: (completion: string) => void;
|
|
41
|
+
onError?: (error: Error) => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface UseCompletionResult {
|
|
45
|
+
completion: string;
|
|
46
|
+
isLoading: boolean;
|
|
47
|
+
error: Error | null;
|
|
48
|
+
complete: (prompt: string) => Promise<void>;
|
|
49
|
+
stop: () => void;
|
|
50
|
+
setCompletion: (completion: string) => void;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export declare function useCompletion(options: UseCompletionOptions): UseCompletionResult;
|
|
54
|
+
|
|
55
|
+
// UseAgent Types (Custom)
|
|
56
|
+
export type AgentStatus = "idle" | "thinking" | "executing" | "completed" | "error";
|
|
57
|
+
|
|
58
|
+
export interface ToolCall {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
arguments: unknown;
|
|
62
|
+
status: "pending" | "executing" | "completed" | "error";
|
|
63
|
+
result?: unknown;
|
|
64
|
+
error?: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface UseAgentOptions {
|
|
68
|
+
agent: string;
|
|
69
|
+
onToolCall?: (toolCall: ToolCall) => void;
|
|
70
|
+
onToolResult?: (toolCall: ToolCall, result: unknown) => void;
|
|
71
|
+
onError?: (error: Error) => void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface UseAgentResult {
|
|
75
|
+
messages: Message[];
|
|
76
|
+
toolCalls: ToolCall[];
|
|
77
|
+
status: AgentStatus;
|
|
78
|
+
thinking?: string;
|
|
79
|
+
invoke: (input: string) => Promise<void>;
|
|
80
|
+
stop: () => void;
|
|
81
|
+
isLoading: boolean;
|
|
82
|
+
error: Error | null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare function useAgent(options: UseAgentOptions): UseAgentResult;
|
|
86
|
+
|
|
87
|
+
// UseStreaming Types
|
|
88
|
+
export interface UseStreamingOptions {
|
|
89
|
+
url: string;
|
|
90
|
+
onChunk?: (chunk: string) => void;
|
|
91
|
+
onComplete?: () => void;
|
|
92
|
+
onError?: (error: Error) => void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface UseStreamingResult {
|
|
96
|
+
data: string;
|
|
97
|
+
isStreaming: boolean;
|
|
98
|
+
error: Error | null;
|
|
99
|
+
start: (body?: Record<string, unknown>) => Promise<void>;
|
|
100
|
+
stop: () => void;
|
|
101
|
+
reset: () => void;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare function useStreaming(options: UseStreamingOptions): UseStreamingResult;
|