@av-pi-studio/workbench 0.0.0-stage → 0.0.118
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 +157 -2
- package/dist/chunks/BinaryFallbackViewer-BN-9Yvel.js +19 -0
- package/dist/chunks/ChatPanel-CjPUJMEs.js +2493 -0
- package/dist/chunks/CodeView-6kJms_MF.js +143 -0
- package/dist/chunks/DiffView-BqDuT3CF.js +48 -0
- package/dist/chunks/FilePanel-B8IXG2bj.js +92 -0
- package/dist/chunks/HtmlViewer-DpuVFaDo.js +490 -0
- package/dist/chunks/ImageViewer-BBfyA5QN.js +27 -0
- package/dist/chunks/MarkdownFileViewer-DPFPDS7G.js +88 -0
- package/dist/chunks/ModelProvidersPanel-Dsezq7Ss.js +95 -0
- package/dist/chunks/MoleculeViewerPanel-DEEU6Zkx.js +191 -0
- package/dist/chunks/PdfViewer-BdacmAu_.js +300 -0
- package/dist/chunks/SaveFileButton-2rOu02Xx.js +33 -0
- package/dist/chunks/SettingsDialog-DO1tDhMW.js +471 -0
- package/dist/chunks/SkillsPanel-DZDia4Pw.js +833 -0
- package/dist/chunks/TerminalPanel-bphwCSyW.js +242 -0
- package/dist/chunks/TextViewer-CVGqN6yy.js +63 -0
- package/dist/chunks/VideoViewer-BkB9BoOr.js +20 -0
- package/dist/chunks/ViewersPanel-C2E9FLf7.js +50 -0
- package/dist/chunks/href-resolution-jv3tpRcp.js +25 -0
- package/dist/chunks/index-Dlz8mEKZ.js +6258 -0
- package/dist/chunks/markdown-B2OXhZ-_.js +353 -0
- package/dist/chunks/provider-auth-store-C1GaLTlw.js +34 -0
- package/dist/chunks/use-file-download-CogCqTvU.js +31 -0
- package/dist/chunks/use-file-watch-Bb_Xzbr-.js +55 -0
- package/dist/chunks/use-provider-auth-list-DTjIZycd.js +16 -0
- package/dist/features/agent-ui/AskCard.d.ts +62 -0
- package/dist/features/agent-ui/agent-ui-store.d.ts +84 -0
- package/dist/features/agent-ui/announce.d.ts +51 -0
- package/dist/features/agent-ui/ask-list.d.ts +53 -0
- package/dist/features/agent-ui/ask-placement.d.ts +47 -0
- package/dist/features/agent-ui/deadline.d.ts +27 -0
- package/dist/features/agent-ui/keyboard.d.ts +37 -0
- package/dist/features/agent-ui/notify-effect.d.ts +41 -0
- package/dist/features/agent-ui/option-layout.d.ts +24 -0
- package/dist/features/agent-ui/outcome-line.d.ts +38 -0
- package/dist/features/agent-ui/prompt-text.d.ts +24 -0
- package/dist/features/chat/Attachments.d.ts +20 -0
- package/dist/features/chat/ChatPanel.d.ts +12 -0
- package/dist/features/chat/CommandMenu.d.ts +41 -0
- package/dist/features/chat/Composer.d.ts +58 -0
- package/dist/features/chat/ForkDialog.d.ts +24 -0
- package/dist/features/chat/ModelMenu.d.ts +54 -0
- package/dist/features/chat/ThinkingMenu.d.ts +39 -0
- package/dist/features/chat/Timeline.d.ts +30 -0
- package/dist/features/chat/TurnProgressBar.d.ts +14 -0
- package/dist/features/chat/composer-busy.d.ts +22 -0
- package/dist/features/chat/composer-gate.d.ts +37 -0
- package/dist/features/chat/composer-path-drop.d.ts +75 -0
- package/dist/features/chat/fork-correlation.d.ts +39 -0
- package/dist/features/chat/fork-gate.d.ts +27 -0
- package/dist/features/chat/fork-picker-nav.d.ts +14 -0
- package/dist/features/chat/fork-result.d.ts +43 -0
- package/dist/features/chat/model-menu-sort.d.ts +30 -0
- package/dist/features/chat/onboarding-nudge.d.ts +18 -0
- package/dist/features/chat/rows/AssistantRow.d.ts +24 -0
- package/dist/features/chat/rows/CompactionRow.d.ts +16 -0
- package/dist/features/chat/rows/ErrorRow.d.ts +13 -0
- package/dist/features/chat/rows/ReasoningRow.d.ts +16 -0
- package/dist/features/chat/rows/RowShell.d.ts +37 -0
- package/dist/features/chat/rows/SystemRow.d.ts +11 -0
- package/dist/features/chat/rows/ToolCard.d.ts +30 -0
- package/dist/features/chat/rows/UserRow.d.ts +43 -0
- package/dist/features/chat/slash-commands.d.ts +81 -0
- package/dist/features/chat/thinking-level-source.d.ts +29 -0
- package/dist/features/chat/todos/TodoPanel.d.ts +11 -0
- package/dist/features/chat/todos/agent-todos-store.d.ts +35 -0
- package/dist/features/chat/todos/todo-collapse-codec.d.ts +12 -0
- package/dist/features/chat/todos/todo-panel-model.d.ts +37 -0
- package/dist/features/chat/use-bottom-anchor.d.ts +33 -0
- package/dist/features/chat/use-fork-action.d.ts +32 -0
- package/dist/features/connection/ConnectionBar.d.ts +18 -0
- package/dist/features/connection/connection-presentation.d.ts +70 -0
- package/dist/features/files/BinaryFallbackViewer.d.ts +9 -0
- package/dist/features/files/CodeView.d.ts +15 -0
- package/dist/features/files/DiffView.d.ts +18 -0
- package/dist/features/files/FileContextMenu.d.ts +13 -0
- package/dist/features/files/FileExplorer.d.ts +24 -0
- package/dist/features/files/FilePanel.d.ts +26 -0
- package/dist/features/files/HtmlViewer.d.ts +22 -0
- package/dist/features/files/ImageViewer.d.ts +8 -0
- package/dist/features/files/MarkdownFileViewer.d.ts +14 -0
- package/dist/features/files/MoleculeViewer.d.ts +60 -0
- package/dist/features/files/MoleculeViewerPanel.d.ts +9 -0
- package/dist/features/files/PdfViewer.d.ts +14 -0
- package/dist/features/files/RightSidebar.d.ts +9 -0
- package/dist/features/files/SaveFileButton.d.ts +9 -0
- package/dist/features/files/TextViewer.d.ts +23 -0
- package/dist/features/files/TreeDraftRow.d.ts +15 -0
- package/dist/features/files/TreeNode.d.ts +42 -0
- package/dist/features/files/TreeRenameRow.d.ts +19 -0
- package/dist/features/files/VideoViewer.d.ts +8 -0
- package/dist/features/files/create-entry.d.ts +23 -0
- package/dist/features/files/delete-entry.d.ts +17 -0
- package/dist/features/files/file-tree.d.ts +92 -0
- package/dist/features/files/git-status-index.d.ts +37 -0
- package/dist/features/files/html-asset-loader.d.ts +43 -0
- package/dist/features/files/html-assets.d.ts +97 -0
- package/dist/features/files/html-sandbox.d.ts +62 -0
- package/dist/features/files/molecule-reload.d.ts +20 -0
- package/dist/features/files/molecule-source.d.ts +10 -0
- package/dist/features/files/molecule-theme.d.ts +31 -0
- package/dist/features/files/move-entry.d.ts +10 -0
- package/dist/features/files/move-status.d.ts +10 -0
- package/dist/features/files/move-target.d.ts +31 -0
- package/dist/features/files/open-file-tab.d.ts +32 -0
- package/dist/features/files/pdf-layout.d.ts +28 -0
- package/dist/features/files/pdfjs-runtime.d.ts +30 -0
- package/dist/features/files/polymer-file.d.ts +33 -0
- package/dist/features/files/text-viewer-state.d.ts +53 -0
- package/dist/features/files/upload-sources.d.ts +20 -0
- package/dist/features/files/viewer-registry.d.ts +81 -0
- package/dist/features/files/write-file.d.ts +12 -0
- package/dist/features/git/ChangesPanel.d.ts +13 -0
- package/dist/features/provider-auth/LoginDialog.d.ts +21 -0
- package/dist/features/provider-auth/ModelProvidersPanel.d.ts +12 -0
- package/dist/features/provider-auth/QrCode.d.ts +26 -0
- package/dist/features/provider-auth/login-flow.d.ts +55 -0
- package/dist/features/provider-auth/provider-auth-presentation.d.ts +31 -0
- package/dist/features/provider-auth/provider-auth-store.d.ts +42 -0
- package/dist/features/sessions/SessionContextMenu.d.ts +11 -0
- package/dist/features/sessions/SessionItem.d.ts +22 -0
- package/dist/features/sessions/SessionList.d.ts +9 -0
- package/dist/features/sessions/WorkspaceContextMenu.d.ts +9 -0
- package/dist/features/sessions/WorkspaceGroupHeader.d.ts +26 -0
- package/dist/features/sessions/apply-agent-deep-link.d.ts +7 -0
- package/dist/features/sessions/open-chat-tab.d.ts +14 -0
- package/dist/features/sessions/open-workspace.d.ts +20 -0
- package/dist/features/sessions/session-actions.d.ts +18 -0
- package/dist/features/sessions/session-presentation.d.ts +47 -0
- package/dist/features/sessions/status-map.d.ts +10 -0
- package/dist/features/sessions/workspace-grouping.d.ts +30 -0
- package/dist/features/settings/SettingsDialog.d.ts +22 -0
- package/dist/features/settings/ViewersPanel.d.ts +18 -0
- package/dist/features/settings/settings-categories.d.ts +32 -0
- package/dist/features/skills/InstallSkillDialog.d.ts +21 -0
- package/dist/features/skills/SkillsPanel.d.ts +32 -0
- package/dist/features/skills/skills-presentation.d.ts +159 -0
- package/dist/features/skills/use-skills.d.ts +215 -0
- package/dist/features/terminal/TerminalPanel.d.ts +37 -0
- package/dist/features/terminal/terminal-font.d.ts +44 -0
- package/dist/features/terminal/terminal-size.d.ts +52 -0
- package/dist/features/workspace/ContextMeter.d.ts +15 -0
- package/dist/features/workspace/ContextMeterPopover.d.ts +16 -0
- package/dist/features/workspace/DropPreview.d.ts +23 -0
- package/dist/features/workspace/PaneDividers.d.ts +30 -0
- package/dist/features/workspace/StatusBar.d.ts +16 -0
- package/dist/features/workspace/TabContextMenu.d.ts +15 -0
- package/dist/features/workspace/TabPanelHost.d.ts +30 -0
- package/dist/features/workspace/TabStrip.d.ts +36 -0
- package/dist/features/workspace/compact-action.d.ts +21 -0
- package/dist/features/workspace/context-meter.d.ts +26 -0
- package/dist/features/workspace/external-drag.d.ts +99 -0
- package/dist/features/workspace/pane-dnd.d.ts +70 -0
- package/dist/features/workspace/pane-layout-view.d.ts +73 -0
- package/dist/features/workspace/pane-tree.d.ts +141 -0
- package/dist/features/workspace/panel-registry.d.ts +13 -0
- package/dist/features/workspace/reopen-client-tabs.d.ts +44 -0
- package/dist/features/workspace/restore-active-workspace.d.ts +30 -0
- package/dist/features/workspace/status-bar-format.d.ts +20 -0
- package/dist/features/workspace/tab-attention.d.ts +35 -0
- package/dist/features/workspace-picker/OpenWorkspaceDialog.d.ts +11 -0
- package/dist/fonts/CascadiaMono.woff2 +0 -0
- package/dist/fonts/CascadiaMonoNF.woff2 +0 -0
- package/dist/fonts/LICENSE-Cascadia.txt +97 -0
- package/dist/fonts.css +60 -0
- package/dist/hooks/agent-stream-events.d.ts +20 -0
- package/dist/hooks/file-text-state.d.ts +31 -0
- package/dist/hooks/file-transfer-instance.d.ts +10 -0
- package/dist/hooks/use-agent-commands.d.ts +18 -0
- package/dist/hooks/use-agent-deep-link-boot.d.ts +9 -0
- package/dist/hooks/use-agent-stream.d.ts +15 -0
- package/dist/hooks/use-agent-todos.d.ts +10 -0
- package/dist/hooks/use-checkout-status.d.ts +13 -0
- package/dist/hooks/use-connection.d.ts +27 -0
- package/dist/hooks/use-explorer-tree.d.ts +20 -0
- package/dist/hooks/use-explorer-watch.d.ts +39 -0
- package/dist/hooks/use-explorer.d.ts +21 -0
- package/dist/hooks/use-external-pane-drop.d.ts +47 -0
- package/dist/hooks/use-file-diff.d.ts +9 -0
- package/dist/hooks/use-file-download.d.ts +18 -0
- package/dist/hooks/use-file-live-refresh.d.ts +31 -0
- package/dist/hooks/use-file-read.d.ts +31 -0
- package/dist/hooks/use-file-source.d.ts +16 -0
- package/dist/hooks/use-file-text.d.ts +21 -0
- package/dist/hooks/use-file-transfer.d.ts +18 -0
- package/dist/hooks/use-file-watch.d.ts +36 -0
- package/dist/hooks/use-home-dir.d.ts +14 -0
- package/dist/hooks/use-inline-image.d.ts +37 -0
- package/dist/hooks/use-is-compacting.d.ts +9 -0
- package/dist/hooks/use-pane-drag.d.ts +40 -0
- package/dist/hooks/use-pane-layout.d.ts +40 -0
- package/dist/hooks/use-provider-auth-list.d.ts +19 -0
- package/dist/hooks/use-provider-models.d.ts +14 -0
- package/dist/hooks/use-session-restore.d.ts +44 -0
- package/dist/hooks/use-session-stats.d.ts +40 -0
- package/dist/hooks/use-shortcuts.d.ts +6 -0
- package/dist/hooks/use-terminal-exit-watch.d.ts +47 -0
- package/dist/hooks/use-terminal-restore.d.ts +38 -0
- package/dist/hooks/use-thinking-levels.d.ts +13 -0
- package/dist/hooks/use-timeline-reset-watch.d.ts +43 -0
- package/dist/hooks/use-viewer-settings.d.ts +17 -0
- package/dist/host/browser-clipboard.d.ts +9 -0
- package/dist/host/browser-connection.d.ts +13 -0
- package/dist/host/browser-files.d.ts +9 -0
- package/dist/host/browser-host.d.ts +14 -0
- package/dist/host/browser-launch.d.ts +19 -0
- package/dist/host/browser-worker-timers.d.ts +29 -0
- package/dist/host/external-link.d.ts +14 -0
- package/dist/host/index.d.ts +4 -0
- package/dist/host/install.d.ts +21 -0
- package/dist/host/types.d.ts +168 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +18 -0
- package/dist/lib/agent-deep-link.d.ts +29 -0
- package/dist/lib/connection/connection-store.d.ts +49 -0
- package/dist/lib/connection/files-changed.d.ts +41 -0
- package/dist/lib/connection/live-file-transfer.d.ts +8 -0
- package/dist/lib/connection/normalize-url.d.ts +16 -0
- package/dist/lib/connection/query-client.d.ts +3 -0
- package/dist/lib/connection/resolve-connect-target.d.ts +10 -0
- package/dist/lib/connection/resume-action.d.ts +33 -0
- package/dist/lib/connection/resume-handler.d.ts +6 -0
- package/dist/lib/connection/rpc-keys.d.ts +39 -0
- package/dist/lib/drag-guard.d.ts +39 -0
- package/dist/lib/inline-image-cache.d.ts +34 -0
- package/dist/lib/pane-layout-persistence.d.ts +74 -0
- package/dist/lib/paths.d.ts +33 -0
- package/dist/lib/protocol/events.d.ts +19 -0
- package/dist/lib/protocol/timeline-paging.d.ts +29 -0
- package/dist/lib/random-id.d.ts +16 -0
- package/dist/shell/Workbench.d.ts +6 -0
- package/dist/shell/WorkbenchBoot.d.ts +4 -0
- package/dist/shell/WorkbenchProvider.d.ts +10 -0
- package/dist/shell/WorkspaceShell.d.ts +12 -0
- package/dist/shell/context.d.ts +8 -0
- package/dist/shell/hooks.d.ts +32 -0
- package/dist/shell/regions.d.ts +17 -0
- package/dist/stores/compaction-store.d.ts +45 -0
- package/dist/stores/deep-link-store.d.ts +15 -0
- package/dist/stores/draft-store.d.ts +45 -0
- package/dist/stores/explorer-store.d.ts +63 -0
- package/dist/stores/fork-store.d.ts +69 -0
- package/dist/stores/git-store.d.ts +59 -0
- package/dist/stores/layout-store.d.ts +137 -0
- package/dist/stores/materialize.d.ts +47 -0
- package/dist/stores/session-store.d.ts +76 -0
- package/dist/stores/stats-store.d.ts +48 -0
- package/dist/stores/tab-store.d.ts +145 -0
- package/dist/stores/ui-store.d.ts +85 -0
- package/dist/styles.css +1 -0
- package/dist/timeline/FileLink.d.ts +22 -0
- package/dist/timeline/InlineImage.d.ts +16 -0
- package/dist/timeline/bottom-anchor.d.ts +77 -0
- package/dist/timeline/compaction.d.ts +12 -0
- package/dist/timeline/file-link-src.d.ts +34 -0
- package/dist/timeline/file-open-target.d.ts +19 -0
- package/dist/timeline/format-meta-time.d.ts +10 -0
- package/dist/timeline/highlight.d.ts +9 -0
- package/dist/timeline/href-resolution.d.ts +34 -0
- package/dist/timeline/image-src.d.ts +32 -0
- package/dist/timeline/inline-image-view.d.ts +34 -0
- package/dist/timeline/live-tail.d.ts +5 -0
- package/dist/timeline/markdown.d.ts +35 -0
- package/dist/timeline/mermaid-theme.d.ts +23 -0
- package/dist/timeline/reducer.d.ts +38 -0
- package/dist/timeline/row-model.d.ts +154 -0
- package/dist/timeline/streaming-split.d.ts +42 -0
- package/dist/timeline/tool-mapping.d.ts +60 -0
- package/dist/viewer-plugins/viewer-settings-store.d.ts +55 -0
- package/dist/vite/index.d.ts +36 -0
- package/dist/vite/index.js +39 -0
- package/package.json +81 -4
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { jsx as a, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { useState as k, useEffect as I, memo as E, useMemo as _ } from "react";
|
|
3
|
+
import P from "react-markdown";
|
|
4
|
+
import V from "rehype-katex";
|
|
5
|
+
import $ from "remark-gfm";
|
|
6
|
+
import j from "remark-math";
|
|
7
|
+
import "katex/dist/katex.min.css";
|
|
8
|
+
import { W as D, u as y, X as A, Y as B, g as U, i as v, Z as M, f as x, D as O } from "./index-Dlz8mEKZ.js";
|
|
9
|
+
import { createHighlighter as z } from "shiki";
|
|
10
|
+
import { r as S } from "./href-resolution-jv3tpRcp.js";
|
|
11
|
+
import { Spinner as G } from "@av-pi-studio/ui-library";
|
|
12
|
+
const T = "github-dark";
|
|
13
|
+
let h = null;
|
|
14
|
+
const C = /* @__PURE__ */ new Set(["plaintext"]);
|
|
15
|
+
function K() {
|
|
16
|
+
return h || (h = z({ themes: [T], langs: ["plaintext"] })), h;
|
|
17
|
+
}
|
|
18
|
+
async function Q(r, e) {
|
|
19
|
+
if (C.has(e)) return e;
|
|
20
|
+
try {
|
|
21
|
+
return await r.loadLanguage(e), C.add(e), e;
|
|
22
|
+
} catch {
|
|
23
|
+
return "plaintext";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function Y(r, e) {
|
|
27
|
+
const n = await K(), t = await Q(n, e);
|
|
28
|
+
return n.codeToHtml(r, { lang: t, theme: T });
|
|
29
|
+
}
|
|
30
|
+
const N = {
|
|
31
|
+
background: "--pi-color-surface1",
|
|
32
|
+
primaryColor: "--pi-color-surface2",
|
|
33
|
+
primaryTextColor: "--pi-color-foreground",
|
|
34
|
+
primaryBorderColor: "--pi-color-surface3",
|
|
35
|
+
lineColor: "--pi-color-foregroundMuted",
|
|
36
|
+
secondaryColor: "--pi-color-surface3",
|
|
37
|
+
secondaryTextColor: "--pi-color-foreground",
|
|
38
|
+
secondaryBorderColor: "--pi-color-surface4",
|
|
39
|
+
tertiaryColor: "--pi-color-surface1",
|
|
40
|
+
tertiaryTextColor: "--pi-color-foreground",
|
|
41
|
+
tertiaryBorderColor: "--pi-color-surface3",
|
|
42
|
+
textColor: "--pi-color-foreground"
|
|
43
|
+
};
|
|
44
|
+
function Z(r) {
|
|
45
|
+
const e = {};
|
|
46
|
+
for (const [n, t] of Object.entries(N)) {
|
|
47
|
+
const i = r[t]?.trim();
|
|
48
|
+
i && (e[n] = i);
|
|
49
|
+
}
|
|
50
|
+
return e;
|
|
51
|
+
}
|
|
52
|
+
function q() {
|
|
53
|
+
const r = getComputedStyle(document.documentElement), e = {};
|
|
54
|
+
for (const n of Object.values(N))
|
|
55
|
+
e[n] = r.getPropertyValue(n);
|
|
56
|
+
return Z(e);
|
|
57
|
+
}
|
|
58
|
+
const W = "piwb-markdown_prose_4ADyQ", X = "piwb-markdown_streaming_k9s8Q", J = "piwb-markdown_inlineCode_RghPb", ee = "piwb-markdown_mermaid_B9Blp", re = "piwb-markdown_mermaidError_44zNo", ne = "piwb-markdown_mermaidErrorMessage__6nf4", te = "piwb-markdown_inlineImage_fN8VC", ie = "piwb-markdown_inlineImageSkeleton_o9LuV", oe = "piwb-markdown_inlineImageFallback_RQqnv", m = {
|
|
59
|
+
prose: W,
|
|
60
|
+
streaming: X,
|
|
61
|
+
inlineCode: J,
|
|
62
|
+
mermaid: ee,
|
|
63
|
+
mermaidError: re,
|
|
64
|
+
mermaidErrorMessage: ne,
|
|
65
|
+
inlineImage: te,
|
|
66
|
+
inlineImageSkeleton: ie,
|
|
67
|
+
inlineImageFallback: oe
|
|
68
|
+
}, ae = {
|
|
69
|
+
"http:": !0,
|
|
70
|
+
"https:": !0,
|
|
71
|
+
"data:": !0,
|
|
72
|
+
"blob:": !0
|
|
73
|
+
}, le = /^([a-zA-Z][a-zA-Z0-9+.-]*):/;
|
|
74
|
+
function se(r, e, n) {
|
|
75
|
+
const t = r.trim();
|
|
76
|
+
if (!t) return { kind: "unresolvable" };
|
|
77
|
+
const i = t.split(/[?#]/, 1)[0];
|
|
78
|
+
if (!i) return { kind: "unresolvable" };
|
|
79
|
+
const o = le.exec(i);
|
|
80
|
+
if (o)
|
|
81
|
+
return `${o[1].toLowerCase()}:` in ae ? { kind: "remote" } : { kind: "unresolvable" };
|
|
82
|
+
const l = S(r, e, n);
|
|
83
|
+
return l ? D(l) !== "image" ? { kind: "unresolvable" } : { kind: "local", path: l } : { kind: "unresolvable" };
|
|
84
|
+
}
|
|
85
|
+
function ce(r, e, n, t) {
|
|
86
|
+
return r.kind === "remote" ? { kind: "remote", src: n || "", alt: t } : r.kind === "unresolvable" ? { kind: "unresolvable", fallbackText: t || n || "(image)" } : e.status === "loading" || e.status === "idle" ? { kind: "loading" } : e.status === "ready" ? { kind: "ready", objectUrl: e.objectUrl, alt: t, path: r.path } : { kind: "error", fallbackText: t || r.path || "(image)" };
|
|
87
|
+
}
|
|
88
|
+
function L(r, e, n) {
|
|
89
|
+
return {
|
|
90
|
+
workspaceCwd: n ?? (r || "~"),
|
|
91
|
+
targetPaneId: e ?? void 0
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function me(r, e, n) {
|
|
95
|
+
if (!r || !e) {
|
|
96
|
+
n({ status: "idle" });
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let t = !1;
|
|
100
|
+
return n({ status: "loading" }), A(r, e).then((i) => {
|
|
101
|
+
t || n({ status: "ready", objectUrl: i.objectUrl });
|
|
102
|
+
}).catch((i) => {
|
|
103
|
+
t || n({
|
|
104
|
+
status: "error",
|
|
105
|
+
message: i instanceof Error ? i.message : String(i)
|
|
106
|
+
});
|
|
107
|
+
}), () => {
|
|
108
|
+
t = !0, B(r);
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function ue(r) {
|
|
112
|
+
const e = y((o) => o.client), n = y((o) => o.daemon), [t, i] = k({ status: "idle" });
|
|
113
|
+
return I(() => me(r, e && n ? (l) => U().files.openForView(l) : null, i), [e, n, r]), t;
|
|
114
|
+
}
|
|
115
|
+
const de = E(function({
|
|
116
|
+
src: e,
|
|
117
|
+
alt: n,
|
|
118
|
+
assetBase: t,
|
|
119
|
+
owningPaneId: i,
|
|
120
|
+
workspaceCwd: o
|
|
121
|
+
}) {
|
|
122
|
+
const l = v(), u = _(
|
|
123
|
+
() => se(e || "", t, l),
|
|
124
|
+
[e, t, l]
|
|
125
|
+
), c = ue(u.kind === "local" ? u.path : null), s = ce(u, c, e, n);
|
|
126
|
+
if (s.kind === "remote")
|
|
127
|
+
return /* @__PURE__ */ a("img", { src: s.src, alt: s.alt, className: m.inlineImage });
|
|
128
|
+
if (s.kind === "unresolvable" || s.kind === "error")
|
|
129
|
+
return /* @__PURE__ */ a("code", { className: m.inlineImageFallback, children: s.fallbackText });
|
|
130
|
+
if (s.kind === "loading")
|
|
131
|
+
return /* @__PURE__ */ a("div", { className: m.inlineImageSkeleton, children: /* @__PURE__ */ a(G, { size: "sm" }) });
|
|
132
|
+
const f = L(t, i ?? null, o ?? null), g = () => {
|
|
133
|
+
x(s.path, f.workspaceCwd, f.targetPaneId);
|
|
134
|
+
};
|
|
135
|
+
return /* @__PURE__ */ a(
|
|
136
|
+
"img",
|
|
137
|
+
{
|
|
138
|
+
src: s.objectUrl,
|
|
139
|
+
alt: s.alt,
|
|
140
|
+
className: m.inlineImage,
|
|
141
|
+
title: s.path,
|
|
142
|
+
draggable: !0,
|
|
143
|
+
onDragStart: M(s.path),
|
|
144
|
+
onClick: g,
|
|
145
|
+
style: { cursor: "pointer" }
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
function fe(r, e, n) {
|
|
150
|
+
const t = r.trim();
|
|
151
|
+
if (!t) return { kind: "external" };
|
|
152
|
+
if (t.startsWith("#")) return { kind: "external" };
|
|
153
|
+
const i = S(r, e, n);
|
|
154
|
+
return i ? { kind: "local", path: i } : { kind: "external" };
|
|
155
|
+
}
|
|
156
|
+
function ge({ href: r, children: e, assetBase: n, owningPaneId: t, workspaceCwd: i }) {
|
|
157
|
+
const o = v(), l = fe(r ?? "", n, o);
|
|
158
|
+
if (l.kind === "external")
|
|
159
|
+
return /* @__PURE__ */ a("a", { href: r, children: e });
|
|
160
|
+
const u = l.path, c = L(n, t, i);
|
|
161
|
+
return /* @__PURE__ */ a(
|
|
162
|
+
"a",
|
|
163
|
+
{
|
|
164
|
+
href: r,
|
|
165
|
+
draggable: !0,
|
|
166
|
+
onDragStart: M(u),
|
|
167
|
+
onClick: (s) => {
|
|
168
|
+
s.preventDefault(), x(u, c.workspaceCwd, c.targetPaneId);
|
|
169
|
+
},
|
|
170
|
+
children: e
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
const H = /^ {0,3}([-*+]|\d{1,9}[.)])(\s|$)/, pe = /^(\s*)(`{3,}|~{3,})(.*)$/;
|
|
175
|
+
function ke(r) {
|
|
176
|
+
return H.test(r[0] ?? "");
|
|
177
|
+
}
|
|
178
|
+
function he(r, e) {
|
|
179
|
+
for (let n = e; n < r.length; n++)
|
|
180
|
+
if ((r[n] ?? "").trim() !== "") return n;
|
|
181
|
+
return -1;
|
|
182
|
+
}
|
|
183
|
+
function be(r) {
|
|
184
|
+
if (!r) return { blocks: [], tail: "" };
|
|
185
|
+
const e = r.split(`
|
|
186
|
+
`), n = [];
|
|
187
|
+
let t = [], i = null, o = !1, l = !1;
|
|
188
|
+
const u = () => {
|
|
189
|
+
const c = t.join(`
|
|
190
|
+
`).trim();
|
|
191
|
+
c && n.push(c), t = [];
|
|
192
|
+
};
|
|
193
|
+
for (let c = 0; c < e.length; c++) {
|
|
194
|
+
const s = e[c] ?? "", f = s.trim();
|
|
195
|
+
if (i !== null) {
|
|
196
|
+
if (t.push(s), i.test(f)) {
|
|
197
|
+
const d = o;
|
|
198
|
+
i = null, o = !1, d && u();
|
|
199
|
+
}
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
const g = pe.exec(s);
|
|
203
|
+
if (g && !l) {
|
|
204
|
+
const d = g[2];
|
|
205
|
+
i = new RegExp(`^[${d[0]}]{${d.length},}$`), o = g[1] === "", t.push(s);
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
if (f === "" && t.length === 0) continue;
|
|
209
|
+
if ((f.split("$$").length - 1) % 2 === 1 && (l = !l), f === "" && !l) {
|
|
210
|
+
const d = he(e, c + 1), p = d === -1 ? null : e[d] ?? "", R = p !== null && !/^\s/.test(p), F = p !== null && H.test(p) && ke(t);
|
|
211
|
+
if (R && !F) {
|
|
212
|
+
u(), c = d - 1;
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
t.push(s);
|
|
217
|
+
}
|
|
218
|
+
return { blocks: n, tail: t.join(`
|
|
219
|
+
`) };
|
|
220
|
+
}
|
|
221
|
+
function we({ language: r, code: e }) {
|
|
222
|
+
const [n, t] = k(null);
|
|
223
|
+
return I(() => {
|
|
224
|
+
let i = !1;
|
|
225
|
+
return Y(e, r).then((o) => {
|
|
226
|
+
i || t(o);
|
|
227
|
+
}), () => {
|
|
228
|
+
i = !0;
|
|
229
|
+
};
|
|
230
|
+
}, [e, r]), n ? /* @__PURE__ */ a("div", { className: m.prose, dangerouslySetInnerHTML: { __html: n } }) : /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: e }) });
|
|
231
|
+
}
|
|
232
|
+
function Ie({ code: r }) {
|
|
233
|
+
const [e] = k(() => `mermaid-${O()}`), [n, t] = k({ status: "pending" });
|
|
234
|
+
return I(() => {
|
|
235
|
+
let i = !1;
|
|
236
|
+
return (async () => {
|
|
237
|
+
try {
|
|
238
|
+
const { default: o } = await import("mermaid");
|
|
239
|
+
o.initialize({
|
|
240
|
+
startOnLoad: !1,
|
|
241
|
+
theme: "base",
|
|
242
|
+
themeVariables: q(),
|
|
243
|
+
securityLevel: "strict",
|
|
244
|
+
fontFamily: "var(--pi-font-ui)"
|
|
245
|
+
});
|
|
246
|
+
const { svg: l } = await o.render(e, r);
|
|
247
|
+
i || t({ status: "ready", svg: l });
|
|
248
|
+
} catch (o) {
|
|
249
|
+
i || t({
|
|
250
|
+
status: "error",
|
|
251
|
+
message: o instanceof Error ? o.message : "Failed to render diagram"
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
})(), () => {
|
|
255
|
+
i = !0;
|
|
256
|
+
};
|
|
257
|
+
}, [e, r]), n.status === "ready" ? /* @__PURE__ */ a("div", { className: m.mermaid, dangerouslySetInnerHTML: { __html: n.svg } }) : n.status === "error" ? /* @__PURE__ */ b("div", { className: m.mermaidError, children: [
|
|
258
|
+
/* @__PURE__ */ b("p", { className: m.mermaidErrorMessage, children: [
|
|
259
|
+
"Failed to render diagram: ",
|
|
260
|
+
n.message
|
|
261
|
+
] }),
|
|
262
|
+
/* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: r }) })
|
|
263
|
+
] }) : /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: r }) });
|
|
264
|
+
}
|
|
265
|
+
function ye({ className: r, children: e, ...n }) {
|
|
266
|
+
const t = /language-(\w+)/.exec(r ?? ""), i = !!t, o = String(e).replace(/\n$/, "");
|
|
267
|
+
if (i && t) {
|
|
268
|
+
const l = t[1] ?? "plaintext";
|
|
269
|
+
return l === "mermaid" ? /* @__PURE__ */ a(Ie, { code: o }) : /* @__PURE__ */ a(we, { language: l, code: o });
|
|
270
|
+
}
|
|
271
|
+
return /* @__PURE__ */ a("code", { className: m.inlineCode, ...n, children: e });
|
|
272
|
+
}
|
|
273
|
+
function Ce({ className: r, children: e, ...n }) {
|
|
274
|
+
return /language-(\w+)/.test(r ?? "") ? /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: String(e).replace(/\n$/, "") }) }) : /* @__PURE__ */ a("code", { className: m.inlineCode, ...n, children: e });
|
|
275
|
+
}
|
|
276
|
+
const Ee = [$, j], _e = [V], ve = [], w = E(function({
|
|
277
|
+
text: e,
|
|
278
|
+
assetBase: n = null,
|
|
279
|
+
owningPaneId: t = null,
|
|
280
|
+
workspaceCwd: i = null,
|
|
281
|
+
lean: o = !1
|
|
282
|
+
}) {
|
|
283
|
+
return /* @__PURE__ */ a(
|
|
284
|
+
P,
|
|
285
|
+
{
|
|
286
|
+
remarkPlugins: Ee,
|
|
287
|
+
rehypePlugins: o ? ve : _e,
|
|
288
|
+
components: {
|
|
289
|
+
code: o ? Ce : ye,
|
|
290
|
+
img: (l) => /* @__PURE__ */ a(
|
|
291
|
+
de,
|
|
292
|
+
{
|
|
293
|
+
...l,
|
|
294
|
+
assetBase: n,
|
|
295
|
+
owningPaneId: t,
|
|
296
|
+
workspaceCwd: i
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
a: (l) => /* @__PURE__ */ a(
|
|
300
|
+
ge,
|
|
301
|
+
{
|
|
302
|
+
...l,
|
|
303
|
+
assetBase: n,
|
|
304
|
+
owningPaneId: t,
|
|
305
|
+
workspaceCwd: i
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
},
|
|
309
|
+
children: e
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
function je({ text: r, assetBase: e, owningPaneId: n, workspaceCwd: t }) {
|
|
314
|
+
return /* @__PURE__ */ a("div", { className: m.prose, children: /* @__PURE__ */ a(
|
|
315
|
+
w,
|
|
316
|
+
{
|
|
317
|
+
text: r,
|
|
318
|
+
assetBase: e,
|
|
319
|
+
owningPaneId: n,
|
|
320
|
+
workspaceCwd: t
|
|
321
|
+
}
|
|
322
|
+
) });
|
|
323
|
+
}
|
|
324
|
+
function De({ text: r, assetBase: e, owningPaneId: n, workspaceCwd: t }) {
|
|
325
|
+
const { blocks: i, tail: o } = _(() => be(r), [r]);
|
|
326
|
+
return /* @__PURE__ */ b("div", { className: `${m.prose} ${m.streaming}`, children: [
|
|
327
|
+
i.map((l, u) => /* @__PURE__ */ a(
|
|
328
|
+
w,
|
|
329
|
+
{
|
|
330
|
+
text: l,
|
|
331
|
+
assetBase: e,
|
|
332
|
+
owningPaneId: n,
|
|
333
|
+
workspaceCwd: t
|
|
334
|
+
},
|
|
335
|
+
u
|
|
336
|
+
)),
|
|
337
|
+
o !== "" && /* @__PURE__ */ a(
|
|
338
|
+
w,
|
|
339
|
+
{
|
|
340
|
+
text: o,
|
|
341
|
+
lean: !0,
|
|
342
|
+
assetBase: e,
|
|
343
|
+
owningPaneId: n,
|
|
344
|
+
workspaceCwd: t
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
] });
|
|
348
|
+
}
|
|
349
|
+
export {
|
|
350
|
+
je as M,
|
|
351
|
+
De as S,
|
|
352
|
+
L as r
|
|
353
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { create as t } from "zustand";
|
|
2
|
+
const g = t()((r, o) => ({
|
|
3
|
+
pendingLogin: null,
|
|
4
|
+
requestLogin: (n, e, i) => {
|
|
5
|
+
o().pendingLogin || r({
|
|
6
|
+
pendingLogin: {
|
|
7
|
+
provider: n,
|
|
8
|
+
providerName: e,
|
|
9
|
+
authType: i,
|
|
10
|
+
controller: new AbortController(),
|
|
11
|
+
attempt: 0
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
cancelLogin: () => {
|
|
16
|
+
o().pendingLogin?.controller.abort(), r({ pendingLogin: null });
|
|
17
|
+
},
|
|
18
|
+
clearLogin: () => r({ pendingLogin: null }),
|
|
19
|
+
retryLogin: () => {
|
|
20
|
+
const n = o().pendingLogin;
|
|
21
|
+
n && r({
|
|
22
|
+
pendingLogin: {
|
|
23
|
+
provider: n.provider,
|
|
24
|
+
providerName: n.providerName,
|
|
25
|
+
authType: n.authType,
|
|
26
|
+
controller: new AbortController(),
|
|
27
|
+
attempt: n.attempt + 1
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}));
|
|
32
|
+
export {
|
|
33
|
+
g as u
|
|
34
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useRef as i, useEffect as l } from "react";
|
|
2
|
+
import { useQuery as c } from "@tanstack/react-query";
|
|
3
|
+
import { u as a, g as f, r as m } from "./index-Dlz8mEKZ.js";
|
|
4
|
+
function y(r, n) {
|
|
5
|
+
return n && r && r !== n && r.release(), n;
|
|
6
|
+
}
|
|
7
|
+
function T(r, n = !0) {
|
|
8
|
+
const u = a((e) => e.client), s = a((e) => e.daemon), o = c({
|
|
9
|
+
queryKey: m.fileDownload(r),
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
const e = await f().files.openForView(r);
|
|
12
|
+
return {
|
|
13
|
+
objectUrl: e.url,
|
|
14
|
+
mimeType: e.mimeType,
|
|
15
|
+
fileName: e.fileName,
|
|
16
|
+
release: () => e.release()
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
enabled: !!u && !!s && !!r && n,
|
|
20
|
+
// View URLs are process-local, non-serializable resources — never persist them or silently
|
|
21
|
+
// refetch behind this hook's back (that would leak the previous URL).
|
|
22
|
+
staleTime: 1 / 0,
|
|
23
|
+
gcTime: 0
|
|
24
|
+
}), t = i(null);
|
|
25
|
+
return l(() => {
|
|
26
|
+
t.current = y(t.current, o.data ?? null);
|
|
27
|
+
}, [o.data]), l(() => () => t.current?.release(), []), o;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
T as u
|
|
31
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { useState as h, useEffect as p } from "react";
|
|
2
|
+
import { u as w } from "./index-Dlz8mEKZ.js";
|
|
3
|
+
function b(e) {
|
|
4
|
+
return typeof e == "object" && e !== null && "type" in e && e.type === "file_changed" && "path" in e && typeof e.path == "string";
|
|
5
|
+
}
|
|
6
|
+
const a = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function g(e, t, i) {
|
|
8
|
+
let s = a.get(e);
|
|
9
|
+
s || (s = /* @__PURE__ */ new Map(), a.set(e, s));
|
|
10
|
+
let o = s.get(t);
|
|
11
|
+
if (!o) {
|
|
12
|
+
const n = {
|
|
13
|
+
count: 0,
|
|
14
|
+
resolvedPath: null,
|
|
15
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
16
|
+
dispose: () => {
|
|
17
|
+
}
|
|
18
|
+
}, l = e.connection.onSessionMessage((c) => {
|
|
19
|
+
const r = c;
|
|
20
|
+
if (!b(r) || r.path !== t && r.path !== n.resolvedPath) return;
|
|
21
|
+
const f = Date.now();
|
|
22
|
+
for (const d of n.listeners) d(f);
|
|
23
|
+
});
|
|
24
|
+
e.connection.request("file_watch_subscribe", { path: t }).then((c) => {
|
|
25
|
+
const r = c;
|
|
26
|
+
if (r?.ok === !1) {
|
|
27
|
+
console.warn(`watchFile: ${r.error ?? "subscribe failed"} for "${t}"`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
typeof r?.path == "string" && (n.resolvedPath = r.path);
|
|
31
|
+
}).catch(() => {
|
|
32
|
+
}), n.dispose = () => {
|
|
33
|
+
l(), e.connection.request("file_watch_unsubscribe", { path: t }).catch(() => {
|
|
34
|
+
});
|
|
35
|
+
}, o = n, s.set(t, o);
|
|
36
|
+
}
|
|
37
|
+
o.count++, o.listeners.add(i);
|
|
38
|
+
let u = !1;
|
|
39
|
+
return () => {
|
|
40
|
+
if (u) return;
|
|
41
|
+
u = !0;
|
|
42
|
+
const n = s.get(t);
|
|
43
|
+
n && (n.listeners.delete(i), n.count--, n.count === 0 && (s.delete(t), n.dispose()));
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function M(e) {
|
|
47
|
+
const t = w((o) => o.client), [i, s] = h(null);
|
|
48
|
+
return p(() => {
|
|
49
|
+
if (!(!t || !e))
|
|
50
|
+
return g(t, e, s);
|
|
51
|
+
}, [t, e]), { changedAt: i };
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
M as u
|
|
55
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useQuery as o } from "@tanstack/react-query";
|
|
2
|
+
import { u as n, r as u } from "./index-Dlz8mEKZ.js";
|
|
3
|
+
function c(e = !0) {
|
|
4
|
+
const r = n((t) => t.client);
|
|
5
|
+
return o({
|
|
6
|
+
queryKey: u.providerAuthList(),
|
|
7
|
+
queryFn: () => {
|
|
8
|
+
if (!r) throw new Error("not connected");
|
|
9
|
+
return r.listProviderAuth();
|
|
10
|
+
},
|
|
11
|
+
enabled: !!r && e
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
c as u
|
|
16
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AskCard — an extension-UI dialog rendered inline in the chat transcript, through every state in
|
|
3
|
+
* its life (sprint-068/task-005 pending states; task-006 in-flight, resolved-collapsed and
|
|
4
|
+
* non-answerable; task-008 keyboard/focus ownership). A UI request is never a persisted
|
|
5
|
+
* `TimelineRow` — it is composed into the virtualized list at render time (`Timeline.tsx`), never
|
|
6
|
+
* written to `session.timeline.rows` — but it reuses the same `RowShell` gutter/disc/connector
|
|
7
|
+
* language every other timeline row uses (§ 02: "same 20px gutter, disc and connector as a tool
|
|
8
|
+
* card"), so the shell is reused, not reinvented.
|
|
9
|
+
*
|
|
10
|
+
* **No optimistic update.** Submitting fires `respondToUi` and nothing else — the card stays
|
|
11
|
+
* pending (in-flight) until the daemon's `agent_ui_resolved` arrives; there is nothing local to
|
|
12
|
+
* await or resolve here. `submitting`/`submittedAnswer`/`answerable` are read straight off the SDK's
|
|
13
|
+
* `AgentUiPendingEntry` (`agent-ui-state.ts`) — this component decides nothing new, it renders what
|
|
14
|
+
* the store already models (task-006's own scope boundary).
|
|
15
|
+
*
|
|
16
|
+
* **Keyboard/focus ownership (task-008, § 07).** A card claims Enter and Esc only while focus is
|
|
17
|
+
* inside it — enforced by DOM structure, not a global handler: `Composer.tsx`'s Enter-submit is
|
|
18
|
+
* scoped to its own `<textarea onKeyDown>`, a disjoint subtree, so it can never see a keypress
|
|
19
|
+
* whose focus target lives inside a card, and vice versa. The only place ownership has to be
|
|
20
|
+
* *asserted* rather than simply falling out of the DOM is Esc, because `use-shortcuts.ts` attaches
|
|
21
|
+
* a `document`-level listener that would otherwise also see it — every Esc handled here calls
|
|
22
|
+
* `stopPropagation()`. The card border/ring and the hint line's visibility are pure CSS
|
|
23
|
+
* (`.card:focus-within`, `AskCard.module.css`) — no focus/blur listener needed for those; `armed`
|
|
24
|
+
* is the one piece of real state, because the hint's *text* has to change mid-flow.
|
|
25
|
+
*
|
|
26
|
+
* Three things make that contract actually reachable with a mouse, all fixed after sprint-069's
|
|
27
|
+
* live pass found the card "clunky to focus" (and every first click on a button silently eaten):
|
|
28
|
+
* the card carries `tabIndex={-1}` and focuses itself on a body mousedown (a `div` is otherwise
|
|
29
|
+
* unfocusable, so clicking the prompt did nothing at all); the hint line toggles `visibility`
|
|
30
|
+
* rather than `display`, so revealing it cannot move the button being clicked out from under the
|
|
31
|
+
* pointer between `mousedown` and `mouseup`; and initial autofocus yields only to a text field
|
|
32
|
+
* holding *unsent text*, not merely to whichever field happens to be focused — the composer is
|
|
33
|
+
* always focused-and-empty right after sending the message that triggered the card.
|
|
34
|
+
*/
|
|
35
|
+
import { type AskEntry } from "./ask-list.js";
|
|
36
|
+
export interface AskCardProps {
|
|
37
|
+
item: AskEntry;
|
|
38
|
+
/** Draw the rail connector below this card. `false` on the timeline's last row. */
|
|
39
|
+
connector: boolean;
|
|
40
|
+
/** § 06 "past four": render a pending card collapsed to its header line. Ignored for a resolved
|
|
41
|
+
* entry — task-006 already collapses those unconditionally, orthogonally to this flag. */
|
|
42
|
+
collapsed?: boolean;
|
|
43
|
+
/** § 07 "the first pending card in the active session takes focus" — `Timeline.tsx` sets this on
|
|
44
|
+
* exactly one card (or none): the active session's focused pane's first pending entry. Ignored
|
|
45
|
+
* for a resolved/collapsed entry, neither of which has anything focusable. */
|
|
46
|
+
autoFocus?: boolean;
|
|
47
|
+
/** § 08's `role="group"` accessible name is "Question in {session name}" — the owning session's
|
|
48
|
+
* own title, never an extension identity (none exists on the wire). Only `PendingAskCard`
|
|
49
|
+
* actually renders it; resolved/collapsed cards are static rows, not an interactive group. */
|
|
50
|
+
sessionTitle: string;
|
|
51
|
+
}
|
|
52
|
+
export declare function AskCard({ item, connector, collapsed, autoFocus, sessionTitle, }: AskCardProps): import("react").JSX.Element;
|
|
53
|
+
/** § 06 "N more waiting" — the clickable row that lifts the past-four limit, rendered by
|
|
54
|
+
* `Timeline.tsx` right where `layoutAskEntries` places the `{ kind: "more" }` marker (immediately
|
|
55
|
+
* after the last full pending card). Not itself an `AskCard` variant — it carries no dialog
|
|
56
|
+
* identity of its own, so it takes its own connector prop directly rather than an `AskEntry`. */
|
|
57
|
+
export declare function AskMoreRow({ count, connector, onExpand, }: {
|
|
58
|
+
count: number;
|
|
59
|
+
connector: boolean;
|
|
60
|
+
onExpand: () => void;
|
|
61
|
+
}): import("react").JSX.Element;
|
|
62
|
+
//# sourceMappingURL=AskCard.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension-UI state, wired into React (sprint-068/task-003). Owns lifetime management only — the
|
|
3
|
+
* `AgentUiController` (`@av-pi-studio/client`, sprint-067) already handles every hard problem
|
|
4
|
+
* (rehydration ordering, reconnect resync, first-answer-wins, agent-lifecycle pruning); this module
|
|
5
|
+
* must not reimplement or second-guess any of it.
|
|
6
|
+
*
|
|
7
|
+
* **One controller per connected client, app-scoped** (unlike `use-file-watch.ts`'s/
|
|
8
|
+
* `use-checkout-status.ts`'s per-path subscriptions) — created lazily and disposed on client
|
|
9
|
+
* change, mirroring `lib/connection/connection-store.ts`'s own lifecycle.
|
|
10
|
+
*
|
|
11
|
+
* **Capability is read only once the connection is actually `"open"`**, never eagerly the instant
|
|
12
|
+
* `client` is assigned: `client.extensionUiAvailable()` reads `server_info.features`, which is not
|
|
13
|
+
* known until the handshake completes (`connection-store.ts`'s `connect()` sets `client` before
|
|
14
|
+
* `await daemon.connect()` resolves). Creating a controller unconditionally at assignment time
|
|
15
|
+
* would either race that handshake or (worse) require polling; instead this module waits for the
|
|
16
|
+
* connection's own `"open"` transition, checks capability at that moment, and creates a controller
|
|
17
|
+
* only if it is present. **If it is never present for this client, no controller is ever created**
|
|
18
|
+
* — not merely inert, genuinely absent, satisfying the capability-gating acceptance criterion
|
|
19
|
+
* verbatim ("no controller exists").
|
|
20
|
+
*
|
|
21
|
+
* **A controller, once created, is NEVER torn down for an in-connection blip** (disconnect/
|
|
22
|
+
* reconnect against the very same `client` instance) — the controller's own `disconnected`/resync
|
|
23
|
+
* handling already covers that (`agent-ui-controller.ts`'s header: "`answerable` is a one-way door
|
|
24
|
+
* … only a fresh snapshot resets it"). Disposal happens only when `client` itself changes — a real
|
|
25
|
+
* switch of daemon, or a transition to no client at all.
|
|
26
|
+
*
|
|
27
|
+
* **Effects (`AgentUiEffect`) are routed from exactly one seam** — `dispatchEffects`, called from
|
|
28
|
+
* this module's single `controller.subscribe` callback with that commit's own `effects` array, in
|
|
29
|
+
* order. Exactly-once follows from the controller itself: `agent-ui-controller.ts`'s `commit()` is
|
|
30
|
+
* the only place a listener ever fires, called exactly once per action (including once each for
|
|
31
|
+
* queued transients replayed during `resync()`), and this module registers exactly one listener —
|
|
32
|
+
* so there is no path that could process the same effects twice. `"notify"` routes to a toast
|
|
33
|
+
* (`notify-effect.ts`'s pure decision helpers; sprint-069/task-006); `"replace_composer_text"`
|
|
34
|
+
* routes to `draft-store.ts` (sprint-069/task-007), the target SESSION's draft resolved from the
|
|
35
|
+
* effect's own `agentId` — never whichever composer currently has focus; any other/future kind is
|
|
36
|
+
* ignored, never thrown — the SDK's own `onUnknownMethod` above establishes the same "log or
|
|
37
|
+
* ignore, never crash" posture for methods this client doesn't know.
|
|
38
|
+
*
|
|
39
|
+
* **§ 08/§ 11 announcements are a second, separate consumer of the same commit** (sprint-069/
|
|
40
|
+
* task-008) — `announceTransitions`, called right after `dispatchEffects` from the same
|
|
41
|
+
* `subscribe` callback, diffs the just-committed `uiState` against the one before it
|
|
42
|
+
* (`announce.ts`'s pure `computeAnnouncements`) for § 08 pending-question arrivals/resolutions,
|
|
43
|
+
* while `notifyEffect`/`composerTextEffect` themselves additionally `speak()` their own § 11
|
|
44
|
+
* copy. Both write through `stores/announcer-store.ts`'s one shared live region — never a second,
|
|
45
|
+
* divergent one.
|
|
46
|
+
*
|
|
47
|
+
* **Retained surfaces are deliberately not exposed** — no `useAgentUiSurfaces` hook exists yet.
|
|
48
|
+
* Sprint-070 renders them; an unused public selector today would invite a second, divergent
|
|
49
|
+
* consumer before that design is settled.
|
|
50
|
+
*/
|
|
51
|
+
import { type AgentUiController, type AgentUiPendingEntry, type AgentUiResolvedEntry, type AgentUiRespondResult, type AgentUiState } from "@av-pi-studio/client";
|
|
52
|
+
import type { AgentUiResponse } from "@av-pi-studio/protocol";
|
|
53
|
+
export interface AgentUiStoreState {
|
|
54
|
+
controller: AgentUiController | null;
|
|
55
|
+
uiState: AgentUiState;
|
|
56
|
+
}
|
|
57
|
+
export declare const useAgentUiStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AgentUiStoreState>>;
|
|
58
|
+
/** Pure selector core, exported so tests can exercise stability/emptiness without a React renderer
|
|
59
|
+
* (this repo's Vitest runner has no jsdom — see `use-file-watch.ts`'s "extract the testable core"
|
|
60
|
+
* convention). `useAgentUiPending` is a thin hook wrapper around this same function. */
|
|
61
|
+
export declare function selectAgentUiPending(s: AgentUiStoreState, agentId: string): readonly AgentUiPendingEntry[];
|
|
62
|
+
/** Pure selector core for resolved entries — see `selectAgentUiPending`. */
|
|
63
|
+
export declare function selectAgentUiResolved(s: AgentUiStoreState, agentId: string): readonly AgentUiResolvedEntry[];
|
|
64
|
+
/** Pure selector core for the set of agent ids with at least one pending question, across every
|
|
65
|
+
* agent — sprint-069/task-003's workspace-header aggregation and task-004's tab strip both need
|
|
66
|
+
* "does this session have a pending question" without subscribing to `useAgentUiPending` per
|
|
67
|
+
* session (which would call a hook a variable number of times across a group's session list).
|
|
68
|
+
* Stable-reference cached like `stableList` above, so an unrelated agent's transition does not
|
|
69
|
+
* re-render every consumer of this selector. */
|
|
70
|
+
export declare function selectAgentUiPendingAgentIds(s: AgentUiStoreState): ReadonlySet<string>;
|
|
71
|
+
/** The set of agent ids with at least one pending question. Empty (a stable, shared empty set)
|
|
72
|
+
* when no controller exists (capability absent) or nothing is pending anywhere. */
|
|
73
|
+
export declare function useAgentUiPendingAgentIds(): ReadonlySet<string>;
|
|
74
|
+
/** Every pending dialog for `agentId`, oldest first. Empty (a stable, shared empty array) when no
|
|
75
|
+
* controller exists (capability absent) or the agent has none pending. */
|
|
76
|
+
export declare function useAgentUiPending(agentId: string): readonly AgentUiPendingEntry[];
|
|
77
|
+
/** Every resolved (collapsed-in-place) dialog for `agentId`, oldest first, bounded at the SDK's
|
|
78
|
+
* `RESOLVED_HISTORY_LIMIT`. Same stability contract as `useAgentUiPending`. */
|
|
79
|
+
export declare function useAgentUiResolved(agentId: string): readonly AgentUiResolvedEntry[];
|
|
80
|
+
/** Answers a pending dialog. `{ ok: false, reason }` is a normal outcome (e.g. another client won
|
|
81
|
+
* the race) — callers must handle it, never treat it as a thrown error. Resolves
|
|
82
|
+
* `{ ok: false, reason: "unsupported" }` with no RPC when no controller exists. */
|
|
83
|
+
export declare function respondToUi(uiRequestId: string, response: AgentUiResponse): Promise<AgentUiRespondResult>;
|
|
84
|
+
//# sourceMappingURL=agent-ui-store.d.ts.map
|