zidane-ui 9.4.0 → 9.5.2
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/index.d.ts +2 -1
- package/dist/adapters/index.js +2 -1
- package/dist/adapters/live.d.ts +7 -2
- package/dist/adapters/live.js +5 -2
- package/dist/adapters/server-approvals-host.js +3 -1
- package/dist/adapters/server-channels-host.d.ts +32 -0
- package/dist/adapters/server-channels-host.js +49 -0
- package/dist/adapters/server-composer-host.js +13 -0
- package/dist/adapters/server-files-host.js +12 -31
- package/dist/adapters/server-host.js +27 -3
- package/dist/adapters/server-machines-host.d.ts +5 -0
- package/dist/adapters/server-machines-host.js +13 -6
- package/dist/adapters/server-oauth-flow.d.ts +2 -1
- package/dist/adapters/server-projects.d.ts +15 -0
- package/dist/adapters/server-projects.js +225 -0
- package/dist/adapters/server-session-host.d.ts +2 -0
- package/dist/adapters/server-session-host.js +20 -1
- package/dist/app/AppHostProvider.d.ts +1 -1
- package/dist/app/AppHostProvider.js +7 -2
- package/dist/app/ModalProvider.d.ts +6 -2
- package/dist/app/ModalProvider.js +38 -10
- package/dist/app/headless/app-host.d.ts +3 -0
- package/dist/approvals/ApprovalsProvider.d.ts +2 -1
- package/dist/approvals/ApprovalsProvider.js +12 -4
- package/dist/approvals/headless/host.d.ts +13 -2
- package/dist/approvals/headless/index.d.ts +3 -3
- package/dist/approvals/headless/index.js +2 -2
- package/dist/approvals/headless/labels.d.ts +12 -2
- package/dist/approvals/headless/labels.js +19 -1
- package/dist/channels/BindingEditorDialog.d.ts +18 -0
- package/dist/channels/BindingEditorDialog.js +637 -0
- package/dist/channels/ChannelAlertsList.d.ts +25 -0
- package/dist/channels/ChannelAlertsList.js +107 -0
- package/dist/channels/ChannelDefaultsSection.d.ts +20 -0
- package/dist/channels/ChannelDefaultsSection.js +133 -0
- package/dist/channels/ChannelsProvider.d.ts +31 -0
- package/dist/channels/ChannelsProvider.js +29 -0
- package/dist/channels/ChannelsSettingsSection.d.ts +40 -0
- package/dist/channels/ChannelsSettingsSection.js +456 -0
- package/dist/channels/ConnectionSetupDialog.d.ts +16 -0
- package/dist/channels/ConnectionSetupDialog.js +470 -0
- package/dist/channels/HeldRepliesList.d.ts +27 -0
- package/dist/channels/HeldRepliesList.js +173 -0
- package/dist/channels/ProjectChannelsSection.d.ts +55 -0
- package/dist/channels/ProjectChannelsSection.js +433 -0
- package/dist/channels/ReadinessChecklist.d.ts +102 -0
- package/dist/channels/ReadinessChecklist.js +273 -0
- package/dist/channels/TestSessionBanner.d.ts +24 -0
- package/dist/channels/TestSessionBanner.js +44 -0
- package/dist/channels/channels-parts.d.ts +104 -0
- package/dist/channels/channels-parts.js +203 -0
- package/dist/channels/context.d.ts +9 -0
- package/dist/channels/context.js +14 -0
- package/dist/channels/headless/access.d.ts +127 -0
- package/dist/channels/headless/access.js +187 -0
- package/dist/channels/headless/fixture-host.d.ts +83 -0
- package/dist/channels/headless/fixture-host.js +557 -0
- package/dist/channels/headless/host.d.ts +245 -0
- package/dist/channels/headless/host.js +39 -0
- package/dist/channels/headless/index.d.ts +10 -0
- package/dist/channels/headless/index.js +5 -0
- package/dist/channels/headless/labels.d.ts +217 -0
- package/dist/channels/headless/labels.js +260 -0
- package/dist/channels/headless/state.d.ts +22 -0
- package/dist/channels/headless/state.js +303 -0
- package/dist/channels/index.d.ts +21 -0
- package/dist/channels/index.js +13 -0
- package/dist/channels/testing/contract.d.ts +31 -0
- package/dist/channels/testing/contract.js +378 -0
- package/dist/channels/testing/index.d.ts +7 -0
- package/dist/channels/testing/index.js +1 -0
- package/dist/chat/HostBadge.js +1 -0
- package/dist/chat/OrchestratorBadge.d.ts +23 -0
- package/dist/chat/OrchestratorBadge.js +22 -0
- package/dist/chat/SessionGroupHeader.d.ts +11 -1
- package/dist/chat/SessionGroupHeader.js +25 -14
- package/dist/chat/SessionList.d.ts +1 -1
- package/dist/chat/SessionList.js +1 -1
- package/dist/chat/SessionRow.d.ts +141 -0
- package/dist/chat/SessionRow.js +215 -0
- package/dist/chat/StatusDot.d.ts +7 -2
- package/dist/chat/StatusDot.js +3 -2
- package/dist/chat/Transcript.js +6 -2
- package/dist/chat/composer/ComposerEditor.js +1 -1
- package/dist/chat/composer/ContextBreakdown.d.ts +27 -2
- package/dist/chat/composer/ContextBreakdown.js +123 -2
- package/dist/chat/composer/DraftPickers.d.ts +8 -2
- package/dist/chat/composer/DraftPickers.js +7 -3
- package/dist/chat/composer/HostContextOrb.d.ts +2 -0
- package/dist/chat/composer/HostContextOrb.js +17 -2
- package/dist/chat/composer/ProjectMenu.d.ts +16 -3
- package/dist/chat/composer/ProjectMenu.js +102 -20
- package/dist/chat/composer/ScopeToggle.d.ts +7 -2
- package/dist/chat/composer/ScopeToggle.js +4 -2
- package/dist/chat/composer/ServerScopeToggle.d.ts +7 -2
- package/dist/chat/composer/ServerScopeToggle.js +3 -1
- package/dist/chat/composer/index.d.ts +2 -2
- package/dist/chat/composer/index.js +2 -2
- package/dist/chat/composer/use-draft-target.d.ts +12 -1
- package/dist/chat/composer/use-draft-target.js +22 -10
- package/dist/chat/composer/use-send-prompt.d.ts +2 -0
- package/dist/chat/composer/use-send-prompt.js +4 -1
- package/dist/chat/headless/answered-first.d.ts +28 -0
- package/dist/chat/headless/answered-first.js +14 -0
- package/dist/chat/headless/chip-labels.d.ts +2 -0
- package/dist/chat/headless/chip-labels.js +2 -0
- package/dist/chat/headless/composer/composer-sources.d.ts +5 -2
- package/dist/chat/headless/composer/composer-sources.js +6 -0
- package/dist/chat/headless/composer/host.d.ts +13 -0
- package/dist/chat/headless/composer/index.d.ts +2 -2
- package/dist/chat/headless/composer/labels-chrome.d.ts +3 -0
- package/dist/chat/headless/composer/labels-chrome.js +4 -1
- package/dist/chat/headless/composer/labels-editor.d.ts +2 -0
- package/dist/chat/headless/composer/labels-editor.js +2 -0
- package/dist/chat/headless/draft-target.d.ts +2 -0
- package/dist/chat/headless/fixtures/demo-transcript-all-kinds.d.ts +6 -0
- package/dist/chat/headless/fixtures/demo-transcript-all-kinds.js +90 -2
- package/dist/chat/headless/folder-groups.d.ts +41 -0
- package/dist/chat/headless/folder-groups.js +76 -0
- package/dist/chat/headless/host.d.ts +16 -1
- package/dist/chat/headless/hosts.d.ts +1 -1
- package/dist/chat/headless/index.d.ts +15 -10
- package/dist/chat/headless/index.js +35 -30
- package/dist/chat/headless/labels.d.ts +43 -4
- package/dist/chat/headless/labels.js +40 -9
- package/dist/chat/headless/prompt-origin.d.ts +2 -2
- package/dist/chat/headless/prompt-origin.js +3 -3
- package/dist/chat/headless/send-flow.d.ts +2 -0
- package/dist/chat/headless/session-list.d.ts +36 -2
- package/dist/chat/headless/session-list.js +7 -0
- package/dist/chat/headless/sidebar/directory.d.ts +5 -0
- package/dist/chat/headless/sidebar/directory.js +2 -0
- package/dist/chat/headless/sidebar/inbox.d.ts +33 -7
- package/dist/chat/headless/sidebar/inbox.js +65 -26
- package/dist/chat/headless/sidebar/index.d.ts +6 -4
- package/dist/chat/headless/sidebar/index.js +5 -3
- package/dist/chat/headless/sidebar/labels.d.ts +36 -7
- package/dist/chat/headless/sidebar/labels.js +1 -4
- package/dist/chat/headless/sidebar/project-main.d.ts +43 -0
- package/dist/chat/headless/sidebar/project-main.js +46 -0
- package/dist/chat/headless/sidebar/row-changes.d.ts +43 -0
- package/dist/chat/headless/sidebar/row-changes.js +43 -0
- package/dist/chat/headless/sidebar/rows.d.ts +64 -6
- package/dist/chat/headless/sidebar/rows.js +98 -18
- package/dist/chat/headless/sidebar/types.d.ts +12 -0
- package/dist/chat/headless/streams/live-events.d.ts +12 -0
- package/dist/chat/headless/streams/live-events.js +21 -2
- package/dist/chat/headless/streams/store.d.ts +17 -0
- package/dist/chat/headless/streams/store.js +38 -15
- package/dist/chat/headless/streams/types.d.ts +2 -1
- package/dist/chat/headless/transcript/collapse.js +3 -1
- package/dist/chat/headless/transcript/derive.d.ts +1 -0
- package/dist/chat/headless/transcript/derive.js +3 -1
- package/dist/chat/headless/transcript/fold.js +1 -0
- package/dist/chat/headless/transcript/index.d.ts +3 -2
- package/dist/chat/headless/transcript/index.js +2 -1
- package/dist/chat/headless/transcript/rail.d.ts +8 -1
- package/dist/chat/headless/transcript/rail.js +10 -2
- package/dist/chat/headless/transcript/rows.d.ts +31 -3
- package/dist/chat/headless/transcript/select-stops.js +1 -0
- package/dist/chat/headless/transcript/session-groups.d.ts +36 -0
- package/dist/chat/headless/transcript/session-groups.js +94 -0
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/index.d.ts +8 -5
- package/dist/chat/index.js +9 -6
- package/dist/chat/interactions/HostInteractions.js +4 -2
- package/dist/chat/interactions/InboxPanel.js +6 -4
- package/dist/chat/interactions/use-answer-interaction.d.ts +11 -0
- package/dist/chat/interactions/use-answer-interaction.js +19 -0
- package/dist/chat/rich-composer/artifact-mentions.d.ts +29 -0
- package/dist/chat/rich-composer/artifact-mentions.js +40 -0
- package/dist/chat/rich-composer/composer-extensions.d.ts +3 -2
- package/dist/chat/rich-composer/composer-extensions.js +12 -9
- package/dist/chat/rich-composer/use-composer-sources.js +1 -0
- package/dist/chat/sidebar/InboxList.d.ts +26 -2
- package/dist/chat/sidebar/InboxList.js +65 -49
- package/dist/chat/sidebar/MainSessionRow.d.ts +2 -1
- package/dist/chat/sidebar/MainSessionRow.js +1 -1
- package/dist/chat/sidebar/ProjectIcon.d.ts +8 -4
- package/dist/chat/sidebar/ProjectIcon.js +15 -3
- package/dist/chat/sidebar/SessionSidebar.d.ts +51 -2
- package/dist/chat/sidebar/SessionSidebar.js +87 -17
- package/dist/chat/sidebar/SidebarFooter.d.ts +2 -23
- package/dist/chat/sidebar/SidebarFooter.js +2 -43
- package/dist/chat/sidebar/SidebarGroupHeader.d.ts +12 -3
- package/dist/chat/sidebar/SidebarGroupHeader.js +36 -15
- package/dist/chat/sidebar/SidebarLiveProvider.d.ts +22 -0
- package/dist/chat/sidebar/SidebarLiveProvider.js +20 -0
- package/dist/chat/sidebar/SidebarSessionRow.d.ts +6 -1
- package/dist/chat/sidebar/SidebarSessionRow.js +16 -7
- package/dist/chat/sidebar/inbox-triage.d.ts +18 -2
- package/dist/chat/sidebar/inbox-triage.js +39 -12
- package/dist/chat/sidebar/index.d.ts +5 -4
- package/dist/chat/sidebar/index.js +3 -2
- package/dist/chat/sidebar/sidebar-live.d.ts +29 -2
- package/dist/chat/sidebar/sidebar-live.js +36 -2
- package/dist/chat/sidebar/useInboxRows.d.ts +4 -1
- package/dist/chat/sidebar/useInboxRows.js +8 -6
- package/dist/chat/sidebar/useInboxTriage.d.ts +8 -2
- package/dist/chat/sidebar/useInboxTriage.js +29 -20
- package/dist/chat/testing/fixture-composer-host.d.ts +3 -1
- package/dist/chat/testing/fixture-composer-host.js +1 -0
- package/dist/chat/testing/index.d.ts +2 -2
- package/dist/chat/testing/index.js +2 -2
- package/dist/chat/transcript/BadgeMenu.d.ts +9 -2
- package/dist/chat/transcript/BadgeMenu.js +20 -2
- package/dist/chat/transcript/PromptEcho.js +15 -2
- package/dist/chat/transcript/PromptOriginLabel.d.ts +1 -1
- package/dist/chat/transcript/SubagentBlock.js +24 -7
- package/dist/chat/transcript/TranscriptRail.d.ts +3 -1
- package/dist/chat/transcript/TranscriptRail.js +15 -5
- package/dist/chat/transcript/TranscriptRow.js +9 -0
- package/dist/chat/transcript/badges.d.ts +1 -0
- package/dist/chat/transcript/badges.js +1 -0
- package/dist/chat/transcript/fold.js +2 -1
- package/dist/chat/transcript/frame.d.ts +7 -0
- package/dist/chat/transcript/frame.js +51 -5
- package/dist/chat/transcript/index.d.ts +5 -4
- package/dist/chat/transcript/index.js +4 -3
- package/dist/chat/transcript/inline-facts.d.ts +9 -0
- package/dist/chat/transcript/inline-facts.js +20 -0
- package/dist/chat/transcript/notices.d.ts +34 -12
- package/dist/chat/transcript/notices.js +213 -97
- package/dist/chat/transcript/prompt.js +8 -1
- package/dist/chat/transcript/receipt-parts.d.ts +29 -2
- package/dist/chat/transcript/receipt-parts.js +40 -7
- package/dist/chat/transcript/row-estimate.js +4 -1
- package/dist/chat/transcript/run-rows.js +2 -5
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/session-groups.d.ts +21 -0
- package/dist/chat/transcript/session-groups.js +154 -0
- package/dist/chat/transcript/session-line.d.ts +63 -0
- package/dist/chat/transcript/session-line.js +114 -0
- package/dist/chat/transcript/tasks.d.ts +1 -1
- package/dist/chat/transcript/tasks.js +1 -1
- package/dist/chat/transcript/tool-row.js +3 -2
- package/dist/code/editor/FileView.js +1 -3
- package/dist/components/Form.d.ts +28 -1
- package/dist/components/Form.js +43 -7
- package/dist/components/HelpTip.d.ts +22 -0
- package/dist/components/HelpTip.js +26 -0
- package/dist/components/Menu.js +1 -1
- package/dist/components/Notice.d.ts +6 -4
- package/dist/components/Notice.js +73 -27
- package/dist/components/Progress.js +10 -4
- package/dist/components/SearchField.d.ts +46 -0
- package/dist/components/SearchField.js +50 -0
- package/dist/components/ShowMore.d.ts +48 -0
- package/dist/components/ShowMore.js +57 -0
- package/dist/components/Tooltip.js +8 -5
- package/dist/components/charts/ScatterChart.js +13 -6
- package/dist/components/floating/FloatingSurface.js +2 -2
- package/dist/components/floating/useAnchoredPosition.d.ts +15 -1
- package/dist/components/floating/useAnchoredPosition.js +41 -7
- package/dist/components/palette/PaletteList.d.ts +5 -5
- package/dist/components/palette/PaletteList.js +2 -3
- package/dist/components/palette/PalettePanel.js +18 -12
- package/dist/components/palette/palette-layout.d.ts +5 -1
- package/dist/components/palette/palette-layout.js +13 -10
- package/dist/core.css +45 -20
- package/dist/dist/index-BmO8bRgK.d.ts +1 -0
- package/dist/dist/{index-BheVJOLc.d.ts → index-DPbpsCtl.d.ts} +248 -118
- package/dist/dist/index.d.ts +5 -5
- package/dist/dist/sandbox-Bzg_jJK2.d.ts +2 -0
- package/dist/dist/{timeout-CmTx6V9y.d.ts → timeout-NoG7ppkm.d.ts} +1 -1
- package/dist/files/FilesProvider.d.ts +2 -0
- package/dist/files/FilesProvider.js +5 -1
- package/dist/files/headless/host.d.ts +6 -2
- package/dist/files/index.d.ts +2 -2
- package/dist/files/index.js +2 -2
- package/dist/git/GitBar.js +8 -2
- package/dist/git/MoveSessionDialog.js +8 -5
- package/dist/git/MoveToDialog.d.ts +3 -1
- package/dist/git/MoveToDialog.js +43 -16
- package/dist/git/TeleportSessionDialog.d.ts +11 -4
- package/dist/git/TeleportSessionDialog.js +263 -107
- package/dist/git/WherePicker.js +4 -1
- package/dist/git/headless/labels.d.ts +8 -0
- package/dist/git/headless/labels.js +24 -16
- package/dist/git/index.d.ts +2 -2
- package/dist/git/index.js +2 -2
- package/dist/git/useEnvironmentChoices.d.ts +19 -0
- package/dist/git/useEnvironmentChoices.js +34 -10
- package/dist/hooks/useLastCount.d.ts +9 -0
- package/dist/hooks/useLastCount.js +29 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +7 -3
- package/dist/keybindings/headless/overrides.d.ts +1 -1
- package/dist/keybindings/headless/overrides.js +14 -3
- package/dist/labels.d.ts +7 -0
- package/dist/labels.js +10 -3
- package/dist/machines/AddMachineDialog.js +1 -1
- package/dist/machines/AddServerForm.d.ts +14 -2
- package/dist/machines/AddServerForm.js +167 -51
- package/dist/machines/HostCapabilities.js +8 -4
- package/dist/machines/HostSignIn.d.ts +2 -1
- package/dist/machines/HostSignIn.js +1 -0
- package/dist/machines/HostSyncPanel.d.ts +4 -1
- package/dist/machines/HostSyncPanel.js +248 -132
- package/dist/machines/HostsSection.d.ts +2 -2
- package/dist/machines/HostsSection.js +91 -52
- package/dist/machines/LinkedAccountsPanel.d.ts +29 -0
- package/dist/machines/LinkedAccountsPanel.js +268 -0
- package/dist/machines/MachinesExplainer.d.ts +4 -4
- package/dist/machines/MachinesExplainer.js +27 -17
- package/dist/machines/OrganizationPanel.d.ts +12 -5
- package/dist/machines/OrganizationPanel.js +420 -133
- package/dist/machines/ProjectsSpendPanel.d.ts +22 -0
- package/dist/machines/ProjectsSpendPanel.js +160 -0
- package/dist/machines/ServerMachinesPanel.js +19 -4
- package/dist/machines/ServerUpdatePanel.js +3 -3
- package/dist/machines/SyncAccounts.d.ts +14 -7
- package/dist/machines/SyncAccounts.js +67 -81
- package/dist/machines/TokensPanel.js +54 -30
- package/dist/machines/headless/fixture-host.d.ts +15 -10
- package/dist/machines/headless/fixture-host.js +75 -44
- package/dist/machines/headless/fixtures.d.ts +12 -0
- package/dist/machines/headless/fixtures.js +71 -1
- package/dist/machines/headless/host.d.ts +13 -9
- package/dist/machines/headless/index.d.ts +3 -3
- package/dist/machines/headless/index.js +2 -2
- package/dist/machines/headless/labels.d.ts +81 -40
- package/dist/machines/headless/labels.js +103 -60
- package/dist/machines/headless/linked-accounts.d.ts +42 -0
- package/dist/machines/headless/linked-accounts.js +31 -0
- package/dist/machines/headless/organization.d.ts +9 -3
- package/dist/machines/headless/organization.js +12 -2
- package/dist/machines/headless/sync.d.ts +2 -0
- package/dist/machines/index.d.ts +3 -2
- package/dist/machines/index.js +3 -2
- package/dist/machines/sync-rows.d.ts +8 -0
- package/dist/machines/sync-rows.js +10 -0
- package/dist/machines/testing/contract.d.ts +1 -25
- package/dist/machines/testing/contract.js +1 -97
- package/dist/machines/testing/index.d.ts +3 -3
- package/dist/machines/testing/index.js +2 -2
- package/dist/onboarding/demos/extensions.d.ts +4 -0
- package/dist/onboarding/demos/extensions.js +27 -1
- package/dist/onboarding/demos/sidebar-layout.d.ts +4 -2
- package/dist/onboarding/demos/sidebar-layout.js +5 -2
- package/dist/onboarding/headless/labels.d.ts +9 -0
- package/dist/onboarding/headless/labels.js +2 -0
- package/dist/onboarding/steps/SidebarStep.js +4 -2
- package/dist/onboarding/steps/setting-cards.d.ts +4 -2
- package/dist/onboarding/steps/setting-cards.js +3 -2
- package/dist/palette/PaletteDialog.js +4 -4
- package/dist/palette/PaletteRows.js +34 -16
- package/dist/palette/headless/app-sources.js +3 -1
- package/dist/palette/headless/labels.js +2 -2
- package/dist/palette/usePaletteController.js +4 -8
- package/dist/session/ArtifactsPanel.js +11 -23
- package/dist/session/NewProjectDialog.d.ts +33 -0
- package/dist/session/NewProjectDialog.js +216 -0
- package/dist/session/OpenProjectsDialog.d.ts +56 -0
- package/dist/session/OpenProjectsDialog.js +324 -0
- package/dist/session/OpenSessionsDialog.js +186 -61
- package/dist/session/ProjectArtifactsHome.d.ts +42 -0
- package/dist/session/ProjectArtifactsHome.js +98 -0
- package/dist/session/ProjectArtifactsSection.d.ts +13 -0
- package/dist/session/ProjectArtifactsSection.js +367 -0
- package/dist/session/ProjectBudgetsSection.d.ts +7 -0
- package/dist/session/ProjectBudgetsSection.js +377 -0
- package/dist/session/ProjectContextSection.d.ts +20 -0
- package/dist/session/ProjectContextSection.js +139 -0
- package/dist/session/ProjectHome.d.ts +32 -5
- package/dist/session/ProjectHome.js +496 -249
- package/dist/session/ProjectInstructionsSection.d.ts +7 -0
- package/dist/session/ProjectInstructionsSection.js +179 -0
- package/dist/session/ProjectMainButton.d.ts +35 -0
- package/dist/session/ProjectMainButton.js +73 -0
- package/dist/session/ProjectName.d.ts +76 -0
- package/dist/session/ProjectName.js +140 -0
- package/dist/session/ProjectOrchestratorSection.d.ts +14 -0
- package/dist/session/ProjectOrchestratorSection.js +117 -0
- package/dist/session/ProjectPublishDialog.d.ts +30 -0
- package/dist/session/ProjectPublishDialog.js +420 -0
- package/dist/session/ProjectSessionAccessSection.d.ts +13 -0
- package/dist/session/ProjectSessionAccessSection.js +109 -0
- package/dist/session/ProjectSessionsList.d.ts +53 -0
- package/dist/session/ProjectSessionsList.js +316 -0
- package/dist/session/ProjectSettingsDialog.d.ts +30 -0
- package/dist/session/ProjectSettingsDialog.js +693 -0
- package/dist/session/ProjectShareDialog.d.ts +36 -0
- package/dist/session/ProjectShareDialog.js +190 -0
- package/dist/session/ProjectSkillsSection.d.ts +7 -0
- package/dist/session/ProjectSkillsSection.js +197 -0
- package/dist/session/ProjectToolsSection.d.ts +16 -0
- package/dist/session/ProjectToolsSection.js +347 -0
- package/dist/session/ProjectUsage.d.ts +61 -0
- package/dist/session/ProjectUsage.js +344 -0
- package/dist/session/ProviderUsageProvider.d.ts +2 -3
- package/dist/session/QueueTab.js +11 -1
- package/dist/session/SessionAccessNotice.d.ts +31 -0
- package/dist/session/SessionAccessNotice.js +69 -0
- package/dist/session/SessionDetailsDialog.d.ts +3 -1
- package/dist/session/SessionDetailsDialog.js +16 -1
- package/dist/session/SessionHeader.d.ts +10 -3
- package/dist/session/SessionHeader.js +20 -8
- package/dist/session/SessionPeopleStack.d.ts +3 -2
- package/dist/session/SessionPeopleStack.js +51 -17
- package/dist/session/SessionPlaceMenu.js +2 -2
- package/dist/session/SessionProvider.d.ts +13 -1
- package/dist/session/SessionProvider.js +21 -1
- package/dist/session/ShareSessionDialog.d.ts +4 -4
- package/dist/session/ShareSessionDialog.js +182 -283
- package/dist/session/TypingLine.d.ts +9 -4
- package/dist/session/TypingLine.js +16 -5
- package/dist/session/{UsagePanel.d.ts → UsageSection.d.ts} +9 -13
- package/dist/session/{UsagePanel.js → UsageSection.js} +40 -41
- package/dist/session/artifact-row-parts.d.ts +32 -0
- package/dist/session/artifact-row-parts.js +51 -0
- package/dist/session/headless/access.d.ts +33 -0
- package/dist/session/headless/access.js +48 -0
- package/dist/session/headless/fixture-host.d.ts +48 -9
- package/dist/session/headless/fixture-host.js +139 -1
- package/dist/session/headless/fixture-project-artifacts.d.ts +77 -0
- package/dist/session/headless/fixture-project-artifacts.js +168 -0
- package/dist/session/headless/fixture-project-content.d.ts +67 -0
- package/dist/session/headless/fixture-project-content.js +176 -0
- package/dist/session/headless/fixture-projects.d.ts +175 -0
- package/dist/session/headless/fixture-projects.js +498 -0
- package/dist/session/headless/home-layout.d.ts +18 -2
- package/dist/session/headless/home-layout.js +20 -7
- package/dist/session/headless/host.d.ts +263 -7
- package/dist/session/headless/index.d.ts +10 -5
- package/dist/session/headless/index.js +8 -3
- package/dist/session/headless/labels.d.ts +381 -6
- package/dist/session/headless/labels.js +72 -24
- package/dist/session/headless/orchestration-labels.d.ts +52 -0
- package/dist/session/headless/orchestration-labels.js +59 -0
- package/dist/session/headless/project-artifact-labels.d.ts +67 -0
- package/dist/session/headless/project-artifact-labels.js +96 -0
- package/dist/session/headless/project-artifacts.d.ts +124 -0
- package/dist/session/headless/project-artifacts.js +271 -0
- package/dist/session/headless/project-content-labels.d.ts +88 -0
- package/dist/session/headless/project-content-labels.js +152 -0
- package/dist/session/headless/project-labels.d.ts +123 -0
- package/dist/session/headless/project-labels.js +128 -0
- package/dist/session/headless/project-sessions.d.ts +37 -0
- package/dist/session/headless/project-sessions.js +57 -0
- package/dist/session/headless/project-usage-labels.d.ts +74 -0
- package/dist/session/headless/project-usage-labels.js +81 -0
- package/dist/session/headless/project-usage.d.ts +65 -0
- package/dist/session/headless/project-usage.js +92 -0
- package/dist/session/headless/projects.d.ts +158 -0
- package/dist/session/headless/projects.js +301 -0
- package/dist/session/headless/pushed-once.d.ts +22 -0
- package/dist/session/headless/pushed-once.js +28 -0
- package/dist/session/headless/queue.js +2 -1
- package/dist/session/headless/typing.d.ts +20 -1
- package/dist/session/headless/typing.js +58 -3
- package/dist/session/home-block-parts.d.ts +40 -0
- package/dist/session/home-block-parts.js +46 -0
- package/dist/session/index.d.ts +17 -4
- package/dist/session/index.js +16 -3
- package/dist/session/modal-shell.d.ts +1 -1
- package/dist/session/modal-shell.js +1 -1
- package/dist/session/project-artifact-parts.d.ts +59 -0
- package/dist/session/project-artifact-parts.js +222 -0
- package/dist/session/project-content-parts.d.ts +176 -0
- package/dist/session/project-content-parts.js +546 -0
- package/dist/session/project-files.d.ts +48 -0
- package/dist/session/project-files.js +54 -0
- package/dist/session/project-folder-actions.d.ts +11 -0
- package/dist/session/project-folder-actions.js +39 -0
- package/dist/session/project-mcp-add.d.ts +23 -0
- package/dist/session/project-mcp-add.js +107 -0
- package/dist/session/project-record-document.d.ts +48 -0
- package/dist/session/project-record-document.js +225 -0
- package/dist/session/project-settings-parts.d.ts +69 -0
- package/dist/session/project-settings-parts.js +90 -0
- package/dist/session/share-people.d.ts +222 -0
- package/dist/session/share-people.js +457 -0
- package/dist/session/testing/contract.d.ts +67 -8
- package/dist/session/testing/contract.js +343 -6
- package/dist/session/testing/index.d.ts +5 -2
- package/dist/session/testing/index.js +4 -1
- package/dist/session/testing/project-artifacts.contract.js +159 -0
- package/dist/session/testing/project-content.contract.d.ts +19 -0
- package/dist/session/testing/project-content.contract.js +221 -0
- package/dist/session/testing/project-sessions.contract.js +134 -0
- package/dist/session/use-folder-missing.d.ts +6 -0
- package/dist/session/use-folder-missing.js +31 -0
- package/dist/session/use-folder-project.d.ts +14 -0
- package/dist/session/use-folder-project.js +37 -0
- package/dist/session/use-home-projects.d.ts +55 -0
- package/dist/session/use-home-projects.js +154 -0
- package/dist/session/use-project-home-layout.d.ts +33 -0
- package/dist/session/use-project-home-layout.js +134 -0
- package/dist/session/use-project-home-on.d.ts +2 -0
- package/dist/session/use-project-home-on.js +14 -0
- package/dist/settings/SettingCard.d.ts +3 -1
- package/dist/settings/SettingCard.js +2 -1
- package/dist/settings/SettingDemo.d.ts +3 -1
- package/dist/settings/SettingDemo.js +4 -3
- package/dist/settings/SettingsShell.d.ts +2 -1
- package/dist/settings/SettingsShell.js +55 -43
- package/dist/settings/headless/index.d.ts +2 -1
- package/dist/settings/headless/index.js +2 -1
- package/dist/settings/headless/mcp-requirement.d.ts +93 -0
- package/dist/settings/headless/mcp-requirement.js +117 -0
- package/dist/settings/headless/mcp.d.ts +2 -0
- package/dist/settings/headless/mcp.js +3 -2
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/index.d.ts +3 -2
- package/dist/settings/index.js +13 -12
- package/dist/settings/section.d.ts +9 -0
- package/dist/settings/section.js +12 -1
- package/dist/settings/sections/editor/labels.js +1 -1
- package/dist/settings/sections/extensions/ExtensionConfigRows.d.ts +6 -2
- package/dist/settings/sections/extensions/ExtensionConfigRows.js +10 -1
- package/dist/settings/sections/extensions/ExtensionOptionsSection.js +1 -0
- package/dist/settings/sections/extensions/ExtensionsSection.d.ts +6 -3
- package/dist/settings/sections/extensions/ExtensionsSection.js +24 -3
- package/dist/settings/sections/extensions/McpRequirementRow.d.ts +45 -0
- package/dist/settings/sections/extensions/McpRequirementRow.js +298 -0
- package/dist/settings/sections/extensions/labels.d.ts +4 -0
- package/dist/settings/sections/extensions/labels.js +4 -0
- package/dist/settings/sections/extensions/options-labels.d.ts +39 -0
- package/dist/settings/sections/extensions/options-labels.js +48 -1
- package/dist/settings/sections/extensions/use-mcp-setup.d.ts +6 -0
- package/dist/settings/sections/extensions/use-mcp-setup.js +41 -0
- package/dist/settings/sections/host-catalog/HostCatalogSection.js +3 -0
- package/dist/settings/sections/index.d.ts +4 -3
- package/dist/settings/sections/index.js +4 -3
- package/dist/settings/sections/instructions/InstructionsSection.d.ts +69 -1
- package/dist/settings/sections/instructions/InstructionsSection.js +181 -109
- package/dist/settings/sections/mcp/McpAddForm.d.ts +9 -2
- package/dist/settings/sections/mcp/McpAddForm.js +15 -7
- package/dist/settings/sections/mcp/McpSection.js +3 -5
- package/dist/settings/sections/mcp/McpServerRow.js +7 -47
- package/dist/settings/sections/mcp/McpSignIn.d.ts +38 -0
- package/dist/settings/sections/mcp/McpSignIn.js +72 -0
- package/dist/settings/sections/mcp/labels.js +1 -1
- package/dist/settings/sections/models/AgentDefaults.d.ts +12 -4
- package/dist/settings/sections/models/AgentDefaults.js +102 -70
- package/dist/settings/sections/models/ModelPickField.d.ts +10 -1
- package/dist/settings/sections/models/ModelPickField.js +87 -39
- package/dist/settings/sections/models/labels.d.ts +8 -0
- package/dist/settings/sections/models/labels.js +8 -0
- package/dist/settings/sections/performance/labels.js +2 -2
- package/dist/settings/sections/providers/ServerSignIn.d.ts +6 -1
- package/dist/settings/sections/providers/ServerSignIn.js +66 -61
- package/dist/settings/sections/skills/SkillList.d.ts +45 -0
- package/dist/settings/sections/skills/SkillList.js +58 -40
- package/dist/settings/server-app.d.ts +2 -0
- package/dist/settings/server-app.js +16 -4
- package/dist/styles.css +170 -34
- package/dist/theme/runtime-icons.js +7 -3
- package/dist/workspace/PanelContentView.js +1 -1
- package/package.json +26 -2
- package/src/styles/app.css +6 -3
- package/src/styles/palette.css +15 -19
- package/src/styles/primitives.css +3 -1
- package/src/styles/transcript.css +61 -0
- package/dist/dist/index-ttmMvjgM.d.ts +0 -1
- package/dist/dist/sandbox-CSUihARm.d.ts +0 -2
- package/dist/machines/PersonalLayerPanel.d.ts +0 -32
- package/dist/machines/PersonalLayerPanel.js +0 -360
- package/dist/machines/headless/layer.d.ts +0 -64
- package/dist/machines/headless/layer.js +0 -56
- /package/dist/dist/{execution-failure-SREfl-EZ.d.ts → execution-failure-_L2r_Qd-.d.ts} +0 -0
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { ModalShell, useOptionalModal } from "../app/ModalProvider.js";
|
|
2
|
+
import { constant, useReadable } from "../chat/headless/store.js";
|
|
3
|
+
import { Facts, MetaChip } from "../components/Form.js";
|
|
4
|
+
import { Notice } from "../components/Notice.js";
|
|
5
|
+
import { numberFormats } from "../components/numbers.js";
|
|
6
|
+
import { errorMessage } from "../components/report-error.js";
|
|
7
|
+
import { Segmented } from "../components/Segmented.js";
|
|
8
|
+
import { ShowMoreButton, useShowMore } from "../components/ShowMore.js";
|
|
9
|
+
import { Skeleton } from "../components/Skeleton.js";
|
|
10
|
+
import { useTooltip } from "../components/Tooltip.js";
|
|
11
|
+
import { formatUsd, tightestBudget } from "./headless/project-usage.js";
|
|
12
|
+
import { managesProject } from "./headless/projects.js";
|
|
13
|
+
import { useSessionProjects } from "./SessionProvider.js";
|
|
14
|
+
import { useSessionLabels } from "./useSessionLabels.js";
|
|
15
|
+
import { useCallback, useEffect, useState } from "react";
|
|
16
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
// src/session/ProjectUsage.tsx
|
|
18
|
+
const NO_LIVE = constant(null);
|
|
19
|
+
const NO_PLACES = constant({});
|
|
20
|
+
const FILL = {
|
|
21
|
+
ok: "bg-[var(--zg-accent)]",
|
|
22
|
+
warn: "bg-zg-warn-dot",
|
|
23
|
+
reached: "bg-zg-danger-dot"
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* One budget: what it is, what it spent of its limit, and a bar that fills toward it (warning from 80 %, danger once
|
|
27
|
+
* spent).
|
|
28
|
+
*
|
|
29
|
+
* @param props - {@link BudgetBarProps}.
|
|
30
|
+
*/
|
|
31
|
+
function BudgetBar({ state, name, className = "", style }) {
|
|
32
|
+
const labels = useSessionLabels();
|
|
33
|
+
const what = budgetName(labels, state, name);
|
|
34
|
+
const share = Math.min(1, state.limitUsd > 0 ? state.spentUsd / state.limitUsd : 0);
|
|
35
|
+
const status = state.level === "reached" ? labels.projectBudgetReached : state.level === "warn" ? labels.projectBudgetWarn : null;
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
37
|
+
className: `flex flex-col gap-1 min-w-0 ${className}`,
|
|
38
|
+
style,
|
|
39
|
+
"data-budget-level": state.level,
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "flex items-baseline justify-between gap-3 min-w-0",
|
|
43
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
44
|
+
className: "truncate",
|
|
45
|
+
children: what
|
|
46
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
47
|
+
className: "zg-meta shrink-0",
|
|
48
|
+
children: labels.projectUsageSpentOf(formatUsd(state.spentUsd), formatUsd(state.limitUsd))
|
|
49
|
+
})]
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ jsx("div", {
|
|
52
|
+
role: "meter",
|
|
53
|
+
"aria-label": what,
|
|
54
|
+
"aria-valuenow": state.spentUsd,
|
|
55
|
+
"aria-valuemin": 0,
|
|
56
|
+
"aria-valuemax": state.limitUsd,
|
|
57
|
+
className: "zg-track-chip relative h-1.5 overflow-hidden",
|
|
58
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
59
|
+
className: `absolute inset-0 origin-left ${FILL[state.level]}`,
|
|
60
|
+
style: { transform: `scaleX(${share})` }
|
|
61
|
+
})
|
|
62
|
+
}),
|
|
63
|
+
status && /* @__PURE__ */ jsx(MetaChip, {
|
|
64
|
+
tone: state.level === "reached" ? "danger" : "warn",
|
|
65
|
+
className: "self-start",
|
|
66
|
+
children: status
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** A budget's name: daily or monthly, of a source, of a person. */
|
|
72
|
+
function budgetName(labels, { scope }, name) {
|
|
73
|
+
return scope.kind === "project" ? scope.period === "day" ? labels.projectBudgetDay : labels.projectBudgetMonth : scope.kind === "source" ? labels.projectBudgetSource(scope.source) : labels.projectBudgetPerson(name ?? labels.projectUsageNobody);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The project's most pressing budget once it is near its limit (over 80 %, or spent): what it spent of it, live while
|
|
77
|
+
* its runs stream, in its tone. A press opens the Usage view. Nothing while every budget is under 80 %, for a project
|
|
78
|
+
* with no budget, without `SessionProjects.usage`, nor before the first read.
|
|
79
|
+
*
|
|
80
|
+
* @param props - {@link ProjectSpendChipProps}.
|
|
81
|
+
*/
|
|
82
|
+
function ProjectSpendChip({ projectId, onOpen, className = "", style }) {
|
|
83
|
+
const usage = useSessionProjects()?.usage;
|
|
84
|
+
const labels = useSessionLabels();
|
|
85
|
+
const live = useReadable(usage?.live(projectId) ?? NO_LIVE);
|
|
86
|
+
const openDialog = useProjectUsage();
|
|
87
|
+
useEffect(() => usage?.ensure(projectId), [usage, projectId]);
|
|
88
|
+
const open = onOpen ?? (openDialog ? () => openDialog(projectId) : void 0);
|
|
89
|
+
const tightest = live ? tightestBudget(live.budgets) : void 0;
|
|
90
|
+
const near = tightest && tightest.level !== "ok" ? tightest : void 0;
|
|
91
|
+
const spent = near ? formatUsd(near.spentUsd) : "";
|
|
92
|
+
const limit = near ? formatUsd(near.limitUsd) : "";
|
|
93
|
+
const label = near ? labels.projectSpendChipLabel(budgetName(labels, near), spent, limit, near.level === "reached") : "";
|
|
94
|
+
const { anchorProps, tip } = useTooltip(label);
|
|
95
|
+
if (!usage || !near) return null;
|
|
96
|
+
const level = near.level;
|
|
97
|
+
const period = near.scope.kind === "project" ? near.scope.period : "day";
|
|
98
|
+
const tone = level === "reached" ? "!text-zg-danger !bg-zg-danger/12" : "!text-zg-warn !bg-zg-warn/12";
|
|
99
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
100
|
+
...anchorProps,
|
|
101
|
+
type: "button",
|
|
102
|
+
className: `zg-track-chip zg-meta zg-press-subtle inline-flex items-center gap-1 h-[18px] px-1.5 border-0 cursor-pointer ${tone} ${className}`,
|
|
103
|
+
style,
|
|
104
|
+
"aria-label": label,
|
|
105
|
+
"data-budget-level": level,
|
|
106
|
+
disabled: !open,
|
|
107
|
+
onClick: open,
|
|
108
|
+
children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", {
|
|
110
|
+
"aria-hidden": true,
|
|
111
|
+
className: "i-ph-coins shrink-0"
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ jsx("span", { children: labels.projectSpendChip(spent, limit, period) }),
|
|
114
|
+
tip
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
const RANGES = [
|
|
119
|
+
"today",
|
|
120
|
+
"month",
|
|
121
|
+
"7d",
|
|
122
|
+
"30d"
|
|
123
|
+
];
|
|
124
|
+
/** Whose keys the project's sessions run on, as its sharing says (none: this computer's). */
|
|
125
|
+
function usePayer(projectId) {
|
|
126
|
+
const labels = useSessionLabels();
|
|
127
|
+
const sharing = useSessionProjects()?.sharing;
|
|
128
|
+
const [payer, setPayer] = useState(sharing ? null : labels.projectUsagePaysHost);
|
|
129
|
+
useEffect(() => {
|
|
130
|
+
if (!sharing) return void 0;
|
|
131
|
+
let live = true;
|
|
132
|
+
sharing.get(projectId).then((view) => live && setPayer(view.runOnOwnerKeys && view.owner ? labels.projectUsagePaysOwner(view.owner.name ?? view.owner.email) : labels.projectUsagePaysProject), () => live && setPayer(null));
|
|
133
|
+
return () => {
|
|
134
|
+
live = false;
|
|
135
|
+
};
|
|
136
|
+
}, [
|
|
137
|
+
sharing,
|
|
138
|
+
projectId,
|
|
139
|
+
labels
|
|
140
|
+
]);
|
|
141
|
+
return payer;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A project's Usage view: a period, its spend against each budget, and that spend split by source, person (owners and
|
|
145
|
+
* maintainers), session or model, with whose keys pay. Renders nothing without `SessionProjects.usage`.
|
|
146
|
+
*
|
|
147
|
+
* @param props - {@link ProjectUsageDialogProps}.
|
|
148
|
+
*/
|
|
149
|
+
function ProjectUsageDialog({ projectId, onClose }) {
|
|
150
|
+
const projects = useSessionProjects();
|
|
151
|
+
const usage = projects?.usage;
|
|
152
|
+
const labels = useSessionLabels();
|
|
153
|
+
const places = useReadable(projects?.sharing?.places ?? NO_PLACES);
|
|
154
|
+
const live = useReadable(usage?.live(projectId) ?? NO_LIVE);
|
|
155
|
+
const payer = usePayer(projectId);
|
|
156
|
+
const [range, setRange] = useState("today");
|
|
157
|
+
const [groupBy, setGroupBy] = useState("source");
|
|
158
|
+
const [view, setView] = useState(null);
|
|
159
|
+
const people = !projects?.sharing || managesProject(places[projectId]);
|
|
160
|
+
useEffect(() => projects?.sharing?.ensurePlace(projectId), [projects, projectId]);
|
|
161
|
+
useEffect(() => {
|
|
162
|
+
if (!usage) return void 0;
|
|
163
|
+
let current = true;
|
|
164
|
+
usage.read(projectId, range, groupBy).then((answer) => current && setView(answer), (err) => current && setView({ detail: errorMessage(err) }));
|
|
165
|
+
return () => {
|
|
166
|
+
current = false;
|
|
167
|
+
};
|
|
168
|
+
}, [
|
|
169
|
+
usage,
|
|
170
|
+
projectId,
|
|
171
|
+
range,
|
|
172
|
+
groupBy,
|
|
173
|
+
live
|
|
174
|
+
]);
|
|
175
|
+
if (!usage) return null;
|
|
176
|
+
const groups = [
|
|
177
|
+
{
|
|
178
|
+
value: "source",
|
|
179
|
+
label: labels.projectUsageBySource
|
|
180
|
+
},
|
|
181
|
+
...people ? [{
|
|
182
|
+
value: "person",
|
|
183
|
+
label: labels.projectUsageByPerson
|
|
184
|
+
}] : [],
|
|
185
|
+
{
|
|
186
|
+
value: "session",
|
|
187
|
+
label: labels.projectUsageBySession
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
value: "model",
|
|
191
|
+
label: labels.projectUsageByModel
|
|
192
|
+
}
|
|
193
|
+
];
|
|
194
|
+
const rangeLabel = {
|
|
195
|
+
"today": labels.projectUsageToday,
|
|
196
|
+
"month": labels.projectUsageMonth,
|
|
197
|
+
"7d": labels.projectUsage7d,
|
|
198
|
+
"30d": labels.projectUsage30d
|
|
199
|
+
};
|
|
200
|
+
return /* @__PURE__ */ jsx(ModalShell, {
|
|
201
|
+
title: labels.projectUsageTitle,
|
|
202
|
+
...payer ? { description: payer } : {},
|
|
203
|
+
onClose,
|
|
204
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
205
|
+
className: "flex flex-col gap-5",
|
|
206
|
+
"data-testid": "project-usage",
|
|
207
|
+
children: [
|
|
208
|
+
/* @__PURE__ */ jsxs("div", {
|
|
209
|
+
className: "flex flex-wrap items-center justify-between gap-2",
|
|
210
|
+
children: [/* @__PURE__ */ jsx(Segmented, {
|
|
211
|
+
size: "sm",
|
|
212
|
+
ariaLabel: labels.projectUsageRange,
|
|
213
|
+
value: range,
|
|
214
|
+
onChange: setRange,
|
|
215
|
+
options: RANGES.map((value) => ({
|
|
216
|
+
value,
|
|
217
|
+
label: rangeLabel[value]
|
|
218
|
+
}))
|
|
219
|
+
}), /* @__PURE__ */ jsx(Segmented, {
|
|
220
|
+
size: "sm",
|
|
221
|
+
ariaLabel: labels.projectUsageSplit,
|
|
222
|
+
value: groupBy,
|
|
223
|
+
onChange: setGroupBy,
|
|
224
|
+
options: groups
|
|
225
|
+
})]
|
|
226
|
+
}),
|
|
227
|
+
view && "detail" in view && /* @__PURE__ */ jsx(Notice, {
|
|
228
|
+
tone: "error",
|
|
229
|
+
compact: true,
|
|
230
|
+
detail: view.detail,
|
|
231
|
+
children: labels.projectUsageLoadFailed
|
|
232
|
+
}),
|
|
233
|
+
view === null && /* @__PURE__ */ jsx("div", {
|
|
234
|
+
"aria-busy": "true",
|
|
235
|
+
"aria-label": labels.projectUsageLoading,
|
|
236
|
+
children: /* @__PURE__ */ jsx(Skeleton, { height: 96 })
|
|
237
|
+
}),
|
|
238
|
+
view && "totals" in view && /* @__PURE__ */ jsx(UsageBody, {
|
|
239
|
+
view,
|
|
240
|
+
groupBy
|
|
241
|
+
}, groupBy)
|
|
242
|
+
]
|
|
243
|
+
})
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/** A total's facts, each its own item on one quiet line: tokens, tool calls, turns. */
|
|
247
|
+
function UsageFacts({ totals }) {
|
|
248
|
+
const labels = useSessionLabels();
|
|
249
|
+
const tokens = numberFormats().compact(totals.input + totals.output + totals.cacheRead + totals.cacheCreation);
|
|
250
|
+
return /* @__PURE__ */ jsx(Facts, {
|
|
251
|
+
className: "zg-meta",
|
|
252
|
+
facts: [
|
|
253
|
+
labels.projectUsageTokens(tokens),
|
|
254
|
+
labels.projectUsageToolCalls(totals.toolCalls),
|
|
255
|
+
labels.projectUsageTurns(totals.turns)
|
|
256
|
+
]
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
/** The totals, the budgets and the split of one read: three blocks on one left edge. */
|
|
260
|
+
function UsageBody({ view, groupBy }) {
|
|
261
|
+
const labels = useSessionLabels();
|
|
262
|
+
const unnamed = groupBy === "source" ? labels.projectUsageNoSource : groupBy === "person" ? labels.projectUsageNobody : labels.projectUsageUnknown;
|
|
263
|
+
const groupLabel = (group) => group.label ?? (group.key ? group.key : unnamed);
|
|
264
|
+
const names = Object.fromEntries((view.groups ?? []).filter((g) => g.label).map((g) => [g.key, g.label]));
|
|
265
|
+
const { shown, hidden, more } = useShowMore(view.groups ?? []);
|
|
266
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
267
|
+
/* @__PURE__ */ jsxs("div", {
|
|
268
|
+
className: "flex flex-col gap-1",
|
|
269
|
+
children: [
|
|
270
|
+
/* @__PURE__ */ jsx("span", {
|
|
271
|
+
className: "zg-section-label",
|
|
272
|
+
children: labels.projectUsageSpent
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsx("span", {
|
|
275
|
+
className: "text-zg-title font-semibold tabular-nums",
|
|
276
|
+
children: formatUsd(view.totals.costUsd)
|
|
277
|
+
}),
|
|
278
|
+
/* @__PURE__ */ jsx(UsageFacts, { totals: view.totals })
|
|
279
|
+
]
|
|
280
|
+
}),
|
|
281
|
+
view.budgets.length > 0 && /* @__PURE__ */ jsxs("section", {
|
|
282
|
+
className: "flex flex-col gap-3",
|
|
283
|
+
"aria-label": labels.projectUsageBudgets,
|
|
284
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
285
|
+
className: "zg-section-label m-0",
|
|
286
|
+
children: labels.projectUsageBudgets
|
|
287
|
+
}), view.budgets.map((state) => /* @__PURE__ */ jsx(BudgetBar, {
|
|
288
|
+
state,
|
|
289
|
+
...state.scope.kind === "person" && names[state.scope.person] ? { name: names[state.scope.person] } : {}
|
|
290
|
+
}, JSON.stringify(state.scope)))]
|
|
291
|
+
}),
|
|
292
|
+
view.groups && /* @__PURE__ */ jsxs("section", {
|
|
293
|
+
className: "flex flex-col gap-1",
|
|
294
|
+
"aria-label": labels.projectUsageSplitHeading[groupBy],
|
|
295
|
+
children: [
|
|
296
|
+
/* @__PURE__ */ jsx("h3", {
|
|
297
|
+
className: "zg-section-label m-0",
|
|
298
|
+
children: labels.projectUsageSplitHeading[groupBy]
|
|
299
|
+
}),
|
|
300
|
+
view.groups.length === 0 && /* @__PURE__ */ jsx("span", {
|
|
301
|
+
className: "text-[var(--zg-text-muted)]",
|
|
302
|
+
children: labels.projectUsageEmpty
|
|
303
|
+
}),
|
|
304
|
+
view.groups.length > 0 && /* @__PURE__ */ jsx("ul", {
|
|
305
|
+
className: "flex flex-col gap-3 m-0 p-0 pt-1 list-none",
|
|
306
|
+
"aria-label": labels.projectUsageSplit,
|
|
307
|
+
children: shown.map((group) => /* @__PURE__ */ jsxs("li", {
|
|
308
|
+
className: "flex items-baseline gap-3 min-w-0",
|
|
309
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
310
|
+
className: "flex flex-col gap-0.5 min-w-0 flex-1",
|
|
311
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
312
|
+
className: `truncate ${!group.label && group.key && groupBy !== "person" ? "zg-meta !text-[var(--zg-text)]" : ""}`,
|
|
313
|
+
children: /* @__PURE__ */ jsx("bdi", { children: groupLabel(group) })
|
|
314
|
+
}), /* @__PURE__ */ jsx(UsageFacts, { totals: group })]
|
|
315
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
316
|
+
className: "zg-meta shrink-0 !text-[var(--zg-text)]",
|
|
317
|
+
children: formatUsd(group.costUsd)
|
|
318
|
+
})]
|
|
319
|
+
}, group.key))
|
|
320
|
+
}),
|
|
321
|
+
/* @__PURE__ */ jsx(ShowMoreButton, {
|
|
322
|
+
hidden,
|
|
323
|
+
onMore: more,
|
|
324
|
+
className: ""
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
})
|
|
328
|
+
] });
|
|
329
|
+
}
|
|
330
|
+
/** Opens a project's Usage view on the app's modal layer: `undefined` without one, or without `SessionProjects.usage`. */
|
|
331
|
+
function useProjectUsage() {
|
|
332
|
+
const usage = useSessionProjects()?.usage;
|
|
333
|
+
const modal = useOptionalModal();
|
|
334
|
+
const open = modal?.open;
|
|
335
|
+
const close = modal?.close;
|
|
336
|
+
const show = useCallback((projectId) => {
|
|
337
|
+
open?.(/* @__PURE__ */ jsx(ProjectUsageDialog, {
|
|
338
|
+
projectId,
|
|
339
|
+
onClose: () => close?.()
|
|
340
|
+
}));
|
|
341
|
+
}, [open, close]);
|
|
342
|
+
return usage && open ? show : void 0;
|
|
343
|
+
}
|
|
344
|
+
export { BudgetBar, ProjectSpendChip, ProjectUsageDialog, useProjectUsage };
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Subscription usage for the components that show it (
|
|
3
|
-
* usage panel): ONE cache and ONE refresh cadence per host, shared through
|
|
2
|
+
* Subscription usage for the components that show it (Settings › Usage): ONE cache and ONE refresh cadence per host, shared through
|
|
4
3
|
* context. `autoLoad` probes every minute while the window is visible and
|
|
5
4
|
* focused, and catches up when it comes back to it; off, nothing is fetched
|
|
6
5
|
* in the background (GitHub's observed limits still show, no network) and a
|
|
7
6
|
* manual refresh still works.
|
|
8
7
|
*
|
|
9
8
|
* <ProviderUsageProvider autoLoad={settings.subscriptionUsage !== false}>
|
|
10
|
-
* <
|
|
9
|
+
* <UsageSection … />
|
|
11
10
|
* </ProviderUsageProvider>
|
|
12
11
|
*/
|
|
13
12
|
import { ProviderUsageState, ProviderUsageView } from "./headless/usage.js";
|
package/dist/session/QueueTab.js
CHANGED
|
@@ -221,6 +221,16 @@ function QueueList({ messages, onPush, onDrop, onEdit, attachments: slot }) {
|
|
|
221
221
|
onSave: () => void commitEdit(msg),
|
|
222
222
|
onSaveAndPush: () => void pushEntry(msg),
|
|
223
223
|
onCancel: cancelEdit
|
|
224
|
+
}) : msg.waitingFor !== void 0 ? /* @__PURE__ */ jsxs("div", {
|
|
225
|
+
className: "flex flex-col items-start gap-1 py-1",
|
|
226
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
227
|
+
className: "m-0 w-full min-w-0 text-zg-ui leading-5 text-[var(--zg-text)] whitespace-pre-wrap break-words line-clamp-4",
|
|
228
|
+
children: msg.text.trim()
|
|
229
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
230
|
+
className: "text-zg-label text-[var(--zg-text-muted)]",
|
|
231
|
+
"data-testid": "queue-waiting",
|
|
232
|
+
children: labels.queueWaitingFor(msg.waitingFor)
|
|
233
|
+
})]
|
|
224
234
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
225
235
|
className: "flex flex-col items-start gap-1 py-1",
|
|
226
236
|
children: [/* @__PURE__ */ jsx("button", {
|
|
@@ -237,7 +247,7 @@ function QueueList({ messages, onPush, onDrop, onEdit, attachments: slot }) {
|
|
|
237
247
|
}) : null]
|
|
238
248
|
})
|
|
239
249
|
}),
|
|
240
|
-
/* @__PURE__ */ jsxs("span", {
|
|
250
|
+
msg.waitingFor === void 0 && /* @__PURE__ */ jsxs("span", {
|
|
241
251
|
onMouseDown: editing ? (e) => e.preventDefault() : void 0,
|
|
242
252
|
className: `shrink-0 h-7 inline-flex items-center gap-0.5 transition-opacity ${editing ? "opacity-100" : "opacity-0 group-hover/queued:opacity-100 group-focus-within/queued:opacity-100"}`,
|
|
243
253
|
children: [
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When a shared session is no longer yours (organization mode, docs/MULTIPLAYER.md): the owner removed you, or
|
|
3
|
+
* stopped sharing a live session. `useSessionAccess` reads it from the host's `sharing.access`, at once and without
|
|
4
|
+
* a reload; the app then shows `SessionAccessNotice` in place of the composer and what docks on it, so you never type
|
|
5
|
+
* into a session that refuses you. Being invited again brings the composer back.
|
|
6
|
+
*/
|
|
7
|
+
import { SessionAccessLoss } from "./headless/access.js";
|
|
8
|
+
import { CSSProperties } from "react";
|
|
9
|
+
/**
|
|
10
|
+
* Why `sessionId` is no longer yours to use, or `null` while it is (and on a host without `sharing.access`).
|
|
11
|
+
*
|
|
12
|
+
* @param sessionId - The session shown, or `null` for none (a new session's composer).
|
|
13
|
+
*/
|
|
14
|
+
export declare function useSessionAccess(sessionId: string | null): SessionAccessLoss | null;
|
|
15
|
+
/** Props for {@link SessionAccessNotice}. */
|
|
16
|
+
export interface SessionAccessNoticeProps {
|
|
17
|
+
/** Why the session is no longer yours ({@link useSessionAccess}). */
|
|
18
|
+
loss: SessionAccessLoss;
|
|
19
|
+
/** Leaves the session (the Close button). Absent: no button. */
|
|
20
|
+
onClose?: () => void;
|
|
21
|
+
/** Extra classes on the root. */
|
|
22
|
+
className?: string;
|
|
23
|
+
/** Inline styles on the root. */
|
|
24
|
+
style?: CSSProperties;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Renders, at the composer's place and width, why the session is no longer yours, with a Close.
|
|
28
|
+
*
|
|
29
|
+
* @param props - The {@link SessionAccessNoticeProps}.
|
|
30
|
+
*/
|
|
31
|
+
export declare function SessionAccessNotice(props: SessionAccessNoticeProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { buttonClass } from "../components/button.js";
|
|
2
|
+
import { useSessionHost } from "./SessionProvider.js";
|
|
3
|
+
import { useSessionLabels } from "./useSessionLabels.js";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/session/SessionAccessNotice.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Why `sessionId` is no longer yours to use, or `null` while it is (and on a host without `sharing.access`).
|
|
9
|
+
*
|
|
10
|
+
* @param sessionId - The session shown, or `null` for none (a new session's composer).
|
|
11
|
+
*/
|
|
12
|
+
function useSessionAccess(sessionId) {
|
|
13
|
+
const access = useSessionHost().sharing?.access;
|
|
14
|
+
const [loss, setLoss] = useState(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (!access || !sessionId) return void 0;
|
|
17
|
+
return access.watch(sessionId, (next) => setLoss(next ? {
|
|
18
|
+
sessionId,
|
|
19
|
+
loss: next
|
|
20
|
+
} : null));
|
|
21
|
+
}, [access, sessionId]);
|
|
22
|
+
return loss && loss.sessionId === sessionId ? loss.loss : null;
|
|
23
|
+
}
|
|
24
|
+
const ICONS = {
|
|
25
|
+
removed: "i-ph-user-minus",
|
|
26
|
+
ended: "i-ph-link-break"
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Renders, at the composer's place and width, why the session is no longer yours, with a Close.
|
|
30
|
+
*
|
|
31
|
+
* @param props - The {@link SessionAccessNoticeProps}.
|
|
32
|
+
*/
|
|
33
|
+
function SessionAccessNotice(props) {
|
|
34
|
+
const { loss, onClose, className = "", style } = props;
|
|
35
|
+
const labels = useSessionLabels();
|
|
36
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
37
|
+
role: "status",
|
|
38
|
+
"data-testid": "session-access-notice",
|
|
39
|
+
"data-loss": loss,
|
|
40
|
+
className: `zg-raised rounded-zg-2xl border flex items-center gap-3 px-4 py-3.5 ${className}`.trimEnd(),
|
|
41
|
+
style,
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", {
|
|
44
|
+
"aria-hidden": true,
|
|
45
|
+
className: `${ICONS[loss]} size-5 shrink-0 text-[var(--zg-text-muted)]`
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: "flex-1 min-w-0",
|
|
49
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
50
|
+
className: "m-0 text-sm text-[var(--zg-text)]",
|
|
51
|
+
children: labels.accessLostTitle[loss]
|
|
52
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
53
|
+
className: "m-0 mt-0.5 text-xs text-[var(--zg-text-muted)]",
|
|
54
|
+
children: labels.accessLostBody
|
|
55
|
+
})]
|
|
56
|
+
}),
|
|
57
|
+
onClose && /* @__PURE__ */ jsx("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
onClick: onClose,
|
|
60
|
+
className: `${buttonClass({
|
|
61
|
+
variant: "secondary",
|
|
62
|
+
size: "sm"
|
|
63
|
+
})} shrink-0`,
|
|
64
|
+
children: labels.accessLostClose
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export { SessionAccessNotice, useSessionAccess };
|
|
@@ -72,8 +72,10 @@ export interface SessionDetailsFacts {
|
|
|
72
72
|
cwd: string;
|
|
73
73
|
/** The folder as shown (its home folder as `~`, a long path giving way in the middle). Default: `cwd`. */
|
|
74
74
|
folderDisplay?: string;
|
|
75
|
-
/** The project root
|
|
75
|
+
/** The project root (a worktree's main checkout), whose project the description names. */
|
|
76
76
|
projectRoot?: string;
|
|
77
|
+
/** The saved server the session runs on. Absent: this computer (its project shows). */
|
|
78
|
+
hostId?: string;
|
|
77
79
|
/** The orchestration main: titled Main, folderless, everywhere. */
|
|
78
80
|
isMain?: boolean;
|
|
79
81
|
/** Where the folder is when this computer's picker can't choose it. */
|
|
@@ -9,6 +9,8 @@ import { useDisplayPath } from "../hooks/useDisplayPath.js";
|
|
|
9
9
|
import { useHydrated } from "../hooks/useHydrated.js";
|
|
10
10
|
import { SwapIcon } from "../motion/SwapIcon.js";
|
|
11
11
|
import { useSettings } from "../settings/SettingsProvider.js";
|
|
12
|
+
import { ProjectBadge, useSessionProject } from "./ProjectName.js";
|
|
13
|
+
import { useProjectSettings } from "./ProjectSettingsDialog.js";
|
|
12
14
|
import { useSessionHost } from "./SessionProvider.js";
|
|
13
15
|
import { ShellFrame } from "./SessionShell.js";
|
|
14
16
|
import { useSessionLabels } from "./useSessionLabels.js";
|
|
@@ -30,6 +32,9 @@ const STATUS_DOT = {
|
|
|
30
32
|
function SessionDetailsDialog({ session, onRename, confirmDelete, onDelete, spaces = null, spaceId: spaceProp, onMoveToSpace, onRevealFolder, onPickFolder, folderPicker, onChanged, cache, formatError = errorMessage, onClose, renderShell, className, style }) {
|
|
31
33
|
const labels = useSessionLabels();
|
|
32
34
|
const details = useSessionHost().details;
|
|
35
|
+
const project = useSessionProject(session.id, session.cwd ? session.projectRoot || session.cwd : null, !session.hostId && session.isMain !== true);
|
|
36
|
+
const openProjectSettings = useProjectSettings();
|
|
37
|
+
const projectId = project?.id ?? null;
|
|
33
38
|
const [title, setTitle] = useState(session.title);
|
|
34
39
|
const [busy, setBusy] = useState(null);
|
|
35
40
|
const [error, setError] = useState(null);
|
|
@@ -134,7 +139,17 @@ function SessionDetailsDialog({ session, onRename, confirmDelete, onDelete, spac
|
|
|
134
139
|
return /* @__PURE__ */ jsxs(ShellFrame, {
|
|
135
140
|
render: renderShell,
|
|
136
141
|
title: labels.detailsTitle,
|
|
137
|
-
description: isMain ? labels.detailsMainDescription :
|
|
142
|
+
description: isMain ? labels.detailsMainDescription : project ? /* @__PURE__ */ jsx(ProjectBadge, {
|
|
143
|
+
name: project.name,
|
|
144
|
+
...project.icon ? { icon: project.icon } : {},
|
|
145
|
+
...projectId && openProjectSettings ? {
|
|
146
|
+
label: labels.detailsProjectSettings(project.name),
|
|
147
|
+
onClick: () => {
|
|
148
|
+
onClose();
|
|
149
|
+
openProjectSettings(projectId);
|
|
150
|
+
}
|
|
151
|
+
} : {}
|
|
152
|
+
}) : session.cwd || session.projectRoot || labels.headerChat,
|
|
138
153
|
onClose,
|
|
139
154
|
...className ? { className } : {},
|
|
140
155
|
...style ? { style } : {},
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The session header, a breadcrumb: where the session runs (`place`, a dot for a
|
|
3
|
-
* sandbox or a server), its project (the original repository,
|
|
4
|
-
*
|
|
3
|
+
* sandbox or a server), its project (the original repository, named and with
|
|
4
|
+
* its icon as the sidebar shows it: `ProjectName`; a click opens its settings
|
|
5
|
+
* with `onOpenProjectSettings` when the host knows the project, else its home
|
|
6
|
+
* with `onOpenProject`, else changes the folder), its own branch for a worktree or a sandbox (a click opens the
|
|
5
7
|
* switcher), then the title (a click opens the details; renamable in place),
|
|
6
8
|
* and the app's toolbar on the right. A server session without a `place` names
|
|
7
9
|
* its server in a chip. Right-click on the project or the title opens the app's
|
|
@@ -12,6 +14,7 @@
|
|
|
12
14
|
*/
|
|
13
15
|
import { RowActionItem } from "../components/RowActionsMenu.js";
|
|
14
16
|
import { GitBarBranchMenuProps } from "../git/GitBar.js";
|
|
17
|
+
import { SessionProjectRef } from "./ProjectName.js";
|
|
15
18
|
import { CSSProperties, ComponentType, ReactNode } from "react";
|
|
16
19
|
/** The server a server session runs on. */
|
|
17
20
|
export interface SessionHeaderServer {
|
|
@@ -59,6 +62,10 @@ export interface SessionHeaderProps {
|
|
|
59
62
|
server?: SessionHeaderServer;
|
|
60
63
|
/** Picks a folder (attaches one to a chat, or changes the default folder). Absent: the chip is inert. */
|
|
61
64
|
onPickFolder?: () => void;
|
|
65
|
+
/** Opens the home of the session's project (the project page): a click on the project does, not `onPickFolder`. */
|
|
66
|
+
onOpenProject?: (project: SessionProjectRef) => void;
|
|
67
|
+
/** Opens the settings of the session's project (`useProjectSettings`): a click on a project the host knows does, not `onOpenProject`. */
|
|
68
|
+
onOpenProjectSettings?: (projectId: string) => void;
|
|
62
69
|
/** Opens the session details. */
|
|
63
70
|
onOpenDetails?: () => void;
|
|
64
71
|
/** Renames the session. Absent: no in-place rename. */
|
|
@@ -88,4 +95,4 @@ export interface SessionHeaderProps {
|
|
|
88
95
|
* @param props - The session facts, the folder, details and rename handlers, the menu, the `toolbar`, `className` and
|
|
89
96
|
* `style`.
|
|
90
97
|
*/
|
|
91
|
-
export declare function SessionHeader({ title, titleDisplay, titleScope, cwd, projectRoot, branch, BranchMenu, place, isMain, running, server, onPickFolder, onOpenDetails, onRename, renaming, onRenamingChange, menuItems, onMenuOpenChange, startedFrom, toolbar, sessionId, className, style }: SessionHeaderProps): import("react").JSX.Element;
|
|
98
|
+
export declare function SessionHeader({ title, titleDisplay, titleScope, cwd, projectRoot, branch, BranchMenu, place, isMain, running, server, onPickFolder, onOpenProject, onOpenProjectSettings, onOpenDetails, onRename, renaming, onRenamingChange, menuItems, onMenuOpenChange, startedFrom, toolbar, sessionId, className, style }: SessionHeaderProps): import("react").JSX.Element;
|
|
@@ -4,6 +4,7 @@ import { useTooltip } from "../components/Tooltip.js";
|
|
|
4
4
|
import { ExtensionSlot } from "../extensions/ExtensionSlot.js";
|
|
5
5
|
import { RoutedLink } from "../extensions/links.js";
|
|
6
6
|
import { TitleText } from "../motion/title-text.js";
|
|
7
|
+
import { ProjectName, useSessionProject } from "./ProjectName.js";
|
|
7
8
|
import { useSessionLabels } from "./useSessionLabels.js";
|
|
8
9
|
import { useEffect, useRef, useState } from "react";
|
|
9
10
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -19,7 +20,7 @@ function folderBasename(path) {
|
|
|
19
20
|
* @param props - The session facts, the folder, details and rename handlers, the menu, the `toolbar`, `className` and
|
|
20
21
|
* `style`.
|
|
21
22
|
*/
|
|
22
|
-
function SessionHeader({ title, titleDisplay, titleScope, cwd, projectRoot, branch, BranchMenu, place, isMain = false, running = false, server, onPickFolder, onOpenDetails, onRename, renaming = false, onRenamingChange, menuItems, onMenuOpenChange, startedFrom, toolbar, sessionId = titleScope, className = "", style }) {
|
|
23
|
+
function SessionHeader({ title, titleDisplay, titleScope, cwd, projectRoot, branch, BranchMenu, place, isMain = false, running = false, server, onPickFolder, onOpenProject, onOpenProjectSettings, onOpenDetails, onRename, renaming = false, onRenamingChange, menuItems, onMenuOpenChange, startedFrom, toolbar, sessionId = titleScope, className = "", style }) {
|
|
23
24
|
const labels = useSessionLabels();
|
|
24
25
|
const [menuAt, setMenuAt] = useState(null);
|
|
25
26
|
const setMenu = (at) => {
|
|
@@ -45,13 +46,23 @@ function SessionHeader({ title, titleDisplay, titleScope, cwd, projectRoot, bran
|
|
|
45
46
|
onRenamingChange?.(false);
|
|
46
47
|
};
|
|
47
48
|
const onServer = server !== void 0;
|
|
48
|
-
const folderless = !cwd;
|
|
49
|
+
const folderless = !cwd?.trim();
|
|
49
50
|
const folderName = folderless ? labels.headerChat : folderBasename(projectRoot || cwd);
|
|
50
|
-
const
|
|
51
|
+
const project = useSessionProject(sessionId ?? null, folderless ? null : projectRoot || cwd, !onServer && !isMain);
|
|
52
|
+
const settingsOf = project?.id && onOpenProjectSettings ? project.id : null;
|
|
53
|
+
const opensProject = project !== null && (settingsOf !== null || onOpenProject !== void 0);
|
|
54
|
+
const settingsLabel = settingsOf !== null && project ? labels.headerProjectSettings(project.name) : null;
|
|
55
|
+
const folderTip = useTooltip(settingsLabel ?? (opensProject ? labels.headerOpenProject(project.name) : isMain ? labels.headerMainFolder : folderless && running ? labels.headerChatRunning : onServer ? labels.headerFolderOnServer(cwd, server.name ?? null) : folderless ? labels.headerChatAttach : labels.headerChangeFolder(cwd)));
|
|
51
56
|
const titleRef = useRef(null);
|
|
52
57
|
const [overflow, setOverflow] = useState(null);
|
|
53
58
|
const needsTruncate = overflow?.title === title ? overflow.value : true;
|
|
54
|
-
const titleTip = useTooltip(needsTruncate ?
|
|
59
|
+
const titleTip = useTooltip(needsTruncate ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "block",
|
|
61
|
+
children: title
|
|
62
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
63
|
+
className: "block",
|
|
64
|
+
children: labels.headerDetails
|
|
65
|
+
})] }) : labels.headerDetails);
|
|
55
66
|
useEffect(() => {
|
|
56
67
|
const el = titleRef.current;
|
|
57
68
|
if (!el) return void 0;
|
|
@@ -89,12 +100,13 @@ function SessionHeader({ title, titleDisplay, titleScope, cwd, projectRoot, bran
|
|
|
89
100
|
/* @__PURE__ */ jsx("button", {
|
|
90
101
|
...folderTip.anchorProps,
|
|
91
102
|
type: "button",
|
|
92
|
-
onClick: onPickFolder,
|
|
103
|
+
onClick: settingsOf !== null ? () => onOpenProjectSettings?.(settingsOf) : opensProject ? () => onOpenProject?.(project) : onPickFolder,
|
|
104
|
+
...settingsLabel ? { "aria-label": settingsLabel } : {},
|
|
93
105
|
onContextMenu: openMenu,
|
|
94
|
-
disabled: !onPickFolder || isMain || onServer || folderless && running,
|
|
106
|
+
disabled: !opensProject && (!onPickFolder || isMain || onServer || folderless && running),
|
|
95
107
|
"data-testid": "session-project",
|
|
96
|
-
className: `zg-press-soft min-w-0 max-w-[200px] truncate text-left bg-transparent border-0 text-sm font-medium px-1.5 py-1 -mx-1.5 rounded-zg-sm transition-colors disabled:cursor-default enabled:cursor-pointer enabled:hover:before:bg-[var(--zg-row-hover)] ${folderless ? "text-[var(--zg-text-muted)]" : "text-[var(--zg-text)]"}`,
|
|
97
|
-
children: folderName
|
|
108
|
+
className: `zg-press-soft inline-flex items-center min-w-0 max-w-[200px] truncate text-left bg-transparent border-0 text-sm font-medium px-1.5 py-1 -mx-1.5 rounded-zg-sm transition-colors disabled:cursor-default enabled:cursor-pointer enabled:hover:before:bg-[var(--zg-row-hover)] ${folderless && !project ? "text-[var(--zg-text-muted)]" : "text-[var(--zg-text)]"}`,
|
|
109
|
+
children: project ? /* @__PURE__ */ jsx(ProjectName, { ...project }) : folderName
|
|
98
110
|
}),
|
|
99
111
|
folderTip.tip,
|
|
100
112
|
onServer && !place && /* @__PURE__ */ jsxs("span", {
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* Who else has the session open (organization mode, docs/MULTIPLAYER.md): a small stack of avatars at the right of
|
|
3
3
|
* its header, from the host's `sharing.people`. Nothing when nobody else is there, or without `people`.
|
|
4
4
|
*
|
|
5
|
-
* At most three avatars, then "+N". A photo that fails to load falls back to the person's initial. Hovering
|
|
6
|
-
*
|
|
5
|
+
* At most three avatars, then "+N". A photo that fails to load falls back to the person's initial. Hovering (or
|
|
6
|
+
* focusing) the stack opens a card with everyone here: each face, name and email. A screen reader hears the same
|
|
7
|
+
* line as the label. It sits in the window's drag area (`zg-no-drag`), so the hover reaches it there.
|
|
7
8
|
*/
|
|
8
9
|
import { CSSProperties } from "react";
|
|
9
10
|
/** Props for {@link SessionPeopleStack}. */
|