@swirls/shuttle 0.0.0-stage → 0.1.1

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 (298) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +5 -0
  4. package/README.md +42 -2
  5. package/dist/api/auth.d.ts +18 -0
  6. package/dist/api/auth.js +15 -0
  7. package/dist/api/common.d.ts +8 -0
  8. package/dist/api/common.js +4 -0
  9. package/dist/api/connections.d.ts +292 -0
  10. package/dist/api/connections.js +114 -0
  11. package/dist/api/github.d.ts +20 -0
  12. package/dist/api/github.js +13 -0
  13. package/dist/api/harness.d.ts +97 -0
  14. package/dist/api/harness.js +47 -0
  15. package/dist/api/index.d.ts +2059 -0
  16. package/dist/api/index.js +37 -0
  17. package/dist/api/runners.d.ts +93 -0
  18. package/dist/api/runners.js +45 -0
  19. package/dist/api/sandbox.d.ts +550 -0
  20. package/dist/api/sandbox.js +210 -0
  21. package/dist/api/sessions.d.ts +318 -0
  22. package/dist/api/sessions.js +154 -0
  23. package/dist/api/tenant.d.ts +54 -0
  24. package/dist/api/tenant.js +19 -0
  25. package/dist/api/timings.d.ts +36 -0
  26. package/dist/api/timings.js +48 -0
  27. package/dist/api/workspace.d.ts +738 -0
  28. package/dist/api/workspace.js +246 -0
  29. package/dist/core/pulls.d.ts +1001 -0
  30. package/dist/core/pulls.js +170 -0
  31. package/dist/core/workspace.d.ts +985 -0
  32. package/dist/core/workspace.js +174 -0
  33. package/dist/react/components/command-palette.d.ts +22 -0
  34. package/dist/react/components/command-palette.js +66 -0
  35. package/dist/react/components/follow-list.d.ts +20 -0
  36. package/dist/react/components/follow-list.js +98 -0
  37. package/dist/react/components/json-tree.d.ts +11 -0
  38. package/dist/react/components/json-tree.js +120 -0
  39. package/dist/react/components/markdown.d.ts +5 -0
  40. package/dist/react/components/markdown.js +29 -0
  41. package/dist/react/components/shuttle-mark.d.ts +7 -0
  42. package/dist/react/components/shuttle-mark.js +9 -0
  43. package/dist/react/components/status-dot.d.ts +9 -0
  44. package/dist/react/components/status-dot.js +27 -0
  45. package/dist/react/components/status.d.ts +6 -0
  46. package/dist/react/components/status.js +66 -0
  47. package/dist/react/components/ui/badge.d.ts +7 -0
  48. package/dist/react/components/ui/badge.js +19 -0
  49. package/dist/react/components/ui/button.d.ts +10 -0
  50. package/dist/react/components/ui/button.js +40 -0
  51. package/dist/react/components/ui/dialog.d.ts +19 -0
  52. package/dist/react/components/ui/dialog.js +34 -0
  53. package/dist/react/components/ui/dropdown-menu.d.ts +14 -0
  54. package/dist/react/components/ui/dropdown-menu.js +33 -0
  55. package/dist/react/components/ui/input.d.ts +3 -0
  56. package/dist/react/components/ui/input.js +6 -0
  57. package/dist/react/components/ui/panel.d.ts +18 -0
  58. package/dist/react/components/ui/panel.js +22 -0
  59. package/dist/react/components/ui/popover.d.ts +7 -0
  60. package/dist/react/components/ui/popover.js +16 -0
  61. package/dist/react/components/ui/resizable.d.ts +7 -0
  62. package/dist/react/components/ui/resizable.js +14 -0
  63. package/dist/react/components/ui/scroll-area.d.ts +14 -0
  64. package/dist/react/components/ui/scroll-area.js +12 -0
  65. package/dist/react/components/ui/select.d.ts +10 -0
  66. package/dist/react/components/ui/select.js +20 -0
  67. package/dist/react/components/ui/sheet.d.ts +8 -0
  68. package/dist/react/components/ui/sheet.js +20 -0
  69. package/dist/react/components/ui/tabs.d.ts +7 -0
  70. package/dist/react/components/ui/tabs.js +16 -0
  71. package/dist/react/components/ui/textarea.d.ts +3 -0
  72. package/dist/react/components/ui/textarea.js +6 -0
  73. package/dist/react/components/ui/tooltip.d.ts +8 -0
  74. package/dist/react/components/ui/tooltip.js +17 -0
  75. package/dist/react/features/artifacts/artifact-links.d.ts +9 -0
  76. package/dist/react/features/artifacts/artifact-links.js +38 -0
  77. package/dist/react/features/artifacts/artifact-pane.d.ts +19 -0
  78. package/dist/react/features/artifacts/artifact-pane.js +75 -0
  79. package/dist/react/features/artifacts/artifact-types.d.ts +59 -0
  80. package/dist/react/features/artifacts/artifact-types.js +69 -0
  81. package/dist/react/features/artifacts/browser-viewer.d.ts +5 -0
  82. package/dist/react/features/artifacts/browser-viewer.js +60 -0
  83. package/dist/react/features/artifacts/diff-style.d.ts +10 -0
  84. package/dist/react/features/artifacts/diff-style.js +21 -0
  85. package/dist/react/features/artifacts/file-pane.d.ts +13 -0
  86. package/dist/react/features/artifacts/file-pane.js +305 -0
  87. package/dist/react/features/artifacts/file-quick-open.d.ts +15 -0
  88. package/dist/react/features/artifacts/file-quick-open.js +74 -0
  89. package/dist/react/features/artifacts/file-search.d.ts +12 -0
  90. package/dist/react/features/artifacts/file-search.js +90 -0
  91. package/dist/react/features/artifacts/media-viewer.d.ts +8 -0
  92. package/dist/react/features/artifacts/media-viewer.js +41 -0
  93. package/dist/react/features/artifacts/review-diff.d.ts +19 -0
  94. package/dist/react/features/artifacts/review-diff.js +59 -0
  95. package/dist/react/features/artifacts/review-viewer.d.ts +4 -0
  96. package/dist/react/features/artifacts/review-viewer.js +337 -0
  97. package/dist/react/features/artifacts/sandbox.d.ts +43 -0
  98. package/dist/react/features/artifacts/sandbox.js +109 -0
  99. package/dist/react/features/artifacts/tab-strip.d.ts +11 -0
  100. package/dist/react/features/artifacts/tab-strip.js +55 -0
  101. package/dist/react/features/artifacts/terminal-theme.d.ts +34 -0
  102. package/dist/react/features/artifacts/terminal-theme.js +62 -0
  103. package/dist/react/features/artifacts/terminal-viewer.d.ts +5 -0
  104. package/dist/react/features/artifacts/terminal-viewer.js +209 -0
  105. package/dist/react/features/artifacts/unified-diff.d.ts +16 -0
  106. package/dist/react/features/artifacts/unified-diff.js +55 -0
  107. package/dist/react/features/artifacts/workspace-viewer.d.ts +16 -0
  108. package/dist/react/features/artifacts/workspace-viewer.js +275 -0
  109. package/dist/react/features/connections/agent-sign-in.d.ts +71 -0
  110. package/dist/react/features/connections/agent-sign-in.js +251 -0
  111. package/dist/react/features/connections/connections-panel.d.ts +8 -0
  112. package/dist/react/features/connections/connections-panel.js +42 -0
  113. package/dist/react/features/connections/login.d.ts +24 -0
  114. package/dist/react/features/connections/login.js +35 -0
  115. package/dist/react/features/connections/places.d.ts +20 -0
  116. package/dist/react/features/connections/places.js +27 -0
  117. package/dist/react/features/connections/queries.d.ts +28 -0
  118. package/dist/react/features/connections/queries.js +8 -0
  119. package/dist/react/features/events/event-cache.d.ts +4 -0
  120. package/dist/react/features/events/event-cache.js +29 -0
  121. package/dist/react/features/events/event-catalog.d.ts +17 -0
  122. package/dist/react/features/events/event-catalog.js +261 -0
  123. package/dist/react/features/events/event-inspector.d.ts +7 -0
  124. package/dist/react/features/events/event-inspector.js +29 -0
  125. package/dist/react/features/events/event-row.d.ts +21 -0
  126. package/dist/react/features/events/event-row.js +34 -0
  127. package/dist/react/features/events/event-stream.d.ts +18 -0
  128. package/dist/react/features/events/event-stream.js +58 -0
  129. package/dist/react/features/events/global-events.d.ts +122 -0
  130. package/dist/react/features/events/global-events.js +329 -0
  131. package/dist/react/features/events/shuttle-events.d.ts +7 -0
  132. package/dist/react/features/events/shuttle-events.js +1 -0
  133. package/dist/react/features/playbook/playbook-page.d.ts +2 -0
  134. package/dist/react/features/playbook/playbook-page.js +36 -0
  135. package/dist/react/features/playbook/playbook-query.d.ts +111 -0
  136. package/dist/react/features/playbook/playbook-query.js +17 -0
  137. package/dist/react/features/pulls/linked-session.d.ts +12 -0
  138. package/dist/react/features/pulls/linked-session.js +22 -0
  139. package/dist/react/features/pulls/pull-detail-sheet.d.ts +10 -0
  140. package/dist/react/features/pulls/pull-detail-sheet.js +41 -0
  141. package/dist/react/features/pulls/pull-fixtures.d.ts +8 -0
  142. package/dist/react/features/pulls/pull-fixtures.js +258 -0
  143. package/dist/react/features/pulls/pull-glyphs.d.ts +24 -0
  144. package/dist/react/features/pulls/pull-glyphs.js +89 -0
  145. package/dist/react/features/pulls/pull-inbox-list.d.ts +13 -0
  146. package/dist/react/features/pulls/pull-inbox-list.js +230 -0
  147. package/dist/react/features/pulls/pull-inbox-pref.d.ts +2 -0
  148. package/dist/react/features/pulls/pull-inbox-pref.js +19 -0
  149. package/dist/react/features/pulls/pull-inbox.d.ts +30 -0
  150. package/dist/react/features/pulls/pull-inbox.js +110 -0
  151. package/dist/react/features/pulls/pull-threads.d.ts +39 -0
  152. package/dist/react/features/pulls/pull-threads.js +145 -0
  153. package/dist/react/features/pulls/pulls.d.ts +120 -0
  154. package/dist/react/features/pulls/pulls.js +414 -0
  155. package/dist/react/features/pulls/session-pull-groups.d.ts +14 -0
  156. package/dist/react/features/pulls/session-pull-groups.js +29 -0
  157. package/dist/react/features/pulls/stack-ladder.d.ts +9 -0
  158. package/dist/react/features/pulls/stack-ladder.js +32 -0
  159. package/dist/react/features/sessions/agent-tree.d.ts +16 -0
  160. package/dist/react/features/sessions/agent-tree.js +100 -0
  161. package/dist/react/features/sessions/agents.d.ts +34 -0
  162. package/dist/react/features/sessions/agents.js +146 -0
  163. package/dist/react/features/sessions/attention.d.ts +32 -0
  164. package/dist/react/features/sessions/attention.js +42 -0
  165. package/dist/react/features/sessions/composer-attachments.d.ts +33 -0
  166. package/dist/react/features/sessions/composer-attachments.js +126 -0
  167. package/dist/react/features/sessions/composer.d.ts +15 -0
  168. package/dist/react/features/sessions/composer.js +327 -0
  169. package/dist/react/features/sessions/context-usage-meter.d.ts +5 -0
  170. package/dist/react/features/sessions/context-usage-meter.js +122 -0
  171. package/dist/react/features/sessions/context-usage.d.ts +54 -0
  172. package/dist/react/features/sessions/context-usage.js +206 -0
  173. package/dist/react/features/sessions/conversation.d.ts +21 -0
  174. package/dist/react/features/sessions/conversation.js +549 -0
  175. package/dist/react/features/sessions/harness-switcher.d.ts +26 -0
  176. package/dist/react/features/sessions/harness-switcher.js +118 -0
  177. package/dist/react/features/sessions/intake-heuristic.d.ts +5 -0
  178. package/dist/react/features/sessions/intake-heuristic.js +28 -0
  179. package/dist/react/features/sessions/interjection-routes.d.ts +13 -0
  180. package/dist/react/features/sessions/interjection-routes.js +72 -0
  181. package/dist/react/features/sessions/llm-models.d.ts +128 -0
  182. package/dist/react/features/sessions/llm-models.js +174 -0
  183. package/dist/react/features/sessions/media-strip.d.ts +25 -0
  184. package/dist/react/features/sessions/media-strip.js +56 -0
  185. package/dist/react/features/sessions/media.d.ts +43 -0
  186. package/dist/react/features/sessions/media.js +115 -0
  187. package/dist/react/features/sessions/model-search.d.ts +6 -0
  188. package/dist/react/features/sessions/model-search.js +16 -0
  189. package/dist/react/features/sessions/model-switcher.d.ts +16 -0
  190. package/dist/react/features/sessions/model-switcher.js +262 -0
  191. package/dist/react/features/sessions/open-pull-request.d.ts +20 -0
  192. package/dist/react/features/sessions/open-pull-request.js +92 -0
  193. package/dist/react/features/sessions/pull-publish-card.d.ts +14 -0
  194. package/dist/react/features/sessions/pull-publish-card.js +88 -0
  195. package/dist/react/features/sessions/recent-sessions.d.ts +11 -0
  196. package/dist/react/features/sessions/recent-sessions.js +29 -0
  197. package/dist/react/features/sessions/seen-sessions.d.ts +16 -0
  198. package/dist/react/features/sessions/seen-sessions.js +108 -0
  199. package/dist/react/features/sessions/session-activity.d.ts +95 -0
  200. package/dist/react/features/sessions/session-activity.js +785 -0
  201. package/dist/react/features/sessions/session-context.d.ts +8 -0
  202. package/dist/react/features/sessions/session-context.js +98 -0
  203. package/dist/react/features/sessions/session-feed.d.ts +243 -0
  204. package/dist/react/features/sessions/session-feed.js +883 -0
  205. package/dist/react/features/sessions/session-header.d.ts +24 -0
  206. package/dist/react/features/sessions/session-header.js +97 -0
  207. package/dist/react/features/sessions/session-layout.d.ts +7 -0
  208. package/dist/react/features/sessions/session-layout.js +87 -0
  209. package/dist/react/features/sessions/session-panes.d.ts +49 -0
  210. package/dist/react/features/sessions/session-panes.js +142 -0
  211. package/dist/react/features/sessions/session-parts.d.ts +35 -0
  212. package/dist/react/features/sessions/session-parts.js +74 -0
  213. package/dist/react/features/sessions/session-place.d.ts +9 -0
  214. package/dist/react/features/sessions/session-place.js +109 -0
  215. package/dist/react/features/sessions/session-pr-pills.d.ts +7 -0
  216. package/dist/react/features/sessions/session-pr-pills.js +28 -0
  217. package/dist/react/features/sessions/session-queries.d.ts +172 -0
  218. package/dist/react/features/sessions/session-queries.js +90 -0
  219. package/dist/react/features/sessions/session-repos.d.ts +8 -0
  220. package/dist/react/features/sessions/session-repos.js +15 -0
  221. package/dist/react/features/sessions/session-share.d.ts +8 -0
  222. package/dist/react/features/sessions/session-share.js +112 -0
  223. package/dist/react/features/sessions/session-tabs.d.ts +38 -0
  224. package/dist/react/features/sessions/session-tabs.js +191 -0
  225. package/dist/react/features/sessions/session.d.ts +103 -0
  226. package/dist/react/features/sessions/session.js +216 -0
  227. package/dist/react/features/sessions/signals.d.ts +13 -0
  228. package/dist/react/features/sessions/signals.js +34 -0
  229. package/dist/react/features/sessions/tab-set.d.ts +20 -0
  230. package/dist/react/features/sessions/tab-set.js +58 -0
  231. package/dist/react/features/sessions/team.d.ts +16 -0
  232. package/dist/react/features/sessions/team.js +35 -0
  233. package/dist/react/features/sessions/timeline.d.ts +53 -0
  234. package/dist/react/features/sessions/timeline.js +153 -0
  235. package/dist/react/features/sessions/use-session-tabs.d.ts +18 -0
  236. package/dist/react/features/sessions/use-session-tabs.js +119 -0
  237. package/dist/react/features/sessions/vendor-models.d.ts +23 -0
  238. package/dist/react/features/sessions/vendor-models.js +61 -0
  239. package/dist/react/features/workspace/activity-dot.d.ts +15 -0
  240. package/dist/react/features/workspace/activity-dot.js +36 -0
  241. package/dist/react/features/workspace/app-sidebar.d.ts +16 -0
  242. package/dist/react/features/workspace/app-sidebar.js +227 -0
  243. package/dist/react/features/workspace/fixture-toggle.d.ts +2 -0
  244. package/dist/react/features/workspace/fixture-toggle.js +72 -0
  245. package/dist/react/features/workspace/folder-group.d.ts +18 -0
  246. package/dist/react/features/workspace/folder-group.js +83 -0
  247. package/dist/react/features/workspace/inline-name-input.d.ts +10 -0
  248. package/dist/react/features/workspace/inline-name-input.js +33 -0
  249. package/dist/react/features/workspace/link-repo-dialog.d.ts +9 -0
  250. package/dist/react/features/workspace/link-repo-dialog.js +76 -0
  251. package/dist/react/features/workspace/repo-chip.d.ts +13 -0
  252. package/dist/react/features/workspace/repo-chip.js +15 -0
  253. package/dist/react/features/workspace/session-row.d.ts +20 -0
  254. package/dist/react/features/workspace/session-row.js +23 -0
  255. package/dist/react/features/workspace/use-debounced.d.ts +2 -0
  256. package/dist/react/features/workspace/use-debounced.js +10 -0
  257. package/dist/react/features/workspace/workspace-context.d.ts +45 -0
  258. package/dist/react/features/workspace/workspace-context.js +245 -0
  259. package/dist/react/features/workspace/workspace-fixtures.d.ts +16 -0
  260. package/dist/react/features/workspace/workspace-fixtures.js +175 -0
  261. package/dist/react/features/workspace/workspace-tree.d.ts +30 -0
  262. package/dist/react/features/workspace/workspace-tree.js +69 -0
  263. package/dist/react/features/workspace/workspace.d.ts +107 -0
  264. package/dist/react/features/workspace/workspace.js +458 -0
  265. package/dist/react/index.d.ts +33 -0
  266. package/dist/react/index.js +35 -0
  267. package/dist/react/lib/cn.d.ts +6 -0
  268. package/dist/react/lib/cn.js +20 -0
  269. package/dist/react/lib/initials.d.ts +6 -0
  270. package/dist/react/lib/initials.js +32 -0
  271. package/dist/react/lib/json.d.ts +33 -0
  272. package/dist/react/lib/json.js +101 -0
  273. package/dist/react/lib/time.d.ts +8 -0
  274. package/dist/react/lib/time.js +57 -0
  275. package/dist/react/lib/use-media-query.d.ts +1 -0
  276. package/dist/react/lib/use-media-query.js +9 -0
  277. package/dist/react/lib/use-now.d.ts +2 -0
  278. package/dist/react/lib/use-now.js +10 -0
  279. package/dist/react/lib/use-width-bucket.d.ts +6 -0
  280. package/dist/react/lib/use-width-bucket.js +28 -0
  281. package/dist/react/parts/index.d.ts +43 -0
  282. package/dist/react/parts/index.js +43 -0
  283. package/dist/react/shuttle/device.d.ts +42 -0
  284. package/dist/react/shuttle/device.js +10 -0
  285. package/dist/react/shuttle/host.d.ts +1126 -0
  286. package/dist/react/shuttle/host.js +93 -0
  287. package/dist/react/shuttle/identity.d.ts +31 -0
  288. package/dist/react/shuttle/identity.js +20 -0
  289. package/dist/react/shuttle/index.d.ts +14 -0
  290. package/dist/react/shuttle/index.js +13 -0
  291. package/dist/react/shuttle/provider.d.ts +41 -0
  292. package/dist/react/shuttle/provider.js +59 -0
  293. package/dist/react/shuttle/router.d.ts +43 -0
  294. package/dist/react/shuttle/router.js +1 -0
  295. package/dist/react/theme.css +456 -0
  296. package/dist/react/ui.d.ts +19 -0
  297. package/dist/react/ui.js +19 -0
  298. package/package.json +100 -4
