@galvanized-pukeko/vue-ui 0.0.1 → 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/index.d.ts +2 -0
- 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 +19 -0
- package/dist/src/services/chatService.d.ts +46 -0
- package/dist/src/services/configService.d.ts +21 -0
- package/dist/vue-ui.css +1 -0
- package/dist/vue-ui.es.js +1119 -973
- package/dist/vue-ui.umd.js +1 -3
- package/package.json +10 -7
- package/dist/style.css +0 -1
package/dist/index.d.ts
ADDED
|
@@ -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 {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as CoreApp } from './CoreApp.vue';
|
|
2
|
+
import { default as PkForm } from './components/PkForm.vue';
|
|
3
|
+
import { default as PkInput } from './components/PkInput.vue';
|
|
4
|
+
import { default as PkCheckbox } from './components/PkCheckbox.vue';
|
|
5
|
+
import { default as PkRadio } from './components/PkRadio.vue';
|
|
6
|
+
import { default as PkSelect } from './components/PkSelect.vue';
|
|
7
|
+
import { default as PkButton } from './components/PkButton.vue';
|
|
8
|
+
import { default as PkInputCounter } from './components/PkInputCounter.vue';
|
|
9
|
+
import { default as PkBarChart } from './components/PkBarChart.vue';
|
|
10
|
+
import { default as PkPieChart } from './components/PkPieChart.vue';
|
|
11
|
+
import { default as PkTable } from './components/PkTable.vue';
|
|
12
|
+
import { default as ChatInterface } from './components/ChatInterface.vue';
|
|
13
|
+
import { default as PkNavHeader } from './components/PkNavHeader.vue';
|
|
14
|
+
import { default as PkLogo } from './components/PkLogo.vue';
|
|
15
|
+
import { default as PkLogoLarge } from './components/PkLogoLarge.vue';
|
|
16
|
+
import { default as PkNavItem } from './components/PkNavItem.vue';
|
|
17
|
+
export { CoreApp };
|
|
18
|
+
export * from './services/configService';
|
|
19
|
+
export { PkForm, PkInput, PkCheckbox, PkRadio, PkSelect, PkButton, PkInputCounter, PkBarChart, PkPieChart, PkTable, ChatInterface, PkNavHeader, PkLogo, PkLogoLarge, PkNavItem };
|
|
@@ -0,0 +1,46 @@
|
|
|
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;
|
|
25
|
+
}
|
|
26
|
+
declare class ChatService {
|
|
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>;
|
|
44
|
+
}
|
|
45
|
+
export declare const chatService: ChatService;
|
|
46
|
+
export type { Message };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
interface UiConfigItem {
|
|
2
|
+
text?: string;
|
|
3
|
+
href?: string;
|
|
4
|
+
img?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface UiConfig {
|
|
7
|
+
agUiUrl: string;
|
|
8
|
+
appName?: string;
|
|
9
|
+
pageTitle?: string;
|
|
10
|
+
configUrl?: string;
|
|
11
|
+
logo?: UiConfigItem;
|
|
12
|
+
header?: UiConfigItem[];
|
|
13
|
+
footer?: UiConfigItem[];
|
|
14
|
+
}
|
|
15
|
+
declare class ConfigService {
|
|
16
|
+
private config;
|
|
17
|
+
load(): Promise<void>;
|
|
18
|
+
get(): UiConfig;
|
|
19
|
+
}
|
|
20
|
+
export declare const configService: ConfigService;
|
|
21
|
+
export {};
|