@av-pi-studio/workbench 0.0.0-stage → 0.0.117
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,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The "Download" action for a file no viewer can display (too large, or binary with no preview).
|
|
3
|
+
* Saves through the host's `files.saveToDisk` — the browser downloads and offers the file, a native
|
|
4
|
+
* host can stream it to disk — so no viewer builds its own download link.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SaveFileButton({ path }: {
|
|
7
|
+
path: string;
|
|
8
|
+
}): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SaveFileButton.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextViewer — the default viewer for source/text files: fetches the UTF-8 preview via
|
|
3
|
+
* `useFileSource` and renders it through `CodeView` (line gutter + Shiki highlighting).
|
|
4
|
+
* Registered in `viewer-registry.ts` as the fallback for any file not claimed by a more specific
|
|
5
|
+
* viewer.
|
|
6
|
+
*
|
|
7
|
+
* Three size tiers (task-009 — raising `file_read_request`'s old 512 KiB ceiling; task-002 —
|
|
8
|
+
* extracted into the shared `use-file-source` hook so other text-shaped viewers get the same
|
|
9
|
+
* ladder):
|
|
10
|
+
* 1. `size <= MAX_INLINE_FILE_READ_BYTES` (server-side, 5 MiB) — the `useFileRead` JSON round
|
|
11
|
+
* trip, unchanged.
|
|
12
|
+
* 2. `MAX_INLINE_FILE_READ_BYTES < size <= MAX_DISPLAY_BYTES` (30 MiB) — transparently refetch via
|
|
13
|
+
* the uncapped chunked binary download path (`use-file-text.ts`) and render the same
|
|
14
|
+
* `CodeView`, with a muted note that the file was streamed rather than read inline.
|
|
15
|
+
* 3. `size > MAX_DISPLAY_BYTES` — a terminal state: no render attempt, just the size, why, and a
|
|
16
|
+
* download action (`SaveFileButton`, through the host's `files.saveToDisk`).
|
|
17
|
+
*
|
|
18
|
+
* Which tier applies is the pure, DOM-free `selectTextViewerState` (`text-viewer-state.ts`), run
|
|
19
|
+
* inside `useFileSource` — this component is a thin switch-render over its result.
|
|
20
|
+
*/
|
|
21
|
+
import type { ViewerProps } from "./viewer-registry.js";
|
|
22
|
+
export declare function TextViewer({ path }: ViewerProps): import("react").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=TextViewer.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TreeDraftRow — the inline "new file"/"new folder" name-entry row rendered in place of a real
|
|
3
|
+
* tree row (`file-tree.ts`'s `DraftRow`). Owns the input's local text state so `TreeNode` stays
|
|
4
|
+
* hook-free and presentational; submits the trimmed name up to `FileExplorer` via `onSubmit`,
|
|
5
|
+
* or discards the draft via `onCancel` on Escape/blur/empty-submit.
|
|
6
|
+
*/
|
|
7
|
+
import { type CSSProperties } from "react";
|
|
8
|
+
export interface TreeDraftRowProps {
|
|
9
|
+
draftKind: "file" | "directory";
|
|
10
|
+
indentStyle: CSSProperties;
|
|
11
|
+
onSubmit(name: string): void;
|
|
12
|
+
onCancel(): void;
|
|
13
|
+
}
|
|
14
|
+
export declare function TreeDraftRow({ draftKind, indentStyle, onSubmit, onCancel }: TreeDraftRowProps): import("react").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=TreeDraftRow.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TreeNode — one row of the Files tab tree view (POC_TO_APP_PLAN_UI.md §4.7 tree-view follow-up).
|
|
3
|
+
* Presentational only: `FileExplorer.tsx` computes the flattened `TreeRow[]` (`file-tree.ts`) and
|
|
4
|
+
* hands each one here as a fixed-height virtualized row. A directory row toggles expansion; a
|
|
5
|
+
* file row opens a tab; both show the "⋮" action button feeding the shared `FileContextMenu`.
|
|
6
|
+
*/
|
|
7
|
+
import type { TreeRow } from "./file-tree.js";
|
|
8
|
+
import type { GitRowStatus } from "./git-status-index.js";
|
|
9
|
+
import type { DragEvent } from "react";
|
|
10
|
+
export interface TreeNodeProps {
|
|
11
|
+
row: TreeRow;
|
|
12
|
+
/** True when this row's path is the active tab's file (`FileExplorer.tsx`'s `activeFilePath`) —
|
|
13
|
+
* highlighted like the sidebar's active session row. */
|
|
14
|
+
active?: boolean;
|
|
15
|
+
/** True when this row is the last-clicked row (`explorer-store.ts`'s `selected`) — the target
|
|
16
|
+
* directory for "New File"/"New Folder". */
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/** True while an internal drag would land in this row (`FileExplorer.tsx`'s hovered target). */
|
|
19
|
+
dropTarget?: boolean;
|
|
20
|
+
/** Git status of this row's path (`git-status-index.ts`) — tints the icon + label, with
|
|
21
|
+
* directories inheriting the status of anything changed beneath them. Undefined when clean,
|
|
22
|
+
* ignored, or outside a repo. */
|
|
23
|
+
gitStatus?: GitRowStatus;
|
|
24
|
+
/** True when the entry wouldn't show in a plain listing — a dotfile, or gitignored
|
|
25
|
+
* (`FileExplorer.tsx` computes both). Ghosts the row so it reads as present-but-not-normally-
|
|
26
|
+
* visible; still fully interactive, and full opacity on hover/active/selected. */
|
|
27
|
+
hidden?: boolean;
|
|
28
|
+
/** True for the tree's own root row (the workspace cwd). Styled as a heading and NOT draggable:
|
|
29
|
+
* every legal drop target lives inside it, so a root drag could only ever be refused. */
|
|
30
|
+
isRoot?: boolean;
|
|
31
|
+
onToggle(path: string): void;
|
|
32
|
+
onOpenFile(path: string): void;
|
|
33
|
+
onContextMenu(path: string, isDirectory: boolean, x: number, y: number): void;
|
|
34
|
+
onSubmitDraft(parentPath: string, name: string): void;
|
|
35
|
+
onCancelDraft(): void;
|
|
36
|
+
onSubmitRename(path: string, name: string): void;
|
|
37
|
+
onCancelRename(): void;
|
|
38
|
+
onDragStartRow(path: string, isDirectory: boolean, e: DragEvent): void;
|
|
39
|
+
onDragEndRow(): void;
|
|
40
|
+
}
|
|
41
|
+
export declare function TreeNode({ row, active, selected, dropTarget, gitStatus, hidden, isRoot, onToggle, onOpenFile, onContextMenu, onSubmitDraft, onCancelDraft, onSubmitRename, onCancelRename, onDragStartRow, onDragEndRow, }: TreeNodeProps): import("react").JSX.Element;
|
|
42
|
+
//# sourceMappingURL=TreeNode.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TreeRenameRow — the inline rename editor rendered in place of the row being renamed
|
|
3
|
+
* (`file-tree.ts`'s `RenameRow`). Mirrors `TreeDraftRow`'s division of labour: owns the input's
|
|
4
|
+
* local text state so `TreeNode` stays hook-free and presentational; submits the trimmed name up
|
|
5
|
+
* to `FileExplorer` via `onSubmit`, or discards the edit via `onCancel` on Escape/blur/unchanged-
|
|
6
|
+
* or-empty submit.
|
|
7
|
+
*/
|
|
8
|
+
import { type CSSProperties } from "react";
|
|
9
|
+
export interface TreeRenameRowProps {
|
|
10
|
+
/** Current basename, pre-filled as the input's initial value. */
|
|
11
|
+
name: string;
|
|
12
|
+
isDirectory: boolean;
|
|
13
|
+
indentStyle: CSSProperties;
|
|
14
|
+
/** Called with the trimmed name once it is non-empty and actually different from `name`. */
|
|
15
|
+
onSubmit(name: string): void;
|
|
16
|
+
onCancel(): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function TreeRenameRow({ name, isDirectory, indentStyle, onSubmit, onCancel, }: TreeRenameRowProps): import("react").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=TreeRenameRow.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VideoViewer — renders a binary video file via the file-transfer binary download
|
|
3
|
+
* (`useFileDownload`) into a native `<video>` element (POC_TO_APP_PLAN_UI.md §4.5 follow-up:
|
|
4
|
+
* modular file preview).
|
|
5
|
+
*/
|
|
6
|
+
import type { ViewerProps } from "./viewer-registry.js";
|
|
7
|
+
export declare function VideoViewer({ path, workspaceCwd }: ViewerProps): import("react").JSX.Element | null;
|
|
8
|
+
//# sourceMappingURL=VideoViewer.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `file_create_request` caller for the creation affordances (workspace-picker "new folder",
|
|
3
|
+
* the Files tree's inline "new file"/"new folder" draft row, and the molecule viewer claiming a
|
|
4
|
+
* name for a freshly built polymer) — one place for the wire call and the server error-code →
|
|
5
|
+
* user-facing message mapping.
|
|
6
|
+
*/
|
|
7
|
+
import type { PiStudioClient } from "@av-pi-studio/client";
|
|
8
|
+
export type CreateEntryKind = "file" | "directory";
|
|
9
|
+
/**
|
|
10
|
+
* Thrown by {@link createEntry}. Carries the raw server `code` alongside the user-facing
|
|
11
|
+
* `message`, because one caller has to branch on it rather than just render it: the molecule
|
|
12
|
+
* viewer's polymer build walks candidate names past `exists` until one is free
|
|
13
|
+
* (`polymer-file.ts`), and matching on the rendered prose instead would break the moment the
|
|
14
|
+
* wording changes.
|
|
15
|
+
*/
|
|
16
|
+
export declare class CreateEntryError extends Error {
|
|
17
|
+
readonly code: string;
|
|
18
|
+
constructor(code: string, message: string);
|
|
19
|
+
}
|
|
20
|
+
/** Create an empty file or a directory named `name` inside `parentPath`; returns its absolute path.
|
|
21
|
+
* Throws an Error carrying a user-facing message on failure. */
|
|
22
|
+
export declare function createEntry(client: PiStudioClient, parentPath: string, name: string, kind: CreateEntryKind): Promise<string>;
|
|
23
|
+
//# sourceMappingURL=create-entry.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `file_delete_request` caller — one place for the wire call and the server error-code →
|
|
3
|
+
* user-facing message mapping, structured the same way as its siblings `create-entry.ts`,
|
|
4
|
+
* `write-file.ts` and `move-entry.ts`.
|
|
5
|
+
*
|
|
6
|
+
* Recursive and unconfirmed server-side (`FileExplorerService.deleteFile`): confirming a
|
|
7
|
+
* destructive delete with the user is the caller's job, not this module's.
|
|
8
|
+
*
|
|
9
|
+
* Callers own their own cache invalidation and tab cleanup — those differ per call site (the
|
|
10
|
+
* context menu closes every tab under the deleted prefix; the polymer build is rolling back a file
|
|
11
|
+
* no tab ever saw).
|
|
12
|
+
*/
|
|
13
|
+
import type { PiStudioClient } from "@av-pi-studio/client";
|
|
14
|
+
/** Delete the file or directory at `path`. Throws an Error carrying a user-facing message on
|
|
15
|
+
* failure. */
|
|
16
|
+
export declare function deleteEntry(client: PiStudioClient, path: string): Promise<void>;
|
|
17
|
+
//# sourceMappingURL=delete-entry.d.ts.map
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure tree-flattening for the Files tab (POC_TO_APP_PLAN_UI.md §4.7 tree-view follow-up).
|
|
3
|
+
* `FileExplorer.tsx` owns `expanded` (`explorer-store.ts`) and per-path listings
|
|
4
|
+
* (`useExplorerTree`); this module just walks the two into the ordered row list the virtualizer
|
|
5
|
+
* renders — no React, no store access, so it's cheap to unit-test in isolation.
|
|
6
|
+
*
|
|
7
|
+
* The workspace root is the tree's first row — a collapsible directory row naming the workspace
|
|
8
|
+
* cwd, with its children at depth 1. Nothing renders above it: this is a workspace-scoped
|
|
9
|
+
* browser (§4.7), not a general filesystem browser.
|
|
10
|
+
*/
|
|
11
|
+
import type { ExplorerTreeEntry } from "../../hooks/use-explorer-tree.js";
|
|
12
|
+
interface DirRow {
|
|
13
|
+
kind: "directory";
|
|
14
|
+
/** Absolute path — also the row's stable key and the `explorer-store` toggle/query key. */
|
|
15
|
+
path: string;
|
|
16
|
+
name: string;
|
|
17
|
+
depth: number;
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface FileRow {
|
|
21
|
+
kind: "file";
|
|
22
|
+
path: string;
|
|
23
|
+
name: string;
|
|
24
|
+
depth: number;
|
|
25
|
+
}
|
|
26
|
+
/** A directory's listing is loading, rendered indented under it — not itself
|
|
27
|
+
* expandable/clickable. `path` is the *directory's* path, not a real file/dir on disk — it
|
|
28
|
+
* deliberately collides with that directory's own row, which is why row identity for React goes
|
|
29
|
+
* through `rowKey` (below) rather than `path`. */
|
|
30
|
+
interface LoadingRow {
|
|
31
|
+
kind: "loading";
|
|
32
|
+
path: string;
|
|
33
|
+
depth: number;
|
|
34
|
+
}
|
|
35
|
+
/** A directory's listing failed to load. Same non-interactive placement as `LoadingRow`. */
|
|
36
|
+
interface ErrorRow {
|
|
37
|
+
kind: "error";
|
|
38
|
+
path: string;
|
|
39
|
+
depth: number;
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
42
|
+
/** The inline "new file"/"new folder" name-entry row. `path` is synthetic (never a real
|
|
43
|
+
* filesystem path) so it can't be mistaken for one by the row-identity comparisons that DO key
|
|
44
|
+
* off `path` — the drop-target highlight and the active-file highlight in `FileExplorer.tsx`. */
|
|
45
|
+
interface DraftRow {
|
|
46
|
+
kind: "draft";
|
|
47
|
+
path: string;
|
|
48
|
+
depth: number;
|
|
49
|
+
draftKind: "file" | "directory";
|
|
50
|
+
parentPath: string;
|
|
51
|
+
}
|
|
52
|
+
/** A real tree row replaced in place by its rename editor. `path` and `name` are the row's
|
|
53
|
+
* *current* values; `isDirectory` keeps the correct icon while editing. Unlike `DraftRow`,
|
|
54
|
+
* `path` here is the real filesystem path — the editor stands in for that exact row. */
|
|
55
|
+
interface RenameRow {
|
|
56
|
+
kind: "rename";
|
|
57
|
+
path: string;
|
|
58
|
+
depth: number;
|
|
59
|
+
name: string;
|
|
60
|
+
isDirectory: boolean;
|
|
61
|
+
}
|
|
62
|
+
export type TreeRow = DirRow | FileRow | LoadingRow | ErrorRow | DraftRow | RenameRow;
|
|
63
|
+
/**
|
|
64
|
+
* Stable, collision-free React/virtualizer key for a row.
|
|
65
|
+
*
|
|
66
|
+
* `path` alone is NOT unique: a `loading`/`error` row carries its *directory's* path, so an
|
|
67
|
+
* expanded-but-unsettled directory yields two rows sharing one path — and since the root is now
|
|
68
|
+
* a row of its own, that pair is on screen during every workspace's first paint. Duplicate keys
|
|
69
|
+
* make React orphan one of the two nodes instead of replacing it, which is exactly the "ghost
|
|
70
|
+
* text stacked on the root folder name" symptom.
|
|
71
|
+
*/
|
|
72
|
+
export declare function rowKey(row: TreeRow): string;
|
|
73
|
+
/** Which directory has an in-progress inline create row, and what kind it is. */
|
|
74
|
+
export interface TreeDraft {
|
|
75
|
+
parentPath: string;
|
|
76
|
+
kind: "file" | "directory";
|
|
77
|
+
}
|
|
78
|
+
/** Join a directory and a basename, tolerating a trailing slash on `dir`. Exported so
|
|
79
|
+
* `FileExplorer.tsx`'s rename commit can compute a same-parent destination without a second copy
|
|
80
|
+
* of this logic (rename is not a `resolveMoveTarget` drop target — see `applyMove`'s caller). */
|
|
81
|
+
export declare function joinPath(dir: string, name: string): string;
|
|
82
|
+
/**
|
|
83
|
+
* Flatten the tree rooted at `rootPath` into the ordered rows currently visible.
|
|
84
|
+
*
|
|
85
|
+
* The root is itself the first row — a real, collapsible directory row whose children sit at
|
|
86
|
+
* depth 1 beneath it, so the workspace being browsed is always named on screen. It is never
|
|
87
|
+
* substituted by a rename row: renaming/deleting the workspace root is not offered (its row
|
|
88
|
+
* opens the background-variant context menu, `FileExplorer.tsx`).
|
|
89
|
+
*/
|
|
90
|
+
export declare function flattenTree(rootPath: string, expanded: Set<string>, tree: Map<string, ExplorerTreeEntry>, draft?: TreeDraft | null, renamingPath?: string | null): TreeRow[];
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=file-tree.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git-status tinting index for the Files tree — maps an absolute tree-row path to the colour it
|
|
3
|
+
* should be rendered in, VS Code style (added = green, modified = amber, deleted = red), with
|
|
4
|
+
* directories inheriting the status of anything changed beneath them however deeply nested.
|
|
5
|
+
*
|
|
6
|
+
* The data is already live: `StatusBar` owns the single `checkout_status_subscribe` for the active
|
|
7
|
+
* workspace and pushes every projection into `git-store`, so this module is pure derivation over
|
|
8
|
+
* `useGitStore.changes` — no extra RPC, no server change.
|
|
9
|
+
*
|
|
10
|
+
* Two mismatches with the tree make this more than a `Set` lookup:
|
|
11
|
+
* - `ChangeEntry.path` is **relative to the workspace root**, `TreeRow.path` is absolute. The
|
|
12
|
+
* explorer's `rootPath` is the resolved form of the same cwd the status subscription uses
|
|
13
|
+
* (both derive from `tab-store`'s `activeWorkspaceCwd`), so joining is safe.
|
|
14
|
+
* - `git status --porcelain=v2` runs with the default `-unormal`, which **collapses a wholly
|
|
15
|
+
* untracked directory into one `dir/` entry** instead of listing its files. Descendants of such
|
|
16
|
+
* a directory therefore need a prefix match, not an exact one.
|
|
17
|
+
*/
|
|
18
|
+
import type { ChangeEntry } from "../../stores/git-store.js";
|
|
19
|
+
export type GitRowStatus = "added" | "modified" | "deleted";
|
|
20
|
+
/** Status to tint a tree row with; `undefined` for clean, ignored, or non-repo paths. */
|
|
21
|
+
export type GitStatusLookup = (path: string) => GitRowStatus | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Build the row -> status lookup for a tree rooted at `rootPath` from the flat change list.
|
|
24
|
+
* Returns a constant `undefined` lookup when there is no root or nothing has changed, so the
|
|
25
|
+
* common clean-checkout case allocates nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildGitStatusLookup(rootPath: string, changes: ChangeEntry[]): GitStatusLookup;
|
|
28
|
+
/** Whether a tree row is gitignored. */
|
|
29
|
+
export type IgnoredMatcher = (path: string) => boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Build the "is this row gitignored?" predicate from `git-store.ignored`. Same two-shape input as
|
|
32
|
+
* the status lookup: plain files match exactly, while a wholly ignored directory arrives collapsed
|
|
33
|
+
* as `dir/` (git stops walking there) and therefore also claims everything beneath it — which is
|
|
34
|
+
* the case that matters, since `node_modules/` and `dist/` are exactly what users want ghosted.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildIgnoredMatcher(rootPath: string, ignored: string[]): IgnoredMatcher;
|
|
37
|
+
//# sourceMappingURL=git-status-index.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `html-asset-loader` — framework-free fetch orchestration for local-asset inlining
|
|
3
|
+
* (`html-assets.ts`'s pure core, task-001): turns a document's already-confined local-asset refs
|
|
4
|
+
* into `data:` URIs over the existing binary file-transfer path, with bounded parallelism, the
|
|
5
|
+
* shared byte caps, and one nested pass into an inlined stylesheet's own `url(...)` references.
|
|
6
|
+
*
|
|
7
|
+
* Framework-free by design (no React, no TanStack Query) so it is unit-testable with an injected
|
|
8
|
+
* fake fetch — no network, no DOM — mirroring `use-inline-image.ts`'s `loadInlineImage` split
|
|
9
|
+
* between the effect body and the hook that drives it. `HtmlViewer` (task-002) wires this to
|
|
10
|
+
* `transferFor(daemon).download(path)` behind a `useQuery`.
|
|
11
|
+
*
|
|
12
|
+
* A fetch failure — network error, file gone, or simply not connected — degrades only the refs
|
|
13
|
+
* that shared that one fetch to `"fetch-failed"`; it never rejects the whole bundle. The document
|
|
14
|
+
* still renders, unstyled/unscripted for those refs, with a "not inlined" note listing them.
|
|
15
|
+
*/
|
|
16
|
+
import { type ConfinedRef } from "./html-assets.js";
|
|
17
|
+
export type ByteFetch = (path: string) => Promise<Uint8Array>;
|
|
18
|
+
export interface SkippedRef {
|
|
19
|
+
raw: string;
|
|
20
|
+
reason: "external" | "outside-workspace" | "unsupported" | "over-cap" | "fetch-failed";
|
|
21
|
+
}
|
|
22
|
+
export interface AssetBundle {
|
|
23
|
+
/** Raw ref string → `data:` URI, ready for `assembleHtmlPreview`'s `assets` option. */
|
|
24
|
+
assets: Record<string, string>;
|
|
25
|
+
skipped: SkippedRef[];
|
|
26
|
+
}
|
|
27
|
+
export interface AssetLoaderContext {
|
|
28
|
+
/** The confinement root a nested (stylesheet-internal) ref is checked against — the same root
|
|
29
|
+
* the top-level confined refs were already checked against. */
|
|
30
|
+
root: string;
|
|
31
|
+
homeDir: string | null;
|
|
32
|
+
fetchBytes: ByteFetch;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetches and inlines every confined local ref in `confined` (skip entries pass through
|
|
36
|
+
* unchanged), enforcing `ASSET_LIMITS` as bytes arrive. A ref confined with `context: "style"`
|
|
37
|
+
* gets one extra pass: its own `url(...)` references are extracted, confined against `ctx.root`
|
|
38
|
+
* from *the stylesheet's own directory* (not the top-level document's), fetched under the same
|
|
39
|
+
* caps and pool, and rewritten back into the stylesheet before it is inlined — recursion stops
|
|
40
|
+
* there by construction, since a CSS-extracted ref is always `"image"`/`"font"`, never `"style"`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function loadHtmlAssetBundle(confined: readonly ConfinedRef[], ctx: AssetLoaderContext): Promise<AssetBundle>;
|
|
43
|
+
//# sourceMappingURL=html-asset-loader.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `html-assets` — pure, DOM-free core of local-asset inlining for the HTML preview (sprint-064):
|
|
3
|
+
* finds a previewed document's local asset references, confines them to the workspace root, and
|
|
4
|
+
* rewrites resolved substitutions back into the document (and into an already-fetched stylesheet's
|
|
5
|
+
* own `url(...)` references, one nested level). No fetching, no React — `HtmlViewer`'s asset loader
|
|
6
|
+
* (task-002) supplies the `assets` map this module's rewrite functions consume, over the existing
|
|
7
|
+
* binary file-transfer path.
|
|
8
|
+
*
|
|
9
|
+
* Two invariants this module exists to protect:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Confinement is a security gate, not a convenience filter.** Remote loading is on by default
|
|
12
|
+
* (`html-sandbox.ts`), so a document naming `../../../.ssh/id_rsa` and fetched on its behalf
|
|
13
|
+
* could read the inlined bytes back out of its own `data:` URI and post them anywhere. The gate
|
|
14
|
+
* percent-decodes a candidate **exactly once, non-throwing** — *before* any resolution or
|
|
15
|
+
* normalization — then resolves it against the document's directory, lexically collapses `.`/
|
|
16
|
+
* `..` segments (`lib/paths.ts`'s `collapseDotSegments`), and finally requires the result to sit
|
|
17
|
+
* under the confinement root via a segment-aware check (`path === root ||
|
|
18
|
+
* path.startsWith(root + "/")`, never a bare string prefix, which would wrongly accept a
|
|
19
|
+
* `/ws-evil` sibling of `/ws`). The decode-before-normalize order is load-bearing: the reverse
|
|
20
|
+
* order lets `foo%2F..%2F..%2F..%2Fetc%2Fpasswd` pass the root check as one opaque path segment
|
|
21
|
+
* (no literal `/`) and only decode back into a real traversal afterward.
|
|
22
|
+
* 2. **Rewriting is best-effort presentation, never a boundary.** This package's test runner has no
|
|
23
|
+
* DOM (`AGENTS.md`'s testing convention), so every scan here is a regex-based tag/attribute
|
|
24
|
+
* matcher, not an HTML/CSS parser — a missed ref just degrades to the pre-sprint outcome
|
|
25
|
+
* (unstyled/unscripted/broken image), never a security hole, because the `sandbox` attribute
|
|
26
|
+
* (not this module) is what actually isolates the previewed document.
|
|
27
|
+
*/
|
|
28
|
+
/** One candidate local-asset reference found in the document (or, for `context: "font"`/`"image"`
|
|
29
|
+
* origin, in an already-inlined stylesheet's `url(...)`). `raw` is matched *as authored* — HTML
|
|
30
|
+
* entities (`a&b.png`) are never decoded, so such a ref simply fails to resolve to a real file
|
|
31
|
+
* later (best-effort, per invariant 2 above), and no entity-decoding step may be added here. */
|
|
32
|
+
export interface AssetRef {
|
|
33
|
+
raw: string;
|
|
34
|
+
context: "style" | "script" | "image" | "media" | "font";
|
|
35
|
+
}
|
|
36
|
+
export type ConfinedRef = {
|
|
37
|
+
kind: "local";
|
|
38
|
+
raw: string;
|
|
39
|
+
path: string;
|
|
40
|
+
context: AssetRef["context"];
|
|
41
|
+
} | {
|
|
42
|
+
kind: "skip";
|
|
43
|
+
raw: string;
|
|
44
|
+
reason: "external" | "outside-workspace" | "unsupported";
|
|
45
|
+
};
|
|
46
|
+
/** Caps enforced before any fetch, expressed once here so a change never needs a second edit at
|
|
47
|
+
* the call site (`HtmlViewer`'s asset loader, task-002, drives `withinAssetCaps` as bytes arrive). */
|
|
48
|
+
export declare const ASSET_LIMITS: {
|
|
49
|
+
readonly maxCount: 64;
|
|
50
|
+
readonly maxBytesPerAsset: number;
|
|
51
|
+
readonly maxBytesTotal: number;
|
|
52
|
+
};
|
|
53
|
+
/** Pure cap predicate: `candidateBytes` may be inlined given `countSoFar` assets and
|
|
54
|
+
* `totalBytesSoFar` bytes already committed. The loader stops inlining (reports the remainder
|
|
55
|
+
* skipped) the first time this returns `false`, rather than assembling an over-cap document. */
|
|
56
|
+
export declare function withinAssetCaps(countSoFar: number, totalBytesSoFar: number, candidateBytes: number): boolean;
|
|
57
|
+
/** The confinement root for a document at `docDir`: the expanded workspace root, *narrowed to
|
|
58
|
+
* `docDir`* when that root is the home directory itself. A tab with no real workspace falls back
|
|
59
|
+
* to `cwd = "~"` (`FilePanel.tsx`); with all of `$HOME` as the root, `~/.ssh/id_rsa` would sit
|
|
60
|
+
* *inside* it and the gate would be vacuous exactly where it matters most. */
|
|
61
|
+
export declare function confinementRoot(docDir: string, workspaceRoot: string, homeDir: string | null): string;
|
|
62
|
+
/**
|
|
63
|
+
* Classifies one raw ref against the confinement root. `homeDir`, when supplied, expands a
|
|
64
|
+
* tilde-prefixed ref *authored inside the document itself* (`src="~/logo.png"`) via the same
|
|
65
|
+
* `normalizeCwd` every other tilde-workspace consumer uses — distinct from `workspaceCwd`'s own
|
|
66
|
+
* tilde, which is already expanded by the caller before `root` is computed (`ViewerProps`'s
|
|
67
|
+
* contract). Omitted (`null`), a tilde-prefixed ref cannot be resolved and is skipped as
|
|
68
|
+
* `"unsupported"` rather than silently matched against an unexpanded string.
|
|
69
|
+
*/
|
|
70
|
+
export declare function confineAssetRef(raw: string, docDir: string, root: string, context: AssetRef["context"], homeDir?: string | null): ConfinedRef;
|
|
71
|
+
export declare function mimeForAssetPath(path: string): string;
|
|
72
|
+
export declare function dataUri(mimeType: string, bytes: Uint8Array): string;
|
|
73
|
+
/**
|
|
74
|
+
* Finds every local-asset-candidate reference in the document's scanned attribute contexts,
|
|
75
|
+
* de-duplicated and in first-occurrence order. Values with an explicit scheme, a protocol-relative
|
|
76
|
+
* `//`, a fragment-only `#`, or empty/whitespace are excluded here (the "Local" in this function's
|
|
77
|
+
* name) — `confineAssetRef` independently re-checks the same conditions, since it is a standalone
|
|
78
|
+
* exported function nothing should trust extraction alone to have filtered.
|
|
79
|
+
*/
|
|
80
|
+
export declare function extractLocalAssetRefs(source: string): AssetRef[];
|
|
81
|
+
/**
|
|
82
|
+
* Substitutes resolved local-asset refs back into the document — the same tag/attribute contexts
|
|
83
|
+
* `extractLocalAssetRefs` scans, so a ref that was never a candidate for inlining (an unscanned
|
|
84
|
+
* attribute, or plain document text that merely happens to match a ref's text) is never touched.
|
|
85
|
+
* `srcset` entries are rewritten per-candidate and rejoined, never matched as a whole attribute
|
|
86
|
+
* value. A no-op (returns `source` unchanged) when `assets` is empty.
|
|
87
|
+
*/
|
|
88
|
+
export declare function rewriteHtmlAssetRefs(source: string, assets: Readonly<Record<string, string>>): string;
|
|
89
|
+
/** Finds every local-asset-candidate `url(...)` in one stylesheet's text, de-duplicated and in
|
|
90
|
+
* first-occurrence order — the CSS-side counterpart of `extractLocalAssetRefs`, used by the asset
|
|
91
|
+
* loader (task-002) to fetch an inlined stylesheet's own references one level deep. */
|
|
92
|
+
export declare function extractCssUrlRefs(css: string): AssetRef[];
|
|
93
|
+
/** Substitutes resolved local-asset refs into a stylesheet's `url(...)` occurrences. A no-op
|
|
94
|
+
* (returns `css` unchanged) when `assets` is empty; an occurrence with no matching key is left
|
|
95
|
+
* exactly as authored (original quoting preserved for the untouched case). */
|
|
96
|
+
export declare function rewriteCssUrls(css: string, assets: Readonly<Record<string, string>>): string;
|
|
97
|
+
//# sourceMappingURL=html-assets.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `html-sandbox` — pure policy module for the HTML preview iframe: the frozen sandbox token list,
|
|
3
|
+
* the network-blocking CSP, the base-URL neutralization href, and `assembleHtmlPreview`, the
|
|
4
|
+
* function that turns a raw HTML document into the `srcdoc` string the iframe actually loads.
|
|
5
|
+
*
|
|
6
|
+
* Two invariants this module exists to protect, both written down at the point most likely to be
|
|
7
|
+
* "fixed" into a regression later:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Never `allow-same-origin`.** Paired with `allow-scripts` (needed so the previewed document
|
|
10
|
+
* can run its own inline/CDN scripts) it re-grants the previewed document the app's own origin:
|
|
11
|
+
* its DOM, its `localStorage` (which holds the daemon password and connection state), and its
|
|
12
|
+
* live authenticated WebSocket. `HTML_SANDBOX_TOKENS` is a single frozen constant, guarded by
|
|
13
|
+
* `html-sandbox.test.ts` asserting `allow-same-origin`, every `allow-top-navigation*` form, and
|
|
14
|
+
* `allow-popups` never appear.
|
|
15
|
+
* 2. **The CSP here is a network policy, never the isolation boundary.** The `sandbox` attribute
|
|
16
|
+
* alone is what keeps the previewed document out of the app — measured in headless Chromium,
|
|
17
|
+
* 2026-08-19: with `sandbox="allow-scripts"` and no `allow-same-origin`, the child's
|
|
18
|
+
* `location.origin` is `"null"` and both `parent.document` and `localStorage` throw
|
|
19
|
+
* `SecurityError`, independent of any CSP. `HTML_PREVIEW_BLOCKING_CSP` only decides whether the
|
|
20
|
+
* document may reach the *network* — a per-tab convenience toggle, not a safety mechanism.
|
|
21
|
+
*/
|
|
22
|
+
/** The iframe's `sandbox` attribute token list. `allow-scripts` only — see invariant 1 above. */
|
|
23
|
+
export declare const HTML_SANDBOX_TOKENS: readonly string[];
|
|
24
|
+
/** Injected as `<base href>` when the source document declares none of its own — keeps an
|
|
25
|
+
* un-inlined relative ref off the app's own origin (see `assembleHtmlPreview`'s doc comment). */
|
|
26
|
+
export declare const PREVIEW_BASE_HREF = "https://pi-studio-preview.invalid/";
|
|
27
|
+
/**
|
|
28
|
+
* Injected as a `<meta http-equiv="Content-Security-Policy">` when the "Block remote resources"
|
|
29
|
+
* toggle is on. Every directive an inlined asset can hit carries `data:` alongside the directive's
|
|
30
|
+
* own scheme, because sprint-064 inlines every asset kind as a `data:` URI and the blocking policy
|
|
31
|
+
* must not break its own inlined content — measured while implementing (spec `TODO(verify)`):
|
|
32
|
+
* `data:` subresources load with no CSP at all, and under this policy `style-src` needs `data:`
|
|
33
|
+
* explicitly (a `<link href="data:text/css,…">` stylesheet is not covered by `'unsafe-inline'`,
|
|
34
|
+
* which only governs literal inline `<style>`/`style=""`), and likewise for `script-src` (a
|
|
35
|
+
* `data:`-sourced `<script src>`), `img-src`, `font-src` and `media-src`.
|
|
36
|
+
*/
|
|
37
|
+
export declare const HTML_PREVIEW_BLOCKING_CSP: string;
|
|
38
|
+
export interface AssembleHtmlPreviewOptions {
|
|
39
|
+
/** Resolved local-asset substitutions (sprint-064): raw ref string → `data:` URI. Applied as an
|
|
40
|
+
* attribute-value substitution regardless of sprint; empty/absent here is a no-op. */
|
|
41
|
+
assets?: Readonly<Record<string, string>>;
|
|
42
|
+
/** Injects `HTML_PREVIEW_BLOCKING_CSP` as the first `<head>` child when true. */
|
|
43
|
+
blockRemote: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Assembles the `srcdoc` string the preview iframe loads: substitutes any supplied local-asset
|
|
47
|
+
* refs, optionally injects the blocking CSP as the very first `<head>` child, and — only when the
|
|
48
|
+
* source declares no `<base>` of its own — injects the `.invalid` neutralization base plus the
|
|
49
|
+
* fragment-anchor click interceptor that keeps in-page `#` links working under it.
|
|
50
|
+
*
|
|
51
|
+
* `srcdoc`'s base URL is the *parent app's own URL* (measured), so any ref this function does not
|
|
52
|
+
* substitute would otherwise resolve against the app origin, where the SPA's history-fallback
|
|
53
|
+
* routing answers with `index.html` (200 `text/html`) — a silently wrong response, not a clean
|
|
54
|
+
* failure. The injected `.invalid` base turns that into a clean failure instead, and is skipped
|
|
55
|
+
* entirely when the document already declares its own `<base>` (the author's intent wins).
|
|
56
|
+
*
|
|
57
|
+
* Head-less documents get a synthesized `<head>` inserted right after `<html>` (or prepended, if
|
|
58
|
+
* the document has no `<html>` tag either); `<head>` detection is case-insensitive, so an
|
|
59
|
+
* uppercase `<HEAD>` is still found and used rather than triggering a second, conflicting one.
|
|
60
|
+
*/
|
|
61
|
+
export declare function assembleHtmlPreview(source: string, opts: AssembleHtmlPreviewOptions): string;
|
|
62
|
+
//# sourceMappingURL=html-sandbox.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reload-gating decision for the molecule viewer's live reload (task-006/007). Kept in its
|
|
3
|
+
* own module — like `molecule-source.ts` — so it is unit-testable without importing
|
|
4
|
+
* `@molviewer/core` (which touches `document` at module scope).
|
|
5
|
+
*
|
|
6
|
+
* The gate is intentionally just "are there unsaved in-viewer edits right now" — no timestamp or
|
|
7
|
+
* echo-suppression window. A future in-viewer "Save" cannot self-trigger a clobber: a save can
|
|
8
|
+
* only happen while `modified` is `true`, and the earliest it flips back to `false` is after the
|
|
9
|
+
* write completes — at which point a reload triggered by that same write is a content no-op.
|
|
10
|
+
*/
|
|
11
|
+
export interface ShouldApplyRefreshArgs {
|
|
12
|
+
/** Timestamp of the last `file_changed` push for this path, or `null` if none yet. */
|
|
13
|
+
changedAt: number | null;
|
|
14
|
+
/** Timestamp of the last push this component actually reloaded for, or `null`. */
|
|
15
|
+
lastAppliedAt: number | null;
|
|
16
|
+
/** Whether the viewer currently has unsaved in-viewer edits. */
|
|
17
|
+
modified: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function shouldApplyRefresh({ changedAt, lastAppliedAt, modified, }: ShouldApplyRefreshArgs): boolean;
|
|
20
|
+
//# sourceMappingURL=molecule-reload.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure derivation of molviewer's `{ url, name }` source shape, kept in its own module (no
|
|
3
|
+
* `@molviewer/core` import) so it is unit-testable without pulling in the WebGL viewer bundle —
|
|
4
|
+
* merely importing `@molviewer/core` touches `document` at module scope, which jsdom-less/node
|
|
5
|
+
* test environments don't have.
|
|
6
|
+
*/
|
|
7
|
+
import type { MolViewerSource } from "@molviewer/core";
|
|
8
|
+
/** `name` is load-bearing: molviewer resolves the file format from its extension. */
|
|
9
|
+
export declare function moleculeSource(path: string | null, objectUrl: string | null | undefined): MolViewerSource | null;
|
|
10
|
+
//# sourceMappingURL=molecule-source.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MOLVIEWER_THEME — pi-studio's background/foreground override for `<MolViewer>`'s `theme` prop.
|
|
3
|
+
*
|
|
4
|
+
* `theme` is documented as raw CSS custom properties applied inline to the component's root
|
|
5
|
+
* (`docs/molviewer-core-doc.md` § UI composition) — a completely separate knob from
|
|
6
|
+
* `initialView.backgroundColor` (the WebGL scene's clear color) and `colorScheme` (per-atom
|
|
7
|
+
* coloring). Neither of those is touched here; this only changes chrome DOM elements (sidebar,
|
|
8
|
+
* toolbars, panels, buttons, dropdowns), never the rendered molecule itself.
|
|
9
|
+
*
|
|
10
|
+
* Values are `var(--pi-color-*)` references, not resolved hex — a CSS custom property may hold
|
|
11
|
+
* another `var()` reference and it chains through the cascade like any other value, so
|
|
12
|
+
* molviewer's chrome tracks pi-studio's live theme (light/dark, custom accent) automatically,
|
|
13
|
+
* with no React re-render needed when appearance settings change.
|
|
14
|
+
*
|
|
15
|
+
* Scope is deliberately narrow, per product decision: panel backgrounds, primary text, and —
|
|
16
|
+
* where molviewer exposes an equivalent — the surfaces of its own interactive controls (buttons)
|
|
17
|
+
* and popovers (dropdowns/menus), all mapped onto pi-studio's existing surface/hover/border scale
|
|
18
|
+
* (`Button.module.css`, `Select.module.css`, the `.item[data-highlighted]` hover pattern used
|
|
19
|
+
* across every pi-studio dropdown). Molviewer's semantic/interactive colors that pi-studio has no
|
|
20
|
+
* equivalent for — accent, selection, danger/success/warning, its five-step muted text scale,
|
|
21
|
+
* axis colors — are its own design language and are left untouched.
|
|
22
|
+
*
|
|
23
|
+
* Molviewer's shipped defaults, for reference (`@molviewer/core/dist/style.css`'s `:root` block):
|
|
24
|
+
* --canvas #0a0c10 --well #0e1116 --recess #0f1217 --chrome #12151b
|
|
25
|
+
* --control #1e232c --control-hover #262c37 --control-strong-hover #2b323e
|
|
26
|
+
* --popover #171b22 --popover-item-hover #232935 --row-hover #161a21
|
|
27
|
+
* --border-control #333b48 --border-input #2b323e --border-popover #3b4453
|
|
28
|
+
* --text-primary #e6e9ef --text-on-control #dfe5ee
|
|
29
|
+
*/
|
|
30
|
+
export declare const MOLVIEWER_THEME: Record<string, string>;
|
|
31
|
+
//# sourceMappingURL=molecule-theme.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared `file_move_request` caller for the explorer's drag-and-drop move (`FileExplorer.tsx`) —
|
|
3
|
+
* one place for the wire call and the server error-code → user-facing message mapping, structured
|
|
4
|
+
* the same way as the sibling `create-entry.ts`.
|
|
5
|
+
*/
|
|
6
|
+
import type { PiStudioClient } from "@av-pi-studio/client";
|
|
7
|
+
/** Move or rename `path` to `destination`; returns the resolved destination path. Throws an
|
|
8
|
+
* Error carrying a user-facing message on failure. */
|
|
9
|
+
export declare function moveEntry(client: PiStudioClient, path: string, destination: string): Promise<string>;
|
|
10
|
+
//# sourceMappingURL=move-entry.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure status-line formatter shared by drag-move and rename (`FileExplorer.tsx`'s `applyMove`) —
|
|
3
|
+
* both report how many diff tabs a move/rename silently closed. Closing them is correct (a
|
|
4
|
+
* per-path `git diff` on the new path returns empty right after a rename, so the daemon's
|
|
5
|
+
* `--no-index` fallback would render the whole file as additions — features/file-explorer-
|
|
6
|
+
* improvements.md § 9, "Decision (2026-08-03)"); staying *silent* about it was the defect.
|
|
7
|
+
*/
|
|
8
|
+
/** Append a closed-diff-tab count to a move/rename status line. `0` leaves `text` unchanged. */
|
|
9
|
+
export declare function withClosedDiffs(text: string, closedDiffs: number): string;
|
|
10
|
+
//# sourceMappingURL=move-status.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure drop-legality decision for the explorer's internal drag-and-drop move (task-006's handlers
|
|
3
|
+
* become thin call sites over this). The web-client test setup has no jsdom environment, so any
|
|
4
|
+
* rule reachable only through a DOM drag event is effectively untestable — every legality rule
|
|
5
|
+
* therefore lives here, exhaustively unit-tested, rather than inside a drag event handler.
|
|
6
|
+
*/
|
|
7
|
+
export interface MoveTarget {
|
|
8
|
+
/** Directory the drop lands in. */
|
|
9
|
+
destinationDir: string;
|
|
10
|
+
/** Full destination path — `destinationDir` + "/" + basename(sourcePath). */
|
|
11
|
+
destination: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Where a drag of `sourcePath` dropped on `row` would land, or null when the drop is illegal.
|
|
15
|
+
* `rootPath` is the tree root: a drop resolving above it is rejected (the explorer is
|
|
16
|
+
* workspace-scoped).
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveMoveTarget(sourcePath: string, row: {
|
|
19
|
+
kind: string;
|
|
20
|
+
path: string;
|
|
21
|
+
}, rootPath: string): MoveTarget | null;
|
|
22
|
+
/**
|
|
23
|
+
* Directory an OS-file drop on `row` uploads into — a directory row is the target itself, a file
|
|
24
|
+
* row's parent is (files aren't drop containers). `loading`/`error`/`draft` rows have no listing
|
|
25
|
+
* to upload into and are rejected, same as an out-of-workspace resolution.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveUploadTarget(row: {
|
|
28
|
+
kind: string;
|
|
29
|
+
path: string;
|
|
30
|
+
}, rootPath: string): string | null;
|
|
31
|
+
//# sourceMappingURL=move-target.d.ts.map
|