@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
package/README.md
CHANGED
|
@@ -1,3 +1,158 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @av-pi-studio/workbench
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The Pi-Studio client application as a library: connection, sessions, chat and timeline, composer,
|
|
4
|
+
files and viewers, git, terminals and settings, for any React 19 shell that talks to a Pi-Studio
|
|
5
|
+
daemon. `@av-pi-studio/web-client` (the browser app) and the desktop app are both thin shells over
|
|
6
|
+
it.
|
|
7
|
+
|
|
8
|
+
- ES modules only, React 19 peer, built for **Vite** consumers (lazy chunks, a pdf.js worker built
|
|
9
|
+
by your bundler). No SSR, no React Native.
|
|
10
|
+
- **One instance per document.** Application state is module-level; a second `<Workbench>` shares
|
|
11
|
+
it (development builds warn).
|
|
12
|
+
- The supported API is exactly the exports listed under [Public API](#public-api). Deep imports are
|
|
13
|
+
rejected by the `exports` map.
|
|
14
|
+
|
|
15
|
+
## Quickstart (Vite + React)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @av-pi-studio/workbench @av-pi-studio/ui-library react react-dom pdfjs-dist
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`vite.config.ts`:
|
|
22
|
+
|
|
23
|
+
<!-- smoke:vite.config.ts -->
|
|
24
|
+
```ts
|
|
25
|
+
import react from "@vitejs/plugin-react";
|
|
26
|
+
import { pdfjsAssetsPlugin } from "@av-pi-studio/workbench/vite";
|
|
27
|
+
import { defineConfig } from "vite";
|
|
28
|
+
|
|
29
|
+
export default defineConfig({
|
|
30
|
+
plugins: [react(), pdfjsAssetsPlugin()],
|
|
31
|
+
worker: { format: "es" },
|
|
32
|
+
});
|
|
33
|
+
```
|
|
34
|
+
<!-- /smoke:vite.config.ts -->
|
|
35
|
+
|
|
36
|
+
`src/main.tsx`:
|
|
37
|
+
|
|
38
|
+
<!-- smoke:main.tsx -->
|
|
39
|
+
```tsx
|
|
40
|
+
import "@av-pi-studio/workbench/fonts.css";
|
|
41
|
+
import "@av-pi-studio/ui-library/reset.css";
|
|
42
|
+
import "@av-pi-studio/ui-library/styles.css";
|
|
43
|
+
import "@av-pi-studio/workbench/styles.css";
|
|
44
|
+
import { StrictMode } from "react";
|
|
45
|
+
import { createRoot } from "react-dom/client";
|
|
46
|
+
import { createBrowserHost, Workbench } from "@av-pi-studio/workbench";
|
|
47
|
+
import PdfWorker from "pdfjs-dist/build/pdf.worker.min.mjs?worker";
|
|
48
|
+
|
|
49
|
+
const host = createBrowserHost({
|
|
50
|
+
app: { title: "My Pi-Studio", version: "1.0.0" },
|
|
51
|
+
pdf: {
|
|
52
|
+
createWorker: () => new PdfWorker({ name: "pdfjs" }),
|
|
53
|
+
assetBaseUrl: `${import.meta.env.BASE_URL}pdfjs/`,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
createRoot(document.getElementById("root")!).render(
|
|
58
|
+
<StrictMode>
|
|
59
|
+
<Workbench host={host} />
|
|
60
|
+
</StrictMode>,
|
|
61
|
+
);
|
|
62
|
+
```
|
|
63
|
+
<!-- /smoke:main.tsx -->
|
|
64
|
+
|
|
65
|
+
Stylesheets, in this order: `fonts.css` (the bundled terminal font, Cascadia Mono NF, as real
|
|
66
|
+
files your bundler emits; omit it and terminals fall back to the system monospace stack), the
|
|
67
|
+
design system's `reset.css` (optional) and `styles.css`, then the workbench's `styles.css` (every
|
|
68
|
+
class is prefixed `piwb-`). Your own CSS after them. Without the workbench `styles.css` the app is
|
|
69
|
+
unstyled but works.
|
|
70
|
+
|
|
71
|
+
The katex stylesheet is imported by the workbench's markdown renderer as a plain
|
|
72
|
+
`katex/dist/katex.min.css` import; your bundler resolves it and emits its fonts. Nothing to do.
|
|
73
|
+
|
|
74
|
+
## A custom shell
|
|
75
|
+
|
|
76
|
+
`Workbench` is exactly `WorkbenchProvider` + `WorkbenchBoot` + `WorkspaceShell`. To lay the app out
|
|
77
|
+
yourself, compose the provider, the boot component (mount exactly one) and the regions you want:
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
import { createBrowserHost, PaneArea, SessionList, useConnection, WorkbenchBoot, WorkbenchProvider } from "@av-pi-studio/workbench";
|
|
81
|
+
import { Announcer, ToastViewport } from "@av-pi-studio/ui-library";
|
|
82
|
+
|
|
83
|
+
function ConnectButton() {
|
|
84
|
+
const { status, connect } = useConnection();
|
|
85
|
+
return <button onClick={() => void connect({ url: "127.0.0.1:6767" })}>{status}</button>;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
<WorkbenchProvider host={createBrowserHost({ app: { title: "Mine", version: "1" } })}>
|
|
89
|
+
<WorkbenchBoot />
|
|
90
|
+
<ConnectButton />
|
|
91
|
+
<SessionList />
|
|
92
|
+
<PaneArea />
|
|
93
|
+
<ToastViewport />
|
|
94
|
+
<Announcer />
|
|
95
|
+
</WorkbenchProvider>;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Every region and hook throws `"<Name> must be rendered inside <WorkbenchProvider>"` outside the
|
|
99
|
+
provider. Mount `ToastViewport` and `Announcer` yourself (the default shell does).
|
|
100
|
+
|
|
101
|
+
## Public API
|
|
102
|
+
|
|
103
|
+
| Export | What it is |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `Workbench` | The whole application. Props: `host?` |
|
|
106
|
+
| `WorkbenchProvider` | Host installation, theme, query cache. Props: `host?`, `children` |
|
|
107
|
+
| `WorkbenchBoot` | The boot sequence (connect intent, deep links, session/terminal restore, shortcuts, resume). Renders nothing; mount one |
|
|
108
|
+
| `WorkspaceShell` | The default three-column layout |
|
|
109
|
+
| `ConnectionBar` | Top bar: brand, status, address/password, connect, panel toggles, settings |
|
|
110
|
+
| `SessionList` | Left sidebar: workspaces and conversations |
|
|
111
|
+
| `PaneArea` | Split panes and tabs (chat, files, terminals) |
|
|
112
|
+
| `RightSidebar` | Files and git changes |
|
|
113
|
+
| `StatusBar` | Bottom bar |
|
|
114
|
+
| `OpenWorkspaceDialog` | Workspace picker (opened from the sidebar) |
|
|
115
|
+
| `SettingsDialog` | Settings, lazily loaded. Props: `open`, `onOpenChange`; render inside `<Suspense>` |
|
|
116
|
+
| `useConnection()` | `{ status, serverInfo, error, connect(options), disconnect() }` |
|
|
117
|
+
| `useShellLayout()` | `{ left, right }`, each `{ collapsed, width, toggle(), resize(delta) }` |
|
|
118
|
+
| `useSettingsDialog()` | `{ open, openSettings(), closeSettings() }` |
|
|
119
|
+
| `createBrowserHost(options?)` | The browser host (`options.app`, `options.pdf`) |
|
|
120
|
+
| Types | `WorkbenchHost` and its member types (below), `WorkbenchProviderProps`, `SettingsDialogProps`, `WorkbenchConnection`, `SidebarLayout`, `ConnectOptions`, `BrowserHostOptions` |
|
|
121
|
+
|
|
122
|
+
Entries: `.` (the above), `./styles.css`, `./fonts.css`, `./vite` (Node, for `vite.config.ts`).
|
|
123
|
+
|
|
124
|
+
## The host
|
|
125
|
+
|
|
126
|
+
Everything browser-bound goes through one object, `WorkbenchHost`, passed as `host`. `web-client`
|
|
127
|
+
passes `createBrowserHost(...)`; a desktop shell implements its own. It is installed on the first
|
|
128
|
+
render; the first host wins (a later different one is ignored, with a development warning).
|
|
129
|
+
|
|
130
|
+
| Member | Contract |
|
|
131
|
+
|---|---|
|
|
132
|
+
| `app` | `{ title, version, platform? }`: shown in the top bar; `platform` is sent as `hello.platform` (the desktop app passes `"desktop"`; a browser omits it) |
|
|
133
|
+
| `storage` | `{ get(key): string \| null, set(key, value) }`. **Synchronous**: stores read it while initialising. If your storage is asynchronous, load it into memory before the first render and write behind. Never throws |
|
|
134
|
+
| `clipboard.writeText(text)` | Promise; rejects on failure |
|
|
135
|
+
| `dialogs.confirm/alert/prompt` | Promises. Dismissal resolves `false` / `null` |
|
|
136
|
+
| `links.openExternal?(url)` | Optional. When present, every external link calls it instead of navigating |
|
|
137
|
+
| `launch.initialConnect()` | Read once at boot: `{ url?, password?, cwd?, connect } \| null`. `url` may be a pairing link |
|
|
138
|
+
| `launch.agentDeepLink` | `{ current(), subscribe(listener), consume() }`: "open this agent" requests |
|
|
139
|
+
| `connection.createTransport(target, { password })` | The `Transport` for one connect, or `undefined` for the SDK's WebSocket. `target` is `{ mode: "direct", url }` or `{ mode: "relay", url, daemonPublicKey }`. **A transport must deliver frames in wire order and binary frames as `ArrayBuffer`.** Throwing fails that connect with your message |
|
|
140
|
+
| `connection.timers` | `setTimer`/`clearTimer` for reconnect backoff; must keep firing while the window is hidden |
|
|
141
|
+
| `connection.onResume(listener)` | Fire on wake, focus or network change; the workbench decides whether to probe or reconnect |
|
|
142
|
+
| `files.upload(dir, source, options?)` | Upload `source` (`{ name, size? }`; you must also accept a browser `File`) to `<dir>/<name>`. Resolve only once the daemon has confirmed the write (the SDK does this when the daemon advertises `fileTransferAck`) and reject with the daemon's reason. `options.onProgress(sent, total?)` is optional; the explorer shows a percentage from it. The browser host passes the `File` itself to the SDK (no `arrayBuffer()`), so a large upload does not sit in memory |
|
|
143
|
+
| `files.saveToDisk(path)` | Copy a daemon file to the user's machine |
|
|
144
|
+
| `files.openForView(path)` | `{ url, mimeType?, fileName?, release() }` for viewers; `release` is called when the URL is unused |
|
|
145
|
+
| `files.pickUploads?()` | Optional native picker, replacing the file input |
|
|
146
|
+
| `pdf?` | Optional `{ createWorker(), assetBaseUrl }`. Without it PDFs show an error with Download |
|
|
147
|
+
|
|
148
|
+
## PDF viewing
|
|
149
|
+
|
|
150
|
+
pdf.js needs a worker and data files that only your application bundle can provide:
|
|
151
|
+
|
|
152
|
+
- the worker: `import PdfWorker from "pdfjs-dist/build/pdf.worker.min.mjs?worker"`, passed as
|
|
153
|
+
`pdf.createWorker`. Install the **same `pdfjs-dist` range** as this package's dependency;
|
|
154
|
+
- the data (`cmaps/`, `standard_fonts/`, `wasm/`, `iccs/`): `pdfjsAssetsPlugin()` from
|
|
155
|
+
`@av-pi-studio/workbench/vite` serves them in dev and emits them under `<base>/pdfjs/`; pass that
|
|
156
|
+
URL as `pdf.assetBaseUrl`. Omit the plugin and only PDF viewing degrades.
|
|
157
|
+
|
|
158
|
+
See the quickstart for both.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { FileQuestion as s } from "lucide-react";
|
|
3
|
+
import { S as l } from "./SaveFileButton-2rOu02Xx.js";
|
|
4
|
+
const o = "piwb-BinaryFallbackViewer_wrap_FwVTc", c = "piwb-BinaryFallbackViewer_name_6bPhR", a = {
|
|
5
|
+
wrap: o,
|
|
6
|
+
name: c
|
|
7
|
+
};
|
|
8
|
+
function b({ path: i, workspaceCwd: t }) {
|
|
9
|
+
const r = i.split("/").pop() || i;
|
|
10
|
+
return /* @__PURE__ */ n("div", { className: a.wrap, children: [
|
|
11
|
+
/* @__PURE__ */ e(s, { size: 32 }),
|
|
12
|
+
/* @__PURE__ */ e("div", { className: a.name, children: r }),
|
|
13
|
+
/* @__PURE__ */ e("div", { children: "No preview available for this file type." }),
|
|
14
|
+
/* @__PURE__ */ e(l, { path: i })
|
|
15
|
+
] });
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
b as BinaryFallbackViewer
|
|
19
|
+
};
|