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
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useOptionalConfirm } from "../app/useConfirm.js";
|
|
2
|
-
import {
|
|
2
|
+
import { BTN_SECONDARY } from "../components/button.js";
|
|
3
3
|
import { MetaChip } from "../components/Form.js";
|
|
4
4
|
import { Notice } from "../components/Notice.js";
|
|
5
5
|
import { useProviderUsage } from "./ProviderUsageProvider.js";
|
|
6
|
-
import { ShellFrame } from "./SessionShell.js";
|
|
7
6
|
import { useSessionLabels } from "./useSessionLabels.js";
|
|
8
7
|
import { useState } from "react";
|
|
9
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
9
|
import { formatBalance, formatUsagePercent, resetLabel, showsAccount, updatedLabel, usageTone } from "zidane/chat/pure";
|
|
11
|
-
// src/session/
|
|
10
|
+
// src/session/UsageSection.tsx
|
|
12
11
|
const TONE_CLS = {
|
|
13
12
|
ok: "text-[var(--zg-text)]",
|
|
14
13
|
warn: "text-zg-warn",
|
|
@@ -20,54 +19,51 @@ const BAR_CLS = {
|
|
|
20
19
|
error: "bg-zg-danger"
|
|
21
20
|
};
|
|
22
21
|
/**
|
|
23
|
-
* Renders the subscription windows of every signed-in provider and GitHub, with a Refresh
|
|
22
|
+
* Renders the subscription windows of every signed-in provider and GitHub, with a Refresh: the body of
|
|
23
|
+
* Settings › Accounts › Usage (`panels.usage` of `SettingsRowsPage`).
|
|
24
24
|
*
|
|
25
|
-
* @param props - `activeProviderKey`, `autoLoad`, `
|
|
25
|
+
* @param props - `activeProviderKey`, `autoLoad`, `className` and `style`.
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
27
|
+
function UsageSection({ activeProviderKey = null, autoLoad = true, className = "", style }) {
|
|
28
28
|
const labels = useSessionLabels();
|
|
29
29
|
const { snapshots, github, loading, loaded, refresh, redeemReset } = useProviderUsage();
|
|
30
30
|
const empty = snapshots.length === 0 && github.length === 0;
|
|
31
31
|
const updated = updatedLabel([...snapshots, ...github]);
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
className: "zg-meta
|
|
32
|
+
const status = empty ? autoLoad || loaded ? loading ? labels.usageChecking : labels.usageNone : labels.usageOff : null;
|
|
33
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
34
|
+
className: `flex flex-col gap-3${className ? ` ${className}` : ""}`,
|
|
35
|
+
style,
|
|
36
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
37
|
+
className: "flex items-center gap-2 min-h-7",
|
|
38
|
+
children: [status ? /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "text-zg-label text-[var(--zg-text-muted)]",
|
|
40
|
+
children: status
|
|
41
|
+
}) : updated && !loading && /* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "zg-meta",
|
|
43
43
|
children: updated
|
|
44
44
|
}), /* @__PURE__ */ jsx("button", {
|
|
45
45
|
type: "button",
|
|
46
|
-
className:
|
|
46
|
+
className: `${BTN_SECONDARY} ml-auto`,
|
|
47
47
|
disabled: loading,
|
|
48
48
|
onClick: refresh,
|
|
49
49
|
children: loading ? labels.usageRefreshing : labels.usageRefresh
|
|
50
50
|
})]
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
active: false
|
|
68
|
-
}, snapshot.credentialKey))
|
|
69
|
-
})]
|
|
70
|
-
})
|
|
51
|
+
}), !empty && /* @__PURE__ */ jsxs(Fragment$1, { children: [snapshots.length > 0 && /* @__PURE__ */ jsx(UsageGroup, {
|
|
52
|
+
label: github.length > 0 ? labels.usageModelProviders : null,
|
|
53
|
+
children: snapshots.map((snapshot) => /* @__PURE__ */ jsx(ProviderRow, {
|
|
54
|
+
snapshot,
|
|
55
|
+
account: showsAccount(snapshot, snapshots) ? snapshot.account : null,
|
|
56
|
+
active: snapshot.providerKey === activeProviderKey && snapshot.activeCredential,
|
|
57
|
+
onRedeemReset: redeemReset
|
|
58
|
+
}, snapshot.credentialKey))
|
|
59
|
+
}), github.length > 0 && /* @__PURE__ */ jsx(UsageGroup, {
|
|
60
|
+
label: labels.usageGithub,
|
|
61
|
+
children: github.map((snapshot) => /* @__PURE__ */ jsx(ProviderRow, {
|
|
62
|
+
snapshot,
|
|
63
|
+
account: null,
|
|
64
|
+
active: false
|
|
65
|
+
}, snapshot.credentialKey))
|
|
66
|
+
})] })]
|
|
71
67
|
});
|
|
72
68
|
}
|
|
73
69
|
/** One group of rows on a tray, under a small label (no label when it's the only group). */
|
|
@@ -222,8 +218,11 @@ function ResetsRow({ snapshot, resets, account, onRedeem }) {
|
|
|
222
218
|
className: "text-zg-label text-[var(--zg-text)] truncate",
|
|
223
219
|
children: title
|
|
224
220
|
}), /* @__PURE__ */ jsx("span", {
|
|
225
|
-
className: `text-zg-meta tabular-nums
|
|
226
|
-
children: labels.usageResetDates(credit.grantedAt, credit.expiresAt)
|
|
221
|
+
className: `flex min-w-0 gap-x-2 text-zg-meta tabular-nums ${soon ? "text-zg-warn" : "text-[var(--zg-text-muted)]"}`,
|
|
222
|
+
children: labels.usageResetDates(credit.grantedAt, credit.expiresAt).map((part) => /* @__PURE__ */ jsx("span", {
|
|
223
|
+
className: "truncate",
|
|
224
|
+
children: part
|
|
225
|
+
}, part))
|
|
227
226
|
})]
|
|
228
227
|
}),
|
|
229
228
|
canRedeem && /* @__PURE__ */ jsx("button", {
|
|
@@ -288,4 +287,4 @@ function WindowRow({ win, trailing }) {
|
|
|
288
287
|
]
|
|
289
288
|
});
|
|
290
289
|
}
|
|
291
|
-
export {
|
|
290
|
+
export { UsageSection };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The parts of an artifact row as its kind draws it (`SessionArtifactRowView`), shared by the session's Artifacts panel
|
|
3
|
+
* and a project's Artifacts (its settings, its home): the state icon in its tone or exact color, the state word, and the
|
|
4
|
+
* second line's chips (the lead, the change size, the facts, a fact's reference as its chip). Every chip with a link
|
|
5
|
+
* opens through the link router.
|
|
6
|
+
*/
|
|
7
|
+
import { SessionArtifactRowView } from "./headless/host.js";
|
|
8
|
+
/**
|
|
9
|
+
* Whether a row view draws chips on its second line (the shared layout) rather than its older subtitle and badges.
|
|
10
|
+
*
|
|
11
|
+
* @param view - The row view.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hasArtifactViewChips(view: SessionArtifactRowView): boolean;
|
|
14
|
+
/** The row's state icon in its tone or exact color, or nothing when its kind draws none. */
|
|
15
|
+
export declare function ArtifactStateIcon({ view, className }: {
|
|
16
|
+
view: SessionArtifactRowView;
|
|
17
|
+
className?: string;
|
|
18
|
+
}): import("react").JSX.Element | null;
|
|
19
|
+
/** The row's state word (`open`, `merged`), in the state's tone or exact color; nothing without one. */
|
|
20
|
+
export declare function ArtifactStatus({ view, className }: {
|
|
21
|
+
view: SessionArtifactRowView;
|
|
22
|
+
className?: string;
|
|
23
|
+
}): import("react").JSX.Element | null;
|
|
24
|
+
/**
|
|
25
|
+
* The row's second line as chips: its lead, change size and facts; a fact that stands for a reference (a commit's PR)
|
|
26
|
+
* draws that reference's chip, as everywhere else. Nothing when the view has none.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ArtifactViewChips({ view, cwd, className }: {
|
|
29
|
+
view: SessionArtifactRowView;
|
|
30
|
+
cwd: string | undefined;
|
|
31
|
+
className?: string;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ReferenceChip } from "../chat/transcript/ReferenceText.js";
|
|
2
|
+
import { ArtifactRowChips, badgeColorStyle, badgeToneClass, hasArtifactRowChips } from "./ArtifactRowChips.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/session/artifact-row-parts.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Whether a row view draws chips on its second line (the shared layout) rather than its older subtitle and badges.
|
|
7
|
+
*
|
|
8
|
+
* @param view - The row view.
|
|
9
|
+
*/
|
|
10
|
+
function hasArtifactViewChips(view) {
|
|
11
|
+
return hasArtifactRowChips(view);
|
|
12
|
+
}
|
|
13
|
+
/** The row's state icon in its tone or exact color, or nothing when its kind draws none. */
|
|
14
|
+
function ArtifactStateIcon({ view, className = "" }) {
|
|
15
|
+
if (!view.icon?.gui) return null;
|
|
16
|
+
return /* @__PURE__ */ jsx("span", {
|
|
17
|
+
"aria-hidden": true,
|
|
18
|
+
className: `${view.icon.gui} shrink-0 ${badgeToneClass(view.tone)} ${className}`,
|
|
19
|
+
style: badgeColorStyle(view.color)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
/** The row's state word (`open`, `merged`), in the state's tone or exact color; nothing without one. */
|
|
23
|
+
function ArtifactStatus({ view, className = "" }) {
|
|
24
|
+
if (!view.status) return null;
|
|
25
|
+
return /* @__PURE__ */ jsx("span", {
|
|
26
|
+
className: `shrink-0 text-zg-meta leading-4 whitespace-nowrap ${badgeToneClass(view.tone)} ${className}`,
|
|
27
|
+
style: badgeColorStyle(view.color),
|
|
28
|
+
children: view.status
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The row's second line as chips: its lead, change size and facts; a fact that stands for a reference (a commit's PR)
|
|
33
|
+
* draws that reference's chip, as everywhere else. Nothing when the view has none.
|
|
34
|
+
*/
|
|
35
|
+
function ArtifactViewChips({ view, cwd, className }) {
|
|
36
|
+
return /* @__PURE__ */ jsx(ArtifactRowChips, {
|
|
37
|
+
...view.lead ? { lead: view.lead } : {},
|
|
38
|
+
...view.diff ? { diff: view.diff } : {},
|
|
39
|
+
...view.facts ? { facts: view.facts } : {},
|
|
40
|
+
...className ? { className } : {},
|
|
41
|
+
renderReference: (reference, plain, chipClassName) => /* @__PURE__ */ jsx(ReferenceChip, {
|
|
42
|
+
cwd,
|
|
43
|
+
providerId: reference.providerId,
|
|
44
|
+
refKey: reference.key,
|
|
45
|
+
text: "",
|
|
46
|
+
fallback: plain,
|
|
47
|
+
className: chipClassName
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export { ArtifactStateIcon, ArtifactStatus, ArtifactViewChips, hasArtifactViewChips };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether you can still use a shared session (organization mode, docs/MULTIPLAYER.md): its owner can remove you,
|
|
3
|
+
* and the owner of a live share can stop sharing it. Either takes the session from you at once, so the composer gives
|
|
4
|
+
* way to a notice that says so (`SessionAccessNotice`), instead of failing on the next keystroke.
|
|
5
|
+
*
|
|
6
|
+
* Kept from the server's `members:changed` signals: one that lists you in `removed` takes the session away; a later
|
|
7
|
+
* one that does not (you were invited again) gives it back.
|
|
8
|
+
*/
|
|
9
|
+
/** How a live share's session id starts on the server (`LIVE_SHARE_PREFIX` in zidane's `src/server/identity/relay.ts`). */
|
|
10
|
+
export declare const LIVE_SHARE_SESSION_PREFIX = "ls-";
|
|
11
|
+
/** Why a session is no longer yours to use: `removed` by its owner, or the live share `ended`. */
|
|
12
|
+
export type SessionAccessLoss = 'removed' | 'ended';
|
|
13
|
+
/** A `members:changed` signal as the access store reads it, with the session id as the host keys it. */
|
|
14
|
+
export interface SessionAccessSignal {
|
|
15
|
+
/** The session, by its id on this host. */
|
|
16
|
+
sessionId: string;
|
|
17
|
+
/** You were among the people removed. */
|
|
18
|
+
removedMe: boolean;
|
|
19
|
+
/** The session is a live share from someone's computer: losing it means its owner stopped sharing. */
|
|
20
|
+
liveShare?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** Whether each session is still yours to use, kept current. */
|
|
23
|
+
export interface SessionAccess {
|
|
24
|
+
/** Calls `listener` with why `sessionId` was lost (`null`: still yours) now, then on every change. Returns the unsubscribe. */
|
|
25
|
+
watch: (sessionId: string, listener: (loss: SessionAccessLoss | null) => void) => () => void;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A {@link SessionAccess} over a host's signals. Listens from the first watch on: a removal that lands while the
|
|
29
|
+
* session is not on screen still shows when you open it again.
|
|
30
|
+
*
|
|
31
|
+
* @param onSignal - Subscribes to the host's `members:changed` signals; returns the unsubscribe.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createSessionAccess(onSignal: (listener: (signal: SessionAccessSignal) => void) => () => void): SessionAccess;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// src/session/headless/access.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether you can still use a shared session (organization mode, docs/MULTIPLAYER.md): its owner can remove you,
|
|
4
|
+
* and the owner of a live share can stop sharing it. Either takes the session from you at once, so the composer gives
|
|
5
|
+
* way to a notice that says so (`SessionAccessNotice`), instead of failing on the next keystroke.
|
|
6
|
+
*
|
|
7
|
+
* Kept from the server's `members:changed` signals: one that lists you in `removed` takes the session away; a later
|
|
8
|
+
* one that does not (you were invited again) gives it back.
|
|
9
|
+
*/
|
|
10
|
+
/** How a live share's session id starts on the server (`LIVE_SHARE_PREFIX` in zidane's `src/server/identity/relay.ts`). */
|
|
11
|
+
const LIVE_SHARE_SESSION_PREFIX = "ls-";
|
|
12
|
+
/**
|
|
13
|
+
* A {@link SessionAccess} over a host's signals. Listens from the first watch on: a removal that lands while the
|
|
14
|
+
* session is not on screen still shows when you open it again.
|
|
15
|
+
*
|
|
16
|
+
* @param onSignal - Subscribes to the host's `members:changed` signals; returns the unsubscribe.
|
|
17
|
+
*/
|
|
18
|
+
function createSessionAccess(onSignal) {
|
|
19
|
+
const lost = /* @__PURE__ */ new Map();
|
|
20
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
21
|
+
let listening = false;
|
|
22
|
+
const listen = () => {
|
|
23
|
+
if (listening) return;
|
|
24
|
+
listening = true;
|
|
25
|
+
onSignal((signal) => {
|
|
26
|
+
const before = lost.get(signal.sessionId) ?? null;
|
|
27
|
+
const after = signal.removedMe ? signal.liveShare ? "ended" : "removed" : null;
|
|
28
|
+
if (after) lost.set(signal.sessionId, after);
|
|
29
|
+
else lost.delete(signal.sessionId);
|
|
30
|
+
if (after !== before) for (const listener of listeners.get(signal.sessionId) ?? []) listener(after);
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
return { watch: (sessionId, listener) => {
|
|
34
|
+
listen();
|
|
35
|
+
let set = listeners.get(sessionId);
|
|
36
|
+
if (!set) {
|
|
37
|
+
set = /* @__PURE__ */ new Set();
|
|
38
|
+
listeners.set(sessionId, set);
|
|
39
|
+
}
|
|
40
|
+
set.add(listener);
|
|
41
|
+
listener(lost.get(sessionId) ?? null);
|
|
42
|
+
return () => {
|
|
43
|
+
set.delete(listener);
|
|
44
|
+
if (set.size === 0) listeners.delete(sessionId);
|
|
45
|
+
};
|
|
46
|
+
} };
|
|
47
|
+
}
|
|
48
|
+
export { LIVE_SHARE_SESSION_PREFIX, createSessionAccess };
|
|
@@ -2,14 +2,18 @@
|
|
|
2
2
|
* A `SessionHost` held in memory, for docs, demos, galleries and an app's own
|
|
3
3
|
* tests: plans you can edit, stop and drop (through zidane's plan gate), a queue you can add to, edit, push and
|
|
4
4
|
* drop, artifacts you can remove, running work you can cancel, turns you can
|
|
5
|
-
* fork, edit and delete, the details actions, usage, reminders you can add, pause, run and delete, and saved secrets you can add and revoke
|
|
5
|
+
* fork, edit and delete, the details actions, usage, reminders you can add, pause, run and delete, projects you can create and set up, and saved secrets you can add and revoke
|
|
6
6
|
* (values are dropped at once, never kept). `control` changes the data from outside, as an agent
|
|
7
7
|
* or another window would.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { FixtureRecordedArtifact } from "./fixture-project-artifacts.js";
|
|
10
|
+
import { FixtureProjectOptions } from "./fixture-projects.js";
|
|
11
|
+
import { PromptAttachment as PromptAttachment$1, RunningWorkItem as RunningWorkItem$1, SessionArtifactRow, SessionHost, SessionSecretEntry, SessionTurn } from "./host.js";
|
|
12
|
+
import { TypingPerson } from "./typing.js";
|
|
13
|
+
import { ProviderUsageSnapshot, UsageRange as UsageRange$1, UsageSummary } from "./usage.js";
|
|
14
|
+
import { ProjectContentInput, Schedule, ScheduleFire } from "zidane/chat/pure";
|
|
12
15
|
import { PlanView, TodoItem } from "zidane/chat";
|
|
16
|
+
import { OpenSessionView, ParticipantView, PresencePerson, SessionSharingView } from "zidane/ipc";
|
|
13
17
|
/** A queued entry the fixture holds, with its attachments' bytes. */
|
|
14
18
|
export interface FixtureQueuedEntry {
|
|
15
19
|
/** The entry's id. */
|
|
@@ -18,9 +22,30 @@ export interface FixtureQueuedEntry {
|
|
|
18
22
|
text: string;
|
|
19
23
|
/** Its attachments, with their bytes. */
|
|
20
24
|
attachments?: PromptAttachment$1[];
|
|
25
|
+
/** A live share's message the server holds for its owner's offline computer: the owner's name. */
|
|
26
|
+
waitingFor?: string;
|
|
27
|
+
}
|
|
28
|
+
/** What the fixture's `sharing` holds: who shares each session, the organization's people, the open sessions. */
|
|
29
|
+
export interface SessionSharingFixture {
|
|
30
|
+
/** Who shares each session, by session id. A session left out reads as yours, shared with nobody. */
|
|
31
|
+
views?: Readonly<Record<string, SessionSharingView>>;
|
|
32
|
+
/** The organization's people (the invite picker). */
|
|
33
|
+
users?: readonly ParticipantView[];
|
|
34
|
+
/** The open sessions ("Open sessions"). Absent: no directory. */
|
|
35
|
+
directory?: readonly OpenSessionView[];
|
|
36
|
+
/** Who else has each session open (the header's avatars), by session id. */
|
|
37
|
+
here?: Readonly<Record<string, readonly PresencePerson[]>>;
|
|
38
|
+
/** Who else types in each session, by session id. They never stop until `control.setTyping` says so. */
|
|
39
|
+
typing?: Readonly<Record<string, readonly TypingPerson[]>>;
|
|
40
|
+
/** These calls reject with this message. `change`: every change (invite, grant, remove, open, transfer, notify). */
|
|
41
|
+
errors?: Partial<Record<'get' | 'users' | 'change' | 'directory' | 'join' | 'leave', string>>;
|
|
42
|
+
/** These reads never answer (the loading state). */
|
|
43
|
+
pending?: readonly ('get' | 'users' | 'directory')[];
|
|
21
44
|
}
|
|
22
45
|
/** What a fixture session host starts with, per session id. */
|
|
23
46
|
export interface SessionFixture {
|
|
47
|
+
/** Sharing with people of the organization. Absent: no `sharing`. */
|
|
48
|
+
sharing?: SessionSharingFixture;
|
|
24
49
|
/** The plans per session, oldest first (`possiblyInterrupted` shows an applying plan with no live run). */
|
|
25
50
|
plans?: Readonly<Record<string, readonly PlanView[]>>;
|
|
26
51
|
/** The task list per session as the agent wrote it (`todowrite`), over `plans`: an applying plan. */
|
|
@@ -32,15 +57,15 @@ export interface SessionFixture {
|
|
|
32
57
|
/** An artifact kind's group label. Default: the raw kind. */
|
|
33
58
|
kindLabel?: (kind: string) => string;
|
|
34
59
|
/** The running work per session. */
|
|
35
|
-
work?: Readonly<Record<string, readonly RunningWorkItem[]>>;
|
|
60
|
+
work?: Readonly<Record<string, readonly RunningWorkItem$1[]>>;
|
|
36
61
|
/** The stored turns per session. */
|
|
37
62
|
turns?: Readonly<Record<string, readonly SessionTurn[]>>;
|
|
38
63
|
/** The usage summary per range. Absent: no `usage.summary`. */
|
|
39
|
-
usage?: Partial<Record<UsageRange, UsageSummary>>;
|
|
64
|
+
usage?: Partial<Record<UsageRange$1, UsageSummary>>;
|
|
40
65
|
/** The providers' subscription snapshots. Absent: no `usage.providers`. */
|
|
41
|
-
providerUsage?: readonly ProviderUsageSnapshot
|
|
66
|
+
providerUsage?: readonly ProviderUsageSnapshot[];
|
|
42
67
|
/** GitHub's API limits. Absent: no `usage.github`. */
|
|
43
|
-
githubUsage?: readonly ProviderUsageSnapshot
|
|
68
|
+
githubUsage?: readonly ProviderUsageSnapshot[];
|
|
44
69
|
/** Each session's side chat id, by the parent's id. Absent: no `side`. */
|
|
45
70
|
sides?: Readonly<Record<string, string>>;
|
|
46
71
|
/** The saved secrets per session (as the session's project holds them). Absent: no `secrets`. */
|
|
@@ -53,6 +78,8 @@ export interface SessionFixture {
|
|
|
53
78
|
scheduleFires?: Readonly<Record<string, readonly ScheduleFire[]>>;
|
|
54
79
|
/** `Settings.schedules`. @default true */
|
|
55
80
|
schedulesEnabled?: boolean;
|
|
81
|
+
/** The host's projects (docs/PROJECTS.md). Absent: no `projects`. */
|
|
82
|
+
projects?: FixtureProjectOptions;
|
|
56
83
|
}
|
|
57
84
|
/** Changes a fixture's data from outside and announces it, as the agent or another window would. */
|
|
58
85
|
export interface FixtureSessionControl {
|
|
@@ -67,13 +94,25 @@ export interface FixtureSessionControl {
|
|
|
67
94
|
/** Records an artifact (newest first). */
|
|
68
95
|
recordArtifact: (sessionId: string, row: SessionArtifactRow) => void;
|
|
69
96
|
/** Replaces a session's running work. */
|
|
70
|
-
setWork: (sessionId: string, items: readonly RunningWorkItem[]) => void;
|
|
97
|
+
setWork: (sessionId: string, items: readonly RunningWorkItem$1[]) => void;
|
|
71
98
|
/** Replaces a session's saved secrets (the agent saved one, another window revoked one). */
|
|
72
99
|
setSecrets: (sessionId: string, entries: readonly SessionSecretEntry[]) => void;
|
|
73
100
|
/** Replaces the stored reminders (the agent set one, one fired) and announces the change. */
|
|
74
101
|
setSchedules: (list: readonly Schedule[]) => void;
|
|
75
102
|
/** Turns the Reminders setting on or off and announces it. */
|
|
76
103
|
setSchedulesEnabled: (enabled: boolean) => void;
|
|
104
|
+
/** Renames a project, as another window would, and announces it. Does nothing without `projects`. */
|
|
105
|
+
renameProject: (projectId: string, name: string) => void;
|
|
106
|
+
/** The browser comes back from every project MCP sign-in page that waits. Does nothing without `projects`. */
|
|
107
|
+
finishSignIns: () => void;
|
|
108
|
+
/** Saves a project's record, as another window would, and announces it. Does nothing without `projects`. */
|
|
109
|
+
saveProjectContent: (projectId: string, input: ProjectContentInput) => void;
|
|
110
|
+
/** A session of the project stores an artifact, and the project's artifacts change. Does nothing without `projects`. */
|
|
111
|
+
recordProjectArtifact: (projectId: string, artifact: FixtureRecordedArtifact) => void;
|
|
112
|
+
/** Replaces who else has a session open (another person opened or closed it). */
|
|
113
|
+
setHere: (sessionId: string, people: readonly PresencePerson[]) => void;
|
|
114
|
+
/** Replaces who else types in a session. */
|
|
115
|
+
setTyping: (sessionId: string, people: readonly TypingPerson[]) => void;
|
|
77
116
|
}
|
|
78
117
|
/** The fixture host: a full `SessionHost` plus its `control`. */
|
|
79
118
|
export interface FixtureSessionHost extends SessionHost {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createArtifactsState, groupArtifactRows } from "./artifacts.js";
|
|
2
2
|
import { createFixturePlansBackend } from "./fixture-plans.js";
|
|
3
|
+
import { createFixtureProjectBackend, createFixtureSessionProjects } from "./fixture-projects.js";
|
|
3
4
|
import { createFixtureScheduleBackend } from "./fixture-schedules.js";
|
|
4
5
|
import { createPlansState } from "./plans.js";
|
|
5
6
|
import { createQueueState } from "./queue.js";
|
|
@@ -88,13 +89,17 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
88
89
|
list: async () => scheduleBackend.list()
|
|
89
90
|
});
|
|
90
91
|
scheduleBackend.subscribe(() => schedulesState.wake());
|
|
92
|
+
const projectBackend = fixture.projects ? createFixtureProjectBackend(fixture.projects) : null;
|
|
93
|
+
const sharingFixture = fixture.sharing;
|
|
94
|
+
const sharing = createFixtureSharing(sharingFixture ?? {});
|
|
91
95
|
const items = (sessionId) => (queues.get(sessionId) ?? []).map((e) => ({
|
|
92
96
|
id: e.id,
|
|
93
97
|
text: e.text,
|
|
94
98
|
...e.attachments?.length ? { attachments: e.attachments.map((a) => ({
|
|
95
99
|
mediaType: a.mediaType,
|
|
96
100
|
...a.name ? { name: a.name } : {}
|
|
97
|
-
})) } : {}
|
|
101
|
+
})) } : {},
|
|
102
|
+
...e.waitingFor !== void 0 ? { waitingFor: e.waitingFor } : {}
|
|
98
103
|
}));
|
|
99
104
|
const plans = createPlansState(async (sessionId) => planBackend.snapshot(sessionId));
|
|
100
105
|
planBackend.subscribe((sessionId) => {
|
|
@@ -283,6 +288,10 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
283
288
|
return after.length < before.length;
|
|
284
289
|
}
|
|
285
290
|
} } : {},
|
|
291
|
+
...projectBackend ? { projects: createFixtureSessionProjects(projectBackend, {
|
|
292
|
+
organization: fixture.projects?.organization !== void 0,
|
|
293
|
+
...fixture.projects?.publishTargets ? { publishTargets: fixture.projects.publishTargets } : {}
|
|
294
|
+
}) } : {},
|
|
286
295
|
...fixture.schedules ? { schedules: {
|
|
287
296
|
status: schedulesState.status,
|
|
288
297
|
all: schedulesState.all,
|
|
@@ -295,9 +304,16 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
295
304
|
runNow: async (id) => scheduleBackend.runNow(id),
|
|
296
305
|
fires: async (id, limit) => scheduleBackend.fires(id, limit)
|
|
297
306
|
} } : {},
|
|
307
|
+
...sharingFixture ? { sharing: sharing.host } : {},
|
|
298
308
|
control: {
|
|
309
|
+
setHere: sharing.setHere,
|
|
310
|
+
setTyping: sharing.setTyping,
|
|
299
311
|
setSchedules: (list) => scheduleBackend.replace(list),
|
|
300
312
|
setSchedulesEnabled: (enabled) => scheduleBackend.setEnabled(enabled),
|
|
313
|
+
renameProject: (projectId, name) => void projectBackend?.update(projectId, { name }),
|
|
314
|
+
finishSignIns: () => projectBackend?.finishSignIns(),
|
|
315
|
+
saveProjectContent: (projectId, input) => void projectBackend?.content.put(projectId, input),
|
|
316
|
+
recordProjectArtifact: (projectId, artifact) => void projectBackend?.artifacts.record(projectId, artifact),
|
|
301
317
|
setSecrets: writeSecrets,
|
|
302
318
|
setWork: writeWork,
|
|
303
319
|
writeTodos: planBackend.writeTodos,
|
|
@@ -312,6 +328,128 @@ function createFixtureSessionHost(fixture = {}) {
|
|
|
312
328
|
};
|
|
313
329
|
}
|
|
314
330
|
const HOUR = 36e5;
|
|
331
|
+
/** A live list per session id that watchers follow (who is here, who types). */
|
|
332
|
+
function watchedLists(start) {
|
|
333
|
+
const lists = new Map(Object.entries(start ?? {}));
|
|
334
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
335
|
+
const none = [];
|
|
336
|
+
return {
|
|
337
|
+
watch(sessionId, listener) {
|
|
338
|
+
const set = listeners.get(sessionId) ?? /* @__PURE__ */ new Set();
|
|
339
|
+
listeners.set(sessionId, set);
|
|
340
|
+
set.add(listener);
|
|
341
|
+
listener(lists.get(sessionId) ?? none);
|
|
342
|
+
return () => void set.delete(listener);
|
|
343
|
+
},
|
|
344
|
+
set(sessionId, list) {
|
|
345
|
+
lists.set(sessionId, list);
|
|
346
|
+
for (const listener of listeners.get(sessionId) ?? []) listener(list);
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
/** The fixture's `sharing`: the changes the server makes, in memory. */
|
|
351
|
+
function createFixtureSharing(fixture) {
|
|
352
|
+
const { errors = {}, pending = [] } = fixture;
|
|
353
|
+
const users = [...fixture.users ?? []];
|
|
354
|
+
const views = new Map(Object.entries(fixture.views ?? {}));
|
|
355
|
+
const directory = fixture.directory ? [...fixture.directory] : null;
|
|
356
|
+
const changed = /* @__PURE__ */ new Set();
|
|
357
|
+
const here = watchedLists(fixture.here);
|
|
358
|
+
const typing = watchedLists(fixture.typing);
|
|
359
|
+
const never = () => new Promise(() => {});
|
|
360
|
+
const viewOf = (sessionId) => views.get(sessionId) ?? {
|
|
361
|
+
sessionId,
|
|
362
|
+
members: [],
|
|
363
|
+
open: false,
|
|
364
|
+
defaultGrant: "read",
|
|
365
|
+
you: "owner"
|
|
366
|
+
};
|
|
367
|
+
const person = (userId) => {
|
|
368
|
+
const found = users.find((u) => u.userId === userId || u.email === userId);
|
|
369
|
+
if (!found) throw new Error(`No one in the organization is ${userId}.`);
|
|
370
|
+
return found;
|
|
371
|
+
};
|
|
372
|
+
const change = async (sessionId, next) => {
|
|
373
|
+
if (errors.change) throw new Error(errors.change);
|
|
374
|
+
const view = next(viewOf(sessionId));
|
|
375
|
+
views.set(sessionId, view);
|
|
376
|
+
for (const listener of changed) listener();
|
|
377
|
+
return view;
|
|
378
|
+
};
|
|
379
|
+
return {
|
|
380
|
+
host: {
|
|
381
|
+
get: async (sessionId) => pending.includes("get") ? never() : errors.get ? Promise.reject(new Error(errors.get)) : viewOf(sessionId),
|
|
382
|
+
users: async () => pending.includes("users") ? never() : errors.users ? Promise.reject(new Error(errors.users)) : [...users],
|
|
383
|
+
invite: async (sessionId, user, grant = "prompt") => change(sessionId, (view) => ({
|
|
384
|
+
...view,
|
|
385
|
+
members: [...view.members.filter((m) => m.userId !== person(user).userId), {
|
|
386
|
+
...person(user),
|
|
387
|
+
grant
|
|
388
|
+
}]
|
|
389
|
+
})),
|
|
390
|
+
setGrant: async (sessionId, userId, grant) => change(sessionId, (view) => ({
|
|
391
|
+
...view,
|
|
392
|
+
members: view.members.map((m) => m.userId === userId ? {
|
|
393
|
+
...m,
|
|
394
|
+
grant
|
|
395
|
+
} : m)
|
|
396
|
+
})),
|
|
397
|
+
remove: async (sessionId, userId) => change(sessionId, (view) => ({
|
|
398
|
+
...view,
|
|
399
|
+
members: view.members.filter((m) => m.userId !== userId)
|
|
400
|
+
})),
|
|
401
|
+
setOpen: async (sessionId, open, defaultGrant) => change(sessionId, (view) => ({
|
|
402
|
+
...view,
|
|
403
|
+
open,
|
|
404
|
+
defaultGrant: defaultGrant ?? view.defaultGrant
|
|
405
|
+
})),
|
|
406
|
+
transfer: async (sessionId, userId) => change(sessionId, (view) => {
|
|
407
|
+
const heir = person(userId);
|
|
408
|
+
const members = view.members.filter((m) => m.userId !== userId);
|
|
409
|
+
return {
|
|
410
|
+
...view,
|
|
411
|
+
owner: heir,
|
|
412
|
+
members: view.owner ? [...members, {
|
|
413
|
+
...view.owner,
|
|
414
|
+
grant: "trusted"
|
|
415
|
+
}] : members,
|
|
416
|
+
you: "trusted"
|
|
417
|
+
};
|
|
418
|
+
}),
|
|
419
|
+
async leave(sessionId) {
|
|
420
|
+
if (errors.leave) throw new Error(errors.leave);
|
|
421
|
+
views.set(sessionId, {
|
|
422
|
+
...viewOf(sessionId),
|
|
423
|
+
you: null
|
|
424
|
+
});
|
|
425
|
+
},
|
|
426
|
+
setNotify: async (sessionId, notify) => change(sessionId, (view) => ({
|
|
427
|
+
...view,
|
|
428
|
+
notify
|
|
429
|
+
})),
|
|
430
|
+
...directory ? {
|
|
431
|
+
directory: async () => pending.includes("directory") ? never() : errors.directory ? Promise.reject(new Error(errors.directory)) : [...directory],
|
|
432
|
+
async join(sessionId) {
|
|
433
|
+
if (errors.join) throw new Error(errors.join);
|
|
434
|
+
const row = directory.findIndex((r) => r.sessionId === sessionId);
|
|
435
|
+
if (row >= 0) directory[row] = {
|
|
436
|
+
...directory[row],
|
|
437
|
+
joined: true
|
|
438
|
+
};
|
|
439
|
+
return viewOf(sessionId);
|
|
440
|
+
}
|
|
441
|
+
} : {},
|
|
442
|
+
onChanged(listener) {
|
|
443
|
+
changed.add(listener);
|
|
444
|
+
return () => void changed.delete(listener);
|
|
445
|
+
},
|
|
446
|
+
people: { watch: here.watch },
|
|
447
|
+
typing: { watch: typing.watch }
|
|
448
|
+
},
|
|
449
|
+
setHere: here.set,
|
|
450
|
+
setTyping: typing.set
|
|
451
|
+
};
|
|
452
|
+
}
|
|
315
453
|
/** When a secret saved at `now` with `ttl` expires, as the backend computes it. */
|
|
316
454
|
function fixtureSecretExpiry(ttl, now) {
|
|
317
455
|
return ttl === "never" ? null : now + (ttl === "1h" ? HOUR : ttl === "24h" ? 24 * HOUR : 168 * HOUR);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A project's artifacts held in memory, as zidane's `projects.artifacts.*`
|
|
3
|
+
* keeps them (docs/ARTIFACTS.md § Project artifacts): one row per kind and
|
|
4
|
+
* locator, made by the project's sessions (`record`) or added by hand, the
|
|
5
|
+
* newest first. A row's level is the one a maintainer set, else `index` for
|
|
6
|
+
* the 20 newest rows with none set, else `none`. Adding a kind and locator the
|
|
7
|
+
* project has marks that row as added. Every change announces the project
|
|
8
|
+
* (`project-artifacts:changed`). The fixture project backend refuses for the
|
|
9
|
+
* caller's place before any of this runs.
|
|
10
|
+
*/
|
|
11
|
+
import { ProjectArtifactInput, ProjectArtifactPin, SessionArtifactRowView } from "./host.js";
|
|
12
|
+
import { ArtifactContextLevel, ProjectArtifact, ProjectArtifactView } from "zidane/chat/pure";
|
|
13
|
+
import { Actor } from "zidane";
|
|
14
|
+
/** What a fixture project's artifacts start with. */
|
|
15
|
+
export interface FixtureProjectArtifactsOptions {
|
|
16
|
+
/** The rows, of any project (each names its `projectId`). */
|
|
17
|
+
rows?: readonly ProjectArtifact[];
|
|
18
|
+
/** Who changes them, as a row's `by` names them. Absent: no one is named. */
|
|
19
|
+
by?: Actor;
|
|
20
|
+
/**
|
|
21
|
+
* The kinds' names, icons and drawn rows, as the host's kind registry words them (`kindLabel`, `icon` and `row` on
|
|
22
|
+
* each row; `render`: the kind's, with the icon of the row it draws when `icon` is absent). Absent: none.
|
|
23
|
+
*/
|
|
24
|
+
kinds?: Readonly<Record<string, {
|
|
25
|
+
label: string;
|
|
26
|
+
icon?: string;
|
|
27
|
+
render?: (row: ProjectArtifact) => SessionArtifactRowView | undefined;
|
|
28
|
+
}>>;
|
|
29
|
+
}
|
|
30
|
+
/** What a session recorded, as its project row takes it. */
|
|
31
|
+
export interface FixtureRecordedArtifact {
|
|
32
|
+
/** The session. */
|
|
33
|
+
sessionId: string;
|
|
34
|
+
/** Its session artifact's id. */
|
|
35
|
+
artifactId: string;
|
|
36
|
+
/** The kind. */
|
|
37
|
+
kind: string;
|
|
38
|
+
/** The locator. */
|
|
39
|
+
uri: string;
|
|
40
|
+
/** The human line. */
|
|
41
|
+
label: string;
|
|
42
|
+
}
|
|
43
|
+
/** A fixture project's artifacts, as the wire methods answer. Each throws the host's words for a refused input. */
|
|
44
|
+
export interface FixtureProjectArtifacts {
|
|
45
|
+
/** `projects.artifacts.list`: the newest first, each with its level; `context`: at that level only. */
|
|
46
|
+
list: (projectId: string, filter?: {
|
|
47
|
+
context?: ArtifactContextLevel;
|
|
48
|
+
}) => ProjectArtifactView[];
|
|
49
|
+
/** `projects.artifacts.add`. */
|
|
50
|
+
add: (projectId: string, input: ProjectArtifactInput) => ProjectArtifactView;
|
|
51
|
+
/** `projects.artifacts.pin`. */
|
|
52
|
+
pin: (projectId: string, artifactId: string, change?: ProjectArtifactPin) => ProjectArtifactView;
|
|
53
|
+
/** `projects.artifacts.unpin`. */
|
|
54
|
+
unpin: (projectId: string, artifactId: string) => ProjectArtifactView;
|
|
55
|
+
/** `projects.artifacts.remove`. */
|
|
56
|
+
remove: (projectId: string, artifactId: string) => void;
|
|
57
|
+
/** A session of the project stored an artifact: its row is made, or takes the session and the newer label. */
|
|
58
|
+
record: (projectId: string, artifact: FixtureRecordedArtifact) => ProjectArtifactView;
|
|
59
|
+
/** Hears every change (`project-artifacts:changed`). Returns the unsubscribe. */
|
|
60
|
+
subscribe: (onChange: (projectId: string) => void) => () => void;
|
|
61
|
+
}
|
|
62
|
+
/** What the artifacts read of their project backend. */
|
|
63
|
+
export interface FixtureProjectArtifactsDeps {
|
|
64
|
+
/** Throws for a project the host does not have. */
|
|
65
|
+
project: (projectId: string) => unknown;
|
|
66
|
+
/** Throws a `ProjectRefusedError` when the caller's place does not allow it: reading, or changing. */
|
|
67
|
+
allow: (projectId: string, need: 'read' | 'manage') => void;
|
|
68
|
+
/** The clock. */
|
|
69
|
+
now: () => number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Creates a {@link FixtureProjectArtifacts}.
|
|
73
|
+
*
|
|
74
|
+
* @param deps - The project backend's projects, places and clock.
|
|
75
|
+
* @param options - The starting rows.
|
|
76
|
+
*/
|
|
77
|
+
export declare function createFixtureProjectArtifacts(deps: FixtureProjectArtifactsDeps, options?: FixtureProjectArtifactsOptions): FixtureProjectArtifacts;
|