zidane-ui 9.1.13 → 9.1.16
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 -2
- package/dist/adapters/index.js +2 -2
- package/dist/adapters/live.d.ts +29 -3
- package/dist/adapters/live.js +9 -1
- package/dist/adapters/server-composer-host.js +17 -2
- package/dist/adapters/server-extensions-host.d.ts +0 -1
- package/dist/adapters/server-extensions-host.js +4 -15
- package/dist/adapters/server-git-host.js +7 -16
- package/dist/adapters/server-host.js +181 -43
- package/dist/adapters/server-machines-host.d.ts +2 -0
- package/dist/adapters/server-machines-host.js +22 -23
- package/dist/adapters/server-onboarding-host.d.ts +1 -1
- package/dist/adapters/server-onboarding-host.js +3 -4
- package/dist/adapters/server-session-host.js +22 -3
- package/dist/adapters/server-settings-accounts.js +2 -2
- package/dist/adapters/server-settings-host.js +2 -2
- package/dist/adapters/server-settings-performance.js +7 -9
- package/dist/adapters/server-settings-sections.js +13 -14
- package/dist/adapters/server-sidebar-host.js +2 -2
- package/dist/adapters/sse-host.js +68 -3
- package/dist/adapters/sse-protocol.d.ts +12 -2
- package/dist/adapters/sse-protocol.js +4 -2
- package/dist/app/AppHostProvider.js +4 -3
- package/dist/app/ModalProvider.d.ts +13 -3
- package/dist/app/ModalProvider.js +103 -24
- package/dist/app/NoticeStack.d.ts +33 -0
- package/dist/app/NoticeStack.js +90 -0
- package/dist/app/index.d.ts +3 -2
- package/dist/app/index.js +3 -2
- package/dist/chat/SessionFilterMenu.d.ts +1 -1
- package/dist/chat/SessionFilterMenu.js +2 -1
- package/dist/chat/composer/Composer.js +10 -8
- package/dist/chat/composer/ModelChainList.js +17 -8
- package/dist/chat/composer/ModelChainTooltip.js +5 -2
- package/dist/chat/composer/use-draft-target.d.ts +20 -1
- package/dist/chat/composer/use-draft-target.js +121 -5
- package/dist/chat/composer/use-new-session-defaults.d.ts +5 -1
- package/dist/chat/composer/use-new-session-defaults.js +17 -4
- package/dist/chat/headless/chip-labels.d.ts +1 -0
- package/dist/chat/headless/chip-labels.js +1 -0
- package/dist/chat/headless/composer/labels-editor.d.ts +0 -2
- package/dist/chat/headless/composer/labels-editor.js +0 -2
- package/dist/chat/headless/draft-target.d.ts +21 -1
- package/dist/chat/headless/fixture-host.js +17 -2
- package/dist/chat/headless/host.d.ts +3 -3
- package/dist/chat/headless/index.d.ts +9 -9
- package/dist/chat/headless/index.js +2 -2
- package/dist/chat/headless/labels.d.ts +13 -6
- package/dist/chat/headless/labels.js +10 -9
- package/dist/chat/headless/session-list.d.ts +20 -8
- package/dist/chat/headless/session-list.js +1 -0
- package/dist/chat/headless/sidebar/directory.d.ts +56 -14
- package/dist/chat/headless/sidebar/directory.js +149 -70
- package/dist/chat/headless/sidebar/index.d.ts +3 -3
- package/dist/chat/headless/sidebar/index.js +2 -2
- package/dist/chat/headless/sidebar/labels.d.ts +15 -8
- package/dist/chat/headless/sidebar/types.d.ts +3 -1
- package/dist/chat/headless/sidebar/view.d.ts +13 -5
- package/dist/chat/headless/sidebar/view.js +31 -11
- package/dist/chat/headless/streams/actions.d.ts +5 -3
- package/dist/chat/headless/streams/actions.js +3 -2
- package/dist/chat/headless/streams/index.d.ts +3 -3
- package/dist/chat/headless/streams/merge.d.ts +6 -10
- package/dist/chat/headless/streams/merge.js +7 -21
- package/dist/chat/headless/streams/session-streams.d.ts +29 -4
- package/dist/chat/headless/streams/session-streams.js +86 -0
- package/dist/chat/headless/streams/store.d.ts +162 -16
- package/dist/chat/headless/streams/store.js +334 -38
- package/dist/chat/headless/streams/types.d.ts +10 -7
- package/dist/chat/headless/transcript-labels.d.ts +1 -0
- package/dist/chat/interactions/PlanCard.js +10 -3
- package/dist/chat/interactions/QuestionForm.js +7 -3
- package/dist/chat/interactions/card-ui.d.ts +5 -3
- package/dist/chat/interactions/card-ui.js +9 -7
- package/dist/chat/rich-composer/RichComposer.js +1 -7
- package/dist/chat/rich-composer/composer-extensions.d.ts +0 -2
- package/dist/chat/rich-composer/composer-extensions.js +2 -2
- package/dist/chat/rich-composer/use-composer-editor.d.ts +0 -2
- package/dist/chat/rich-composer/use-composer-editor.js +1 -2
- package/dist/chat/sidebar/SessionSidebar.js +5 -5
- package/dist/chat/sidebar/SidebarFilterMenu.js +3 -1
- package/dist/chat/sidebar/SidebarFrame.d.ts +4 -0
- package/dist/chat/sidebar/SidebarFrame.js +27 -9
- package/dist/chat/sidebar/SidebarGroupHeader.js +1 -1
- package/dist/chat/sidebar/SidebarHostProvider.d.ts +8 -5
- package/dist/chat/sidebar/SidebarHostProvider.js +13 -9
- package/dist/chat/sidebar/SidebarToggleButton.js +7 -3
- package/dist/chat/sidebar/index.d.ts +2 -2
- package/dist/chat/sidebar/session-menu.js +4 -4
- package/dist/chat/sidebar/useSaveViewAsSpace.js +2 -2
- package/dist/chat/testing/contract.js +2 -2
- package/dist/chat/transcript/AuthFailureCard.js +11 -8
- package/dist/chat/transcript/BadgeMenu.js +13 -2
- package/dist/chat/transcript/MermaidDiagram.js +7 -3
- package/dist/chat/transcript/fold.d.ts +4 -0
- package/dist/chat/transcript/fold.js +53 -22
- package/dist/chat/transcript/script-input.d.ts +1 -1
- package/dist/chat/transcript/shell-block.js +7 -3
- package/dist/chat/transcript/useStickToBottom.js +12 -0
- package/dist/components/BrowserSignIn.js +23 -21
- package/dist/components/Form.d.ts +6 -4
- package/dist/components/Form.js +16 -8
- package/dist/components/LoadError.d.ts +4 -2
- package/dist/components/LoadError.js +13 -9
- package/dist/components/Notice.d.ts +29 -0
- package/dist/components/Notice.js +63 -0
- package/dist/components/PanelEmpty.d.ts +1 -1
- package/dist/components/PanelEmpty.js +4 -2
- package/dist/components/Restricted.d.ts +1 -1
- package/dist/components/palette/PaletteList.js +8 -1
- package/dist/components/palette/PalettePanel.js +14 -6
- package/dist/core.css +24 -5
- package/dist/dist/{index-Bq87OcGy.d.ts → index-BZM8tu4L.d.ts} +28 -3
- package/dist/dist/index.d.ts +2 -2
- package/dist/dist/{timeout-B5pO5I5a.d.ts → timeout-Cyx3VGPz.d.ts} +1 -1
- package/dist/extensions/ExtensionSettingsPage.js +1 -4
- package/dist/extensions/ExtensionSettingsSection.js +4 -3
- package/dist/extensions/ExtensionSettingsSidebar.js +2 -6
- package/dist/extensions/SettingsWireForm.d.ts +1 -7
- package/dist/extensions/SettingsWireForm.js +7 -5
- package/dist/extensions/headless/fixture-host.d.ts +1 -5
- package/dist/extensions/headless/fixture-host.js +1 -4
- package/dist/extensions/headless/host.d.ts +1 -11
- package/dist/extensions/headless/index.d.ts +3 -3
- package/dist/extensions/headless/index.js +2 -2
- package/dist/extensions/headless/select.d.ts +1 -11
- package/dist/extensions/headless/select.js +1 -18
- package/dist/files/EditorColumn.js +12 -1
- package/dist/files/TreeColumn.js +13 -20
- package/dist/files/useOpenFiles.js +2 -0
- package/dist/git/BranchMenu.js +5 -3
- package/dist/git/ImportRepoDialog.js +18 -9
- package/dist/git/MoveSessionDialog.js +15 -7
- package/dist/git/RemoteFolderPicker.js +34 -16
- package/dist/git/SyncChip.js +17 -17
- package/dist/git/WherePicker.d.ts +16 -1
- package/dist/git/WherePicker.js +80 -36
- package/dist/git/headless/environment.d.ts +33 -3
- package/dist/git/headless/environment.js +33 -5
- package/dist/git/headless/index.d.ts +2 -2
- package/dist/git/headless/index.js +2 -2
- package/dist/git/headless/labels.d.ts +15 -2
- package/dist/git/headless/labels.js +17 -4
- package/dist/git/useEnvironmentChoices.d.ts +3 -1
- package/dist/git/useEnvironmentChoices.js +6 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/labels.d.ts +5 -0
- package/dist/labels.js +5 -0
- package/dist/machines/AddMachineDialog.d.ts +34 -0
- package/dist/machines/AddMachineDialog.js +464 -0
- package/dist/machines/Banners.d.ts +33 -4
- package/dist/machines/Banners.js +64 -3
- package/dist/machines/DaemonMenu.js +27 -4
- package/dist/machines/HostCapabilities.d.ts +1 -3
- package/dist/machines/HostCapabilities.js +24 -45
- package/dist/machines/HostSyncPanel.js +123 -129
- package/dist/machines/HostsSection.d.ts +4 -1
- package/dist/machines/HostsSection.js +30 -7
- package/dist/machines/MachinesExplainer.d.ts +17 -0
- package/dist/machines/MachinesExplainer.js +71 -0
- package/dist/machines/MachinesProvider.d.ts +14 -2
- package/dist/machines/MachinesProvider.js +35 -1
- package/dist/machines/ServerAddedCard.d.ts +31 -0
- package/dist/machines/ServerAddedCard.js +72 -0
- package/dist/machines/ServerCard.js +91 -215
- package/dist/machines/ServerMachinesPanel.d.ts +2 -2
- package/dist/machines/ServerMachinesPanel.js +184 -323
- package/dist/machines/ServerUpdatePanel.js +51 -40
- package/dist/machines/ShareThisComputerForm.d.ts +19 -0
- package/dist/machines/ShareThisComputerForm.js +133 -0
- package/dist/machines/TokensPanel.d.ts +5 -3
- package/dist/machines/TokensPanel.js +98 -78
- package/dist/machines/headless/fixture-host.d.ts +19 -3
- package/dist/machines/headless/fixture-host.js +42 -5
- package/dist/machines/headless/fixtures.js +4 -6
- package/dist/machines/headless/host.d.ts +40 -19
- package/dist/machines/headless/index.d.ts +3 -3
- package/dist/machines/headless/index.js +2 -2
- package/dist/machines/headless/labels.d.ts +63 -20
- package/dist/machines/headless/labels.js +88 -25
- package/dist/machines/headless/messages.js +8 -0
- package/dist/machines/headless/stores.d.ts +9 -2
- package/dist/machines/headless/stores.js +28 -1
- package/dist/machines/index.d.ts +7 -3
- package/dist/machines/index.js +8 -4
- package/dist/machines/testing/contract.d.ts +15 -3
- package/dist/machines/testing/contract.js +68 -14
- package/dist/motion/grow.d.ts +8 -1
- package/dist/motion/grow.js +10 -4
- package/dist/onboarding/demos/index.js +1 -1
- package/dist/onboarding/headless/labels.d.ts +13 -0
- package/dist/onboarding/headless/labels.js +8 -0
- package/dist/onboarding/index.js +3 -3
- package/dist/onboarding/sources/SourceBrowser.js +11 -7
- package/dist/onboarding/steps/ConnectorsStep.js +1 -1
- package/dist/onboarding/steps/ImportStep.js +4 -1
- package/dist/onboarding/steps/ReadyStep.js +9 -2
- package/dist/onboarding/steps/SkillsStep.js +1 -1
- package/dist/onboarding/steps/connect/KeyForm.js +6 -2
- package/dist/onboarding/steps/connect/ProviderPanel.js +6 -2
- package/dist/onboarding/steps/connect/ProviderReady.js +25 -20
- package/dist/onboarding/steps/tasks.js +17 -14
- package/dist/server/sse-handler.js +141 -19
- package/dist/session/ArtifactsPanel.js +39 -17
- package/dist/session/PlanTracker.js +12 -7
- package/dist/session/ProjectHome.js +13 -11
- package/dist/session/RemindersPanel.js +34 -16
- package/dist/session/RunningWorkDialog.js +6 -2
- package/dist/session/SecretsPanel.js +29 -10
- package/dist/session/SessionDetailsDialog.d.ts +1 -1
- package/dist/session/SessionDetailsDialog.js +18 -10
- package/dist/session/SideChat.js +10 -7
- package/dist/session/TurnDetailsDialog.js +19 -5
- package/dist/session/UsagePanel.js +10 -4
- package/dist/session/headless/host.d.ts +2 -0
- package/dist/session/headless/labels.d.ts +19 -1
- package/dist/session/headless/labels.js +15 -1
- package/dist/session/headless/queue.js +2 -1
- package/dist/session/headless/reminder-labels.d.ts +4 -0
- package/dist/session/headless/reminder-labels.js +4 -0
- package/dist/settings/SettingsRestricted.d.ts +1 -1
- package/dist/settings/SettingsRestricted.js +4 -4
- package/dist/settings/SettingsShell.d.ts +7 -0
- package/dist/settings/SettingsShell.js +6 -1
- package/dist/settings/headless/fixture-performance.d.ts +1 -1
- package/dist/settings/headless/host.d.ts +2 -2
- package/dist/settings/headless/labels.d.ts +3 -3
- package/dist/settings/headless/labels.js +3 -3
- package/dist/settings/headless/performance.d.ts +3 -4
- package/dist/settings/headless/search.d.ts +1 -1
- package/dist/settings/index.d.ts +2 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/sections/editor/EditorSection.js +7 -4
- package/dist/settings/sections/editor/labels.d.ts +1 -0
- package/dist/settings/sections/editor/labels.js +1 -0
- package/dist/settings/sections/environments/EnvironmentsSection.js +19 -12
- package/dist/settings/sections/environments/labels.d.ts +1 -0
- package/dist/settings/sections/environments/labels.js +2 -1
- package/dist/settings/sections/extensions/ExtensionConfigRows.d.ts +1 -3
- package/dist/settings/sections/extensions/ExtensionConfigRows.js +20 -19
- package/dist/settings/sections/extensions/ExtensionOptionsSection.js +2 -1
- package/dist/settings/sections/extensions/options-labels.d.ts +2 -1
- package/dist/settings/sections/extensions/options-labels.js +2 -1
- package/dist/settings/sections/index.d.ts +2 -1
- package/dist/settings/sections/index.js +2 -1
- package/dist/settings/sections/logs/LogsSection.d.ts +2 -2
- package/dist/settings/sections/logs/LogsSection.js +2 -2
- package/dist/settings/sections/mcp/McpSection.d.ts +1 -1
- package/dist/settings/sections/mcp/McpSection.js +12 -6
- package/dist/settings/sections/mcp/McpServerRow.js +20 -13
- package/dist/settings/sections/mcp/labels.d.ts +8 -2
- package/dist/settings/sections/mcp/labels.js +8 -2
- package/dist/settings/sections/models/ModelRows.js +1 -1
- package/dist/settings/sections/models/NewChatPlaceRow.d.ts +26 -0
- package/dist/settings/sections/models/NewChatPlaceRow.js +78 -0
- package/dist/settings/sections/models/SpacesDefaultsSection.js +15 -3
- package/dist/settings/sections/models/labels.d.ts +7 -0
- package/dist/settings/sections/models/labels.js +7 -0
- package/dist/settings/sections/models/model-test.js +7 -4
- package/dist/settings/sections/performance/PerformanceSection.js +16 -6
- package/dist/settings/sections/performance/labels.d.ts +1 -1
- package/dist/settings/sections/performance/labels.js +1 -1
- package/dist/settings/sections/providers/ProvidersSection.d.ts +1 -1
- package/dist/settings/sections/providers/ProvidersSection.js +14 -7
- package/dist/settings/sections/providers/ServerProvidersSection.d.ts +1 -1
- package/dist/settings/sections/providers/ServerProvidersSection.js +11 -5
- package/dist/settings/sections/providers/labels.d.ts +2 -2
- package/dist/settings/sections/providers/labels.js +2 -2
- package/dist/settings/sections/skills/SkillList.js +1 -1
- package/dist/settings/sections/skills/SkillsSection.js +1 -1
- package/dist/settings/testing/performance.contract.js +8 -12
- package/dist/styles.css +32 -3
- package/dist/terminal/HostTerminalSurface.js +15 -5
- package/dist/terminal/TerminalPanel.js +30 -17
- package/dist/terminal/TerminalSurface.js +11 -4
- package/dist/terminal/headless/labels.d.ts +5 -0
- package/dist/terminal/headless/labels.js +5 -0
- package/dist/terminal/headless/store.d.ts +1 -1
- package/dist/terminal/headless/store.js +6 -3
- package/dist/workspace/LayoutBudget.d.ts +5 -1
- package/dist/workspace/LayoutBudget.js +14 -1
- package/dist/workspace/PanelContentView.d.ts +1 -1
- package/dist/workspace/PanelContentView.js +17 -6
- package/dist/workspace/WorkspaceProvider.js +3 -2
- package/dist/workspace/headless/labels.d.ts +1 -0
- package/dist/workspace/headless/labels.js +1 -0
- package/package.json +3 -3
- package/src/styles/motion.css +8 -0
- package/src/styles/primitives.css +7 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { SessionNotification, SessionNotificationStore, createNotificationStore } from "./notifications.js";
|
|
2
2
|
import { SessionActivityFilter, SessionArchiveFilter, SidebarExtensionView, SidebarGroupBy, SidebarListSession, SidebarOrigin, SidebarSortBy, SidebarView, VIEW_CHOICE } from "./types.js";
|
|
3
|
-
import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
|
|
3
|
+
import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
|
|
4
4
|
import { AGENT_GROUPING, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, SidebarContributionStores, SidebarContributions, SidebarGrouping, SidebarItemEntry, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSpace, claimChildSessions, clearedViewFilters, createDecorator, extensionSpaceOf, filterQueryOf, filtersForSpace, itemsForSpace, mergeSidebarSpaces, nextSavedViewName, resolveGrouping, resolveSort, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn } from "./query.js";
|
|
5
|
-
import { DirectoryServer, DirectorySettings, ProjectInSpace, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionRef, SessionRemoval, availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
|
|
5
|
+
import { DirectoryServer, DirectorySettings, ProjectInSpace, RuntimeNow, RuntimeOrigin, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionRef, SessionRemoval, SessionRowChange, availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
|
|
6
6
|
import { SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, createSessionBadges } from "./badges.js";
|
|
7
7
|
import { SessionWindowMode, SidebarEnvironmentHost, SidebarHost } from "./host.js";
|
|
8
8
|
import { DEFAULT_SIDEBAR_LABELS, SidebarLabels } from "./labels.js";
|
|
@@ -16,4 +16,4 @@ import { CompactionProgress, CompactionProgressStore, CompactionSignal, createCo
|
|
|
16
16
|
import { SESSION_HISTORY_LIMIT, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, createSessionHistory, parseSessionHistory } from "./history.js";
|
|
17
17
|
import { DotStateInput, SidebarDotState, deriveDotState } from "./dot-state.js";
|
|
18
18
|
import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
|
|
19
|
-
export { AGENT_GROUPING, BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, COMMON_EMOJI, CompactionProgress, CompactionProgressStore, CompactionSignal, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, DirectoryServer, DirectorySettings, DotStateInput, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, PinsBySpace, ProjectIcon, ProjectIconMap, ProjectInSpace, RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, SessionNotification, SessionNotificationStore, SessionRef, SessionRemoval, SessionWindowMode, SidebarContributionStores, SidebarContributions, SidebarDotState, SidebarEnvironmentHost, SidebarExtensionView, SidebarGroupBy, SidebarGrouping, SidebarHost, SidebarItemEntry, SidebarLabels, SidebarLastSessions, SidebarListRow, SidebarListSession, SidebarNode, SidebarOrigin, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSortBy, SidebarSpace, SidebarView, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
|
|
19
|
+
export { AGENT_GROUPING, BuildQuerySidebarRowsOptions, BuildSidebarRowsOptions, CHATS_BUCKET, COMMON_EMOJI, CompactionProgress, CompactionProgressStore, CompactionSignal, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, DirectoryServer, DirectorySettings, DotStateInput, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, PinsBySpace, ProjectIcon, ProjectIconMap, ProjectInSpace, RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, RuntimeNow, RuntimeOrigin, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, SessionNotification, SessionNotificationStore, SessionRef, SessionRemoval, SessionRowChange, SessionWindowMode, SidebarContributionStores, SidebarContributions, SidebarDotState, SidebarEnvironmentHost, SidebarExtensionView, SidebarGroupBy, SidebarGrouping, SidebarHost, SidebarItemEntry, SidebarLabels, SidebarLastSessions, SidebarListRow, SidebarListSession, SidebarNode, SidebarOrigin, SidebarQueryLayer, SidebarRowChip, SidebarRowDecoration, SidebarSortBy, SidebarSpace, SidebarView, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
|
|
@@ -8,11 +8,11 @@ import { PINNED_PROJECTS_KEY, parsePinnedProjects, withPinnedProject } from "./p
|
|
|
8
8
|
import { activityLabel, createSessionActivity, reduceActivity } from "./activity.js";
|
|
9
9
|
import { createCompactionProgress, reduceCompaction } from "./compaction.js";
|
|
10
10
|
import { createSessionBadges } from "./badges.js";
|
|
11
|
-
import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
|
|
11
|
+
import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
|
|
12
12
|
import { SESSION_HISTORY_LIMIT, createSessionHistory, parseSessionHistory } from "./history.js";
|
|
13
13
|
import { createNotificationStore } from "./notifications.js";
|
|
14
14
|
import { AGENT_GROUPING, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, claimChildSessions, clearedViewFilters, createDecorator, extensionSpaceOf, filterQueryOf, filtersForSpace, itemsForSpace, mergeSidebarSpaces, nextSavedViewName, resolveGrouping, resolveSort, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn } from "./query.js";
|
|
15
15
|
import { availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
|
|
16
16
|
import { deriveDotState } from "./dot-state.js";
|
|
17
17
|
import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
|
|
18
|
-
export { AGENT_GROUPING, CHATS_BUCKET, COMMON_EMOJI, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
|
|
18
|
+
export { AGENT_GROUPING, CHATS_BUCKET, COMMON_EMOJI, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, MAIN_SESSION_ICON_KEY, MAX_ROW_CHIPS, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_ICONS_KEY, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, VIEW_CHOICE, activityLabel, availableProjectsOf, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, claimChildSessions, clearedViewFilters, createCompactionProgress, createDecorator, createNotificationStore, createRunEstimates, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, projectKeyOf, projectPathOf, readSidebarViews, reduceActivity, reduceCompaction, repoGroups, resolveGrouping, resolveSort, runsInRemoteSandbox, sessionRefsOf, sidebarContributionsOf, spaceMembership, switcherSpaces, viewFilterOf, viewFiltersOn, withPinnedProject };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SecretTimeLeft } from "../secrets.js";
|
|
2
|
-
import { u as AuthFailure } from "../../../dist/timeout-
|
|
3
|
-
import {
|
|
2
|
+
import { u as AuthFailure } from "../../../dist/timeout-Cyx3VGPz.js";
|
|
3
|
+
import { tw as SecretTtl } from "../../../dist/index-BZM8tu4L.js";
|
|
4
4
|
import "../../../dist/index.js";
|
|
5
5
|
import "../index.js";
|
|
6
6
|
//#region src/chat/headless/sidebar/labels.d.ts
|
|
@@ -209,7 +209,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
209
209
|
authSignedInRetrying: string;
|
|
210
210
|
authFixed: string;
|
|
211
211
|
authTryAgain: string;
|
|
212
|
-
|
|
212
|
+
authSignInFailed: string;
|
|
213
213
|
sessionEventLabel: (title: string, verb: string, needsAttention: boolean) => string;
|
|
214
214
|
clickToAnswer: string;
|
|
215
215
|
openSession: string;
|
|
@@ -252,7 +252,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
252
252
|
zoomOutDiagram: string;
|
|
253
253
|
fitDiagram: string;
|
|
254
254
|
copyDiagramSource: string;
|
|
255
|
-
|
|
255
|
+
diagramNotDrawn: (at: string) => string;
|
|
256
256
|
diagramErrorAt: (line: number, column: number) => string;
|
|
257
257
|
stopCommand: string;
|
|
258
258
|
shellCancelled: string;
|
|
@@ -273,7 +273,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
273
273
|
blockRunStopped: string;
|
|
274
274
|
blockRunTimedOut: string;
|
|
275
275
|
blockRunTruncated: string;
|
|
276
|
-
|
|
276
|
+
blockRunError: string;
|
|
277
277
|
blockRunNeedsTerminal: string;
|
|
278
278
|
working: string;
|
|
279
279
|
foldSteps: (count: number) => string;
|
|
@@ -300,9 +300,8 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
300
300
|
loadingEarlierHistory: string;
|
|
301
301
|
composerLabel: string;
|
|
302
302
|
composerPlaceholder: string;
|
|
303
|
-
composerPlaceholderSteer: string;
|
|
304
|
-
composerPlaceholderQueue: string;
|
|
305
303
|
sendMessage: string;
|
|
304
|
+
composerSendFailed: string;
|
|
306
305
|
sendHint: string;
|
|
307
306
|
stopRun: string;
|
|
308
307
|
stopHint: string;
|
|
@@ -347,7 +346,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
347
346
|
modelsJumpToProvider: string;
|
|
348
347
|
modelsJumpHint: (provider: string, digit: number | null) => string;
|
|
349
348
|
modelsLoading: string;
|
|
350
|
-
|
|
349
|
+
modelsLoadError: string;
|
|
351
350
|
modelsNoProviders: string;
|
|
352
351
|
modelsNoMatch: (query: string) => string;
|
|
353
352
|
modelsTypeAnId: string;
|
|
@@ -404,6 +403,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
404
403
|
inboxRecent: string;
|
|
405
404
|
inboxPreviousSession: string;
|
|
406
405
|
unsupportedInteraction: (tool: string) => string;
|
|
406
|
+
answerSendFailed: string;
|
|
407
407
|
planRejectNote: string;
|
|
408
408
|
planReviseNote: string;
|
|
409
409
|
planRejectPlaceholder: string;
|
|
@@ -468,6 +468,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
468
468
|
filterSorts: {
|
|
469
469
|
recency: string;
|
|
470
470
|
createdTime: string;
|
|
471
|
+
lastUserMessage: string;
|
|
471
472
|
alphabetical: string;
|
|
472
473
|
};
|
|
473
474
|
filterAllProjects: string;
|
|
@@ -555,6 +556,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
555
556
|
interactionAnsweredBy: (who: string) => string;
|
|
556
557
|
badgePathUnavailable: string;
|
|
557
558
|
badgeNoComposer: string;
|
|
559
|
+
badgeActionFailed: string;
|
|
558
560
|
badgeCopied: string;
|
|
559
561
|
badgeOpenIn: (app: string) => string;
|
|
560
562
|
badgeOpenInBrowserPane: string;
|
|
@@ -590,6 +592,9 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
590
592
|
previous: string;
|
|
591
593
|
next: string;
|
|
592
594
|
loading: string;
|
|
595
|
+
noticeDetails: string;
|
|
596
|
+
noticeStack: string;
|
|
597
|
+
noticeDismiss: string;
|
|
593
598
|
filePath: (path: string) => string;
|
|
594
599
|
rename: string;
|
|
595
600
|
current: string;
|
|
@@ -607,6 +612,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
607
612
|
modalBack: string;
|
|
608
613
|
screenBack: (screen: string) => string;
|
|
609
614
|
screenBackKey: string;
|
|
615
|
+
screenNavBack: (screen: string) => string;
|
|
610
616
|
paletteLabel: string;
|
|
611
617
|
paletteFilter: string;
|
|
612
618
|
paletteBack: string;
|
|
@@ -670,6 +676,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
|
|
|
670
676
|
openInNewTab: string;
|
|
671
677
|
terminal: string;
|
|
672
678
|
terminalLoadFailed: (message: string) => string;
|
|
679
|
+
terminalStartFailed: string;
|
|
673
680
|
terminalExited: (code: number) => string;
|
|
674
681
|
};
|
|
675
682
|
/** The sidebar's strings, as {@link DEFAULT_SIDEBAR_LABELS} has them. */
|
|
@@ -15,6 +15,8 @@ interface SidebarListSession {
|
|
|
15
15
|
createdAt: number;
|
|
16
16
|
/** Epoch ms of the last activity. */
|
|
17
17
|
updatedAt: number;
|
|
18
|
+
/** Epoch ms of the user's last typed message, for the "Last user message" sort. If absent, the session sorts by `createdAt`. */
|
|
19
|
+
lastUserMessageAt?: number;
|
|
18
20
|
/** The folder its tools run in. */
|
|
19
21
|
cwd: string;
|
|
20
22
|
/** The repository or project folder it belongs to, when known. */
|
|
@@ -72,7 +74,7 @@ interface SidebarExtensionView {
|
|
|
72
74
|
/** The Origin filter: the sessions a reminder started (`scheduleId` set), or the others. */
|
|
73
75
|
type SidebarOrigin = 'scheduled' | 'unscheduled';
|
|
74
76
|
/** How the sidebar orders sessions inside a group. */
|
|
75
|
-
type SidebarSortBy = 'recency' | 'createdTime' | 'alphabetical';
|
|
77
|
+
type SidebarSortBy = 'recency' | 'createdTime' | 'lastUserMessage' | 'alphabetical';
|
|
76
78
|
/** The filter axes, kept per space. */
|
|
77
79
|
interface SidebarView {
|
|
78
80
|
/** Active, archived or every session. */
|
|
@@ -3,13 +3,19 @@ import { SidebarView } from "./types.js";
|
|
|
3
3
|
//#region src/chat/headless/sidebar/view.d.ts
|
|
4
4
|
/** A view nobody changed yet. */
|
|
5
5
|
declare const DEFAULT_SIDEBAR_VIEW: SidebarView;
|
|
6
|
+
/** The format a view record carries (`v`). Format 1 had none, and its `sortBy: 'recency'` reads as the default. */
|
|
7
|
+
declare const SIDEBAR_VIEW_VERSION = 2;
|
|
6
8
|
/** Where the views persist: one map of space id → view. */
|
|
7
|
-
declare const SIDEBAR_VIEW_KEY = "zg-sidebar-view:
|
|
9
|
+
declare const SIDEBAR_VIEW_KEY = "zg-sidebar-view:v2";
|
|
8
10
|
/** Where the shown space persists. */
|
|
9
11
|
declare const SIDEBAR_SPACE_KEY = "zg-sidebar-space";
|
|
10
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* A space's record as stored: its view, the conversation last open in it (`session`, when one was),
|
|
14
|
+
* and its format (`v`, {@link SIDEBAR_VIEW_VERSION} on every record written).
|
|
15
|
+
*/
|
|
11
16
|
type SidebarViewRecord = SidebarView & {
|
|
12
17
|
session?: string;
|
|
18
|
+
v?: number;
|
|
13
19
|
};
|
|
14
20
|
/** The views the host keeps for this user, next to the device's Storage. */
|
|
15
21
|
interface SidebarViewsHost {
|
|
@@ -23,7 +29,8 @@ interface SidebarViewsHost {
|
|
|
23
29
|
setSpace(spaceId: string): Promise<unknown>;
|
|
24
30
|
}
|
|
25
31
|
/**
|
|
26
|
-
* A stored view, every axis checked
|
|
32
|
+
* A stored view, every axis checked. What is missing or unknown takes the default. A record
|
|
33
|
+
* without the format mark (format 1) reads `sortBy: 'recency'` as unset, because it was format 1's default.
|
|
27
34
|
*
|
|
28
35
|
* @param raw - The stored value.
|
|
29
36
|
*/
|
|
@@ -55,7 +62,8 @@ type SidebarLastSessions = Record<string, string>;
|
|
|
55
62
|
/** The Storage the views persist in (`localStorage` in a browser). */
|
|
56
63
|
type SidebarViewsStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;
|
|
57
64
|
/**
|
|
58
|
-
* The views the Storage holds: the per-space map
|
|
65
|
+
* The views the Storage holds: the per-space map (format 1's when the current key holds none),
|
|
66
|
+
* else the legacy per-axis keys as the default space's view.
|
|
59
67
|
*
|
|
60
68
|
* @param storage - Where the views persist; absent reads nothing.
|
|
61
69
|
*/
|
|
@@ -103,4 +111,4 @@ interface SidebarViewsOptions {
|
|
|
103
111
|
*/
|
|
104
112
|
declare function createSidebarViews(options?: SidebarViewsOptions): SidebarViews;
|
|
105
113
|
//#endregion
|
|
106
|
-
export { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews };
|
|
114
|
+
export { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, SidebarLastSessions, SidebarViewMap, SidebarViewRecord, SidebarViews, SidebarViewsHost, SidebarViewsOptions, SidebarViewsStorage, SpaceSwitcherPrefs, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews };
|
|
@@ -11,6 +11,12 @@ import { DEFAULT_SPACE_ID } from "zidane/chat/pure";
|
|
|
11
11
|
* too (`ChatHost.sessions.views`, the desktop app's database), it is read
|
|
12
12
|
* once and wins for every space this run has not changed yet; a space only
|
|
13
13
|
* this device knows is written back to it.
|
|
14
|
+
*
|
|
15
|
+
* In format 2 (`SIDEBAR_VIEW_VERSION`), the default sort is creation time.
|
|
16
|
+
* Format 1 saved the whole view, with `sortBy: 'recency'` even when nobody
|
|
17
|
+
* picked it. So a record without the mark (Storage's v1 key, the host's copy,
|
|
18
|
+
* an older app's write) reads that sort as unset, on each read. Every record
|
|
19
|
+
* written in format 2 carries the mark.
|
|
14
20
|
*/
|
|
15
21
|
/** A view nobody changed yet. */
|
|
16
22
|
const DEFAULT_SIDEBAR_VIEW = {
|
|
@@ -18,10 +24,14 @@ const DEFAULT_SIDEBAR_VIEW = {
|
|
|
18
24
|
project: null,
|
|
19
25
|
activity: "all",
|
|
20
26
|
groupBy: "project",
|
|
21
|
-
sortBy: "
|
|
27
|
+
sortBy: "createdTime"
|
|
22
28
|
};
|
|
29
|
+
/** The format a view record carries (`v`). Format 1 had none, and its `sortBy: 'recency'` reads as the default. */
|
|
30
|
+
const SIDEBAR_VIEW_VERSION = 2;
|
|
23
31
|
/** Where the views persist: one map of space id → view. */
|
|
24
|
-
const SIDEBAR_VIEW_KEY = "zg-sidebar-view:
|
|
32
|
+
const SIDEBAR_VIEW_KEY = "zg-sidebar-view:v2";
|
|
33
|
+
/** Where format 1 kept them: read when the current key holds nothing, then removed. */
|
|
34
|
+
const SIDEBAR_VIEW_KEY_V1 = "zg-sidebar-view:v1";
|
|
25
35
|
/** Where the shown space persists. */
|
|
26
36
|
const SIDEBAR_SPACE_KEY = "zg-sidebar-space";
|
|
27
37
|
const oneOf = (members) => (raw) => members.includes(raw) ? raw : void 0;
|
|
@@ -48,6 +58,7 @@ const parseGroupBy = oneOf([
|
|
|
48
58
|
const parseSortBy = oneOf([
|
|
49
59
|
"recency",
|
|
50
60
|
"createdTime",
|
|
61
|
+
"lastUserMessage",
|
|
51
62
|
"alphabetical"
|
|
52
63
|
]);
|
|
53
64
|
function parseExtensionView(raw) {
|
|
@@ -71,13 +82,15 @@ function parseExtensionView(raw) {
|
|
|
71
82
|
};
|
|
72
83
|
}
|
|
73
84
|
/**
|
|
74
|
-
* A stored view, every axis checked
|
|
85
|
+
* A stored view, every axis checked. What is missing or unknown takes the default. A record
|
|
86
|
+
* without the format mark (format 1) reads `sortBy: 'recency'` as unset, because it was format 1's default.
|
|
75
87
|
*
|
|
76
88
|
* @param raw - The stored value.
|
|
77
89
|
*/
|
|
78
90
|
function parseSidebarView(raw) {
|
|
79
91
|
const o = raw && typeof raw === "object" ? raw : {};
|
|
80
92
|
const str = (v) => typeof v === "string" ? v : "";
|
|
93
|
+
const formerDefault = o.v !== 2 && o.sortBy === "recency";
|
|
81
94
|
const d = DEFAULT_SIDEBAR_VIEW;
|
|
82
95
|
const agent = typeof o.agent === "string" && o.agent.length > 0 ? o.agent : null;
|
|
83
96
|
const origin = o.origin === "scheduled" || o.origin === "unscheduled" ? o.origin : null;
|
|
@@ -87,7 +100,7 @@ function parseSidebarView(raw) {
|
|
|
87
100
|
project: typeof o.project === "string" && o.project.length > 0 ? o.project : null,
|
|
88
101
|
activity: parseActivity(str(o.activity)) ?? d.activity,
|
|
89
102
|
groupBy: parseGroupBy(str(o.groupBy)) ?? d.groupBy,
|
|
90
|
-
sortBy: parseSortBy(str(o.sortBy)) ?? d.sortBy,
|
|
103
|
+
sortBy: (formerDefault ? void 0 : parseSortBy(str(o.sortBy))) ?? d.sortBy,
|
|
91
104
|
...agent ? { agent } : {},
|
|
92
105
|
...origin ? { origin } : {},
|
|
93
106
|
...extension ? { extension } : {}
|
|
@@ -154,13 +167,18 @@ function write(storage, key, value) {
|
|
|
154
167
|
else storage?.setItem(key, value);
|
|
155
168
|
} catch {}
|
|
156
169
|
}
|
|
170
|
+
/** The stored per-space records: the current key, else format 1's. */
|
|
171
|
+
function readRecords(storage) {
|
|
172
|
+
return parseJson(read(storage, "zg-sidebar-view:v2") ?? read(storage, SIDEBAR_VIEW_KEY_V1));
|
|
173
|
+
}
|
|
157
174
|
/**
|
|
158
|
-
* The views the Storage holds: the per-space map
|
|
175
|
+
* The views the Storage holds: the per-space map (format 1's when the current key holds none),
|
|
176
|
+
* else the legacy per-axis keys as the default space's view.
|
|
159
177
|
*
|
|
160
178
|
* @param storage - Where the views persist; absent reads nothing.
|
|
161
179
|
*/
|
|
162
180
|
function readSidebarViews(storage) {
|
|
163
|
-
const stored = viewsFrom(
|
|
181
|
+
const stored = viewsFrom(readRecords(storage));
|
|
164
182
|
if (stored) return stored;
|
|
165
183
|
const legacy = Object.fromEntries(Object.entries(LEGACY_KEYS).map(([field, key]) => [field, read(storage, key)]));
|
|
166
184
|
return Object.values(legacy).some((v) => v !== void 0) ? { [DEFAULT_SPACE_ID]: parseSidebarView(legacy) } : {};
|
|
@@ -173,7 +191,7 @@ function readSidebarViews(storage) {
|
|
|
173
191
|
function createSidebarViews(options = {}) {
|
|
174
192
|
const { storage, host, onError } = options;
|
|
175
193
|
const views = writable(readSidebarViews(storage));
|
|
176
|
-
let lastSessions = sessionsFrom(
|
|
194
|
+
let lastSessions = sessionsFrom(readRecords(storage));
|
|
177
195
|
const savedSpace = read(storage, SIDEBAR_SPACE_KEY);
|
|
178
196
|
const space = writable(savedSpace || (options.fallbackSpace ?? DEFAULT_SPACE_ID));
|
|
179
197
|
/** Spaces whose view changed this run: the host's older copy never overwrites them. */
|
|
@@ -185,15 +203,17 @@ function createSidebarViews(options = {}) {
|
|
|
185
203
|
const switcher = writable(parseSwitcherPrefs(parseJson(read(storage, SIDEBAR_SWITCHER_KEY))));
|
|
186
204
|
const recordOf = (spaceId, view = views.get()[spaceId] ?? DEFAULT_SIDEBAR_VIEW) => {
|
|
187
205
|
const session = lastSessions[spaceId];
|
|
188
|
-
return
|
|
206
|
+
return {
|
|
189
207
|
...view,
|
|
190
|
-
session
|
|
191
|
-
|
|
208
|
+
...session ? { session } : {},
|
|
209
|
+
v: 2
|
|
210
|
+
};
|
|
192
211
|
};
|
|
193
212
|
const persistViews = (next) => {
|
|
194
213
|
const ids = /* @__PURE__ */ new Set([...Object.keys(next), ...Object.keys(lastSessions)]);
|
|
195
214
|
const records = Object.fromEntries([...ids].map((id) => [id, recordOf(id, next[id] ?? DEFAULT_SIDEBAR_VIEW)]));
|
|
196
215
|
write(storage, SIDEBAR_VIEW_KEY, JSON.stringify(records));
|
|
216
|
+
write(storage, SIDEBAR_VIEW_KEY_V1, null);
|
|
197
217
|
for (const key of Object.values(LEGACY_KEYS)) write(storage, key, null);
|
|
198
218
|
};
|
|
199
219
|
const saveView = (spaceId, view) => {
|
|
@@ -295,4 +315,4 @@ function createSidebarViews(options = {}) {
|
|
|
295
315
|
};
|
|
296
316
|
}
|
|
297
317
|
//#endregion
|
|
298
|
-
export { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews };
|
|
318
|
+
export { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SIDEBAR_VIEW_VERSION, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews };
|
|
@@ -10,8 +10,8 @@ interface SessionStreamActions<K extends string = string> {
|
|
|
10
10
|
reset(sessionId: K): void;
|
|
11
11
|
/** Forgets the session (a deleted one). */
|
|
12
12
|
drop(sessionId: K): void;
|
|
13
|
-
/** Shows a sent prompt at once; the host's echo of it is then dropped. */
|
|
14
|
-
appendUserPrompt(sessionId: K, text: string, refs?: readonly PromptSegmentRef[], attachments?: readonly ChatAttachment[]): void;
|
|
13
|
+
/** Shows a sent prompt at once; the host's echo of it (matched by `clientMessageId` when given, else by text) is then dropped. */
|
|
14
|
+
appendUserPrompt(sessionId: K, text: string, refs?: readonly PromptSegmentRef[], attachments?: readonly ChatAttachment[], clientMessageId?: string): void;
|
|
15
15
|
/** Unwinds one pending echo after a failed send. */
|
|
16
16
|
dropPendingEcho(sessionId: K, text: string): void;
|
|
17
17
|
/** Keeps a queued prompt's previews until the host sends it. */
|
|
@@ -32,8 +32,10 @@ interface SessionStreamActions<K extends string = string> {
|
|
|
32
32
|
evictExcept(keep: ReadonlySet<K>): void;
|
|
33
33
|
/** Forgets every session. */
|
|
34
34
|
dropAll(): void;
|
|
35
|
-
/** Hydrates a tail page (events and scrollback bookkeeping, one notify). */
|
|
35
|
+
/** Hydrates a tail page (events and scrollback bookkeeping, one notify); a page older than a write applied since is read again. */
|
|
36
36
|
setEventsPage(sessionId: K, page: SessionStreamPage): void;
|
|
37
|
+
/** Brings the session's window back in step after its signals may have gone missing (the reconnect ladder's last steps). */
|
|
38
|
+
resync(sessionId: K): void;
|
|
37
39
|
/** Seeds the session's `SYSTEM.md` override. */
|
|
38
40
|
seedSystemMd(sessionId: K, file: SystemMdFile | null): void;
|
|
39
41
|
/** Names the session the user reads: its run-end compaction waits until it is backgrounded. */
|
|
@@ -11,10 +11,11 @@ function createSessionStreamActions(streams) {
|
|
|
11
11
|
drop: (sessionId) => streams.drop(sessionId),
|
|
12
12
|
dropAll: () => streams.dropAll(),
|
|
13
13
|
evictExcept: (keep) => streams.evictExcept(keep),
|
|
14
|
-
setEventsPage: (sessionId, page) =>
|
|
14
|
+
setEventsPage: (sessionId, page) => streams.setEventsPage(sessionId, page),
|
|
15
|
+
resync: (sessionId) => streams.resync(sessionId),
|
|
15
16
|
seedSystemMd: (sessionId, file) => store.seedSystemMd(sessionId, file),
|
|
16
17
|
loadEarlier: (sessionId, options) => streams.loadEarlier(sessionId, options),
|
|
17
|
-
appendUserPrompt: (sessionId, text, refs, attachments) => store.appendUserPrompt(sessionId, text, refs, attachments),
|
|
18
|
+
appendUserPrompt: (sessionId, text, refs, attachments, clientMessageId) => store.appendUserPrompt(sessionId, text, refs, attachments, clientMessageId),
|
|
18
19
|
dropPendingEcho: (sessionId, text) => store.dropPendingEcho(sessionId, text),
|
|
19
20
|
rememberPromptPreviews: (sessionId, text, attachments) => store.rememberPromptPreviews(sessionId, text, attachments),
|
|
20
21
|
dropPromptPreviews: (sessionId, text) => store.dropPromptPreviews(sessionId, text),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { FrameScheduler, defaultFrameScheduler } from "./scheduler.js";
|
|
2
1
|
import { OtherStreamSignal, SessionFallbackModel, SessionPageState, SessionRetryState, SessionStreamPage, SessionStreamSignal } from "./types.js";
|
|
3
2
|
import { DrainPlan } from "./pacer.js";
|
|
4
|
-
import {
|
|
3
|
+
import { FrameScheduler, defaultFrameScheduler } from "./scheduler.js";
|
|
4
|
+
import { PendingEcho, SessionStreamStore, SessionStreamStoreOptions, SessionStreamWrite } from "./store.js";
|
|
5
5
|
import { LoadEarlierOptions, SessionStreams, SessionStreamsOptions, createSessionStreams } from "./session-streams.js";
|
|
6
6
|
import { mergeLiveTail } from "./merge.js";
|
|
7
7
|
import { mergePromptPreviews, missingPreviewData } from "./prompt-previews.js";
|
|
8
8
|
import { SessionStreamActions, createSessionStreamActions } from "./actions.js";
|
|
9
9
|
import { selectEditEvents, stableSelection } from "./selectors.js";
|
|
10
|
-
export { type DrainPlan, type FrameScheduler, type LoadEarlierOptions, type OtherStreamSignal, type SessionFallbackModel, type SessionPageState, type SessionRetryState, type SessionStreamActions, type SessionStreamPage, type SessionStreamSignal, SessionStreamStore, type SessionStreamStoreOptions, type SessionStreamWrite, type SessionStreams, type SessionStreamsOptions, createSessionStreamActions, createSessionStreams, defaultFrameScheduler, mergeLiveTail, mergePromptPreviews, missingPreviewData, selectEditEvents, stableSelection };
|
|
10
|
+
export { type DrainPlan, type FrameScheduler, type LoadEarlierOptions, type OtherStreamSignal, type PendingEcho, type SessionFallbackModel, type SessionPageState, type SessionRetryState, type SessionStreamActions, type SessionStreamPage, type SessionStreamSignal, SessionStreamStore, type SessionStreamStoreOptions, type SessionStreamWrite, type SessionStreams, type SessionStreamsOptions, createSessionStreamActions, createSessionStreams, defaultFrameScheduler, mergeLiveTail, mergePromptPreviews, missingPreviewData, selectEditEvents, stableSelection };
|
|
@@ -3,16 +3,12 @@ import { ChatEvent } from "../host.js";
|
|
|
3
3
|
/**
|
|
4
4
|
* Hydrate a live-only window: the disk page followed by the live events
|
|
5
5
|
* that disk does not have yet. Persisted turns and their live events share
|
|
6
|
-
* a `turnId` (
|
|
7
|
-
* whose turn is on the page
|
|
8
|
-
* streaming markdown, a display-only error row) is kept
|
|
9
|
-
* it is superseded by its persisted form.
|
|
10
|
-
* run's first turn is still streaming)
|
|
11
|
-
*
|
|
12
|
-
* Untagged live events in the kept suffix (a `user-prompt` echo is
|
|
13
|
-
* broadcast bare and only retagged by `prompt-turns`, `steer:inject` echoes
|
|
14
|
-
* likewise) are dropped when the page's trailing part already holds the
|
|
15
|
-
* same `kind` + `text` — otherwise the disk copy and the echo both render.
|
|
6
|
+
* a `turnId` (the host mints it before it streams). So the boundary is the
|
|
7
|
+
* LAST live event whose turn is on the page. Everything after it (the
|
|
8
|
+
* in-flight turn's streaming markdown, a display-only error row) is kept.
|
|
9
|
+
* Everything up to it is superseded by its persisted form. If no live turn
|
|
10
|
+
* is on the page (the run's first turn is still streaming), the whole live
|
|
11
|
+
* lane is kept.
|
|
16
12
|
*
|
|
17
13
|
* @param live - The window's live events (never hydrated from disk).
|
|
18
14
|
* @param page - The persisted page to hydrate it with.
|
|
@@ -3,16 +3,12 @@ import { reconcileEvents } from "zidane/chat/pure";
|
|
|
3
3
|
/**
|
|
4
4
|
* Hydrate a live-only window: the disk page followed by the live events
|
|
5
5
|
* that disk does not have yet. Persisted turns and their live events share
|
|
6
|
-
* a `turnId` (
|
|
7
|
-
* whose turn is on the page
|
|
8
|
-
* streaming markdown, a display-only error row) is kept
|
|
9
|
-
* it is superseded by its persisted form.
|
|
10
|
-
* run's first turn is still streaming)
|
|
11
|
-
*
|
|
12
|
-
* Untagged live events in the kept suffix (a `user-prompt` echo is
|
|
13
|
-
* broadcast bare and only retagged by `prompt-turns`, `steer:inject` echoes
|
|
14
|
-
* likewise) are dropped when the page's trailing part already holds the
|
|
15
|
-
* same `kind` + `text` — otherwise the disk copy and the echo both render.
|
|
6
|
+
* a `turnId` (the host mints it before it streams). So the boundary is the
|
|
7
|
+
* LAST live event whose turn is on the page. Everything after it (the
|
|
8
|
+
* in-flight turn's streaming markdown, a display-only error row) is kept.
|
|
9
|
+
* Everything up to it is superseded by its persisted form. If no live turn
|
|
10
|
+
* is on the page (the run's first turn is still streaming), the whole live
|
|
11
|
+
* lane is kept.
|
|
16
12
|
*
|
|
17
13
|
* @param live - The window's live events (never hydrated from disk).
|
|
18
14
|
* @param page - The persisted page to hydrate it with.
|
|
@@ -29,17 +25,7 @@ function mergeLiveTail(live, page) {
|
|
|
29
25
|
break;
|
|
30
26
|
}
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
let trailingFrom = 0;
|
|
34
|
-
if (boundaryTurn) {
|
|
35
|
-
for (let i = page.length - 1; i >= 0; i--) if (page[i].turnId === boundaryTurn) {
|
|
36
|
-
trailingFrom = i + 1;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
const trailing = page.slice(trailingFrom);
|
|
41
|
-
const suffix = live.slice(lastPersisted + 1).filter((event) => event.turnId || !trailing.some((p) => p.kind === event.kind && p.text === event.text));
|
|
42
|
-
return [...reconcileEvents(live, page), ...suffix];
|
|
28
|
+
return [...reconcileEvents(live, page), ...live.slice(lastPersisted + 1)];
|
|
43
29
|
}
|
|
44
30
|
//#endregion
|
|
45
31
|
export { mergeLiveTail };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Transcript } from "../host.js";
|
|
2
|
-
import { FrameScheduler } from "./scheduler.js";
|
|
1
|
+
import { ChatEvent, Transcript } from "../host.js";
|
|
3
2
|
import { OtherStreamSignal, SessionStreamPage, SessionStreamSignal } from "./types.js";
|
|
3
|
+
import { FrameScheduler } from "./scheduler.js";
|
|
4
4
|
import { SessionStreamStore } from "./store.js";
|
|
5
|
-
import { MarkdownDeltaOptions } from "zidane/chat/pure";
|
|
5
|
+
import { HistoryChange, HistorySince, MarkdownDeltaOptions } from "zidane/chat/pure";
|
|
6
6
|
//#region src/chat/headless/streams/session-streams.d.ts
|
|
7
7
|
/** Options for {@link createSessionStreams}. */
|
|
8
8
|
interface SessionStreamsOptions<K extends string = string> {
|
|
@@ -12,10 +12,17 @@ interface SessionStreamsOptions<K extends string = string> {
|
|
|
12
12
|
scheduler?: FrameScheduler;
|
|
13
13
|
/** How streamed markdown merges. Default: one event per message. */
|
|
14
14
|
markdown?: MarkdownDeltaOptions;
|
|
15
|
-
/** Loads a session's persisted tail page. Run-end compaction
|
|
15
|
+
/** Loads a session's persisted tail page. Run-end compaction and a history rewrite's fetch need it; without it neither happens. */
|
|
16
16
|
loadTail?(sessionId: K): Promise<SessionStreamPage>;
|
|
17
17
|
/** Loads the page before `beforeSeq`. {@link SessionStreams.loadEarlier} needs it. */
|
|
18
18
|
loadBefore?(sessionId: K, beforeSeq: number): Promise<SessionStreamPage>;
|
|
19
|
+
/**
|
|
20
|
+
* The reconnect ladder's second step (`sessions.historySince`). Reads the rows
|
|
21
|
+
* of the turns appended after `afterPos` of numbering `historyId`. Returns
|
|
22
|
+
* `null` when the host cannot say (a rewrite since, another history).
|
|
23
|
+
* {@link SessionStreams.resync} needs it to skip the tail read.
|
|
24
|
+
*/
|
|
25
|
+
loadSince?(sessionId: K, afterPos: number, historyId: string): Promise<HistorySince<ChatEvent> | null>;
|
|
19
26
|
/** Event count past which a background window is compacted at run end. Default: 2000. */
|
|
20
27
|
compactAbove?: number;
|
|
21
28
|
}
|
|
@@ -34,6 +41,24 @@ interface SessionStreams<K extends string = string> {
|
|
|
34
41
|
* follows, so the transcript stays in causal order.
|
|
35
42
|
*/
|
|
36
43
|
apply(signal: SessionStreamSignal<K> | OtherStreamSignal): void;
|
|
44
|
+
/**
|
|
45
|
+
* Applies one history write (`history:changed`) to a session's window
|
|
46
|
+
* (`SessionStreamStore.applyHistory`). A rewrite, a missed write or an
|
|
47
|
+
* append too large to carry its rows fetches the tail and replaces the
|
|
48
|
+
* window with it. The fetch happens at once, or at the end of a streaming run.
|
|
49
|
+
*/
|
|
50
|
+
applyHistory(sessionId: K, change: HistoryChange): void;
|
|
51
|
+
/**
|
|
52
|
+
* Brings a session's window back in step after its live signals may have
|
|
53
|
+
* gone missing (the connection came back, and the signals could not be
|
|
54
|
+
* replayed). It climbs the reconnect ladder's last two steps
|
|
55
|
+
* (`climbReconnectLadder`). It applies the rows appended since its history
|
|
56
|
+
* position (`loadSince`), or else reads its tail again. A window that is not
|
|
57
|
+
* hydrated (dropped by a runtime switch) reads its tail.
|
|
58
|
+
*/
|
|
59
|
+
resync(sessionId: K): void;
|
|
60
|
+
/** Hydrates a tail page into the store (`SessionStreamStore.setEventsPage`); a page cut before a write the window applied since is read again. */
|
|
61
|
+
setEventsPage(sessionId: K, page: SessionStreamPage): void;
|
|
37
62
|
/** A session's transcript as a {@link ChatHost} hands it to the components (cached per session). */
|
|
38
63
|
transcript(sessionId: K): Transcript;
|
|
39
64
|
/** Empties a session's window and run state (and its smoothing bucket). */
|
|
@@ -3,8 +3,17 @@ import { SessionStreamStore } from "./store.js";
|
|
|
3
3
|
import { storeTranscript } from "./transcript.js";
|
|
4
4
|
import "../smooth-stream.js";
|
|
5
5
|
import { allBucketsEmpty, getOrCreateBucket, planDrainBeforeSignal, planFullDrain, planTickDrain } from "./pacer.js";
|
|
6
|
+
import { climbReconnectLadder, cursorValid } from "zidane/chat/pure";
|
|
6
7
|
//#region src/chat/headless/streams/session-streams.ts
|
|
7
8
|
/**
|
|
9
|
+
* `createSessionStreams`: the session stream store with everything a live
|
|
10
|
+
* client wraps around it. Smooth streaming paces streamed markdown per
|
|
11
|
+
* (session, owner) on a once-per-frame ticker; lazy scrollback fetches the
|
|
12
|
+
* page before a window; run-end compaction swaps an oversized background
|
|
13
|
+
* window back to its disk tail page. React-free: frames and fetches are
|
|
14
|
+
* injected.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
8
17
|
* Event count past which a session's live window is compacted back to the
|
|
9
18
|
* on-disk tail page at the next run-end boundary. Sized well above a tail
|
|
10
19
|
* page (at least 200 turns) so compaction only ever fires after genuinely
|
|
@@ -68,9 +77,51 @@ function createSessionStreams(options = {}) {
|
|
|
68
77
|
if (store.getEventsSnapshot(sessionId) === snapshot) store.setEventsPage(sessionId, page);
|
|
69
78
|
}).catch(() => {});
|
|
70
79
|
};
|
|
80
|
+
/** One read per session is in flight. A read asked for meanwhile runs after it, if the first did not bring the window up to date. */
|
|
81
|
+
const reading = /* @__PURE__ */ new Map();
|
|
82
|
+
const refetch = (sessionId, attempts = 3) => {
|
|
83
|
+
if (!options.loadTail) return;
|
|
84
|
+
const inFlight = reading.get(sessionId);
|
|
85
|
+
if (inFlight) {
|
|
86
|
+
inFlight.again = true;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const entry = { again: false };
|
|
90
|
+
reading.set(sessionId, entry);
|
|
91
|
+
const settle = () => {
|
|
92
|
+
if (reading.get(sessionId) === entry) reading.delete(sessionId);
|
|
93
|
+
};
|
|
94
|
+
const followUp = () => {
|
|
95
|
+
if (entry.again && !reading.has(sessionId) && store.isTailDue(sessionId) && !store.getRunningSnapshot(sessionId)) refetch(sessionId);
|
|
96
|
+
};
|
|
97
|
+
const runSeq = store.getRunSeqSnapshot(sessionId);
|
|
98
|
+
const hydrated = store.isHydrated(sessionId);
|
|
99
|
+
const again = () => {
|
|
100
|
+
if (attempts > 1) refetch(sessionId, attempts - 1);
|
|
101
|
+
else store.markRefetchDue(sessionId);
|
|
102
|
+
};
|
|
103
|
+
options.loadTail(sessionId).then((page) => {
|
|
104
|
+
settle();
|
|
105
|
+
if (store.isHydrated(sessionId) !== hydrated) return;
|
|
106
|
+
if (!hydrated && store.getHistoryPosSnapshot(sessionId) === void 0) return;
|
|
107
|
+
if (hydrated && store.getRunningSnapshot(sessionId)) {
|
|
108
|
+
store.markRefetchDue(sessionId);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (hydrated && store.getRunSeqSnapshot(sessionId) !== runSeq) return again();
|
|
112
|
+
if (!store.setEventsPage(sessionId, page)) again();
|
|
113
|
+
}).catch(() => {
|
|
114
|
+
settle();
|
|
115
|
+
}).finally(followUp);
|
|
116
|
+
};
|
|
71
117
|
const compactAfterRunEnd = (signal) => {
|
|
72
118
|
if (signal.kind !== "run:end") return;
|
|
73
119
|
const { sessionId } = signal;
|
|
120
|
+
if (store.takeRefetchDue(sessionId)) {
|
|
121
|
+
deferredCompact.delete(sessionId);
|
|
122
|
+
refetch(sessionId);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
74
125
|
if (!signal.ok) {
|
|
75
126
|
deferredCompact.delete(sessionId);
|
|
76
127
|
return;
|
|
@@ -110,6 +161,34 @@ function createSessionStreams(options = {}) {
|
|
|
110
161
|
store.applySignal(signal);
|
|
111
162
|
compactAfterRunEnd(signal);
|
|
112
163
|
},
|
|
164
|
+
applyHistory(sessionId, change) {
|
|
165
|
+
if (store.applyHistory(sessionId, change)) refetch(sessionId);
|
|
166
|
+
},
|
|
167
|
+
setEventsPage(sessionId, page) {
|
|
168
|
+
if (!store.setEventsPage(sessionId, page)) refetch(sessionId);
|
|
169
|
+
},
|
|
170
|
+
resync(sessionId) {
|
|
171
|
+
if (!store.isHydrated(sessionId)) {
|
|
172
|
+
options.loadTail?.(sessionId).then((page) => {
|
|
173
|
+
if (!store.isHydrated(sessionId)) streams.setEventsPage(sessionId, page);
|
|
174
|
+
}).catch(() => void 0);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (store.isTailDue(sessionId)) return refetch(sessionId);
|
|
178
|
+
const pos = store.getHistoryPosSnapshot(sessionId);
|
|
179
|
+
const historyId = store.getHistoryIdSnapshot(sessionId);
|
|
180
|
+
const loadSince = options.loadSince;
|
|
181
|
+
climbReconnectLadder({
|
|
182
|
+
sessionId,
|
|
183
|
+
...pos !== void 0 && historyId !== void 0 ? {
|
|
184
|
+
pos,
|
|
185
|
+
historyId
|
|
186
|
+
} : {}
|
|
187
|
+
}, loadSince ? { since: (afterPos, id) => loadSince(sessionId, afterPos, id) } : {}).then((outcome) => {
|
|
188
|
+
if (outcome.via !== "since") return refetch(sessionId);
|
|
189
|
+
if (store.applyHistorySince(sessionId, outcome.since)) refetch(sessionId);
|
|
190
|
+
}).catch(() => refetch(sessionId));
|
|
191
|
+
},
|
|
113
192
|
transcript(sessionId) {
|
|
114
193
|
let transcript = transcripts.get(sessionId);
|
|
115
194
|
if (!transcript) {
|
|
@@ -148,6 +227,7 @@ function createSessionStreams(options = {}) {
|
|
|
148
227
|
};
|
|
149
228
|
store.applyDrainPlan(planDrainBeforeSignal(buckets, signal));
|
|
150
229
|
store.applySignal(signal);
|
|
230
|
+
if (store.takeRefetchDue(sessionId)) refetch(sessionId);
|
|
151
231
|
},
|
|
152
232
|
loadEarlier(sessionId, opts) {
|
|
153
233
|
const page = store.getPageSnapshot(sessionId);
|
|
@@ -161,6 +241,12 @@ function createSessionStreams(options = {}) {
|
|
|
161
241
|
opts?.onSettled?.(false);
|
|
162
242
|
return;
|
|
163
243
|
}
|
|
244
|
+
if (!cursorValid(page.pos, older, page.historyId)) {
|
|
245
|
+
store.setLoadingEarlier(sessionId, false);
|
|
246
|
+
refetch(sessionId);
|
|
247
|
+
opts?.onSettled?.(false);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
164
250
|
store.prependEventsPage(sessionId, older);
|
|
165
251
|
opts?.onSettled?.(true);
|
|
166
252
|
}).catch(() => {
|