@aheart-ui/ai 0.0.0-stage → 1.0.0

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.
Files changed (115) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +21 -2
  3. package/es/actions.vue.d.ts +34 -0
  4. package/es/actions.vue.js +27 -0
  5. package/es/actions.vue2.js +4 -0
  6. package/es/agent-execution.vue.d.ts +106 -0
  7. package/es/agent-execution.vue.js +441 -0
  8. package/es/agent-execution.vue2.js +4 -0
  9. package/es/agent-workbench.vue.d.ts +186 -0
  10. package/es/agent-workbench.vue.js +537 -0
  11. package/es/agent-workbench.vue2.js +4 -0
  12. package/es/attachments.vue.d.ts +39 -0
  13. package/es/attachments.vue.js +39 -0
  14. package/es/attachments.vue2.js +4 -0
  15. package/es/bubble.vue.d.ts +27 -0
  16. package/es/bubble.vue.js +82 -0
  17. package/es/bubble.vue2.js +4 -0
  18. package/es/chat-panel.vue.d.ts +108 -0
  19. package/es/chat-panel.vue.js +330 -0
  20. package/es/chat-panel.vue2.js +4 -0
  21. package/es/conversations.vue.d.ts +39 -0
  22. package/es/conversations.vue.js +29 -0
  23. package/es/conversations.vue2.js +4 -0
  24. package/es/form-field.vue.d.ts +28 -0
  25. package/es/form-field.vue.js +176 -0
  26. package/es/form-field.vue2.js +4 -0
  27. package/es/form-schema.d.ts +73 -0
  28. package/es/form-schema.js +105 -0
  29. package/es/form.vue.d.ts +81 -0
  30. package/es/form.vue.js +376 -0
  31. package/es/form.vue2.js +4 -0
  32. package/es/index.d.ts +20 -0
  33. package/es/index.js +42 -0
  34. package/es/package.json +3 -0
  35. package/es/process.vue.d.ts +30 -0
  36. package/es/process.vue.js +29 -0
  37. package/es/process.vue2.js +4 -0
  38. package/es/prompts.vue.d.ts +39 -0
  39. package/es/prompts.vue.js +33 -0
  40. package/es/prompts.vue2.js +4 -0
  41. package/es/safe-markdown.d.ts +3 -0
  42. package/es/safe-markdown.js +23 -0
  43. package/es/sender.vue.d.ts +52 -0
  44. package/es/sender.vue.js +46 -0
  45. package/es/sender.vue2.js +4 -0
  46. package/es/sources.vue.d.ts +30 -0
  47. package/es/sources.vue.js +34 -0
  48. package/es/sources.vue2.js +4 -0
  49. package/es/stream-reducer.d.ts +35 -0
  50. package/es/stream-reducer.js +85 -0
  51. package/es/style.css +1586 -0
  52. package/es/thought-chain.vue.d.ts +30 -0
  53. package/es/thought-chain.vue.js +15 -0
  54. package/es/thought-chain.vue2.js +4 -0
  55. package/es/types.d.ts +203 -0
  56. package/es/welcome.vue.d.ts +41 -0
  57. package/es/welcome.vue.js +27 -0
  58. package/es/welcome.vue2.js +4 -0
  59. package/lib/actions.vue.d.ts +34 -0
  60. package/lib/actions.vue.js +1 -0
  61. package/lib/actions.vue2.js +1 -0
  62. package/lib/agent-execution.vue.d.ts +106 -0
  63. package/lib/agent-execution.vue.js +1 -0
  64. package/lib/agent-execution.vue2.js +1 -0
  65. package/lib/agent-workbench.vue.d.ts +186 -0
  66. package/lib/agent-workbench.vue.js +1 -0
  67. package/lib/agent-workbench.vue2.js +1 -0
  68. package/lib/attachments.vue.d.ts +39 -0
  69. package/lib/attachments.vue.js +1 -0
  70. package/lib/attachments.vue2.js +1 -0
  71. package/lib/bubble.vue.d.ts +27 -0
  72. package/lib/bubble.vue.js +1 -0
  73. package/lib/bubble.vue2.js +1 -0
  74. package/lib/chat-panel.vue.d.ts +108 -0
  75. package/lib/chat-panel.vue.js +1 -0
  76. package/lib/chat-panel.vue2.js +1 -0
  77. package/lib/conversations.vue.d.ts +39 -0
  78. package/lib/conversations.vue.js +1 -0
  79. package/lib/conversations.vue2.js +1 -0
  80. package/lib/form-field.vue.d.ts +28 -0
  81. package/lib/form-field.vue.js +1 -0
  82. package/lib/form-field.vue2.js +1 -0
  83. package/lib/form-schema.d.ts +73 -0
  84. package/lib/form-schema.js +1 -0
  85. package/lib/form.vue.d.ts +81 -0
  86. package/lib/form.vue.js +1 -0
  87. package/lib/form.vue2.js +1 -0
  88. package/lib/index.d.ts +20 -0
  89. package/lib/index.js +1 -0
  90. package/lib/package.json +3 -0
  91. package/lib/process.vue.d.ts +30 -0
  92. package/lib/process.vue.js +1 -0
  93. package/lib/process.vue2.js +1 -0
  94. package/lib/prompts.vue.d.ts +39 -0
  95. package/lib/prompts.vue.js +1 -0
  96. package/lib/prompts.vue2.js +1 -0
  97. package/lib/safe-markdown.d.ts +3 -0
  98. package/lib/safe-markdown.js +2 -0
  99. package/lib/sender.vue.d.ts +52 -0
  100. package/lib/sender.vue.js +1 -0
  101. package/lib/sender.vue2.js +1 -0
  102. package/lib/sources.vue.d.ts +30 -0
  103. package/lib/sources.vue.js +1 -0
  104. package/lib/sources.vue2.js +1 -0
  105. package/lib/stream-reducer.d.ts +35 -0
  106. package/lib/stream-reducer.js +1 -0
  107. package/lib/style.css +1586 -0
  108. package/lib/thought-chain.vue.d.ts +30 -0
  109. package/lib/thought-chain.vue.js +1 -0
  110. package/lib/thought-chain.vue2.js +1 -0
  111. package/lib/types.d.ts +203 -0
  112. package/lib/welcome.vue.d.ts +41 -0
  113. package/lib/welcome.vue.js +1 -0
  114. package/lib/welcome.vue2.js +1 -0
  115. package/package.json +70 -3
