zidane-ui 9.1.5 → 9.1.9

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.
Files changed (235) hide show
  1. package/dist/adapters/run-host.js +17 -20
  2. package/dist/adapters/server-files-host.js +3 -1
  3. package/dist/adapters/server-host.js +18 -11
  4. package/dist/adapters/server-machines-host.js +3 -1
  5. package/dist/adapters/server-session-host.js +2 -1
  6. package/dist/adapters/server-settings-accounts.js +2 -1
  7. package/dist/adapters/server-settings-host.js +3 -3
  8. package/dist/adapters/sse-host.js +9 -7
  9. package/dist/chat/SessionGroupHeader.js +2 -2
  10. package/dist/chat/SessionHostHeader.js +1 -1
  11. package/dist/chat/StatusDot.js +24 -20
  12. package/dist/chat/composer/Composer.d.ts +13 -8
  13. package/dist/chat/composer/Composer.js +14 -10
  14. package/dist/chat/composer/HostComposer.d.ts +1 -1
  15. package/dist/chat/composer/HostComposer.js +7 -10
  16. package/dist/chat/composer/RunStatusChip.js +13 -1
  17. package/dist/chat/composer/attachment-ingest.d.ts +4 -1
  18. package/dist/chat/composer/attachment-ingest.js +27 -10
  19. package/dist/chat/composer/composer-bus.d.ts +9 -1
  20. package/dist/chat/composer/composer-bus.js +49 -6
  21. package/dist/chat/composer/index.d.ts +2 -2
  22. package/dist/chat/composer/index.js +2 -2
  23. package/dist/chat/composer/use-draft-target.d.ts +4 -0
  24. package/dist/chat/composer/use-draft-target.js +15 -4
  25. package/dist/chat/composer/use-send-prompt.d.ts +5 -1
  26. package/dist/chat/composer/use-send-prompt.js +2 -12
  27. package/dist/chat/headless/chip-labels.d.ts +2 -0
  28. package/dist/chat/headless/chip-labels.js +3 -1
  29. package/dist/chat/headless/composer/labels-editor.d.ts +2 -0
  30. package/dist/chat/headless/composer/labels-editor.js +2 -0
  31. package/dist/chat/headless/file-chip.d.ts +12 -13
  32. package/dist/chat/headless/file-chip.js +40 -2
  33. package/dist/chat/headless/fixture-host.js +14 -17
  34. package/dist/chat/headless/host.d.ts +24 -6
  35. package/dist/chat/headless/index.d.ts +5 -4
  36. package/dist/chat/headless/index.js +6 -5
  37. package/dist/chat/headless/labels.d.ts +16 -0
  38. package/dist/chat/headless/labels.js +15 -2
  39. package/dist/chat/headless/send-flow.d.ts +21 -4
  40. package/dist/chat/headless/send-flow.js +25 -6
  41. package/dist/chat/headless/session-list.d.ts +11 -0
  42. package/dist/chat/headless/sidebar/history.d.ts +71 -0
  43. package/dist/chat/headless/sidebar/history.js +174 -0
  44. package/dist/chat/headless/sidebar/index.d.ts +2 -1
  45. package/dist/chat/headless/sidebar/index.js +3 -2
  46. package/dist/chat/headless/sidebar/labels.d.ts +12 -1
  47. package/dist/chat/headless/transcript-host.d.ts +8 -1
  48. package/dist/chat/headless/transcript-labels.d.ts +2 -0
  49. package/dist/chat/index.d.ts +3 -3
  50. package/dist/chat/index.js +2 -2
  51. package/dist/chat/interactions/InboxPanel.js +2 -2
  52. package/dist/chat/interactions/QuestionField.js +2 -2
  53. package/dist/chat/rich-composer/RichComposer.d.ts +9 -2
  54. package/dist/chat/rich-composer/RichComposer.js +28 -7
  55. package/dist/chat/rich-composer/composer-extensions.d.ts +2 -0
  56. package/dist/chat/rich-composer/composer-extensions.js +2 -2
  57. package/dist/chat/rich-composer/composer-keys.js +1 -1
  58. package/dist/chat/rich-composer/use-composer-bus.js +2 -1
  59. package/dist/chat/rich-composer/use-composer-editor.d.ts +4 -1
  60. package/dist/chat/rich-composer/use-composer-editor.js +2 -1
  61. package/dist/chat/sidebar/SessionSidebar.js +1 -2
  62. package/dist/chat/sidebar/SidebarSearchRow.js +1 -1
  63. package/dist/chat/sidebar/useSidebarKeyboardNav.d.ts +0 -2
  64. package/dist/chat/sidebar/useSidebarKeyboardNav.js +7 -13
  65. package/dist/chat/testing/contract.d.ts +1 -1
  66. package/dist/chat/testing/contract.js +8 -7
  67. package/dist/chat/transcript/BadgeMenu.d.ts +12 -3
  68. package/dist/chat/transcript/BadgeMenu.js +20 -3
  69. package/dist/chat/transcript/CodemodeScript.js +147 -44
  70. package/dist/chat/transcript/EditDiffBlock.js +1 -4
  71. package/dist/chat/transcript/FileChip.js +60 -14
  72. package/dist/chat/transcript/LiveOutput.js +7 -3
  73. package/dist/chat/transcript/badges.js +2 -2
  74. package/dist/chat/transcript/index.d.ts +2 -2
  75. package/dist/chat/transcript/markdown-context.d.ts +4 -1
  76. package/dist/chat/transcript/rolling.d.ts +12 -0
  77. package/dist/chat/transcript/rolling.js +22 -0
  78. package/dist/chat/transcript/script-input.d.ts +1 -1
  79. package/dist/chat/transcript/shell-block.js +70 -60
  80. package/dist/chat/transcript/tool-row.js +21 -5
  81. package/dist/code/editor/FileTree.d.ts +3 -1
  82. package/dist/code/editor/FileTree.js +29 -1
  83. package/dist/components/Restricted.d.ts +25 -0
  84. package/dist/components/Restricted.js +32 -0
  85. package/dist/components/StepFrame.d.ts +1 -1
  86. package/dist/components/ZidaneMark.d.ts +28 -0
  87. package/dist/components/ZidaneMark.js +114 -0
  88. package/dist/components/palette/PalettePanel.d.ts +7 -1
  89. package/dist/components/palette/PalettePanel.js +37 -11
  90. package/dist/components/zidane-mark.d.ts +52 -0
  91. package/dist/components/zidane-mark.js +94 -0
  92. package/dist/core.css +59 -6
  93. package/dist/dist/{index-BI6RZc60.d.ts → index-Bq87OcGy.d.ts} +19 -12
  94. package/dist/dist/index.d.ts +1 -1
  95. package/dist/extensions/ExtensionSettingsSection.d.ts +18 -0
  96. package/dist/extensions/ExtensionSettingsSection.js +227 -0
  97. package/dist/extensions/headless/host.d.ts +1 -1
  98. package/dist/extensions/headless/labels.d.ts +41 -1
  99. package/dist/extensions/headless/labels.js +57 -0
  100. package/dist/extensions/headless/select.js +1 -2
  101. package/dist/extensions/index.d.ts +2 -1
  102. package/dist/extensions/index.js +2 -1
  103. package/dist/files/FilesTab.js +2 -0
  104. package/dist/files/TreeColumn.d.ts +5 -1
  105. package/dist/files/TreeColumn.js +6 -0
  106. package/dist/files/headless/fixture-host.js +5 -3
  107. package/dist/files/headless/host.d.ts +24 -6
  108. package/dist/files/headless/index.d.ts +2 -2
  109. package/dist/files/headless/labels.d.ts +1 -0
  110. package/dist/files/headless/labels.js +1 -0
  111. package/dist/files/testing/contract.js +9 -2
  112. package/dist/files/useWorkspace.d.ts +14 -2
  113. package/dist/files/useWorkspace.js +87 -9
  114. package/dist/git/BranchMenu.js +1 -1
  115. package/dist/git/MoveSessionDialog.js +1 -1
  116. package/dist/git/RemoteFolderPicker.js +1 -1
  117. package/dist/git/WherePicker.js +1 -1
  118. package/dist/git/headless/index.js +1 -1
  119. package/dist/git/useEnvironmentChoices.js +1 -1
  120. package/dist/index.d.ts +4 -2
  121. package/dist/index.js +4 -2
  122. package/dist/keybindings/headless/catalog.d.ts +1 -1
  123. package/dist/keybindings/headless/catalog.js +13 -1
  124. package/dist/keybindings/headless/key-scope.d.ts +4 -2
  125. package/dist/keybindings/headless/key-scope.js +17 -2
  126. package/dist/labels.d.ts +1 -0
  127. package/dist/labels.js +1 -0
  128. package/dist/machines/DaemonMenu.js +1 -1
  129. package/dist/machines/HostCapabilities.d.ts +23 -1
  130. package/dist/machines/HostCapabilities.js +149 -65
  131. package/dist/machines/HostSyncPanel.js +129 -123
  132. package/dist/machines/HostsSection.js +5 -1
  133. package/dist/machines/ServerCard.d.ts +4 -2
  134. package/dist/machines/ServerCard.js +222 -99
  135. package/dist/machines/ServerMachinesPanel.js +16 -13
  136. package/dist/machines/ServerUpdatePanel.js +31 -21
  137. package/dist/machines/TokensPanel.js +75 -53
  138. package/dist/machines/headless/fixture-host.d.ts +5 -0
  139. package/dist/machines/headless/fixture-host.js +13 -4
  140. package/dist/machines/headless/fixtures.js +1 -1
  141. package/dist/machines/headless/host.d.ts +22 -2
  142. package/dist/machines/headless/index.d.ts +2 -2
  143. package/dist/machines/headless/labels.d.ts +22 -1
  144. package/dist/machines/headless/labels.js +22 -2
  145. package/dist/machines/testing/contract.d.ts +3 -1
  146. package/dist/machines/testing/contract.js +9 -0
  147. package/dist/motion/size.d.ts +22 -1
  148. package/dist/motion/size.js +82 -4
  149. package/dist/onboarding/demos/delivery.d.ts +16 -0
  150. package/dist/onboarding/demos/delivery.js +132 -0
  151. package/dist/onboarding/demos/index.d.ts +2 -1
  152. package/dist/onboarding/demos/index.js +2 -1
  153. package/dist/onboarding/headless/labels.d.ts +8 -0
  154. package/dist/onboarding/headless/labels.js +7 -0
  155. package/dist/onboarding/index.d.ts +2 -1
  156. package/dist/onboarding/index.js +2 -1
  157. package/dist/onboarding/steps/ConversationStep.js +46 -4
  158. package/dist/palette/CommandPalette.js +3 -0
  159. package/dist/palette/PaletteDialog.js +7 -3
  160. package/dist/palette/headless/app-sources.js +10 -0
  161. package/dist/palette/headless/labels.js +2 -0
  162. package/dist/palette/usePaletteController.d.ts +10 -0
  163. package/dist/palette/usePaletteController.js +25 -3
  164. package/dist/server/sse-handler.js +6 -1
  165. package/dist/session/ArtifactsPanel.js +1 -1
  166. package/dist/session/PlanTracker.js +1 -0
  167. package/dist/session/SideChat.js +1 -2
  168. package/dist/session/UsagePanel.js +1 -1
  169. package/dist/session/headless/host.d.ts +3 -1
  170. package/dist/session/headless/index.js +2 -2
  171. package/dist/settings/SettingsRestricted.d.ts +25 -0
  172. package/dist/settings/SettingsRestricted.js +44 -0
  173. package/dist/settings/SettingsRowsPage.js +31 -37
  174. package/dist/settings/headless/catalog.js +7 -6
  175. package/dist/settings/headless/labels.d.ts +4 -2
  176. package/dist/settings/headless/labels.js +4 -2
  177. package/dist/settings/headless/layout.js +1 -1
  178. package/dist/settings/headless/providers.d.ts +2 -0
  179. package/dist/settings/headless/search.d.ts +1 -1
  180. package/dist/settings/index.d.ts +2 -2
  181. package/dist/settings/index.js +2 -2
  182. package/dist/settings/rows.d.ts +51 -8
  183. package/dist/settings/rows.js +81 -26
  184. package/dist/settings/sections/enabled-list/EnabledListSection.js +3 -2
  185. package/dist/settings/sections/environments/EnvironmentsSection.js +4 -3
  186. package/dist/settings/sections/extensions/ExtensionConfigRows.d.ts +2 -2
  187. package/dist/settings/sections/extensions/ExtensionConfigRows.js +22 -25
  188. package/dist/settings/sections/extensions/ExtensionOptionsSection.js +3 -2
  189. package/dist/settings/sections/extensions/options-labels.d.ts +2 -2
  190. package/dist/settings/sections/extensions/options-labels.js +2 -2
  191. package/dist/settings/sections/host-catalog/HostCatalogSection.d.ts +5 -3
  192. package/dist/settings/sections/host-catalog/HostCatalogSection.js +7 -4
  193. package/dist/settings/sections/instructions/InstructionsSection.js +24 -17
  194. package/dist/settings/sections/keybindings/labels.d.ts +2 -0
  195. package/dist/settings/sections/keybindings/labels.js +2 -0
  196. package/dist/settings/sections/keybindings/rows.js +8 -0
  197. package/dist/settings/sections/logs/LogsSection.d.ts +2 -1
  198. package/dist/settings/sections/logs/LogsSection.js +64 -56
  199. package/dist/settings/sections/mcp/McpSection.d.ts +1 -1
  200. package/dist/settings/sections/mcp/McpSection.js +18 -17
  201. package/dist/settings/sections/models/ModelRows.d.ts +3 -3
  202. package/dist/settings/sections/models/ModelRows.js +8 -7
  203. package/dist/settings/sections/performance/PerformanceSection.js +13 -4
  204. package/dist/settings/sections/performance/labels.d.ts +0 -1
  205. package/dist/settings/sections/performance/labels.js +0 -1
  206. package/dist/settings/sections/providers/CredentialSources.js +18 -8
  207. package/dist/settings/sections/providers/ProvidersSection.d.ts +2 -2
  208. package/dist/settings/sections/providers/ProvidersSection.js +20 -17
  209. package/dist/settings/sections/providers/ServerProvidersSection.d.ts +1 -1
  210. package/dist/settings/sections/providers/ServerProvidersSection.js +10 -14
  211. package/dist/settings/sections/shared/catalog.js +3 -2
  212. package/dist/settings/sections/skills/SkillList.js +4 -3
  213. package/dist/settings/testing/accounts-demo.js +1 -0
  214. package/dist/settings/testing/accounts.contract.js +2 -0
  215. package/dist/styles.css +160 -24
  216. package/dist/terminal/HostTerminalSurface.js +1 -1
  217. package/dist/terminal/headless/links.d.ts +19 -1
  218. package/dist/terminal/headless/links.js +26 -2
  219. package/dist/theme/css-vars.js +1 -0
  220. package/dist/theme/derive.d.ts +4 -0
  221. package/dist/theme/derive.js +2 -0
  222. package/dist/workspace/PanelContentView.js +1 -1
  223. package/dist/workspace/PanelHome.d.ts +3 -1
  224. package/dist/workspace/PanelHome.js +4 -3
  225. package/dist/workspace/SidePanel.d.ts +3 -1
  226. package/dist/workspace/SidePanel.js +3 -2
  227. package/dist/workspace/headless/open-target.d.ts +1 -1
  228. package/dist/workspace/headless/open-target.js +2 -2
  229. package/package.json +2 -2
  230. package/src/styles/chat.css +10 -10
  231. package/src/styles/motion.css +37 -0
  232. package/src/styles/primitives.css +11 -3
  233. package/src/styles/sidebar.css +12 -0
  234. package/src/styles/tokens.css +6 -0
  235. package/src/styles/transcript.css +69 -5
