@vite-hub/ui 0.6.1 → 0.8.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.
- package/README.md +106 -46
- package/dist/AttachmentTitle-BWw0ck0T.js +110 -0
- package/dist/BubbleContent-B1a4e3vE.js +45 -0
- package/dist/Chat-CuSthJVg.js +112 -0
- package/dist/ChatMessage-CFQs0v4N.js +94 -0
- package/dist/CodeBlockContent-BjXJm8lO.js +92 -0
- package/dist/CodeBlockTitle-DIu8Ef3V.js +99 -0
- package/dist/CommentRow-XY3FNp30.js +86 -0
- package/dist/CopyButton-Bs6DT-Z8.js +188 -0
- package/dist/Markdown-Da5t-931.js +70 -0
- package/dist/MarkdownCodeBlock-BWDLOWPO.js +127 -0
- package/dist/MarkdownImage-CJN3myt4.js +111 -0
- package/dist/MessageHeader-CJ9eBHSS.js +61 -0
- package/dist/MessageParts-CyJLG34y.js +57 -0
- package/dist/MessageScrollerViewport-BaTlWLki.js +142 -0
- package/dist/MorphText-B6MWdeIv.js +36 -0
- package/dist/RollNumber-CnF52zJM.js +49 -0
- package/dist/SwapIcon-CUIq1TU5.js +67 -0
- package/dist/TraceTitle-Cp0y7RRD.js +133 -0
- package/dist/agent-session-2j2gbGpp.js +875 -0
- package/dist/agent-session-BwZSMi4S.d.ts +312 -0
- package/dist/appendItems-hQ4aBd9Q.js +4047 -0
- package/dist/attachment-BllgHx9Q.d.ts +124 -0
- package/dist/attachment-DQMJNfj0.js +35 -0
- package/dist/avatar-stack-Bj1xUkzY.d.ts +4 -0
- package/dist/avatar-stack-CoLlsmwJ.js +72 -0
- package/dist/bubble-D3M2_InY.js +32 -0
- package/dist/bubble-DmplVxLr.d.ts +64 -0
- package/dist/chat-DWdyMSuj.d.ts +13 -0
- package/dist/chat-message-QLHnX_ED.d.ts +11 -0
- package/dist/chat-session-BOj5L3Ey.d.ts +29 -0
- package/dist/chat-session-cxUzvwdj.js +43 -0
- package/dist/choices-input-DqgXl5a-.d.ts +97 -0
- package/dist/{vue-d2Td6uu2.js → client-BG-oCUtv-5i4sRwXP.js} +4156 -4156
- package/dist/code-block-BqOEVWPh.d.ts +182 -0
- package/dist/code-block-CMERLfew.js +14 -0
- package/dist/code-view-26RY6dX8.js +137 -0
- package/dist/code-view-D8yYdFUc.d.ts +184 -0
- package/dist/{comment-composer-DmDM3XYP.d.ts → comment-composer-CsVOvG9j.d.ts} +6 -6
- package/dist/{comment-composer-X7vJKh5b.js → comment-composer-D_mcH3Ts.js} +175 -37
- package/dist/{comment-layer-KnnVfdRV.d.ts → comment-layer-C3xmg-0_.d.ts} +14 -5
- package/dist/comment-layer-Ci6ipGi2.js +1206 -0
- package/dist/{comment-panel-DoLDOw3E.d.ts → comment-panel-DxN21VoY.d.ts} +24 -17
- package/dist/comment-selection-bar-B_bchB2O.d.ts +33 -0
- package/dist/comment-selection-bar-DZAtiRZ9.js +144 -0
- package/dist/{comment-thread-DPV2kqA4.d.ts → comment-thread-BmsqcjVQ.d.ts} +9 -8
- package/dist/{comment-thread-jqPx6aJ8.js → comment-thread-BzOZVqF2.js} +74 -49
- package/dist/comments-BU8cTt5o.d.ts +50 -0
- package/dist/{comments-9MDSNm-9.js → comments-BaSrroRV.js} +32 -4
- package/dist/{comments-OWjNidkP.d.ts → comments-ZfV6IZs8.d.ts} +9 -2
- package/dist/components-B_2Q0dJ3.js +269 -0
- package/dist/{config-LRonN53j.js → config-BDQYUjjp.js} +10 -29
- package/dist/{config-COSdO-ay.d.ts → config-JmsTI7gs.d.ts} +20 -33
- package/dist/connection-status-BVSH2ZVo.js +72 -0
- package/dist/connection-status-g62BTn44.d.ts +37 -0
- package/dist/copy-button-CRiXUFsl.d.ts +17 -0
- package/dist/device-frame-BW6IjB6P.d.ts +78 -0
- package/dist/device-frame-DDWoyB-G.js +515 -0
- package/dist/diffs-BTKaVnsb.d.ts +272 -0
- package/dist/diffs.d.ts +3 -0
- package/dist/{pierre-code-view-C49BVDrc.js → diffs.js} +147 -4223
- package/dist/drop-field-C0bXv1J-.d.ts +35 -0
- package/dist/drop-field-DeIvKoJs.js +77 -0
- package/dist/editor-BsOTjnnN.d.ts +540 -0
- package/dist/{markdown-editor-D1irG9Xl.js → editor-hXea1i46.js} +833 -106
- package/dist/editor.d.ts +2 -0
- package/dist/editor.js +3 -0
- package/dist/element-BpjNQvZ0.js +6 -0
- package/dist/{file-tree-CRFIdtzw.js → file-tree-B4JKbp4r.js} +19 -18
- package/dist/{file-tree-DOtkeBaq.d.ts → file-tree-BdnKA6UA.d.ts} +33 -8
- package/dist/file-tree-DDSIafDn.d.ts +22 -0
- package/dist/file-tree-DS5shGSL.js +46 -0
- package/dist/file-tree.d.ts +2 -0
- package/dist/file-tree.js +1 -0
- package/dist/files-cuVXzWlx.js +30 -0
- package/dist/filter-search-C9e6sGij.d.ts +28 -0
- package/dist/filter-search-COZsoRiR.js +73 -0
- package/dist/formatCSSVariablePrefix-DLS1Ed1_.js +5 -0
- package/dist/headless-2IcUWHMq.d.ts +51 -0
- package/dist/headless.d.ts +7 -4
- package/dist/headless.js +5 -3
- package/dist/highlight.d.ts +2 -0
- package/dist/highlight.js +1 -0
- package/dist/{highlights-C2AbEdDI.js → highlights-8Al0-h-v.js} +3 -2
- package/dist/{hold-to-delete-BSMrpE-i.d.ts → hold-to-delete-CQc1JaG_.d.ts} +7 -0
- package/dist/{hold-to-delete-Cludb56v.js → hold-to-delete-D1Vy40w5.js} +138 -20
- package/dist/hold-to-delete-DazElJT2.js +85 -0
- package/dist/hold-to-delete-ksBE7wxc.d.ts +58 -0
- package/dist/index-CffOzibW.d.ts +77 -0
- package/dist/{index-B2cbt3py.d.ts → index-D3-uYBqH.d.ts} +1 -1
- package/dist/index.d.ts +165 -52
- package/dist/index.js +126 -670
- package/dist/markdown-BLALLOc0.d.ts +45 -0
- package/dist/{parts/components/markdown-renderer.d.ts → markdown-DkDxdpMU.d.ts} +10 -7
- package/dist/{markdown-renderer-DMyYKeil.js → markdown-_0HhbsOo.js} +125 -127
- package/dist/markdown-editor.d.ts +51 -98
- package/dist/markdown-editor.js +70 -3
- package/dist/markdown.d.ts +2 -0
- package/dist/markdown.js +1 -0
- package/dist/marker-CvcWZ3Zp.d.ts +59 -0
- package/dist/marker-DNL6QR3L.js +63 -0
- package/dist/message-BwivYIEl.js +13 -0
- package/dist/message-DEq4K5cQ.d.ts +72 -0
- package/dist/message-parts-B1BZFVKe.d.ts +3 -0
- package/dist/message-parts-CG3gNWn8.d.ts +11 -0
- package/dist/message-parts.d.ts +2 -0
- package/dist/message-parts.js +1 -0
- package/dist/message-scroller-D7AvM31v.d.ts +41 -0
- package/dist/motion/core.d.ts +4 -4
- package/dist/motion/core.js +5 -11
- package/dist/motion-BH6ShUam.d.ts +12 -0
- package/dist/{install-C4LwcJda.js → motion-BhARaNBB.js} +1 -1
- package/dist/{effects-C1zYpSpg.js → motion-core-JZZiPKEk.js} +1829 -120
- package/dist/{motion-core-Dh20n5Se.d.ts → motion-core-gfsTPLbh.d.ts} +35 -74
- package/dist/motion-list-9vD1hSS0.js +49 -0
- package/dist/motion.d.ts +5 -14
- package/dist/motion.js +6 -13
- package/dist/nuxt-ui-D3Qda35W.js +22 -0
- package/dist/nuxt.d.ts +9 -5
- package/dist/nuxt.js +28 -33
- package/dist/parts/components/agent-session.d.ts +2 -295
- package/dist/parts/components/agent-session.js +1 -659
- package/dist/parts/components/attachment.d.ts +2 -85
- package/dist/parts/components/attachment.js +3 -72
- package/dist/parts/components/avatar-stack.d.ts +3 -2
- package/dist/parts/components/avatar-stack.js +1 -60
- package/dist/parts/components/bubble.d.ts +2 -69
- package/dist/parts/components/bubble.js +3 -52
- package/dist/parts/components/chat-message.d.ts +3 -25
- package/dist/parts/components/chat-message.js +1 -50
- package/dist/parts/components/chat-session.d.ts +2 -26
- package/dist/parts/components/chat-session.js +1 -37
- package/dist/parts/components/chat.d.ts +3 -52
- package/dist/parts/components/chat.js +1 -105
- package/dist/parts/components/code-block.d.ts +2 -102
- package/dist/parts/components/code-block.js +4 -109
- package/dist/parts/components/code-view.d.ts +3 -268
- package/dist/parts/components/code-view.js +1 -1
- package/dist/parts/components/comment-composer.d.ts +1 -1
- package/dist/parts/components/comment-composer.js +1 -1
- package/dist/parts/components/comment-layer.d.ts +1 -1
- package/dist/parts/components/comment-layer.js +1 -634
- package/dist/parts/components/comment-panel.d.ts +2 -2
- package/dist/parts/components/comment-panel.js +22 -16
- package/dist/parts/components/comment-selection-bar.d.ts +2 -2
- package/dist/parts/components/comment-selection-bar.js +1 -116
- package/dist/parts/components/comment-thread.d.ts +1 -1
- package/dist/parts/components/comment-thread.js +1 -3
- package/dist/parts/components/comments.d.ts +8 -9
- package/dist/parts/components/comments.js +5 -9
- package/dist/parts/components/connection-status.d.ts +2 -36
- package/dist/parts/components/connection-status.js +1 -64
- package/dist/parts/components/copy-button.d.ts +3 -126
- package/dist/parts/components/copy-button.js +1 -226
- package/dist/parts/components/device-frame.d.ts +2 -128
- package/dist/parts/components/device-frame.js +1 -470
- package/dist/parts/components/drop-field.d.ts +2 -67
- package/dist/parts/components/drop-field.js +1 -76
- package/dist/parts/components/file-tree.d.ts +3 -2
- package/dist/parts/components/file-tree.js +3 -1
- package/dist/parts/components/filter-search.d.ts +2 -45
- package/dist/parts/components/filter-search.js +1 -57
- package/dist/parts/components/hold-to-delete.d.ts +2 -80
- package/dist/parts/components/hold-to-delete.js +1 -75
- package/dist/parts/components/markdown.d.ts +3 -45
- package/dist/parts/components/markdown.js +1 -46
- package/dist/parts/components/marker.d.ts +2 -32
- package/dist/parts/components/marker.js +1 -22
- package/dist/parts/components/message-parts.d.ts +3 -25
- package/dist/parts/components/message-parts.js +1 -45
- package/dist/parts/components/message.d.ts +2 -32
- package/dist/parts/components/message.js +3 -22
- package/dist/parts/components/motion-list.d.ts +2 -40
- package/dist/parts/components/motion-list.js +1 -41
- package/dist/parts/components/motion.d.ts +5 -118
- package/dist/parts/components/motion.js +5 -163
- package/dist/parts/components/patch-parsers.d.ts +1 -1
- package/dist/parts/components/progress.d.ts +2 -39
- package/dist/parts/components/progress.js +1 -53
- package/dist/parts/components/prompt-input.d.ts +2 -134
- package/dist/parts/components/prompt-input.js +1 -253
- package/dist/parts/components/relative-time.d.ts +2 -71
- package/dist/parts/components/relative-time.js +1 -1
- package/dist/parts/components/status.d.ts +2 -58
- package/dist/parts/components/status.js +1 -47
- package/dist/parts/components/sync-status.d.ts +2 -22
- package/dist/parts/components/sync-status.js +1 -48
- package/dist/parts/components/tool-list.d.ts +2 -28
- package/dist/parts/components/tool-list.js +1 -118
- package/dist/parts/components/trace-run.d.ts +2 -25
- package/dist/parts/components/trace-run.js +1 -89
- package/dist/parts/components/trace.d.ts +2 -59
- package/dist/parts/components/trace.js +1 -76
- package/dist/parts/composables/attachments.js +75 -1
- package/dist/parts/headless/choices-input.d.ts +2 -2
- package/dist/parts/headless/choices-input.js +49 -37
- package/dist/parts/headless/comments.d.ts +1 -1
- package/dist/parts/headless/comments.js +1 -1
- package/dist/parts/headless/message-scroller.d.ts +2 -2
- package/dist/parts/headless/message-scroller.js +211 -309
- package/dist/parts/headless/relative-time.d.ts +2 -0
- package/dist/parts/headless/relative-time.js +1 -0
- package/dist/parts/workspace/browser-support-notice.d.ts +1 -1
- package/dist/parts/workspace/browser-support-notice.js +6 -5
- package/dist/parts/workspace/connect-panel.js +1 -1
- package/dist/parts/workspace/runners/web-container.js +2 -2
- package/dist/parts/workspace/workspace-bar.d.ts +1 -1
- package/dist/parts/workspace/workspace-bar.js +1 -1
- package/dist/parts/workspace/workspace-boot-status.d.ts +1 -1
- package/dist/parts/workspace/workspace-boot-status.js +1 -206
- package/dist/parts/workspace/workspace-editor-head.d.ts +1 -1
- package/dist/parts/workspace/workspace-editor-head.js +1 -1
- package/dist/parts/workspace/workspace-editor.d.ts +2 -2
- package/dist/parts/workspace/workspace-examples.js +1 -1
- package/dist/parts/workspace/workspace-file-tree.d.ts +1 -1
- package/dist/parts/workspace/workspace-file-tree.js +3 -2
- package/dist/parts/workspace/workspace-guide.d.ts +1 -1
- package/dist/parts/workspace/workspace-guide.js +1 -1
- package/dist/parts/workspace/workspace-preview.d.ts +1 -1
- package/dist/parts/workspace/workspace-preview.js +14 -12
- package/dist/parts/workspace/workspace-shell.d.ts +1 -1
- package/dist/parts/workspace/workspace-shell.js +11 -11
- package/dist/parts/workspace/workspace-sidebar.d.ts +2 -2
- package/dist/parts/workspace/workspace-sidebar.js +2 -2
- package/dist/parts/workspace/workspace-start.d.ts +1 -1
- package/dist/parts/workspace/workspace-start.js +1 -1
- package/dist/parts/workspace/workspace-steps.js +1 -1
- package/dist/parts/workspace/workspace.d.ts +3 -3
- package/dist/parts/workspace/workspace.js +5 -5
- package/dist/press-BuEC-XvZ.d.ts +83 -0
- package/dist/progress-8P8RLYMy.js +47 -0
- package/dist/progress-Ch0fA-bf.d.ts +8 -0
- package/dist/prompt-input-CRXEJBAK.js +412 -0
- package/dist/prompt-input-j4OFTF5p.d.ts +116 -0
- package/dist/relative-time-BnJfjeEm.js +131 -0
- package/dist/relative-time-BuP-Gvzn.d.ts +43 -0
- package/dist/{relative-time-DJnw45tr.js → relative-time-Dz2DR4eb.js} +64 -114
- package/dist/relative-time-grHFu1kY.d.ts +11 -0
- package/dist/{ring-GaJsg32c.js → ring-B0nZBnU0.js} +1 -2
- package/dist/runtime/nuxt-plugin.js +2 -5
- package/dist/{shiki-CbfEu_Az.js → shiki-CxzM_xNo.js} +3 -2
- package/dist/stand-ins-CuKM1UH1.js +339 -0
- package/dist/status-B2Yhrwv8.js +67 -0
- package/dist/status-ySiRa-8O.d.ts +38 -0
- package/dist/{stream-tokenizer-ByC3l0HQ.js → stream-tokenizer-BsjV6wxW.js} +1 -1
- package/dist/styles.css +4348 -3410
- package/dist/sync-status-B29eG_n-.js +59 -0
- package/dist/sync-status-D4KdGO6y.d.ts +35 -0
- package/dist/theme.css +3 -0
- package/dist/theme.d.ts +14 -0
- package/dist/theme.js +19 -8
- package/dist/{themes-DKugPHlg.js → themes-B0_ioVT0.js} +1 -1
- package/dist/tool-list-DDaCqpR6.js +209 -0
- package/dist/tool-list-DMRPM0Yi.d.ts +50 -0
- package/dist/trace-KCBvOsw_.d.ts +113 -0
- package/dist/trace-run-Dk962P5a.d.ts +49 -0
- package/dist/trace-run-nh6FIsl6.js +202 -0
- package/dist/{opt-out-D66l60sg.js → tween-1W-LlKk9.js} +65 -2
- package/dist/types-CMU8Vmew.d.ts +71 -0
- package/dist/types-CTk3aNb5.d.ts +15 -0
- package/dist/types-D0a3i4Fw.d.ts +21 -0
- package/dist/types-DTecvcsZ.d.ts +35 -0
- package/dist/types-D_BWab7g.d.ts +75 -0
- package/dist/types-RHaQ4gj1.d.ts +27 -0
- package/dist/ui-components-CKQAPI-W.js +7 -0
- package/dist/unwrapDefault-CExq-4rm.js +5 -0
- package/dist/utils-hi9-xROt.js +37 -0
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +8 -14
- package/dist/{vue-vUGpdMct.js → vue-BdA18K5-.js} +1 -1
- package/dist/workspace-boot-status-CyGlJS06.js +216 -0
- package/dist/{workspace-shell-ChCwWPyv.d.ts → workspace-shell-B4A7CINd.d.ts} +1 -1
- package/dist/workspace.d.ts +1 -1
- package/dist/workspace.js +1 -2
- package/package.json +46 -15
- package/dist/announce-B0DLwflT.js +0 -31
- package/dist/attachments-DgwoQZKY.js +0 -88
- package/dist/avatar-stack-C0IKwj6g.d.ts +0 -57
- package/dist/choices-input-BUf-QqGj.d.ts +0 -92
- package/dist/code-view-Cg4nyTNA.js +0 -172
- package/dist/comment-attachments-DAzUbRmJ.js +0 -23
- package/dist/comment-list-ncwaCSVX.d.ts +0 -60
- package/dist/comment-person-D_IyIjXo.js +0 -39
- package/dist/comment-pin-hBJFiSYW.d.ts +0 -66
- package/dist/comment-row-DPMWI5Z0.js +0 -38
- package/dist/comment-selection-bar-CVuS-FNL.d.ts +0 -40
- package/dist/comment-send-CUkL3TbZ.js +0 -275
- package/dist/comment-send-MmxFsOQf.d.ts +0 -23
- package/dist/comment-send.css +0 -267
- package/dist/comment-status-nsCdrRk_.js +0 -20
- package/dist/drop-field-CNZgwFVO.js +0 -162
- package/dist/editor-Dmk3k6f6.js +0 -620
- package/dist/format-CPipR1FP.js +0 -19
- package/dist/handlers-CnbkvXjX.js +0 -181
- package/dist/icon-XZaCUZTG.d.ts +0 -29
- package/dist/image-preview-BKVUtfwQ.js +0 -104
- package/dist/index-B_PSX-5h.d.ts +0 -69
- package/dist/list-DUTAo0uC.js +0 -270
- package/dist/markdown-editor-B7gD60tp.d.ts +0 -189
- package/dist/message-scroller-BZqS63IX.d.ts +0 -173
- package/dist/nuxt-ui-7ByUrymx.js +0 -43
- package/dist/parts/components/comment-list.d.ts +0 -2
- package/dist/parts/components/comment-list.js +0 -173
- package/dist/parts/components/comment-pin.d.ts +0 -2
- package/dist/parts/components/comment-pin.js +0 -74
- package/dist/parts/components/comment-send.d.ts +0 -2
- package/dist/parts/components/comment-send.js +0 -1
- package/dist/parts/components/markdown-editor.d.ts +0 -2
- package/dist/parts/components/markdown-editor.js +0 -1
- package/dist/parts/components/markdown-renderer.js +0 -1
- package/dist/payload-text-DQNRbJY5.js +0 -31
- package/dist/progress-DL9k-ERG.js +0 -265
- package/dist/registry-DAIjCjWd.js +0 -77
- package/dist/slot-part-BWHvQ3mK.js +0 -25
- package/dist/text-gacox6bp.js +0 -822
- package/dist/travel-BliEidau.js +0 -180
- package/dist/tween-Dv3IIIQG.js +0 -61
- package/dist/types-Ceh7h7NT.d.ts +0 -31
- package/dist/visual-copy-CHHBfJ6O.js +0 -14
|
@@ -1,659 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { n as kitSlot } from "../../slot-part-BWHvQ3mK.js";
|
|
3
|
-
import { Markdown } from "./markdown.js";
|
|
4
|
-
import { Tabs, TabsList, TabsPanel, TabsTab } from "@ui-sdk/vue/tabs";
|
|
5
|
-
import { Comment, Fragment, computed, defineComponent, h, isVNode, onBeforeUnmount, onMounted, ref, useId, watch } from "vue";
|
|
6
|
-
// src/components/agent-session.ts
|
|
7
|
-
const workIcons = {
|
|
8
|
-
command: "i-lucide-terminal",
|
|
9
|
-
edit: "i-lucide-file-pen-line",
|
|
10
|
-
read: "i-lucide-file-text",
|
|
11
|
-
search: "i-lucide-search",
|
|
12
|
-
web: "i-lucide-globe",
|
|
13
|
-
mcp: "i-lucide-plug",
|
|
14
|
-
skill: "i-lucide-sparkles",
|
|
15
|
-
thinking: "i-lucide-brain",
|
|
16
|
-
plan: "i-lucide-list-checks",
|
|
17
|
-
tool: "i-lucide-wrench"
|
|
18
|
-
};
|
|
19
|
-
function readLayout(key) {
|
|
20
|
-
if (!key || typeof localStorage === "undefined") return {};
|
|
21
|
-
try {
|
|
22
|
-
const value = JSON.parse(localStorage.getItem(key) ?? "{}");
|
|
23
|
-
return value && typeof value === "object" ? value : {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function icon(name, attrs = {}) {
|
|
29
|
-
const UIcon = useUIComponent("UIcon");
|
|
30
|
-
return h(UIcon, {
|
|
31
|
-
name,
|
|
32
|
-
"aria-hidden": "true",
|
|
33
|
-
...attrs
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
const PANEL_MIN_WIDTH = 320;
|
|
37
|
-
/**
|
|
38
|
-
* An agent session laid out like T3 Code: the timeline in the default slot, a details card that the header toggle
|
|
39
|
-
* opens, and a right panel of `surfaces`. Each surface renders from the `surface-<id>` slot, else from `surface` with
|
|
40
|
-
* `{ surface }`. A timeline that scrolls itself goes in `body` instead of the default slot. Give `storageKey` to keep the
|
|
41
|
-
* panel, its width, its tabs and the details card as the user left them.
|
|
42
|
-
*/
|
|
43
|
-
const AgentSession = defineComponent({
|
|
44
|
-
name: "AgentSession",
|
|
45
|
-
inheritAttrs: false,
|
|
46
|
-
props: {
|
|
47
|
-
title: {
|
|
48
|
-
required: true,
|
|
49
|
-
type: String
|
|
50
|
-
},
|
|
51
|
-
subtitle: { type: String },
|
|
52
|
-
surfaces: {
|
|
53
|
-
default: () => [],
|
|
54
|
-
type: Array
|
|
55
|
-
},
|
|
56
|
-
storageKey: { type: String },
|
|
57
|
-
defaultPanelOpen: {
|
|
58
|
-
default: false,
|
|
59
|
-
type: Boolean
|
|
60
|
-
},
|
|
61
|
-
defaultDetailsOpen: {
|
|
62
|
-
default: true,
|
|
63
|
-
type: Boolean
|
|
64
|
-
},
|
|
65
|
-
defaultSurface: { type: String },
|
|
66
|
-
defaultWidth: {
|
|
67
|
-
default: 560,
|
|
68
|
-
type: Number
|
|
69
|
-
},
|
|
70
|
-
surface: { type: String },
|
|
71
|
-
panelOpen: {
|
|
72
|
-
default: void 0,
|
|
73
|
-
type: Boolean
|
|
74
|
-
},
|
|
75
|
-
maximized: {
|
|
76
|
-
default: void 0,
|
|
77
|
-
type: Boolean
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
emits: {
|
|
81
|
-
"update:surface": (_id) => true,
|
|
82
|
-
"update:panelOpen": (_open) => true,
|
|
83
|
-
"update:maximized": (_maximized) => true
|
|
84
|
-
},
|
|
85
|
-
setup(props, { attrs, emit, expose, slots }) {
|
|
86
|
-
const known = (id) => props.surfaces.some((surface) => surface.id === id);
|
|
87
|
-
const localPanelOpen = ref(props.defaultPanelOpen);
|
|
88
|
-
const panelOpen = computed({
|
|
89
|
-
get: () => props.panelOpen ?? localPanelOpen.value,
|
|
90
|
-
set: (open) => {
|
|
91
|
-
if (open === (props.panelOpen ?? localPanelOpen.value)) return;
|
|
92
|
-
if (props.panelOpen === void 0) localPanelOpen.value = open;
|
|
93
|
-
emit("update:panelOpen", open);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
const detailsOpen = ref(props.defaultDetailsOpen);
|
|
97
|
-
const popoverOpen = ref(false);
|
|
98
|
-
const detailsId = useId();
|
|
99
|
-
const localMaximized = ref(false);
|
|
100
|
-
const maximized = computed({
|
|
101
|
-
get: () => props.maximized ?? localMaximized.value,
|
|
102
|
-
set: (value) => {
|
|
103
|
-
if (value === (props.maximized ?? localMaximized.value)) return;
|
|
104
|
-
if (props.maximized === void 0) localMaximized.value = value;
|
|
105
|
-
emit("update:maximized", value);
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
const width = ref(props.defaultWidth);
|
|
109
|
-
const initialTabs = (props.defaultSurface ? [props.defaultSurface] : []).filter(known);
|
|
110
|
-
const tabs = ref(initialTabs);
|
|
111
|
-
const localActive = ref(initialTabs[0] ?? null);
|
|
112
|
-
const active = computed({
|
|
113
|
-
get: () => props.surface !== void 0 ? props.surface : localActive.value,
|
|
114
|
-
set: (id) => {
|
|
115
|
-
if (id === (props.surface !== void 0 ? props.surface : localActive.value)) return;
|
|
116
|
-
if (props.surface === void 0) localActive.value = id;
|
|
117
|
-
emit("update:surface", id);
|
|
118
|
-
}
|
|
119
|
-
});
|
|
120
|
-
const visibleTabs = computed(() => active.value && !tabs.value.includes(active.value) ? [...tabs.value, active.value] : tabs.value);
|
|
121
|
-
if (active.value && !tabs.value.includes(active.value)) tabs.value.push(active.value);
|
|
122
|
-
const root = ref();
|
|
123
|
-
const body = ref();
|
|
124
|
-
const bodyWidth = ref(0);
|
|
125
|
-
const rootWidth = ref(0);
|
|
126
|
-
const detailsInline = computed(() => bodyWidth.value >= 1088);
|
|
127
|
-
watch(detailsInline, (inline) => {
|
|
128
|
-
if (inline) popoverOpen.value = false;
|
|
129
|
-
stopFollowing();
|
|
130
|
-
});
|
|
131
|
-
const details = ref();
|
|
132
|
-
let following = false;
|
|
133
|
-
let followFrame = 0;
|
|
134
|
-
const detailsInset = () => .75 * (Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16);
|
|
135
|
-
const detailsPlace = () => {
|
|
136
|
-
const card = details.value;
|
|
137
|
-
const box = body.value?.getBoundingClientRect();
|
|
138
|
-
if (!card || !box) return;
|
|
139
|
-
const end = getComputedStyle(card).direction === "rtl" ? box.left : document.documentElement.clientWidth - box.right;
|
|
140
|
-
Object.assign(card.style, {
|
|
141
|
-
insetBlockEnd: "auto",
|
|
142
|
-
insetBlockStart: `${box.top}px`,
|
|
143
|
-
insetInlineEnd: `${end + detailsInset()}px`,
|
|
144
|
-
insetInlineStart: "auto",
|
|
145
|
-
margin: "0",
|
|
146
|
-
maxHeight: `${box.height - detailsInset()}px`
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
const followSoon = () => {
|
|
150
|
-
if (!followFrame) followFrame = requestAnimationFrame(() => {
|
|
151
|
-
followFrame = 0;
|
|
152
|
-
detailsPlace();
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
function stopFollowing() {
|
|
156
|
-
if (!following) return;
|
|
157
|
-
following = false;
|
|
158
|
-
cancelAnimationFrame(followFrame);
|
|
159
|
-
followFrame = 0;
|
|
160
|
-
window.removeEventListener("scroll", followSoon, true);
|
|
161
|
-
window.removeEventListener("resize", followSoon);
|
|
162
|
-
for (const name of [
|
|
163
|
-
"inset-block-end",
|
|
164
|
-
"inset-block-start",
|
|
165
|
-
"inset-inline-end",
|
|
166
|
-
"inset-inline-start",
|
|
167
|
-
"margin",
|
|
168
|
-
"max-height"
|
|
169
|
-
]) details.value?.style.removeProperty(name);
|
|
170
|
-
}
|
|
171
|
-
const checkDetailsPlace = () => {
|
|
172
|
-
const card = details.value;
|
|
173
|
-
const box = body.value?.getBoundingClientRect();
|
|
174
|
-
if (following || !card || !box || !card.matches(":popover-open")) return;
|
|
175
|
-
const at = card.getBoundingClientRect();
|
|
176
|
-
const endGap = getComputedStyle(card).direction === "rtl" ? at.left - box.left : box.right - at.right;
|
|
177
|
-
if (Math.abs(at.top - box.top) < 1 && Math.abs(endGap - detailsInset()) < 1) return;
|
|
178
|
-
following = true;
|
|
179
|
-
detailsPlace();
|
|
180
|
-
window.addEventListener("scroll", followSoon, {
|
|
181
|
-
capture: true,
|
|
182
|
-
passive: true
|
|
183
|
-
});
|
|
184
|
-
window.addEventListener("resize", followSoon, { passive: true });
|
|
185
|
-
};
|
|
186
|
-
const detailsToggled = (event) => {
|
|
187
|
-
popoverOpen.value = event.newState === "open";
|
|
188
|
-
if (event.newState === "open") requestAnimationFrame(checkDetailsPlace);
|
|
189
|
-
else stopFollowing();
|
|
190
|
-
};
|
|
191
|
-
watch([
|
|
192
|
-
panelOpen,
|
|
193
|
-
detailsOpen,
|
|
194
|
-
width,
|
|
195
|
-
tabs,
|
|
196
|
-
active,
|
|
197
|
-
maximized
|
|
198
|
-
], () => {
|
|
199
|
-
if (!props.storageKey || typeof localStorage === "undefined") return;
|
|
200
|
-
const value = {
|
|
201
|
-
panelOpen: panelOpen.value,
|
|
202
|
-
detailsOpen: detailsOpen.value,
|
|
203
|
-
width: width.value,
|
|
204
|
-
tabs: visibleTabs.value,
|
|
205
|
-
active: active.value,
|
|
206
|
-
maximized: maximized.value
|
|
207
|
-
};
|
|
208
|
-
localStorage.setItem(props.storageKey, JSON.stringify(value));
|
|
209
|
-
}, { deep: true });
|
|
210
|
-
watch([() => props.surface, () => props.surfaces], ([id]) => {
|
|
211
|
-
if (id === void 0 || id !== null && !known(id)) return;
|
|
212
|
-
if (id && !tabs.value.includes(id)) tabs.value = [...tabs.value, id];
|
|
213
|
-
}, { immediate: true });
|
|
214
|
-
let observer;
|
|
215
|
-
onMounted(() => {
|
|
216
|
-
const stored = readLayout(props.storageKey);
|
|
217
|
-
localPanelOpen.value = stored.panelOpen ?? localPanelOpen.value;
|
|
218
|
-
detailsOpen.value = stored.detailsOpen ?? detailsOpen.value;
|
|
219
|
-
localMaximized.value = stored.maximized ?? localMaximized.value;
|
|
220
|
-
width.value = stored.width ?? width.value;
|
|
221
|
-
if (stored.tabs) tabs.value = stored.tabs.filter(known);
|
|
222
|
-
if (known(stored.active)) localActive.value = stored.active ?? null;
|
|
223
|
-
else if (stored.tabs) localActive.value = tabs.value[0] ?? null;
|
|
224
|
-
if (active.value && !tabs.value.includes(active.value)) tabs.value = [...tabs.value, active.value];
|
|
225
|
-
observer = new ResizeObserver(() => {
|
|
226
|
-
bodyWidth.value = body.value?.clientWidth ?? 0;
|
|
227
|
-
rootWidth.value = root.value?.clientWidth ?? 0;
|
|
228
|
-
if (following) followSoon();
|
|
229
|
-
});
|
|
230
|
-
if (body.value) observer.observe(body.value);
|
|
231
|
-
if (root.value) observer.observe(root.value);
|
|
232
|
-
});
|
|
233
|
-
onBeforeUnmount(() => {
|
|
234
|
-
observer?.disconnect();
|
|
235
|
-
stopFollowing();
|
|
236
|
-
});
|
|
237
|
-
function openSurface(id) {
|
|
238
|
-
if (!tabs.value.includes(id)) tabs.value = [...tabs.value, id];
|
|
239
|
-
active.value = id;
|
|
240
|
-
panelOpen.value = true;
|
|
241
|
-
}
|
|
242
|
-
function closeSurface(id) {
|
|
243
|
-
const index = visibleTabs.value.indexOf(id);
|
|
244
|
-
tabs.value = visibleTabs.value.filter((tab) => tab !== id);
|
|
245
|
-
if (active.value === id) active.value = tabs.value[Math.max(0, index - 1)] ?? null;
|
|
246
|
-
}
|
|
247
|
-
function togglePanel() {
|
|
248
|
-
const open = !panelOpen.value;
|
|
249
|
-
if (!open) maximized.value = false;
|
|
250
|
-
panelOpen.value = open;
|
|
251
|
-
}
|
|
252
|
-
expose({
|
|
253
|
-
openSurface,
|
|
254
|
-
closeSurface,
|
|
255
|
-
togglePanel
|
|
256
|
-
});
|
|
257
|
-
function startResize(event) {
|
|
258
|
-
const handle = event.currentTarget;
|
|
259
|
-
const startX = event.clientX;
|
|
260
|
-
const startWidth = width.value;
|
|
261
|
-
handle.setPointerCapture(event.pointerId);
|
|
262
|
-
const move = (next) => {
|
|
263
|
-
const max = Math.max(PANEL_MIN_WIDTH, rootWidth.value - 360);
|
|
264
|
-
width.value = Math.round(Math.min(max, Math.max(PANEL_MIN_WIDTH, startWidth + startX - next.clientX)));
|
|
265
|
-
};
|
|
266
|
-
const stop = () => {
|
|
267
|
-
handle.removeEventListener("pointermove", move);
|
|
268
|
-
handle.removeEventListener("pointerup", stop);
|
|
269
|
-
handle.removeEventListener("pointercancel", stop);
|
|
270
|
-
};
|
|
271
|
-
handle.addEventListener("pointermove", move);
|
|
272
|
-
handle.addEventListener("pointerup", stop);
|
|
273
|
-
handle.addEventListener("pointercancel", stop);
|
|
274
|
-
}
|
|
275
|
-
function resizeWithKeys(event) {
|
|
276
|
-
const step = event.shiftKey ? 64 : 16;
|
|
277
|
-
if (event.key === "ArrowLeft") width.value += step;
|
|
278
|
-
else if (event.key === "ArrowRight") width.value = Math.max(PANEL_MIN_WIDTH, width.value - step);
|
|
279
|
-
else return;
|
|
280
|
-
event.preventDefault();
|
|
281
|
-
}
|
|
282
|
-
function launcherKeys(event) {
|
|
283
|
-
const surface = props.surfaces.find((item) => item.shortcut?.toLowerCase() === event.key.toLowerCase());
|
|
284
|
-
if (!surface) return;
|
|
285
|
-
event.preventDefault();
|
|
286
|
-
openSurface(surface.id);
|
|
287
|
-
}
|
|
288
|
-
const toggle = (options) => h("button", {
|
|
289
|
-
type: "button",
|
|
290
|
-
class: "vh-agent-session__toggle",
|
|
291
|
-
"data-slot": options.slot,
|
|
292
|
-
"aria-label": options.label,
|
|
293
|
-
"aria-pressed": options.pressed ? "true" : "false",
|
|
294
|
-
title: options.label,
|
|
295
|
-
onClick: options.onClick,
|
|
296
|
-
popovertarget: options.popovertarget
|
|
297
|
-
}, [icon(options.iconName)]);
|
|
298
|
-
const detailsToggle = () => slots.details ? toggle({
|
|
299
|
-
slot: "agent-session-details-toggle",
|
|
300
|
-
label: "Session details",
|
|
301
|
-
iconName: "i-lucide-square-menu",
|
|
302
|
-
pressed: detailsInline.value ? detailsOpen.value : popoverOpen.value,
|
|
303
|
-
...detailsInline.value ? { onClick: () => detailsOpen.value = !detailsOpen.value } : { popovertarget: detailsId }
|
|
304
|
-
}) : null;
|
|
305
|
-
const panelToggle = () => props.surfaces.length ? toggle({
|
|
306
|
-
slot: "agent-session-panel-toggle",
|
|
307
|
-
label: panelOpen.value ? "Close the right panel" : "Open the right panel",
|
|
308
|
-
iconName: "i-lucide-panel-right",
|
|
309
|
-
pressed: panelOpen.value,
|
|
310
|
-
onClick: togglePanel
|
|
311
|
-
}) : null;
|
|
312
|
-
const launcher = () => h("div", {
|
|
313
|
-
class: "vh-agent-session__launcher",
|
|
314
|
-
"data-slot": "agent-session-launcher",
|
|
315
|
-
tabindex: 0,
|
|
316
|
-
"aria-label": "Open a surface",
|
|
317
|
-
onKeydown: launcherKeys
|
|
318
|
-
}, [h("div", { class: "vh-agent-session__launcher-inner" }, [h("h3", { class: "vh-agent-session__launcher-title" }, "Open a surface"), h("div", { class: "vh-agent-session__launcher-list" }, props.surfaces.map((surface) => h("button", {
|
|
319
|
-
type: "button",
|
|
320
|
-
class: "vh-agent-session__launcher-item",
|
|
321
|
-
onClick: () => openSurface(surface.id)
|
|
322
|
-
}, [
|
|
323
|
-
icon(surface.icon),
|
|
324
|
-
h("span", { class: "vh-agent-session__launcher-label" }, surface.label),
|
|
325
|
-
surface.shortcut ? h("kbd", { class: "vh-agent-session__kbd" }, surface.shortcut.toUpperCase()) : null
|
|
326
|
-
])))])]);
|
|
327
|
-
const panel = () => {
|
|
328
|
-
const surfaceById = new Map(props.surfaces.map((surface) => [surface.id, surface]));
|
|
329
|
-
const current = active.value ? surfaceById.get(active.value) : void 0;
|
|
330
|
-
return h(Tabs, {
|
|
331
|
-
value: active.value,
|
|
332
|
-
"onUpdate:value": (id) => {
|
|
333
|
-
active.value = id;
|
|
334
|
-
},
|
|
335
|
-
class: "vh-agent-session__panel",
|
|
336
|
-
"aria-label": "Right panel"
|
|
337
|
-
}, {
|
|
338
|
-
render: kitSlot("aside", "agent-session-panel"),
|
|
339
|
-
default: () => [h("div", {
|
|
340
|
-
class: "vh-agent-session__panel-header",
|
|
341
|
-
"data-slot": "agent-session-panel-header"
|
|
342
|
-
}, [h(TabsList, { class: "vh-agent-session__tabs" }, () => [...visibleTabs.value.map((id) => {
|
|
343
|
-
const surface = surfaceById.get(id);
|
|
344
|
-
if (!surface) return null;
|
|
345
|
-
const selected = id === active.value;
|
|
346
|
-
const closable = visibleTabs.value.length > 1;
|
|
347
|
-
return h("div", {
|
|
348
|
-
key: id,
|
|
349
|
-
class: "vh-agent-session__tab",
|
|
350
|
-
"data-active": selected ? "" : void 0,
|
|
351
|
-
"data-closable": closable ? "" : void 0
|
|
352
|
-
}, [h(TabsTab, {
|
|
353
|
-
value: id,
|
|
354
|
-
class: "vh-agent-session__tab-button",
|
|
355
|
-
onAuxclick: (event) => closable && event.button === 1 && closeSurface(id)
|
|
356
|
-
}, () => [icon(surface.icon, { class: "vh-agent-session__tab-icon" }), h("span", surface.label)]), closable ? h("button", {
|
|
357
|
-
type: "button",
|
|
358
|
-
class: "vh-agent-session__tab-close",
|
|
359
|
-
"aria-label": `Close ${surface.label}`,
|
|
360
|
-
onClick: () => closeSurface(id)
|
|
361
|
-
}, [icon("i-lucide-x")]) : null]);
|
|
362
|
-
}), h("button", {
|
|
363
|
-
type: "button",
|
|
364
|
-
class: "vh-agent-session__toggle vh-agent-session__new-tab",
|
|
365
|
-
"aria-label": "Open a surface",
|
|
366
|
-
title: "Open a surface",
|
|
367
|
-
"aria-pressed": active.value === null ? "true" : "false",
|
|
368
|
-
onClick: () => active.value = null
|
|
369
|
-
}, [icon("i-lucide-plus")])]), h("div", { class: "vh-agent-session__controls" }, [toggle({
|
|
370
|
-
slot: "agent-session-maximize",
|
|
371
|
-
label: maximized.value ? "Restore panel size" : "Maximize panel",
|
|
372
|
-
iconName: maximized.value ? "i-lucide-minimize-2" : "i-lucide-maximize-2",
|
|
373
|
-
pressed: maximized.value,
|
|
374
|
-
onClick: () => maximized.value = !maximized.value
|
|
375
|
-
}), panelToggle()])]), current ? h(TabsPanel, {
|
|
376
|
-
key: current.id,
|
|
377
|
-
value: current.id,
|
|
378
|
-
class: "vh-agent-session__panel-body"
|
|
379
|
-
}, {
|
|
380
|
-
render: kitSlot("div", "agent-session-panel-body"),
|
|
381
|
-
default: () => slots[`surface-${current.id}`]?.({ surface: current }) ?? slots.surface?.({ surface: current })
|
|
382
|
-
}) : h("div", {
|
|
383
|
-
class: "vh-agent-session__panel-body",
|
|
384
|
-
"data-slot": "agent-session-panel-body"
|
|
385
|
-
}, [launcher()])]
|
|
386
|
-
});
|
|
387
|
-
};
|
|
388
|
-
return () => {
|
|
389
|
-
const open = panelOpen.value && props.surfaces.length > 0;
|
|
390
|
-
const showDetails = Boolean(slots.details) && (detailsInline.value ? detailsOpen.value : popoverOpen.value);
|
|
391
|
-
return h("section", {
|
|
392
|
-
...attrs,
|
|
393
|
-
ref: root,
|
|
394
|
-
class: ["vh-agent-session", attrs.class],
|
|
395
|
-
"aria-label": attrs["aria-label"] ?? props.title,
|
|
396
|
-
"data-panel-open": open ? "" : void 0,
|
|
397
|
-
"data-maximized": open && maximized.value ? "" : void 0,
|
|
398
|
-
"data-details": showDetails ? detailsInline.value ? "inline" : "popover" : void 0,
|
|
399
|
-
style: [{ "--vh-agent-panel-width": `${width.value}px` }, attrs.style]
|
|
400
|
-
}, [
|
|
401
|
-
h("div", {
|
|
402
|
-
class: "vh-agent-session__main",
|
|
403
|
-
"data-slot": "agent-session-main"
|
|
404
|
-
}, [h("header", {
|
|
405
|
-
class: "vh-agent-session__header",
|
|
406
|
-
"data-slot": "agent-session-header"
|
|
407
|
-
}, [h("div", { class: "vh-agent-session__heading" }, slots.heading?.() ?? [h("h2", { class: "vh-agent-session__title" }, props.title), props.subtitle ? h("span", { class: "vh-agent-session__subtitle" }, props.subtitle) : null]), h("div", { class: "vh-agent-session__controls" }, [
|
|
408
|
-
slots.actions?.(),
|
|
409
|
-
detailsToggle(),
|
|
410
|
-
open ? null : panelToggle()
|
|
411
|
-
])]), h("div", {
|
|
412
|
-
ref: body,
|
|
413
|
-
class: "vh-agent-session__body",
|
|
414
|
-
"data-slot": "agent-session-body"
|
|
415
|
-
}, [
|
|
416
|
-
slots.body?.() ?? h("div", {
|
|
417
|
-
class: "vh-agent-session__scroll",
|
|
418
|
-
"data-slot": "agent-session-scroll"
|
|
419
|
-
}, [h("div", {
|
|
420
|
-
class: "vh-agent-session__lane",
|
|
421
|
-
"data-slot": "agent-session-lane"
|
|
422
|
-
}, slots.default?.())]),
|
|
423
|
-
slots.details && detailsInline.value && detailsOpen.value ? h("aside", {
|
|
424
|
-
key: "inline",
|
|
425
|
-
class: "vh-agent-session__details",
|
|
426
|
-
"data-slot": "agent-session-details",
|
|
427
|
-
"aria-label": "Session details"
|
|
428
|
-
}, [h("div", { class: "vh-agent-session__details-card" }, slots.details())]) : null,
|
|
429
|
-
slots.details && !detailsInline.value ? h("aside", {
|
|
430
|
-
key: "popover",
|
|
431
|
-
id: detailsId,
|
|
432
|
-
popover: "auto",
|
|
433
|
-
class: "vh-agent-session__details",
|
|
434
|
-
"data-slot": "agent-session-details",
|
|
435
|
-
"aria-label": "Session details",
|
|
436
|
-
onBeforetoggle: detailsToggled,
|
|
437
|
-
ref: details
|
|
438
|
-
}, popoverOpen.value ? [h("div", { class: "vh-agent-session__details-card" }, slots.details())] : []) : null
|
|
439
|
-
])]),
|
|
440
|
-
open ? h("div", {
|
|
441
|
-
class: "vh-agent-session__resizer",
|
|
442
|
-
"data-slot": "agent-session-resizer",
|
|
443
|
-
role: "separator",
|
|
444
|
-
tabindex: 0,
|
|
445
|
-
"aria-orientation": "vertical",
|
|
446
|
-
"aria-label": "Resize the right panel",
|
|
447
|
-
"aria-valuenow": width.value,
|
|
448
|
-
onPointerdown: startResize,
|
|
449
|
-
onKeydown: resizeWithKeys,
|
|
450
|
-
onDblclick: () => width.value = props.defaultWidth
|
|
451
|
-
}) : null,
|
|
452
|
-
open ? panel() : null
|
|
453
|
-
]);
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
});
|
|
457
|
-
/** One section of the details card, with a small muted heading. */
|
|
458
|
-
const AgentSessionDetailsSection = defineComponent({
|
|
459
|
-
name: "AgentSessionDetailsSection",
|
|
460
|
-
props: { title: { type: String } },
|
|
461
|
-
setup(props, { slots }) {
|
|
462
|
-
return () => h("section", {
|
|
463
|
-
class: "vh-agent-session__section",
|
|
464
|
-
"data-slot": "agent-session-details-section"
|
|
465
|
-
}, [props.title || slots.actions ? h("div", { class: "vh-agent-session__section-heading" }, [props.title ? h("h3", props.title) : null, slots.actions ? h("div", { class: "vh-agent-session__section-actions" }, slots.actions()) : null]) : null, h("div", { class: "vh-agent-session__section-rows" }, slots.default?.())]);
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
/** A 32px row of the details card: an icon, a label, and a value at the end. A row with `href` or `onClick` is a control. */
|
|
469
|
-
const AgentSessionDetailsRow = defineComponent({
|
|
470
|
-
name: "AgentSessionDetailsRow",
|
|
471
|
-
inheritAttrs: false,
|
|
472
|
-
props: {
|
|
473
|
-
icon: { type: String },
|
|
474
|
-
label: { type: String },
|
|
475
|
-
value: { type: [String, Number] },
|
|
476
|
-
href: { type: String },
|
|
477
|
-
tone: {
|
|
478
|
-
default: "default",
|
|
479
|
-
type: String
|
|
480
|
-
},
|
|
481
|
-
title: { type: String }
|
|
482
|
-
},
|
|
483
|
-
setup(props, { attrs, slots }) {
|
|
484
|
-
return () => {
|
|
485
|
-
const interactive = Boolean(props.href || attrs.onClick);
|
|
486
|
-
const tag = props.href ? "a" : interactive ? "button" : "div";
|
|
487
|
-
return h(tag, {
|
|
488
|
-
...attrs,
|
|
489
|
-
class: ["vh-agent-session__row", attrs.class],
|
|
490
|
-
"data-slot": "agent-session-details-row",
|
|
491
|
-
"data-interactive": interactive ? "" : void 0,
|
|
492
|
-
"data-tone": props.tone === "default" ? void 0 : props.tone,
|
|
493
|
-
href: props.href,
|
|
494
|
-
type: tag === "button" ? "button" : void 0,
|
|
495
|
-
title: props.title
|
|
496
|
-
}, [
|
|
497
|
-
props.icon ? icon(props.icon, { class: "vh-agent-session__row-icon" }) : slots.icon?.(),
|
|
498
|
-
h("span", { class: "vh-agent-session__row-label" }, slots.default?.() ?? props.label),
|
|
499
|
-
props.value !== void 0 || slots.value ? h("span", { class: "vh-agent-session__row-value" }, slots.value?.() ?? String(props.value)) : null
|
|
500
|
-
]);
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
});
|
|
504
|
-
function hasContent(nodes) {
|
|
505
|
-
return nodes.some((node) => {
|
|
506
|
-
if (!isVNode(node)) return true;
|
|
507
|
-
if (node.type === Comment) return false;
|
|
508
|
-
return node.type !== Fragment || Array.isArray(node.children) && hasContent(node.children);
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
function workDetail(entry, slot) {
|
|
512
|
-
const custom = slot?.({ entry });
|
|
513
|
-
return custom && hasContent(custom) ? h("div", {
|
|
514
|
-
class: "vh-agent-session__work-detail-custom",
|
|
515
|
-
"data-slot": "agent-session-work-detail"
|
|
516
|
-
}, custom) : h("pre", {
|
|
517
|
-
class: "vh-agent-session__work-detail",
|
|
518
|
-
"data-slot": "agent-session-work-detail"
|
|
519
|
-
}, entry.detail);
|
|
520
|
-
}
|
|
521
|
-
function workRow(entry, open, onToggle, detailSlot) {
|
|
522
|
-
const expandable = Boolean(entry.detail);
|
|
523
|
-
const line = [
|
|
524
|
-
h("span", {
|
|
525
|
-
class: "vh-agent-session__work-icon",
|
|
526
|
-
"data-status": entry.status
|
|
527
|
-
}, [icon(entry.status === "error" ? "i-lucide-circle-x" : workIcons[entry.kind])]),
|
|
528
|
-
h("span", { class: "vh-agent-session__work-label" }, [h("span", { class: "vh-agent-session__work-title" }, entry.label), entry.preview ? h("span", { class: "vh-agent-session__work-preview" }, entry.preview) : null]),
|
|
529
|
-
entry.trailing ? h("span", { class: "vh-agent-session__work-trailing" }, entry.trailing) : null
|
|
530
|
-
];
|
|
531
|
-
return h("div", {
|
|
532
|
-
key: entry.id,
|
|
533
|
-
class: "vh-agent-session__work-row",
|
|
534
|
-
"data-slot": "agent-session-work-row",
|
|
535
|
-
"data-kind": entry.kind,
|
|
536
|
-
"data-open": open ? "" : void 0
|
|
537
|
-
}, [expandable ? h("button", {
|
|
538
|
-
type: "button",
|
|
539
|
-
class: "vh-agent-session__work-line",
|
|
540
|
-
"aria-expanded": open ? "true" : "false",
|
|
541
|
-
onClick: onToggle
|
|
542
|
-
}, line) : h("div", { class: "vh-agent-session__work-line" }, line), expandable && open ? workDetail(entry, detailSlot) : null]);
|
|
543
|
-
}
|
|
544
|
-
/** A group of tool calls, folded behind one line such as "Worked for 3m 12s". */
|
|
545
|
-
const AgentSessionWorkGroup = defineComponent({
|
|
546
|
-
name: "AgentSessionWorkGroup",
|
|
547
|
-
props: {
|
|
548
|
-
label: { type: String },
|
|
549
|
-
entries: {
|
|
550
|
-
required: true,
|
|
551
|
-
type: Array
|
|
552
|
-
},
|
|
553
|
-
defaultOpen: {
|
|
554
|
-
default: false,
|
|
555
|
-
type: Boolean
|
|
556
|
-
}
|
|
557
|
-
},
|
|
558
|
-
slots: Object,
|
|
559
|
-
setup(props, { slots }) {
|
|
560
|
-
const open = ref(props.defaultOpen);
|
|
561
|
-
const openRows = ref(/* @__PURE__ */ new Set());
|
|
562
|
-
const toggleRow = (id) => {
|
|
563
|
-
const next = new Set(openRows.value);
|
|
564
|
-
if (next.has(id)) next.delete(id);
|
|
565
|
-
else next.add(id);
|
|
566
|
-
openRows.value = next;
|
|
567
|
-
};
|
|
568
|
-
return () => {
|
|
569
|
-
const failed = props.entries.filter((entry) => entry.status === "error").length;
|
|
570
|
-
const summary = props.label ?? `${props.entries.length} ${props.entries.length === 1 ? "step" : "steps"}`;
|
|
571
|
-
return h("div", {
|
|
572
|
-
class: "vh-agent-session__work",
|
|
573
|
-
"data-slot": "agent-session-work",
|
|
574
|
-
"data-open": open.value ? "" : void 0
|
|
575
|
-
}, [h("button", {
|
|
576
|
-
type: "button",
|
|
577
|
-
class: "vh-agent-session__work-summary",
|
|
578
|
-
"aria-expanded": open.value ? "true" : "false",
|
|
579
|
-
onClick: () => open.value = !open.value
|
|
580
|
-
}, [
|
|
581
|
-
h("span", summary),
|
|
582
|
-
props.label ? h("span", { class: "vh-agent-session__work-count" }, `${props.entries.length} ${props.entries.length === 1 ? "step" : "steps"}`) : null,
|
|
583
|
-
failed ? h("span", { class: "vh-agent-session__work-failed" }, `${failed} failed`) : null,
|
|
584
|
-
icon("i-lucide-chevron-down", { class: "vh-agent-session__work-chevron" })
|
|
585
|
-
]), open.value ? h("div", { class: "vh-agent-session__work-list" }, props.entries.map((entry) => workRow(entry, openRows.value.has(entry.id), () => toggleRow(entry.id), slots.detail))) : null]);
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
const FOLD_LINES = 14;
|
|
590
|
-
const FOLD_CHARACTERS = 900;
|
|
591
|
-
const UserMessage = defineComponent({
|
|
592
|
-
name: "AgentSessionUserMessage",
|
|
593
|
-
props: { text: {
|
|
594
|
-
required: true,
|
|
595
|
-
type: String
|
|
596
|
-
} },
|
|
597
|
-
setup(props) {
|
|
598
|
-
const expanded = ref(false);
|
|
599
|
-
return () => {
|
|
600
|
-
const long = props.text.length > FOLD_CHARACTERS || props.text.split("\n").length > FOLD_LINES;
|
|
601
|
-
const folded = long && !expanded.value;
|
|
602
|
-
return h("div", {
|
|
603
|
-
class: "vh-agent-session__user",
|
|
604
|
-
"data-slot": "agent-session-user"
|
|
605
|
-
}, [h("h3", { class: "vh-agent-session__sr" }, "You"), h("div", {
|
|
606
|
-
class: "vh-agent-session__bubble",
|
|
607
|
-
"data-folded": folded ? "" : void 0
|
|
608
|
-
}, [h("div", { class: "vh-agent-session__bubble-text" }, props.text), long ? h("button", {
|
|
609
|
-
type: "button",
|
|
610
|
-
class: "vh-agent-session__bubble-more",
|
|
611
|
-
"aria-expanded": expanded.value ? "true" : "false",
|
|
612
|
-
onClick: () => expanded.value = !expanded.value
|
|
613
|
-
}, expanded.value ? "Show less" : "Show more") : null])]);
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
/** The session's turns: user bubbles on the right, the agent's answers as Markdown, and folded tool calls between them. */
|
|
618
|
-
const AgentSessionTimeline = defineComponent({
|
|
619
|
-
name: "AgentSessionTimeline",
|
|
620
|
-
props: { items: {
|
|
621
|
-
required: true,
|
|
622
|
-
type: Array
|
|
623
|
-
} },
|
|
624
|
-
slots: Object,
|
|
625
|
-
setup(props, { slots }) {
|
|
626
|
-
return () => h("div", {
|
|
627
|
-
class: "vh-agent-session__timeline",
|
|
628
|
-
"data-slot": "agent-session-timeline"
|
|
629
|
-
}, props.items.map((item) => {
|
|
630
|
-
const itemSlot = slots[`item-${item.type}`];
|
|
631
|
-
const custom = itemSlot?.({ item });
|
|
632
|
-
if (custom) return h("div", {
|
|
633
|
-
key: item.id,
|
|
634
|
-
class: "vh-agent-session__item"
|
|
635
|
-
}, custom);
|
|
636
|
-
if (item.type === "user") return h(UserMessage, {
|
|
637
|
-
key: item.id,
|
|
638
|
-
text: item.text
|
|
639
|
-
});
|
|
640
|
-
if (item.type === "assistant") return h("div", {
|
|
641
|
-
key: item.id,
|
|
642
|
-
class: "vh-agent-session__assistant",
|
|
643
|
-
"data-slot": "agent-session-assistant"
|
|
644
|
-
}, [h(Markdown, { value: item.text })]);
|
|
645
|
-
if (item.type === "divider") return h("div", {
|
|
646
|
-
key: item.id,
|
|
647
|
-
class: "vh-agent-session__divider",
|
|
648
|
-
role: "separator"
|
|
649
|
-
}, item.label);
|
|
650
|
-
return h(AgentSessionWorkGroup, {
|
|
651
|
-
key: item.id,
|
|
652
|
-
label: item.label,
|
|
653
|
-
entries: item.entries,
|
|
654
|
-
defaultOpen: item.defaultOpen
|
|
655
|
-
}, slots["work-detail"] ? { detail: slots["work-detail"] } : void 0);
|
|
656
|
-
}));
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
export { AgentSession, AgentSessionDetailsRow, AgentSessionDetailsSection, AgentSessionTimeline, AgentSessionWorkGroup };
|
|
1
|
+
export { a as AgentSession, i as AgentSessionDetailsRow, r as AgentSessionDetailsSection, t as AgentSessionTimeline, s as AgentSessionTitle, n as AgentSessionWorkGroup, o as agentSessionProviderLabel } from "../../agent-session-2j2gbGpp.js";
|