zidane-ui 9.1.16 → 9.1.17
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/dist/adapters/browser-keybindings-host.d.ts +10 -2
- package/dist/adapters/browser-keybindings-host.js +40 -2
- package/dist/adapters/index.d.ts +3 -2
- package/dist/adapters/index.js +3 -2
- package/dist/adapters/server-custom-frame.d.ts +22 -0
- package/dist/adapters/server-custom-frame.js +163 -0
- package/dist/adapters/server-host.js +8 -3
- package/dist/adapters/server-machines-host.js +1 -0
- package/dist/adapters/server-views-host.d.ts +24 -0
- package/dist/adapters/server-views-host.js +78 -0
- package/dist/app/AppHostProvider.d.ts +4 -1
- package/dist/app/AppHostProvider.js +11 -5
- package/dist/app/ModalProvider.js +2 -2
- package/dist/app/NoticeStack.js +1 -1
- package/dist/app/headless/app-host.d.ts +3 -0
- package/dist/app/useConfirm.js +1 -1
- package/dist/appearance/AppearanceProvider.js +1 -1
- package/dist/approvals/ApprovalBar.js +27 -15
- package/dist/approvals/ApprovalShell.js +1 -1
- package/dist/approvals/ApprovalsProvider.js +1 -1
- package/dist/approvals/FileEditApproval.js +1 -1
- package/dist/approvals/HunkPreviews.js +2 -2
- package/dist/approvals/SafelistPanel.js +2 -2
- package/dist/approvals/headless/labels.d.ts +3 -0
- package/dist/approvals/headless/labels.js +3 -0
- package/dist/chat/ChatProvider.js +1 -1
- package/dist/chat/DaemonOrb.js +1 -1
- package/dist/chat/HostBadge.js +1 -1
- package/dist/chat/HostTranscript.js +1 -1
- package/dist/chat/PdfPreview.js +1 -1
- package/dist/chat/RunEstimateChip.js +1 -1
- package/dist/chat/SessionFilterMenu.js +2 -2
- package/dist/chat/SessionList.js +1 -1
- package/dist/chat/SessionListRow.js +2 -2
- package/dist/chat/SessionStreamsProvider.d.ts +3 -1
- package/dist/chat/SessionStreamsProvider.js +6 -2
- package/dist/chat/StatusDot.js +1 -1
- package/dist/chat/TextPreview.js +1 -1
- package/dist/chat/Throbber.js +1 -1
- package/dist/chat/Transcript.d.ts +1 -1
- package/dist/chat/Transcript.js +95 -26
- package/dist/chat/composer/AgentPicker.js +1 -1
- package/dist/chat/composer/AgentPickerDialog.js +1 -1
- package/dist/chat/composer/ApprovalDock.js +1 -1
- package/dist/chat/composer/AttachmentTiles.js +2 -2
- package/dist/chat/composer/Composer.js +1 -1
- package/dist/chat/composer/ComposerBadges.js +2 -2
- package/dist/chat/composer/ComposerControls.js +1 -1
- package/dist/chat/composer/ComposerEditor.js +1 -1
- package/dist/chat/composer/ComposerHostProvider.js +1 -1
- package/dist/chat/composer/ComposerShell.js +1 -1
- package/dist/chat/composer/ContextBreakdown.js +23 -23
- package/dist/chat/composer/ConversationBadges.js +1 -1
- package/dist/chat/composer/DraftPickers.d.ts +38 -0
- package/dist/chat/composer/DraftPickers.js +72 -0
- package/dist/chat/composer/EffortPickerDialog.js +1 -1
- package/dist/chat/composer/HostComposer.js +2 -2
- package/dist/chat/composer/HostContextOrb.js +2 -2
- package/dist/chat/composer/HostModelChainList.js +1 -1
- package/dist/chat/composer/HostPickers.js +1 -1
- package/dist/chat/composer/ImageModelList.js +1 -1
- package/dist/chat/composer/ModelChainList.js +1 -1
- package/dist/chat/composer/ModelChainParts.js +1 -1
- package/dist/chat/composer/ModelChainRow.js +1 -1
- package/dist/chat/composer/ModelChainRows.js +1 -1
- package/dist/chat/composer/ModelOptionsPicker.js +1 -1
- package/dist/chat/composer/ModelPicker.js +2 -2
- package/dist/chat/composer/ModelPickerDialog.js +1 -1
- package/dist/chat/composer/ModelProviderPills.js +1 -1
- package/dist/chat/composer/PickerPill.js +1 -1
- package/dist/chat/composer/ProjectMenu.js +1 -1
- package/dist/chat/composer/PromptHistoryProvider.js +1 -1
- package/dist/chat/composer/RunStatusChip.js +1 -1
- package/dist/chat/composer/attachment-ingest.js +4 -2
- package/dist/chat/composer/heif.d.ts +12 -0
- package/dist/chat/composer/heif.js +115 -0
- package/dist/chat/composer/index.d.ts +5 -3
- package/dist/chat/composer/index.js +4 -2
- package/dist/chat/composer/suggestions.js +1 -1
- package/dist/chat/composer/use-composer-stores.d.ts +3 -1
- package/dist/chat/composer/use-composer-stores.js +7 -2
- package/dist/chat/composer/use-draft-target.d.ts +5 -0
- package/dist/chat/composer/use-draft-target.js +10 -8
- package/dist/chat/composer/use-new-chats-default.d.ts +25 -0
- package/dist/chat/composer/use-new-chats-default.js +32 -0
- package/dist/chat/composer/use-send-prompt.d.ts +11 -1
- package/dist/chat/composer/use-send-prompt.js +5 -3
- package/dist/chat/headless/host.d.ts +9 -0
- package/dist/chat/headless/index.d.ts +5 -4
- package/dist/chat/headless/index.js +5 -3
- package/dist/chat/headless/labels.d.ts +82 -1
- package/dist/chat/headless/labels.js +11 -1
- package/dist/chat/headless/notifications.d.ts +2 -0
- package/dist/chat/headless/notifications.js +1 -0
- package/dist/chat/headless/prompt-origin.d.ts +53 -2
- package/dist/chat/headless/prompt-origin.js +55 -5
- package/dist/chat/headless/session-list.d.ts +79 -0
- package/dist/chat/headless/sidebar/index.js +1 -1
- package/dist/chat/headless/sidebar/labels.d.ts +80 -1
- package/dist/chat/headless/transcript/batch.d.ts +12 -1
- package/dist/chat/headless/transcript/batch.js +47 -1
- package/dist/chat/headless/transcript/collapse.js +11 -0
- package/dist/chat/headless/transcript/fold.js +23 -7
- package/dist/chat/headless/transcript/index.d.ts +3 -3
- package/dist/chat/headless/transcript/index.js +2 -2
- package/dist/chat/headless/transcript/rows.d.ts +31 -2
- package/dist/chat/headless/transcript/select-stops.js +4 -0
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/headless/turn-labels.d.ts +2 -0
- package/dist/chat/headless/turn-labels.js +2 -0
- package/dist/chat/index.d.ts +10 -5
- package/dist/chat/index.js +9 -4
- package/dist/chat/interactions/HostInteractions.js +1 -1
- package/dist/chat/interactions/InboxPanel.js +2 -2
- package/dist/chat/interactions/PlanCard.js +4 -4
- package/dist/chat/interactions/QuestionField.js +2 -2
- package/dist/chat/interactions/QuestionForm.js +1 -1
- package/dist/chat/interactions/SecretInput.js +1 -1
- package/dist/chat/interactions/card-ui.js +1 -1
- package/dist/chat/rich-composer/MentionList.js +1 -1
- package/dist/chat/rich-composer/RichComposer.js +1 -1
- package/dist/chat/sidebar/MainSessionRow.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.js +3 -3
- package/dist/chat/sidebar/SessionSidebar.js +2 -2
- package/dist/chat/sidebar/SidebarDecoration.js +2 -2
- package/dist/chat/sidebar/SidebarFilterMenu.js +1 -1
- package/dist/chat/sidebar/SidebarFooter.js +1 -1
- package/dist/chat/sidebar/SidebarFrame.js +2 -2
- package/dist/chat/sidebar/SidebarGroupHeader.js +3 -3
- package/dist/chat/sidebar/SidebarHostProvider.js +1 -1
- package/dist/chat/sidebar/SidebarRowView.js +1 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +6 -6
- package/dist/chat/sidebar/SpaceSwitcher.js +1 -1
- package/dist/chat/sidebar/SpacesSection.js +2 -2
- package/dist/chat/sidebar/sidebar-live.js +3 -3
- package/dist/chat/transcript/AnsiText.js +4 -4
- package/dist/chat/transcript/AuthFailureCard.js +2 -2
- package/dist/chat/transcript/BadgeMenu.js +1 -1
- package/dist/chat/transcript/CardMarkdown.js +1 -1
- package/dist/chat/transcript/ChipCards.js +1 -1
- package/dist/chat/transcript/CodemodeScript.js +11 -6
- package/dist/chat/transcript/DiffLines.js +1 -1
- package/dist/chat/transcript/EarlierHistory.js +1 -1
- package/dist/chat/transcript/EditDiffBlock.js +1 -1
- package/dist/chat/transcript/FileChip.js +5 -5
- package/dist/chat/transcript/ImageGenerationBlock.js +1 -1
- package/dist/chat/transcript/LazyRow.js +1 -1
- package/dist/chat/transcript/LiveOutput.js +1 -1
- package/dist/chat/transcript/MermaidDiagram.d.ts +68 -2
- package/dist/chat/transcript/MermaidDiagram.js +344 -32
- package/dist/chat/transcript/PromptEcho.js +1 -1
- package/dist/chat/transcript/ProseMarkdown.js +1 -1
- package/dist/chat/transcript/ReferenceText.js +8 -8
- package/dist/chat/transcript/SelectCursor.js +1 -1
- package/dist/chat/transcript/SelectTurnProvider.js +1 -1
- package/dist/chat/transcript/SubagentBlock.js +1 -1
- package/dist/chat/transcript/TranscriptRow.js +20 -5
- package/dist/chat/transcript/TranscriptSearch.js +1 -1
- package/dist/chat/transcript/TurnMenu.js +1 -1
- package/dist/chat/transcript/actions.js +1 -1
- package/dist/chat/transcript/diagrams-scope.d.ts +4 -0
- package/dist/chat/transcript/diagrams-scope.js +11 -0
- package/dist/chat/transcript/extension-renderers.js +1 -1
- package/dist/chat/transcript/fold-attachments.js +1 -1
- package/dist/chat/transcript/fold-status.js +1 -1
- package/dist/chat/transcript/fold-worker.js +1 -1
- package/dist/chat/transcript/fold.js +5 -5
- package/dist/chat/transcript/frame.js +1 -1
- package/dist/chat/transcript/index.d.ts +5 -2
- package/dist/chat/transcript/index.js +5 -2
- package/dist/chat/transcript/markdown.js +95 -14
- package/dist/chat/transcript/messages.js +19 -10
- package/dist/chat/transcript/notices.js +2 -2
- package/dist/chat/transcript/prompt-lines.js +5 -5
- package/dist/chat/transcript/prompt.js +2 -2
- package/dist/chat/transcript/prose.js +1 -1
- package/dist/chat/transcript/renderer-slots.js +1 -1
- package/dist/chat/transcript/renderers.js +3 -3
- package/dist/chat/transcript/row-estimate.js +5 -1
- package/dist/chat/transcript/run-rows.js +2 -2
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/shell-block.js +4 -4
- package/dist/chat/transcript/tasks.d.ts +35 -0
- package/dist/chat/transcript/tasks.js +100 -0
- package/dist/chat/transcript/tool-batch.js +2 -2
- package/dist/chat/transcript/tool-media.js +1 -1
- package/dist/chat/transcript/tool-parts.js +1 -1
- package/dist/chat/transcript/tool-row.js +8 -8
- package/dist/chat/transcript/turn-commands.d.ts +15 -1
- package/dist/chat/transcript/turn-commands.js +43 -4
- package/dist/chat/transcript/use-host-turn-menu.d.ts +25 -0
- package/dist/chat/transcript/use-host-turn-menu.js +57 -0
- package/dist/chat/transcript/use-transcript-rows.js +2 -2
- package/dist/chat/transcript/useStickToBottom.js +1 -1
- package/dist/chat/transcript/useTranscriptSearch.js +1 -1
- package/dist/chat/transcript/user-bash.js +1 -1
- package/dist/chat/transcript/view-scope.d.ts +163 -0
- package/dist/chat/transcript/view-scope.js +224 -0
- package/dist/chat/transcript-options.d.ts +1 -1
- package/dist/chat/transcript-options.js +4 -1
- package/dist/code/CodeHighlightProvider.js +1 -1
- package/dist/code/HighlightedCode.js +1 -1
- package/dist/code/editor/CodeCompletion.js +3 -3
- package/dist/code/editor/CodeEditor.js +1 -1
- package/dist/code/editor/CodeHover.js +1 -1
- package/dist/code/editor/DiffView.js +1 -1
- package/dist/code/editor/EditorColumn.js +1 -1
- package/dist/code/editor/FileIcon.js +1 -1
- package/dist/code/editor/FileTree.js +1 -1
- package/dist/code/editor/FileView.js +1 -1
- package/dist/code/editor/HighlightWorkers.js +2 -2
- package/dist/code/editor/LanguageEditor.js +1 -1
- package/dist/code/editor/environment.js +1 -1
- package/dist/code/editor/find/FindBar.js +1 -1
- package/dist/components/Accordion.d.ts +30 -0
- package/dist/components/Accordion.js +96 -0
- package/dist/components/Breadcrumb.js +1 -1
- package/dist/components/Breakdown.d.ts +82 -0
- package/dist/components/Breakdown.js +212 -0
- package/dist/components/BrowserChrome.js +1 -1
- package/dist/components/BrowserSignIn.js +4 -4
- package/dist/components/Callout.d.ts +29 -0
- package/dist/components/Callout.js +60 -0
- package/dist/components/Checklist.d.ts +53 -0
- package/dist/components/Checklist.js +189 -0
- package/dist/components/ChoiceCards.d.ts +7 -1
- package/dist/components/ChoiceCards.js +11 -7
- package/dist/components/CodeFrame.js +1 -1
- package/dist/components/Compare.d.ts +65 -0
- package/dist/components/Compare.js +242 -0
- package/dist/components/ConfirmDialog.js +1 -1
- package/dist/components/CopyButton.js +1 -1
- package/dist/components/EditableTitle.js +1 -1
- package/dist/components/ErrorBoundary.js +1 -1
- package/dist/components/Form.d.ts +3 -1
- package/dist/components/Form.js +2 -1
- package/dist/components/HowItWorks.js +2 -2
- package/dist/components/IconButton.js +2 -2
- package/dist/components/KeyValue.d.ts +37 -0
- package/dist/components/KeyValue.js +43 -0
- package/dist/components/Lightbox.js +2 -2
- package/dist/components/Menu.js +2 -2
- package/dist/components/Overlay.js +2 -2
- package/dist/components/Progress.d.ts +55 -0
- package/dist/components/Progress.js +94 -0
- package/dist/components/ReorderTabs.js +1 -1
- package/dist/components/RowActionsMenu.js +3 -3
- package/dist/components/RowMenuButton.d.ts +24 -0
- package/dist/components/RowMenuButton.js +42 -0
- package/dist/components/Segmented.js +1 -1
- package/dist/components/Stat.d.ts +105 -0
- package/dist/components/Stat.js +131 -0
- package/dist/components/StepFrame.js +1 -1
- package/dist/components/Steps.d.ts +38 -0
- package/dist/components/Steps.js +49 -0
- package/dist/components/Surface.d.ts +1 -1
- package/dist/components/Surface.js +1 -1
- package/dist/components/SwatchPicker.js +1 -1
- package/dist/components/Table.d.ts +123 -0
- package/dist/components/Table.js +437 -0
- package/dist/components/Tabs.d.ts +41 -0
- package/dist/components/Tabs.js +103 -0
- package/dist/components/ToggleCard.js +3 -3
- package/dist/components/Tooltip.js +2 -2
- package/dist/components/ZidaneMark.js +1 -1
- package/dist/components/ZoomableImage.js +1 -1
- package/dist/components/charts/AreaChart.d.ts +24 -0
- package/dist/components/charts/AreaChart.js +210 -0
- package/dist/components/charts/BarChart.d.ts +112 -0
- package/dist/components/charts/BarChart.js +686 -0
- package/dist/components/charts/LineChart.d.ts +34 -0
- package/dist/components/charts/LineChart.js +299 -0
- package/dist/components/charts/ScatterChart.d.ts +83 -0
- package/dist/components/charts/ScatterChart.js +702 -0
- package/dist/components/charts/Sparkline.d.ts +31 -0
- package/dist/components/charts/Sparkline.js +82 -0
- package/dist/components/charts/Trend.d.ts +86 -0
- package/dist/components/charts/Trend.js +233 -0
- package/dist/components/charts/frame.d.ts +225 -0
- package/dist/components/charts/frame.js +475 -0
- package/dist/components/charts/index.d.ts +10 -0
- package/dist/components/charts/index.js +9 -0
- package/dist/components/charts/interact.d.ts +89 -0
- package/dist/components/charts/interact.js +296 -0
- package/dist/components/charts/measure.d.ts +29 -0
- package/dist/components/charts/measure.js +79 -0
- package/dist/components/charts/xy.d.ts +230 -0
- package/dist/components/charts/xy.js +488 -0
- package/dist/components/charts/zoom-reset.d.ts +7 -0
- package/dist/components/charts/zoom-reset.js +23 -0
- package/dist/components/floating/FloatingSurface.js +1 -1
- package/dist/components/floating/HoverCard.js +2 -2
- package/dist/components/floating/Popover.js +2 -2
- package/dist/components/lazy-part.d.ts +17 -0
- package/dist/components/lazy-part.js +33 -0
- package/dist/components/numbers.d.ts +74 -0
- package/dist/components/numbers.js +157 -0
- package/dist/components/palette/PaletteList.js +5 -5
- package/dist/components/palette/PalettePanel.js +2 -2
- package/dist/core.css +517 -3
- package/dist/dist/index-BUHcyEqA.d.ts +1 -0
- package/dist/dist/{index-BZM8tu4L.d.ts → index-CGCMyhB3.d.ts} +182 -126
- package/dist/dist/index.d.ts +4 -4
- package/dist/dist/sandbox-Cib3Qf4t.d.ts +2 -0
- package/dist/extensions/ExtensionComponent.js +6 -5
- package/dist/extensions/ExtensionDialogHost.js +1 -1
- package/dist/extensions/ExtensionRenderer.js +1 -1
- package/dist/extensions/ExtensionScreen.js +1 -1
- package/dist/extensions/ExtensionSettingsPage.js +1 -1
- package/dist/extensions/ExtensionSettingsSection.js +1 -1
- package/dist/extensions/ExtensionSettingsSidebar.js +1 -1
- package/dist/extensions/ExtensionSlot.js +2 -2
- package/dist/extensions/ExtensionWebview.js +1 -1
- package/dist/extensions/ExtensionsProvider.js +1 -1
- package/dist/extensions/headless/index.d.ts +2 -2
- package/dist/extensions/headless/wire.d.ts +5 -1
- package/dist/extensions/headless/wire.js +2 -1
- package/dist/extensions/links.js +1 -1
- package/dist/files/CodeViewer.js +1 -1
- package/dist/files/DiffFileViewer.js +1 -1
- package/dist/files/DiffsTab.js +2 -2
- package/dist/files/EditorColumn.js +62 -28
- package/dist/files/EditorEnvironmentRoot.js +1 -1
- package/dist/files/FilePreview.d.ts +24 -0
- package/dist/files/FilePreview.js +283 -0
- package/dist/files/FilesProvider.js +1 -1
- package/dist/files/FilesTab.js +2 -2
- package/dist/files/MediaDiff.js +1 -1
- package/dist/files/MediaView.js +1 -1
- package/dist/files/ReviewDraft.js +1 -1
- package/dist/files/ReviewableDiff.js +2 -2
- package/dist/files/SearchPanel.js +2 -2
- package/dist/files/TreeColumn.js +2 -2
- package/dist/files/file-actions.js +1 -0
- package/dist/files/headless/labels.d.ts +5 -0
- package/dist/files/headless/labels.js +5 -0
- package/dist/files/headless/preview.d.ts +44 -0
- package/dist/files/headless/preview.js +103 -0
- package/dist/files/lazy-tabs.js +1 -1
- package/dist/files/useCodeReview.js +1 -1
- package/dist/files/useLsp.js +1 -1
- package/dist/files/useOpenFiles.d.ts +2 -0
- package/dist/files/useOpenFiles.js +14 -0
- package/dist/git/BranchMenu.js +7 -7
- package/dist/git/GitBar.js +1 -1
- package/dist/git/GitProvider.js +1 -1
- package/dist/git/ImportRepoDialog.js +1 -1
- package/dist/git/MoveSessionDialog.js +2 -2
- package/dist/git/RemoteFolderPicker.js +4 -4
- package/dist/git/SyncChip.js +1 -1
- package/dist/git/WherePicker.d.ts +2 -0
- package/dist/git/WherePicker.js +15 -12
- package/dist/git/index.d.ts +1 -1
- package/dist/git/index.js +1 -1
- package/dist/hooks/useDisplayPath.js +1 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +16 -3
- package/dist/keybindings/KeyCommands.js +1 -1
- package/dist/keybindings/KeybindingsProvider.js +4 -2
- package/dist/keybindings/headless/host.d.ts +5 -0
- package/dist/keybindings/headless/overrides.d.ts +2 -1
- package/dist/keybindings/headless/overrides.js +2 -1
- package/dist/keybindings/testing/contract.js +1 -0
- package/dist/labels.d.ts +97 -0
- package/dist/labels.js +104 -1
- package/dist/machines/AddMachineDialog.js +3 -3
- package/dist/machines/AddServerForm.js +1 -1
- package/dist/machines/DaemonMenu.js +3 -3
- package/dist/machines/HostCapabilities.js +5 -5
- package/dist/machines/HostIcon.d.ts +21 -0
- package/dist/machines/HostIcon.js +19 -0
- package/dist/machines/HostSignIn.js +1 -1
- package/dist/machines/HostSyncPanel.js +1 -1
- package/dist/machines/HostsSection.d.ts +27 -1
- package/dist/machines/HostsSection.js +60 -46
- package/dist/machines/MachinesProvider.js +1 -1
- package/dist/machines/ServerCard.d.ts +1 -2
- package/dist/machines/ServerCard.js +4 -9
- package/dist/machines/ServerMachinesPanel.js +161 -196
- package/dist/machines/ServerUpdatePanel.js +94 -111
- package/dist/machines/ShareThisComputerForm.js +1 -1
- package/dist/machines/SyncAccounts.js +1 -1
- package/dist/machines/SyncMarker.js +2 -2
- package/dist/machines/TokensPanel.js +225 -124
- package/dist/machines/headless/index.d.ts +2 -1
- package/dist/machines/headless/index.js +2 -1
- package/dist/machines/headless/labels.d.ts +22 -0
- package/dist/machines/headless/labels.js +25 -0
- package/dist/machines/headless/update-store.d.ts +29 -0
- package/dist/machines/headless/update-store.js +83 -0
- package/dist/machines/index.d.ts +5 -3
- package/dist/machines/index.js +5 -3
- package/dist/machines/server-update.d.ts +23 -0
- package/dist/machines/server-update.js +106 -0
- package/dist/motion/grow.js +1 -1
- package/dist/motion/provider.js +1 -1
- package/dist/motion/roll.js +2 -2
- package/dist/motion/size.js +1 -1
- package/dist/motion/springs.js +1 -1
- package/dist/motion/swap.js +1 -1
- package/dist/motion/title-text.js +2 -2
- package/dist/onboarding/OnboardingFlow.js +1 -1
- package/dist/onboarding/OnboardingProvider.js +1 -1
- package/dist/onboarding/conversation.js +1 -1
- package/dist/onboarding/demos/features.js +1 -1
- package/dist/onboarding/demos/index.js +1 -1
- package/dist/onboarding/demos/tour.js +1 -1
- package/dist/onboarding/headless/labels.d.ts +74 -0
- package/dist/onboarding/index.js +3 -3
- package/dist/onboarding/skills/SkillSourceBrowser.js +1 -1
- package/dist/onboarding/skills/parts.js +1 -1
- package/dist/onboarding/sources/SourceBrowser.js +4 -4
- package/dist/onboarding/steps/ConnectStep.js +1 -1
- package/dist/onboarding/steps/ConnectorsStep.js +3 -3
- package/dist/onboarding/steps/ConversationStep.js +2 -2
- package/dist/onboarding/steps/FeatureExample.js +2 -2
- package/dist/onboarding/steps/ImportStep.js +2 -2
- package/dist/onboarding/steps/LookStep.js +1 -1
- package/dist/onboarding/steps/ReadyStep.js +2 -2
- package/dist/onboarding/steps/SkillsStep.js +1 -1
- package/dist/onboarding/steps/connect/KeyForm.js +1 -1
- package/dist/onboarding/steps/connect/ProviderPanel.js +1 -1
- package/dist/onboarding/steps/connect/ProviderReady.js +2 -2
- package/dist/palette/CommandPalette.d.ts +3 -1
- package/dist/palette/CommandPalette.js +11 -3
- package/dist/palette/PaletteDialog.js +25 -2
- package/dist/palette/PaletteProvider.js +1 -1
- package/dist/palette/PaletteRows.js +5 -5
- package/dist/palette/headless/index.d.ts +2 -2
- package/dist/palette/headless/index.js +2 -2
- package/dist/palette/headless/labels.d.ts +2 -0
- package/dist/palette/headless/labels.js +2 -0
- package/dist/palette/headless/sources.d.ts +26 -2
- package/dist/palette/headless/sources.js +40 -1
- package/dist/session/ArtifactsPanel.js +2 -2
- package/dist/session/DiffFileTree.js +1 -1
- package/dist/session/PlanTracker.js +1 -1
- package/dist/session/ProjectHome.js +4 -4
- package/dist/session/ProviderUsageProvider.js +2 -2
- package/dist/session/QueueTab.js +6 -6
- package/dist/session/RemindersPanel.js +2 -2
- package/dist/session/RunningWorkDialog.js +3 -2
- package/dist/session/SecretsPanel.js +2 -2
- package/dist/session/SessionCacheFacts.js +56 -57
- package/dist/session/SessionDetailsDialog.js +29 -17
- package/dist/session/SessionHeader.js +1 -1
- package/dist/session/SessionProvider.js +1 -1
- package/dist/session/SessionShell.js +2 -2
- package/dist/session/SideChat.js +1 -1
- package/dist/session/StepStatusIcon.js +1 -1
- package/dist/session/TurnDetailsDialog.js +1 -1
- package/dist/session/UsagePanel.js +9 -5
- package/dist/session/WelcomeScreen.js +1 -1
- package/dist/session/headless/host.d.ts +1 -1
- package/dist/session/headless/index.js +1 -1
- package/dist/session/headless/labels.d.ts +1 -0
- package/dist/session/headless/labels.js +4 -2
- package/dist/settings/SettingsFooter.d.ts +51 -0
- package/dist/settings/SettingsFooter.js +91 -0
- package/dist/settings/SettingsHeadingText.js +1 -1
- package/dist/settings/SettingsNav.js +1 -1
- package/dist/settings/SettingsProvider.js +1 -1
- package/dist/settings/SettingsRestricted.js +2 -2
- package/dist/settings/SettingsRowsPage.js +2 -2
- package/dist/settings/SettingsShell.js +3 -3
- package/dist/settings/headless/app-update.d.ts +27 -0
- package/dist/settings/headless/app-update.js +0 -0
- package/dist/settings/headless/catalog.js +61 -1
- package/dist/settings/headless/fixture-accounts.js +7 -0
- package/dist/settings/headless/index.d.ts +2 -1
- package/dist/settings/headless/index.js +2 -2
- package/dist/settings/headless/labels.d.ts +13 -0
- package/dist/settings/headless/labels.js +16 -1
- package/dist/settings/headless/layout.js +30 -12
- package/dist/settings/headless/mcp.d.ts +4 -0
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/index.d.ts +3 -1
- package/dist/settings/index.js +11 -9
- package/dist/settings/section.js +1 -1
- package/dist/settings/sections/appearance/AppearanceSection.js +1 -1
- package/dist/settings/sections/claude-import/ClaudeImportDialog.js +2 -2
- package/dist/settings/sections/descriptors.js +4 -4
- package/dist/settings/sections/editor/EditorSection.js +2 -2
- package/dist/settings/sections/enabled-list/EnabledListSection.js +1 -1
- package/dist/settings/sections/environments/EnvironmentsSection.js +3 -3
- package/dist/settings/sections/extensions/ChangeOriginDialog.js +1 -1
- package/dist/settings/sections/extensions/CreateExtensionDialog.js +1 -1
- package/dist/settings/sections/extensions/ExtensionConfigRows.js +2 -2
- package/dist/settings/sections/extensions/ExtensionOptionsSection.js +2 -2
- package/dist/settings/sections/extensions/ExtensionPicksBar.js +1 -1
- package/dist/settings/sections/extensions/ExtensionSourceBrowser.js +1 -1
- package/dist/settings/sections/extensions/ExtensionsSection.js +2 -2
- package/dist/settings/sections/host-catalog/HostCatalogSection.js +4 -4
- package/dist/settings/sections/index.js +8 -8
- package/dist/settings/sections/instructions/InstructionsSection.js +3 -3
- package/dist/settings/sections/keybindings/KeybindingsSection.js +2 -2
- package/dist/settings/sections/logs/LogsSection.js +1 -1
- package/dist/settings/sections/mcp/McpAddForm.js +48 -22
- package/dist/settings/sections/mcp/McpSection.js +14 -2
- package/dist/settings/sections/mcp/McpServerRow.d.ts +3 -1
- package/dist/settings/sections/mcp/McpServerRow.js +104 -10
- package/dist/settings/sections/mcp/labels.d.ts +18 -0
- package/dist/settings/sections/mcp/labels.js +18 -0
- package/dist/settings/sections/models/AgentDefaults.js +4 -4
- package/dist/settings/sections/models/ModelListPicker.js +1 -1
- package/dist/settings/sections/models/ModelPickField.js +1 -1
- package/dist/settings/sections/models/ModelRows.js +2 -2
- package/dist/settings/sections/models/model-test.js +1 -1
- package/dist/settings/sections/performance/PerfSparkline.js +1 -1
- package/dist/settings/sections/performance/PerformanceSection.js +14 -14
- package/dist/settings/sections/plugins/PluginsSection.js +1 -1
- package/dist/settings/sections/providers/CredentialSources.js +3 -3
- package/dist/settings/sections/providers/ProvidersSection.js +1 -1
- package/dist/settings/sections/providers/ServerProvidersSection.js +1 -1
- package/dist/settings/sections/providers/ServerSignIn.js +2 -2
- package/dist/settings/sections/shared/catalog.js +2 -2
- package/dist/settings/sections/skills/SkillList.js +5 -5
- package/dist/settings/sections/skills/SkillsSection.js +3 -3
- package/dist/settings/server-app.d.ts +41 -0
- package/dist/settings/server-app.js +155 -0
- package/dist/settings/testing/accounts.contract.d.ts +1 -1
- package/dist/settings/testing/accounts.contract.js +10 -1
- package/dist/styles.css +686 -30
- package/dist/terminal/HostTerminalSurface.js +4 -3
- package/dist/terminal/TerminalDrawer.js +2 -2
- package/dist/terminal/TerminalPanel.js +3 -3
- package/dist/terminal/TerminalProvider.d.ts +13 -2
- package/dist/terminal/TerminalProvider.js +15 -7
- package/dist/terminal/TerminalSurface.d.ts +3 -1
- package/dist/terminal/TerminalSurface.js +5 -4
- package/dist/terminal/assets.d.ts +10 -0
- package/dist/terminal/assets.js +23 -0
- package/dist/terminal/fonts/LICENSE +21 -0
- package/dist/terminal/fonts/SymbolsNerdFontMono-Regular.woff2 +0 -0
- package/dist/terminal/ghostty.d.ts +3 -1
- package/dist/terminal/ghostty.js +25 -4
- package/dist/terminal/index.d.ts +2 -2
- package/dist/theme/derive.d.ts +3 -2
- package/dist/theme/derive.js +3 -2
- package/dist/uno.js +2 -1
- package/dist/url-imports.d.ts +6 -0
- package/dist/views/BoolMark.d.ts +15 -0
- package/dist/views/BoolMark.js +28 -0
- package/dist/views/SvgImage.d.ts +19 -0
- package/dist/views/SvgImage.js +89 -0
- package/dist/views/TranscriptViews.d.ts +31 -0
- package/dist/views/TranscriptViews.js +59 -0
- package/dist/views/ViewAutoRefresh.d.ts +23 -0
- package/dist/views/ViewAutoRefresh.js +73 -0
- package/dist/views/ViewBlock.d.ts +40 -0
- package/dist/views/ViewBlock.js +482 -0
- package/dist/views/ViewCharts.d.ts +20 -0
- package/dist/views/ViewCharts.js +331 -0
- package/dist/views/ViewControls.d.ts +49 -0
- package/dist/views/ViewControls.js +208 -0
- package/dist/views/ViewCustom.d.ts +40 -0
- package/dist/views/ViewCustom.js +354 -0
- package/dist/views/ViewExpanded.d.ts +32 -0
- package/dist/views/ViewExpanded.js +107 -0
- package/dist/views/ViewExtension.d.ts +21 -0
- package/dist/views/ViewExtension.js +125 -0
- package/dist/views/ViewInputs.d.ts +24 -0
- package/dist/views/ViewInputs.js +561 -0
- package/dist/views/ViewMcpApp.d.ts +26 -0
- package/dist/views/ViewMcpApp.js +569 -0
- package/dist/views/ViewNodes.d.ts +92 -0
- package/dist/views/ViewNodes.js +1073 -0
- package/dist/views/ViewPreviewPage.d.ts +42 -0
- package/dist/views/ViewPreviewPage.js +214 -0
- package/dist/views/ViewTables.d.ts +15 -0
- package/dist/views/ViewTables.js +305 -0
- package/dist/views/ViewsProvider.d.ts +32 -0
- package/dist/views/ViewsProvider.js +50 -0
- package/dist/views/badge-tone.d.ts +20 -0
- package/dist/views/badge-tone.js +100 -0
- package/dist/views/expanded.d.ts +7 -0
- package/dist/views/expanded.js +14 -0
- package/dist/views/format.d.ts +18 -0
- package/dist/views/format.js +37 -0
- package/dist/views/headless/answers.d.ts +50 -0
- package/dist/views/headless/answers.js +85 -0
- package/dist/views/headless/custom-slots.d.ts +35 -0
- package/dist/views/headless/custom-slots.js +59 -0
- package/dist/views/headless/download.d.ts +10 -0
- package/dist/views/headless/download.js +26 -0
- package/dist/views/headless/frame-name.d.ts +17 -0
- package/dist/views/headless/frame-name.js +24 -0
- package/dist/views/headless/host.d.ts +197 -0
- package/dist/views/headless/host.js +0 -0
- package/dist/views/headless/index.d.ts +13 -0
- package/dist/views/headless/index.js +12 -0
- package/dist/views/headless/labels.d.ts +144 -0
- package/dist/views/headless/labels.js +147 -0
- package/dist/views/headless/live.d.ts +12 -0
- package/dist/views/headless/live.js +50 -0
- package/dist/views/headless/lru.d.ts +31 -0
- package/dist/views/headless/lru.js +62 -0
- package/dist/views/headless/mcp-app-bridge.d.ts +128 -0
- package/dist/views/headless/mcp-app-bridge.js +330 -0
- package/dist/views/headless/placement.d.ts +98 -0
- package/dist/views/headless/placement.js +227 -0
- package/dist/views/headless/records.d.ts +53 -0
- package/dist/views/headless/records.js +114 -0
- package/dist/views/headless/refs.d.ts +10 -0
- package/dist/views/headless/refs.js +13 -0
- package/dist/views/headless/safe.d.ts +35 -0
- package/dist/views/headless/safe.js +58 -0
- package/dist/views/headless/store.d.ts +54 -0
- package/dist/views/headless/store.js +228 -0
- package/dist/views/headless/streaming.d.ts +43 -0
- package/dist/views/headless/streaming.js +136 -0
- package/dist/views/headless/view-state.d.ts +20 -0
- package/dist/views/headless/view-state.js +55 -0
- package/dist/views/index.d.ts +2 -0
- package/dist/views/index.js +1 -0
- package/dist/views/input-preview.d.ts +5 -0
- package/dist/views/input-preview.js +11 -0
- package/dist/views/preview-style.d.ts +10 -0
- package/dist/views/preview-style.js +262 -0
- package/dist/views/preview.d.ts +2 -0
- package/dist/views/preview.js +1 -0
- package/dist/views/testing/contract.d.ts +50 -0
- package/dist/views/testing/contract.js +266 -0
- package/dist/views/testing/fixture-host.d.ts +29 -0
- package/dist/views/testing/fixture-host.js +77 -0
- package/dist/views/testing/index.d.ts +2 -0
- package/dist/views/testing/index.js +1 -0
- package/dist/views/theme-watch.d.ts +28 -0
- package/dist/views/theme-watch.js +65 -0
- package/dist/views/trusted.d.ts +17 -0
- package/dist/views/trusted.js +17 -0
- package/dist/views/viewport.d.ts +30 -0
- package/dist/views/viewport.js +87 -0
- package/dist/workspace/LayoutBudget.js +1 -1
- package/dist/workspace/PanelContentView.js +2 -2
- package/dist/workspace/PanelGroups.js +1 -1
- package/dist/workspace/PanelHome.js +1 -1
- package/dist/workspace/PanelItems.js +2 -2
- package/dist/workspace/PanelStrip.js +2 -2
- package/dist/workspace/PanelToolbar.js +2 -2
- package/dist/workspace/SidePanel.js +4 -4
- package/dist/workspace/TabParking.js +2 -2
- package/dist/workspace/WorkspaceProvider.js +1 -1
- package/dist/workspace/dnd/parking.js +2 -2
- package/dist/workspace/extension-tabs.js +2 -2
- package/package.json +49 -2
- package/src/styles/components.css +421 -0
- package/src/styles/files.css +15 -0
- package/src/styles/primitives.css +10 -0
- package/src/styles/tokens.css +20 -1
- package/src/styles/transcript.css +174 -18
- package/dist/dist/index-f-XWIoYo.d.ts +0 -1
- package/dist/dist/sandbox-B4OW6oNx.d.ts +0 -2
- /package/dist/dist/{types-2HrgolQz.d.ts → types-CgfAUN48.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { plainTextToDocJson } from "./prompt-history-nav.js";
|
|
2
2
|
import { suggestionExtension } from "./suggestion-extension.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { useLayoutEffect } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import Placeholder from "@tiptap/extension-placeholder";
|
|
6
6
|
import { EditorContent, useEditor } from "@tiptap/react";
|
|
7
7
|
import StarterKit from "@tiptap/starter-kit";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLabels } from "../../labels.js";
|
|
2
2
|
import { DEFAULT_COMPOSER_LABELS } from "../headless/composer/labels.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { createContext, useContext, useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/chat/composer/ComposerHostProvider.tsx
|
|
6
6
|
/**
|
|
7
7
|
* Puts a `ComposerHost` (and composer label overrides) in context for the rich
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { forwardRef, useImperativeHandle, useLayoutEffect, useRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/chat/composer/ComposerShell.tsx
|
|
4
4
|
/**
|
|
5
5
|
* What the composer shows until its editor chunk lands: the editor's own
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Tooltip } from "../../components/Tooltip.js";
|
|
2
|
+
import { KeyValue } from "../../components/KeyValue.js";
|
|
2
3
|
import { MenuNote, MenuSection } from "../../components/Menu.js";
|
|
3
4
|
import { useChatLabels } from "../useChatLabels.js";
|
|
4
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useMemo, useState } from "react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { displayNameFor, fmtTokens } from "zidane/chat/pure";
|
|
7
8
|
//#region src/chat/composer/ContextBreakdown.tsx
|
|
8
9
|
/**
|
|
@@ -58,19 +59,6 @@ function ContextBar({ children }) {
|
|
|
58
59
|
children
|
|
59
60
|
});
|
|
60
61
|
}
|
|
61
|
-
/** A label / value line under a section label (usage, extension rows). */
|
|
62
|
-
function MetaLine({ label, value }) {
|
|
63
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
64
|
-
className: "flex items-center justify-between gap-2 h-5 px-2 text-zg-label",
|
|
65
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
66
|
-
className: "text-[var(--zg-text-muted)]",
|
|
67
|
-
children: label
|
|
68
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
69
|
-
className: "zg-meta",
|
|
70
|
-
children: value
|
|
71
|
-
})]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
62
|
/**
|
|
75
63
|
* Renders the context window breakdown: a stacked bar and a list of categories with their token shares. While there is no breakdown it shows a plain gauge from the fallback values.
|
|
76
64
|
*
|
|
@@ -205,20 +193,32 @@ function ContextBreakdown({ breakdown, fallbackPct, fallbackColor, className, st
|
|
|
205
193
|
}),
|
|
206
194
|
usageRows.length > 0 && /* @__PURE__ */ jsx(MenuSection, {
|
|
207
195
|
label: labels.contextLastTurn,
|
|
208
|
-
children:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
196
|
+
children: /* @__PURE__ */ jsx(KeyValue, {
|
|
197
|
+
layout: "split",
|
|
198
|
+
meta: true,
|
|
199
|
+
className: "px-2",
|
|
200
|
+
items: usageRows.map((r) => ({
|
|
201
|
+
id: r.label,
|
|
202
|
+
label: r.label,
|
|
203
|
+
value: fmtTokens(r.tokens)
|
|
204
|
+
}))
|
|
205
|
+
})
|
|
212
206
|
}),
|
|
213
207
|
breakdown.extensionSections?.map((section) => section.rows.length === 0 ? null : /* @__PURE__ */ jsx(MenuSection, {
|
|
214
208
|
label: /* @__PURE__ */ jsx("span", {
|
|
215
209
|
style: section.accentColor ? { color: section.accentColor } : void 0,
|
|
216
210
|
children: section.label
|
|
217
211
|
}),
|
|
218
|
-
children:
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
212
|
+
children: /* @__PURE__ */ jsx(KeyValue, {
|
|
213
|
+
layout: "split",
|
|
214
|
+
meta: true,
|
|
215
|
+
className: "px-2",
|
|
216
|
+
items: section.rows.map((r) => ({
|
|
217
|
+
id: r.label,
|
|
218
|
+
label: r.label,
|
|
219
|
+
value: r.value
|
|
220
|
+
}))
|
|
221
|
+
})
|
|
222
222
|
}, section.id)),
|
|
223
223
|
breakdown.hasEstimates && /* @__PURE__ */ jsx(MenuNote, {
|
|
224
224
|
className: "!px-1",
|
|
@@ -231,7 +231,7 @@ function ContextBreakdown({ breakdown, fallbackPct, fallbackColor, className, st
|
|
|
231
231
|
function ContextRow({ cat, denom, isOpen, onToggle }) {
|
|
232
232
|
const hasItems = !!cat.items && cat.items.length > 0;
|
|
233
233
|
const pct = pctLabel(cat.tokens, denom);
|
|
234
|
-
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
234
|
+
const body = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
235
235
|
/* @__PURE__ */ jsx("span", {
|
|
236
236
|
className: "w-2.5 shrink-0 inline-flex items-center justify-center",
|
|
237
237
|
children: hasItems && /* @__PURE__ */ jsx("span", {
|
|
@@ -8,8 +8,8 @@ import { mergeBadgeOrder, orderComposerBadges } from "./badge-order.js";
|
|
|
8
8
|
import { usePendingInteractions } from "../interactions/hooks.js";
|
|
9
9
|
import { conversationBadges } from "../headless/composer/conversation-badges.js";
|
|
10
10
|
import { useSustainedWork } from "./use-sustained-work.js";
|
|
11
|
-
import { jsx } from "react/jsx-runtime";
|
|
12
11
|
import { memo, useCallback, useEffect, useMemo, useRef } from "react";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
13
|
//#region src/chat/composer/ConversationBadges.tsx
|
|
14
14
|
/**
|
|
15
15
|
* The composer's badge strip for one conversation (`ComposerBadges`, drawn
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { HostView } from "../headless/hosts.js";
|
|
2
|
+
import { EnvironmentMachine } from "../../git/headless/environment.js";
|
|
3
|
+
import { WhereMenuProps } from "../../git/WherePicker.js";
|
|
4
|
+
import { DraftTarget } from "./use-draft-target.js";
|
|
5
|
+
import { CSSProperties } from "react";
|
|
6
|
+
//#region src/chat/composer/DraftPickers.d.ts
|
|
7
|
+
/** Props for {@link DraftPickers}. */
|
|
8
|
+
interface DraftPickersProps {
|
|
9
|
+
/** The draft's target (`useDraftTarget`). */
|
|
10
|
+
draft: DraftTarget;
|
|
11
|
+
/** The places: this computer first (where it is one), then the servers. */
|
|
12
|
+
hosts: readonly HostView[];
|
|
13
|
+
/** This computer is a place (the where menu's help lists it, a local folder picks there). Default: true. */
|
|
14
|
+
local?: boolean;
|
|
15
|
+
/** Machine names not to list (servers this computer also uses as machines). */
|
|
16
|
+
hiddenMachines?: ReadonlySet<string>;
|
|
17
|
+
/** The machines of the other hosts, by host id. */
|
|
18
|
+
serverMachines?: ReadonlyMap<string, readonly EnvironmentMachine[]>;
|
|
19
|
+
/** Opens Add a machine for a server. Absent: no Add a machine row. */
|
|
20
|
+
onAddMachine?: (hostId: string) => void;
|
|
21
|
+
/** "Use for new chats" (see `WhereMenuProps`). Absent: no row. */
|
|
22
|
+
newChatsDefault?: WhereMenuProps['newChatsDefault'];
|
|
23
|
+
/** Opens the environment settings. Absent: no settings row. */
|
|
24
|
+
onOpenSettings?: () => void;
|
|
25
|
+
/** Extra classes on the root. */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** Inline styles on the root. */
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Renders the where menu and the folder picker of the draft's place. They never shrink: on a tight composer they
|
|
32
|
+
* fold instead (`.zg-chatbox-target`).
|
|
33
|
+
*
|
|
34
|
+
* @param props - The draft, the hosts and the app's callbacks.
|
|
35
|
+
*/
|
|
36
|
+
declare function DraftPickers({ draft, hosts, local, hiddenMachines, serverMachines, onAddMachine, newChatsDefault, onOpenSettings, className, style }: DraftPickersProps): import("react").JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { DraftPickers, DraftPickersProps };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ScopeToggle } from "./ScopeToggle.js";
|
|
2
|
+
import { RemoteFolderPicker } from "../../git/RemoteFolderPicker.js";
|
|
3
|
+
import { WherePicker } from "../../git/WherePicker.js";
|
|
4
|
+
import { ServerScopeToggle } from "./ServerScopeToggle.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { LOCAL_HOST_KEY, machineKind } from "zidane/chat/pure";
|
|
7
|
+
//#region src/chat/composer/DraftPickers.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The new-chat draft's pickers, next to Send: where it runs (`WherePicker`:
|
|
10
|
+
* the hosts, their machines, the isolation) and its folder there (a
|
|
11
|
+
* machine's folders, a server's projects, or a folder on this computer).
|
|
12
|
+
* Every app shows the same pickers over its `useDraftTarget`. "Use for new
|
|
13
|
+
* chats" saves the draft's place when the app gives `newChatsDefault`.
|
|
14
|
+
*
|
|
15
|
+
* <DraftPickers draft={draft} hosts={hosts} onOpenSettings={openEnvironments} />
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Renders the where menu and the folder picker of the draft's place. They never shrink: on a tight composer they
|
|
19
|
+
* fold instead (`.zg-chatbox-target`).
|
|
20
|
+
*
|
|
21
|
+
* @param props - The draft, the hosts and the app's callbacks.
|
|
22
|
+
*/
|
|
23
|
+
function DraftPickers({ draft, hosts, local = true, hiddenMachines, serverMachines, onAddMachine, newChatsDefault, onOpenSettings, className = "", style }) {
|
|
24
|
+
const { machine, server } = draft;
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
26
|
+
className: `zg-chatbox-target flex items-center gap-2 ${className}`.trimEnd(),
|
|
27
|
+
style,
|
|
28
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
29
|
+
className: "zg-chatbox-where contents",
|
|
30
|
+
children: /* @__PURE__ */ jsx(WherePicker, {
|
|
31
|
+
hosts,
|
|
32
|
+
hostId: server?.id ?? LOCAL_HOST_KEY,
|
|
33
|
+
onHostChange: draft.setHostId,
|
|
34
|
+
descriptors: draft.environmentChoices,
|
|
35
|
+
draft: draft.environment,
|
|
36
|
+
onChange: draft.setEnvironment,
|
|
37
|
+
local,
|
|
38
|
+
...hiddenMachines && !server ? { hiddenMachines } : {},
|
|
39
|
+
...serverMachines ? { serverMachines } : {},
|
|
40
|
+
onPickServerMachine: (serverId, picked) => draft.setPlace(serverId, machineKind("local", picked.name)),
|
|
41
|
+
...onAddMachine ? { onAddMachine } : {},
|
|
42
|
+
...newChatsDefault ? { newChatsDefault } : {},
|
|
43
|
+
...onOpenSettings ? { onOpenSettings } : {}
|
|
44
|
+
})
|
|
45
|
+
}), machine ? /* @__PURE__ */ jsx(RemoteFolderPicker, {
|
|
46
|
+
hostId: draft.machineHost,
|
|
47
|
+
machineId: machine.id,
|
|
48
|
+
hostName: machine.name,
|
|
49
|
+
folder: draft.machineFolder,
|
|
50
|
+
onChange: draft.setMachineFolder
|
|
51
|
+
}) : server ? /* @__PURE__ */ jsx(ServerScopeToggle, {
|
|
52
|
+
hostId: server.id,
|
|
53
|
+
hostName: server.name,
|
|
54
|
+
folder: draft.remoteFolder,
|
|
55
|
+
onChange: draft.setRemoteFolder,
|
|
56
|
+
projects: draft.serverFolders,
|
|
57
|
+
root: draft.remoteRoot,
|
|
58
|
+
clone: draft.remoteClone,
|
|
59
|
+
cloning: draft.cloning,
|
|
60
|
+
...draft.importRepoOnServer ? { onImportRepo: draft.importRepoOnServer } : {}
|
|
61
|
+
}) : local ? /* @__PURE__ */ jsx(ScopeToggle, {
|
|
62
|
+
folderPath: draft.folderPath,
|
|
63
|
+
onJustChat: draft.justChat,
|
|
64
|
+
onPickFolder: draft.pickFolder,
|
|
65
|
+
onImportRepo: draft.importRepoIntoDraft,
|
|
66
|
+
recents: draft.recentFolders,
|
|
67
|
+
onPickRecent: draft.pickRecent
|
|
68
|
+
}) : null]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { DraftPickers };
|
|
@@ -4,8 +4,8 @@ import { useComposerLabels } from "./ComposerHostProvider.js";
|
|
|
4
4
|
import { ModalShell, useModal } from "../../app/ModalProvider.js";
|
|
5
5
|
import { EFFORT_LEVELS, OPTION_ICON } from "./ModelOptionsPicker.js";
|
|
6
6
|
import { useCacheHints } from "./use-cache-hints.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/chat/composer/EffortPickerDialog.tsx
|
|
10
10
|
/**
|
|
11
11
|
* The model options dialog: the keyboard-shortcut surface for the active
|
|
@@ -3,8 +3,8 @@ import { useChatHost, useHostSessions } from "../ChatProvider.js";
|
|
|
3
3
|
import { Composer } from "./Composer.js";
|
|
4
4
|
import { ModelOptionsPicker, THINKING_LEVELS } from "./ModelOptionsPicker.js";
|
|
5
5
|
import { ModelPicker, findModel, modelKey } from "./ModelPicker.js";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { useMemo, useState } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/chat/composer/HostComposer.tsx
|
|
9
9
|
/**
|
|
10
10
|
* `Composer` over a `ChatHost` for one session: Enter sends through
|
|
@@ -79,7 +79,7 @@ function HostComposer({ sessionId, defaultModel, defaultThinking = "medium", foo
|
|
|
79
79
|
running,
|
|
80
80
|
onSend: send,
|
|
81
81
|
...host.interrupt ? { onStop: () => host.interrupt(sessionId) } : {},
|
|
82
|
-
footer: pickers || footer ? /* @__PURE__ */ jsxs(Fragment, { children: [pickers, footer] }) : void 0
|
|
82
|
+
footer: pickers || footer ? /* @__PURE__ */ jsxs(Fragment$1, { children: [pickers, footer] }) : void 0
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
//#endregion
|
|
@@ -3,8 +3,8 @@ import { useComposerHost, useComposerLabels } from "./ComposerHostProvider.js";
|
|
|
3
3
|
import { ContextBreakdown } from "./ContextBreakdown.js";
|
|
4
4
|
import { ContextOrb } from "./ContextOrb.js";
|
|
5
5
|
import { resourceErrorText, useHostResource } from "./use-composer-stores.js";
|
|
6
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { useMemo } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/chat/composer/HostContextOrb.tsx
|
|
9
9
|
/**
|
|
10
10
|
* The composer's context orb over the host: `ContextOrb` on the session's
|
|
@@ -20,7 +20,7 @@ function HostContextBreakdown({ sessionId, fallbackPct, fallbackColor }) {
|
|
|
20
20
|
const snap = useHostResource(resource);
|
|
21
21
|
const failed = snap.status === "error";
|
|
22
22
|
const breakdown = !resource || failed ? null : snap.data;
|
|
23
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ContextBreakdown, {
|
|
23
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ContextBreakdown, {
|
|
24
24
|
breakdown,
|
|
25
25
|
fallbackPct,
|
|
26
26
|
fallbackColor
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModelChainList } from "./ModelChainList.js";
|
|
2
2
|
import { useCacheHints } from "./use-cache-hints.js";
|
|
3
3
|
import { useModelCatalog, useModelPickerPrefs, useModelPickerPrefsStore } from "./use-composer-stores.js";
|
|
4
|
-
import { jsx } from "react/jsx-runtime";
|
|
5
4
|
import { useMemo } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/chat/composer/HostModelChainList.tsx
|
|
7
7
|
/**
|
|
8
8
|
* `ModelChainList` (search, the Legacy switch, provider pills, the chain
|
|
@@ -7,8 +7,8 @@ import { useAgentProfiles } from "./use-agent-profiles.js";
|
|
|
7
7
|
import { useCacheHints } from "./use-cache-hints.js";
|
|
8
8
|
import { resourceErrorText, useHostResource, useModelKnobs, useModelPickerPrefs, useModelPickerPrefsStore } from "./use-composer-stores.js";
|
|
9
9
|
import { commitModelPick } from "../headless/composer/remember-model-pick.js";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
11
10
|
import { useCallback, useMemo, useState } from "react";
|
|
11
|
+
import { jsx } from "react/jsx-runtime";
|
|
12
12
|
//#region src/chat/composer/HostPickers.tsx
|
|
13
13
|
/**
|
|
14
14
|
* The composer's pickers over the host: the agent (`HostAgentPicker`), the
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useChatLabels } from "../useChatLabels.js";
|
|
2
2
|
import { ModelChainList } from "./ModelChainList.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
3
|
import { useMemo } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
//#region src/chat/composer/ImageModelList.tsx
|
|
6
6
|
/**
|
|
7
7
|
* The image models of the connected providers: the model picker's Image tab.
|
|
@@ -6,8 +6,8 @@ import { ModelChainFooter, ModelChainHeader } from "./ModelChainParts.js";
|
|
|
6
6
|
import { ModelChainRows } from "./ModelChainRows.js";
|
|
7
7
|
import { ModelProviderPills } from "./ModelProviderPills.js";
|
|
8
8
|
import { useModelListSpy } from "./useModelListSpy.js";
|
|
9
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { positionKeyed, reorderKeyed, toggleKeyed } from "zidane/chat/pure";
|
|
12
12
|
//#region src/chat/composer/ModelChainList.tsx
|
|
13
13
|
/**
|
|
@@ -3,8 +3,8 @@ import { MenuSwitch } from "../../components/Menu.js";
|
|
|
3
3
|
import { useChatLabels } from "../useChatLabels.js";
|
|
4
4
|
import { providerColor } from "../provider-color.js";
|
|
5
5
|
import "./model-list-layout.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { memo } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
//#region src/chat/composer/ModelChainParts.tsx
|
|
9
9
|
/**
|
|
10
10
|
* The model pickers' furniture: the header (the search field, the caller's
|
|
@@ -3,8 +3,8 @@ import { useChatLabels } from "../useChatLabels.js";
|
|
|
3
3
|
import { providerColor } from "../provider-color.js";
|
|
4
4
|
import { rowKey } from "./model-catalog.js";
|
|
5
5
|
import { ModelMeta, ModelProviderChip } from "./ModelFacts.js";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { memo, useLayoutEffect, useRef } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { modelDisplayName } from "zidane/chat/pure";
|
|
9
9
|
//#region src/chat/composer/ModelChainRow.tsx
|
|
10
10
|
/**
|
|
@@ -2,8 +2,8 @@ import { canJoinChain, lineupKeyOf, pickRefOf, refKey, rowKey } from "./model-ca
|
|
|
2
2
|
import { groupAt, maxScroll, placeOfRow, rowTop, rowsBetween, scrollToShow } from "./model-list-layout.js";
|
|
3
3
|
import { ModelGroupHeader } from "./ModelChainParts.js";
|
|
4
4
|
import { ModelChainRow } from "./ModelChainRow.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { memo, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { positionKeyed } from "zidane/chat/pure";
|
|
8
8
|
//#region src/chat/composer/ModelChainRows.tsx
|
|
9
9
|
/**
|
|
@@ -2,8 +2,8 @@ import { Menu, MenuRow, MenuSection, MenuSeparator } from "../../components/Menu
|
|
|
2
2
|
import { Popover } from "../../components/floating/Popover.js";
|
|
3
3
|
import { useChatLabels } from "../useChatLabels.js";
|
|
4
4
|
import { PickerPill } from "./PickerPill.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { useCallback, useEffect, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
//#region src/chat/composer/ModelOptionsPicker.tsx
|
|
8
8
|
/**
|
|
9
9
|
* The model options pill of the composer's controls and its menu: a
|
|
@@ -7,8 +7,8 @@ import { catalogFromProviders, modelLineup, modelNameOf, refKey } from "./model-
|
|
|
7
7
|
import { ModelChainList } from "./ModelChainList.js";
|
|
8
8
|
import { ImageModelList, effectiveImageModel } from "./ImageModelList.js";
|
|
9
9
|
import { ModelChainTooltip } from "./ModelChainTooltip.js";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
11
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { chainsEqualKeyed } from "zidane/chat/pure";
|
|
13
13
|
//#region src/chat/composer/ModelPicker.tsx
|
|
14
14
|
/**
|
|
@@ -199,7 +199,7 @@ function ModelChainPopover({ catalog, loadError = null, onRetry, chain, onCommit
|
|
|
199
199
|
catalog,
|
|
200
200
|
serving,
|
|
201
201
|
forNextChat,
|
|
202
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [ariaLabel ?? (chain.length > 0 ? labels.switchModel : labels.chooseModel), shortcut] })
|
|
202
|
+
footer: /* @__PURE__ */ jsxs(Fragment$1, { children: [ariaLabel ?? (chain.length > 0 ? labels.switchModel : labels.chooseModel), shortcut] })
|
|
203
203
|
}),
|
|
204
204
|
onOpenChange: (open) => {
|
|
205
205
|
if (!open) {
|
|
@@ -3,8 +3,8 @@ import { ModalShell, useModal } from "../../app/ModalProvider.js";
|
|
|
3
3
|
import { refKey } from "./model-catalog.js";
|
|
4
4
|
import { commitModelPick } from "../headless/composer/remember-model-pick.js";
|
|
5
5
|
import { HostModelChainList } from "./HostModelChainList.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
6
|
import { useRef, useState } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { chainsEqualKeyed } from "zidane/chat/pure";
|
|
9
9
|
//#region src/chat/composer/ModelPickerDialog.tsx
|
|
10
10
|
/**
|
|
@@ -2,8 +2,8 @@ import { useReducedMotion } from "../../motion/reduced.js";
|
|
|
2
2
|
import { useWithFade } from "../../motion/springs.js";
|
|
3
3
|
import { useChatLabels } from "../useChatLabels.js";
|
|
4
4
|
import { providerColor } from "../provider-color.js";
|
|
5
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
5
|
import { memo, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { motion } from "motion/react";
|
|
8
8
|
//#region src/chat/composer/ModelProviderPills.tsx
|
|
9
9
|
/**
|
|
@@ -4,8 +4,8 @@ import { basename, compactPath } from "../../path.js";
|
|
|
4
4
|
import { useDisplayPath } from "../../hooks/useDisplayPath.js";
|
|
5
5
|
import { useComposerLabels } from "./ComposerHostProvider.js";
|
|
6
6
|
import { scopeTone } from "./scope-side.js";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/chat/composer/ProjectMenu.tsx
|
|
10
10
|
/**
|
|
11
11
|
* The folder side of a draft's scope toggle: a pill in the composer's
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import { createContext, useCallback, useContext, useMemo, useRef } from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/chat/composer/PromptHistoryProvider.tsx
|
|
4
4
|
/**
|
|
5
5
|
* Prompt history — per-session ring of past user submissions. ↑ / ↓ at
|
|
@@ -5,8 +5,8 @@ import { Presence, useCadencedValue } from "../../motion/swap.js";
|
|
|
5
5
|
import { useComposerLabels } from "./ComposerHostProvider.js";
|
|
6
6
|
import { formatSessionCostLabel } from "../headless/composer/live-cost.js";
|
|
7
7
|
import { useRunElapsedSec } from "./use-run-meter.js";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
8
|
import { useRef } from "react";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { EMPTY_RATE, fmtTokens, formatElapsed, stepStreamRate, streamRateValue } from "zidane/chat/pure";
|
|
11
11
|
//#region src/chat/composer/RunStatusChip.tsx
|
|
12
12
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { decodeHeif, isHeifType } from "./heif.js";
|
|
1
2
|
import { ATTACHMENT_SNIFF_BYTES, MAX_FILE_ATTACHMENT_BYTES, MAX_FILE_ATTACHMENT_BYTES as MAX_FILE_ATTACHMENT_BYTES$1, MAX_IMAGE_ATTACHMENT_BYTES, MAX_IMAGE_ATTACHMENT_BYTES as MAX_IMAGE_ATTACHMENT_BYTES$1, formatBytes, formatBytes as formatBytes$1, planAttachment } from "zidane/chat/pure";
|
|
2
3
|
//#region src/chat/composer/attachment-ingest.ts
|
|
3
4
|
/**
|
|
@@ -137,10 +138,11 @@ const MAX_IMAGE_EDGE = 8e3;
|
|
|
137
138
|
/**
|
|
138
139
|
* Decode an image and encode it again, as PNG (JPEG for a JPEG: a photo grows
|
|
139
140
|
* as PNG), scaled down until it fits the image cap. An animated GIF or WebP
|
|
140
|
-
* over the cap keeps its first frame (`original` keeps them all).
|
|
141
|
-
* TIFF in Chromium) or there is no DOM to draw it in.
|
|
141
|
+
* over the cap keeps its first frame (`original` keeps them all). A HEIC / HEIF photo is decoded to JPEG first
|
|
142
|
+
* (`decodeHeif`). Rejects when the image cannot be decoded (TIFF in Chromium) or there is no DOM to draw it in.
|
|
142
143
|
*/
|
|
143
144
|
async function convertImage(file, sourceType) {
|
|
145
|
+
if (isHeifType(sourceType)) return convertImage(await decodeHeif(file), "image/jpeg");
|
|
144
146
|
const url = URL.createObjectURL(file);
|
|
145
147
|
try {
|
|
146
148
|
const image = new Image();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/chat/composer/heif.d.ts
|
|
2
|
+
/** `image/heic` or `image/heif`. */
|
|
3
|
+
declare function isHeifType(mediaType: string): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Decode a HEIC / HEIF photo to a JPEG. Rejects when the file is over the
|
|
6
|
+
* attachment cap or {@link MAX_PIXELS}, or is not a photo libheif reads.
|
|
7
|
+
*
|
|
8
|
+
* @param file - The photo.
|
|
9
|
+
*/
|
|
10
|
+
declare function decodeHeif(file: Blob): Promise<Blob>;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { decodeHeif, isHeifType };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { MAX_FILE_ATTACHMENT_BYTES } from "zidane/chat/pure";
|
|
2
|
+
//#region src/chat/composer/heif.ts
|
|
3
|
+
/**
|
|
4
|
+
* HEIC / HEIF photos decoded in the page. Chromium has no HEIF decoder, so
|
|
5
|
+
* libheif compiled to WebAssembly (`heic-to`) does it, loaded with the first
|
|
6
|
+
* photo. Its `csp` build needs no `eval`, so it runs under the web app's
|
|
7
|
+
* Content-Security-Policy. zidane's own Node-side paths (the TUI, `read_file`)
|
|
8
|
+
* convert with the OS's tools instead (`zidane/src/media/heif.ts`).
|
|
9
|
+
*/
|
|
10
|
+
/** Decoding holds every pixel in memory: refuse past 64 MP (a 48 MP iPhone photo fits). */
|
|
11
|
+
const MAX_PIXELS = 64e6;
|
|
12
|
+
/** The most a `meta` box (the image properties) may hold. */
|
|
13
|
+
const METADATA_BYTES = 1048576;
|
|
14
|
+
/** Top-level boxes walked before `meta` (`ftyp`, maybe `mdat`, a few others). */
|
|
15
|
+
const MAX_TOP_LEVEL_BOXES = 64;
|
|
16
|
+
const JPEG_QUALITY = .92;
|
|
17
|
+
const fourCC = (code) => [...code].reduce((n, c) => n << 8 | c.charCodeAt(0), 0) >>> 0;
|
|
18
|
+
const META = fourCC("meta");
|
|
19
|
+
const IPRP = fourCC("iprp");
|
|
20
|
+
const IPCO = fourCC("ipco");
|
|
21
|
+
const ISPE = fourCC("ispe");
|
|
22
|
+
/** `image/heic` or `image/heif`. */
|
|
23
|
+
function isHeifType(mediaType) {
|
|
24
|
+
return mediaType === "image/heic" || mediaType === "image/heif";
|
|
25
|
+
}
|
|
26
|
+
/** The first box of `type` among the siblings in `[start, end)`, or `null`. */
|
|
27
|
+
function findBox(view, start, end, type) {
|
|
28
|
+
let offset = start;
|
|
29
|
+
while (offset + 8 <= end) {
|
|
30
|
+
let size = view.getUint32(offset);
|
|
31
|
+
let header = 8;
|
|
32
|
+
if (size === 1) {
|
|
33
|
+
if (offset + 16 > end) return null;
|
|
34
|
+
const large = view.getBigUint64(offset + 8);
|
|
35
|
+
if (large > BigInt(end - offset)) return null;
|
|
36
|
+
size = Number(large);
|
|
37
|
+
header = 16;
|
|
38
|
+
} else if (size === 0) size = end - offset;
|
|
39
|
+
if (size < header || size > end - offset) return null;
|
|
40
|
+
if (view.getUint32(offset + 4) === type) return {
|
|
41
|
+
start: offset + header,
|
|
42
|
+
end: offset + size
|
|
43
|
+
};
|
|
44
|
+
offset += size;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Whether every image the file declares (its `ispe` properties, under
|
|
50
|
+
* `meta` › `iprp` › `ipco`) is within {@link MAX_PIXELS}. False for a file
|
|
51
|
+
* whose sizes cannot be found: it is not a photo this decodes.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* The top-level `meta` box's content, or `null`. Reads each box's header
|
|
55
|
+
* from the file, so a large `mdat` written before `meta` is skipped, not read.
|
|
56
|
+
*/
|
|
57
|
+
async function readMeta(file) {
|
|
58
|
+
let offset = 0;
|
|
59
|
+
for (let n = 0; n < MAX_TOP_LEVEL_BOXES && offset + 8 <= file.size; n++) {
|
|
60
|
+
const head = new DataView(await file.slice(offset, offset + 16).arrayBuffer());
|
|
61
|
+
let size = head.getUint32(0);
|
|
62
|
+
let header = 8;
|
|
63
|
+
if (size === 1) {
|
|
64
|
+
if (head.byteLength < 16) return null;
|
|
65
|
+
const large = head.getBigUint64(8);
|
|
66
|
+
if (large > BigInt(file.size - offset)) return null;
|
|
67
|
+
size = Number(large);
|
|
68
|
+
header = 16;
|
|
69
|
+
} else if (size === 0) size = file.size - offset;
|
|
70
|
+
if (size < header || size > file.size - offset) return null;
|
|
71
|
+
if (head.getUint32(4) === META) {
|
|
72
|
+
if (size - header > METADATA_BYTES) return null;
|
|
73
|
+
return new DataView(await file.slice(offset + header, offset + size).arrayBuffer());
|
|
74
|
+
}
|
|
75
|
+
offset += size;
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
async function withinPixelCap(file) {
|
|
80
|
+
const view = await readMeta(file);
|
|
81
|
+
if (!view) return false;
|
|
82
|
+
const props = findBox(view, 4, view.byteLength, IPRP);
|
|
83
|
+
const container = props && findBox(view, props.start, props.end, IPCO);
|
|
84
|
+
if (!container) return false;
|
|
85
|
+
let found = false;
|
|
86
|
+
for (let offset = container.start; offset < container.end;) {
|
|
87
|
+
const ispe = findBox(view, offset, container.end, ISPE);
|
|
88
|
+
if (!ispe) break;
|
|
89
|
+
if (ispe.start + 12 > ispe.end) return false;
|
|
90
|
+
const width = view.getUint32(ispe.start + 4);
|
|
91
|
+
const height = view.getUint32(ispe.start + 8);
|
|
92
|
+
if (width === 0 || height === 0 || width > MAX_PIXELS / height) return false;
|
|
93
|
+
found = true;
|
|
94
|
+
offset = ispe.end;
|
|
95
|
+
}
|
|
96
|
+
return found;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Decode a HEIC / HEIF photo to a JPEG. Rejects when the file is over the
|
|
100
|
+
* attachment cap or {@link MAX_PIXELS}, or is not a photo libheif reads.
|
|
101
|
+
*
|
|
102
|
+
* @param file - The photo.
|
|
103
|
+
*/
|
|
104
|
+
async function decodeHeif(file) {
|
|
105
|
+
if (file.size > MAX_FILE_ATTACHMENT_BYTES) throw new Error("HEIF file over the attachment cap");
|
|
106
|
+
if (!await withinPixelCap(file)) throw new Error("HEIF image too large or unreadable");
|
|
107
|
+
const { heicTo } = await import("heic-to/csp");
|
|
108
|
+
return heicTo({
|
|
109
|
+
blob: file,
|
|
110
|
+
type: "image/jpeg",
|
|
111
|
+
quality: JPEG_QUALITY
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { decodeHeif, isHeifType };
|