@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,174 @@
1
+ import { Schema } from 'effect';
2
+ import { agentCatalog } from '@swirls/looms/agent';
3
+ import { approvalCatalog } from '@swirls/looms/approval';
4
+ import { createModuleScope, defineEventCatalog } from '@swirls/looms/core';
5
+ const GithubAccountSchema = Schema.Struct({
6
+ login: Schema.String,
7
+ type: Schema.String,
8
+ avatarUrl: Schema.String,
9
+ });
10
+ const LinkedRepoSchema = Schema.Struct({
11
+ installationId: Schema.Finite,
12
+ owner: Schema.String,
13
+ name: Schema.String,
14
+ fullName: Schema.String,
15
+ defaultBranch: Schema.String,
16
+ private: Schema.Boolean,
17
+ });
18
+ const LessonSchema = Schema.Struct({
19
+ id: Schema.String,
20
+ text: Schema.String,
21
+ scope: Schema.optional(Schema.String),
22
+ });
23
+ export const SessionActivitySchema = Schema.Union([
24
+ Schema.Literal('working'),
25
+ Schema.Literal('needs_input'),
26
+ Schema.Literal('idle'),
27
+ Schema.Literal('error'),
28
+ ]);
29
+ export const TabKindSchema = Schema.Union([
30
+ Schema.Literal('events'),
31
+ Schema.Literal('files'),
32
+ Schema.Literal('file'),
33
+ Schema.Literal('changes'),
34
+ Schema.Literal('terminal'),
35
+ Schema.Literal('browser'),
36
+ Schema.Literal('review'),
37
+ Schema.Literal('media'),
38
+ // A kind the host draws itself, named `<namespace>:<name>`. See `CustomArtifactTabKind` in
39
+ // `@swirls/shuttle/api`, which this matches. The run keeps the tab and never looks inside it.
40
+ Schema.TemplateLiteral([Schema.String, ':', Schema.String]).check(Schema.isPattern(/^[a-z][a-z0-9-]*:[a-z0-9][a-z0-9-]*$/), Schema.isMaxLength(64)),
41
+ ]);
42
+ export const workspaceCatalog = defineEventCatalog('workspace', {
43
+ 'folder.created': Schema.Struct({
44
+ folderId: Schema.String,
45
+ name: Schema.String,
46
+ createdAt: Schema.Finite,
47
+ }),
48
+ 'folder.renamed': Schema.Struct({
49
+ folderId: Schema.String,
50
+ name: Schema.String,
51
+ }),
52
+ 'folder.archived': Schema.Struct({
53
+ folderId: Schema.String,
54
+ }),
55
+ 'folder.reordered': Schema.Struct({
56
+ folderIds: Schema.Array(Schema.String),
57
+ }),
58
+ 'folder.auto_review.set': Schema.Struct({
59
+ folderId: Schema.String,
60
+ autoReview: Schema.Union([
61
+ Schema.Literal('off'),
62
+ Schema.Literal('others'),
63
+ Schema.Literal('all'),
64
+ ]),
65
+ }),
66
+ 'github.connected': Schema.Struct({
67
+ installationId: Schema.Finite,
68
+ account: GithubAccountSchema,
69
+ }),
70
+ 'github.disconnected': Schema.Struct({
71
+ installationId: Schema.Finite,
72
+ }),
73
+ 'repo.linked': Schema.Struct({
74
+ folderId: Schema.String,
75
+ repo: LinkedRepoSchema,
76
+ }),
77
+ 'repo.unlinked': Schema.Struct({
78
+ folderId: Schema.String,
79
+ fullName: Schema.String,
80
+ }),
81
+ 'session.requested': Schema.Struct({
82
+ runId: Schema.String,
83
+ folderId: Schema.String,
84
+ goal: Schema.String,
85
+ lessons: Schema.Array(LessonSchema),
86
+ playbookVersion: Schema.Finite,
87
+ playbookRunId: Schema.NullOr(Schema.String),
88
+ definitionName: Schema.optional(Schema.String),
89
+ /** The person who started the session. Absent when Shuttle started it. */
90
+ ownerId: Schema.optional(Schema.String),
91
+ /**
92
+ * The repositories the session works on, read from its folder when it was requested. A
93
+ * personal workspace has no folders of its own to read them from.
94
+ */
95
+ repos: Schema.optional(Schema.Array(LinkedRepoSchema)),
96
+ pull: Schema.optional(Schema.Struct({
97
+ fullName: Schema.String,
98
+ number: Schema.Finite,
99
+ headSha: Schema.String,
100
+ baseSha: Schema.String,
101
+ })),
102
+ }),
103
+ /**
104
+ * A session that already exists starts being listed in this workspace: it was shared with this
105
+ * person, or made public. Carries the session as its previous listing showed it.
106
+ */
107
+ 'session.listed': Schema.Struct({
108
+ runId: Schema.String,
109
+ folderId: Schema.String,
110
+ goal: Schema.String,
111
+ title: Schema.String,
112
+ status: Schema.String,
113
+ activity: SessionActivitySchema,
114
+ createdAt: Schema.Finite,
115
+ updatedAt: Schema.Finite,
116
+ archived: Schema.Boolean,
117
+ ownerId: Schema.NullOr(Schema.String),
118
+ memberIds: Schema.Array(Schema.String),
119
+ }),
120
+ /** This workspace stops listing a session: it was unshared, or its visibility changed. */
121
+ 'session.unlisted': Schema.Struct({
122
+ runId: Schema.String,
123
+ }),
124
+ /** The owner changed who else may open the session. `memberIds` is the whole new list. */
125
+ 'session.shared': Schema.Struct({
126
+ runId: Schema.String,
127
+ memberIds: Schema.Array(Schema.String),
128
+ }),
129
+ 'session.launched': Schema.Struct({
130
+ runId: Schema.String,
131
+ }),
132
+ 'session.renamed': Schema.Struct({
133
+ runId: Schema.String,
134
+ title: Schema.String,
135
+ }),
136
+ 'session.archived': Schema.Struct({
137
+ runId: Schema.String,
138
+ }),
139
+ 'session.activity': Schema.Struct({
140
+ runId: Schema.String,
141
+ activity: SessionActivitySchema,
142
+ at: Schema.Finite,
143
+ seq: Schema.optional(Schema.Finite),
144
+ }),
145
+ 'tab.opened': Schema.Struct({
146
+ runId: Schema.String,
147
+ tabId: Schema.String,
148
+ kind: TabKindSchema,
149
+ title: Schema.String,
150
+ target: Schema.String,
151
+ at: Schema.Finite,
152
+ }),
153
+ 'tab.closed': Schema.Struct({
154
+ runId: Schema.String,
155
+ tabId: Schema.String,
156
+ }),
157
+ 'tab.reordered': Schema.Struct({
158
+ runId: Schema.String,
159
+ tabIds: Schema.Array(Schema.String),
160
+ }),
161
+ 'tab.retargeted': Schema.Struct({
162
+ runId: Schema.String,
163
+ tabId: Schema.String,
164
+ title: Schema.String,
165
+ target: Schema.String,
166
+ }),
167
+ });
168
+ export const workspaceModule = createModuleScope({
169
+ namespace: 'workspace',
170
+ protocolVersion: '1.0.0',
171
+ description: 'Folders, GitHub installs, linked repos, and session launches.',
172
+ events: workspaceCatalog,
173
+ observes: [agentCatalog, approvalCatalog],
174
+ });
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface Command {
3
+ readonly id: string;
4
+ readonly label: string;
5
+ readonly icon: ReactNode;
6
+ /** How its own shortcut reads, so the palette teaches the faster way. */
7
+ readonly shortcut?: string;
8
+ /** Extra words to find it by, beyond its label. */
9
+ readonly keywords?: string;
10
+ readonly run: () => void;
11
+ }
12
+ /** The commands whose label or keywords contain every word typed, in their given order. */
13
+ export declare function matchCommands(commands: readonly Command[], query: string): Command[];
14
+ /**
15
+ * Every pane and action the session keeps out of sight, in one searchable list. Type part of a
16
+ * name, arrow to a command, Enter to run it.
17
+ */
18
+ export declare function CommandPalette({ open, onOpenChange, commands, }: {
19
+ open: boolean;
20
+ onOpenChange: (open: boolean) => void;
21
+ commands: readonly Command[];
22
+ }): import("react").JSX.Element;
@@ -0,0 +1,66 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Search } from 'lucide-react';
3
+ import { useEffect, useMemo, useRef, useState } from 'react';
4
+ import { cn } from '../lib/cn.js';
5
+ import { Dialog, DialogContent, DialogDescription, DialogTitle } from './ui/dialog.js';
6
+ import { Kbd } from './ui/panel.js';
7
+ import { ScrollArea } from './ui/scroll-area.js';
8
+ /** The commands whose label or keywords contain every word typed, in their given order. */
9
+ export function matchCommands(commands, query) {
10
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);
11
+ return commands.filter((command) => {
12
+ const text = `${command.label} ${command.keywords ?? ''}`.toLowerCase();
13
+ return words.every((word) => text.includes(word));
14
+ });
15
+ }
16
+ /**
17
+ * Every pane and action the session keeps out of sight, in one searchable list. Type part of a
18
+ * name, arrow to a command, Enter to run it.
19
+ */
20
+ export function CommandPalette({ open, onOpenChange, commands, }) {
21
+ // Counts openings, so each one starts with an empty search.
22
+ const [wasOpen, setWasOpen] = useState(open);
23
+ const [opening, setOpening] = useState(0);
24
+ if (wasOpen !== open) {
25
+ setWasOpen(open);
26
+ if (open) {
27
+ setOpening(opening + 1);
28
+ }
29
+ }
30
+ return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { instant: true, className: "top-[18%] max-w-xl translate-y-0 gap-0 overflow-hidden p-0", children: [_jsx(DialogTitle, { className: "sr-only", children: "Commands" }), _jsx(DialogDescription, { className: "sr-only", children: "Type part of a command, then use the arrow keys and Enter to run it." }), _jsx(PaletteBody, { commands: commands, onRun: (command) => {
31
+ onOpenChange(false);
32
+ command.run();
33
+ } }, opening)] }) }));
34
+ }
35
+ function PaletteBody({ commands, onRun, }) {
36
+ const [query, setQuery] = useState('');
37
+ const [cursor, setCursor] = useState(0);
38
+ const listRef = useRef(null);
39
+ const results = useMemo(() => matchCommands(commands, query), [commands, query]);
40
+ const active = Math.min(cursor, Math.max(results.length - 1, 0));
41
+ useEffect(() => {
42
+ listRef.current?.children[active]?.scrollIntoView({ block: 'nearest' });
43
+ }, [active]);
44
+ const run = (command) => {
45
+ if (command) {
46
+ onRun(command);
47
+ }
48
+ };
49
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "flex h-11 items-center gap-2 border-b px-3.5", children: [_jsx(Search, { className: "text-muted-foreground size-4 shrink-0" }), _jsx("input", { autoFocus: true, value: query, onChange: (event) => {
50
+ setQuery(event.target.value);
51
+ setCursor(0);
52
+ }, onKeyDown: (event) => {
53
+ if (event.key === 'ArrowDown') {
54
+ event.preventDefault();
55
+ setCursor(Math.min(active + 1, results.length - 1));
56
+ }
57
+ else if (event.key === 'ArrowUp') {
58
+ event.preventDefault();
59
+ setCursor(Math.max(active - 1, 0));
60
+ }
61
+ else if (event.key === 'Enter') {
62
+ event.preventDefault();
63
+ run(results[active]);
64
+ }
65
+ }, placeholder: "Show a pane or run a command", "aria-label": "Search commands", role: "combobox", "aria-expanded": true, "aria-controls": "command-palette-results", "aria-activedescendant": results[active] ? `command-${results[active].id}` : undefined, spellCheck: false, autoComplete: "off", className: "placeholder:text-muted-foreground/70 h-full min-w-0 flex-1 bg-transparent text-[13px] outline-none" })] }), results.length === 0 ? (_jsxs("p", { className: "text-muted-foreground px-3.5 py-6 text-center text-[12px]", children: ["No command matches \u201C", query.trim(), "\u201D."] })) : (_jsx(ScrollArea, { className: "max-h-80", viewportClassName: "max-h-80", children: _jsx("ul", { ref: listRef, id: "command-palette-results", role: "listbox", className: "p-1.5", children: results.map((command, index) => (_jsxs("li", { id: `command-${command.id}`, role: "option", "aria-selected": index === active, onMouseMove: () => setCursor(index), onClick: () => run(command), className: cn('flex h-8 cursor-default items-center gap-2.5 rounded-md px-2 text-[12.5px]', index === active && 'bg-accent text-accent-foreground'), children: [_jsx("span", { className: "text-muted-foreground [&_svg]:size-3.5 [&_svg]:shrink-0", children: command.icon }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: command.label }), command.shortcut ? _jsx(Kbd, { children: command.shortcut }) : null] }, command.id))) }) }))] }));
66
+ }
@@ -0,0 +1,20 @@
1
+ import { type ReactNode } from 'react';
2
+ /**
3
+ * A virtualized list that stays pinned to its newest item while following, stops following
4
+ * when the reader scrolls up, and resumes when they return to the bottom.
5
+ */
6
+ export declare function FollowList<T>({ items, getKey, renderItem, estimateSize, overscan, follow: controlledFollow, onFollowChange, paddingStart, paddingEnd, className, viewportClassName, itemClassName, empty, }: {
7
+ items: readonly T[];
8
+ getKey: (item: T, index: number) => string | number;
9
+ renderItem: (item: T, index: number) => ReactNode;
10
+ estimateSize: number;
11
+ overscan?: number;
12
+ follow?: boolean;
13
+ onFollowChange?: (follow: boolean) => void;
14
+ paddingStart?: number;
15
+ paddingEnd?: number;
16
+ className?: string;
17
+ viewportClassName?: string;
18
+ itemClassName?: string;
19
+ empty?: ReactNode;
20
+ }): import("react").JSX.Element;
@@ -0,0 +1,98 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useVirtualizer } from '@tanstack/react-virtual';
3
+ import { ArrowDown } from 'lucide-react';
4
+ import { useCallback, useEffect, useRef, useState, } from 'react';
5
+ import { cn } from '../lib/cn.js';
6
+ import { ScrollArea } from './ui/scroll-area.js';
7
+ const FOLLOW_THRESHOLD = 24;
8
+ const USER_INPUT_WINDOW = 400;
9
+ const FOLLOW_SETTLE_MS = 50;
10
+ /**
11
+ * A virtualized list that stays pinned to its newest item while following, stops following
12
+ * when the reader scrolls up, and resumes when they return to the bottom.
13
+ */
14
+ export function FollowList({ items, getKey, renderItem, estimateSize, overscan = 8, follow: controlledFollow, onFollowChange, paddingStart = 4, paddingEnd = 4, className, viewportClassName, itemClassName, empty, }) {
15
+ const [ownFollow, setOwnFollow] = useState(true);
16
+ const follow = controlledFollow ?? ownFollow;
17
+ const parentRef = useRef(null);
18
+ const followLock = useRef(false);
19
+ const lastScrollTop = useRef(0);
20
+ const lastInputAt = useRef(Number.NEGATIVE_INFINITY);
21
+ const setFollow = useCallback((next) => {
22
+ setOwnFollow(next);
23
+ onFollowChange?.(next);
24
+ }, [onFollowChange]);
25
+ const virtualizer = useVirtualizer({
26
+ count: items.length,
27
+ getScrollElement: () => parentRef.current,
28
+ estimateSize: () => estimateSize,
29
+ overscan,
30
+ paddingStart,
31
+ paddingEnd,
32
+ // A list that follows its end starts there. Without this the first frame shows the top and
33
+ // the next one jumps to the bottom, which reads as a flash on every page that opens on a
34
+ // long list. Row heights are estimates at this point; following settles the exact spot.
35
+ initialOffset: () => follow && items.length > 0 ? paddingStart + items.length * estimateSize + paddingEnd : 0,
36
+ getItemKey: (index) => {
37
+ const item = items[index];
38
+ return item === undefined ? index : getKey(item, index);
39
+ },
40
+ // Avoid flushSync during ref measurement / follow-scroll under high event rates.
41
+ useFlushSync: false,
42
+ });
43
+ const totalSize = virtualizer.getTotalSize();
44
+ const viewportHeight = virtualizer.scrollRect?.height ?? 0;
45
+ useEffect(() => {
46
+ const el = parentRef.current;
47
+ // Content that shrank to fit (e.g. after filtering) never scrolls, so resume following here.
48
+ if (!follow && el && el.scrollHeight <= el.clientHeight + 1) {
49
+ setFollow(true);
50
+ }
51
+ if (!follow || items.length === 0) {
52
+ return () => undefined;
53
+ }
54
+ followLock.current = true;
55
+ let releaseTimer;
56
+ const rafId = requestAnimationFrame(() => {
57
+ virtualizer.scrollToIndex(items.length - 1, { align: 'end' });
58
+ releaseTimer = setTimeout(() => {
59
+ followLock.current = false;
60
+ }, FOLLOW_SETTLE_MS);
61
+ });
62
+ return () => {
63
+ cancelAnimationFrame(rafId);
64
+ clearTimeout(releaseTimer);
65
+ followLock.current = false;
66
+ };
67
+ }, [follow, items.length, setFollow, totalSize, viewportHeight, virtualizer]);
68
+ const noteInput = useCallback((event) => {
69
+ lastInputAt.current = event.timeStamp;
70
+ }, []);
71
+ const onScroll = useCallback((event) => {
72
+ const el = parentRef.current;
73
+ if (!el) {
74
+ return;
75
+ }
76
+ // Row measurement also moves scrollTop, so only an upward scroll right after reader input unfollows.
77
+ const movedUp = el.scrollTop < lastScrollTop.current - 1;
78
+ const fromReader = event.timeStamp - lastInputAt.current < USER_INPUT_WINDOW;
79
+ lastScrollTop.current = el.scrollTop;
80
+ if (followLock.current) {
81
+ return;
82
+ }
83
+ const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < FOLLOW_THRESHOLD;
84
+ if (follow && !atBottom && movedUp && fromReader) {
85
+ setFollow(false);
86
+ }
87
+ else if (!follow && atBottom) {
88
+ setFollow(true);
89
+ }
90
+ }, [follow, setFollow]);
91
+ return (_jsxs("div", { className: cn('relative min-h-0 flex-1', className), children: [_jsx(ScrollArea, { viewportRef: parentRef, className: cn('size-full', viewportClassName), onViewportScroll: onScroll, onWheel: noteInput, onTouchMove: noteInput, onPointerDown: noteInput, onKeyDown: noteInput, children: items.length === 0 && empty !== undefined ? (empty) : (_jsx("div", { className: "relative w-full", style: { height: totalSize }, children: virtualizer.getVirtualItems().map((row) => {
92
+ const item = items[row.index];
93
+ if (item === undefined) {
94
+ return null;
95
+ }
96
+ return (_jsx("div", { "data-index": row.index, ref: virtualizer.measureElement, className: cn('absolute top-0 left-0 w-full', itemClassName), style: { transform: `translateY(${row.start}px)` }, children: renderItem(item, row.index) }, row.key));
97
+ }) })) }), !follow && items.length > 0 ? (_jsxs("button", { type: "button", onClick: () => setFollow(true), className: "float-in bg-popover/95 text-foreground hover:bg-accent absolute bottom-3 left-1/2 z-20 flex h-7 -translate-x-1/2 items-center gap-1.5 rounded-full border px-3 text-[11px] font-medium shadow-lg shadow-black/30 backdrop-blur active:scale-[0.97]", children: [_jsx(ArrowDown, { className: "size-3" }), "Jump to latest"] })) : null] }));
98
+ }
@@ -0,0 +1,11 @@
1
+ import type { JsonValue } from '@swirls/looms/core';
2
+ /**
3
+ * Collapsible, syntax-coloured JSON. Strings that hold JSON expand in place,
4
+ * wide nodes start collapsed, and very large arrays render in buckets.
5
+ */
6
+ export declare function JsonTree({ value, defaultExpandDepth, copyable, className, }: {
7
+ value: JsonValue;
8
+ defaultExpandDepth?: number;
9
+ copyable?: boolean;
10
+ className?: string;
11
+ }): import("react").JSX.Element;
@@ -0,0 +1,120 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check, ChevronRight, Copy } from 'lucide-react';
3
+ import { memo, useMemo, useState } from 'react';
4
+ import { cn } from '../lib/cn.js';
5
+ import { jsonEntries, jsonNode, jsonPreview, parseStructuredJson } from '../lib/json.js';
6
+ /** Children past this count render in collapsed buckets so huge arrays never flood the DOM. */
7
+ const CHUNK_SIZE = 100;
8
+ /** Nodes wider than this start collapsed even inside the default expand depth. */
9
+ const AUTO_EXPAND_LIMIT = 50;
10
+ const STRING_CLAMP = 320;
11
+ function Chevron({ open }) {
12
+ return (_jsx(ChevronRight, { "aria-hidden": true, className: cn('ease-snappy size-3 transition-transform duration-100', open && 'rotate-90') }));
13
+ }
14
+ function Key({ name, index }) {
15
+ if (name === undefined) {
16
+ return null;
17
+ }
18
+ return (_jsxs("span", { className: cn('mr-1 shrink-0', index ? 'text-muted-foreground' : 'text-json-key'), children: [name, _jsx("span", { className: "text-muted-foreground", children: ":" })] }));
19
+ }
20
+ function StringValue({ value }) {
21
+ const [expanded, setExpanded] = useState(false);
22
+ const clamped = !expanded && value.length > STRING_CLAMP;
23
+ const shown = clamped ? value.slice(0, STRING_CLAMP) : value;
24
+ return (_jsxs("span", { className: "text-json-string", children: ["\"", shown, clamped ? (_jsxs("button", { type: "button", className: "text-muted-foreground hover:text-foreground ml-0.5 rounded-sm px-0.5 hover:underline", onClick: () => setExpanded(true), children: ["\u2026+", value.length - STRING_CLAMP] })) : null, "\""] }));
25
+ }
26
+ function Scalar({ node }) {
27
+ switch (node.kind) {
28
+ case 'string':
29
+ return _jsx(StringValue, { value: node.value });
30
+ case 'number':
31
+ return _jsx("span", { className: "text-json-number", children: String(node.value) });
32
+ case 'boolean':
33
+ return _jsx("span", { className: "text-json-boolean", children: String(node.value) });
34
+ case 'null':
35
+ return _jsx("span", { className: "text-json-null italic", children: "null" });
36
+ case 'object':
37
+ return _jsx("span", { className: "text-muted-foreground", children: '{}' });
38
+ case 'array':
39
+ return _jsx("span", { className: "text-muted-foreground", children: "[]" });
40
+ default: {
41
+ const exhaustive = node;
42
+ return exhaustive;
43
+ }
44
+ }
45
+ }
46
+ /** Leaf values flow inline so long strings wrap beneath their key instead of in a narrow column. */
47
+ function Leaf({ children, className }) {
48
+ return (_jsx("div", { className: cn('py-px pl-4 break-words whitespace-pre-wrap', className), children: children }));
49
+ }
50
+ function Branch({ label, summary, defaultOpen, children, }) {
51
+ const [open, setOpen] = useState(defaultOpen);
52
+ const [deep, setDeep] = useState(false);
53
+ const [generation, setGeneration] = useState(0);
54
+ function toggle(event) {
55
+ const next = !open;
56
+ setOpen(next);
57
+ // Alt-click opens or closes the whole subtree, like browser devtools.
58
+ if (event.altKey) {
59
+ setDeep(next);
60
+ setGeneration((value) => value + 1);
61
+ }
62
+ }
63
+ return (_jsxs("div", { children: [_jsxs("button", { type: "button", "aria-expanded": open, onClick: toggle, className: "hover:bg-accent/50 group/branch -mx-1 flex w-[calc(100%+0.5rem)] min-w-0 items-start gap-1 rounded-sm px-1 py-px text-left", children: [_jsx("span", { className: "text-muted-foreground group-hover/branch:text-foreground flex h-5 w-3 shrink-0 items-center", children: _jsx(Chevron, { open: open }) }), label, _jsx("span", { className: "text-muted-foreground min-w-0 truncate", children: summary })] }), open ? (_jsx("div", { className: "border-border/70 ml-1.5 border-l pl-2.5", children: children(deep) }, generation)) : null] }));
64
+ }
65
+ function Children({ node, depth, options, forceOpen, }) {
66
+ const entries = jsonEntries(node);
67
+ const index = node.kind === 'array';
68
+ if (entries.length <= CHUNK_SIZE) {
69
+ return entries.map(([key, value]) => (_jsx(Entry, { name: key, index: index, value: value, depth: depth, options: options, forceOpen: forceOpen }, key)));
70
+ }
71
+ const chunks = [];
72
+ for (let start = 0; start < entries.length; start += CHUNK_SIZE) {
73
+ chunks.push(entries.slice(start, start + CHUNK_SIZE));
74
+ }
75
+ return chunks.map((chunk, chunkIndex) => {
76
+ const first = chunkIndex * CHUNK_SIZE;
77
+ const last = first + chunk.length - 1;
78
+ return (_jsx(Branch, { defaultOpen: forceOpen, label: _jsxs("span", { className: "text-muted-foreground shrink-0", children: ["[", first, " \u2026 ", last, "]"] }), summary: null, children: (deep) => chunk.map(([key, value]) => (_jsx(Entry, { name: key, index: index, value: value, depth: depth, options: options, forceOpen: deep }, key))) }, first));
79
+ });
80
+ }
81
+ const Entry = memo(function Entry({ name, index = false, value, depth, options, forceOpen = false, }) {
82
+ const node = useMemo(() => jsonNode(value), [value]);
83
+ const embedded = useMemo(() => (node.kind === 'string' ? parseStructuredJson(node.value) : undefined), [node]);
84
+ const branch = embedded !== undefined
85
+ ? jsonNode(embedded)
86
+ : node.kind === 'object' || node.kind === 'array'
87
+ ? node
88
+ : undefined;
89
+ const size = branch ? jsonEntries(branch).length : 0;
90
+ if (!branch || size === 0) {
91
+ return (_jsxs(Leaf, { children: [_jsx(Key, { name: name, index: index }), _jsx(Scalar, { node: branch ?? node })] }));
92
+ }
93
+ const defaultOpen = forceOpen ||
94
+ (embedded === undefined && depth < options.defaultExpandDepth && size <= AUTO_EXPAND_LIMIT);
95
+ return (_jsx(Branch, { defaultOpen: defaultOpen, label: _jsxs(_Fragment, { children: [_jsx(Key, { name: name, index: index }), embedded !== undefined ? (_jsx("span", { className: "border-border text-muted-foreground mt-0.5 shrink-0 rounded-sm border px-1 text-[9px] leading-3.5 uppercase", title: "String containing JSON", children: "json" })) : null] }), summary: jsonPreview(branch), children: (deep) => _jsx(Children, { node: branch, depth: depth + 1, options: options, forceOpen: deep }) }));
96
+ });
97
+ function CopyButton({ value }) {
98
+ const [copied, setCopied] = useState(false);
99
+ return (_jsx("button", { type: "button", "aria-label": "Copy JSON", className: "text-muted-foreground hover:text-foreground bg-card/90 hover:bg-accent border-border absolute top-0 right-0 flex size-6 items-center justify-center rounded-md border opacity-0 transition-opacity duration-150 group-hover/json:opacity-100 focus-visible:opacity-100", onClick: () => {
100
+ void navigator.clipboard
101
+ .writeText(JSON.stringify(value, null, 2))
102
+ .then(() => setCopied(true));
103
+ }, onPointerLeave: () => setCopied(false), children: copied ? _jsx(Check, { className: "size-3" }) : _jsx(Copy, { className: "size-3" }) }));
104
+ }
105
+ /**
106
+ * Collapsible, syntax-coloured JSON. Strings that hold JSON expand in place,
107
+ * wide nodes start collapsed, and very large arrays render in buckets.
108
+ */
109
+ export function JsonTree({ value, defaultExpandDepth = 1, copyable = true, className, }) {
110
+ const options = useMemo(() => ({ defaultExpandDepth }), [defaultExpandDepth]);
111
+ const { root, source } = useMemo(() => {
112
+ const node = jsonNode(value);
113
+ const embedded = node.kind === 'string' ? parseStructuredJson(node.value) : undefined;
114
+ return embedded !== undefined
115
+ ? { root: jsonNode(embedded), source: embedded }
116
+ : { root: node, source: value };
117
+ }, [value]);
118
+ const hasChildren = (root.kind === 'object' || root.kind === 'array') && jsonEntries(root).length > 0;
119
+ return (_jsxs("div", { className: cn('group/json relative min-w-0 font-mono text-[11px] leading-5', className), children: [hasChildren ? (_jsx(Children, { node: root, depth: 0, options: options, forceOpen: false })) : (_jsx(Leaf, { className: "pl-0", children: _jsx(Scalar, { node: root }) })), copyable ? _jsx(CopyButton, { value: source }) : null] }));
120
+ }
@@ -0,0 +1,5 @@
1
+ /** Agent output is markdown; render it with the conversation's type scale. */
2
+ export declare const Markdown: import("react").MemoExoticComponent<({ text, className, }: {
3
+ text: string;
4
+ className?: string;
5
+ }) => import("react").JSX.Element>;
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { memo } from 'react';
3
+ import ReactMarkdown, {} from 'react-markdown';
4
+ import remarkGfm from 'remark-gfm';
5
+ import { cn } from '../lib/cn.js';
6
+ const components = {
7
+ p: ({ node: _node, ...props }) => _jsx("p", { className: "my-2 first:mt-0 last:mb-0", ...props }),
8
+ h1: ({ node: _node, ...props }) => (_jsx("h3", { className: "text-foreground mt-4 mb-1.5 text-sm font-semibold first:mt-0", ...props })),
9
+ h2: ({ node: _node, ...props }) => (_jsx("h3", { className: "text-foreground mt-4 mb-1.5 text-sm font-semibold first:mt-0", ...props })),
10
+ h3: ({ node: _node, ...props }) => (_jsx("h4", { className: "text-foreground mt-3 mb-1 text-[13px] font-semibold first:mt-0", ...props })),
11
+ h4: ({ node: _node, ...props }) => (_jsx("h4", { className: "text-foreground mt-3 mb-1 text-[13px] font-semibold first:mt-0", ...props })),
12
+ strong: ({ node: _node, ...props }) => (_jsx("strong", { className: "text-foreground font-semibold", ...props })),
13
+ a: ({ node: _node, ...props }) => (_jsx("a", { className: "text-brand underline-offset-2 hover:underline", target: "_blank", rel: "noreferrer", ...props })),
14
+ ul: ({ node: _node, ...props }) => (_jsx("ul", { className: "marker:text-muted-foreground my-2 list-disc space-y-1 pl-5", ...props })),
15
+ ol: ({ node: _node, ...props }) => (_jsx("ol", { className: "marker:text-muted-foreground my-2 list-decimal space-y-1 pl-5", ...props })),
16
+ li: ({ node: _node, ...props }) => _jsx("li", { className: "pl-0.5", ...props }),
17
+ blockquote: ({ node: _node, ...props }) => (_jsx("blockquote", { className: "text-muted-foreground my-2 border-l-2 pl-3", ...props })),
18
+ hr: () => _jsx("hr", { className: "my-3" }),
19
+ pre: ({ node: _node, ...props }) => (_jsx("pre", { className: "my-2 overflow-x-auto rounded-lg border bg-black/25 p-3 font-mono text-[12px] leading-relaxed [&_code]:bg-transparent [&_code]:p-0", ...props })),
20
+ code: ({ node: _node, className, ...props }) => (_jsx("code", { className: cn('text-foreground rounded bg-white/6 px-1 py-px font-mono text-[0.88em]', className), ...props })),
21
+ table: ({ node: _node, ...props }) => (_jsx("div", { className: "my-2 overflow-x-auto rounded-lg border", children: _jsx("table", { className: "w-full text-xs", ...props }) })),
22
+ th: ({ node: _node, ...props }) => (_jsx("th", { className: "bg-card border-b px-2.5 py-1.5 text-left font-medium", ...props })),
23
+ td: ({ node: _node, ...props }) => (_jsx("td", { className: "border-b px-2.5 py-1.5 align-top [tr:last-child_&]:border-b-0", ...props })),
24
+ };
25
+ const remarkPlugins = [remarkGfm];
26
+ /** Agent output is markdown; render it with the conversation's type scale. */
27
+ export const Markdown = memo(function Markdown({ text, className, }) {
28
+ return (_jsx("div", { className: cn('break-words', className), children: _jsx(ReactMarkdown, { remarkPlugins: remarkPlugins, components: components, children: text }) }));
29
+ });
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The Shuttle mark: two weft threads woven over and under two warp threads. The warp takes the
3
+ * current text color; the weft the shuttle lays is the brand blue.
4
+ */
5
+ export declare function ShuttleMark({ className }: {
6
+ className?: string;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ /**
4
+ * The Shuttle mark: two weft threads woven over and under two warp threads. The warp takes the
5
+ * current text color; the weft the shuttle lays is the brand blue.
6
+ */
7
+ export function ShuttleMark({ className }) {
8
+ return (_jsxs("svg", { viewBox: "4 4 40 40", fill: "currentColor", "aria-hidden": true, className: cn('shrink-0', className), children: [_jsxs("g", { children: [_jsx("rect", { x: "11.5", y: "5", width: "9", height: "20.5", rx: "2.25" }), _jsx("rect", { x: "11.5", y: "38.5", width: "9", height: "4.5", rx: "2.25" }), _jsx("rect", { x: "27.5", y: "5", width: "9", height: "4.5", rx: "2.25" }), _jsx("rect", { x: "27.5", y: "22.5", width: "9", height: "20.5", rx: "2.25" })] }), _jsxs("g", { className: "fill-brand", children: [_jsx("rect", { x: "5", y: "11.5", width: "4.5", height: "9", rx: "2.25" }), _jsx("rect", { x: "22.5", y: "11.5", width: "20.5", height: "9", rx: "2.25" }), _jsx("rect", { x: "5", y: "27.5", width: "20.5", height: "9", rx: "2.25" }), _jsx("rect", { x: "38.5", y: "27.5", width: "4.5", height: "9", rx: "2.25" })] })] }));
9
+ }
@@ -0,0 +1,9 @@
1
+ /** Thread and header indicator; only genuinely executing work animates. */
2
+ export declare function StatusDot({ status, className }: {
3
+ status: string;
4
+ className?: string;
5
+ }): import("react").JSX.Element;
6
+ export declare function StatusBadge({ status, className }: {
7
+ status: string;
8
+ className?: string;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ import { statusClass, statusDotClass, statusLabel, statusTone } from './status.js';
4
+ /** Thread and header indicator; only genuinely executing work animates. */
5
+ export function StatusDot({ status, className }) {
6
+ const tone = statusTone(status);
7
+ switch (tone) {
8
+ case 'running':
9
+ return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, className: cn('text-status-running spinner-ring size-3 shrink-0', className), children: [_jsx("circle", { cx: "8", cy: "8", r: "5.5", stroke: "currentColor", strokeOpacity: "0.22", strokeWidth: "1.75" }), _jsx("path", { d: "M8 2.5a5.5 5.5 0 0 1 5.5 5.5", stroke: "currentColor", strokeWidth: "1.75", strokeLinecap: "round" })] }));
10
+ case 'waiting':
11
+ return (_jsxs("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, className: cn('text-status-waiting size-3 shrink-0', className), children: [_jsx("circle", { cx: "8", cy: "8", r: "5.75", stroke: "currentColor", strokeOpacity: "0.6", strokeWidth: "1.5" }), _jsx("circle", { cx: "8", cy: "8", r: "2.65", fill: "currentColor" })] }));
12
+ case 'delegating':
13
+ return (_jsx("span", { "aria-hidden": true, className: cn('border-status-running/60 inline-block size-2 shrink-0 rounded-full border-[1.5px]', className) }));
14
+ case 'idle':
15
+ return (_jsx("span", { "aria-hidden": true, className: cn('border-muted-foreground/45 inline-block size-2 shrink-0 rounded-full border', className) }));
16
+ case 'completed':
17
+ case 'failed':
18
+ return _jsx("span", { "aria-hidden": true, className: cn(statusDotClass(status), className) });
19
+ default: {
20
+ const exhaustive = tone;
21
+ return exhaustive;
22
+ }
23
+ }
24
+ }
25
+ export function StatusBadge({ status, className }) {
26
+ return (_jsxs("span", { className: cn('inline-flex h-5 shrink-0 items-center gap-1.5 rounded-full bg-current/10 px-2 text-[11px] font-medium', statusClass(status), className), children: [_jsx(StatusDot, { status: status }), statusLabel(status)] }));
27
+ }
@@ -0,0 +1,6 @@
1
+ export type StatusTone = 'running' | 'delegating' | 'waiting' | 'completed' | 'failed' | 'idle';
2
+ export declare function statusTone(status: string): StatusTone;
3
+ export declare function statusLabel(status: string): string;
4
+ export declare function statusClass(status: string): string;
5
+ export declare function statusDotClass(status: string): string;
6
+ export declare function isLive(status: string): boolean;