@molecule/app-ide-panel-logic 0.0.0-stage → 0.0.1-stage

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 (147) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +2925 -2
  3. package/dist/chatTimelineOrdering.d.ts +50 -0
  4. package/dist/chatTimelineOrdering.d.ts.map +1 -0
  5. package/dist/chatTimelineOrdering.js +46 -0
  6. package/dist/chatTimelineOrdering.js.map +1 -0
  7. package/dist/command-metadata.d.ts +117 -0
  8. package/dist/command-metadata.d.ts.map +1 -0
  9. package/dist/command-metadata.js +271 -0
  10. package/dist/command-metadata.js.map +1 -0
  11. package/dist/components/activity-utilities.d.ts +107 -0
  12. package/dist/components/activity-utilities.d.ts.map +1 -0
  13. package/dist/components/activity-utilities.js +154 -0
  14. package/dist/components/activity-utilities.js.map +1 -0
  15. package/dist/components/chat-autocommit-utilities.d.ts +172 -0
  16. package/dist/components/chat-autocommit-utilities.d.ts.map +1 -0
  17. package/dist/components/chat-autocommit-utilities.js +185 -0
  18. package/dist/components/chat-autocommit-utilities.js.map +1 -0
  19. package/dist/components/chat-card-style.d.ts +81 -0
  20. package/dist/components/chat-card-style.d.ts.map +1 -0
  21. package/dist/components/chat-card-style.js +78 -0
  22. package/dist/components/chat-card-style.js.map +1 -0
  23. package/dist/components/chat-commands.d.ts +17 -0
  24. package/dist/components/chat-commands.d.ts.map +1 -0
  25. package/dist/components/chat-commands.js +17 -0
  26. package/dist/components/chat-commands.js.map +1 -0
  27. package/dist/components/chat-commit-utilities.d.ts +29 -0
  28. package/dist/components/chat-commit-utilities.d.ts.map +1 -0
  29. package/dist/components/chat-commit-utilities.js +31 -0
  30. package/dist/components/chat-commit-utilities.js.map +1 -0
  31. package/dist/components/chat-cost-utilities.d.ts +62 -0
  32. package/dist/components/chat-cost-utilities.d.ts.map +1 -0
  33. package/dist/components/chat-cost-utilities.js +66 -0
  34. package/dist/components/chat-cost-utilities.js.map +1 -0
  35. package/dist/components/chat-effort-utilities.d.ts +104 -0
  36. package/dist/components/chat-effort-utilities.d.ts.map +1 -0
  37. package/dist/components/chat-effort-utilities.js +99 -0
  38. package/dist/components/chat-effort-utilities.js.map +1 -0
  39. package/dist/components/chat-help-utilities.d.ts +89 -0
  40. package/dist/components/chat-help-utilities.d.ts.map +1 -0
  41. package/dist/components/chat-help-utilities.js +131 -0
  42. package/dist/components/chat-help-utilities.js.map +1 -0
  43. package/dist/components/chat-model-mode-utilities.d.ts +169 -0
  44. package/dist/components/chat-model-mode-utilities.d.ts.map +1 -0
  45. package/dist/components/chat-model-mode-utilities.js +221 -0
  46. package/dist/components/chat-model-mode-utilities.js.map +1 -0
  47. package/dist/components/chat-models-utilities.d.ts +162 -0
  48. package/dist/components/chat-models-utilities.d.ts.map +1 -0
  49. package/dist/components/chat-models-utilities.js +302 -0
  50. package/dist/components/chat-models-utilities.js.map +1 -0
  51. package/dist/components/chat-report-utilities.d.ts +149 -0
  52. package/dist/components/chat-report-utilities.d.ts.map +1 -0
  53. package/dist/components/chat-report-utilities.js +151 -0
  54. package/dist/components/chat-report-utilities.js.map +1 -0
  55. package/dist/components/chat-scripts-utilities.d.ts +185 -0
  56. package/dist/components/chat-scripts-utilities.d.ts.map +1 -0
  57. package/dist/components/chat-scripts-utilities.js +199 -0
  58. package/dist/components/chat-scripts-utilities.js.map +1 -0
  59. package/dist/components/chat-settings-utilities.d.ts +72 -0
  60. package/dist/components/chat-settings-utilities.d.ts.map +1 -0
  61. package/dist/components/chat-settings-utilities.js +56 -0
  62. package/dist/components/chat-settings-utilities.js.map +1 -0
  63. package/dist/components/chat-share-utilities.d.ts +110 -0
  64. package/dist/components/chat-share-utilities.d.ts.map +1 -0
  65. package/dist/components/chat-share-utilities.js +90 -0
  66. package/dist/components/chat-share-utilities.js.map +1 -0
  67. package/dist/components/chat-skills-utilities.d.ts +242 -0
  68. package/dist/components/chat-skills-utilities.d.ts.map +1 -0
  69. package/dist/components/chat-skills-utilities.js +433 -0
  70. package/dist/components/chat-skills-utilities.js.map +1 -0
  71. package/dist/components/chat-stream-utilities.d.ts +74 -0
  72. package/dist/components/chat-stream-utilities.d.ts.map +1 -0
  73. package/dist/components/chat-stream-utilities.js +103 -0
  74. package/dist/components/chat-stream-utilities.js.map +1 -0
  75. package/dist/components/chat-timestamps-utilities.d.ts +123 -0
  76. package/dist/components/chat-timestamps-utilities.d.ts.map +1 -0
  77. package/dist/components/chat-timestamps-utilities.js +177 -0
  78. package/dist/components/chat-timestamps-utilities.js.map +1 -0
  79. package/dist/components/chat-tips-utilities.d.ts +108 -0
  80. package/dist/components/chat-tips-utilities.d.ts.map +1 -0
  81. package/dist/components/chat-tips-utilities.js +137 -0
  82. package/dist/components/chat-tips-utilities.js.map +1 -0
  83. package/dist/components/device-cycle.d.ts +84 -0
  84. package/dist/components/device-cycle.d.ts.map +1 -0
  85. package/dist/components/device-cycle.js +77 -0
  86. package/dist/components/device-cycle.js.map +1 -0
  87. package/dist/components/fileExplorerPersistence.d.ts +50 -0
  88. package/dist/components/fileExplorerPersistence.d.ts.map +1 -0
  89. package/dist/components/fileExplorerPersistence.js +63 -0
  90. package/dist/components/fileExplorerPersistence.js.map +1 -0
  91. package/dist/components/search-utilities.d.ts +15 -0
  92. package/dist/components/search-utilities.d.ts.map +1 -0
  93. package/dist/components/search-utilities.js +26 -0
  94. package/dist/components/search-utilities.js.map +1 -0
  95. package/dist/components/tests-bar-utilities.d.ts +106 -0
  96. package/dist/components/tests-bar-utilities.d.ts.map +1 -0
  97. package/dist/components/tests-bar-utilities.js +167 -0
  98. package/dist/components/tests-bar-utilities.js.map +1 -0
  99. package/dist/components/tests-card-utilities.d.ts +280 -0
  100. package/dist/components/tests-card-utilities.d.ts.map +1 -0
  101. package/dist/components/tests-card-utilities.js +591 -0
  102. package/dist/components/tests-card-utilities.js.map +1 -0
  103. package/dist/components/tool-call-utilities.d.ts +256 -0
  104. package/dist/components/tool-call-utilities.d.ts.map +1 -0
  105. package/dist/components/tool-call-utilities.js +1004 -0
  106. package/dist/components/tool-call-utilities.js.map +1 -0
  107. package/dist/components/user-avatar-utilities.d.ts +41 -0
  108. package/dist/components/user-avatar-utilities.d.ts.map +1 -0
  109. package/dist/components/user-avatar-utilities.js +56 -0
  110. package/dist/components/user-avatar-utilities.js.map +1 -0
  111. package/dist/components/workspace-layout-utilities.d.ts +37 -0
  112. package/dist/components/workspace-layout-utilities.d.ts.map +1 -0
  113. package/dist/components/workspace-layout-utilities.js +58 -0
  114. package/dist/components/workspace-layout-utilities.js.map +1 -0
  115. package/dist/customEventCards.d.ts +147 -0
  116. package/dist/customEventCards.d.ts.map +1 -0
  117. package/dist/customEventCards.js +36 -0
  118. package/dist/customEventCards.js.map +1 -0
  119. package/dist/icon-names.d.ts +26 -0
  120. package/dist/icon-names.d.ts.map +1 -0
  121. package/dist/icon-names.js +14 -0
  122. package/dist/icon-names.js.map +1 -0
  123. package/dist/index.d.ts +51 -0
  124. package/dist/index.d.ts.map +1 -0
  125. package/dist/index.js +51 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/keyboard-shortcut-utilities.d.ts +63 -0
  128. package/dist/keyboard-shortcut-utilities.d.ts.map +1 -0
  129. package/dist/keyboard-shortcut-utilities.js +100 -0
  130. package/dist/keyboard-shortcut-utilities.js.map +1 -0
  131. package/dist/panels.d.ts +26 -0
  132. package/dist/panels.d.ts.map +1 -0
  133. package/dist/panels.js +26 -0
  134. package/dist/panels.js.map +1 -0
  135. package/dist/settings-metadata.d.ts +78 -0
  136. package/dist/settings-metadata.d.ts.map +1 -0
  137. package/dist/settings-metadata.js +137 -0
  138. package/dist/settings-metadata.js.map +1 -0
  139. package/dist/types.d.ts +588 -0
  140. package/dist/types.d.ts.map +1 -0
  141. package/dist/types.js +9 -0
  142. package/dist/types.js.map +1 -0
  143. package/dist/viewport-queries.d.ts +19 -0
  144. package/dist/viewport-queries.d.ts.map +1 -0
  145. package/dist/viewport-queries.js +19 -0
  146. package/dist/viewport-queries.js.map +1 -0
  147. package/package.json +74 -4