@@ -0,0 +1,30 @@
1
+ import type { AIProcessItem } from './types';
2
+ declare const _default: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ items?: AIProcessItem[] | undefined;
4
+ }>, {
5
+ items: () => never[];
6
+ }>>, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
7
+ items?: AIProcessItem[] | undefined;
8
+ }>, {
9
+ items: () => never[];
10
+ }>>> & Readonly<{}>, {
11
+ items: AIProcessItem[];
12
+ }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: import('vue').PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
23
+ type __VLS_WithDefaults<P, D> = {
24
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
25
+ default: D[K];
26
+ }> : P[K];
27
+ };
28
+ type __VLS_Prettify<T> = {
29
+ [K in keyof T]: T[K];
30
+ } & {};
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),u=require("./process.vue.js"),n=e.defineComponent({name:"AAIThoughtChain",__name:"thought-chain",props:{items:{default:()=>[]}},setup(t){return(r,s)=>(e.openBlock(),e.createBlock(u.default,{items:t.items},null,8,["items"]))}});exports.default=n;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./thought-chain.vue.js");exports.default=e.default;
package/lib/types.d.ts ADDED
@@ -0,0 +1,203 @@
1
+ export type AIMessageRole = 'user' | 'assistant' | 'system' | 'tool';
2
+ export type AIMessageStatus = 'complete' | 'streaming' | 'stopped' | 'error';
3
+ export type AIProcessStatus = 'pending' | 'running' | 'complete' | 'stopped' | 'error';
4
+ export interface AIAttachment {
5
+ id: string;
6
+ name: string;
7
+ url?: string;
8
+ type?: string;
9
+ size?: number;
10
+ }
11
+ export interface AISource {
12
+ id: string;
13
+ title: string;
14
+ url?: string;
15
+ description?: string;
16
+ }
17
+ export interface AIProcessItem {
18
+ id: string;
19
+ label: string;
20
+ status: AIProcessStatus;
21
+ detail?: string;
22
+ }
23
+ export interface AIMessage {
24
+ id: string;
25
+ role: AIMessageRole;
26
+ content: string;
27
+ status?: AIMessageStatus;
28
+ attachments?: AIAttachment[];
29
+ sources?: AISource[];
30
+ process?: AIProcessItem[];
31
+ error?: string;
32
+ retryable?: boolean;
33
+ toolCall?: AIToolCallDisplay;
34
+ }
35
+ export interface AIToolCallDisplay {
36
+ id: string;
37
+ name: string;
38
+ summary: string;
39
+ inputStatus?: 'pending' | 'ready' | 'redacted';
40
+ inputSummary?: string;
41
+ resultStatus?: 'pending' | 'success' | 'error';
42
+ resultSummary?: string;
43
+ error?: string;
44
+ }
45
+ export type AIContentRenderer = (message: AIMessage) => VNodeChild;
46
+ export type AIChatAction = 'send' | 'retry' | 'regenerate' | 'edit';
47
+ export interface AIChatRequest {
48
+ conversationId?: string;
49
+ messages: AIMessage[];
50
+ action?: AIChatAction;
51
+ messageId?: string;
52
+ }
53
+ export type AIStreamEvent = {
54
+ type: 'text-delta';
55
+ delta: string;
56
+ } | {
57
+ type: 'process';
58
+ item: AIProcessItem;
59
+ } | {
60
+ type: 'sources';
61
+ sources: AISource[];
62
+ } | {
63
+ type: 'done';
64
+ } | {
65
+ type: 'cancelled';
66
+ } | {
67
+ type: 'error';
68
+ error: string;
69
+ };
70
+ export interface AITransport {
71
+ send(request: AIChatRequest, signal: AbortSignal): AsyncIterable<AIStreamEvent>;
72
+ }
73
+ export interface AIStreamEventBaseV2 {
74
+ version: '2';
75
+ requestId: string;
76
+ messageId: string;
77
+ sequence: number;
78
+ revision: number;
79
+ }
80
+ export type AIStreamEventV2 = (AIStreamEventBaseV2 & {
81
+ type: 'text-delta';
82
+ delta: string;
83
+ }) | (AIStreamEventBaseV2 & {
84
+ type: 'process-upsert';
85
+ item: AIProcessItem;
86
+ }) | (AIStreamEventBaseV2 & {
87
+ type: 'sources-replace';
88
+ sources: AISource[];
89
+ }) | (AIStreamEventBaseV2 & {
90
+ type: 'snapshot';
91
+ message: AIMessage;
92
+ }) | (AIStreamEventBaseV2 & {
93
+ type: 'final';
94
+ message: AIMessage;
95
+ }) | (AIStreamEventBaseV2 & {
96
+ type: 'cancelled';
97
+ reason?: string;
98
+ }) | (AIStreamEventBaseV2 & {
99
+ type: 'error';
100
+ error: string;
101
+ retryable?: boolean;
102
+ });
103
+ export interface AIChatResumeCursorV2 {
104
+ afterSequence: number;
105
+ revision: number;
106
+ }
107
+ export interface AIChatRequestV2 extends Omit<AIChatRequest, 'messageId'> {
108
+ version: '2';
109
+ requestId: string;
110
+ messageId: string;
111
+ targetMessageId?: string;
112
+ idempotencyKey: string;
113
+ resume?: AIChatResumeCursorV2;
114
+ }
115
+ export interface AITransportV2 {
116
+ version: '2';
117
+ send(request: AIChatRequestV2, signal: AbortSignal): AsyncIterable<AIStreamEventV2>;
118
+ resume?(request: AIChatRequestV2, signal: AbortSignal): AsyncIterable<AIStreamEventV2>;
119
+ }
120
+ export interface AIPrompt {
121
+ key: string;
122
+ label: string;
123
+ description?: string;
124
+ }
125
+ export interface AIConversation {
126
+ key: string;
127
+ label: string;
128
+ disabled?: boolean;
129
+ }
130
+ export interface AIAction {
131
+ key: string;
132
+ label: string;
133
+ disabled?: boolean;
134
+ }
135
+ export type AIAgentTaskStatus = 'pending' | 'running' | 'waiting-approval' | 'complete' | 'error' | 'cancelled';
136
+ export type AIAgentApprovalStatus = 'pending' | 'approved' | 'rejected';
137
+ export type AIAgentTaskKind = 'task' | 'tool' | 'approval';
138
+ export interface AIAgentApproval {
139
+ id: string;
140
+ title: string;
141
+ description?: string;
142
+ artifactId?: string;
143
+ status?: AIAgentApprovalStatus;
144
+ }
145
+ export interface AIAgentTask {
146
+ id: string;
147
+ label: string;
148
+ status: AIAgentTaskStatus;
149
+ kind?: AIAgentTaskKind;
150
+ detail?: string;
151
+ error?: string;
152
+ toolName?: string;
153
+ progress?: number;
154
+ startedAt?: string;
155
+ completedAt?: string;
156
+ approval?: AIAgentApproval;
157
+ revision?: string | number;
158
+ dependsOn?: string[];
159
+ reorderable?: boolean;
160
+ lockedReason?: string;
161
+ toolCall?: AIToolCallDisplay;
162
+ }
163
+ export interface AIAgentContextItem {
164
+ id: string;
165
+ label: string;
166
+ description?: string;
167
+ disabled?: boolean;
168
+ }
169
+ export interface AIAgentArtifact {
170
+ id: string;
171
+ title: string;
172
+ description?: string;
173
+ type?: string;
174
+ url?: string;
175
+ status?: 'draft' | 'ready' | 'error';
176
+ updatedAt?: string;
177
+ revision?: string | number;
178
+ }
179
+ export type AIAgentOperationAction = 'approve' | 'reject' | 'cancel' | 'retry';
180
+ export type AIAgentOperationStatus = 'idle' | 'pending' | 'success' | 'error';
181
+ export interface AIAgentOperationRequest {
182
+ operationId: string;
183
+ idempotencyKey: string;
184
+ conversationId?: string;
185
+ taskId: string;
186
+ taskRevision: string | number;
187
+ action: AIAgentOperationAction;
188
+ approvalId?: string;
189
+ artifactId?: string;
190
+ artifactRevision?: string | number;
191
+ }
192
+ export type AIAgentOperationResult = {
193
+ status: 'success';
194
+ operationId: string;
195
+ } | {
196
+ status: 'error';
197
+ operationId: string;
198
+ error: string;
199
+ retryable?: boolean;
200
+ outcome?: 'not-applied' | 'unknown';
201
+ };
202
+ export type AIAgentActionHandler = (request: AIAgentOperationRequest, signal: AbortSignal) => Promise<AIAgentOperationResult>;
203
+ import type { VNodeChild } from 'vue';
@@ -0,0 +1,41 @@
1
+ declare const _default: __VLS_WithTemplateSlots<import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
2
+ title?: string | undefined;
3
+ description?: string | undefined;
4
+ }>, {
5
+ title: string;
6
+ description: undefined;
7
+ }>>, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
8
+ title?: string | undefined;
9
+ description?: string | undefined;
10
+ }>, {
11
+ title: string;
12
+ description: undefined;
13
+ }>>> & Readonly<{}>, {
14
+ title: string;
15
+ description: string;
16
+ }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>, {
17
+ default?(_: {}): any;
18
+ }>;
19
+ export default _default;
20
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
+ type __VLS_TypePropsToRuntimeProps<T> = {
22
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
23
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
+ } : {
25
+ type: import('vue').PropType<T[K]>;
26
+ required: true;
27
+ };
28
+ };
29
+ type __VLS_WithDefaults<P, D> = {
30
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
+ default: D[K];
32
+ }> : P[K];
33
+ };
34
+ type __VLS_Prettify<T> = {
35
+ [K in keyof T]: T[K];
36
+ } & {};
37
+ type __VLS_WithTemplateSlots<T, S> = T & {
38
+ new (): {
39
+ $slots: S;
40
+ };
41
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),c={class:"aheart-ai-welcome"},l={class:"aheart-ai-welcome__title"},a={key:0,class:"aheart-ai-welcome__description"},n={key:1,class:"aheart-ai-welcome__content"},s=e.defineComponent({name:"AAIWelcome",__name:"welcome",props:{title:{default:"你好,我能为你做些什么?"},description:{default:void 0}},setup(t){return(o,i)=>(e.openBlock(),e.createElementBlock("section",c,[e.createElementVNode("h2",l,e.toDisplayString(t.title),1),t.description?(e.openBlock(),e.createElementBlock("p",a,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0),o.$slots.default?(e.openBlock(),e.createElementBlock("div",n,[e.renderSlot(o.$slots,"default")])):e.createCommentVNode("",!0)]))}});exports.default=s;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./welcome.vue.js");exports.default=e.default;
package/package.json CHANGED
@@ -1,6 +1,73 @@
1
1
  {
2
2
  "name": "@aheart-ui/ai",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "Vue 3 AI interface components for Aheart UI.",
5
+ "main": "lib/index.js",
6
+ "module": "es/index.js",
7
+ "types": "es/index.d.ts",
8
+ "sideEffects": [
9
+ "**/*.css"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./es/index.d.ts",
14
+ "import": "./es/index.js",
15
+ "require": "./lib/index.js"
16
+ },
17
+ "./style.css": "./es/style.css",
18
+ "./es/*": "./es/*",
19
+ "./lib/*": "./lib/*",
20
+ "./package.json": "./package.json"
21
+ },
22
+ "files": [
23
+ "es",
24
+ "lib"
25
+ ],
26
+ "keywords": [
27
+ "aheart-ui",
28
+ "vue3",
29
+ "ai",
30
+ "chat",
31
+ "agent",
32
+ "form"
33
+ ],
34
+ "author": "小凡",
35
+ "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/wzfdhr/aheart-ui.git",
39
+ "directory": "packages/ai"
40
+ },
41
+ "homepage": "https://github.com/wzfdhr/aheart-ui#readme",
42
+ "bugs": {
43
+ "url": "https://github.com/wzfdhr/aheart-ui/issues"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public",
47
+ "registry": "https://registry.npmjs.org/"
48
+ },
49
+ "peerDependencies": {
50
+ "aheart-ui": "^1.1.0",
51
+ "vue": ">=3.5.0 <4"
52
+ },
53
+ "dependencies": {
54
+ "@aheart-ui/dnd": "^1.0.0"
55
+ },
56
+ "devDependencies": {
57
+ "@vitejs/plugin-vue": "^5.0.3",
58
+ "@vitest/coverage-v8": "1.6.1",
59
+ "@vue/test-utils": "^2.4.6",
60
+ "jsdom": "^24.1.1",
61
+ "vite": "^5.0.12",
62
+ "vite-plugin-dts": "^3.7.2",
63
+ "vitest": "^1.6.1",
64
+ "vue": "^3.5.38",
65
+ "vue-tsc": "^2.0.29"
66
+ },
67
+ "scripts": {
68
+ "build": "vite build",
69
+ "typecheck": "vue-tsc --noEmit -p tsconfig.json",
70
+ "test": "vitest run --environment jsdom",
71
+ "test:coverage": "vitest run --environment jsdom --coverage"
72
+ }
6
73
  }