@vite-hub/ui 0.1.0 → 0.3.1
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 +244 -18
- package/dist/attachments-BzTwqRTU.js +90 -0
- package/dist/choices-input-ByXJvDn1.d.ts +94 -0
- package/dist/{code-view-J4OsgEdh.js → code-view-D0bqhogi.js} +20 -4
- package/dist/colors-BghReA9C-CjF9gnmy.js +28 -0
- package/dist/comment-composer-Cc8Jvu6u.d.ts +243 -0
- package/dist/comment-composer-jYv2ULNP.js +591 -0
- package/dist/comment-layer-ClH4MLj4.d.ts +165 -0
- package/dist/comment-list-B8hphLfS.d.ts +62 -0
- package/dist/comment-marks.css +234 -0
- package/dist/comment-panel-fcKSKwLC.d.ts +197 -0
- package/dist/comment-person-CLPlW_SS.js +40 -0
- package/dist/comment-pin-CvwgRSDR.d.ts +68 -0
- package/dist/comment-row-Bbm9WwuF.js +39 -0
- package/dist/comment-thread-CoTLrdal.d.ts +368 -0
- package/dist/comment-visibility-DsVuVndP.d.ts +40 -0
- package/dist/{comments-ChNJkV1d.d.ts → comments-Bx2WRsYy.d.ts} +69 -7
- package/dist/{comments-C08J3z4e.js → comments-CkWc2Khc.js} +155 -60
- package/dist/comments-context-C2lOZyQ5.js +38 -0
- package/dist/config-DgxBW013.d.ts +80 -0
- package/dist/config-Dk67emQt.js +63 -0
- package/dist/copy-button-CRN3kmSD.js +253 -0
- package/dist/draw-DzSmD7uo-Dwz8zoH2.js +72976 -0
- package/dist/editor-C_wt4RRV.js +582 -0
- package/dist/error-diagnostics-SXtnk6bz.js +38 -0
- package/dist/{file-tree-C1pv4_AI.js → file-tree-C4OYgbV-.js} +292 -145
- package/dist/{file-tree-Ctb8hZ_g.d.ts → file-tree-DlT9RGhu.d.ts} +51 -15
- package/dist/format-Du58PlsG.js +18 -0
- package/dist/handlers-DMl-Na3x.js +182 -0
- package/dist/headless.d.ts +5 -176
- package/dist/headless.js +5 -3
- package/dist/icon-swap.css +69 -0
- package/dist/{image-preview-VfknBEFu.js → image-preview-C9tdkmEj.js} +8 -5
- package/dist/{index-DcH0QSI5.d.ts → index-BD1e8vx5.d.ts} +8 -0
- package/dist/{code-view-vDM-hph-.d.ts → index-CNY1uNTh.d.ts} +14 -228
- package/dist/index.d.ts +53 -56
- package/dist/index.js +677 -25
- package/dist/markdown-editor-CMbNZOdN.js +2394 -0
- package/dist/markdown-editor-DqdZfIEn.d.ts +195 -0
- package/dist/markdown-editor.d.ts +108 -0
- package/dist/markdown-editor.js +3 -0
- package/dist/message-scroller-Bm1YWTeY.d.ts +175 -0
- package/dist/nuxt-ui-DSQFzq3s.js +38 -0
- package/dist/nuxt.d.ts +84 -2
- package/dist/nuxt.js +237 -35
- package/dist/parts/components/agent-session.d.ts +254 -0
- package/dist/parts/components/agent-session.js +640 -0
- package/dist/{attachment-BBndG9_P.d.ts → parts/components/attachment.d.ts} +13 -14
- package/dist/{attachment-B3dXC7jM.js → parts/components/attachment.js} +6 -4
- package/dist/{avatar-stack.d.ts → parts/components/avatar-stack.d.ts} +1 -1
- package/dist/{avatar-stack-DM6HRnc0.js → parts/components/avatar-stack.js} +2 -5
- package/dist/{bubble-BJH2rfii.d.ts → parts/components/bubble.d.ts} +8 -9
- package/dist/{bubble-BPyFQlW7.js → parts/components/bubble.js} +2 -2
- package/dist/{chat-message-mpDmZbIC.d.ts → parts/components/chat-message.d.ts} +2 -3
- package/dist/{chat-message-BNK9G7xF.js → parts/components/chat-message.js} +4 -4
- package/dist/{chat-session-D6C7VJBR.d.ts → parts/components/chat-session.d.ts} +3 -4
- package/dist/{chat-session-DYEHB1HC.js → parts/components/chat-session.js} +2 -2
- package/dist/{chat-B9HlZWA2.d.ts → parts/components/chat.d.ts} +8 -4
- package/dist/{chat-BoFHlu9V.js → parts/components/chat.js} +42 -9
- package/dist/{highlighted-code-Dzf6o54i.d.ts → parts/components/code-block.d.ts} +16 -24
- package/dist/{code-block-Br-02hn-.js → parts/components/code-block.js} +9 -38
- package/dist/parts/components/code-view.d.ts +270 -0
- package/dist/parts/components/code-view.js +2 -0
- package/dist/parts/components/comment-composer.d.ts +2 -0
- package/dist/parts/components/comment-composer.js +2 -0
- package/dist/parts/components/comment-layer.d.ts +2 -0
- package/dist/parts/components/comment-layer.js +618 -0
- package/dist/parts/components/comment-list.d.ts +2 -0
- package/dist/parts/components/comment-list.js +167 -0
- package/dist/parts/components/comment-panel.d.ts +2 -0
- package/dist/parts/components/comment-panel.js +299 -0
- package/dist/parts/components/comment-pin.d.ts +2 -0
- package/dist/parts/components/comment-pin.js +75 -0
- package/dist/parts/components/comment-thread.d.ts +2 -0
- package/dist/parts/components/comment-thread.js +571 -0
- package/dist/parts/components/comments.d.ts +7 -0
- package/dist/parts/components/comments.js +8 -0
- package/dist/{connection-status-DjGBw6xX.d.ts → parts/components/connection-status.d.ts} +6 -7
- package/dist/{connection-status-CzuWBENf.js → parts/components/connection-status.js} +1 -1
- package/dist/parts/components/copy-button.d.ts +118 -0
- package/dist/parts/components/copy-button.js +2 -0
- package/dist/parts/components/device-frame.d.ts +130 -0
- package/dist/parts/components/device-frame.js +471 -0
- package/dist/parts/components/file-tree.d.ts +2 -0
- package/dist/parts/components/file-tree.js +2 -0
- package/dist/parts/components/filter-search.d.ts +47 -0
- package/dist/parts/components/filter-search.js +58 -0
- package/dist/parts/components/markdown-editor.d.ts +2 -0
- package/dist/parts/components/markdown-editor.js +2 -0
- package/dist/parts/components/markdown-renderer.d.ts +52 -0
- package/dist/parts/components/markdown-renderer.js +23077 -0
- package/dist/{markdown-Dse5ldJe.d.ts → parts/components/markdown.d.ts} +7 -7
- package/dist/parts/components/markdown.js +47 -0
- package/dist/{marker-ea-tvx-J.d.ts → parts/components/marker.d.ts} +5 -6
- package/dist/{marker-Di2ZG_k1.js → parts/components/marker.js} +2 -2
- package/dist/{message-parts-BBFUkluC.d.ts → parts/components/message-parts.d.ts} +2 -3
- package/dist/{message-parts-DQnfioAH.js → parts/components/message-parts.js} +6 -6
- package/dist/{message-CW_paC1k.d.ts → parts/components/message.d.ts} +8 -9
- package/dist/{message-DiyBthIq.js → parts/components/message.js} +2 -2
- package/dist/parts/components/patch-parsers.d.ts +2 -0
- package/dist/parts/components/patch-parsers.js +2 -0
- package/dist/{prompt-input-Cy_Ue6B5.d.ts → parts/components/prompt-input.d.ts} +54 -11
- package/dist/{prompt-input-BbnCb80O.js → parts/components/prompt-input.js} +66 -111
- package/dist/parts/components/relative-time.d.ts +73 -0
- package/dist/parts/components/relative-time.js +2 -0
- package/dist/parts/components/status.d.ts +60 -0
- package/dist/parts/components/status.js +48 -0
- package/dist/{sync-status-refELOZn.d.ts → parts/components/sync-status.d.ts} +5 -6
- package/dist/{sync-status-BpxYdZIJ.js → parts/components/sync-status.js} +1 -1
- package/dist/{tool-list-E7CA52rz.d.ts → parts/components/tool-list.d.ts} +3 -4
- package/dist/{tool-list-BdSr5CT4.js → parts/components/tool-list.js} +7 -38
- package/dist/{trace-run-COeXn46Z.d.ts → parts/components/trace-run.d.ts} +3 -4
- package/dist/{trace-run-BIQ17CED.js → parts/components/trace-run.js} +15 -23
- package/dist/{trace-V7rM3Pyd.d.ts → parts/components/trace.d.ts} +10 -11
- package/dist/{trace-llBCDiSW.js → parts/components/trace.js} +20 -13
- package/dist/parts/composables/attachments.d.ts +32 -0
- package/dist/parts/composables/attachments.js +2 -0
- package/dist/parts/composables/highlighted-code.d.ts +9 -0
- package/dist/{highlighted-code-Ck4zexJX.js → parts/composables/highlighted-code.js} +5 -2
- package/dist/parts/headless/choices-input.d.ts +2 -0
- package/dist/parts/headless/choices-input.js +162 -0
- package/dist/parts/headless/comment-visibility.d.ts +2 -0
- package/dist/parts/headless/comment-visibility.js +128 -0
- package/dist/parts/headless/comments.d.ts +2 -0
- package/dist/parts/headless/comments.js +2 -0
- package/dist/parts/headless/message-scroller.d.ts +2 -0
- package/dist/{message-scroller-CX6NJTdm.js → parts/headless/message-scroller.js} +2 -2
- package/dist/parts/playground/highlight.d.ts +5 -0
- package/dist/parts/playground/highlight.js +23 -0
- package/dist/parts/playground/paths.d.ts +4 -0
- package/dist/parts/playground/paths.js +7 -0
- package/dist/parts/playground/playground-render.d.ts +126 -0
- package/dist/parts/playground/playground-render.js +356 -0
- package/dist/parts/playground/share.d.ts +2 -0
- package/dist/parts/playground/share.js +92 -0
- package/dist/parts/playground/zip.d.ts +6 -0
- package/dist/parts/playground/zip.js +76 -0
- package/dist/parts/workspace/browser-support-notice.d.ts +76 -0
- package/dist/parts/workspace/browser-support-notice.js +105 -0
- package/dist/parts/workspace/codemirror.d.ts +16 -0
- package/dist/parts/workspace/codemirror.js +243 -0
- package/dist/parts/workspace/connect-panel.d.ts +129 -0
- package/dist/parts/workspace/connect-panel.js +285 -0
- package/dist/parts/workspace/connect-store.d.ts +26 -0
- package/dist/parts/workspace/connect-store.js +59 -0
- package/dist/parts/workspace/icons.d.ts +34 -0
- package/dist/parts/workspace/icons.js +46 -0
- package/dist/parts/workspace/playground-container.d.ts +192 -0
- package/dist/parts/workspace/playground-container.js +603 -0
- package/dist/parts/workspace/workspace-boot-status.d.ts +75 -0
- package/dist/parts/workspace/workspace-boot-status.js +207 -0
- package/dist/parts/workspace/workspace-editor.d.ts +43 -0
- package/dist/parts/workspace/workspace-editor.js +54 -0
- package/dist/parts/workspace/workspace-file-tree.d.ts +53 -0
- package/dist/parts/workspace/workspace-file-tree.js +68 -0
- package/dist/parts/workspace/workspace-preview.d.ts +72 -0
- package/dist/parts/workspace/workspace-preview.js +307 -0
- package/dist/parts/workspace/workspace-shell.d.ts +88 -0
- package/dist/parts/workspace/workspace-shell.js +291 -0
- package/dist/parts/workspace/workspace-terminal.d.ts +39 -0
- package/dist/parts/workspace/workspace-terminal.js +130 -0
- package/dist/payload-text-sjkYAwvw.js +32 -0
- package/dist/{pierre-code-view-T7V67hwT.js → pierre-code-view-xgBL6DO7.js} +209 -86
- package/dist/{pierre-dark-DDWDl8g6.js → pierre-dark-CzUmjETS.js} +3 -1
- package/dist/{pierre-light-CWhW4NrH.js → pierre-light-Dn6E0sWv.js} +3 -1
- package/dist/playground.d.ts +4 -0
- package/dist/playground.js +4 -0
- package/dist/relative-time-BVmjOsYG.js +309 -0
- package/dist/rolldown-runtime-C9mWXvCC.js +29 -0
- package/dist/runtime/nuxt-plugin.js +23 -4
- package/dist/sankey-CAYwt82B-D4uDQoMR.js +2887 -0
- package/dist/share-DM4eNy4q.d.ts +37 -0
- package/dist/{slot-part-C7Ocxn3b.js → slot-part-Doic71uh.js} +7 -1
- package/dist/styles.css +2465 -594
- package/dist/temml-BilSAAws.js +12362 -0
- package/dist/theme-focus-ring.css +42 -0
- package/dist/theme.css +376 -0
- package/dist/theme.d.ts +355 -0
- package/dist/theme.js +265 -0
- package/dist/{types-CqDwuJAm.d.ts → types-Dyr6CfBW.d.ts} +1 -1
- package/dist/vue-BDmSCtay.js +30779 -0
- package/dist/vue-DGstVdGn.js +2492 -0
- package/dist/workspace.d.ts +15 -0
- package/dist/workspace.js +12 -0
- package/package.json +136 -150
- package/dist/andromeeda-BASpqCeJ.js +0 -4
- package/dist/attachment.d.ts +0 -2
- package/dist/attachment.js +0 -2
- package/dist/aurora-x-DugsLcii.js +0 -4
- package/dist/avatar-stack.js +0 -2
- package/dist/ayu-dark-BT3qdi3o.js +0 -4
- package/dist/ayu-light-BVZyHoh9.js +0 -4
- package/dist/ayu-mirage-XFwUVZQZ.js +0 -4
- package/dist/bubble.d.ts +0 -2
- package/dist/bubble.js +0 -2
- package/dist/catppuccin-frappe-D20KODDN.js +0 -4
- package/dist/catppuccin-latte-eGLVHIUJ.js +0 -4
- package/dist/catppuccin-macchiato-bQGch4PY.js +0 -4
- package/dist/catppuccin-mocha-Bes8-0Mr.js +0 -4
- package/dist/chat-message.d.ts +0 -2
- package/dist/chat-message.js +0 -2
- package/dist/chat-session.d.ts +0 -2
- package/dist/chat-session.js +0 -2
- package/dist/chat.d.ts +0 -2
- package/dist/chat.js +0 -2
- package/dist/code-block.d.ts +0 -2
- package/dist/code-block.js +0 -3
- package/dist/code-view.d.ts +0 -2
- package/dist/code-view.js +0 -2
- package/dist/comment-layer-CBlxJ8eK.js +0 -1113
- package/dist/comments-Cq5eewsu.d.ts +0 -537
- package/dist/comments.d.ts +0 -2
- package/dist/comments.js +0 -2
- package/dist/config-Bux_AJzm.d.ts +0 -29
- package/dist/config-bHqE4JOs.js +0 -38
- package/dist/connection-status.d.ts +0 -2
- package/dist/connection-status.js +0 -2
- package/dist/dark-plus-BGuiqa1B.js +0 -4
- package/dist/dracula-0CVA2XY5.js +0 -4
- package/dist/dracula-soft-Dk9bpbVU.js +0 -4
- package/dist/error-diagnostics-B4hMpJRL.js +0 -13
- package/dist/everforest-dark-CRjTbhh5.js +0 -4
- package/dist/everforest-light-CEeYFLn8.js +0 -4
- package/dist/file-diff.d.ts +0 -2
- package/dist/file-diff.js +0 -2
- package/dist/file-tree.d.ts +0 -2
- package/dist/file-tree.js +0 -2
- package/dist/file-view.d.ts +0 -2
- package/dist/file-view.js +0 -2
- package/dist/github-dark-BXgKmOw_.js +0 -4
- package/dist/github-dark-default-DzJQXksd.js +0 -4
- package/dist/github-dark-dimmed-B1pEmGtS.js +0 -4
- package/dist/github-dark-high-contrast-BkHIa6jc.js +0 -4
- package/dist/github-light-BKRlUbaB.js +0 -4
- package/dist/github-light-default-BU3eYkzs.js +0 -4
- package/dist/github-light-high-contrast-B3MumDcI.js +0 -4
- package/dist/gruvbox-dark-hard-B0ecF443.js +0 -4
- package/dist/gruvbox-dark-medium-BQnpC39k.js +0 -4
- package/dist/gruvbox-dark-soft-DFZUgESr.js +0 -4
- package/dist/gruvbox-light-hard-CuB_LOJr.js +0 -4
- package/dist/gruvbox-light-medium-idDHgxjs.js +0 -4
- package/dist/gruvbox-light-soft-CfWH49MY.js +0 -4
- package/dist/horizon-bright-Ba6M8QSV.js +0 -4
- package/dist/horizon-h92C5OlZ.js +0 -4
- package/dist/houston-EQnPegWq.js +0 -4
- package/dist/kanagawa-dragon-DgDvwi3B.js +0 -4
- package/dist/kanagawa-lotus-BgoQro20.js +0 -4
- package/dist/kanagawa-wave-DgXEowHs.js +0 -4
- package/dist/laserwave-IxBH_3yW.js +0 -4
- package/dist/light-plus-S8JBx6is.js +0 -4
- package/dist/markdown-BoLBN0qH.js +0 -197
- package/dist/markdown.d.ts +0 -2
- package/dist/markdown.js +0 -2
- package/dist/marker.d.ts +0 -2
- package/dist/marker.js +0 -2
- package/dist/material-theme-D1f3HBq-.js +0 -4
- package/dist/material-theme-darker-ExzYhT0j.js +0 -4
- package/dist/material-theme-lighter-D6gH9nnA.js +0 -4
- package/dist/material-theme-ocean-D1w5BPAa.js +0 -4
- package/dist/material-theme-palenight-CkqWmVpF.js +0 -4
- package/dist/message-parts.d.ts +0 -2
- package/dist/message-parts.js +0 -2
- package/dist/message.d.ts +0 -2
- package/dist/message.js +0 -2
- package/dist/min-dark-npsJH98j.js +0 -4
- package/dist/min-light-DUk1XsVt.js +0 -4
- package/dist/monokai-CfFRWUNl.js +0 -4
- package/dist/multi-file-diff.d.ts +0 -2
- package/dist/multi-file-diff.js +0 -2
- package/dist/night-owl-BS7V-av_.js +0 -4
- package/dist/night-owl-light-CZtRawYE.js +0 -4
- package/dist/nord-BFh54Nqz.js +0 -4
- package/dist/one-dark-pro-zDovGosB.js +0 -4
- package/dist/one-light-gmHK3iK6.js +0 -4
- package/dist/patch-diff.d.ts +0 -2
- package/dist/patch-diff.js +0 -2
- package/dist/plastic-DtdaCjub.js +0 -4
- package/dist/poimandres-Hdda6aHK.js +0 -4
- package/dist/primitive-rail.d.ts +0 -222
- package/dist/primitive-rail.js +0 -348
- package/dist/prompt-input.d.ts +0 -2
- package/dist/prompt-input.js +0 -2
- package/dist/red-VqZFRByZ.js +0 -4
- package/dist/rose-pine-DiTkEueR.js +0 -4
- package/dist/rose-pine-dawn-tfo5y2X0.js +0 -4
- package/dist/rose-pine-moon-C0gON9XN.js +0 -4
- package/dist/runtime-type-DlCscMfw.js +0 -59
- package/dist/slack-dark-v8P_eXr6.js +0 -4
- package/dist/slack-ochin-D8SyEdKz.js +0 -4
- package/dist/snazzy-light-BtkQkvXb.js +0 -4
- package/dist/solarized-dark-B8nAdMfM.js +0 -4
- package/dist/solarized-light-B-3F1INj.js +0 -4
- package/dist/sync-status.d.ts +0 -2
- package/dist/sync-status.js +0 -2
- package/dist/synthwave-84-DcsXCF_c.js +0 -4
- package/dist/tokyo-night-Bvpqduda.js +0 -4
- package/dist/tool-list.d.ts +0 -2
- package/dist/tool-list.js +0 -2
- package/dist/trace-run.d.ts +0 -2
- package/dist/trace-run.js +0 -2
- package/dist/trace.d.ts +0 -2
- package/dist/trace.js +0 -2
- package/dist/unresolved-file.d.ts +0 -2
- package/dist/unresolved-file.js +0 -2
- package/dist/vesper-CfxmMOy3.js +0 -4
- package/dist/vitesse-black-D9-_1mjV.js +0 -4
- package/dist/vitesse-dark-DlSMLlr9.js +0 -4
- package/dist/vitesse-light-KRWWWztf.js +0 -4
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
import { r as useUIComponent } from "../../nuxt-ui-DSQFzq3s.js";
|
|
2
|
+
import { n as kitSlot } from "../../slot-part-Doic71uh.js";
|
|
3
|
+
import { Markdown } from "./markdown.js";
|
|
4
|
+
import { Tabs, TabsList, TabsPanel, TabsTab } from "@ui-sdk/vue/tabs";
|
|
5
|
+
import { computed, defineComponent, h, onBeforeUnmount, onMounted, ref, useId, watch } from "vue";
|
|
6
|
+
//#region 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 workRow(entry, open, onToggle) {
|
|
505
|
+
const expandable = Boolean(entry.detail);
|
|
506
|
+
const line = [
|
|
507
|
+
h("span", {
|
|
508
|
+
class: "vh-agent-session__work-icon",
|
|
509
|
+
"data-status": entry.status
|
|
510
|
+
}, [icon(entry.status === "error" ? "i-lucide-circle-x" : workIcons[entry.kind])]),
|
|
511
|
+
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]),
|
|
512
|
+
entry.trailing ? h("span", { class: "vh-agent-session__work-trailing" }, entry.trailing) : null
|
|
513
|
+
];
|
|
514
|
+
return h("div", {
|
|
515
|
+
key: entry.id,
|
|
516
|
+
class: "vh-agent-session__work-row",
|
|
517
|
+
"data-slot": "agent-session-work-row",
|
|
518
|
+
"data-kind": entry.kind,
|
|
519
|
+
"data-open": open ? "" : void 0
|
|
520
|
+
}, [expandable ? h("button", {
|
|
521
|
+
type: "button",
|
|
522
|
+
class: "vh-agent-session__work-line",
|
|
523
|
+
"aria-expanded": open ? "true" : "false",
|
|
524
|
+
onClick: onToggle
|
|
525
|
+
}, line) : h("div", { class: "vh-agent-session__work-line" }, line), expandable && open ? h("pre", { class: "vh-agent-session__work-detail" }, entry.detail) : null]);
|
|
526
|
+
}
|
|
527
|
+
/** A group of tool calls, folded behind one line such as "Worked for 3m 12s". */
|
|
528
|
+
const AgentSessionWorkGroup = defineComponent({
|
|
529
|
+
name: "AgentSessionWorkGroup",
|
|
530
|
+
props: {
|
|
531
|
+
label: { type: String },
|
|
532
|
+
entries: {
|
|
533
|
+
required: true,
|
|
534
|
+
type: Array
|
|
535
|
+
},
|
|
536
|
+
defaultOpen: {
|
|
537
|
+
default: false,
|
|
538
|
+
type: Boolean
|
|
539
|
+
}
|
|
540
|
+
},
|
|
541
|
+
setup(props) {
|
|
542
|
+
const open = ref(props.defaultOpen);
|
|
543
|
+
const openRows = ref(/* @__PURE__ */ new Set());
|
|
544
|
+
const toggleRow = (id) => {
|
|
545
|
+
const next = new Set(openRows.value);
|
|
546
|
+
if (next.has(id)) next.delete(id);
|
|
547
|
+
else next.add(id);
|
|
548
|
+
openRows.value = next;
|
|
549
|
+
};
|
|
550
|
+
return () => {
|
|
551
|
+
const failed = props.entries.filter((entry) => entry.status === "error").length;
|
|
552
|
+
const summary = props.label ?? `${props.entries.length} ${props.entries.length === 1 ? "step" : "steps"}`;
|
|
553
|
+
return h("div", {
|
|
554
|
+
class: "vh-agent-session__work",
|
|
555
|
+
"data-slot": "agent-session-work",
|
|
556
|
+
"data-open": open.value ? "" : void 0
|
|
557
|
+
}, [h("button", {
|
|
558
|
+
type: "button",
|
|
559
|
+
class: "vh-agent-session__work-summary",
|
|
560
|
+
"aria-expanded": open.value ? "true" : "false",
|
|
561
|
+
onClick: () => open.value = !open.value
|
|
562
|
+
}, [
|
|
563
|
+
h("span", summary),
|
|
564
|
+
props.label ? h("span", { class: "vh-agent-session__work-count" }, `${props.entries.length} ${props.entries.length === 1 ? "step" : "steps"}`) : null,
|
|
565
|
+
failed ? h("span", { class: "vh-agent-session__work-failed" }, `${failed} failed`) : null,
|
|
566
|
+
icon("i-lucide-chevron-down", { class: "vh-agent-session__work-chevron" })
|
|
567
|
+
]), open.value ? h("div", { class: "vh-agent-session__work-list" }, props.entries.map((entry) => workRow(entry, openRows.value.has(entry.id), () => toggleRow(entry.id)))) : null]);
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
});
|
|
571
|
+
const FOLD_LINES = 14;
|
|
572
|
+
const FOLD_CHARACTERS = 900;
|
|
573
|
+
const UserMessage = defineComponent({
|
|
574
|
+
name: "AgentSessionUserMessage",
|
|
575
|
+
props: { text: {
|
|
576
|
+
required: true,
|
|
577
|
+
type: String
|
|
578
|
+
} },
|
|
579
|
+
setup(props) {
|
|
580
|
+
const expanded = ref(false);
|
|
581
|
+
return () => {
|
|
582
|
+
const long = props.text.length > FOLD_CHARACTERS || props.text.split("\n").length > FOLD_LINES;
|
|
583
|
+
const folded = long && !expanded.value;
|
|
584
|
+
return h("div", {
|
|
585
|
+
class: "vh-agent-session__user",
|
|
586
|
+
"data-slot": "agent-session-user"
|
|
587
|
+
}, [h("h3", { class: "vh-agent-session__sr" }, "You"), h("div", {
|
|
588
|
+
class: "vh-agent-session__bubble",
|
|
589
|
+
"data-folded": folded ? "" : void 0
|
|
590
|
+
}, [h("div", { class: "vh-agent-session__bubble-text" }, props.text), long ? h("button", {
|
|
591
|
+
type: "button",
|
|
592
|
+
class: "vh-agent-session__bubble-more",
|
|
593
|
+
"aria-expanded": expanded.value ? "true" : "false",
|
|
594
|
+
onClick: () => expanded.value = !expanded.value
|
|
595
|
+
}, expanded.value ? "Show less" : "Show more") : null])]);
|
|
596
|
+
};
|
|
597
|
+
}
|
|
598
|
+
});
|
|
599
|
+
/** The session's turns: user bubbles on the right, the agent's answers as Markdown, and folded tool calls between them. */
|
|
600
|
+
const AgentSessionTimeline = defineComponent({
|
|
601
|
+
name: "AgentSessionTimeline",
|
|
602
|
+
props: { items: {
|
|
603
|
+
required: true,
|
|
604
|
+
type: Array
|
|
605
|
+
} },
|
|
606
|
+
setup(props, { slots }) {
|
|
607
|
+
return () => h("div", {
|
|
608
|
+
class: "vh-agent-session__timeline",
|
|
609
|
+
"data-slot": "agent-session-timeline"
|
|
610
|
+
}, props.items.map((item) => {
|
|
611
|
+
const custom = slots[`item-${item.type}`]?.({ item });
|
|
612
|
+
if (custom) return h("div", {
|
|
613
|
+
key: item.id,
|
|
614
|
+
class: "vh-agent-session__item"
|
|
615
|
+
}, custom);
|
|
616
|
+
if (item.type === "user") return h(UserMessage, {
|
|
617
|
+
key: item.id,
|
|
618
|
+
text: item.text
|
|
619
|
+
});
|
|
620
|
+
if (item.type === "assistant") return h("div", {
|
|
621
|
+
key: item.id,
|
|
622
|
+
class: "vh-agent-session__assistant",
|
|
623
|
+
"data-slot": "agent-session-assistant"
|
|
624
|
+
}, [h(Markdown, { value: item.text })]);
|
|
625
|
+
if (item.type === "divider") return h("div", {
|
|
626
|
+
key: item.id,
|
|
627
|
+
class: "vh-agent-session__divider",
|
|
628
|
+
role: "separator"
|
|
629
|
+
}, item.label);
|
|
630
|
+
return h(AgentSessionWorkGroup, {
|
|
631
|
+
key: item.id,
|
|
632
|
+
label: item.label,
|
|
633
|
+
entries: item.entries,
|
|
634
|
+
defaultOpen: item.defaultOpen
|
|
635
|
+
});
|
|
636
|
+
}));
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
//#endregion
|
|
640
|
+
export { AgentSession, AgentSessionDetailsRow, AgentSessionDetailsSection, AgentSessionTimeline, AgentSessionWorkGroup };
|