package/README.md CHANGED
@@ -1,3 +1,2926 @@
1
- # Temporary Holding Version
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-15T09:36:01.966Z
7
+ -->
2
8
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
9
+ # @molecule/app-ide-panel-logic
10
+
11
+ `@molecule/app-ide-panel-logic` — the framework-neutral logic of the IDE
12
+ panels (chat, preview, file explorer, tests): command and settings metadata,
13
+ the custom-event-card registry, and the pure helper modules behind the
14
+ `@molecule/app-ide-react` components. Every framework's IDE package imports
15
+ (and React's re-exports) this exact set, so the logic exists once.
16
+
17
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
18
+ > It is written to be read by coding agents as much as by people, and is generated from this
19
+ > package's source — edit `src/index.ts` JSDoc, not this file.
20
+
21
+ ## Quick Start
22
+
23
+ ```ts
24
+ import { t } from '@molecule/app-i18n'
25
+ import { COMMANDS, registerCustomEventCard } from '@molecule/app-ide-panel-logic'
26
+
27
+ // Read the shared slash-command registry (same array the API prompt reads).
28
+ const share = COMMANDS.find((command) => command.id === 'share')
29
+
30
+ // Register an app-specific chat card once; every framework's IDE package
31
+ // sees it because the registry lives in this package.
32
+ registerCustomEventCard('build_degraded', () => ({
33
+ text: t('app.buildDegraded', undefined, { defaultValue: 'This build ran on a smaller model.' }),
34
+ tone: 'upgrade',
35
+ action: { label: t('app.upgrade', undefined, { defaultValue: 'Upgrade' }), href: '/pricing' },
36
+ }))
37
+ ```
38
+
39
+ ## Type
40
+
41
+ `feature`
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ npm install @molecule/app-ide-panel-logic @molecule/app-ai-chat @molecule/app-ai-models @molecule/app-code-editor @molecule/app-i18n @molecule/app-icons @molecule/app-ide @molecule/app-live-preview @molecule/app-storage
47
+ ```
48
+
49
+ ## API
50
+
51
+ ### Interfaces
52
+
53
+ #### `CommandCategory`
54
+
55
+ A command category with its display label.
56
+
57
+ ```typescript
58
+ interface CommandCategory {
59
+ /** Stable category key referenced by {@link CommandDef.category}. */
60
+ key: CommandCategoryKey
61
+ /** Human-readable category heading (English default; wrapped in `t()` at render). */
62
+ label: string
63
+ }
64
+ ```
65
+
66
+ #### `CommandDef`
67
+
68
+ Metadata describing a single slash command.
69
+
70
+ ```typescript
71
+ interface CommandDef {
72
+ /** Command id (the part after the slash, e.g. `'help'`). */
73
+ id: string
74
+ /** Display label including the leading slash (e.g. `'/help'`). */
75
+ label: string
76
+ /**
77
+ * Short description shown in the menu and in `/help` (English default). May
78
+ * contain the `{{agentName}}` interpolation token, filled in by the render
79
+ * sites (command menu, `/help`, `/settings` card) from the host's agent
80
+ * identity (neutral default: "the assistant").
81
+ */
82
+ description: string
83
+ /** Category this command is grouped under. */
84
+ category: CommandCategoryKey
85
+ /**
86
+ * Argument syntax for commands that take options, shown in the `/settings`
87
+ * command reference (English default). `[…]` = optional, `<…>` = required.
88
+ * Omit for commands that take no arguments.
89
+ */
90
+ usage?: string
91
+ /**
92
+ * Alternate short forms (WITHOUT the slash) that also invoke this command —
93
+ * e.g. `['t']` lets `/t <message>` invoke `/teamsay`. Matched by the chat
94
+ * input's command dispatch alongside {@link id}.
95
+ */
96
+ aliases?: string[]
97
+ /**
98
+ * True for a human-only side-channel command handled by the HOST's server
99
+ * (e.g. a team-chat note the agent never sees): the raw `/command` text is
100
+ * sent to the backend, but NO optimistic user bubble is rendered — the server
101
+ * emits the canonical `message` stream event (see the `ChatStreamEvent`
102
+ * union), which IS the visible message, persisted and fanned out live to
103
+ * every project member.
104
+ */
105
+ sideChannel?: boolean
106
+ /**
107
+ * True for commands a read-only project VIEWER may run — the ones that only
108
+ * read, open a view-only surface, or set a per-user/per-device preference
109
+ * (`/cost`, `/settings`, `/help`, `/mic`, …). Everything else writes shared
110
+ * project state or triggers a Synthase turn (which the server 403s for a
111
+ * viewer), so it is **default-denied** for viewers: omitting this flag means a
112
+ * viewer cannot run the command, which is the safe default for any command
113
+ * added later. Host side-channel commands (`sideChannel`, e.g. `/teamsay`) are
114
+ * team communication, not project mutation — they set this so viewers can talk.
115
+ */
116
+ viewerSafe?: boolean
117
+ }
118
+ ```
119
+
120
+ #### `CommandGroup`
121
+
122
+ A category paired with the commands that belong to it.
123
+
124
+ ```typescript
125
+ interface CommandGroup {
126
+ /** The category metadata (key + label). */
127
+ category: CommandCategory
128
+ /** Commands in this category, in registry order. */
129
+ commands: CommandDef[]
130
+ }
131
+ ```
132
+
133
+ #### `Activity`
134
+
135
+ A single captured activity. Mirrors the SSE `activity.activity` payload; the
136
+ REST list endpoint additionally returns `payload` and `result` for the
137
+ expanded detail view.
138
+
139
+ ```typescript
140
+ interface Activity {
141
+ id: string
142
+ type: ActivityType
143
+ status: ActivityStatus
144
+ recipient?: string
145
+ summary?: string
146
+ /** ISO 8601 timestamp. */
147
+ timestamp: string
148
+ /** Full captured payload — only present on the REST detail response (dev only). */
149
+ payload?: unknown
150
+ /** Provider result / synthetic success record — only present on the REST detail response. */
151
+ result?: unknown
152
+ }
153
+ ```
154
+
155
+ #### `AutoCommitState`
156
+
157
+ The countdown's state.
158
+
159
+ `intervalSeconds` is the configured cadence (`0` = disabled). `remaining` is
160
+ the live count: a positive number while counting down, `0` at the instant a
161
+ commit is due, and `null` while disabled or paused (after a commit, awaiting
162
+ the next file change to re-arm).
163
+
164
+ ```typescript
165
+ interface AutoCommitState {
166
+ /** Configured countdown length in seconds; `0` when auto-commit is off. */
167
+ intervalSeconds: number
168
+ /** Seconds left until the next auto-commit; `null` when disabled or paused. */
169
+ remaining: number | null
170
+ }
171
+ ```
172
+
173
+ #### `ChatCardStyle`
174
+
175
+ A chat info card's container chrome, as React's `style` takes it (a unitless
176
+ `borderRadius` is pixels).
177
+
178
+ ```typescript
179
+ interface ChatCardStyle {
180
+ /** Inner padding. */
181
+ padding: string
182
+ /** Corner radius in pixels. */
183
+ borderRadius: number
184
+ /** The 1px tinted frame on all sides. */
185
+ border: string
186
+ /** The tinted background. */
187
+ background: string
188
+ }
189
+ ```
190
+
191
+ #### `ReportFormState`
192
+
193
+ The report modal's form state.
194
+
195
+ ```typescript
196
+ interface ReportFormState {
197
+ /** Short summary / issue title. */
198
+ title: string
199
+ /** Detailed description of the problem or request. */
200
+ description: string
201
+ /** Optional reproduction steps (free text). */
202
+ steps: string
203
+ /** Whether to attach the recent conversation to the report. */
204
+ includeChat: boolean
205
+ }
206
+ ```
207
+
208
+ #### `ClientInfo`
209
+
210
+ Client-side diagnostics attached to a report so triage can see the running
211
+ environment without asking the user. Every field is optional — only what
212
+ could be read in the current environment is present (see
213
+ {@link collectClientInfo}).
214
+
215
+ ```typescript
216
+ interface ClientInfo {
217
+ /** The running build version. */
218
+ appVersion?: string
219
+ /** `navigator.userAgent` (browser + OS). */
220
+ userAgent?: string
221
+ /** `navigator.platform`. */
222
+ platform?: string
223
+ /** `navigator.language`. */
224
+ language?: string
225
+ /** Inner viewport size, `${innerWidth}×${innerHeight}`. */
226
+ viewport?: string
227
+ /** Physical screen size, `${screen.width}×${screen.height}`. */
228
+ screen?: string
229
+ /** Active theme — `'light'` or `'dark'`. */
230
+ theme?: string
231
+ /** The current page URL (`window.location.href`). */
232
+ url?: string
233
+ }
234
+ ```
235
+
236
+ #### `ReportPayload`
237
+
238
+ The `POST /projects/:id/report` request body.
239
+
240
+ ```typescript
241
+ interface ReportPayload {
242
+ /** Short summary / issue title. */
243
+ title: string
244
+ /** Detailed description. */
245
+ description: string
246
+ /** Reproduction steps — omitted entirely when blank. */
247
+ steps?: string
248
+ /** Whether the backend should attach the recent conversation. */
249
+ includeChat: boolean
250
+ /** Client diagnostics — omitted entirely when none could be collected. */
251
+ clientInfo?: ClientInfo
252
+ }
253
+ ```
254
+
255
+ #### `ReportResult`
256
+
257
+ The `POST /projects/:id/report` response.
258
+
259
+ ```typescript
260
+ interface ReportResult {
261
+ /** Whether the report was recorded. */
262
+ ok: boolean
263
+ /** Link to the created issue, when one was filed. */
264
+ url?: string
265
+ /** The persisted DB row id. */
266
+ id?: string
267
+ }
268
+ ```
269
+
270
+ #### `SharePayload`
271
+
272
+ The `POST /projects/:projectId/shares` request body.
273
+
274
+ ```typescript
275
+ interface SharePayload {
276
+ /** Role granted to anyone who opens the link. */
277
+ role: ShareRole
278
+ }
279
+ ```
280
+
281
+ #### `ShareLinkResult`
282
+
283
+ The `POST /projects/:projectId/shares` response — the created public link.
284
+ Mirrors the relevant fields of the `@molecule/api-resource-share` `ShareLink`.
285
+
286
+ ```typescript
287
+ interface ShareLinkResult {
288
+ /** The link's unique id (used by the revoke route). */
289
+ id?: string
290
+ /** Opaque slug embedded in the public URL. */
291
+ slug: string
292
+ /** The role this link grants. */
293
+ role: ShareRole
294
+ /**
295
+ * A fully-qualified share URL, when the backend supplies one. Preferred over
296
+ * client-side construction so the canonical origin (e.g. a custom domain)
297
+ * wins over the current page origin.
298
+ */
299
+ url?: string
300
+ /** When the link expires, if ever (ISO 8601); absent/`null` = no expiry. */
301
+ expiresAt?: string | null
302
+ /** When the link was revoked (ISO 8601); absent/`null` = still active. */
303
+ revokedAt?: string | null
304
+ /** When the link was created (ISO 8601). */
305
+ createdAt?: string
306
+ }
307
+ ```
308
+
309
+ #### `ChatTimestampSlot`
310
+
311
+ A timeline item that can carry a timestamp, in render order.
312
+
313
+ ```typescript
314
+ interface ChatTimestampSlot {
315
+ /** The timeline item's id. */
316
+ id: string
317
+ /** Epoch milliseconds of the item. */
318
+ timestamp: number
319
+ /**
320
+ * Shown even with timestamps turned off — the user's own message headers (the
321
+ * time already fits in the header row) and critical events (a failure, a
322
+ * blocked connection, a limit that stopped work).
323
+ */
324
+ alwaysShown: boolean
325
+ }
326
+ ```
327
+
328
+ #### `DeviceDimensions`
329
+
330
+ Per-frame iframe sizing. `width`/`height` are the PORTRAIT CSS sizes; a
331
+ fixed-frame (`rotatable`) device swaps them in landscape. `'100%'` width with
332
+ a `null` height means "fluid" — fill the available preview area (responsive /
333
+ desktop have no fixed frame to rotate).
334
+
335
+ ```typescript
336
+ interface DeviceDimensions {
337
+ /** Portrait CSS width (e.g. `'768px'`, or `'100%'` for a fluid frame). */
338
+ readonly width: string
339
+ /** Portrait CSS height in px (e.g. `'1024px'`), or `null` to fill the area. */
340
+ readonly height: string | null
341
+ /** Whether the frame has a fixed size that can be rotated portrait ⇄ landscape. */
342
+ readonly rotatable: boolean
343
+ }
344
+ ```
345
+
346
+ #### `TestCaseRef`
347
+
348
+ The one test a file is on right now, named the way its runner names it.
349
+
350
+ ```typescript
351
+ interface TestCaseRef {
352
+ /** The runner's test title. */
353
+ title: string
354
+ /** Its enclosing group (`describe`), when it has one. */
355
+ describe?: string
356
+ }
357
+ ```
358
+
359
+ #### `TestCaseProgress`
360
+
361
+ What one FILE is doing while it runs: which test is on screen, and how its
362
+ own tests have gone so far. Discarded the moment the file reports a `result`
363
+ — the row's verdict pill takes over from there.
364
+
365
+ ```typescript
366
+ interface TestCaseProgress {
367
+ /** The test running right now, or `null` between tests. */
368
+ current: TestCaseRef | null
369
+ passed: number
370
+ failed: number
371
+ skipped: number
372
+ }
373
+ ```
374
+
375
+ #### `TestGroup`
376
+
377
+ One rendered group of rows: a kind within a project directory.
378
+
379
+ ```typescript
380
+ interface TestGroup {
381
+ kind: TestKind
382
+ workspace: TestWorkspace
383
+ /** The directory's name for the heading; `null` for the workspace root. */
384
+ label: string | null
385
+ items: TestItem[]
386
+ }
387
+ ```
388
+
389
+ #### `TestResultEntry`
390
+
391
+ What one test file ended as in the last run.
392
+
393
+ ```typescript
394
+ interface TestResultEntry {
395
+ status: TestStatus
396
+ durationMs?: number
397
+ passed: number
398
+ failed: number
399
+ skipped: number
400
+ /** The runner's output, kept for a FAILURE so the row can keep showing it. */
401
+ output?: string
402
+ }
403
+ ```
404
+
405
+ #### `TestsRunState`
406
+
407
+ Everything the card knows about the run it is showing.
408
+
409
+ ```typescript
410
+ interface TestsRunState {
411
+ runId: string | null
412
+ running: boolean
413
+ /** The ids the run on show covers, in run order (its private Skip candidates). */
414
+ queued: string[]
415
+ /** Files owed by ANY live covering run; row spinners use this aggregate, Skip never does. */
416
+ runningIds?: string[]
417
+ /** The id whose output is streaming right now, when the host says which. */
418
+ currentId: string | null
419
+ /** The live output lines, newest last, capped at {@link MAX_OUTPUT_LINES}. */
420
+ output: string[]
421
+ /** Per-id outcome from this run (and from earlier runs, until re-run). */
422
+ results: Record<string, TestResultEntry>
423
+ /**
424
+ * Per-id LIVE per-test progress, for the files that are running right now.
425
+ * An entry exists only between a file's first `case` event and its `result`.
426
+ */
427
+ cases: Record<string, TestCaseProgress>
428
+ /** A skip was asked for and the run has not answered it yet. */
429
+ skipPending: boolean
430
+ /**
431
+ * Skipping is not on offer: the host wired no `skipCurrent`, or it answered
432
+ * that there was nothing left to skip. The control is dropped — never
433
+ * replaced by an error the person cannot act on.
434
+ */
435
+ skipUnavailable: boolean
436
+ /** How the run ended, once it has. */
437
+ outcome: TestRunOutcome | null
438
+ /** A run-level failure message (timeout, transport error) shown in the card. */
439
+ error: string | null
440
+ startedAt: number | null
441
+ durationMs: number | null
442
+ /**
443
+ * The run on show was NOT started by this panel (the agent, the platform, or
444
+ * another tab): it can be watched but not stopped or skipped from here.
445
+ * Absent on the panel's own runs.
446
+ */
447
+ external?: boolean
448
+ /** Who started the run, when the host said. */
449
+ source?: TestRunSource | null
450
+ /** The command a run this panel did not start is running, when the host said. */
451
+ command?: string | null
452
+ }
453
+ ```
454
+
455
+ #### `TestFailure`
456
+
457
+ One failing test and the output that explains it.
458
+
459
+ ```typescript
460
+ interface TestFailure {
461
+ item: TestItem
462
+ output?: string | undefined
463
+ }
464
+ ```
465
+
466
+ #### `ChatEventCardAction`
467
+
468
+ A single call-to-action on a chat card: a labelled link (`href`) and/or click
469
+ handler. The app supplies any route/copy — the shared package never hardcodes one.
470
+
471
+ ```typescript
472
+ interface ChatEventCardAction {
473
+ /** Button label (already localized by the app). */
474
+ label: string
475
+ /** Link target. App-owned — e.g. the host's own pricing/auth route. */
476
+ href?: string
477
+ /** Click handler (alternative to, or alongside, `href`). */
478
+ onClick?: () => void
479
+ /**
480
+ * Render the action's label as inline monospace code — a command/identifier like
481
+ * `/report` or a skill name — so it stands out from prose while staying clickable.
482
+ */
483
+ code?: boolean
484
+ /**
485
+ * Semantic design-system button color. When set, the card renders this action
486
+ * as a real `cm.button` (the ClassMap's standard tinted button, same as every
487
+ * other button in the app) in this color, so a CTA looks identical wherever it
488
+ * appears — e.g. an app can keep "Sign up" `primary` and "Log in" `success`
489
+ * across its auth page, banners, and chat cards. When omitted, the card's
490
+ * legacy accent-outline treatment applies. The app owns the semantics; the
491
+ * shared package just passes the color through to the ClassMap.
492
+ */
493
+ color?: 'primary' | 'secondary' | 'success' | 'warning' | 'error' | 'info'
494
+ }
495
+ ```
496
+
497
+ #### `ChatEventCardCode`
498
+
499
+ A non-interactive inline monospace code span in a card body — a command or identifier
500
+ the prose refers to (`/report`, a skill name) that should read as code but isn't
501
+ clickable. For a _clickable_ command, use {@link ChatEventCardAction} with `code: true`.
502
+
503
+ ```typescript
504
+ interface ChatEventCardCode {
505
+ /** The code text, rendered monospaced/tinted. */
506
+ code: string
507
+ }
508
+ ```
509
+
510
+ #### `ChatEventCard`
511
+
512
+ A chat system card: a short message with an optional action (or actions). Mirrors
513
+ the system-card shape ChatPanel renders for upgrade prompts, guest reminders, etc.
514
+
515
+ ```typescript
516
+ interface ChatEventCard {
517
+ /** The card's text. */
518
+ text: string
519
+ /** An optional action button (or buttons): a link (`href`) and/or a click handler. */
520
+ action?: ChatEventCardAction | ChatEventCardAction[]
521
+ /**
522
+ * Composable inline body for a `tone` (tip) card: an ordered list of segments rendered
523
+ * in sequence — plain strings as text, {@link ChatEventCardAction}s as inline underlined
524
+ * links — so prose and links interleave freely (e.g. text → an inline link → a trailing
525
+ * period). When set, the renderer uses this INSTEAD of `text` + appended `action`s, so a
526
+ * link can sit mid-sentence rather than only at the end. Segments carry their own spacing
527
+ * (no auto-space is inserted between them). Keep `text` populated with a plain-text
528
+ * equivalent for accessibility / non-toned consumers. Only honored when `tone` is set.
529
+ */
530
+ content?: ChatEventCardSegment[]
531
+ /**
532
+ * When true, ChatPanel renders the card as a stand-out tip box rather than muted inline
533
+ * text. Prefer setting {@link ChatEventCard.tone} (which implies emphasis AND picks the
534
+ * accent colour + icon); `emphasized` without a `tone` falls back to the neutral `info`
535
+ * tone. The app opts in; the shared package never infers emphasis from a card's copy.
536
+ */
537
+ emphasized?: boolean
538
+ /**
539
+ * The card's tip TONE — picks its accent colour + default icon so every notice card
540
+ * shares ONE consistent box (icon + tinted body + a uniform 1px border + actions),
541
+ * differing only by colour/icon per kind:
542
+ * - `info` — blue, info glyph (neutral notice)
543
+ * - `gold` — amber, lightbulb (an honest tip / onboarding note)
544
+ * - `upgrade` — amber, clock (a plan/limit/budget nudge)
545
+ * - `success` — green, check (a completed action, e.g. a saved script)
546
+ * - `signup` — primary, sign-in (an auth nudge)
547
+ *
548
+ * Setting `tone` implies emphasis. Cards that supply composable {@link ChatEventCard.content}
549
+ * render their inline links in the box; cards that supply `action`(s) render them as a
550
+ * consistent row of accent buttons. Omit `tone` (and `emphasized`) for a plain muted line.
551
+ */
552
+ tone?: 'info' | 'gold' | 'upgrade' | 'success' | 'signup'
553
+ /**
554
+ * Optional icon-name override (a `@molecule/app-icons` glyph) — defaults to the tone's
555
+ * icon. Use only a name that exists in the bonded set (`getIcon` throws otherwise);
556
+ * sets with extra glyphs register them via `CustomIconNames` augmentation.
557
+ */
558
+ icon?: IconName
559
+ /**
560
+ * The limit this card already explains, named by the same `limitType` the backend puts
561
+ * on its limit errors (e.g. `'ai_cost'`). A limit is hit ONCE but can surface twice —
562
+ * as this persisted card (recorded when the turn was interrupted) and again as the live
563
+ * limit banner when the NEXT send is refused — which reads as two cards saying the same
564
+ * thing. When a live error carries the same `limitType`, ChatPanel hides this card for
565
+ * as long as that banner is up, so exactly one surface states the limit; the card
566
+ * returns as soon as the error clears. The banner is never the one suppressed: it is
567
+ * the only feedback the refused send gets, and its message can be more specific than
568
+ * the card's (a platform-capacity refusal shares `limitType` with a personal-budget
569
+ * one). The app owns the identifier; the shared package only matches it.
570
+ */
571
+ coversLimitType?: string
572
+ /**
573
+ * Marks the card as a critical event — something failed, was blocked, or stopped
574
+ * the work (a refused deploy, a blocked outbound connection). A critical card
575
+ * keeps its timestamp even while the viewer has timestamps turned off. The app
576
+ * decides; the shared package never infers criticality from a card's tone or copy.
577
+ */
578
+ critical?: boolean
579
+ }
580
+ ```
581
+
582
+ #### `SettingMeta`
583
+
584
+ Canonical, value-free metadata for a single user-controllable setting.
585
+
586
+ ```typescript
587
+ interface SettingMeta {
588
+ /** Stable id (also the i18n key suffix, e.g. `'effort'`). */
589
+ id: SettingKey
590
+ /** Human-readable label (English default; wrapped in `t()` at render). */
591
+ label: string
592
+ /**
593
+ * One-line explanation of what the setting does (English default). May
594
+ * contain the `{{agentName}}` interpolation token, filled in at render from
595
+ * the host's agent identity (neutral default: "the assistant").
596
+ */
597
+ description: string
598
+ /**
599
+ * The slash command that edits this setting client-side. Drives the inline
600
+ * "Edit" affordance and cross-links the setting to its command. Omitted only
601
+ * for read-only settings.
602
+ */
603
+ editCommand?: CommandId
604
+ /**
605
+ * The exact slash-command input to prefill when editing, for settings whose
606
+ * bare {@link SettingMeta.editCommand} is not specific enough — e.g. the
607
+ * per-mode model rows both run the `model` command but must scope it to a
608
+ * mode (`/model --plan`, `/model --execute`). Omit when running the bare
609
+ * command suffices.
610
+ */
611
+ editInput?: string
612
+ }
613
+ ```
614
+
615
+ #### `IdeClientAction`
616
+
617
+ A non-mutating UI action the AI agent asks the IDE to perform — reload or
618
+ navigate the live preview, open a file in the editor, or drive the preview's
619
+ interaction bridge (`preview_ui`). Delivered via the `client_action`
620
+ chat-stream event (and, for `preview_ui`, also via the host's collab socket
621
+ so a mid-build tab reload can't orphan it).
622
+
623
+ ```typescript
624
+ interface IdeClientAction {
625
+ action: 'reload_preview' | 'navigate_preview' | 'open_file' | 'preview_ui'
626
+ /** navigate_preview: a URL path (e.g. "/dashboard"). open_file: a file path. */
627
+ path?: string
628
+ /** preview_ui: correlates the command with its ui-result round-trip. */
629
+ requestId?: string
630
+ /** preview_ui: the interaction the preview bridge should perform. */
631
+ command?: 'snapshot' | 'click' | 'fill' | 'select' | 'waitFor'
632
+ /** preview_ui: the `data-mol-id` of the target element (preferred). */
633
+ molId?: string
634
+ /** preview_ui: CSS-selector fallback when no molId is available. */
635
+ selector?: string
636
+ /** preview_ui: visible-label match for apps whose elements carry no molId. */
637
+ text?: string
638
+ /** preview_ui: value to set for fill/select. */
639
+ value?: string
640
+ }
641
+ ```
642
+
643
+ #### `ChatUserIdentity`
644
+
645
+ Identity of the user whose avatar or name was clicked in the chat timeline,
646
+ passed to {@link ChatPanelProps.onProfileClick} so the host can open that
647
+ user's profile.
648
+
649
+ The identity is always the clicked MESSAGE AUTHOR's — a teammate's click
650
+ carries their persisted `author` fields, never the viewer's. An author-less
651
+ message (the local optimistic echo, legacy solo rows) is the signed-in user's
652
+ own, so it carries {@link ChatPanelProps.currentUserId} + the viewer's avatar.
653
+ The host compares `id` against the signed-in user to pick the surface: own →
654
+ editable profile, someone else → view-only. A missing `id` means "the
655
+ signed-in user" (author-less rows in a host that passes no `currentUserId`).
656
+
657
+ ```typescript
658
+ interface ChatUserIdentity {
659
+ /** The clicked user's stable id (a persisted `author.id`), when known. */
660
+ id?: string
661
+ /** The clicked user's display name (a persisted `author.name`), when known. */
662
+ name?: string
663
+ /** The clicked user's avatar value (data-URI / URL), if any. */
664
+ avatar?: string | null
665
+ }
666
+ ```
667
+
668
+ #### `TestItem`
669
+
670
+ One test file the host discovered in the project.
671
+
672
+ ```typescript
673
+ interface TestItem {
674
+ /** Stable id, unique across workspaces — used as the row key and to select by. */
675
+ id: string
676
+ /** Path relative to its workspace, e.g. `e2e/home.spec.ts`. */
677
+ file: string
678
+ kind: TestKind
679
+ workspace: TestWorkspace
680
+ /**
681
+ * The group's project name, ready to render: the same path as `workspace`,
682
+ * or `null` for the workspace root, which has no name of its own. Hosts that
683
+ * omit it get the path itself (and the translated "Project" for the root).
684
+ */
685
+ workspaceLabel?: string | null
686
+ /** Human label for the row; the bar falls back to the file path without one. */
687
+ title?: string
688
+ }
689
+ ```
690
+
691
+ #### `TestRunners`
692
+
693
+ Which runner drives each kind in one workspace (`null` = none installed).
694
+
695
+ ```typescript
696
+ interface TestRunners {
697
+ e2e: string | null
698
+ unit: string | null
699
+ }
700
+ ```
701
+
702
+ #### `TestList`
703
+
704
+ What {@link ChatPanelProps.listTests} resolves with.
705
+
706
+ ```typescript
707
+ interface TestList {
708
+ tests: TestItem[]
709
+ /**
710
+ * Per project directory (keyed like {@link TestItem.workspace}), the runners
711
+ * the host found. Only directories that hold a listed test appear.
712
+ */
713
+ runners: Record<string, TestRunners>
714
+ }
715
+ ```
716
+
717
+ #### `TestSelection`
718
+
719
+ What the bar asks the host to run.
720
+
721
+ ```typescript
722
+ interface TestSelection {
723
+ /** Specific {@link TestItem.id}s. Takes precedence over `kind`. */
724
+ ids?: string[]
725
+ /** Everything of this kind when no `ids` are given. */
726
+ kind?: TestKind | 'all'
727
+ }
728
+ ```
729
+
730
+ #### `TestRunHandle`
731
+
732
+ Handle to a run in flight, so the bar can stop it.
733
+
734
+ ```typescript
735
+ interface TestRunHandle {
736
+ /** Stop the run — the host aborts its stream, which cancels the work. */
737
+ cancel(): void
738
+ /**
739
+ * Skip the command the run is on right now WITHOUT ending the run: the files
740
+ * that command owned come back as `result`s with `status: 'skipped'`, and the
741
+ * run moves to the next command.
742
+ *
743
+ * Optional, because a host may not serve it. Resolving `false` means there
744
+ * was nothing to skip (the run had already moved on) — a benign race the card
745
+ * answers by dropping the control, never by showing an error.
746
+ */
747
+ skipCurrent?(): void | Promise<boolean | void>
748
+ }
749
+ ```
750
+
751
+ #### `EditorPanelProps`
752
+
753
+ Properties for the editor panel component.
754
+
755
+ ```typescript
756
+ interface EditorPanelProps {
757
+ className?: string
758
+ /**
759
+ * Render the editor read-only (Monaco `readOnly`) — for read-only project
760
+ * VIEWERS, whose file writes the server rejects anyway. Typing is blocked at
761
+ * the editor, so a viewer never composes an edit that cannot be saved.
762
+ */
763
+ readOnly?: boolean
764
+ /** Called whenever the active file changes (tab switch, file open, file close). */
765
+ onActiveFileChange?: (path: string | null) => void
766
+ /** Called once after the editor is fully mounted and ready to accept files. */
767
+ onEditorReady?: () => void
768
+ /** Called whenever the open tab list changes (file opened or closed). */
769
+ onTabsChange?: (paths: string[]) => void
770
+ /** Maps file path to git status for coloring tab filenames. */
771
+ fileStatuses?: Record<string, string>
772
+ /** Path of the file currently being formatted, for visual indicator. */
773
+ formattingFile?: string | null
774
+ /** Path of the file with an active save debounce countdown. */
775
+ countdownFile?: string | null
776
+ /** Incremented each keystroke to restart the countdown animation. */
777
+ countdownKey?: number
778
+ /** Estimated format duration in ms (rolling average, default 2000). */
779
+ formatEstimate?: number
780
+ /** Called when the user triggers "Fix with AI" from the editor's lightbulb or context menu. */
781
+ onFixWithAI?: (request: FixWithAIRequest) => void
782
+ /** Override double-click on a tab. Return `true` to skip the default pin behavior. */
783
+ onTabDoubleClick?: (path: string) => boolean
784
+ }
785
+ ```
786
+
787
+ #### `PreviewStuckReport`
788
+
789
+ Structured report passed to {@link PreviewPanelProps.onPreviewStuck} when the preview
790
+ gives up. Carries the failure class + the route it happened on so the host can compose
791
+ an actionable, agent-fixable message instead of a bare "preview is stuck".
792
+
793
+ ```typescript
794
+ interface PreviewStuckReport {
795
+ /** The failure class — what left the preview unable to show the running app. */
796
+ reason: PreviewStuckReason
797
+ /** The preview's current location (route) when the failure was detected, if known. */
798
+ url?: string
799
+ }
800
+ ```
801
+
802
+ #### `PreviewUiCommand`
803
+
804
+ A live-preview interaction the host asks the panel to perform inside the iframe, so an AI
805
+ agent can verify a feature end-to-end by DRIVING the app the user is watching (no headless
806
+ browser). The panel just relays it to the iframe's interaction bridge — generic, so it
807
+ carries no host/API specifics.
808
+
809
+ ```typescript
810
+ interface PreviewUiCommand {
811
+ /** Correlates this command with its result; the host round-trips on it. */
812
+ id: string
813
+ /** `snapshot` the interactive UI, or act on an element. */
814
+ action: 'snapshot' | 'click' | 'fill' | 'select' | 'waitFor'
815
+ /** `data-mol-id` of the target element (preferred over selector). */
816
+ molId?: string
817
+ /** CSS-selector fallback when no molId is available. */
818
+ selector?: string
819
+ /** Visible-label match — targets apps whose elements carry no `data-mol-id`. */
820
+ text?: string
821
+ /** Value to set for `fill` / `select`. */
822
+ value?: string
823
+ /**
824
+ * `snapshot` only — the moment the host pointed the preview at a new URL (`Date.now()`).
825
+ * Only a document that loaded at or after it may answer, so a navigation snapshot can never
826
+ * come from the OUTGOING page still sitting in the iframe. Set it ONLY when a new document
827
+ * is genuinely loading (the URL actually changed) — otherwise nothing can satisfy it and the
828
+ * command goes unanswered. Omit for a plain read.
829
+ */
830
+ minLoadedAt?: number
831
+ }
832
+ ```
833
+
834
+ #### `PreviewUiResult`
835
+
836
+ The preview interaction bridge's reply to a {@link PreviewUiCommand}.
837
+
838
+ ```typescript
839
+ interface PreviewUiResult {
840
+ ok: boolean
841
+ /** Interactive-element list + url/title from the preview (present on a snapshot / success). */
842
+ snapshot?: unknown
843
+ found?: boolean
844
+ error?: string
845
+ /**
846
+ * Failed network requests from the last ~10s (method, url, status, bounded response body),
847
+ * captured in-page — so a click that 4xx'd explains itself in the same result.
848
+ */
849
+ recentNetworkErrors?: string[]
850
+ /**
851
+ * Present when the bridge gave up on a settle budget instead of observing the page settle —
852
+ * it names what was still pending (document parsing, an empty root, an unreached route,
853
+ * in-flight requests). The snapshot may be incomplete, so a race stays distinguishable from
854
+ * a genuinely broken page.
855
+ */
856
+ stillSettling?: string
857
+ }
858
+ ```
859
+
860
+ #### `TabBarProps`
861
+
862
+ Properties for tab bar.
863
+
864
+ ```typescript
865
+ interface TabBarProps {
866
+ tabs: EditorTab[]
867
+ activeFile: string | null
868
+ onSelect: (path: string) => void
869
+ onClose: (path: string) => void
870
+ onDoubleClick?: (path: string) => void
871
+ /** Maps file path to git status for coloring tab filenames. */
872
+ fileStatuses?: Record<string, string>
873
+ className?: string
874
+ }
875
+ ```
876
+
877
+ #### `FileExplorerProps`
878
+
879
+ Properties for file explorer.
880
+
881
+ ```typescript
882
+ interface FileExplorerProps {
883
+ /**
884
+ * Read-only mode (a project viewer): the context menu omits every mutating
885
+ * entry. Pair with omitting the mutation handlers (onRename/onDelete/…) so
886
+ * keyboard shortcuts and drag-moves no-op too.
887
+ */
888
+ readOnly?: boolean
889
+ files: FileNode[]
890
+ onFileSelect: (path: string) => void
891
+ onFileDoubleClick?: (path: string) => void
892
+ onDirExpand?: (path: string) => void
893
+ /** Called when the user chooses "Rename" from the context menu. */
894
+ onRename?: (path: string) => void
895
+ /** Called when the user chooses "Delete" from the context menu. */
896
+ onDelete?: (path: string) => void
897
+ /** Called when the user deletes multiple selected files/folders via context menu or keyboard. */
898
+ onDeleteMultiple?: (paths: string[]) => void
899
+ /** Called when the user moves files via drag-and-drop or cut+paste. */
900
+ onMoveFiles?: (moves: Array<{ oldPath: string; newPath: string }>) => void
901
+ /** Called when the user chooses "New File" from the context menu. */
902
+ onNewFile?: (dirPath: string) => void
903
+ /** Called when the user chooses "New Folder" from the context menu. */
904
+ onNewFolder?: (dirPath: string) => void
905
+ /** Called when the user chooses "Collapse All" from the context menu. */
906
+ onCollapseAll?: () => void
907
+ className?: string
908
+ /** Storage key for persisting expand/collapse state across reloads (through `@molecule/app-storage`). */
909
+ persistKey?: string
910
+ /** Path of the currently active file — highlighted in the tree. */
911
+ activeFile?: string | null
912
+ /** Maps file path to git status — used to color directory names by highest-priority child status. */
913
+ fileStatuses?: Record<string, string>
914
+ }
915
+ ```
916
+
917
+ #### `FileNode`
918
+
919
+ File Node interface.
920
+
921
+ ```typescript
922
+ interface FileNode {
923
+ name: string
924
+ path: string
925
+ type: 'file' | 'directory'
926
+ children?: FileNode[]
927
+ isDimmed?: boolean
928
+ gitStatus?: 'modified' | 'added' | 'deleted' | 'untracked'
929
+ /** If this entry is a symlink, the target it points to. */
930
+ symlinkTarget?: string
931
+ }
932
+ ```
933
+
934
+ #### `ResizeHandleProps`
935
+
936
+ Properties for resize handle.
937
+
938
+ ```typescript
939
+ interface ResizeHandleProps {
940
+ onResize: (delta: number) => void
941
+ direction?: 'horizontal' | 'vertical'
942
+ className?: string
943
+ }
944
+ ```
945
+
946
+ #### `DeviceFrameSelectorProps`
947
+
948
+ Properties for device frame selector.
949
+
950
+ ```typescript
951
+ interface DeviceFrameSelectorProps {
952
+ current: DeviceFrame
953
+ onChange: (device: DeviceFrame) => void
954
+ className?: string
955
+ }
956
+ ```
957
+
958
+ #### `ToolCallCardProps`
959
+
960
+ Properties for tool call card.
961
+
962
+ ```typescript
963
+ interface ToolCallCardProps {
964
+ id: string
965
+ name: string
966
+ input?: unknown
967
+ output?: unknown
968
+ status: 'pending' | 'running' | 'done' | 'error'
969
+ /** Snapshot of original/modified file content captured at tool-call time. */
970
+ fileDiff?: { original: string; modified: string }
971
+ /** Externally controlled undo state — when true, the card displays as undone. */
972
+ isUndone?: boolean
973
+ /** Called when the undo/redo button is toggled on this tool call. */
974
+ onUndoToggle?: (id: string, undone: boolean) => void
975
+ /** Called when a filename in the card is clicked — should open the file as a preview tab. */
976
+ onFileOpen?: (path: string) => void
977
+ /** Called when a filename in the card is double-clicked — should pin the tab. */
978
+ onFileDoubleClick?: (path: string) => void
979
+ /** Called when a file-changing card is clicked — should open the file diff in the editor. */
980
+ onFileDiff?: (path: string, diff?: { original: string; modified: string }) => void
981
+ /** Called to undo/redo a file change — writes the given content to the file path. */
982
+ onFileRevert?: (path: string, content: string) => Promise<void>
983
+ /** Called when the user responds to an `ask_user` tool call (clicks an option or submits free text). */
984
+ onAskUserResponse?: (response: string) => void
985
+ /**
986
+ * Skip this tool call while it is RUNNING, without ending the turn: the call
987
+ * comes back as skipped, the model is told it did not run, and the turn
988
+ * carries on. Omitted by a host that does not serve it — then no control is
989
+ * rendered at all. Resolving `false` means nothing was in flight (the call
990
+ * had already finished), which returns the button to its resting state rather
991
+ * than reporting an error.
992
+ */
993
+ onSkip?: (id: string) => void | Promise<boolean | void>
994
+ /**
995
+ * Why skipping is unavailable to THIS viewer, already translated by the host
996
+ * — `null` when it is available. The control stays visible and disabled with
997
+ * the reason on it, rather than vanishing without explanation.
998
+ */
999
+ skipDisabledReason?: string | null
1000
+ className?: string
1001
+ }
1002
+ ```
1003
+
1004
+ #### `ChatMessageItemProps`
1005
+
1006
+ Properties for the chat message item component.
1007
+
1008
+ ```typescript
1009
+ interface ChatMessageItemProps {
1010
+ message: ChatMessage
1011
+ className?: string
1012
+ }
1013
+ ```
1014
+
1015
+ #### `KeyboardShortcut`
1016
+
1017
+ A keyboard shortcut definition.
1018
+
1019
+ ```typescript
1020
+ interface KeyboardShortcut {
1021
+ /** Key combo string, e.g. `"mod+p"`, `"mod+shift+f"`. `mod` = Cmd (Mac) / Ctrl (others). */
1022
+ keys: string
1023
+ /** Handler invoked when the shortcut fires. */
1024
+ handler: () => void
1025
+ /** If true, fires even when an `<input>` / `<textarea>` is focused. */
1026
+ allowInInput?: boolean
1027
+ /** If true, fires even when the Monaco editor is focused. */
1028
+ allowInEditor?: boolean
1029
+ /** Human-readable label for display in the command palette. */
1030
+ label?: string
1031
+ }
1032
+ ```
1033
+
1034
+ #### `SearchPanelProps`
1035
+
1036
+ Properties for the search-in-files panel.
1037
+
1038
+ ```typescript
1039
+ interface SearchPanelProps {
1040
+ /** Project ID used for API calls. */
1041
+ projectId: string
1042
+ /** Called when the user clicks a search result. */
1043
+ onResultClick?: (path: string, line: number) => void
1044
+ className?: string
1045
+ /**
1046
+ * The project's excluded directory names (VS Code `search.exclude`
1047
+ * semantics). Displayed and editable in the panel; the backend applies the
1048
+ * SAME set server-side to every search surface (panel + AI tools), so this
1049
+ * prop is display/edit state — searches don't send it per query. When
1050
+ * omitted, the panel shows {@link DEFAULT_SEARCH_EXCLUDED_DIRS}.
1051
+ */
1052
+ excludedDirs?: string[]
1053
+ /** Persist an edited excluded-dir set (the host owns storage). */
1054
+ onExcludedDirsChange?: (dirs: string[]) => void
1055
+ /**
1056
+ * Read-only mode (a project viewer): search stays fully usable, but the
1057
+ * Replace toggle/inputs/buttons are hidden (bulk writes are editor work).
1058
+ * Pair with omitting onExcludedDirsChange so exclude edits never persist.
1059
+ */
1060
+ readOnly?: boolean
1061
+ }
1062
+ ```
1063
+
1064
+ #### `SearchResult`
1065
+
1066
+ A single file's search results.
1067
+
1068
+ ```typescript
1069
+ interface SearchResult {
1070
+ /** Relative file path. */
1071
+ file: string
1072
+ /** Matching lines within the file. */
1073
+ matches: Array<{ line: number; content: string }>
1074
+ }
1075
+ ```
1076
+
1077
+ #### `SearchResponse`
1078
+
1079
+ Response from the search API endpoint.
1080
+
1081
+ ```typescript
1082
+ interface SearchResponse {
1083
+ /** The search pattern used. */
1084
+ pattern: string
1085
+ /** Grouped results by file. */
1086
+ results: SearchResult[]
1087
+ /** Total number of matches across all files. */
1088
+ totalCount: number
1089
+ /** Whether results were truncated. */
1090
+ truncated: boolean
1091
+ }
1092
+ ```
1093
+
1094
+ #### `QuickOpenProps`
1095
+
1096
+ Properties for the quick-open file finder.
1097
+
1098
+ ```typescript
1099
+ interface QuickOpenProps {
1100
+ /** Project ID used for API calls. */
1101
+ projectId: string
1102
+ /** Called when the user selects a file. */
1103
+ onFileOpen: (path: string) => void
1104
+ /** Called when the picker is dismissed. */
1105
+ onDismiss: () => void
1106
+ }
1107
+ ```
1108
+
1109
+ #### `Command`
1110
+
1111
+ A command available in the command palette.
1112
+
1113
+ ```typescript
1114
+ interface Command {
1115
+ /** Unique identifier. */
1116
+ id: string
1117
+ /** Display label. */
1118
+ label: string
1119
+ /** Keyboard shortcut hint (e.g. "Cmd+P"). */
1120
+ shortcut?: string
1121
+ /** Handler invoked when the command is executed. */
1122
+ execute: () => void
1123
+ /** Category prefix (e.g. "View", "File"). */
1124
+ category?: string
1125
+ }
1126
+ ```
1127
+
1128
+ #### `CommandPaletteProps`
1129
+
1130
+ Properties for the command palette.
1131
+
1132
+ ```typescript
1133
+ interface CommandPaletteProps {
1134
+ /** Available commands. */
1135
+ commands: Command[]
1136
+ /** Called when the palette is dismissed. */
1137
+ onDismiss: () => void
1138
+ }
1139
+ ```
1140
+
1141
+ #### `ShortcutEntry`
1142
+
1143
+ A shortcut entry for display in the keyboard shortcuts panel.
1144
+
1145
+ ```typescript
1146
+ interface ShortcutEntry {
1147
+ /** Human-readable label describing the action. */
1148
+ label: string
1149
+ /** Display string for the key combo (e.g. "⌘P", "⌘⇧F"). */
1150
+ keys: string
1151
+ /** Optional grouping category. */
1152
+ category?: string
1153
+ /** Handler invoked when the row is clicked. */
1154
+ execute?: () => void
1155
+ }
1156
+ ```
1157
+
1158
+ #### `KeyboardShortcutsPanelProps`
1159
+
1160
+ Properties for the keyboard shortcuts reference panel.
1161
+
1162
+ ```typescript
1163
+ interface KeyboardShortcutsPanelProps {
1164
+ /** List of shortcuts to display. */
1165
+ shortcuts: ShortcutEntry[]
1166
+ /** Called when the panel is dismissed. */
1167
+ onDismiss: () => void
1168
+ }
1169
+ ```
1170
+
1171
+ ### Types
1172
+
1173
+ #### `CommandCategoryKey`
1174
+
1175
+ Category keys used to group commands in the menu and in `/help`.
1176
+
1177
+ ```typescript
1178
+ type CommandCategoryKey = 'context' | 'code' | 'collaborate' | 'model' | 'settings' | 'support'
1179
+ ```
1180
+
1181
+ #### `CommandId`
1182
+
1183
+ Union of all command ids (loosely `string`, since {@link CommandDef.id} is a string).
1184
+
1185
+ ```typescript
1186
+ type CommandId = CommandDef['id']
1187
+ ```
1188
+
1189
+ #### `ActivityType`
1190
+
1191
+ Channel categories a captured activity can belong to.
1192
+
1193
+ ```typescript
1194
+ type ActivityType = 'email' | 'sms' | 'push' | 'webhook' | 'channel'
1195
+ ```
1196
+
1197
+ #### `ActivityStatus`
1198
+
1199
+ Lifecycle status of a captured activity.
1200
+
1201
+ ```typescript
1202
+ type ActivityStatus = 'captured' | 'sent' | 'delivered' | 'failed'
1203
+ ```
1204
+
1205
+ #### `AutoCommitAction`
1206
+
1207
+ Actions the countdown reducer accepts.
1208
+
1209
+ - `set` — apply a `/autocommit <seconds>` command (`seconds <= 0` disables);
1210
+ arms AND starts a fresh countdown (an explicit, just-now user choice).
1211
+ - `hydrate` — restore a cadence persisted on the project (e.g. on reload),
1212
+ enabled but PAUSED (`seconds <= 0` disables). Unlike `set`, it does NOT
1213
+ start counting down — the countdown only re-arms on the next file change —
1214
+ so reopening a project never auto-commits a tree the user hasn't touched.
1215
+ - `reset` — a file changed; restart the full countdown (no-op when disabled).
1216
+ - `tick` — one second elapsed; decrement toward zero (no-op when paused).
1217
+ - `fired` — a commit was just dispatched; pause until the next file change.
1218
+
1219
+ ```typescript
1220
+ type AutoCommitAction =
1221
+ | { type: 'set'; seconds: number }
1222
+ | { type: 'hydrate'; seconds: number }
1223
+ | { type: 'reset' }
1224
+ | { type: 'tick' }
1225
+ | { type: 'fired' }
1226
+ ```
1227
+
1228
+ #### `ShareRole`
1229
+
1230
+ A role granted by a share link.
1231
+
1232
+ ```typescript
1233
+ type ShareRole = (typeof SHARE_ROLES)[number]
1234
+ ```
1235
+
1236
+ #### `ShareCommand`
1237
+
1238
+ The parsed result of a `/share` command:
1239
+
1240
+ - `create` — POST a link at a valid role (`/share`, defaulting to `viewer`,
1241
+ or `/share <role>` with a recognized role).
1242
+ - `invalid` — an unrecognized role argument was given (the caller shows usage).
1243
+
1244
+ ```typescript
1245
+ type ShareCommand = { kind: 'create'; role: ShareRole } | { kind: 'invalid'; arg: string }
1246
+ ```
1247
+
1248
+ #### `TimestampsCommand`
1249
+
1250
+ Parsed `/timestamps` invocation: toggle, explicit on/off, or an unrecognized argument.
1251
+
1252
+ ```typescript
1253
+ type TimestampsCommand = { action: 'toggle' | 'on' | 'off' } | { action: 'invalid' }
1254
+ ```
1255
+
1256
+ #### `DeviceOrientation`
1257
+
1258
+ Preview-only iframe orientation. Portrait is the natural orientation of a
1259
+ fixed-frame device; landscape swaps its width/height. This is a visual
1260
+ preview concern that lives in {@link PreviewPanel}'s local state — it is NOT
1261
+ part of the live-preview core state.
1262
+
1263
+ ```typescript
1264
+ type DeviceOrientation = 'portrait' | 'landscape'
1265
+ ```
1266
+
1267
+ #### `ChatEventCardSegment`
1268
+
1269
+ One inline segment of a card's composable body: literal text, an inline monospace
1270
+ {@link ChatEventCardCode} span, or a labelled link/action ({@link ChatEventCardAction}).
1271
+ See {@link ChatEventCard.content}.
1272
+
1273
+ ```typescript
1274
+ type ChatEventCardSegment = string | ChatEventCardCode | ChatEventCardAction
1275
+ ```
1276
+
1277
+ #### `ChatEventCardFactory`
1278
+
1279
+ Turns a custom event's `data` payload into a chat card, or returns null to render
1280
+ nothing for that event.
1281
+
1282
+ ```typescript
1283
+ type ChatEventCardFactory = (data: Record<string, unknown> | undefined) => ChatEventCard | null
1284
+ ```
1285
+
1286
+ #### `SettingKey`
1287
+
1288
+ Stable ids for each user-controllable setting (also the i18n key suffix).
1289
+
1290
+ ```typescript
1291
+ type SettingKey =
1292
+ | 'model'
1293
+ | 'planModel'
1294
+ | 'executeModel'
1295
+ | 'commitModel'
1296
+ | 'compactModel'
1297
+ | 'mode'
1298
+ | 'effort'
1299
+ | 'maxLoops'
1300
+ | 'autoFix'
1301
+ | 'autoCommit'
1302
+ | 'hooks'
1303
+ | 'autoApproveCommands'
1304
+ | 'sounds'
1305
+ | 'timestamps'
1306
+ ```
1307
+
1308
+ #### `TestWorkspace`
1309
+
1310
+ Which project directory a test file belongs to: the directory that OWNS the
1311
+ file (the nearest ancestor holding the runner's config or a `package.json`),
1312
+ as a path relative to the workspace root — `app`, `api`, `my-app/app`,
1313
+ `packages/web` — or `.` for the workspace root itself. Nothing guarantees
1314
+ `app/` or `api/` at the root: the executor names its project directory, so
1315
+ the value is a path, not an enum.
1316
+
1317
+ ```typescript
1318
+ type TestWorkspace = 'app' | 'api' | '.' | (string & {})
1319
+ ```
1320
+
1321
+ #### `TestKind`
1322
+
1323
+ What a test file is: an end-to-end spec driven against the LIVE PREVIEW (the
1324
+ `@molecule/app-e2e-preview` bond every scaffolded app carries), or a plain
1325
+ unit test run by the project's own runner.
1326
+
1327
+ ```typescript
1328
+ type TestKind = 'e2e' | 'unit'
1329
+ ```
1330
+
1331
+ #### `TestStatus`
1332
+
1333
+ How one test file ended.
1334
+
1335
+ ```typescript
1336
+ type TestStatus = 'passed' | 'failed' | 'skipped'
1337
+ ```
1338
+
1339
+ #### `TestCaseStatus`
1340
+
1341
+ How one TEST inside a file is doing: the three verdicts a file can end with,
1342
+ plus `running` — the state a file never reports, because a file is only ever
1343
+ seen finished.
1344
+
1345
+ ```typescript
1346
+ type TestCaseStatus = TestStatus | 'running'
1347
+ ```
1348
+
1349
+ #### `TestRunOutcome`
1350
+
1351
+ How a whole run ended. `skipped-by-user` is a run that otherwise finished but
1352
+ had at least one command skipped from the card — deliberately its OWN outcome
1353
+ rather than `completed` plus a count, so nothing can read a run with skipped
1354
+ work in it as a clean pass. A real failure still wins: `error`, `timeout` and
1355
+ `cancelled` take precedence over it.
1356
+
1357
+ ```typescript
1358
+ type TestRunOutcome = 'completed' | 'cancelled' | 'timeout' | 'error' | 'skipped-by-user'
1359
+ ```
1360
+
1361
+ #### `TestRunEvent`
1362
+
1363
+ One event from a run in progress. The host streams these to the bar (over SSE
1364
+ in molecule.dev) in the order the run produces them: one `start`, then
1365
+ interleaved `output`/`case`/`result`, then exactly one `done`.
1366
+
1367
+ ```typescript
1368
+ type TestRunEvent = (
1369
+ | {
1370
+ type: 'start'
1371
+ runId: string
1372
+ ids: string[]
1373
+ startedAt?: string
1374
+ /** Who started the run — what the test view says about a run it did not start. */
1375
+ source?: TestRunSource
1376
+ /**
1377
+ * The command a run the test view did not start is running (masked by the
1378
+ * host). An agent's own command names no test ids up front, so this is
1379
+ * what the view can show while its results arrive.
1380
+ */
1381
+ command?: string
1382
+ }
1383
+ | { type: 'output'; id?: string; stream?: 'stdout' | 'stderr'; chunk: string }
1384
+ /**
1385
+ * One TEST within a file — the runner's own title and group, so the person
1386
+ * watching a five-minute spec run sees WHICH test is on screen instead of a
1387
+ * spinner. `id` is the same file id `result` uses.
1388
+ */
1389
+ | {
1390
+ type: 'case'
1391
+ id: string
1392
+ title: string
1393
+ describe?: string
1394
+ status: TestCaseStatus
1395
+ durationMs?: number
1396
+ }
1397
+ | {
1398
+ type: 'result'
1399
+ id: string
1400
+ status: TestStatus
1401
+ durationMs?: number
1402
+ passed?: number
1403
+ failed?: number
1404
+ skipped?: number
1405
+ /** The runner's output for a FAILURE, which the bar keeps visible. */
1406
+ output?: string
1407
+ }
1408
+ | {
1409
+ type: 'done'
1410
+ runId?: string
1411
+ outcome: TestRunOutcome
1412
+ passed?: number
1413
+ failed?: number
1414
+ skipped?: number
1415
+ durationMs?: number
1416
+ error?: string
1417
+ }
1418
+ ) & {
1419
+ /** Server order on the direct stream too; optional only for older/custom hosts. */
1420
+ eventId?: string
1421
+ }
1422
+ ```
1423
+
1424
+ #### `TestRunSource`
1425
+
1426
+ Who started a test run: the person (the Run buttons, in this tab or another),
1427
+ the agent (its test tool or its own shell commands), or the platform (its
1428
+ checks of a deploy).
1429
+
1430
+ ```typescript
1431
+ type TestRunSource = 'person' | 'agent' | 'platform'
1432
+ ```
1433
+
1434
+ #### `TestRunFeedEvent`
1435
+
1436
+ One event of the project's test-run feed: any {@link TestRunEvent}, stamped
1437
+ with the run it belongs to, since the feed interleaves every run in the
1438
+ project.
1439
+
1440
+ ```typescript
1441
+ type TestRunFeedEvent = TestRunEvent & { runId: string }
1442
+ ```
1443
+
1444
+ #### `PreviewStuckReason`
1445
+
1446
+ Why the preview could not show the running app — the failure CLASS the host hands
1447
+ to its AI agent so a fix can be targeted (and so the agent isn't told "it's broken"
1448
+ with no hint of how). Distinct from a JS error (`onPreviewError`): these are states
1449
+ the iframe itself can't report once it's in them.
1450
+
1451
+ ```typescript
1452
+ type PreviewStuckReason =
1453
+ // Heartbeats stopped after a render — the app's main thread is locked (an infinite
1454
+ // loop / runaway render). The iframe can post nothing else once frozen, so only the
1455
+ // host's heartbeat-silence watchdog can detect it.
1456
+ | 'frozen'
1457
+ // Repeated reload/remount cycles never produced a confirmed render — the document
1458
+ // loads but the app never mounts (e.g. a route that throws on every attempt).
1459
+ | 'load-failed'
1460
+ // The absolute readiness ceiling elapsed with no confirmed render and no active
1461
+ // build — a catch-all backstop so the preview can never spin forever.
1462
+ | 'load-timeout'
1463
+ ```
1464
+
1465
+ #### `PreviewRenderState`
1466
+
1467
+ The preview's live render verdict, derived from the iframe bridges — the one preview
1468
+ fact the server can't observe itself (it has no browser). The host forwards it to the
1469
+ server so the post-loop verification won't pass a build while the app isn't actually
1470
+ rendering ("compiles + serves" ≠ "renders").
1471
+
1472
+ - `rendered` — the app drew content (`molecule:ready`).
1473
+ - `blank` — loaded but showed nothing (gave up / `#root` empty after settling).
1474
+ - `frozen` — rendered then locked up (heartbeats stopped).
1475
+ - `loading` — still loading / not yet determined.
1476
+
1477
+ ```typescript
1478
+ type PreviewRenderState = 'rendered' | 'blank' | 'frozen' | 'loading'
1479
+ ```
1480
+
1481
+ ### Classes
1482
+
1483
+ #### `TestRunProjection`
1484
+
1485
+ Incremental card state. A server id is applied once, in order; completed runs are compacted
1486
+ while per-file verdicts survive. No raw event history is retained or replayed into a fold.
1487
+
1488
+ ```typescript
1489
+ class TestRunProjection {
1490
+ private readonly runs = new Map<string, ProjectedRun>()
1491
+ private readonly results: Record<string, TestResultEntry> = {}
1492
+ private readonly pending = new Map<string, string>()
1493
+ private lastEventId: string | null = null
1494
+ private order = 0
1495
+
1496
+ /** Apply one event and return the visible state. Missing ids support older custom hosts only. */
1497
+ apply(event: TestRunFeedEvent, activeOwnRunId: string | null = null): TestsRunState {
1498
+ if (event.eventId) {
1499
+ if (this.lastEventId && compareEventIds(event.eventId, this.lastEventId) <= 0)
1500
+ return this.show(activeOwnRunId)
1501
+ this.lastEventId = event.eventId
1502
+ }
1503
+ const order = ++this.order
1504
+ const previous = this.runs.get(event.runId) ?? {
1505
+ state: { ...EMPTY_RUN_STATE, runId: event.runId, running: event.type !== 'done' },
1506
+ covered: new Set<string>(),
1507
+ startOrder: order,
1508
+ lastOrder: order,
1509
+ }
1510
+ if (!previous.state.running && event.type === 'done') return this.show(activeOwnRunId)
1511
+
1512
+ const id =
1513
+ event.type === 'case' || event.type === 'result' || event.type === 'output'
1514
+ ? event.id
1515
+ : undefined
1516
+ const covered =
1517
+ event.type === 'start' ? event.ids : id != null && !previous.covered.has(id) ? [id] : []
1518
+ for (const file of covered) {
1519
+ previous.covered.add(file)
1520
+ delete this.results[file]
1521
+ this.pending.set(file, event.runId)
1522
+ }
1523
+
1524
+ let next = applyTestRunEvent(previous.state, event)
1525
+ if (event.type === 'start' && event.startedAt) {
1526
+ const startedAt = Date.parse(event.startedAt)
1527
+ if (Number.isFinite(startedAt)) next = { ...next, startedAt }
1528
+ }
1529
+ if (event.type === 'result') {
1530
+ const verdict = next.results[event.id]
1531
+ if (verdict) this.results[event.id] = verdict
1532
+ // The latest verdict is what counts, even when an older run produced it after a newer start.
1533
+ this.pending.delete(event.id)
1534
+ }
1535
+ if (event.type === 'done') {
1536
+ for (const [file, runId] of this.pending) {
1537
+ if (runId === event.runId) this.pending.delete(file)
1538
+ }
1539
+ }
1540
+ this.runs.set(event.runId, { ...previous, state: next, lastOrder: order })
1541
+ this.compact()
1542
+ return this.show(activeOwnRunId)
1543
+ }
1544
+
1545
+ /** Keep every live run (including the active own run) and only the latest completed run. */
1546
+ private compact(): void {
1547
+ const completed = [...this.runs.values()]
1548
+ .filter((run) => !run.state.running)
1549
+ .sort((a, b) => b.lastOrder - a.lastOrder)
1550
+ for (const run of completed.slice(1)) {
1551
+ if (run.state.runId) this.runs.delete(run.state.runId)
1552
+ }
1553
+ }
1554
+
1555
+ /** Render current per-file state, with progress and controls selected independently. */
1556
+ show(activeOwnRunId: string | null = null): TestsRunState {
1557
+ const activeOwn = activeOwnRunId ? this.runs.get(activeOwnRunId) : undefined
1558
+ const running = [...this.runs.values()]
1559
+ .filter((run) => run.state.running)
1560
+ .sort((a, b) => a.startOrder - b.startOrder || a.lastOrder - b.lastOrder)
1561
+ const latest = [...this.runs.values()].sort((a, b) => a.lastOrder - b.lastOrder).at(-1)
1562
+ const shown = activeOwn?.state.running
1563
+ ? activeOwn
1564
+ : (running.at(-1) ?? latest ?? { state: EMPTY_RUN_STATE })
1565
+ const runningIds = new Set(
1566
+ [...this.pending]
1567
+ .filter(([, runId]) => this.runs.get(runId)?.state.running === true)
1568
+ .map(([id]) => id),
1569
+ )
1570
+ const own = shown.state.runId != null && shown.state.runId === activeOwnRunId
1571
+ const currentId =
1572
+ shown.state.currentId && runningIds.has(shown.state.currentId) ? shown.state.currentId : null
1573
+ const cases = Object.fromEntries(
1574
+ Object.entries(shown.state.cases).filter(([id]) => runningIds.has(id)),
1575
+ )
1576
+ return {
1577
+ ...shown.state,
1578
+ currentId,
1579
+ cases,
1580
+ runningIds: [...runningIds],
1581
+ results: { ...this.results },
1582
+ external: shown.state.runId == null ? undefined : !own,
1583
+ skipUnavailable: own ? shown.state.skipUnavailable : true,
1584
+ }
1585
+ }
1586
+ }
1587
+ ```
1588
+
1589
+ ### Functions
1590
+
1591
+ #### `groupCommandsByCategory(commands, categories)`
1592
+
1593
+ Groups commands under their categories, preserving category and command
1594
+ order and dropping empty categories. Used by the `/settings` command
1595
+ reference (and any other view that lists commands by section) so the
1596
+ grouping stays in sync with the registry automatically.
1597
+
1598
+ ```typescript
1599
+ function groupCommandsByCategory(
1600
+ commands?: readonly CommandDef[],
1601
+ categories?: readonly CommandCategory[],
1602
+ ): CommandGroup[]
1603
+ ```
1604
+
1605
+ - `commands` — Command registry to group (defaults to {@link COMMANDS}).
1606
+ - `categories` — Ordered categories (defaults to {@link COMMAND_CATEGORIES}).
1607
+
1608
+ **Returns:** One {@link CommandGroup} per non-empty category, in category order.
1609
+
1610
+ #### `matchesSideChannelCommand(defs, text)`
1611
+
1612
+ True when `text` invokes a side-channel command ({@link CommandDef.sideChannel})
1613
+ from `defs`, matched against the leading `/token` by command id or alias
1614
+ (case-insensitive). Used by the chat input's dispatch AND the auto-send
1615
+ (initialMessage) path so a side-channel send never renders an optimistic
1616
+ "/command …" echo — the server's emitted `message` stream event is the one
1617
+ visible message.
1618
+
1619
+ ```typescript
1620
+ function matchesSideChannelCommand(defs: readonly CommandDef[] | undefined, text: string): boolean
1621
+ ```
1622
+
1623
+ - `defs` — The command registry to consult (e.g. shared ∪ host commands).
1624
+ - `text` — The raw outgoing message text.
1625
+
1626
+ **Returns:** Whether the text invokes a side-channel command.
1627
+
1628
+ #### `activityIconName(type)`
1629
+
1630
+ Returns the bonded-icon-set glyph NAME for an activity type — pass it to
1631
+ `<Icon name={…} />` to render the themed SVG. Unknown/future types (which
1632
+ {@link activityFromEvent} normalizes to `webhook`) reuse the `link` glyph
1633
+ rather than risk a `getIcon` throw.
1634
+
1635
+ ```typescript
1636
+ function activityIconName(type: ActivityType): IconName
1637
+ ```
1638
+
1639
+ - `type` — The activity channel type.
1640
+
1641
+ **Returns:** The icon-set glyph name for the type.
1642
+
1643
+ #### `activityTypeLabel(type)`
1644
+
1645
+ Human-readable, translated label for a channel type (used as filter-tab labels).
1646
+
1647
+ ```typescript
1648
+ function activityTypeLabel(type: ActivityType): string
1649
+ ```
1650
+
1651
+ - `type` — The activity channel type.
1652
+
1653
+ **Returns:** The translated channel label.
1654
+
1655
+ #### `activityStatusLabel(status)`
1656
+
1657
+ Human-readable, translated label for a status (shown in the status pill).
1658
+
1659
+ ```typescript
1660
+ function activityStatusLabel(status: ActivityStatus): string
1661
+ ```
1662
+
1663
+ - `status` — The activity status.
1664
+
1665
+ **Returns:** The translated status label.
1666
+
1667
+ #### `activityStatusColors(status)`
1668
+
1669
+ Resolves the status-pill colors for a given status. Uses RGBA literals (not
1670
+ ClassMap classes) because these semantic status hues are not part of the
1671
+ surface/text token set — the same approach `VerificationBadge` takes for its
1672
+ pass/fail coloring.
1673
+
1674
+ ```typescript
1675
+ function activityStatusColors(status: ActivityStatus): { fg: string; bg: string }
1676
+ ```
1677
+
1678
+ - `status` — The activity status.
1679
+
1680
+ **Returns:** An object with `fg` (text) and `bg` (background) CSS color strings.
1681
+
1682
+ #### `activitySummaryLine(activity)`
1683
+
1684
+ Builds the one-line summary shown on the inline card: the activity's own
1685
+ summary, with the recipient appended after an arrow when present
1686
+ (e.g. `Welcome email → user@example.com`). Falls back to a translated,
1687
+ type-specific default when no summary was captured.
1688
+
1689
+ ```typescript
1690
+ function activitySummaryLine(activity: Pick<Activity, 'type' | 'recipient' | 'summary'>): string
1691
+ ```
1692
+
1693
+ - `activity` — The activity to summarize.
1694
+
1695
+ **Returns:** The single-line summary string.
1696
+
1697
+ #### `activityFromEvent(raw)`
1698
+
1699
+ Maps a raw SSE `activity` event payload into a normalized {@link Activity}.
1700
+ Tolerates missing optional fields and supplies an id/timestamp if absent.
1701
+
1702
+ ```typescript
1703
+ function activityFromEvent(raw: {
1704
+ id?: string
1705
+ type?: string
1706
+ status?: string
1707
+ recipient?: string
1708
+ summary?: string
1709
+ timestamp?: string
1710
+ }): Activity
1711
+ ```
1712
+
1713
+ - `raw` — The `activity` field from the SSE event.
1714
+ - `raw.id` — Activity id; generated if absent.
1715
+ - `raw.type` — Channel type; defaults to `webhook` if absent.
1716
+ - `raw.status` — Lifecycle status; defaults to `captured` if absent.
1717
+ - `raw.recipient` — Optional recipient.
1718
+ - `raw.summary` — Optional short summary.
1719
+ - `raw.timestamp` — ISO timestamp; defaults to now if absent.
1720
+
1721
+ **Returns:** A normalized Activity object.
1722
+
1723
+ #### `filterActivitiesByType(activities, type)`
1724
+
1725
+ Filters a list of activities by channel type. `null` (the "All" tab) returns
1726
+ every activity unchanged.
1727
+
1728
+ ```typescript
1729
+ function filterActivitiesByType(activities: Activity[], type: ActivityType | null): Activity[]
1730
+ ```
1731
+
1732
+ - `activities` — The activities to filter.
1733
+ - `type` — The channel type to keep, or `null` for all.
1734
+
1735
+ **Returns:** The filtered list (a new array unless `type` is null).
1736
+
1737
+ #### `isAutoCommitCountdownVisible(state)`
1738
+
1739
+ Whether the countdown is in its visible window — armed and within the final
1740
+ {@link AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS} seconds — i.e. the commit
1741
+ button should render the live "Auto-commit in Ns" label instead of "Commit".
1742
+
1743
+ ```typescript
1744
+ function isAutoCommitCountdownVisible(state: AutoCommitState): boolean
1745
+ ```
1746
+
1747
+ - `state` — The countdown state.
1748
+
1749
+ **Returns:** `true` when armed with at most the visible-window seconds left.
1750
+
1751
+ #### `resolveAutoCommitSeconds(saved)`
1752
+
1753
+ Resolves the persisted `project.settings.autoCommitSeconds` value to the
1754
+ effective cadence. A finite number is an explicit user choice: positive
1755
+ values floor to whole seconds, non-positive values mean "the user turned
1756
+ auto-commit off" (`0`). Anything else — missing, never configured, or
1757
+ invalid — falls back to {@link DEFAULT_AUTO_COMMIT_SECONDS}, because
1758
+ auto-commit is on by default.
1759
+
1760
+ ```typescript
1761
+ function resolveAutoCommitSeconds(saved: unknown): number
1762
+ ```
1763
+
1764
+ - `saved` — The raw persisted setting value.
1765
+
1766
+ **Returns:** The effective cadence in whole seconds (`0` = off).
1767
+
1768
+ #### `autoCommitReducer(state, action)`
1769
+
1770
+ Pure reducer for the auto-commit countdown. Deterministic and side-effect
1771
+ free: the component performs the actual commit when {@link isAutoCommitDue}
1772
+ becomes true, then dispatches `fired`.
1773
+
1774
+ ```typescript
1775
+ function autoCommitReducer(state: AutoCommitState, action: AutoCommitAction): AutoCommitState
1776
+ ```
1777
+
1778
+ - `state` — The current countdown state.
1779
+ - `action` — The action to apply.
1780
+
1781
+ **Returns:** The next countdown state.
1782
+
1783
+ #### `isAutoCommitEnabled(state)`
1784
+
1785
+ Whether auto-commit is enabled (a positive cadence is configured), regardless
1786
+ of whether it is currently counting down or paused.
1787
+
1788
+ ```typescript
1789
+ function isAutoCommitEnabled(state: AutoCommitState): boolean
1790
+ ```
1791
+
1792
+ - `state` — The countdown state.
1793
+
1794
+ **Returns:** `true` when `intervalSeconds > 0`.
1795
+
1796
+ #### `isAutoCommitArmed(state)`
1797
+
1798
+ Whether the countdown is actively armed (counting down), i.e. a 1s tick
1799
+ interval should be running. False when disabled or paused after a commit.
1800
+
1801
+ ```typescript
1802
+ function isAutoCommitArmed(state: AutoCommitState): boolean
1803
+ ```
1804
+
1805
+ - `state` — The countdown state.
1806
+
1807
+ **Returns:** `true` when `remaining` is a number.
1808
+
1809
+ #### `isAutoCommitDue(state)`
1810
+
1811
+ Whether a commit is due this instant (the countdown has reached zero). The
1812
+ component reacts to this by running `/commit` and dispatching `fired`.
1813
+
1814
+ ```typescript
1815
+ function isAutoCommitDue(state: AutoCommitState): boolean
1816
+ ```
1817
+
1818
+ - `state` — The countdown state.
1819
+
1820
+ **Returns:** `true` when `remaining === 0`.
1821
+
1822
+ #### `parseAutoCommitCommand(input)`
1823
+
1824
+ Parses an `/autocommit [seconds]` command.
1825
+
1826
+ Returns `{ seconds: null }` when `/autocommit` is typed with no argument (the
1827
+ caller shows usage/current state), `{ seconds: n }` for a non-negative integer
1828
+ argument (`0` cancels), or `null` when the input is not the command.
1829
+
1830
+ ```typescript
1831
+ function parseAutoCommitCommand(input: string): { seconds: number | null } | null
1832
+ ```
1833
+
1834
+ - `input` — The raw chat input.
1835
+
1836
+ **Returns:** The parsed command, or `null` when it is not `/autocommit`.
1837
+
1838
+ #### `formatAutoCommitBadge(state)`
1839
+
1840
+ Formats the countdown's remaining seconds for the compact badge (e.g. `"12s"`).
1841
+ Returns `''` when there is nothing to show (disabled or paused).
1842
+
1843
+ ```typescript
1844
+ function formatAutoCommitBadge(state: AutoCommitState): string
1845
+ ```
1846
+
1847
+ - `state` — The countdown state.
1848
+
1849
+ **Returns:** The badge label, or `''`.
1850
+
1851
+ #### `chatCardBorder(accent, pct)`
1852
+
1853
+ Build the tinted border colour for a chat info card from its accent.
1854
+
1855
+ ```typescript
1856
+ function chatCardBorder(accent?: string, pct?: number): string
1857
+ ```
1858
+
1859
+ - `accent` — Accent source colour (CSS var or hex). Defaults to the theme primary.
1860
+ - `pct` — Opacity of the accent in the mix (percent). Defaults to the resting 40.
1861
+
1862
+ **Returns:** A `color-mix` border colour.
1863
+
1864
+ #### `chatCardBg(accent, pct)`
1865
+
1866
+ Build the tinted background colour for a chat info card from its accent.
1867
+
1868
+ ```typescript
1869
+ function chatCardBg(accent?: string, pct?: number): string
1870
+ ```
1871
+
1872
+ - `accent` — Accent source colour (CSS var or hex). Defaults to the theme primary.
1873
+ - `pct` — Opacity of the accent in the mix (percent). Defaults to the resting 10.
1874
+
1875
+ **Returns:** A `color-mix` background colour.
1876
+
1877
+ #### `chatCardStyle(accent)`
1878
+
1879
+ The single container chrome shared by every boxed info card in the chat
1880
+ timeline: subtle tint, full 1px border on all sides, one padding, one radius.
1881
+
1882
+ Spread it first, then add layout (`display`/`gap`/`alignItems`) and the
1883
+ bottom-margin rhythm at the call site — e.g.
1884
+ `style={{ display: 'flex', gap: 10, marginBottom: TIMELINE_ITEM_GAP, ...chatCardStyle(accent) }}`.
1885
+
1886
+ ```typescript
1887
+ function chatCardStyle(accent?: string): ChatCardStyle
1888
+ ```
1889
+
1890
+ - `accent` — Tint/border source colour. Defaults to the theme primary (neutral cards).
1891
+
1892
+ **Returns:** The container `style` chrome (border, background, padding, radius).
1893
+
1894
+ #### `parseReportCommand(input)`
1895
+
1896
+ Parses a `/report [title]` or `/bug [title]` command. Returns the (possibly
1897
+ empty) trimmed title used to seed the modal when the input is one of those
1898
+ commands, else `null`.
1899
+
1900
+ ```typescript
1901
+ function parseReportCommand(input: string): { title: string } | null
1902
+ ```
1903
+
1904
+ - `input` — The raw chat input.
1905
+
1906
+ **Returns:** `{ title }` when it's a `/report` or `/bug` command, else `null`.
1907
+
1908
+ #### `collectClientInfo(opts)`
1909
+
1910
+ Collects client-side diagnostics for a report. Reads `navigator`
1911
+ (userAgent/platform/language), `window` (inner viewport size, screen size,
1912
+ location href), plus the caller-supplied app version and theme. Every access
1913
+ is guarded (`typeof window/navigator !== 'undefined'` and per-property
1914
+ presence) so it is SSR-safe and never throws — it returns only the fields it
1915
+ could actually read, so the result may be partial or (in a headless
1916
+ environment) empty.
1917
+
1918
+ ```typescript
1919
+ function collectClientInfo(opts?: { appVersion?: string; theme?: string }): ClientInfo
1920
+ ```
1921
+
1922
+ - `opts` — Caller-supplied context.
1923
+ - `opts.appVersion` — The running build version, if known.
1924
+ - `opts.theme` — The active theme (`'light'` | `'dark'`), if known.
1925
+
1926
+ **Returns:** The populated subset of {@link ClientInfo}.
1927
+
1928
+ #### `buildReportPayload(form, clientInfo)`
1929
+
1930
+ Builds the `POST /projects/:id/report` body from the form state, trimming all
1931
+ text fields and omitting `steps` entirely when it is blank. When `clientInfo`
1932
+ is supplied and non-empty, it is attached; an `undefined` or empty diagnostics
1933
+ object is omitted from the payload.
1934
+
1935
+ ```typescript
1936
+ function buildReportPayload(form: ReportFormState, clientInfo?: ClientInfo): ReportPayload
1937
+ ```
1938
+
1939
+ - `form` — The report form state.
1940
+ - `clientInfo` — Optional client diagnostics from {@link collectClientInfo}.
1941
+
1942
+ **Returns:** The normalized report payload.
1943
+
1944
+ #### `isReportFormValid(form)`
1945
+
1946
+ Whether the report form has the minimum required fields: a non-empty title
1947
+ and a non-empty description.
1948
+
1949
+ ```typescript
1950
+ function isReportFormValid(form: ReportFormState): boolean
1951
+ ```
1952
+
1953
+ - `form` — The report form state.
1954
+
1955
+ **Returns:** `true` when the form can be submitted.
1956
+
1957
+ #### `formatReportConfirmation(result)`
1958
+
1959
+ Builds the confirmation message shown after a report is submitted. Returns the
1960
+ English defaults; the component passes these through `t()` at render. The
1961
+ success `defaultValue` may contain the `{{productName}}` interpolation token,
1962
+ which the caller fills in from the host's product identity (neutral default:
1963
+ "the IDE"). When the result is not `ok`, returns the failure message.
1964
+
1965
+ ```typescript
1966
+ function formatReportConfirmation(result: ReportResult): {
1967
+ key: string
1968
+ defaultValue: string
1969
+ }
1970
+ ```
1971
+
1972
+ - `result` — The `POST /projects/:id/report` response.
1973
+
1974
+ **Returns:** `{ key, defaultValue }` for the confirmation/failure message.
1975
+
1976
+ #### `isShareRole(value)`
1977
+
1978
+ Type guard for a valid {@link ShareRole} (case-insensitive callers should
1979
+ lower-case first).
1980
+
1981
+ ```typescript
1982
+ function isShareRole(value: string): value is ShareRole
1983
+ ```
1984
+
1985
+ - `value` — The candidate value.
1986
+
1987
+ **Returns:** `true` when `value` is one of the {@link SHARE_ROLES}.
1988
+
1989
+ #### `parseShareCommand(input)`
1990
+
1991
+ Parses a `/share [role]` command. Bare `/share` creates a link at the default
1992
+ `viewer` role; `/share <role>` uses the named role when valid (any case); an
1993
+ unrecognized role is reported as invalid so the caller can show usage. Returns
1994
+ `null` when the input is not the `/share` command.
1995
+
1996
+ ```typescript
1997
+ function parseShareCommand(input: string): ShareCommand | null
1998
+ ```
1999
+
2000
+ - `input` — The raw chat input.
2001
+
2002
+ **Returns:** The parsed {@link ShareCommand}, or `null`.
2003
+
2004
+ #### `buildSharePayload(role)`
2005
+
2006
+ Builds the `POST /projects/:projectId/shares` body for a role.
2007
+
2008
+ ```typescript
2009
+ function buildSharePayload(role?: ShareRole): SharePayload
2010
+ ```
2011
+
2012
+ - `role` — The role to grant (defaults to {@link DEFAULT_SHARE_ROLE}).
2013
+
2014
+ **Returns:** The normalized share payload.
2015
+
2016
+ #### `buildShareUrl(result, origin)`
2017
+
2018
+ Resolves the copyable public URL for a created share link. Prefers the
2019
+ backend-supplied `url` (canonical origin / custom domain); otherwise builds
2020
+ `<origin>/share/<slug>` from the given origin, tolerating a trailing slash.
2021
+
2022
+ ```typescript
2023
+ function buildShareUrl(result: ShareLinkResult, origin: string): string
2024
+ ```
2025
+
2026
+ - `result` — The created link from the share endpoint.
2027
+ - `origin` — The current page origin (e.g. `window.location.origin`).
2028
+
2029
+ **Returns:** The absolute, copyable share URL.
2030
+
2031
+ #### `parseChatTimestampsVisible(raw)`
2032
+
2033
+ Parses the stored preference. Only an explicit `'true'` shows every timestamp,
2034
+ so a missing or unreadable value keeps the default (off — only the user's own
2035
+ message headers and critical events carry a time; see {@link planChatTimestamps}).
2036
+
2037
+ ```typescript
2038
+ function parseChatTimestampsVisible(raw: string | null): boolean
2039
+ ```
2040
+
2041
+ - `raw` — The raw localStorage value.
2042
+
2043
+ **Returns:** Whether timestamps are visible on every item.
2044
+
2045
+ #### `getChatTimestampsVisible()`
2046
+
2047
+ Reads this device's preference.
2048
+
2049
+ ```typescript
2050
+ function getChatTimestampsVisible(): boolean
2051
+ ```
2052
+
2053
+ **Returns:** Whether chat timestamps are visible on every item (default `false`).
2054
+
2055
+ #### `resolveChatLocale(getLocale)` _(deprecated)_
2056
+
2057
+ The active i18n locale, or the browser's when reading it throws.
2058
+
2059
+ ```typescript
2060
+ function resolveChatLocale(getLocale: () => string): string
2061
+ ```
2062
+
2063
+ - `getLocale` — The i18n accessor.
2064
+
2065
+ **Returns:** A BCP 47 locale.
2066
+
2067
+ #### `planChatTimestamps(slots, options)`
2068
+
2069
+ Decides which timeline items actually render their timestamp. An item is a
2070
+ candidate when timestamps are on, or when its slot is {@link ChatTimestampSlot.alwaysShown}.
2071
+ A candidate renders only when its label differs from the last RENDERED label,
2072
+ so a run of items that would all read "3 minutes ago" shows it once, at the top
2073
+ of the run. Re-run on every minute tick: labels move with the clock, so the
2074
+ grouping does too.
2075
+
2076
+ ```typescript
2077
+ function planChatTimestamps(
2078
+ slots: readonly (ChatTimestampSlot | null)[],
2079
+ options: { visible: boolean; now: number; locale: string },
2080
+ ): Set<string>
2081
+ ```
2082
+
2083
+ - `slots` — One entry per rendered timeline item, in order (`null` = no timestamp).
2084
+ - `options` — The visibility preference, the current time, and the locale.
2085
+ - `options.visible` — Whether timestamps are turned on for every item.
2086
+ - `options.now` — Epoch milliseconds to measure from.
2087
+ - `options.locale` — BCP 47 locale for the labels.
2088
+
2089
+ **Returns:** The ids of the items whose timestamp renders.
2090
+
2091
+ #### `setChatTimestampsVisible(visible)`
2092
+
2093
+ Persists this device's preference and notifies every mounted chat in this tab.
2094
+
2095
+ ```typescript
2096
+ function setChatTimestampsVisible(visible: boolean): void
2097
+ ```
2098
+
2099
+ - `visible` — Whether chat timestamps should be shown.
2100
+
2101
+ #### `parseTimestampsCommand(input)`
2102
+
2103
+ Parses `/timestamps [on | off]`. `show`/`hide` are accepted as synonyms.
2104
+
2105
+ ```typescript
2106
+ function parseTimestampsCommand(input: string): TimestampsCommand | null
2107
+ ```
2108
+
2109
+ - `input` — The trimmed composer text.
2110
+
2111
+ **Returns:** The parsed command, or `null` when the text is not `/timestamps`.
2112
+
2113
+ #### `formatChatRelativeTime(ms, now, locale)`
2114
+
2115
+ Short, localized, MINUTE-precise time for a chat item: "now" and "5 minutes
2116
+ ago" within the hour, then the clock time ("9:25 AM") for earlier today, then
2117
+ the date and time ("Sep 12, 9:25 AM", with the year when it differs).
2118
+
2119
+ Minute precision at every age is load-bearing: {@link planChatTimestamps}
2120
+ collapses runs of identical labels, so a coarse label ("1 hour ago", "3 days
2121
+ ago") would collapse a whole hour or day of history into one timestamp.
2122
+ Localized by `Intl`, so it needs no translation keys.
2123
+
2124
+ ```typescript
2125
+ function formatChatRelativeTime(ms: number, now: number, locale: string): string
2126
+ ```
2127
+
2128
+ - `ms` — Epoch milliseconds of the item.
2129
+ - `now` — Epoch milliseconds to measure from.
2130
+ - `locale` — BCP 47 locale (e.g. `'en'`, `'fr'`).
2131
+
2132
+ **Returns:** The formatted label.
2133
+
2134
+ #### `formatChatFullTime(ms, locale)`
2135
+
2136
+ Exact, localized date and time for a chat item's tooltip and `<time dateTime>`
2137
+ companion (e.g. "Sep 13, 2026, 2:05 PM").
2138
+
2139
+ ```typescript
2140
+ function formatChatFullTime(ms: number, locale: string): string
2141
+ ```
2142
+
2143
+ - `ms` — Epoch milliseconds of the item.
2144
+ - `locale` — BCP 47 locale.
2145
+
2146
+ **Returns:** The formatted date and time.
2147
+
2148
+ #### `isDeviceRotatable(device)`
2149
+
2150
+ Whether a device frame can be rotated (true only for fixed-frame devices —
2151
+ tablet and mobile). Responsive and desktop are full-width with nothing to
2152
+ rotate, so the "Rotate" control is enabled only "where possible".
2153
+
2154
+ ```typescript
2155
+ function isDeviceRotatable(device: DeviceFrame): boolean
2156
+ ```
2157
+
2158
+ - `device` — The device frame.
2159
+
2160
+ **Returns:** `true` if the frame has a fixed size that can be rotated.
2161
+
2162
+ #### `resolveDeviceSize(device, orientation)`
2163
+
2164
+ Resolves the concrete iframe `width`/`height` for a device frame at a given
2165
+ orientation. Fluid frames (responsive/desktop) ignore orientation and fill
2166
+ the preview area (`width` from dims, `height: '100%'`). Fixed frames render
2167
+ at their pixel size in portrait and at the swapped size in landscape.
2168
+
2169
+ ```typescript
2170
+ function resolveDeviceSize(
2171
+ device: DeviceFrame,
2172
+ orientation: DeviceOrientation,
2173
+ ): { width: string; height: string }
2174
+ ```
2175
+
2176
+ - `device` — The device frame.
2177
+ - `orientation` — The preview orientation.
2178
+
2179
+ **Returns:** The CSS `width` and `height` to apply to the preview iframe.
2180
+
2181
+ #### `deviceIconName(device)`
2182
+
2183
+ Returns the icon-set glyph name for a device frame.
2184
+
2185
+ ```typescript
2186
+ function deviceIconName(device: DeviceFrame): string
2187
+ ```
2188
+
2189
+ - `device` — The device frame.
2190
+
2191
+ **Returns:** The icon name registered in the bonded icon set.
2192
+
2193
+ #### `groupTests(tests)`
2194
+
2195
+ Group tests for display: by kind (end-to-end first), then by project
2196
+ directory (whatever directories are present — `app`, `my-app/app`,
2197
+ `packages/web`, the root last), with the files sorted inside each group.
2198
+
2199
+ ```typescript
2200
+ function groupTests(tests: readonly TestItem[]): TestGroup[]
2201
+ ```
2202
+
2203
+ - `tests` — Every discovered test.
2204
+
2205
+ **Returns:** The groups, in display order. Empty groups are never produced.
2206
+
2207
+ #### `countByKind(tests)`
2208
+
2209
+ How many tests there are of each kind.
2210
+
2211
+ ```typescript
2212
+ function countByKind(tests: readonly TestItem[]): Record<TestKind, number>
2213
+ ```
2214
+
2215
+ - `tests` — Every discovered test.
2216
+
2217
+ **Returns:** The per-kind counts.
2218
+
2219
+ #### `summarizeResults(tests, results)`
2220
+
2221
+ The tallies of the last run, over the tests that are still listed. Counted
2222
+ per FILE (one row, one verdict) so the collapsed summary matches the rows.
2223
+
2224
+ ```typescript
2225
+ function summarizeResults(
2226
+ tests: readonly TestItem[],
2227
+ results: Record<string, TestResultEntry>,
2228
+ ): { passed: number; failed: number; skipped: number; reported: number }
2229
+ ```
2230
+
2231
+ - `tests` — The currently listed tests.
2232
+ - `results` — The per-id outcomes.
2233
+
2234
+ **Returns:** Passed/failed/skipped file counts.
2235
+
2236
+ #### `applyTestRunEvent(state, event)`
2237
+
2238
+ Fold one streamed event into the run state.
2239
+
2240
+ Deliberately total: an event for an id the card no longer lists is recorded
2241
+ anyway (a re-list may be in flight), a `case` that arrives out of order (after
2242
+ its file already reported a verdict) is dropped rather than resurrecting a
2243
+ finished row, and an unknown event type leaves the state untouched rather
2244
+ than throwing inside a stream handler.
2245
+
2246
+ ```typescript
2247
+ function applyTestRunEvent(state: TestsRunState, event: TestRunEvent): TestsRunState
2248
+ ```
2249
+
2250
+ - `state` — The current state.
2251
+ - `event` — The event just received.
2252
+
2253
+ **Returns:** The next state (a new object whenever anything changed).
2254
+
2255
+ #### `requestSkip(state)`
2256
+
2257
+ Record that the person asked to skip what is running. The state only says a
2258
+ request is OUT — the run's own `result` for the skipped file is what actually
2259
+ moves the row, so nothing here can make a skipped file read as anything else.
2260
+
2261
+ ```typescript
2262
+ function requestSkip(state: TestsRunState): TestsRunState
2263
+ ```
2264
+
2265
+ - `state` — The current state.
2266
+
2267
+ **Returns:** The next state, or the same one when there is nothing to skip.
2268
+
2269
+ #### `markSkipUnavailable(state)`
2270
+
2271
+ Record that skipping is not on offer — either the host wired no `skipCurrent`
2272
+ or it answered that the run had already moved on. The control is dropped; the
2273
+ person is not shown an error about a race they did not cause.
2274
+
2275
+ ```typescript
2276
+ function markSkipUnavailable(state: TestsRunState): TestsRunState
2277
+ ```
2278
+
2279
+ - `state` — The current state.
2280
+
2281
+ **Returns:** The next state.
2282
+
2283
+ #### `canSkipRun(state)`
2284
+
2285
+ Whether the host can be asked to skip right now.
2286
+
2287
+ ```typescript
2288
+ function canSkipRun(state: TestsRunState): boolean
2289
+ ```
2290
+
2291
+ - `state` — The run state.
2292
+
2293
+ **Returns:** True when a Skip control belongs on screen.
2294
+
2295
+ #### `currentRunRowId(state)`
2296
+
2297
+ Which row the Skip acts on: the one the stream named as current, or — when it
2298
+ has not named one yet — the single row still awaiting a verdict, because with
2299
+ exactly one candidate there is nothing to be ambiguous about.
2300
+
2301
+ ```typescript
2302
+ function currentRunRowId(state: TestsRunState): string | null
2303
+ ```
2304
+
2305
+ - `state` — The run state.
2306
+
2307
+ **Returns:** The row's id, or `null` when the run is not on an identifiable row.
2308
+
2309
+ #### `testCaseLabel(current)`
2310
+
2311
+ The one-line name of the test a file is on: its group and its title, or just
2312
+ its title when the runner gave it no group.
2313
+
2314
+ ```typescript
2315
+ function testCaseLabel(current: TestCaseRef | null | undefined): string
2316
+ ```
2317
+
2318
+ - `current` — The running test, or `null`.
2319
+
2320
+ **Returns:** The label, or `` when nothing is named.
2321
+
2322
+ #### `failRun(state, message)`
2323
+
2324
+ The state after a run that never produced a `done` event — the host's stream
2325
+ died, or its request failed before the server could answer.
2326
+
2327
+ ```typescript
2328
+ function failRun(state: TestsRunState, message: string): TestsRunState
2329
+ ```
2330
+
2331
+ - `state` — The current state.
2332
+ - `message` — What to show in the card.
2333
+
2334
+ **Returns:** The next state, no longer running.
2335
+
2336
+ #### `isRowRunning(state, id)`
2337
+
2338
+ Whether a row should render as "running": the run is live and either the host
2339
+ named this row as current, or it is in the queue and has no verdict yet.
2340
+
2341
+ ```typescript
2342
+ function isRowRunning(state: TestsRunState, id: string): boolean
2343
+ ```
2344
+
2345
+ - `state` — The run state.
2346
+ - `id` — The row's test id.
2347
+
2348
+ **Returns:** True when the row is part of the live run and still undecided.
2349
+
2350
+ #### `testRowLabel(item)`
2351
+
2352
+ The label for a row: the host's title when it gave one, else the file path.
2353
+
2354
+ ```typescript
2355
+ function testRowLabel(item: TestItem): string
2356
+ ```
2357
+
2358
+ - `item` — The test.
2359
+
2360
+ **Returns:** The label to render.
2361
+
2362
+ #### `filterTests(tests, query)`
2363
+
2364
+ Filters tests by a free-text query, matching (case-insensitively) against the
2365
+ file path, the row title, and the project directory. A blank query returns
2366
+ every test in input order — the same contract as `filterScripts`.
2367
+
2368
+ ```typescript
2369
+ function filterTests(tests: readonly TestItem[], query: string): TestItem[]
2370
+ ```
2371
+
2372
+ - `tests` — The tests to filter.
2373
+ - `query` — The search query.
2374
+
2375
+ **Returns:** The matching tests, in input order.
2376
+
2377
+ #### `parseTestCommand(input)`
2378
+
2379
+ Parses a `/test [query | all]` command (`/tests` is the registered alias).
2380
+
2381
+ `all` is the one argument that ACTS: it runs everything immediately. Every
2382
+ other argument only filters the list, exactly the way `/scripts <query>` seeds
2383
+ the scripts browser — running ONE test by name is what the per-row Run button
2384
+ is for, and giving the argument a second meaning would make `/test <thing>`
2385
+ sometimes list and sometimes execute.
2386
+
2387
+ ```typescript
2388
+ function parseTestCommand(input: string): { query: string; runAll: boolean } | null
2389
+ ```
2390
+
2391
+ - `input` — The raw chat input.
2392
+
2393
+ **Returns:** `{ query, runAll }` when it is a `/test` command, else `null`.
2394
+
2395
+ #### `buildTestFixMessage(failures)`
2396
+
2397
+ Compose the ONE user message the card's “Fix with Synthase” action sends.
2398
+
2399
+ It is a real turn the executor answers, so it reads like something a person
2400
+ would type: which test failed, where it lives, what the runner said, and to
2401
+ re-run it. This is a PROMPT, not UI copy — it is not translated, exactly like
2402
+ the auto-fix loop’s own `Fix these issues:` message.
2403
+
2404
+ ```typescript
2405
+ function buildTestFixMessage(failures: readonly TestFailure[]): string
2406
+ ```
2407
+
2408
+ - `failures` — The failing tests, in the order the card lists them.
2409
+
2410
+ **Returns:** The message, or `` when there is nothing to fix.
2411
+
2412
+ #### `failedTests(tests, results)`
2413
+
2414
+ Every listed test whose last verdict was a failure, with its output — what
2415
+ the card's fix actions send.
2416
+
2417
+ ```typescript
2418
+ function failedTests(
2419
+ tests: readonly TestItem[],
2420
+ results: Record<string, TestResultEntry>,
2421
+ ): TestFailure[]
2422
+ ```
2423
+
2424
+ - `tests` — The currently listed (and filtered) tests.
2425
+ - `results` — The per-id outcomes.
2426
+
2427
+ **Returns:** The failures, in list order.
2428
+
2429
+ #### `resolveUserAvatar(avatar)`
2430
+
2431
+ Resolve a stored avatar value to a safe `<img>` src, or `null` to fall back to
2432
+ the generic icon.
2433
+
2434
+ ```typescript
2435
+ function resolveUserAvatar(avatar?: string | null): string | null
2436
+ ```
2437
+
2438
+ - `avatar` — The avatar value from user metadata (data-URI, URL, or absent).
2439
+
2440
+ **Returns:** A safe image src string, or `null` when there is no renderable avatar.
2441
+
2442
+ #### `hasRenderableAvatar(avatar)`
2443
+
2444
+ Whether a stored avatar value is renderable (vs. needing the icon fallback).
2445
+
2446
+ ```typescript
2447
+ function hasRenderableAvatar(avatar?: string | null): boolean
2448
+ ```
2449
+
2450
+ - `avatar` — The avatar value from user metadata.
2451
+
2452
+ **Returns:** `true` when {@link resolveUserAvatar} would return a src.
2453
+
2454
+ #### `clampPanelSize(currentSize, deltaPx, containerWidth, min, max)`
2455
+
2456
+ Clamp a panel's new size after a pixel drag delta.
2457
+
2458
+ ```typescript
2459
+ function clampPanelSize(
2460
+ currentSize: number,
2461
+ deltaPx: number,
2462
+ containerWidth: number,
2463
+ min?: number,
2464
+ max?: number,
2465
+ ): number
2466
+ ```
2467
+
2468
+ - `currentSize` — The panel's current size as a percentage.
2469
+ - `deltaPx` — The drag delta in pixels (positive = grow the left panel).
2470
+ - `containerWidth` — The layout container width in pixels.
2471
+ - `min` — Minimum allowed percentage. Defaults to {@link MIN_PANEL_PERCENT}.
2472
+ - `max` — Maximum allowed percentage. Defaults to {@link MAX_PANEL_PERCENT}.
2473
+
2474
+ **Returns:** The new size as a percentage, clamped to `[min, max]`.
2475
+
2476
+ #### `livePanelSize(layout, panelConfigs, index)`
2477
+
2478
+ The live size (percentage) of the visible panel at `index`, read from
2479
+ `layout.sizes` keyed by the panel's position group (where `resizePanel`
2480
+ writes), falling back to the panel's `defaultSize`, then to an equal split.
2481
+
2482
+ ```typescript
2483
+ function livePanelSize(layout: WorkspaceLayout, panelConfigs: PanelConfig[], index: number): number
2484
+ ```
2485
+
2486
+ - `layout` — The current workspace layout.
2487
+ - `panelConfigs` — The visible panel configs, in render order.
2488
+ - `index` — The index of the panel within `panelConfigs`.
2489
+
2490
+ **Returns:** The panel size as a percentage.
2491
+
2492
+ #### `registerCustomEventCard(name, factory)`
2493
+
2494
+ Register a renderer for a custom chat-stream event. Consuming apps call this at
2495
+ startup so their own `{ type: 'custom', name }` events surface as chat cards —
2496
+ keeping app-specific events out of the core ai-chat union and this package's
2497
+ ChatPanel. Re-registering the same name overwrites the previous factory.
2498
+
2499
+ ```typescript
2500
+ function registerCustomEventCard(name: string, factory: ChatEventCardFactory): void
2501
+ ```
2502
+
2503
+ - `name` — The custom event `name` to handle (matches the emitted event's `name`).
2504
+ - `factory` — Builds the card from the event's `data` (or returns null to skip).
2505
+
2506
+ #### `getCustomEventCardFactory(name)`
2507
+
2508
+ Resolve the registered card factory for a custom event name, if any.
2509
+
2510
+ ```typescript
2511
+ function getCustomEventCardFactory(name: string): ChatEventCardFactory | undefined
2512
+ ```
2513
+
2514
+ - `name` — The custom event `name`.
2515
+
2516
+ **Returns:** The registered factory, or undefined if none is registered.
2517
+
2518
+ #### `serializeEvent(e, isMac)`
2519
+
2520
+ Serialize a `KeyboardEvent` into a normalized combo string.
2521
+ Format: modifier keys in order `mod+ctrl+alt+shift+key` (lowercase).
2522
+ `mod` maps to Meta on Mac, Control elsewhere.
2523
+
2524
+ ```typescript
2525
+ function serializeEvent(e: KeyboardEvent, isMac?: boolean): string
2526
+ ```
2527
+
2528
+ - `e` — The keyboard event.
2529
+ - `isMac` — Override platform detection (for testing).
2530
+
2531
+ **Returns:** Serialized combo string.
2532
+
2533
+ #### `normalizeKeys(keys)`
2534
+
2535
+ Normalize a shortcut definition string into the same format produced by
2536
+ `serializeEvent`. Accepts `mod+shift+f` style strings (case-insensitive).
2537
+
2538
+ ```typescript
2539
+ function normalizeKeys(keys: string): string
2540
+ ```
2541
+
2542
+ - `keys` — Raw shortcut string.
2543
+
2544
+ **Returns:** Normalized lowercase combo string.
2545
+
2546
+ #### `isInputFocused(e)`
2547
+
2548
+ Returns true when the event target is an interactive input element
2549
+ where shortcuts should be suppressed by default.
2550
+
2551
+ ```typescript
2552
+ function isInputFocused(e: KeyboardEvent): boolean
2553
+ ```
2554
+
2555
+ - `e` — The keyboard event.
2556
+
2557
+ **Returns:** Whether an input-like element is focused.
2558
+
2559
+ #### `isMonacoFocused(e)`
2560
+
2561
+ Returns true when focus is inside a Monaco editor instance.
2562
+
2563
+ ```typescript
2564
+ function isMonacoFocused(e: KeyboardEvent): boolean
2565
+ ```
2566
+
2567
+ - `e` — The keyboard event.
2568
+
2569
+ **Returns:** Whether the target is inside `.monaco-editor`.
2570
+
2571
+ #### `isShortcutBlockedByFocus(shortcut, e)`
2572
+
2573
+ Whether where the key was pressed rules a shortcut out. Inside the Monaco
2574
+ editor only `allowInEditor` decides: Monaco takes keys through its own hidden
2575
+ `<textarea>`, which is the editor, not a text field, so `allowInInput` neither
2576
+ blocks nor allows it there. Elsewhere a text field (`<input>`, `<textarea>`,
2577
+ `<select>`, an editable element) rules it out unless `allowInInput` is set.
2578
+
2579
+ ```typescript
2580
+ function isShortcutBlockedByFocus(
2581
+ shortcut: Pick<KeyboardShortcut, 'allowInInput' | 'allowInEditor'>,
2582
+ e: KeyboardEvent,
2583
+ ): boolean
2584
+ ```
2585
+
2586
+ - `shortcut` — The shortcut's focus flags.
2587
+ - `e` — The keyboard event.
2588
+
2589
+ **Returns:** `true` when the shortcut must not fire for this event.
2590
+
2591
+ #### `findKeyboardShortcut(shortcuts, e, isMac)`
2592
+
2593
+ The shortcut a keydown triggers: the first whose keys match the event's combo
2594
+ and whose focus flags allow where it was pressed ({@link isShortcutBlockedByFocus}).
2595
+ A matching shortcut the focus rules out lets a later one with the same keys fire.
2596
+
2597
+ ```typescript
2598
+ function findKeyboardShortcut<S extends KeyboardShortcut>(
2599
+ shortcuts: readonly S[],
2600
+ e: KeyboardEvent,
2601
+ isMac?: boolean,
2602
+ ): S | undefined
2603
+ ```
2604
+
2605
+ - `shortcuts` — The registered shortcuts, in priority order.
2606
+ - `e` — The keyboard event.
2607
+ - `isMac` — Override platform detection (for testing).
2608
+
2609
+ **Returns:** The shortcut to run, or `undefined` when the key is not one.
2610
+
2611
+ ### Constants
2612
+
2613
+ #### `COMMAND_CATEGORIES`
2614
+
2615
+ Ordered list of command categories used as section headings.
2616
+
2617
+ ```typescript
2618
+ const COMMAND_CATEGORIES: readonly CommandCategory[]
2619
+ ```
2620
+
2621
+ #### `COMMANDS`
2622
+
2623
+ Every available slash command, grouped by category order. This is the
2624
+ authoritative list — the menu, key handling, `/help`, AND the system prompt's
2625
+ "Available Commands" section all read from it.
2626
+
2627
+ ```typescript
2628
+ const COMMANDS: readonly CommandDef[]
2629
+ ```
2630
+
2631
+ #### `ACTIVITY_TYPES`
2632
+
2633
+ All channel types, in the order their filter tabs should appear.
2634
+
2635
+ ```typescript
2636
+ const ACTIVITY_TYPES: ActivityType[]
2637
+ ```
2638
+
2639
+ #### `AUTO_COMMIT_DISABLED`
2640
+
2641
+ The disabled (off) countdown state — the reducer's initial value.
2642
+
2643
+ ```typescript
2644
+ const AUTO_COMMIT_DISABLED: AutoCommitState
2645
+ ```
2646
+
2647
+ #### `DEFAULT_AUTO_COMMIT_SECONDS`
2648
+
2649
+ The default auto-commit cadence in seconds — auto-commit is ON by default.
2650
+ Projects that have never persisted `autoCommitSeconds` hydrate to this
2651
+ cadence (paused, arming on the first file change); only an explicit `0`
2652
+ (the user cancelled) keeps auto-commit off.
2653
+
2654
+ The value is the TOTAL debounce after the last file change (once the agent's
2655
+ turn has finished): a short quiet period, then the final
2656
+ {@link AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS} seconds render as a live
2657
+ countdown on the commit button. 5s = 2s quiet + 3s visible countdown.
2658
+
2659
+ ```typescript
2660
+ const DEFAULT_AUTO_COMMIT_SECONDS: 5
2661
+ ```
2662
+
2663
+ #### `AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS`
2664
+
2665
+ How many final seconds of the countdown are DISPLAYED as a live countdown.
2666
+ Until the countdown drops to this threshold, the commit-bar button stays a
2667
+ plain green "Commit" (a bare "12s" pill told users nothing); the countdown
2668
+ label only takes over for these last seconds, right before the auto-commit
2669
+ fires. Cadences at or below the threshold show the countdown the whole time.
2670
+
2671
+ ```typescript
2672
+ const AUTO_COMMIT_COUNTDOWN_VISIBLE_SECONDS: 3
2673
+ ```
2674
+
2675
+ #### `CHAT_CARD_NEUTRAL_ACCENT`
2676
+
2677
+ Neutral accent for non-semantic info cards: the theme's primary colour, so a
2678
+ card that has no status meaning is still subtly _tinted_ (never a flat gray
2679
+ surface) and recolors with the brand.
2680
+
2681
+ ```typescript
2682
+ const CHAT_CARD_NEUTRAL_ACCENT: 'var(--mol-color-primary, #6366f1)'
2683
+ ```
2684
+
2685
+ #### `CHAT_CARD_ICON_SIZE`
2686
+
2687
+ Uniform leading-icon size (px) for every chat-timeline info card.
2688
+
2689
+ ```typescript
2690
+ const CHAT_CARD_ICON_SIZE: 18
2691
+ ```
2692
+
2693
+ #### `EMPTY_REPORT_FORM`
2694
+
2695
+ An empty report form (the modal's initial state).
2696
+
2697
+ ```typescript
2698
+ const EMPTY_REPORT_FORM: ReportFormState
2699
+ ```
2700
+
2701
+ #### `SHARE_ROLES`
2702
+
2703
+ Share roles, ordered least- to most-privileged. Mirrors the
2704
+ `@molecule/api-resource-share` `SHARE_ROLES` contract; duplicated here (rather
2705
+ than imported) because an `app-*` package may not import an `api-*` package
2706
+ across the stack boundary.
2707
+
2708
+ ```typescript
2709
+ const SHARE_ROLES: readonly ['viewer', 'commenter', 'editor', 'owner']
2710
+ ```
2711
+
2712
+ #### `DEFAULT_SHARE_ROLE`
2713
+
2714
+ The default (and safest) role when `/share` is run with no argument.
2715
+
2716
+ ```typescript
2717
+ const DEFAULT_SHARE_ROLE: ShareRole
2718
+ ```
2719
+
2720
+ #### `SHARE_ROLE_LABELS`
2721
+
2722
+ Short English labels per role (the component wraps these in `t()` at render).
2723
+
2724
+ ```typescript
2725
+ const SHARE_ROLE_LABELS: Record<ShareRole, string>
2726
+ ```
2727
+
2728
+ #### `CHAT_TIMESTAMPS_STORAGE_KEY`
2729
+
2730
+ localStorage key holding `'true'` / `'false'`. Absent = the default (hidden).
2731
+
2732
+ ```typescript
2733
+ const CHAT_TIMESTAMPS_STORAGE_KEY: 'mol_chat_show_timestamps'
2734
+ ```
2735
+
2736
+ #### `CHAT_TIMESTAMPS_EVENT`
2737
+
2738
+ Window event dispatched (same tab) whenever the preference changes.
2739
+
2740
+ ```typescript
2741
+ const CHAT_TIMESTAMPS_EVENT: 'mol:chat-timestamps-changed'
2742
+ ```
2743
+
2744
+ #### `DEVICE_FRAMES`
2745
+
2746
+ The device frames the selector dropdown lists, in display order.
2747
+ `none` = responsive (no fixed frame, full width).
2748
+
2749
+ ```typescript
2750
+ const DEVICE_FRAMES: readonly DeviceFrame[]
2751
+ ```
2752
+
2753
+ #### `DEVICE_META`
2754
+
2755
+ Per-frame display metadata: the icon-set glyph name and the i18n label
2756
+ (key + English default) shown in the dropdown trigger + menu items.
2757
+
2758
+ ```typescript
2759
+ const DEVICE_META: Record<
2760
+ DeviceFrame,
2761
+ { readonly icon: IconName; readonly labelKey: string; readonly label: string }
2762
+ >
2763
+ ```
2764
+
2765
+ #### `DEVICE_DIMENSIONS`
2766
+
2767
+ The fixed pixel frame each device renders the preview iframe at. `none`
2768
+ (responsive) and `desktop` are fluid — full width, full height, nothing to
2769
+ rotate. `tablet` (768×1024) and `mobile` (375×667) are fixed frames that can
2770
+ be rotated to landscape (swapping width/height).
2771
+
2772
+ ```typescript
2773
+ const DEVICE_DIMENSIONS: Record<DeviceFrame, DeviceDimensions>
2774
+ ```
2775
+
2776
+ #### `DEFAULT_SEARCH_EXCLUDED_DIRS`
2777
+
2778
+ Default search-excluded directory names shown when the host supplies none —
2779
+ VS Code's `search.exclude`/`files.exclude` defaults plus the platform's
2780
+ vendored/build dirs. MUST stay in sync with the API-side list in
2781
+ `@molecule/api-ai-tools` (utilities.ts) — the cross-stack import boundary
2782
+ forces the duplication; `molecule/scripts/__tests__/search-excluded-dirs-sync.test.mjs` fails
2783
+ when the two differ.
2784
+
2785
+ ```typescript
2786
+ const DEFAULT_SEARCH_EXCLUDED_DIRS: readonly [
2787
+ 'node_modules',
2788
+ 'bower_components',
2789
+ '.git',
2790
+ '.svn',
2791
+ '.hg',
2792
+ 'CVS',
2793
+ 'dist',
2794
+ '.next',
2795
+ '.vite',
2796
+ 'molecule',
2797
+ ]
2798
+ ```
2799
+
2800
+ #### `MAX_OUTPUT_LINES`
2801
+
2802
+ Live output lines retained — enough to read, bounded so a chatty run cannot grow forever.
2803
+
2804
+ ```typescript
2805
+ const MAX_OUTPUT_LINES: 400
2806
+ ```
2807
+
2808
+ #### `EMPTY_RUN_STATE`
2809
+
2810
+ A run that has not started.
2811
+
2812
+ ```typescript
2813
+ const EMPTY_RUN_STATE: TestsRunState
2814
+ ```
2815
+
2816
+ #### `MAX_FIX_OUTPUT_CHARS`
2817
+
2818
+ Output kept per failure when several are batched into one fix message.
2819
+
2820
+ ```typescript
2821
+ const MAX_FIX_OUTPUT_CHARS: 2000
2822
+ ```
2823
+
2824
+ #### `MAX_FIX_MESSAGE_OUTPUT_CHARS`
2825
+
2826
+ Total output kept across a batched fix message, so one click cannot send a novel.
2827
+
2828
+ ```typescript
2829
+ const MAX_FIX_MESSAGE_OUTPUT_CHARS: 12000
2830
+ ```
2831
+
2832
+ #### `MAX_AVATAR_SRC_LENGTH`
2833
+
2834
+ Maximum avatar source length we will render inline (~256 KB data-URI).
2835
+
2836
+ ```typescript
2837
+ const MAX_AVATAR_SRC_LENGTH: 262144
2838
+ ```
2839
+
2840
+ #### `MIN_PANEL_PERCENT`
2841
+
2842
+ Smallest a panel may shrink to, as a percentage of the container.
2843
+
2844
+ ```typescript
2845
+ const MIN_PANEL_PERCENT: 10
2846
+ ```
2847
+
2848
+ #### `MAX_PANEL_PERCENT`
2849
+
2850
+ Largest a panel may grow to, as a percentage of the container.
2851
+
2852
+ ```typescript
2853
+ const MAX_PANEL_PERCENT: 80
2854
+ ```
2855
+
2856
+ #### `IS_MAC`
2857
+
2858
+ Whether the platform is macOS or iOS, where `mod` means Cmd instead of Ctrl.
2859
+
2860
+ ```typescript
2861
+ const IS_MAC: boolean
2862
+ ```
2863
+
2864
+ #### `SETTINGS`
2865
+
2866
+ Every user-controllable setting, in display order. The authoritative list —
2867
+ the `/settings` view (via `buildSettingsList`) and the system prompt both read
2868
+ from it, so they cannot drift. The default `model` and the per-mode
2869
+ `planModel` / `executeModel` rows are kept distinct (rather than collapsed
2870
+ into one "Model" row); `effort`, `autoCommit`, and `hooks` are each listed
2871
+ alongside (or in `hooks`' case, instead of) the command the panel references —
2872
+ so a user's actual configuration is never understated and the panel never
2873
+ shows a command for a setting it hides.
2874
+
2875
+ ```typescript
2876
+ const SETTINGS: readonly SettingMeta[]
2877
+ ```
2878
+
2879
+ #### `NARROW_VIEWPORT_QUERY`
2880
+
2881
+ The phone-width media query — matches viewports below 768px, mirroring the
2882
+ host workspace's single-pane mobile breakpoint.
2883
+
2884
+ ```typescript
2885
+ const NARROW_VIEWPORT_QUERY: '(max-width: 767px)'
2886
+ ```
2887
+
2888
+ #### `COARSE_POINTER_QUERY`
2889
+
2890
+ The touch-first media query — matches when the PRIMARY pointer is coarse
2891
+ (finger), i.e. phones/tablets, regardless of viewport width.
2892
+
2893
+ ```typescript
2894
+ const COARSE_POINTER_QUERY: '(pointer: coarse)'
2895
+ ```
2896
+
2897
+ ## Injection Notes
2898
+
2899
+ ### Requirements
2900
+
2901
+ Peer dependencies:
2902
+
2903
+ - `@molecule/app-ai-chat` ^1.8.0
2904
+ - `@molecule/app-ai-models` ^1.0.1
2905
+ - `@molecule/app-code-editor` ^1.0.1
2906
+ - `@molecule/app-i18n` ^1.0.1
2907
+ - `@molecule/app-icons` ^1.0.1
2908
+ - `@molecule/app-ide` ^1.0.1
2909
+ - `@molecule/app-live-preview` ^1.0.1
2910
+ - `@molecule/app-storage` ^1.1.1
2911
+
2912
+ ### Runtime Dependencies
2913
+
2914
+ - `@molecule/app-ai-chat`
2915
+ - `@molecule/app-ai-models`
2916
+ - `@molecule/app-code-editor`
2917
+ - `@molecule/app-i18n`
2918
+ - `@molecule/app-icons`
2919
+ - `@molecule/app-ide`
2920
+ - `@molecule/app-live-preview`
2921
+ - `@molecule/app-storage`
2922
+
2923
+ - The `./panels` entry holds the further helper modules the panel views use
2924
+ directly; it is not re-exported by the framework packages.
2925
+ - `registerCustomEventCard()` holds module state: every importer reaches THIS
2926
+ package's one copy of the registry, never a second one.