@galvanized-pukeko/vue-ui 0.0.2 → 0.0.3
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/src/components/a2ui/catalog.d.ts +2 -0
- package/dist/src/composables/useA2UI.d.ts +77 -0
- package/dist/src/index.d.ts +0 -1
- package/dist/src/services/chatService.d.ts +42 -49
- package/dist/src/services/configService.d.ts +2 -3
- package/dist/vue-ui.css +1 -1
- package/dist/vue-ui.es.js +1119 -952
- package/dist/vue-ui.umd.js +1 -3
- package/package.json +3 -2
- package/dist/src/services/connectionService.d.ts +0 -43
- package/dist/src/types/jsonrpc.d.ts +0 -22
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Ref, InjectionKey } from 'vue';
|
|
2
|
+
import { ChatCallbacks } from '../services/chatService';
|
|
3
|
+
interface Action {
|
|
4
|
+
name: string;
|
|
5
|
+
context?: Array<{
|
|
6
|
+
key: string;
|
|
7
|
+
value: {
|
|
8
|
+
path?: string;
|
|
9
|
+
literalString?: string;
|
|
10
|
+
literalNumber?: number;
|
|
11
|
+
literalBoolean?: boolean;
|
|
12
|
+
};
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
interface BaseComponentNode {
|
|
16
|
+
id: string;
|
|
17
|
+
type: string;
|
|
18
|
+
dataContextPath?: string;
|
|
19
|
+
weight?: number | string;
|
|
20
|
+
properties: Record<string, any>;
|
|
21
|
+
}
|
|
22
|
+
export type AnyComponentNode = BaseComponentNode;
|
|
23
|
+
export interface Surface {
|
|
24
|
+
rootComponentId: string | null;
|
|
25
|
+
componentTree: AnyComponentNode | null;
|
|
26
|
+
dataModel: Map<string, any>;
|
|
27
|
+
components: Map<string, any>;
|
|
28
|
+
styles: Record<string, string>;
|
|
29
|
+
}
|
|
30
|
+
interface ServerToClientMessage {
|
|
31
|
+
surfaceUpdate?: any;
|
|
32
|
+
dataModelUpdate?: any;
|
|
33
|
+
beginRendering?: any;
|
|
34
|
+
deleteSurface?: any;
|
|
35
|
+
}
|
|
36
|
+
declare class SimpleA2UIProcessor {
|
|
37
|
+
static readonly DEFAULT_SURFACE_ID = "@default";
|
|
38
|
+
private surfaces;
|
|
39
|
+
getSurfaces(): ReadonlyMap<string, Surface>;
|
|
40
|
+
clearSurfaces(): void;
|
|
41
|
+
processMessages(messages: ServerToClientMessage[]): void;
|
|
42
|
+
getData(node: AnyComponentNode, relativePath: string, surfaceId?: string): any;
|
|
43
|
+
setData(node: AnyComponentNode | null, relativePath: string, value: any, surfaceId?: string): void;
|
|
44
|
+
resolvePath(path: string, dataContextPath?: string): string;
|
|
45
|
+
private getOrCreateSurface;
|
|
46
|
+
private handleSurfaceUpdate;
|
|
47
|
+
private handleDataModelUpdate;
|
|
48
|
+
private convertKeyValueArray;
|
|
49
|
+
private handleBeginRendering;
|
|
50
|
+
private handleDeleteSurface;
|
|
51
|
+
private rebuildComponentTree;
|
|
52
|
+
private buildNode;
|
|
53
|
+
private resolveProperty;
|
|
54
|
+
private setDataByPath;
|
|
55
|
+
private getDataByPath;
|
|
56
|
+
}
|
|
57
|
+
export interface UserAction {
|
|
58
|
+
actionName: string;
|
|
59
|
+
sourceComponentId: string;
|
|
60
|
+
timestamp: string;
|
|
61
|
+
context?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
export interface A2UIContext {
|
|
64
|
+
sendAction: (surfaceId: string, action: Action, sourceComponentId: string, node?: AnyComponentNode) => void;
|
|
65
|
+
processor: SimpleA2UIProcessor;
|
|
66
|
+
}
|
|
67
|
+
export declare const A2UIContextKey: InjectionKey<A2UIContext>;
|
|
68
|
+
export declare function useA2UI(): {
|
|
69
|
+
surfaces: Ref<Map<string, Surface>, Map<string, Surface>>;
|
|
70
|
+
pendingToolCallId: Ref<string | null, string | null>;
|
|
71
|
+
processBatch: (messages: ServerToClientMessage[]) => void;
|
|
72
|
+
clearSurfaces: () => void;
|
|
73
|
+
sendAction: (surfaceId: string, action: Action, sourceComponentId: string, node?: AnyComponentNode) => void;
|
|
74
|
+
setCallbacks: (cb: ChatCallbacks) => void;
|
|
75
|
+
processor: SimpleA2UIProcessor;
|
|
76
|
+
};
|
|
77
|
+
export {};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -16,5 +16,4 @@ import { default as PkLogoLarge } from './components/PkLogoLarge.vue';
|
|
|
16
16
|
import { default as PkNavItem } from './components/PkNavItem.vue';
|
|
17
17
|
export { CoreApp };
|
|
18
18
|
export * from './services/configService';
|
|
19
|
-
export * from './services/connectionService';
|
|
20
19
|
export { PkForm, PkInput, PkCheckbox, PkRadio, PkSelect, PkButton, PkInputCounter, PkBarChart, PkPieChart, PkTable, ChatInterface, PkNavHeader, PkLogo, PkLogoLarge, PkNavItem };
|
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
functionCall?: FunctionCall;
|
|
26
|
-
functionResponse?: FunctionResponse;
|
|
27
|
-
}
|
|
28
|
-
interface ChatMessage {
|
|
29
|
-
role: 'user' | 'model';
|
|
30
|
-
parts: ChatMessagePart[];
|
|
31
|
-
}
|
|
32
|
-
interface ChatResponse {
|
|
33
|
-
id: string;
|
|
34
|
-
invocationId: string;
|
|
35
|
-
author: string;
|
|
36
|
-
content: ChatMessage;
|
|
37
|
-
actions: {
|
|
38
|
-
stateDelta: Record<string, unknown>;
|
|
39
|
-
artifactDelta: Record<string, unknown>;
|
|
40
|
-
requestedAuthConfigs: Record<string, unknown>;
|
|
41
|
-
};
|
|
42
|
-
timestamp: number;
|
|
43
|
-
}
|
|
44
|
-
interface CompleteChatResponse {
|
|
45
|
-
chunks: ChatResponse[];
|
|
46
|
-
finalMessage: ChatResponse;
|
|
1
|
+
import { Message } from '@ag-ui/client';
|
|
2
|
+
export interface StreamingSlot {
|
|
3
|
+
messageId: string;
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ToolCallInfo {
|
|
7
|
+
toolCallId: string;
|
|
8
|
+
toolCallName: string;
|
|
9
|
+
toolCallBuffer: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ToolCallRecord {
|
|
12
|
+
toolCallId: string;
|
|
13
|
+
toolCallName: string;
|
|
14
|
+
args: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ChatCallbacks {
|
|
17
|
+
onStreamStart: (messageId: string) => void;
|
|
18
|
+
onStreamDelta: (messageId: string, fullText: string) => void;
|
|
19
|
+
onStreamEnd: (messageId: string, finalText: string) => void;
|
|
20
|
+
onToolCallComplete?: (record: ToolCallRecord) => void;
|
|
21
|
+
onToolCallStart?: (toolCallId: string, toolCallName: string) => void;
|
|
22
|
+
onToolCallEnd?: (toolCallId: string, toolCallName: string, toolCallBuffer: string) => void;
|
|
23
|
+
onToolCallResult?: (toolCallId: string, toolCallName: string, content: string) => void;
|
|
24
|
+
onError: (error: string) => void;
|
|
47
25
|
}
|
|
48
26
|
declare class ChatService {
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
private agent;
|
|
28
|
+
private ensureAgent;
|
|
29
|
+
/**
|
|
30
|
+
* Reset the conversation (new thread)
|
|
31
|
+
*/
|
|
32
|
+
resetThread(): void;
|
|
33
|
+
getThreadId(): string;
|
|
34
|
+
/**
|
|
35
|
+
* Send a message and stream the response in real-time via callbacks.
|
|
36
|
+
*/
|
|
37
|
+
sendMessage(text: string, callbacks: ChatCallbacks): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Submit a user action (e.g. form submission) as a user message and stream the follow-up response.
|
|
40
|
+
* User actions are NOT sent as tool messages — the show_a2ui_surface tool call is already resolved
|
|
41
|
+
* once the surfaceJsonl is returned. A second tool message for the same toolCallId would be invalid.
|
|
42
|
+
*/
|
|
43
|
+
submitToolResult(_toolCallId: string, content: string, callbacks?: ChatCallbacks): Promise<void>;
|
|
51
44
|
}
|
|
52
45
|
export declare const chatService: ChatService;
|
|
53
|
-
export type {
|
|
46
|
+
export type { Message };
|