@@ -6,6 +6,7 @@ import { mergeLiveTail } from "./streams/merge.js";
6
6
  import { mergePromptPreviews, missingPreviewData } from "./streams/prompt-previews.js";
7
7
  import { defaultFrameScheduler } from "./streams/scheduler.js";
8
8
  import { SessionStreamStore } from "./streams/store.js";
9
+ import { NO_PROVIDER_ERROR, newSessionRequest, promptAttachments, promptRefs, sendPrompt, shellCommandOf, wireOriginal } from "./send-flow.js";
9
10
  import { LIVE_BLOCK_RUN_LINES, createChatBlockRuns } from "./block-runs.js";
10
11
  import { DEFAULT_MODEL_PICKER_PREFS, MODEL_PICKER_STORAGE_KEY, createModelPickerPrefs, parseModelPickerPrefs } from "./composer/model-picker-prefs.js";
11
12
  import { EMPTY_RUN_METER, createRunMeter } from "./composer/run-meter.js";
@@ -14,7 +15,7 @@ import { DEFAULT_COMPOSER_CHROME_LABELS } from "./composer/labels-chrome.js";
14
15
  import { DEFAULT_COMPOSER_LABELS } from "./composer/labels.js";
15
16
  import { DEFAULT_CHAT_LABELS, secretExpiryWords } from "./labels.js";
