@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aheart UI contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,22 @@
1
- # Temporary Holding Version
1
+ # @aheart-ui/ai
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Aheart UI 的后端无关 AI 产品组件包,提供 AIChatPanel、AIForm、AIAgentWorkbench 与配套原子组件。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pnpm add @aheart-ui/ai @aheart-ui/dnd aheart-ui vue
9
+ ```
10
+
11
+ ```ts
12
+ import { AIChatPanel } from '@aheart-ui/ai'
13
+ import 'aheart-ui/style.css'
14
+ import '@aheart-ui/dnd/style.css'
15
+ import '@aheart-ui/ai/style.css'
16
+ ```
17
+
18
+ 该包不包含模型 SDK、API Key、鉴权或持久化。业务层通过 `AITransport` 接入流式服务。Vue `>=3.4.0 <4` 和 `aheart-ui` 由业务应用提供。
19
+
20
+ AIForm 的日期时间字段包含 `date`、`time`、`date-range` 与 `time-range`,所有值均为字符串或完整双端字符串范围,不向业务 schema 暴露 Dayjs。运行时会拒绝不可解析的日期时间默认值;必填范围不允许单端为空。
21
+
22
+ 完整用法见[中文 AI 对话文档](https://github.com/wzfdhr/aheart-ui/blob/master/docs/components/ai.md)、[AIForm 文档](https://github.com/wzfdhr/aheart-ui/blob/master/docs/components/ai-form.md)和[工作台文档](https://github.com/wzfdhr/aheart-ui/blob/master/docs/components/ai-agent-workbench.md)。
@@ -0,0 +1,34 @@
1
+ import type { AIAction } from './types';
2
+ declare const _default: import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ actions?: AIAction[] | undefined;
4
+ }>, {
5
+ actions: () => never[];
6
+ }>>, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
7
+ select: (action: AIAction) => void;
8
+ }, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
9
+ actions?: AIAction[] | undefined;
10
+ }>, {
11
+ actions: () => never[];
12
+ }>>> & Readonly<{
13
+ onSelect?: ((action: AIAction) => any) | undefined;
14
+ }>, {
15
+ actions: AIAction[];
16
+ }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>;
17
+ export default _default;
18
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
19
+ type __VLS_TypePropsToRuntimeProps<T> = {
20
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
21
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
22
+ } : {
23
+ type: import('vue').PropType<T[K]>;
24
+ required: true;
25
+ };
26
+ };
27
+ type __VLS_WithDefaults<P, D> = {
28
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
29
+ default: D[K];
30
+ }> : P[K];
31
+ };
32
+ type __VLS_Prettify<T> = {
33
+ [K in keyof T]: T[K];
34
+ } & {};
@@ -0,0 +1,27 @@
1
+ import { defineComponent as i, openBlock as t, createElementBlock as n, Fragment as l, renderList as c, toDisplayString as r, createCommentVNode as d } from "vue";
2
+ const m = {
3
+ key: 0,
4
+ class: "aheart-ai-actions",
5
+ "aria-label": "消息操作"
6
+ }, u = ["disabled", "onClick"], f = /* @__PURE__ */ i({
7
+ name: "AAIActions",
8
+ __name: "actions",
9
+ props: {
10
+ actions: { default: () => [] }
11
+ },
12
+ emits: ["select"],
13
+ setup(s, { emit: a }) {
14
+ const o = a;
15
+ return (_, b) => s.actions.length ? (t(), n("div", m, [
16
+ (t(!0), n(l, null, c(s.actions, (e) => (t(), n("button", {
17
+ key: e.key,
18
+ type: "button",
19
+ disabled: e.disabled,
20
+ onClick: (k) => o("select", e)
21
+ }, r(e.label), 9, u))), 128))
22
+ ])) : d("", !0);
23
+ }
24
+ });
25
+ export {
26
+ f as default
27
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./actions.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,106 @@
1
+ import type { AIAgentArtifact, AIAgentTask } from './types';
2
+ declare const _default: __VLS_WithTemplateSlots<import("@vue/runtime-core").DefineComponent<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ tasks?: AIAgentTask[] | undefined;
4
+ artifacts?: AIAgentArtifact[] | undefined;
5
+ activeArtifact?: string | undefined;
6
+ disabled?: boolean | undefined;
7
+ reorderable?: boolean | undefined;
8
+ tasksRevision?: string | number | undefined;
9
+ scopeKey?: string | undefined;
10
+ actionDisabled?: ((task: AIAgentTask, action: string) => boolean) | undefined;
11
+ operationMessages?: Record<string, string> | undefined;
12
+ validateCandidate?: ((tasks: AIAgentTask[]) => string | undefined) | undefined;
13
+ }>, {
14
+ tasks: () => never[];
15
+ artifacts: () => never[];
16
+ activeArtifact: undefined;
17
+ disabled: boolean;
18
+ reorderable: boolean;
19
+ scopeKey: string;
20
+ actionDisabled: () => false;
21
+ operationMessages: () => {};
22
+ validateCandidate: () => undefined;
23
+ }>>, {}, {}, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {
24
+ retry: (task: AIAgentTask) => void;
25
+ approve: (task: AIAgentTask) => void;
26
+ reject: (task: AIAgentTask) => void;
27
+ cancel: (task: AIAgentTask) => void;
28
+ "update:tasks": (tasks: AIAgentTask[]) => void;
29
+ "move-task": (id: string, direction: "up" | "down") => void;
30
+ "move-task-reject": (reason: string) => void;
31
+ "select-artifact": (artifact: AIAgentArtifact) => void;
32
+ }, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
33
+ tasks?: AIAgentTask[] | undefined;
34
+ artifacts?: AIAgentArtifact[] | undefined;
35
+ activeArtifact?: string | undefined;
36
+ disabled?: boolean | undefined;
37
+ reorderable?: boolean | undefined;
38
+ tasksRevision?: string | number | undefined;
39
+ scopeKey?: string | undefined;
40
+ actionDisabled?: ((task: AIAgentTask, action: string) => boolean) | undefined;
41
+ operationMessages?: Record<string, string> | undefined;
42
+ validateCandidate?: ((tasks: AIAgentTask[]) => string | undefined) | undefined;
43
+ }>, {
44
+ tasks: () => never[];
45
+ artifacts: () => never[];
46
+ activeArtifact: undefined;
47
+ disabled: boolean;
48
+ reorderable: boolean;
49
+ scopeKey: string;
50
+ actionDisabled: () => false;
51
+ operationMessages: () => {};
52
+ validateCandidate: () => undefined;
53
+ }>>> & Readonly<{
54
+ onRetry?: ((task: AIAgentTask) => any) | undefined;
55
+ onApprove?: ((task: AIAgentTask) => any) | undefined;
56
+ onReject?: ((task: AIAgentTask) => any) | undefined;
57
+ onCancel?: ((task: AIAgentTask) => any) | undefined;
58
+ "onUpdate:tasks"?: ((tasks: AIAgentTask[]) => any) | undefined;
59
+ "onMove-task"?: ((id: string, direction: "up" | "down") => any) | undefined;
60
+ "onMove-task-reject"?: ((reason: string) => any) | undefined;
61
+ "onSelect-artifact"?: ((artifact: AIAgentArtifact) => any) | undefined;
62
+ }>, {
63
+ disabled: boolean;
64
+ tasks: AIAgentTask[];
65
+ artifacts: AIAgentArtifact[];
66
+ activeArtifact: string;
67
+ reorderable: boolean;
68
+ scopeKey: string;
69
+ actionDisabled: (task: AIAgentTask, action: string) => boolean;
70
+ operationMessages: Record<string, string>;
71
+ validateCandidate: (tasks: AIAgentTask[]) => string | undefined;
72
+ }, {}, {}, {}, string, import("@vue/runtime-core").ComponentProvideOptions, true, {}, any>, {
73
+ task?(_: {
74
+ task: AIAgentTask;
75
+ index: number;
76
+ }): any;
77
+ artifact?(_: {
78
+ artifact: AIAgentArtifact;
79
+ }): any;
80
+ "artifact-preview"?(_: {
81
+ artifact: AIAgentArtifact;
82
+ }): any;
83
+ }>;
84
+ export default _default;
85
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
86
+ type __VLS_TypePropsToRuntimeProps<T> = {
87
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
88
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
89
+ } : {
90
+ type: import('vue').PropType<T[K]>;
91
+ required: true;
92
+ };
93
+ };
94
+ type __VLS_WithDefaults<P, D> = {
95
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
96
+ default: D[K];
97
+ }> : P[K];
98
+ };
99
+ type __VLS_Prettify<T> = {
100
+ [K in keyof T]: T[K];
101
+ } & {};
102
+ type __VLS_WithTemplateSlots<T, S> = T & {
103
+ new (): {
104
+ $slots: S;
105
+ };
106
+ };
@@ -0,0 +1,441 @@
1
+ import { defineComponent as fa, computed as w, openBlock as r, createElementBlock as l, createElementVNode as o, toDisplayString as n, createCommentVNode as i, Fragment as N, createVNode as S, unref as k, withCtx as y, createTextVNode as m, renderSlot as x, normalizeClass as D, normalizeStyle as ga, createBlock as ia, renderList as wa } from "vue";
2
+ import { Button as C } from "aheart-ui";
3
+ import { SortableList as ma } from "@aheart-ui/dnd";
4
+ import { getSafeUrl as da } from "./safe-markdown.js";
5
+ const Ca = { class: "aheart-ai-workbench__execution-content" }, $a = {
6
+ key: 0,
7
+ class: "aheart-ai-workbench__mobile-priority",
8
+ role: "region",
9
+ "aria-label": "移动端优先处理"
10
+ }, Aa = { class: "aheart-ai-workbench__priority-heading" }, ja = { class: "aheart-ai-workbench__eyebrow" }, Sa = { key: 0 }, Ba = { key: 1 }, Ia = {
11
+ key: 0,
12
+ class: "aheart-ai-workbench__priority-approval"
13
+ }, Ma = { key: 0 }, Ka = { class: "aheart-ai-workbench__priority-actions" }, Ra = {
14
+ key: 1,
15
+ class: "aheart-ai-workbench__approval-result"
16
+ }, za = ["aria-label"], La = { key: 0 }, Na = ["aria-label"], xa = { key: 0 }, Da = ["aria-labelledby"], Ta = { class: "aheart-ai-workbench__section-heading" }, Va = ["id"], Ea = { class: "aheart-ai-workbench__timeline" }, Fa = ["data-task-id"], Ha = { class: "aheart-ai-workbench__task-body" }, Ua = { class: "aheart-ai-workbench__task-summary" }, Pa = {
17
+ key: 0,
18
+ class: "aheart-ai-workbench__tool-name"
19
+ }, Wa = { class: "aheart-ai-workbench__task-status" }, Za = {
20
+ key: 0,
21
+ class: "aheart-ai-workbench__task-detail"
22
+ }, qa = {
23
+ key: 1,
24
+ class: "aheart-ai-workbench__tool-call",
25
+ "aria-label": "工具调用摘要"
26
+ }, Ga = { key: 0 }, Ja = { key: 1 }, Oa = { key: 2 }, Qa = {
27
+ key: 2,
28
+ class: "aheart-ai-workbench__task-lock-reason",
29
+ role: "status"
30
+ }, Xa = {
31
+ key: 3,
32
+ class: "aheart-ai-workbench__task-lock-reason",
33
+ role: "status"
34
+ }, Ya = {
35
+ key: 4,
36
+ class: "aheart-ai-workbench__task-lock-reason",
37
+ role: "status"
38
+ }, ae = {
39
+ key: 5,
40
+ class: "aheart-ai-workbench__task-progress"
41
+ }, ee = ["aria-valuenow"], te = {
42
+ key: 6,
43
+ class: "aheart-ai-workbench__task-time"
44
+ }, se = { key: 0 }, oe = { key: 1 }, re = {
45
+ key: 7,
46
+ class: "aheart-ai-workbench__task-error"
47
+ }, le = { class: "aheart-ai-workbench__task-actions" }, ne = {
48
+ key: 8,
49
+ class: "aheart-ai-workbench__operation-status",
50
+ role: "status"
51
+ }, ie = ["data-approval-id"], de = { key: 0 }, ce = {
52
+ key: 1,
53
+ class: "aheart-ai-workbench__approval-result"
54
+ }, ue = {
55
+ key: 0,
56
+ class: "aheart-ai-workbench__empty"
57
+ }, pe = ["aria-labelledby"], ve = { class: "aheart-ai-workbench__section-heading" }, _e = ["id"], ke = {
58
+ key: 0,
59
+ class: "aheart-ai-workbench__artifact-list"
60
+ }, he = ["data-artifact-id"], be = ["aria-pressed", "onClick"], ye = { key: 0 }, fe = {
61
+ key: 1,
62
+ class: "aheart-ai-workbench__empty"
63
+ }, ge = {
64
+ key: 2,
65
+ class: "aheart-ai-workbench__artifact-preview",
66
+ "aria-label": "产物预览"
67
+ }, we = { class: "aheart-ai-workbench__artifact-preview-header" }, me = ["href"], Ce = { key: 0 }, Be = /* @__PURE__ */ fa({
68
+ name: "AIAgentWorkbenchExecution",
69
+ __name: "agent-execution",
70
+ props: {
71
+ tasks: { default: () => [] },
72
+ artifacts: { default: () => [] },
73
+ activeArtifact: { default: void 0 },
74
+ disabled: { type: Boolean, default: !1 },
75
+ reorderable: { type: Boolean, default: !0 },
76
+ tasksRevision: {},
77
+ scopeKey: { default: "default" },
78
+ actionDisabled: { type: Function, default: () => !1 },
79
+ operationMessages: { default: () => ({}) },
80
+ validateCandidate: { type: Function, default: () => {
81
+ } }
82
+ },
83
+ emits: ["update:tasks", "approve", "reject", "cancel", "retry", "move-task", "move-task-reject", "select-artifact"],
84
+ setup(v, { emit: ca }) {
85
+ const d = v, T = w(() => `aheart-agent-execution-${String(d.scopeKey ?? "default").replace(/[^a-zA-Z0-9_-]/g, "-")}`), V = w(() => `${T.value}-tasks`), E = w(() => `${T.value}-artifacts`), _ = ca, ua = {
86
+ pending: "等待执行",
87
+ running: "执行中",
88
+ "waiting-approval": "等待审批",
89
+ complete: "已完成",
90
+ error: "执行失败",
91
+ cancelled: "已取消"
92
+ }, pa = w(() => d.tasks.map((t, s) => ({ ...t, __sortableKey: `${t.id}::${s}` }))), c = w(
93
+ () => d.artifacts.find((t) => t.id === d.activeArtifact) ?? d.artifacts[0]
94
+ ), u = w(
95
+ () => d.tasks.find((t) => t.approval && (!t.approval.status || t.approval.status === "pending")) ?? d.tasks.find((t) => t.approval)
96
+ ), $ = w(
97
+ () => d.artifacts.find((t) => {
98
+ var s, p;
99
+ return t.id === ((p = (s = u.value) == null ? void 0 : s.approval) == null ? void 0 : p.artifactId);
100
+ }) ?? c.value
101
+ ), va = w(() => {
102
+ var t;
103
+ return (t = u.value) != null && t.approval && (!u.value.approval.status || u.value.approval.status === "pending") ? "等待审批" : u.value ? "审批结果" : "当前产物";
104
+ }), e = (t) => t, h = (t) => t.toolCall, K = (t) => {
105
+ var s;
106
+ return `${t.id}:${String(t.revision ?? "")}:${((s = t.approval) == null ? void 0 : s.id) ?? ""}`;
107
+ }, _a = (t) => {
108
+ _("move-task-reject", {
109
+ "stale-revision": "任务版本已变化,排序已拒绝",
110
+ "source-missing": "源任务已不存在,排序已拒绝",
111
+ "target-missing": "目标位置已不存在,排序已拒绝",
112
+ "duplicate-key": "任务标识重复,无法排序",
113
+ "group-mismatch": "任务不属于当前排序分组",
114
+ disabled: "任务当前不可排序,排序已拒绝",
115
+ "invalid-position": "目标位置无效,排序已拒绝",
116
+ "parent-rejected": "任务版本已变化,排序已拒绝",
117
+ "rollback-rejected": "排序回滚失败,请刷新后重试",
118
+ unmounted: "排序目标已卸载",
119
+ cancelled: "排序已取消"
120
+ }[t.reason ?? ""] ?? "任务当前不可排序,排序已拒绝");
121
+ }, ka = (t) => ua[t], ha = (t) => t.status, ba = (t) => ka(t.status), R = (t) => Math.min(100, Math.max(0, Math.round(t ?? 0))), ya = (t) => {
122
+ var s;
123
+ if (!d.disabled && d.reorderable) {
124
+ const p = t.map(({ __sortableKey: B, ...j }) => j), f = (s = d.validateCandidate) == null ? void 0 : s.call(d, p);
125
+ if (f) {
126
+ _("move-task-reject", f);
127
+ return;
128
+ }
129
+ _("update:tasks", p);
130
+ }
131
+ }, F = (t, s) => {
132
+ var j;
133
+ if (z(d.tasks[t], t, s)) return;
134
+ const p = [...d.tasks], [f] = p.splice(t, 1);
135
+ p.splice(t + s, 0, f);
136
+ const B = (j = d.validateCandidate) == null ? void 0 : j.call(d, p);
137
+ if (B) {
138
+ _("move-task-reject", B);
139
+ return;
140
+ }
141
+ _("update:tasks", p), _("move-task", f.id, s < 0 ? "up" : "down");
142
+ }, A = (t, s) => {
143
+ var p;
144
+ return d.disabled || !!((p = d.actionDisabled) != null && p.call(d, t, s));
145
+ }, z = (t, s, p) => !!(d.disabled || !d.reorderable || s + p < 0 || s + p >= d.tasks.length || (t == null ? void 0 : t.reorderable) === !1 || t != null && t.lockedReason || (t == null ? void 0 : t.status) === "running" || (t == null ? void 0 : t.status) === "waiting-approval");
146
+ return (t, s) => {
147
+ var p, f, B, j, H, U;
148
+ return r(), l("div", Ca, [
149
+ u.value || c.value ? (r(), l("section", $a, [
150
+ o("div", Aa, [
151
+ o("span", ja, n(va.value), 1),
152
+ u.value ? (r(), l("strong", Sa, n((p = u.value.approval) == null ? void 0 : p.title), 1)) : (r(), l("strong", Ba, "查看当前产物"))
153
+ ]),
154
+ u.value ? (r(), l("div", Ia, [
155
+ (f = u.value.approval) != null && f.description ? (r(), l("p", Ma, n(u.value.approval.description), 1)) : i("", !0),
156
+ o("div", Ka, [
157
+ !((B = u.value.approval) != null && B.status) || u.value.approval.status === "pending" ? (r(), l(N, { key: 0 }, [
158
+ S(k(C), {
159
+ "data-action": "approve",
160
+ type: "primary",
161
+ disabled: A(u.value, "approve"),
162
+ onClick: s[0] || (s[0] = (a) => _("approve", u.value))
163
+ }, {
164
+ default: y(() => [...s[4] || (s[4] = [
165
+ m("批准", -1)
166
+ ])]),
167
+ _: 1
168
+ }, 8, ["disabled"]),
169
+ S(k(C), {
170
+ "data-action": "reject",
171
+ danger: "",
172
+ disabled: A(u.value, "reject"),
173
+ onClick: s[1] || (s[1] = (a) => _("reject", u.value))
174
+ }, {
175
+ default: y(() => [...s[5] || (s[5] = [
176
+ m("拒绝", -1)
177
+ ])]),
178
+ _: 1
179
+ }, 8, ["disabled"])
180
+ ], 64)) : (r(), l("span", Ra, n(u.value.approval.status === "approved" ? "已批准" : "已拒绝"), 1))
181
+ ])
182
+ ])) : i("", !0),
183
+ $.value ? (r(), l("button", {
184
+ key: 1,
185
+ type: "button",
186
+ class: "aheart-ai-workbench__priority-artifact",
187
+ "data-artifact-role": "approval",
188
+ "aria-label": $.value.title,
189
+ onClick: s[2] || (s[2] = (a) => _("select-artifact", $.value))
190
+ }, [
191
+ o("span", null, n((H = (j = u.value) == null ? void 0 : j.approval) != null && H.artifactId ? "审批对象" : "当前产物"), 1),
192
+ o("strong", null, n($.value.title), 1),
193
+ $.value.description ? (r(), l("small", La, n($.value.description), 1)) : i("", !0)
194
+ ], 8, za)) : i("", !0),
195
+ c.value && c.value.id !== ((U = $.value) == null ? void 0 : U.id) ? (r(), l("button", {
196
+ key: 2,
197
+ type: "button",
198
+ class: "aheart-ai-workbench__priority-artifact",
199
+ "data-artifact-role": "current",
200
+ "aria-label": c.value.title,
201
+ onClick: s[3] || (s[3] = (a) => _("select-artifact", c.value))
202
+ }, [
203
+ s[6] || (s[6] = o("span", null, "当前产物", -1)),
204
+ o("strong", null, n(c.value.title), 1),
205
+ c.value.description ? (r(), l("small", xa, n(c.value.description), 1)) : i("", !0)
206
+ ], 8, Na)) : i("", !0)
207
+ ])) : i("", !0),
208
+ o("section", {
209
+ class: "aheart-ai-workbench__tasks",
210
+ "aria-labelledby": V.value
211
+ }, [
212
+ o("div", Ta, [
213
+ o("div", null, [
214
+ s[7] || (s[7] = o("span", { class: "aheart-ai-workbench__eyebrow" }, "执行流程", -1)),
215
+ o("h2", { id: V.value }, "执行时间线", 8, Va)
216
+ ]),
217
+ o("span", null, n(v.tasks.length) + " 项", 1)
218
+ ]),
219
+ o("div", Ea, [
220
+ S(k(ma), {
221
+ items: pa.value,
222
+ "item-key": "__sortableKey",
223
+ disabled: v.disabled || !v.reorderable,
224
+ revision: v.tasksRevision,
225
+ group: `agent-tasks-${v.scopeKey}`,
226
+ "onUpdate:items": ya,
227
+ onMoveReject: _a
228
+ }, {
229
+ item: y(({ item: a, index: g }) => [
230
+ x(t.$slots, "task", {
231
+ task: e(a),
232
+ index: g
233
+ }, () => {
234
+ var I, L, P, W, Z, q, G, J, O, Q, X, Y, aa, ea, ta, sa, oa, ra, la, na;
235
+ return [
236
+ o("article", {
237
+ "data-task-id": e(a).id,
238
+ class: D(["aheart-ai-workbench__timeline-item", [`is-${ha(e(a))}`, { "has-approval-summary": !!e(a).approval }]])
239
+ }, [
240
+ s[15] || (s[15] = o("span", {
241
+ class: "aheart-ai-workbench__timeline-marker",
242
+ "aria-hidden": "true"
243
+ }, null, -1)),
244
+ o("div", Ha, [
245
+ o("header", Ua, [
246
+ o("div", null, [
247
+ o("strong", null, n(e(a).label), 1),
248
+ e(a).toolName ? (r(), l("span", Pa, n(e(a).toolName), 1)) : i("", !0)
249
+ ]),
250
+ o("span", Wa, n(ba(e(a))), 1)
251
+ ]),
252
+ e(a).detail && !h(e(a)) ? (r(), l("p", Za, n(e(a).detail), 1)) : i("", !0),
253
+ h(e(a)) ? (r(), l("section", qa, [
254
+ o("strong", null, n((I = h(e(a))) == null ? void 0 : I.name), 1),
255
+ o("span", null, n((L = h(e(a))) == null ? void 0 : L.summary), 1),
256
+ (P = h(e(a))) != null && P.inputSummary ? (r(), l("small", Ga, n((W = h(e(a))) == null ? void 0 : W.inputSummary), 1)) : i("", !0),
257
+ (Z = h(e(a))) != null && Z.resultSummary ? (r(), l("small", Ja, n((q = h(e(a))) == null ? void 0 : q.resultSummary), 1)) : i("", !0),
258
+ (G = h(e(a))) != null && G.error ? (r(), l("small", Oa, n((J = h(e(a))) == null ? void 0 : J.error), 1)) : i("", !0)
259
+ ])) : i("", !0),
260
+ e(a).lockedReason || ((O = v.operationMessages) == null ? void 0 : O[K(e(a))]) === "" ? (r(), l("p", Qa, n(e(a).lockedReason), 1)) : i("", !0),
261
+ e(a).revision === void 0 && A(e(a), "approve") ? (r(), l("p", Xa, "缺少任务版本")) : i("", !0),
262
+ (Q = e(a).approval) != null && Q.artifactId && (!v.artifacts.some((b) => {
263
+ var M;
264
+ return b.id === ((M = e(a).approval) == null ? void 0 : M.artifactId);
265
+ }) || v.artifacts.some((b) => {
266
+ var M;
267
+ return b.id === ((M = e(a).approval) == null ? void 0 : M.artifactId) && b.revision === void 0;
268
+ })) ? (r(), l("p", Ya, "缺少产物版本")) : i("", !0),
269
+ e(a).progress !== void 0 ? (r(), l("div", ae, [
270
+ o("div", {
271
+ role: "progressbar",
272
+ "aria-label": "任务进度",
273
+ "aria-valuemin": "0",
274
+ "aria-valuemax": "100",
275
+ "aria-valuenow": R(e(a).progress)
276
+ }, [
277
+ o("span", {
278
+ style: ga({ inlineSize: `${R(e(a).progress)}%` })
279
+ }, null, 4)
280
+ ], 8, ee),
281
+ o("small", null, n(R(e(a).progress)) + "%", 1)
282
+ ])) : i("", !0),
283
+ e(a).startedAt || e(a).completedAt ? (r(), l("div", te, [
284
+ e(a).startedAt ? (r(), l("span", se, "开始 " + n(e(a).startedAt), 1)) : i("", !0),
285
+ e(a).completedAt ? (r(), l("span", oe, "完成 " + n(e(a).completedAt), 1)) : i("", !0)
286
+ ])) : i("", !0),
287
+ e(a).error ? (r(), l("details", re, [
288
+ s[8] || (s[8] = o("summary", null, "查看错误详情", -1)),
289
+ o("p", null, n(e(a).error), 1)
290
+ ])) : i("", !0),
291
+ o("div", le, [
292
+ e(a).status === "running" ? (r(), ia(k(C), {
293
+ key: 0,
294
+ "data-action": "cancel",
295
+ type: "text",
296
+ disabled: A(e(a), "cancel"),
297
+ onClick: (b) => _("cancel", e(a))
298
+ }, {
299
+ default: y(() => [...s[9] || (s[9] = [
300
+ m("取消", -1)
301
+ ])]),
302
+ _: 1
303
+ }, 8, ["disabled", "onClick"])) : i("", !0),
304
+ e(a).status === "error" || (X = v.operationMessages) != null && X[K(e(a))] ? (r(), ia(k(C), {
305
+ key: 1,
306
+ "data-action": "retry",
307
+ type: "text",
308
+ disabled: A(e(a), "retry"),
309
+ onClick: (b) => _("retry", e(a))
310
+ }, {
311
+ default: y(() => [...s[10] || (s[10] = [
312
+ m("重试", -1)
313
+ ])]),
314
+ _: 1
315
+ }, 8, ["disabled", "onClick"])) : i("", !0),
316
+ S(k(C), {
317
+ "data-action": "move-up",
318
+ type: "text",
319
+ disabled: z(e(a), g, -1),
320
+ onClick: (b) => F(g, -1)
321
+ }, {
322
+ default: y(() => [...s[11] || (s[11] = [
323
+ m("上移", -1)
324
+ ])]),
325
+ _: 1
326
+ }, 8, ["disabled", "onClick"]),
327
+ S(k(C), {
328
+ "data-action": "move-down",
329
+ type: "text",
330
+ disabled: z(e(a), g, 1),
331
+ onClick: (b) => F(g, 1)
332
+ }, {
333
+ default: y(() => [...s[12] || (s[12] = [
334
+ m("下移", -1)
335
+ ])]),
336
+ _: 1
337
+ }, 8, ["disabled", "onClick"])
338
+ ]),
339
+ (Y = v.operationMessages) != null && Y[K(e(a))] ? (r(), l("p", ne, n(v.operationMessages[K(e(a))]), 1)) : i("", !0),
340
+ e(a).approval ? (r(), l("div", {
341
+ key: 9,
342
+ "data-approval-id": (aa = e(a).approval) == null ? void 0 : aa.id,
343
+ class: D(["aheart-ai-workbench__approval", `is-${((ea = e(a).approval) == null ? void 0 : ea.status) ?? "pending"}`])
344
+ }, [
345
+ o("div", null, [
346
+ o("strong", null, n((ta = e(a).approval) == null ? void 0 : ta.title), 1),
347
+ (sa = e(a).approval) != null && sa.description ? (r(), l("p", de, n((oa = e(a).approval) == null ? void 0 : oa.description), 1)) : i("", !0)
348
+ ]),
349
+ !((ra = e(a).approval) != null && ra.status) || ((la = e(a).approval) == null ? void 0 : la.status) === "pending" ? (r(), l(N, { key: 0 }, [
350
+ S(k(C), {
351
+ "data-action": "approve",
352
+ type: "primary",
353
+ disabled: A(e(a), "approve"),
354
+ onClick: (b) => _("approve", e(a))
355
+ }, {
356
+ default: y(() => [...s[13] || (s[13] = [
357
+ m("批准", -1)
358
+ ])]),
359
+ _: 1
360
+ }, 8, ["disabled", "onClick"]),
361
+ S(k(C), {
362
+ "data-action": "reject",
363
+ danger: "",
364
+ disabled: A(e(a), "reject"),
365
+ onClick: (b) => _("reject", e(a))
366
+ }, {
367
+ default: y(() => [...s[14] || (s[14] = [
368
+ m("拒绝", -1)
369
+ ])]),
370
+ _: 1
371
+ }, 8, ["disabled", "onClick"])
372
+ ], 64)) : (r(), l("span", ce, n(((na = e(a).approval) == null ? void 0 : na.status) === "approved" ? "已批准" : "已拒绝"), 1))
373
+ ], 10, ie)) : i("", !0)
374
+ ])
375
+ ], 10, Fa)
376
+ ];
377
+ })
378
+ ]),
379
+ _: 3
380
+ }, 8, ["items", "disabled", "revision", "group"])
381
+ ]),
382
+ v.tasks.length ? i("", !0) : (r(), l("p", ue, "尚无执行任务。"))
383
+ ], 8, Da),
384
+ o("section", {
385
+ class: "aheart-ai-workbench__artifacts",
386
+ "aria-labelledby": E.value
387
+ }, [
388
+ o("div", ve, [
389
+ o("div", null, [
390
+ s[16] || (s[16] = o("span", { class: "aheart-ai-workbench__eyebrow" }, "产物输出", -1)),
391
+ o("h2", { id: E.value }, "产物", 8, _e)
392
+ ]),
393
+ o("span", null, n(v.artifacts.length) + " 项", 1)
394
+ ]),
395
+ v.artifacts.length ? (r(), l("ul", ke, [
396
+ (r(!0), l(N, null, wa(v.artifacts, (a) => {
397
+ var g, I;
398
+ return r(), l("li", {
399
+ key: a.id,
400
+ "data-artifact-id": a.id,
401
+ class: D({ "is-active": a.id === ((g = c.value) == null ? void 0 : g.id) })
402
+ }, [
403
+ o("button", {
404
+ type: "button",
405
+ "aria-pressed": a.id === ((I = c.value) == null ? void 0 : I.id),
406
+ onClick: (L) => _("select-artifact", a)
407
+ }, [
408
+ x(t.$slots, "artifact", { artifact: a }, () => [
409
+ o("span", null, n(a.title), 1),
410
+ a.description ? (r(), l("small", ye, n(a.description), 1)) : i("", !0)
411
+ ])
412
+ ], 8, be)
413
+ ], 10, he);
414
+ }), 128))
415
+ ])) : (r(), l("p", fe, "任务完成后,产物会出现在这里。")),
416
+ c.value ? (r(), l("section", ge, [
417
+ x(t.$slots, "artifact-preview", { artifact: c.value }, () => [
418
+ o("div", we, [
419
+ o("div", null, [
420
+ o("span", null, n(c.value.type ?? "文件"), 1),
421
+ o("h3", null, n(c.value.title), 1)
422
+ ]),
423
+ k(da)(c.value.url) ? (r(), l("a", {
424
+ key: 0,
425
+ href: k(da)(c.value.url),
426
+ target: "_blank",
427
+ rel: "noreferrer"
428
+ }, "打开产物", 8, me)) : i("", !0)
429
+ ]),
430
+ o("p", null, n(c.value.description ?? "业务层可通过 artifact-preview 插槽提供自定义预览。"), 1),
431
+ c.value.updatedAt ? (r(), l("small", Ce, "更新于 " + n(c.value.updatedAt), 1)) : i("", !0)
432
+ ])
433
+ ])) : i("", !0)
434
+ ], 8, pe)
435
+ ]);
436
+ };
437
+ }
438
+ });
439
+ export {
440
+ Be as default
441
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./agent-execution.vue.js";
2
+ export {
3
+ f as default
4
+ };