@@ -0,0 +1,24 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type PaneShortcut } from './session-panes.js';
3
+ /** A header button that shows or hides one of the session's panes, with its shortcut on hover. */
4
+ export declare function PaneToggle({ label, shortcut, open, onToggle, align, children, }: {
5
+ label: string;
6
+ shortcut: Pick<PaneShortcut, 'key' | 'shift'>;
7
+ open: boolean;
8
+ onToggle: () => void;
9
+ align?: 'start' | 'end';
10
+ children: ReactNode;
11
+ }): import("react").JSX.Element;
12
+ /**
13
+ * The session's name and what it produced, at the top of the conversation. It has no border
14
+ * and shares the panel header height (and the app sidebar's top bar), so it reads as part of
15
+ * the conversation and lines up with the panes beside it.
16
+ */
17
+ export declare function SessionHeader({ leading, trailing, onShowAgents, }: {
18
+ /** Sits before the title, such as the control that brings back a closed agents pane. */
19
+ leading?: ReactNode;
20
+ /** Sits at the far end, such as the control that shows or hides the artifacts pane. */
21
+ trailing?: ReactNode;
22
+ /** Makes the status a button that shows the agents, where the arrangement has room for them. */
23
+ onShowAgents?: () => void;
24
+ }): import("react").JSX.Element;
@@ -0,0 +1,97 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowLeft, Check, ChevronRight, Copy, Ellipsis, Folder as FolderIcon, GitPullRequest, PanelBottom, Search, } from 'lucide-react';
3
+ import { Fragment, useMemo, useState } from 'react';
4
+ import { useProjection, useRunStore } from '@swirls/looms/react';
5
+ import { statusClass, statusLabel } from '../../components/status.js';
6
+ import { StatusDot } from '../../components/status-dot.js';
7
+ import { Button } from '../../components/ui/button.js';
8
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from '../../components/ui/dropdown-menu.js';
9
+ import { Kbd } from '../../components/ui/panel.js';
10
+ import { Tooltip, TooltipContent, TooltipTrigger } from '../../components/ui/tooltip.js';
11
+ import { cn, shortId } from '../../lib/cn.js';
12
+ import { Link } from '../../shuttle/index.js';
13
+ import { authoredPullsForSession, pullInbox, reviewedPullForSession, usePullsRunId, } from '../pulls/pulls.js';
14
+ import { OpenPullRequestButton } from './open-pull-request.js';
15
+ import { useSession } from './session.js';
16
+ import { EVENTS_SHORTCUT, PALETTE_SHORTCUT, shortcutLabel, } from './session-panes.js';
17
+ import { SessionPlace } from './session-place.js';
18
+ import { SessionPrPills } from './session-pr-pills.js';
19
+ import { SessionShare } from './session-share.js';
20
+ /** A header button that shows or hides one of the session's panes, with its shortcut on hover. */
21
+ export function PaneToggle({ label, shortcut, open, onToggle, align = 'end', children, }) {
22
+ return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": label, "aria-pressed": open, onClick: onToggle, className: "aria-pressed:bg-accent aria-pressed:text-foreground", children: children }) }), _jsx(TooltipContent, { side: "bottom", align: align, children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [open ? `Hide ${label.toLowerCase()}` : `Show ${label.toLowerCase()}`, _jsx(Kbd, { children: shortcutLabel(shortcut) })] }) })] }));
23
+ }
24
+ /**
25
+ * What the session is doing, in the title bar. The bar leaves it out while idle: nothing to
26
+ * report is the resting state, and a badge for it is noise.
27
+ */
28
+ function SessionStatusLine({ status, onShowAgents, }) {
29
+ const body = (_jsxs(_Fragment, { children: [_jsx(StatusDot, { status: status }), _jsx("span", { className: "hidden @md:inline", children: statusLabel(status) })] }));
30
+ const className = cn('inline-flex h-6 shrink-0 items-center gap-1.5 rounded-full px-2 text-[11.5px] font-medium whitespace-nowrap', statusClass(status));
31
+ return onShowAgents ? (_jsx("button", { type: "button", onClick: onShowAgents, "aria-label": `${statusLabel(status)}. Show agents`, title: `${statusLabel(status)}. Show agents`, className: cn(className, 'ease-snappy transition-[background-color,transform] duration-150 outline-none hover:bg-current/10 focus-visible:bg-current/10 active:scale-[0.97]'), children: body })) : (_jsx("span", { className: className, title: statusLabel(status), children: body }));
32
+ }
33
+ /**
34
+ * The session's name and what it produced, at the top of the conversation. It has no border
35
+ * and shares the panel header height (and the app sidebar's top bar), so it reads as part of
36
+ * the conversation and lines up with the panes beside it.
37
+ */
38
+ export function SessionHeader({ leading, trailing, onShowAgents, }) {
39
+ const { runId, title, folder, feed, status, summary, labelFor, inspect, threadPath: viewPath, openThread, leaveThread, panes, } = useSession();
40
+ const [copied, setCopied] = useState(false);
41
+ const pullsStore = useRunStore(usePullsRunId());
42
+ const inbox = useProjection(pullsStore, pullInbox);
43
+ const sessionPulls = useMemo(() => mergeSessionPulls(feed.publishedPulls, inbox, runId), [feed.publishedPulls, inbox, runId]);
44
+ const reviewed = useMemo(() => reviewedPullForSession(inbox, runId), [inbox, runId]);
45
+ // The title only ever truncates, so its length never moves the controls. As the bar narrows
46
+ // the folder goes first, then the status and connection labels, then all but one avatar. The
47
+ // title, the menu and the artifacts toggle stay to the end.
48
+ return (_jsxs("header", { className: "@container grid h-12 shrink-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-2", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-1.5", children: [leading, _jsxs("div", { className: "flex min-w-0 items-center gap-1.5 pl-1", children: [folder ? (_jsxs(_Fragment, { children: [_jsxs(Link, { to: { page: 'folder', folderId: folder.folderId }, title: folder.name, className: "text-muted-foreground hover:text-foreground hidden max-w-24 shrink-0 items-center gap-1.5 text-[12px] transition-colors duration-100 @xl:inline-flex @4xl:max-w-40", children: [_jsx(FolderIcon, { className: "size-3.5 shrink-0" }), _jsx("span", { className: "truncate", dir: "auto", children: folder.name })] }), _jsx("span", { "aria-hidden": true, className: "text-muted-foreground/50 hidden text-[12px] @xl:inline", children: "/" })] })) : null, viewPath.length === 0 ? (_jsx("h1", { className: "min-w-0 truncate text-[13px] font-medium", dir: "auto", title: title, children: title })) : (_jsx(ThreadBreadcrumb, { title: title, path: viewPath, labelFor: labelFor, onOpenThread: openThread, onLeave: leaveThread }))] })] }), _jsxs("div", { className: "flex items-center gap-0.5", children: [reviewed ? (_jsxs("a", { href: reviewed.url, target: "_blank", rel: "noreferrer", title: `Reviewing ${reviewed.fullName}#${reviewed.number}: ${reviewed.title}\n${reviewed.headRef} → ${reviewed.baseRef}`, className: "text-muted-foreground hover:text-foreground focus-visible:ring-ring/50 inline-flex max-w-52 shrink-0 items-center gap-1.5 rounded-full border px-2 py-0.5 text-[11px] transition-colors duration-100 outline-none focus-visible:ring-2", children: [_jsx(GitPullRequest, { className: "size-3 shrink-0" }), _jsxs("span", { className: "min-w-0 truncate", children: ["Reviewing ", _jsxs("span", { className: "font-mono", children: ["#", reviewed.number] })] })] })) : null, _jsx(SessionPrPills, { pulls: sessionPulls, labelFor: labelFor, onInspect: inspect }), folder && folder.repos.length > 0 && !reviewed ? (_jsx(OpenPullRequestButton, { runId: runId, feed: feed, hasPulls: sessionPulls.length > 0, working: status === 'working' || status === 'running' })) : null, _jsx(ConnectionIndicator, { connection: summary.connection }), status === 'idle' ? null : (_jsx(SessionStatusLine, { status: status, onShowAgents: onShowAgents })), _jsx(SessionPlace, { runId: runId, working: status === 'working' || status === 'running' }, `place:${runId}`), _jsx(SessionShare, { runId: runId }, runId), _jsxs(DropdownMenu, { onOpenChange: (open) => !open && setCopied(false), children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "More session actions", children: _jsx(Ellipsis, {}) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "w-56", children: [_jsxs(DropdownMenuItem, { onSelect: () => panes.setPalette(true), children: [_jsx(Search, {}), "Commands", _jsx(Kbd, { className: "ml-auto", children: shortcutLabel(PALETTE_SHORTCUT) })] }), _jsxs(DropdownMenuItem, { onSelect: () => panes.setEvents(!panes.events), children: [_jsx(PanelBottom, {}), panes.events ? 'Hide event history' : 'Show event history', _jsx(Kbd, { className: "ml-auto", children: shortcutLabel(EVENTS_SHORTCUT) })] }), _jsxs(DropdownMenuItem, { onSelect: (event) => {
49
+ // Stay open long enough to show that it copied.
50
+ event.preventDefault();
51
+ void navigator.clipboard.writeText(runId).then(() => setCopied(true));
52
+ }, children: [copied ? _jsx(Check, { className: "text-status-completed" }) : _jsx(Copy, {}), copied ? 'Copied' : 'Copy run ID', _jsx("span", { className: "text-muted-foreground ml-auto font-mono text-[10px]", children: shortId(runId) })] })] })] }), trailing] })] }));
53
+ }
54
+ /**
55
+ * Where the open timeline sits: the session, the agents above it, then the agent itself. Each
56
+ * step but the last goes back to that level.
57
+ */
58
+ function ThreadBreadcrumb({ title, path, labelFor, onOpenThread, onLeave, }) {
59
+ const crumbClass = 'text-muted-foreground hover:text-foreground min-w-0 truncate text-[13px] transition-colors duration-100';
60
+ return (_jsxs("nav", { "aria-label": "Open thread", className: "flex min-w-0 items-center gap-1", children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": "Back", onClick: onLeave, children: _jsx(ArrowLeft, {}) }) }), _jsx(TooltipContent, { side: "bottom", align: "start", children: _jsxs("span", { className: "inline-flex items-center gap-1.5", children: ["Back ", _jsx(Kbd, { children: "Esc" })] }) })] }), _jsx("button", { type: "button", onClick: () => onOpenThread(undefined), title: title, dir: "auto", className: cn(crumbClass, 'hidden max-w-48 shrink @lg:block'), children: title }), path.map((threadId, index) => {
61
+ const last = index === path.length - 1;
62
+ const label = labelFor(threadId) ?? 'Agent';
63
+ return (_jsxs(Fragment, { children: [_jsx(ChevronRight, { "aria-hidden": true, className: cn('text-muted-foreground/60 size-3 shrink-0',
64
+ // The first separator follows the title, which is hidden where space is short.
65
+ index === 0 && 'hidden @lg:block', !last && index > 0 && 'hidden @2xl:block') }), last ? (_jsx("h1", { className: "min-w-0 truncate text-[13px] font-medium", children: label })) : (_jsx("button", { type: "button", onClick: () => onOpenThread(threadId), className: cn(crumbClass, 'hidden shrink-0 @2xl:block'), children: label }))] }, threadId));
66
+ })] }));
67
+ }
68
+ function mergeSessionPulls(published, inbox, runId) {
69
+ const byKey = new Map();
70
+ for (const pull of authoredPullsForSession(inbox, runId)) {
71
+ byKey.set(`${pull.fullName}#${pull.number}`, pull);
72
+ }
73
+ for (const pull of published) {
74
+ const key = `${pull.fullName}#${pull.number}`;
75
+ const existing = byKey.get(key);
76
+ byKey.set(key, {
77
+ ...pull,
78
+ threadId: pull.threadId ?? existing?.threadId,
79
+ stack: pull.stack ?? existing?.stack,
80
+ });
81
+ }
82
+ return [...byKey.values()];
83
+ }
84
+ /** Silent while live; only a degraded connection earns header space. */
85
+ function ConnectionIndicator({ connection }) {
86
+ switch (connection) {
87
+ case 'live':
88
+ return null;
89
+ case 'connecting':
90
+ case 'reconnecting':
91
+ return (_jsxs("span", { title: connection === 'connecting' ? 'Connecting' : 'Reconnecting', className: "text-status-waiting inline-flex shrink-0 items-center gap-1.5 px-1 text-[11px]", children: [_jsx("span", { className: "bg-status-waiting size-1.5 animate-pulse rounded-full" }), _jsx("span", { className: "hidden @md:inline", children: connection === 'connecting' ? 'Connecting' : 'Reconnecting' })] }));
92
+ default: {
93
+ const exhaustive = connection;
94
+ return exhaustive;
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shuttle's own arrangement of a session: agents, the conversation with its header and message
3
+ * box, and artifacts side by side, with event history in a drawer underneath. Panes dock where
4
+ * there is room and can be dragged, shown and hidden. It is one way to put the parts together;
5
+ * a host that wants another puts them together itself inside `<Shuttle.Session>`.
6
+ */
7
+ export declare function SessionLayout(): import("react").JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PanelBottom, PanelRight, Users } from 'lucide-react';
3
+ import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '../../components/ui/resizable.js';
4
+ import { cn } from '../../lib/cn.js';
5
+ import { useWidthBucket } from '../../lib/use-width-bucket.js';
6
+ import { useSession } from './session.js';
7
+ import { PaneToggle, SessionHeader } from './session-header.js';
8
+ import { AGENTS_SHORTCUT, ARTIFACTS_SHORTCUT, EVENTS_SHORTCUT, PALETTE_SHORTCUT, shortcutLabel, useCollapsiblePanel, usePaneShortcuts, } from './session-panes.js';
9
+ import { SessionAgents, SessionArtifacts, SessionComposer, SessionConversation, SessionEvents, SessionPalette, } from './session-parts.js';
10
+ /**
11
+ * Session-area widths, in CSS pixels, at which a pane can dock. Below the first only the
12
+ * conversation shows (artifacts open over it); from the second the agents pane can dock too.
13
+ */
14
+ const PANE_BREAKPOINTS = [640, 980];
15
+ /**
16
+ * Shuttle's own arrangement of a session: agents, the conversation with its header and message
17
+ * box, and artifacts side by side, with event history in a drawer underneath. Panes dock where
18
+ * there is room and can be dragged, shown and hidden. It is one way to put the parts together;
19
+ * a host that wants another puts them together itself inside `<Shuttle.Session>`.
20
+ */
21
+ export function SessionLayout() {
22
+ const { panes } = useSession();
23
+ const [layoutRef, paneCount] = useWidthBucket(PANE_BREAKPOINTS);
24
+ const layout = paneCount >= 2 ? 'three' : paneCount === 1 ? 'two' : 'one';
25
+ // In the one-pane layout the artifacts pane opens over the conversation.
26
+ const artifactsOpen = layout === 'one' ? panes.artifactsOverlay : panes.artifacts;
27
+ const toggleArtifacts = () => {
28
+ if (layout === 'one') {
29
+ panes.setArtifactsOverlay(!panes.artifactsOverlay);
30
+ }
31
+ else {
32
+ panes.setArtifacts(!panes.artifacts);
33
+ }
34
+ };
35
+ const commands = [
36
+ ...(layout === 'three'
37
+ ? [
38
+ {
39
+ id: 'agents',
40
+ label: panes.agents ? 'Hide agents' : 'Show agents',
41
+ icon: _jsx(Users, {}),
42
+ shortcut: shortcutLabel(AGENTS_SHORTCUT),
43
+ keywords: 'threads tree conductor worker',
44
+ run: () => panes.setAgents(!panes.agents),
45
+ },
46
+ ]
47
+ : []),
48
+ {
49
+ id: 'artifacts',
50
+ label: artifactsOpen ? 'Hide artifacts' : 'Show artifacts',
51
+ icon: _jsx(PanelRight, {}),
52
+ shortcut: shortcutLabel(ARTIFACTS_SHORTCUT),
53
+ keywords: 'panel tabs side',
54
+ run: toggleArtifacts,
55
+ },
56
+ {
57
+ id: 'events',
58
+ label: panes.events ? 'Hide event history' : 'Show event history',
59
+ icon: _jsx(PanelBottom, {}),
60
+ shortcut: shortcutLabel(EVENTS_SHORTCUT),
61
+ keywords: 'debug log inspect',
62
+ run: () => panes.setEvents(!panes.events),
63
+ },
64
+ ];
65
+ const agentsPanel = useCollapsiblePanel({
66
+ open: panes.agents,
67
+ onOpenChange: panes.setAgents,
68
+ preferredSize: '18',
69
+ });
70
+ const artifactsPanel = useCollapsiblePanel({
71
+ open: panes.artifacts,
72
+ onOpenChange: panes.setArtifacts,
73
+ preferredSize: '34',
74
+ });
75
+ const eventsPanel = useCollapsiblePanel({
76
+ open: panes.events,
77
+ onOpenChange: panes.setEvents,
78
+ preferredSize: '38',
79
+ });
80
+ usePaneShortcuts([
81
+ { ...AGENTS_SHORTCUT, run: () => panes.setAgents(!panes.agents) },
82
+ { ...ARTIFACTS_SHORTCUT, run: toggleArtifacts },
83
+ { ...EVENTS_SHORTCUT, run: () => panes.setEvents(!panes.events) },
84
+ { ...PALETTE_SHORTCUT, run: () => panes.setPalette(!panes.palette) },
85
+ ]);
86
+ return (_jsxs("div", { ref: layoutRef, className: "flex h-full min-h-0 flex-col", children: [_jsx(SessionPalette, { commands: commands }), _jsxs(ResizablePanelGroup, { orientation: "vertical", className: "min-h-0 flex-1", children: [_jsx(ResizablePanel, { id: "session", minSize: 160, children: _jsxs(ResizablePanelGroup, { orientation: "horizontal", className: "h-full min-h-0", children: [layout === 'three' ? (_jsxs(_Fragment, { children: [_jsx(ResizablePanel, { id: "agents", panelRef: agentsPanel.panelRef, onResize: agentsPanel.onResize, defaultSize: agentsPanel.defaultSize, collapsible: true, collapsedSize: 0, minSize: 200, maxSize: "30", children: _jsx("div", { inert: !panes.agents, className: "h-full min-h-0", children: _jsx(SessionAgents, { onClose: () => panes.setAgents(false) }) }) }), _jsx(ResizableHandle, { className: panes.agents ? undefined : 'hidden' })] })) : null, _jsx(ResizablePanel, { id: "conversation", minSize: layout === 'one' ? 0 : 320, children: _jsxs("main", { className: "flex h-full min-h-0 flex-col", children: [_jsx(SessionHeader, { onShowAgents: layout === 'three' ? () => panes.setAgents(true) : undefined, leading: layout === 'three' && !panes.agents ? (_jsx(PaneToggle, { label: "Agents", shortcut: AGENTS_SHORTCUT, open: panes.agents, onToggle: () => panes.setAgents(true), align: "start", children: _jsx(Users, {}) })) : null, trailing: _jsx(PaneToggle, { label: "Artifacts", shortcut: ARTIFACTS_SHORTCUT, open: artifactsOpen, onToggle: toggleArtifacts, children: _jsx(PanelRight, {}) }) }), _jsxs("div", { className: "relative flex min-h-0 flex-1 flex-col", children: [_jsx(SessionConversation, {}), _jsx(SessionComposer, {}), layout === 'one' && panes.artifactsOverlay ? (_jsx("aside", { className: "bg-background absolute inset-0 z-20 min-h-0", children: _jsx(SessionArtifacts, {}) })) : null] })] }) }), layout === 'one' ? null : (_jsxs(_Fragment, { children: [_jsx(ResizableHandle, { className: panes.artifacts ? undefined : 'hidden' }), _jsx(ResizablePanel, { id: "artifacts", panelRef: artifactsPanel.panelRef, onResize: artifactsPanel.onResize, defaultSize: artifactsPanel.defaultSize, collapsible: true, collapsedSize: 0, minSize: 280, children: _jsx("aside", { inert: !panes.artifacts, "aria-label": "Artifacts", className: "h-full min-h-0", children: _jsx(SessionArtifacts, {}) }) })] }))] }) }), _jsx(ResizableHandle, { className: cn('h-px w-full after:inset-x-0 after:inset-y-auto after:top-1/2 after:left-0 after:h-2 after:w-full after:translate-x-0 after:-translate-y-1/2', !panes.events && 'hidden') }), _jsx(ResizablePanel, { id: "events", panelRef: eventsPanel.panelRef, onResize: eventsPanel.onResize, defaultSize: eventsPanel.defaultSize, collapsible: true, collapsedSize: 0, minSize: 180, maxSize: "80", children: _jsx("section", { inert: !panes.events, "aria-label": "Event history", className: "bg-sidebar h-full min-h-0", children: _jsx(SessionEvents, { onClose: () => panes.setEvents(false) }) }) })] })] }));
87
+ }
@@ -0,0 +1,49 @@
1
+ import { type PanelImperativeHandle, type PanelSize } from 'react-resizable-panels';
2
+ /** Whether the agents pane is open. Closed until the reader asks for it. */
3
+ export declare function useAgentsOpen(): [boolean, (next: boolean) => void];
4
+ /** Whether the event history drawer is open. Closed until the reader asks for it. */
5
+ export declare function useEventsOpen(): [boolean, (next: boolean) => void];
6
+ /**
7
+ * Whether the reader opened or closed this session's artifacts pane themself. `null` until they
8
+ * do, and the pane then follows whether the session has anything open in it.
9
+ */
10
+ export declare function useArtifactsChoice(runId: string): [boolean | null, (next: boolean) => void];
11
+ /**
12
+ * Keeps a collapsible panel in step with whether its pane is open. Dragging a panel shut or
13
+ * open reports back through `onResize`, so the toggle and the drag never disagree.
14
+ */
15
+ export declare function useCollapsiblePanel({ open, onOpenChange, preferredSize, }: {
16
+ open: boolean;
17
+ onOpenChange: (open: boolean) => void;
18
+ /** The size to open at the first time, before the reader has sized the panel themself. */
19
+ preferredSize: string;
20
+ }): {
21
+ panelRef: import("react").RefObject<PanelImperativeHandle | null>;
22
+ onResize: (size: PanelSize, _id: string | number | undefined, previous: PanelSize | undefined) => void;
23
+ defaultSize: string;
24
+ };
25
+ /** The shortcuts for the session's panes and its command palette. */
26
+ export declare const AGENTS_SHORTCUT: {
27
+ readonly key: 'a';
28
+ readonly shift: true;
29
+ };
30
+ export declare const ARTIFACTS_SHORTCUT: {
31
+ readonly key: 'b';
32
+ readonly shift: true;
33
+ };
34
+ export declare const EVENTS_SHORTCUT: {
35
+ readonly key: 'j';
36
+ };
37
+ export declare const PALETTE_SHORTCUT: {
38
+ readonly key: 'k';
39
+ };
40
+ export interface PaneShortcut {
41
+ /** The letter pressed with ⌘ on a Mac and Ctrl elsewhere. */
42
+ readonly key: string;
43
+ readonly shift?: boolean;
44
+ readonly run: () => void;
45
+ }
46
+ /** How a shortcut reads in a tooltip, e.g. `⌘⇧B` or `Ctrl+Shift+B`. */
47
+ export declare function shortcutLabel(shortcut: Pick<PaneShortcut, 'key' | 'shift'>): string;
48
+ /** Runs pane shortcuts from anywhere on the page. */
49
+ export declare function usePaneShortcuts(shortcuts: readonly PaneShortcut[]): void;
@@ -0,0 +1,142 @@
1
+ import { useCallback, useEffect, useEffectEvent, useRef, useState } from 'react';
2
+ import { usePanelRef } from 'react-resizable-panels';
3
+ const AGENTS_OPEN_KEY = 'shuttle.agents-open';
4
+ const EVENTS_OPEN_KEY = 'shuttle.events-open';
5
+ const ARTIFACTS_OPEN_PREFIX = 'shuttle.artifacts-open:';
6
+ function readFlag(storage, key) {
7
+ try {
8
+ const stored = storage().getItem(key);
9
+ return stored === '1' ? true : stored === '0' ? false : null;
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ }
15
+ function writeFlag(storage, key, value) {
16
+ try {
17
+ storage().setItem(key, value ? '1' : '0');
18
+ }
19
+ catch {
20
+ // Private mode or a full quota: the pane still opens, it just isn't remembered.
21
+ }
22
+ }
23
+ /** An open/closed preference that holds across sessions and reloads. */
24
+ function useStoredFlag(key, fallback) {
25
+ const [value, setValue] = useState(() => readFlag(() => localStorage, key) ?? fallback);
26
+ useEffect(() => {
27
+ writeFlag(() => localStorage, key, value);
28
+ }, [key, value]);
29
+ return [value, setValue];
30
+ }
31
+ /** Whether the agents pane is open. Closed until the reader asks for it. */
32
+ export function useAgentsOpen() {
33
+ return useStoredFlag(AGENTS_OPEN_KEY, false);
34
+ }
35
+ /** Whether the event history drawer is open. Closed until the reader asks for it. */
36
+ export function useEventsOpen() {
37
+ return useStoredFlag(EVENTS_OPEN_KEY, false);
38
+ }
39
+ /**
40
+ * Whether the reader opened or closed this session's artifacts pane themself. `null` until they
41
+ * do, and the pane then follows whether the session has anything open in it.
42
+ */
43
+ export function useArtifactsChoice(runId) {
44
+ const key = `${ARTIFACTS_OPEN_PREFIX}${runId}`;
45
+ const [choice, setChoice] = useState(() => readFlag(() => sessionStorage, key));
46
+ const choose = useCallback((next) => {
47
+ setChoice(next);
48
+ writeFlag(() => sessionStorage, key, next);
49
+ }, [key]);
50
+ return [choice, choose];
51
+ }
52
+ /**
53
+ * Keeps a collapsible panel in step with whether its pane is open. Dragging a panel shut or
54
+ * open reports back through `onResize`, so the toggle and the drag never disagree.
55
+ */
56
+ export function useCollapsiblePanel({ open, onOpenChange, preferredSize, }) {
57
+ const panelRef = usePanelRef();
58
+ const wanted = useRef(open);
59
+ // The size to reopen at: the last one the panel had while open, as a percentage.
60
+ const lastSize = useRef(null);
61
+ // The panel handle this hook last looked at. A panel that has only just mounted already has
62
+ // the right size from `defaultSize`, and its group has not registered it yet, so asking it
63
+ // anything throws.
64
+ const seen = useRef(null);
65
+ // Runs after every render, not only when `open` changes: the panel unmounts and remounts when
66
+ // the layout changes, and this is how the hook notices. Each check is a no-op once in step.
67
+ useEffect(() => {
68
+ wanted.current = open;
69
+ const panel = panelRef.current;
70
+ if (seen.current !== panel) {
71
+ seen.current = panel;
72
+ return;
73
+ }
74
+ if (!panel) {
75
+ return;
76
+ }
77
+ try {
78
+ if (!open) {
79
+ if (!panel.isCollapsed()) {
80
+ panel.collapse();
81
+ }
82
+ }
83
+ else if (panel.isCollapsed()) {
84
+ panel.resize(lastSize.current === null ? preferredSize : `${lastSize.current}%`);
85
+ }
86
+ }
87
+ catch {
88
+ // The group is between layouts. The next render brings the panel back in step.
89
+ }
90
+ });
91
+ const onResize = useCallback((size, _id, previous) => {
92
+ const nowOpen = size.asPercentage > 0;
93
+ if (nowOpen) {
94
+ lastSize.current = size.asPercentage;
95
+ }
96
+ // Only a drag disagrees with what was asked for; that is the reader's own choice.
97
+ if (previous !== undefined && nowOpen !== wanted.current) {
98
+ onOpenChange(nowOpen);
99
+ }
100
+ }, [onOpenChange]);
101
+ return { panelRef, onResize, defaultSize: open ? preferredSize : '0' };
102
+ }
103
+ /** The shortcuts for the session's panes and its command palette. */
104
+ export const AGENTS_SHORTCUT = { key: 'a', shift: true };
105
+ export const ARTIFACTS_SHORTCUT = { key: 'b', shift: true };
106
+ export const EVENTS_SHORTCUT = { key: 'j' };
107
+ export const PALETTE_SHORTCUT = { key: 'k' };
108
+ function isMac() {
109
+ return typeof navigator !== 'undefined' && /mac|iphone|ipad/i.test(navigator.userAgent);
110
+ }
111
+ /** How a shortcut reads in a tooltip, e.g. `⌘⇧B` or `Ctrl+Shift+B`. */
112
+ export function shortcutLabel(shortcut) {
113
+ const key = shortcut.key.toUpperCase();
114
+ if (isMac()) {
115
+ return `⌘${shortcut.shift ? '⇧' : ''}${key}`;
116
+ }
117
+ return `Ctrl+${shortcut.shift ? 'Shift+' : ''}${key}`;
118
+ }
119
+ /** Runs pane shortcuts from anywhere on the page. */
120
+ export function usePaneShortcuts(shortcuts) {
121
+ const onKeyDown = useEffectEvent((event) => {
122
+ const mac = isMac();
123
+ const chord = mac ? event.metaKey && !event.ctrlKey : event.ctrlKey && !event.metaKey;
124
+ if (!chord || event.altKey) {
125
+ return;
126
+ }
127
+ // Off a Mac these are Ctrl chords, which inside a terminal belong to the shell.
128
+ if (!mac && event.target instanceof Element && event.target.closest('.xterm')) {
129
+ return;
130
+ }
131
+ const key = event.key.toLowerCase();
132
+ const match = shortcuts.find((shortcut) => shortcut.key === key && Boolean(shortcut.shift) === event.shiftKey);
133
+ if (match) {
134
+ event.preventDefault();
135
+ match.run();
136
+ }
137
+ });
138
+ useEffect(() => {
139
+ window.addEventListener('keydown', onKeyDown, true);
140
+ return () => window.removeEventListener('keydown', onKeyDown, true);
141
+ }, []);
142
+ }
@@ -0,0 +1,35 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type Command } from '../../components/command-palette.js';
3
+ /**
4
+ * The session's agents, as a tree. Picking one opens its timeline; event history, when it is
5
+ * open, follows along.
6
+ */
7
+ export declare function SessionAgents({ onClose, }: {
8
+ /** Adds a close button to the header. */
9
+ onClose?: () => void;
10
+ }): import("react").JSX.Element;
11
+ /** The conversation: the session's top level, or the open agent's own timeline. */
12
+ export declare function SessionConversation(): import("react").JSX.Element;
13
+ /** The message box. Messages go to the open agent while one is, unless the sender picks. */
14
+ export declare function SessionComposer({ context, }: {
15
+ /**
16
+ * What the session works from, shown under the box on the left. Left out, it is the folder's
17
+ * repositories and the brief.
18
+ */
19
+ context?: ReactNode;
20
+ }): import("react").JSX.Element;
21
+ /** The artifacts pane: a tab for each thing open beside the session, drawn by its type. */
22
+ export declare function SessionArtifacts(): import("react").JSX.Element;
23
+ /** Every event of the session, or of the agent being inspected. */
24
+ export declare function SessionEvents({ onClose, }: {
25
+ /** Adds a close button to the header. */
26
+ onClose?: () => void;
27
+ }): import("react").JSX.Element;
28
+ /**
29
+ * The session's command palette: everything the default view keeps out of sight, findable by
30
+ * name. It lists a command for each artifact type that can be opened by hand, after any the
31
+ * arrangement adds for its own panes.
32
+ */
33
+ export declare function SessionPalette({ commands }: {
34
+ commands?: readonly Command[];
35
+ }): import("react").JSX.Element;
@@ -0,0 +1,74 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Copy, Users, X } from 'lucide-react';
3
+ import { CommandPalette } from '../../components/command-palette.js';
4
+ import { Button } from '../../components/ui/button.js';
5
+ import { PanelHeader, PanelTitle } from '../../components/ui/panel.js';
6
+ import { ArtifactPane } from '../artifacts/artifact-pane.js';
7
+ import { launchableArtifactTypes } from '../artifacts/artifact-types.js';
8
+ import { EventStream } from '../events/event-stream.js';
9
+ import { AgentTree } from './agent-tree.js';
10
+ import { Composer } from './composer.js';
11
+ import { Conversation } from './conversation.js';
12
+ import { useSession } from './session.js';
13
+ import { SessionContextButtons } from './session-context.js';
14
+ import { SessionRepos } from './session-repos.js';
15
+ /**
16
+ * The session's agents, as a tree. Picking one opens its timeline; event history, when it is
17
+ * open, follows along.
18
+ */
19
+ export function SessionAgents({ onClose, }) {
20
+ const session = useSession();
21
+ return (_jsxs("aside", { "aria-label": "Agents", className: "bg-sidebar flex h-full min-h-0 flex-col", children: [_jsxs(PanelHeader, { className: "pr-2", children: [_jsx(Users, { className: "text-muted-foreground size-3.5" }), _jsx(PanelTitle, { meta: session.identities.size || undefined, children: "Agents" }), onClose ? (_jsx(Button, { variant: "ghost", size: "icon-sm", className: "ml-auto", "aria-label": "Close agents", onClick: onClose, children: _jsx(X, {}) })) : null] }), _jsx(AgentTree, { root: session.root, activityState: session.activity, identities: session.identities, eventCounts: session.eventCounts, totalEventCount: session.events.length, selectedThreadId: session.openThreadId ?? session.inspected.threadId, showCounts: session.panes.events, onSelect: (threadId) => {
22
+ session.selectThread(threadId);
23
+ session.selectEvent(undefined);
24
+ session.openThread(threadId);
25
+ }, stopIn: session.runId })] }));
26
+ }
27
+ /** The conversation: the session's top level, or the open agent's own timeline. */
28
+ export function SessionConversation() {
29
+ const session = useSession();
30
+ return (_jsx(Conversation, { runId: session.runId, feed: session.feed, activity: session.activity, streaming: session.streaming, identities: session.identities, onInspect: session.inspect, onOpenArtifact: session.openArtifact, root: session.root, openThreadId: session.openThreadId, onOpenThread: session.openThread }));
31
+ }
32
+ /** The message box. Messages go to the open agent while one is, unless the sender picks. */
33
+ export function SessionComposer({ context, }) {
34
+ const session = useSession();
35
+ const { folder } = session;
36
+ return (_jsx(Composer, { runId: session.runId, identities: session.identities, disabled: session.summary.finished, showExamples: !session.feed.items.some((item) => item.kind === 'user' && !item.goal), targetThreadId: session.openThreadId, context: context ?? (_jsxs(_Fragment, { children: [folder ? (_jsx(SessionRepos, { folderId: folder.folderId, folderName: folder.name, repos: folder.repos, align: "start" })) : null, _jsx(SessionContextButtons, { feed: session.feed })] })) }));
37
+ }
38
+ /** The artifacts pane: a tab for each thing open beside the session, drawn by its type. */
39
+ export function SessionArtifacts() {
40
+ const session = useSession();
41
+ return (_jsx(ArtifactPane, { runId: session.runId, folderId: session.folder?.folderId, events: session.events, media: session.feed.media, identities: session.identities, controller: session.tabs, onReveal: session.panes.revealArtifacts, types: session.artifactTypes }));
42
+ }
43
+ /** Every event of the session, or of the agent being inspected. */
44
+ export function SessionEvents({ onClose, }) {
45
+ const session = useSession();
46
+ const { threadId, seq } = session.inspected;
47
+ return (_jsx(EventStream, { events: session.events, startedAt: session.summary.startedAt, threadId: threadId, threadLabel: session.labelFor(threadId ?? null), labelFor: session.labelFor, onClearThread: () => session.selectThread(undefined), selectedSeq: seq, onSelectSeq: session.selectEvent, title: "Event history", split: true, onClose: onClose }));
48
+ }
49
+ /**
50
+ * The session's command palette: everything the default view keeps out of sight, findable by
51
+ * name. It lists a command for each artifact type that can be opened by hand, after any the
52
+ * arrangement adds for its own panes.
53
+ */
54
+ export function SessionPalette({ commands = [] }) {
55
+ const session = useSession();
56
+ const all = [
57
+ ...commands,
58
+ ...launchableArtifactTypes(session.artifactTypes).map((type) => ({
59
+ id: type.kind,
60
+ label: `Open ${type.label.toLowerCase()}`,
61
+ icon: type.icon,
62
+ keywords: type.launcher?.keywords,
63
+ run: () => session.openArtifact(type.kind),
64
+ })),
65
+ {
66
+ id: 'copy-run-id',
67
+ label: 'Copy run ID',
68
+ icon: _jsx(Copy, {}),
69
+ keywords: 'session identifier',
70
+ run: () => void navigator.clipboard.writeText(session.runId),
71
+ },
72
+ ];
73
+ return (_jsx(CommandPalette, { open: session.panes.palette, onOpenChange: session.panes.setPalette, commands: all }));
74
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Where a session runs, in the session's title bar: on this machine or in the cloud, with a way
3
+ * to move it. It appears in the desktop app, and anywhere for a session that is on a machine.
4
+ * Give it the session as its `key` so it starts fresh when the page moves to another session.
5
+ */
6
+ export declare function SessionPlace({ runId, working }: {
7
+ runId: string;
8
+ working: boolean;
9
+ }): import("react").JSX.Element | null;