16
17
  import { commandRef, shortUrl, urlRefs } from "./badge-refs.js";
17
- import { chipForPath, classifyInlineCode, resolveChipPath } from "./file-chip.js";
18
+ import { chipForPath, classifyInlineCode, positionSuffix, resolveChipPath } from "./file-chip.js";
18
19
  import { createSiteIcons, siteOrigin } from "./site-icons.js";
19
20
  import { PROJECT_GROUP_CAP, RELATIVE_TIME_DATE_AFTER_DAYS, buildSessionRows, compareSessions, dateBucket, filterSessions, formatElapsedShort, relativeTime } from "./session-list.js";
20
21
  import { commandName, commandView, commitView, sessionForToken, sessionView, skillName, skillView } from "./chip-views.js";
@@ -41,16 +42,14 @@ import { createModelNames, modelNamesOf, namerFor } from "./composer/model-names
41
42
  import { commitModelPick, lastModelChainOf, rememberableChain, rememberedPick, settledResource } from "./composer/remember-model-pick.js";
42
43
  import { MAX_EXTENSION_COMPOSER_BADGES, conversationBadges, resolveBadgePanel } from "./composer/conversation-badges.js";
43
44
  import { draftFolderPath, draftLocalFolder, recentHostFolders, recentLocalFolders } from "./draft-target.js";
44
- import { NO_PROVIDER_ERROR, newSessionRequest, promptAttachments, promptRefs, sendPrompt, shellCommandOf } from "./send-flow.js";
45
45
  import { defaultModelPatch, effortPickerTarget, rememberedDefaultModel } from "./composer/new-session-defaults.js";
46
46
  import { secretTimeLeft, secretTimeLeftIso } from "./secrets.js";
47
47
  import { wireAttachmentsToChat } from "./composer/draft-sync.js";
48
48
  import { promptDraftOf } from "./turn-prompt.js";
49
+ import { pinSession, pinnedSessions } from "./sidebar/pinned-sessions.js";
49
50
  import { COMMON_EMOJI, MAIN_SESSION_ICON_KEY, PROJECT_ICONS_KEY, firstGrapheme, isProjectIcon, parseProjectIcons } from "./sidebar/project-icons.js";
50
51
  import { DEFAULT_SIDEBAR_LABELS } from "./sidebar/labels.js";
51
- import { pinSession, pinnedSessions } from "./sidebar/pinned-sessions.js";
52
52
  import { caretEffectivelyAtStart, composeSubmitText, decodeHistoryEntry, encodeHistoryDraft, exitsModeOnKey, modeForTypedChar, unsentDraft } from "./composer-modes.js";
53
- import { createComposerLists } from "./composer/composer-sources.js";
54
53
  import { createDraftScopeStore, draftScopeOf } from "./draft-scope.js";
55
54
  import { VIEW_CHOICE } from "./sidebar/types.js";
56
55
  import { CHATS_BUCKET, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, groupsByFolder, isProjectMember, itemRows, nestSidebarRows, partitionMainSession, projectPathOf, repoGroups } from "./sidebar/rows.js";
@@ -59,9 +58,11 @@ import { activityLabel, createSessionActivity, reduceActivity } from "./sidebar/
59
58
  import { createCompactionProgress, reduceCompaction } from "./sidebar/compaction.js";
60
59
  import { createSessionBadges } from "./sidebar/badges.js";
61
60
  import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./sidebar/view.js";
61
+ import { SESSION_HISTORY_LIMIT, createSessionHistory, parseSessionHistory } from "./sidebar/history.js";
62
62
  import { createNotificationStore } from "./sidebar/notifications.js";
63
63
  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 "./sidebar/query.js";
64
64
  import { availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./sidebar/directory.js";
65
65
  import { deriveDotState } from "./sidebar/dot-state.js";
66
66
  import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./sidebar/environment.js";
67
- export { AGENT_GROUPING, CHATS_BUCKET, CHUNK_THRESHOLD, COMMON_EMOJI, DEFAULT_CHAT_LABELS, DEFAULT_COMPOSER_CHROME_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_MODEL_PICKER_PREFS, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, EMPTY_RUN_METER, LIVE_BLOCK_RUN_LINES, MAIN_SESSION_ICON_KEY, MAX_EXTENSION_COMPOSER_BADGES, MAX_ROW_CHIPS, MODEL_PICKER_STORAGE_KEY, NO_PROVIDER_ERROR, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_GROUP_CAP, PROJECT_ICONS_KEY, REFERENCES_STORAGE_KEY, RELATIVE_TIME_DATE_AFTER_DAYS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SMOOTH_TICK_MS, SessionStreamStore, VIEW_CHOICE, activityLabel, authFailureDetails, availableProjectsOf, batchThinkingRuns, batchToolRuns, beginChipWork, buildHostSidebarRows, buildQuerySidebarRows, buildSessionRows, buildSidebarRows, caretEffectivelyAtStart, chipForPath, chipWorkBusy, claimChildSessions, classifyInlineCode, clearedViewFilters, clusterByOwner, collapseEvents, commandName, commandRef, commandView, commitModelPick, commitView, compareSessions, composeLiveCost, composeSubmitText, computeSelectStops, constant, conversationBadges, createAuthFixes, createChatBlockRuns, createCompactionProgress, createComposerLists, createDecorator, createDraftScopeStore, createModelKnobs, createModelNames, createModelPickerPrefs, createNotificationStore, createPathResolver, createReferenceStore, createRunEstimates, createRunMeter, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionStreamActions, createSessionStreams, createSidebarViews, createSiteIcons, dateBucket, decodeHistoryEntry, defaultFrameScheduler, defaultModelPatch, deleteSessionPrompt, deriveDotState, dockRunReceipts, dotVariantFor, draftFolderPath, draftLocalFolder, draftScopeOf, drainBucket, effortPickerTarget, encodeHistoryDraft, environmentKindLabel, environmentSummaryText, exitsModeOnKey, extensionSpaceOf, failureTooltip, filterDirectorySessions, filterQueryOf, filterSessions, filtersForSpace, findCommand, findLastStreamingRow, firstGrapheme, firstRowId, foldActionItems, foldExchanges, foldWorkerRows, formatElapsedShort, formatSessionCostLabel, groupsByFolder, hostReachable, hostStatusLabel, inheritRowIdentity, isAuthFixed, isProjectIcon, isProjectMember, itemRows, itemsForSpace, lastModelChainOf, markRunFailures, mergeLiveTail, mergePromptPreviews, mergeSidebarSpaces, missingPreviewData, modeForTypedChar, modelKnobsOf, modelNamesOf, namerFor, nestSidebarRows, nestToolCalls, nestedCallVisible, newSessionRequest, nextSavedViewName, openFenceOf, pairToolEvents, parseBashExitMeta, parseModelPickerPrefs, parsePinnedProjects, parseProjectIcons, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, planAuthCard, projectKeyOf, projectPathOf, promptAttachments, promptDraftOf, promptRefs, readSidebarViews, recentHostFolders, recentLocalFolders, reduceActivity, reduceCompaction, refusedSpawn, relativeTime, rememberableChain, rememberedDefaultModel, rememberedPick, repoGroups, resetChipWorkForTests, resolveBadgePanel, resolveChipPath, resolveGrouping, resolveSort, rowTurnIds, runsInRemoteSandbox, safeSurrogateSlice, secretExpiryWords, secretTimeLeft, secretTimeLeftIso, selectEditEvents, sendPrompt, sessionForToken, sessionRefsOf, sessionView, settledResource, shellCommandOf, shortUrl, sidebarContributionsOf, siteOrigin, skillName, skillView, spaceMembership, splitMarkdown, stableSelection, stopForRow, switcherSpaces, tickBucket, toolAction, toolFailed, unsentDraft, urlRefs, useReadable, viewFilterOf, viewFiltersOn, whenChipsSettle, wireAttachmentsToChat, withPinnedProject, withoutPartialFence, writable };
67
+ import { createComposerLists } from "./composer/composer-sources.js";
68
+ export { AGENT_GROUPING, CHATS_BUCKET, CHUNK_THRESHOLD, COMMON_EMOJI, DEFAULT_CHAT_LABELS, DEFAULT_COMPOSER_CHROME_LABELS, DEFAULT_COMPOSER_LABELS, DEFAULT_MODEL_PICKER_PREFS, DEFAULT_SIDEBAR_LABELS, DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, EMPTY_RUN_METER, LIVE_BLOCK_RUN_LINES, MAIN_SESSION_ICON_KEY, MAX_EXTENSION_COMPOSER_BADGES, MAX_ROW_CHIPS, MODEL_PICKER_STORAGE_KEY, NO_PROVIDER_ERROR, NO_SIDEBAR_CONTRIBUTIONS, PINNED_PROJECTS_KEY, PROJECT_GROUP_CAP, PROJECT_ICONS_KEY, REFERENCES_STORAGE_KEY, RELATIVE_TIME_DATE_AFTER_DAYS, SESSION_HISTORY_LIMIT, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SMOOTH_TICK_MS, SessionStreamStore, VIEW_CHOICE, activityLabel, authFailureDetails, availableProjectsOf, batchThinkingRuns, batchToolRuns, beginChipWork, buildHostSidebarRows, buildQuerySidebarRows, buildSessionRows, buildSidebarRows, caretEffectivelyAtStart, chipForPath, chipWorkBusy, claimChildSessions, classifyInlineCode, clearedViewFilters, clusterByOwner, collapseEvents, commandName, commandRef, commandView, commitModelPick, commitView, compareSessions, composeLiveCost, composeSubmitText, computeSelectStops, constant, conversationBadges, createAuthFixes, createChatBlockRuns, createCompactionProgress, createComposerLists, createDecorator, createDraftScopeStore, createModelKnobs, createModelNames, createModelPickerPrefs, createNotificationStore, createPathResolver, createReferenceStore, createRunEstimates, createRunMeter, createSessionActivity, createSessionBadges, createSessionDirectory, createSessionHistory, createSessionStreamActions, createSessionStreams, createSidebarViews, createSiteIcons, dateBucket, decodeHistoryEntry, defaultFrameScheduler, defaultModelPatch, deleteSessionPrompt, deriveDotState, dockRunReceipts, dotVariantFor, draftFolderPath, draftLocalFolder, draftScopeOf, drainBucket, effortPickerTarget, encodeHistoryDraft, environmentKindLabel, environmentSummaryText, exitsModeOnKey, extensionSpaceOf, failureTooltip, filterDirectorySessions, filterQueryOf, filterSessions, filtersForSpace, findCommand, findLastStreamingRow, firstGrapheme, firstRowId, foldActionItems, foldExchanges, foldWorkerRows, formatElapsedShort, formatSessionCostLabel, groupsByFolder, hostReachable, hostStatusLabel, inheritRowIdentity, isAuthFixed, isProjectIcon, isProjectMember, itemRows, itemsForSpace, lastModelChainOf, markRunFailures, mergeLiveTail, mergePromptPreviews, mergeSidebarSpaces, missingPreviewData, modeForTypedChar, modelKnobsOf, modelNamesOf, namerFor, nestSidebarRows, nestToolCalls, nestedCallVisible, newSessionRequest, nextSavedViewName, openFenceOf, pairToolEvents, parseBashExitMeta, parseModelPickerPrefs, parsePinnedProjects, parseProjectIcons, parseSessionHistory, parseSidebarView, parseSwitcherPrefs, partitionMainSession, pickRunEstimate, pinSession, pinnedSessions, planAuthCard, positionSuffix, projectKeyOf, projectPathOf, promptAttachments, promptDraftOf, promptRefs, readSidebarViews, recentHostFolders, recentLocalFolders, reduceActivity, reduceCompaction, refusedSpawn, relativeTime, rememberableChain, rememberedDefaultModel, rememberedPick, repoGroups, resetChipWorkForTests, resolveBadgePanel, resolveChipPath, resolveGrouping, resolveSort, rowTurnIds, runsInRemoteSandbox, safeSurrogateSlice, secretExpiryWords, secretTimeLeft, secretTimeLeftIso, selectEditEvents, sendPrompt, sessionForToken, sessionRefsOf, sessionView, settledResource, shellCommandOf, shortUrl, sidebarContributionsOf, siteOrigin, skillName, skillView, spaceMembership, splitMarkdown, stableSelection, stopForRow, switcherSpaces, tickBucket, toolAction, toolFailed, unsentDraft, urlRefs, useReadable, viewFilterOf, viewFiltersOn, whenChipsSettle, wireAttachmentsToChat, wireOriginal, withPinnedProject, withoutPartialFence, writable };
@@ -133,6 +133,17 @@ declare const DEFAULT_CHAT_LABELS: {
133
133
  scriptCallsDone: (done: number) => string;
134
134
  scriptCallsRunning: (running: number) => string;
135
135
  scriptCallsFailed: (failed: number) => string;
136
+ /** The mark of the line a loop starts on. */
137
+ scriptLoop: string;
138
+ /** After the line a loop starts on: the round it is on, then how many it ran. */
139
+ scriptLoopRound: (round: number) => string;
140
+ scriptLoopRounds: (rounds: number) => string;
141
+ /** After the line an array method's callback starts on (`.map`): how many times it ran. */
142
+ scriptLoopRuns: (runs: number) => string;
143
+ /** After a line that made more than one call. */
144
+ scriptLineCalls: (calls: number) => string;
145
+ /** After a line that waits (`sleep`): the time left. */
146
+ scriptWaitLeft: (seconds: number) => string;
136
147
  /** Accessible name of the script's progress bar. */
137
148
  scriptProgress: string;
138
149
  openNamedSession: (title: string) => string;
@@ -207,6 +218,8 @@ declare const DEFAULT_CHAT_LABELS: {
207
218
  loadingEarlierHistory: string;
208
219
  composerLabel: string;
209
220
  composerPlaceholder: string;
221
+ composerPlaceholderSteer: string;
222
+ composerPlaceholderQueue: string;
210
223
  sendMessage: string;
211
224
  sendHint: string;
212
225
  stopRun: string;
@@ -465,6 +478,8 @@ declare const DEFAULT_CHAT_LABELS: {
465
478
  badgePathUnavailable: string;
466
479
  badgeNoComposer: string;
467
480
  badgeCopied: string;
481
+ badgeOpenIn: (app: string) => string;
482
+ badgeOpenInBrowserPane: string;
468
483
  findInConversation: string;
469
484
  findInConversationClose: string;
470
485
  turnMenuCopySelection: string;
@@ -526,6 +541,7 @@ declare const DEFAULT_CHAT_LABELS: {
526
541
  paletteChoose: string;
527
542
  paletteTurnOn: string;
528
543
  paletteTurnOff: string;
544
+ paletteScopeHint: string;
529
545
  editorConflict: string;
530
546
  editorConflictDetail: string;
531
547
  editorReload: string;
@@ -167,6 +167,17 @@ const DEFAULT_CHAT_LABELS = {
167
167
  scriptCallsDone: (done) => `${done} done`,
168
168
  scriptCallsRunning: (running) => `${running} running`,
169
169
  scriptCallsFailed: (failed) => `${failed} failed`,
170
+ /** The mark of the line a loop starts on. */
171
+ scriptLoop: "Loop",
172
+ /** After the line a loop starts on: the round it is on, then how many it ran. */
173
+ scriptLoopRound: (round) => `round ${round}`,
174
+ scriptLoopRounds: (rounds) => `${rounds} round${rounds === 1 ? "" : "s"}`,
175
+ /** After the line an array method's callback starts on (`.map`): how many times it ran. */
176
+ scriptLoopRuns: (runs) => `${runs} run${runs === 1 ? "" : "s"}`,
177
+ /** After a line that made more than one call. */
178
+ scriptLineCalls: (calls) => `×${calls}`,
179
+ /** After a line that waits (`sleep`): the time left. */
180
+ scriptWaitLeft: (seconds) => `${seconds}s left`,
170
181
  /** Accessible name of the script's progress bar. */
171
182
  scriptProgress: "Script progress",
172
183
  openNamedSession: (title) => `Open ${title}`,
@@ -241,14 +252,16 @@ const DEFAULT_CHAT_LABELS = {
241
252
  loadingEarlierHistory: "Loading earlier history…",
242
253
  composerLabel: "Message",
243
254
  composerPlaceholder: "Message the agent…",
255
+ composerPlaceholderSteer: "Enter adds it to the run. Alt+Enter sends it when the run ends.",
256
+ composerPlaceholderQueue: "Enter sends it when the run ends. Alt+Enter adds it to the run.",
244
257
  sendMessage: "Send message",
245
258
  sendHint: "Send (Enter)",
246
259
  stopRun: "Stop",
247
260
  stopHint: "Stop the run (Esc)",
248
261
  steerMessage: "Steer the run",
249
- steerHint: "Add to the running turn (Enter)",
262
+ steerHint: "Add to the run (Enter). Alt+Enter sends it when the run ends.",
250
263
  queueMessage: "Queue message",
251
- queueHint: "Send when the run ends (Enter)",
264
+ queueHint: "Send when the run ends (Enter). Alt+Enter adds it to the run.",
252
265
  attachFile: "Attach file",
253
266
  removeAttachment: (name) => `Remove ${name}`,
254
267
  attachments: "Attachments",
@@ -1,8 +1,8 @@
1
- import { ChatAttachment, ChatHost } from "./host.js";
1
+ import { ChatAttachment, ChatAttachmentOriginal, ChatHost } from "./host.js";
2
2
  import { QueueAddOptions } from "../../session/headless/host.js";
3
3
  import { DraftEnvironment } from "../../git/headless/environment.js";
4
4
  import { PromptSegmentRef } from "zidane/chat/pure";
5
- import { EnvironmentDescriptor, EnvironmentRequest } from "zidane/chat";
5
+ import { EnvironmentDescriptor, EnvironmentRequest, MessageDelivery } from "zidane/chat";
6
6
  //#region src/chat/headless/send-flow.d.ts
7
7
  /** An attachment as the composer staged it: `dataUrl` is the paste, drop or picker URL. */
8
8
  interface SendAttachment {
@@ -14,6 +14,8 @@ interface SendAttachment {
14
14
  name: string;
15
15
  /** Size in bytes. */
16
16
  size: number;
17
+ /** The file as picked, when the composer converted it ({@link ChatAttachment.original}). */
18
+ original?: ChatAttachmentOriginal;
17
19
  }
18
20
  /** A prompt attachment on the wire: raw base64, no `data:` prefix. */
19
21
  interface SendPromptAttachment {
@@ -23,6 +25,12 @@ interface SendPromptAttachment {
23
25
  data: string;
24
26
  /** File name. */
25
27
  name: string;
28
+ /** The file as picked, when `data` is a converted copy: the host saves these bytes. */
29
+ original?: {
30
+ mediaType: string;
31
+ data: string;
32
+ name: string;
33
+ };
26
34
  }
27
35
  /**
28
36
  * The prompt's chips, for its echo: `/<skill>` tokens naming an activated
@@ -41,6 +49,13 @@ declare function promptRefs(text: string, activatedSkills: readonly string[]): P
41
49
  * @param attachments - The staged attachments.
42
50
  */
43
51
  declare function promptAttachments(attachments: readonly SendAttachment[]): SendPromptAttachment[];
52
+ /**
53
+ * A converted attachment's original as the wire carries it, or `undefined`
54
+ * when there is none (or its URL is not a base64 data URL).
55
+ *
56
+ * @param original - The staged attachment's `original`.
57
+ */
58
+ declare function wireOriginal(original: ChatAttachmentOriginal | undefined): SendPromptAttachment['original'];
44
59
  /**
45
60
  * The command of a `!` prompt (the TUI's `parseBashInvocation`), `''` for
46
61
  * any other prompt or a blank command.
@@ -128,8 +143,10 @@ interface SendRequest {
128
143
  activatedSkills?: readonly string[];
129
144
  /** Sent from outside the composer: the shared draft stays. */
130
145
  keepDraft?: boolean;
131
- /** A run is in flight: the prompt is queued. */
146
+ /** A run is in flight: the prompt goes through the queue, into the run or held (`delivery`). */
132
147
  running: boolean;
148
+ /** While a run works: steer the prompt into it, or queue it. Absent: the host's setting. */
149
+ delivery?: MessageDelivery;
133
150
  /** The folder the prompt runs in (`''`: none), for the provider check and command lookup. */
134
151
  cwd: string;
135
152
  /** Runs on a server, on its credentials: no local provider check. */
@@ -184,4 +201,4 @@ declare const NO_PROVIDER_ERROR = "No provider is connected.";
184
201
  */
185
202
  declare function sendPrompt(request: SendRequest, deps: SendFlowDeps): Promise<void>;
186
203
  //#endregion
187
- export { NO_PROVIDER_ERROR, NewSessionDefaults, NewSessionRequest, SendAttachment, SendDraft, SendFlowDeps, SendPromptAttachment, SendRequest, newSessionRequest, promptAttachments, promptRefs, sendPrompt, shellCommandOf };
204
+ export { NO_PROVIDER_ERROR, NewSessionDefaults, NewSessionRequest, SendAttachment, SendDraft, SendFlowDeps, SendPromptAttachment, SendRequest, newSessionRequest, promptAttachments, promptRefs, sendPrompt, shellCommandOf, wireOriginal };
@@ -50,20 +50,38 @@ function promptRefs(text, activatedSkills) {
50
50
  function promptAttachments(attachments) {
51
51
  return attachments.flatMap((att) => {
52
52
  const match = /^data:([^;]+);base64,(.+)$/.exec(att.dataUrl);
53
- return match ? [{
53
+ if (!match) return [];
54
+ const original = wireOriginal(att.original);
55
+ return [{
54
56
  mediaType: match[1] ?? att.mediaType,
55
57
  data: match[2] ?? "",
56
- name: att.name
57
- }] : [];
58
+ name: att.name,
59
+ ...original ? { original } : {}
60
+ }];
58
61
  });
59
62
  }
63
+ /**
64
+ * A converted attachment's original as the wire carries it, or `undefined`
65
+ * when there is none (or its URL is not a base64 data URL).
66
+ *
67
+ * @param original - The staged attachment's `original`.
68
+ */
69
+ function wireOriginal(original) {
70
+ const match = original ? /^data:[^;]*;base64,(.+)$/.exec(original.dataUrl) : null;
71
+ return original && match ? {
72
+ mediaType: original.mediaType,
73
+ data: match[1] ?? "",
74
+ name: original.name
75
+ } : void 0;
76
+ }
60
77
  /** The previews a sent prompt keeps in memory (the transcript's `<img src>`). */
61
78
  function previewsOf(attachments) {
62
79
  return attachments.map((att) => ({
63
80
  name: att.name,
64
81
  mediaType: att.mediaType,
65
82
  size: att.size,
66
- dataUrl: att.dataUrl
83
+ dataUrl: att.dataUrl,
84
+ ...att.original ? { original: att.original } : {}
67
85
  }));
68
86
  }
69
87
  /**
@@ -172,7 +190,8 @@ async function sendPrompt(request, deps) {
172
190
  try {
173
191
  await deps.enqueue(sessionId, text, {
174
192
  activatedSkills: [...activatedSkills],
175
- attachments: promptAttachments(attachments)
193
+ attachments: promptAttachments(attachments),
194
+ ...request.delivery ? { delivery: request.delivery } : {}
176
195
  });
177
196
  } catch (err) {
178
197
  streams.dropPromptPreviews(sessionId, text);
@@ -195,4 +214,4 @@ async function sendPrompt(request, deps) {
195
214
  } catch {}
196
215
  }
197
216
  //#endregion
198
- export { NO_PROVIDER_ERROR, newSessionRequest, promptAttachments, promptRefs, sendPrompt, shellCommandOf };
217
+ export { NO_PROVIDER_ERROR, newSessionRequest, promptAttachments, promptRefs, sendPrompt, shellCommandOf, wireOriginal };
@@ -230,6 +230,12 @@ declare function dateBucket(at: number, now: number, labels?: {
230
230
  scriptCallsDone: (done: number) => string;
231
231
  scriptCallsRunning: (running: number) => string;
232
232
  scriptCallsFailed: (failed: number) => string;
233
+ scriptLoop: string;
234
+ scriptLoopRound: (round: number) => string;
235
+ scriptLoopRounds: (rounds: number) => string;
236
+ scriptLoopRuns: (runs: number) => string;
237
+ scriptLineCalls: (calls: number) => string;
238
+ scriptWaitLeft: (seconds: number) => string;
233
239
  scriptProgress: string;
234
240
  openNamedSession: (title: string) => string;
235
241
  diagram: (type: string | null) => string;
@@ -287,6 +293,8 @@ declare function dateBucket(at: number, now: number, labels?: {
287
293
  loadingEarlierHistory: string;
288
294
  composerLabel: string;
289
295
  composerPlaceholder: string;
296
+ composerPlaceholderSteer: string;
297
+ composerPlaceholderQueue: string;
290
298
  sendMessage: string;
291
299
  sendHint: string;
292
300
  stopRun: string;
@@ -541,6 +549,8 @@ declare function dateBucket(at: number, now: number, labels?: {
541
549
  badgePathUnavailable: string;
542
550
  badgeNoComposer: string;
543
551
  badgeCopied: string;
552
+ badgeOpenIn: (app: string) => string;
553
+ badgeOpenInBrowserPane: string;
544
554
  findInConversation: string;
545
555
  findInConversationClose: string;
546
556
  turnMenuCopySelection: string;
@@ -602,6 +612,7 @@ declare function dateBucket(at: number, now: number, labels?: {
602
612
  paletteChoose: string;
603
613
  paletteTurnOn: string;
604
614
  paletteTurnOff: string;
615
+ paletteScopeHint: string;
605
616
  editorConflict: string;
606
617
  editorConflictDetail: string;
607
618
  editorReload: string;
@@ -0,0 +1,71 @@
1
+ import { Readable } from "../store.js";
2
+ //#region src/chat/headless/sidebar/history.d.ts
3
+ /** A page of the history: a session, or `null` for the new-chat draft. */
4
+ type SessionHistoryPage<K extends string = string> = K | null;
5
+ /** The history as it is kept: its pages, oldest first, and the cursor. */
6
+ interface SessionHistoryState<K extends string = string> {
7
+ /** The pages, oldest first. */
8
+ entries: readonly SessionHistoryPage<K>[];
9
+ /** The cursor: the entry on show (`-1` while there is none). */
10
+ index: number;
11
+ }
12
+ /** Where the history persists (the desktop app: main's database). */
13
+ interface SessionHistoryStore {
14
+ /** The saved history, as stored (checked by {@link parseSessionHistory}). */
15
+ load(): Promise<unknown>;
16
+ /** Saves the history. */
17
+ save(state: SessionHistoryState): Promise<unknown>;
18
+ }
19
+ /** Which way to move. */
20
+ type SessionHistoryDirection = 'back' | 'forward';
21
+ /** The window's page history, outside React. */
22
+ interface SessionHistory<K extends string = string> {
23
+ /** The pages and the cursor. */
24
+ state: Readable<SessionHistoryState<K>>;
25
+ /** Records a page shown other than by {@link back} / {@link forward}. */
26
+ visit(page: SessionHistoryPage<K>): void;
27
+ /** The entry on show becomes `page` (no-op with no entry). */
28
+ replace(page: SessionHistoryPage<K>): void;
29
+ /**
30
+ * The page one step back or forward, or `undefined` when there is none. Reads only.
31
+ *
32
+ * @param direction - Which way.
33
+ * @param canOpen - Whether a session can open now; the draft always can.
34
+ */
35
+ peek(direction: SessionHistoryDirection, canOpen?: (id: K) => boolean): SessionHistoryPage<K> | undefined;
36
+ /** Moves the cursor back to the page {@link peek} finds and returns it (`undefined`: nowhere to go). */
37
+ back(canOpen?: (id: K) => boolean): SessionHistoryPage<K> | undefined;
38
+ /** Moves the cursor forward to the page {@link peek} finds and returns it (`undefined`: nowhere to go). */
39
+ forward(canOpen?: (id: K) => boolean): SessionHistoryPage<K> | undefined;
40
+ /** Removes a session from every entry (deleted). */
41
+ forget(id: K): void;
42
+ /** Reads the store once and merges it in (resolves at once without a store). */
43
+ load(): Promise<void>;
44
+ }
45
+ /** Options of {@link createSessionHistory}. */
46
+ interface SessionHistoryOptions {
47
+ /** Where the history persists; absent, it lasts as long as the window. */
48
+ store?: SessionHistoryStore;
49
+ /** The most entries kept (default {@link SESSION_HISTORY_LIMIT}). */
50
+ limit?: number;
51
+ /** A store read or write failed. */
52
+ onError?: (what: 'load' | 'save', error: unknown) => void;
53
+ }
54
+ /** The most entries a history keeps by default. */
55
+ declare const SESSION_HISTORY_LIMIT = 200;
56
+ /**
57
+ * A stored history, checked: entries are session keys (non-empty strings) or `null`, the cursor one of them.
58
+ * Anything malformed reads as no history.
59
+ *
60
+ * @param raw - The stored value.
61
+ * @param limit - The most entries kept.
62
+ */
63
+ declare function parseSessionHistory<K extends string = string>(raw: unknown, limit?: number): SessionHistoryState<K>;
64
+ /**
65
+ * The history store: in memory, persisted through `store` once {@link SessionHistory.load} has read it.
66
+ *
67
+ * @param options - The store, the cap and the error report.
68
+ */
69
+ declare function createSessionHistory<K extends string = string>(options?: SessionHistoryOptions): SessionHistory<K>;
70
+ //#endregion
71
+ export { SESSION_HISTORY_LIMIT, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, createSessionHistory, parseSessionHistory };
@@ -0,0 +1,174 @@
1
+ import { writable } from "../store.js";
2
+ //#region src/chat/headless/sidebar/history.ts
3
+ /**
4
+ * A window's page history: the conversations it showed, and the new-chat
5
+ * draft (`null`), in order, with a cursor, like a browser tab's back and
6
+ * forward list.
7
+ *
8
+ * - `visit`: a page shown any way but back / forward. The current page again
9
+ * does nothing; another drops the entries ahead of the cursor and is
10
+ * appended (past the cap, the oldest go).
11
+ * - `back` / `forward`: the nearest entry that opens now (`canOpen`) and is
12
+ * not the page on show. The cursor moves there and the page comes back for
13
+ * the caller to show; the entries passed over stay (a session not listed
14
+ * yet, or open in its own window, may open later).
15
+ * - `replace`: the current entry becomes another page (a draft that became a
16
+ * session is the same page, not a new one).
17
+ * - `forget`: a deleted session leaves; neighbours left equal merge.
18
+ * - Persistence (`store`): `load` reads the saved list once. The pages
19
+ * visited before it answered go after the saved cursor, replacing what was
20
+ * ahead of it; with none, the saved list is taken as it was. Every change
21
+ * after that is saved.
22
+ *
23
+ * Generic over the app's session key.
24
+ */
25
+ /** The most entries a history keeps by default. */
26
+ const SESSION_HISTORY_LIMIT = 200;
27
+ const EMPTY = {
28
+ entries: [],
29
+ index: -1
30
+ };
31
+ /**
32
+ * Merges neighbours that are the same page, keeping the cursor on the entry it was on.
33
+ *
34
+ * @param entries - The pages.
35
+ * @param index - The cursor.
36
+ */
37
+ function collapse(entries, index) {
38
+ const out = [];
39
+ let at = -1;
40
+ entries.forEach((page, i) => {
41
+ if (out.length === 0 || out[out.length - 1] !== page) out.push(page);
42
+ if (i === index) at = out.length - 1;
43
+ });
44
+ return {
45
+ entries: out,
46
+ index: out.length === 0 ? -1 : at === -1 ? out.length - 1 : at
47
+ };
48
+ }
49
+ /**
50
+ * Drops the oldest entries past `limit`.
51
+ *
52
+ * @param state - The history.
53
+ * @param limit - The most entries kept.
54
+ */
55
+ function trim(state, limit) {
56
+ const over = state.entries.length - limit;
57
+ if (over <= 0) return state;
58
+ return {
59
+ entries: state.entries.slice(over),
60
+ index: Math.max(0, state.index - over)
61
+ };
62
+ }
63
+ /**
64
+ * A stored history, checked: entries are session keys (non-empty strings) or `null`, the cursor one of them.
65
+ * Anything malformed reads as no history.
66
+ *
67
+ * @param raw - The stored value.
68
+ * @param limit - The most entries kept.
69
+ */
70
+ function parseSessionHistory(raw, limit = 200) {
71
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) return EMPTY;
72
+ const { entries, index } = raw;
73
+ if (!Array.isArray(entries) || entries.length === 0) return EMPTY;
74
+ if (!entries.every((page) => page === null || typeof page === "string" && page.length > 0)) return EMPTY;
75
+ return trim(collapse(entries, typeof index === "number" && Number.isInteger(index) ? Math.min(Math.max(index, 0), entries.length - 1) : entries.length - 1), limit);
76
+ }
77
+ /**
78
+ * The history store: in memory, persisted through `store` once {@link SessionHistory.load} has read it.
79
+ *
80
+ * @param options - The store, the cap and the error report.
81
+ */
82
+ function createSessionHistory(options = {}) {
83
+ const { store, onError } = options;
84
+ const limit = Math.max(1, options.limit ?? 200);
85
+ const state = writable(EMPTY);
86
+ let loaded = !store;
87
+ let loading = null;
88
+ const commit = (next) => {
89
+ const prev = state.get();
90
+ if (prev.index === next.index && prev.entries.length === next.entries.length && prev.entries.every((p, i) => p === next.entries[i])) return;
91
+ state.set(next);
92
+ if (loaded && store) store.save(next).catch((err) => onError?.("save", err));
93
+ };
94
+ const peekIndex = (direction, canOpen) => {
95
+ const { entries, index } = state.get();
96
+ const current = entries[index];
97
+ const step = direction === "back" ? -1 : 1;
98
+ for (let i = index + step; i >= 0 && i < entries.length; i += step) {
99
+ const page = entries[i];
100
+ if (page === current) continue;
101
+ if (page === null || !canOpen || canOpen(page)) return i;
102
+ }
103
+ return -1;
104
+ };
105
+ const go = (direction, canOpen) => {
106
+ const at = peekIndex(direction, canOpen);
107
+ if (at === -1) return void 0;
108
+ const { entries } = state.get();
109
+ commit({
110
+ entries,
111
+ index: at
112
+ });
113
+ return entries[at];
114
+ };
115
+ return {
116
+ state,
117
+ visit(page) {
118
+ const { entries, index } = state.get();
119
+ if (index !== -1 && entries[index] === page) return;
120
+ commit(trim({
121
+ entries: [...entries.slice(0, index + 1), page],
122
+ index: index + 1
123
+ }, limit));
124
+ },
125
+ replace(page) {
126
+ const { entries, index } = state.get();
127
+ if (index === -1 || entries[index] === page) return;
128
+ const next = [...entries];
129
+ next[index] = page;
130
+ commit(collapse(next, index));
131
+ },
132
+ peek(direction, canOpen) {
133
+ const at = peekIndex(direction, canOpen);
134
+ return at === -1 ? void 0 : state.get().entries[at];
135
+ },
136
+ back: (canOpen) => go("back", canOpen),
137
+ forward: (canOpen) => go("forward", canOpen),
138
+ forget(id) {
139
+ const { entries, index } = state.get();
140
+ if (!entries.includes(id)) return;
141
+ let at = index;
142
+ const kept = [];
143
+ entries.forEach((page, i) => {
144
+ if (page === id) {
145
+ if (i <= index) at -= 1;
146
+ return;
147
+ }
148
+ kept.push(page);
149
+ });
150
+ commit(collapse(kept, Math.max(0, Math.min(at, kept.length - 1))));
151
+ },
152
+ load() {
153
+ if (!store) return Promise.resolve();
154
+ loading ??= store.load().then((raw) => {
155
+ const saved = parseSessionHistory(raw, limit);
156
+ const own = state.get();
157
+ if (own.entries.length === 0) return saved;
158
+ const base = saved.entries.slice(0, saved.index + 1);
159
+ return trim(collapse([...base, ...own.entries], base.length + own.index), limit);
160
+ }).catch((err) => {
161
+ onError?.("load", err);
162
+ return null;
163
+ }).then((merged) => {
164
+ loaded = true;
165
+ if (merged) state.set(merged);
166
+ const now = state.get();
167
+ if (now.entries.length > 0) store.save(now).catch((err) => onError?.("save", err));
168
+ });
169
+ return loading;
170
+ }
171
+ };
172
+ }
173
+ //#endregion
174
+ export { SESSION_HISTORY_LIMIT, createSessionHistory, parseSessionHistory };
@@ -13,6 +13,7 @@ import { COMMON_EMOJI, MAIN_SESSION_ICON_KEY, PROJECT_ICONS_KEY, ProjectIcon, Pr
13
13
  import { SessionActivity, SessionActivitySignal, SessionActivityStore, activityLabel, createSessionActivity, reduceActivity } from "./activity.js";
14
14
  import { RunEstimatesRow, RunEstimatesSignal, RunEstimatesStore, createRunEstimates, pickRunEstimate } from "./estimates.js";
15
15
  import { CompactionProgress, CompactionProgressStore, CompactionSignal, createCompactionProgress, reduceCompaction } from "./compaction.js";
16
+ import { SESSION_HISTORY_LIMIT, SessionHistory, SessionHistoryDirection, SessionHistoryOptions, SessionHistoryPage, SessionHistoryState, SessionHistoryStore, createSessionHistory, parseSessionHistory } from "./history.js";
16
17
  import { DotStateInput, SidebarDotState, deriveDotState } from "./dot-state.js";
17
18
  import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
18
- 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, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, SessionActivity, SessionActivityFilter, SessionActivitySignal, SessionActivityStore, SessionArchiveFilter, SessionBadgesEntry, SessionBadgesSource, SessionBadgesStore, SessionDirectory, SessionDirectoryOptions, SessionDirectorySource, SessionDirectoryState, SessionDirectoryStreams, 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, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, 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, 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 };
@@ -1,7 +1,7 @@
1
1
  import { createRunEstimates, pickRunEstimate } from "./estimates.js";
2
+ import { pinSession, pinnedSessions } from "./pinned-sessions.js";
2
3
  import { COMMON_EMOJI, MAIN_SESSION_ICON_KEY, PROJECT_ICONS_KEY, firstGrapheme, isProjectIcon, parseProjectIcons } from "./project-icons.js";
3
4
  import { DEFAULT_SIDEBAR_LABELS } from "./labels.js";
4
- import { pinSession, pinnedSessions } from "./pinned-sessions.js";
5
5
  import { VIEW_CHOICE } from "./types.js";
6
6
  import { CHATS_BUCKET, buildHostSidebarRows, buildQuerySidebarRows, buildSidebarRows, groupsByFolder, isProjectMember, itemRows, nestSidebarRows, partitionMainSession, projectPathOf, repoGroups } from "./rows.js";
7
7
  import { PINNED_PROJECTS_KEY, parsePinnedProjects, withPinnedProject } from "./pinned-projects.js";
@@ -9,9 +9,10 @@ import { activityLabel, createSessionActivity, reduceActivity } from "./activity
9
9
  import { createCompactionProgress, reduceCompaction } from "./compaction.js";
10
10
  import { createSessionBadges } from "./badges.js";
11
11
  import { DEFAULT_SIDEBAR_VIEW, DEFAULT_SWITCHER_PREFS, SIDEBAR_SPACE_KEY, SIDEBAR_SWITCHER_KEY, SIDEBAR_VIEW_KEY, createSidebarViews, parseSidebarView, parseSwitcherPrefs, readSidebarViews } from "./view.js";
12
+ import { SESSION_HISTORY_LIMIT, createSessionHistory, parseSessionHistory } from "./history.js";
12
13
  import { createNotificationStore } from "./notifications.js";
13
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";
14
15
  import { availableProjectsOf, createSessionDirectory, filterDirectorySessions, projectKeyOf, sessionRefsOf } from "./directory.js";
15
16
  import { deriveDotState } from "./dot-state.js";
16
17
  import { deleteSessionPrompt, environmentKindLabel, environmentSummaryText, runsInRemoteSandbox } from "./environment.js";
17
- 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, 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, createSidebarViews, deleteSessionPrompt, deriveDotState, environmentKindLabel, environmentSummaryText, extensionSpaceOf, filterDirectorySessions, filterQueryOf, filtersForSpace, firstGrapheme, groupsByFolder, isProjectIcon, isProjectMember, itemRows, itemsForSpace, mergeSidebarSpaces, nestSidebarRows, nextSavedViewName, parsePinnedProjects, parseProjectIcons, 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, 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
2
  import { u as AuthFailure } from "../../../dist/timeout-B5pO5I5a.js";
3
- import { UC as SecretTtl } from "../../../dist/index-BI6RZc60.js";
3
+ import { KC as SecretTtl } from "../../../dist/index-Bq87OcGy.js";
4
4
  import "../../../dist/index.js";
5
5
  import "../index.js";
6
6
  //#region src/chat/headless/sidebar/labels.d.ts
@@ -237,6 +237,12 @@ declare const DEFAULT_SIDEBAR_LABELS: {
237
237
  scriptCallsDone: (done: number) => string;
238
238
  scriptCallsRunning: (running: number) => string;
239
239
  scriptCallsFailed: (failed: number) => string;
240
+ scriptLoop: string;
241
+ scriptLoopRound: (round: number) => string;
242
+ scriptLoopRounds: (rounds: number) => string;
243
+ scriptLoopRuns: (runs: number) => string;
244
+ scriptLineCalls: (calls: number) => string;
245
+ scriptWaitLeft: (seconds: number) => string;
240
246
  scriptProgress: string;
241
247
  openNamedSession: (title: string) => string;
242
248
  diagram: (type: string | null) => string;
@@ -294,6 +300,8 @@ declare const DEFAULT_SIDEBAR_LABELS: {
294
300
  loadingEarlierHistory: string;
295
301
  composerLabel: string;
296
302
  composerPlaceholder: string;
303
+ composerPlaceholderSteer: string;
304
+ composerPlaceholderQueue: string;
297
305
  sendMessage: string;
298
306
  sendHint: string;
299
307
  stopRun: string;
@@ -548,6 +556,8 @@ declare const DEFAULT_SIDEBAR_LABELS: {
548
556
  badgePathUnavailable: string;
549
557
  badgeNoComposer: string;
550
558
  badgeCopied: string;
559
+ badgeOpenIn: (app: string) => string;
560
+ badgeOpenInBrowserPane: string;
551
561
  findInConversation: string;
552
562
  findInConversationClose: string;
553
563
  turnMenuCopySelection: string;
@@ -609,6 +619,7 @@ declare const DEFAULT_SIDEBAR_LABELS: {
609
619
  paletteChoose: string;
610
620
  paletteTurnOn: string;
611
621
  paletteTurnOff: string;
622
+ paletteScopeHint: string;
612
623
  editorConflict: string;
613
624
  editorConflictDetail: string;
614
625
  editorReload: string;