@sixb/app 0.1.16 → 0.1.18

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 (106) hide show
  1. package/README.md +8 -0
  2. package/dist/agent/agent-chat.d.ts.map +1 -1
  3. package/dist/agent/bash/interpret.d.ts +6 -2
  4. package/dist/agent/bash/interpret.d.ts.map +1 -1
  5. package/dist/agent/components/approval-mode-icons.d.ts +5 -0
  6. package/dist/agent/components/approval-mode-icons.d.ts.map +1 -0
  7. package/dist/agent/components/composer-add-menu.d.ts +15 -0
  8. package/dist/agent/components/composer-add-menu.d.ts.map +1 -0
  9. package/dist/agent/components/composer-commands.d.ts +37 -0
  10. package/dist/agent/components/composer-commands.d.ts.map +1 -0
  11. package/dist/agent/components/composer-menu.d.ts +18 -15
  12. package/dist/agent/components/composer-menu.d.ts.map +1 -1
  13. package/dist/agent/components/composer-settings.d.ts +34 -0
  14. package/dist/agent/components/composer-settings.d.ts.map +1 -0
  15. package/dist/agent/components/composer.d.ts +10 -3
  16. package/dist/agent/components/composer.d.ts.map +1 -1
  17. package/dist/agent/components/context-chips.d.ts +5 -0
  18. package/dist/agent/components/context-chips.d.ts.map +1 -1
  19. package/dist/agent/components/conversation-panel.d.ts +3 -1
  20. package/dist/agent/components/conversation-panel.d.ts.map +1 -1
  21. package/dist/agent/components/dictation-bar.d.ts +7 -3
  22. package/dist/agent/components/dictation-bar.d.ts.map +1 -1
  23. package/dist/agent/components/model-picker-row.d.ts +1 -3
  24. package/dist/agent/components/model-picker-row.d.ts.map +1 -1
  25. package/dist/agent/components/reasoning-effort-slider.d.ts.map +1 -1
  26. package/dist/agent/components/shared-thread-notice.d.ts +4 -2
  27. package/dist/agent/components/shared-thread-notice.d.ts.map +1 -1
  28. package/dist/agent/delegation/use-children.d.ts.map +1 -1
  29. package/dist/agent/hooks/use-agent-conversation.d.ts +2 -0
  30. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  31. package/dist/agent/hooks/use-thread-lists.d.ts +8 -0
  32. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -1
  33. package/dist/agent/i18n/en.d.ts +69 -8
  34. package/dist/agent/i18n/en.d.ts.map +1 -1
  35. package/dist/agent/i18n/fr.d.ts.map +1 -1
  36. package/dist/agent/i18n/index.d.ts +126 -12
  37. package/dist/agent/i18n/index.d.ts.map +1 -1
  38. package/dist/agent/model-selection.d.ts +1 -0
  39. package/dist/agent/model-selection.d.ts.map +1 -1
  40. package/dist/agent/run-sounds.d.ts +18 -0
  41. package/dist/agent/run-sounds.d.ts.map +1 -0
  42. package/dist/chunk-6n5pdqp0.js.map +1 -1
  43. package/dist/{chunk-12v6y89k.js → chunk-btky7c9w.js} +11678 -11190
  44. package/dist/{chunk-12v6y89k.js.map → chunk-btky7c9w.js.map} +59 -57
  45. package/dist/{chunk-bpj9mg5c.js → chunk-gq6xek89.js} +1 -1
  46. package/dist/{chunk-bpj9mg5c.js.map → chunk-gq6xek89.js.map} +1 -1
  47. package/dist/{chunk-hzy2g13h.js → chunk-hdbmj6f0.js} +1 -1
  48. package/dist/{chunk-hzy2g13h.js.map → chunk-hdbmj6f0.js.map} +1 -1
  49. package/dist/chunk-md3p7qdt.js.map +1 -1
  50. package/dist/{chunk-2a69ge8h.js → chunk-pkcm8rn8.js} +1 -1
  51. package/dist/{chunk-2a69ge8h.js.map → chunk-pkcm8rn8.js.map} +1 -1
  52. package/dist/chunk-yvhzn4ye.js.map +1 -1
  53. package/dist/codegen.d.ts.map +1 -1
  54. package/dist/createCustomApp.d.ts.map +1 -1
  55. package/dist/frame-origins.d.ts +10 -0
  56. package/dist/frame-origins.d.ts.map +1 -0
  57. package/dist/index.d.ts +2 -1
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +6 -6
  60. package/dist/index.js.map +3 -3
  61. package/dist/pages/settings/messages.d.ts +16 -0
  62. package/dist/pages/settings/messages.d.ts.map +1 -1
  63. package/dist/pages/settings/personal.d.ts +2 -2
  64. package/dist/pages/settings/personal.d.ts.map +1 -1
  65. package/dist/pages.js +49 -3
  66. package/dist/pages.js.map +4 -4
  67. package/dist/server.js +97 -22
  68. package/dist/server.js.map +6 -5
  69. package/package.json +3 -3
  70. package/src/agent/agent-chat.tsx +6 -1
  71. package/src/agent/agent.css +145 -14
  72. package/src/agent/bash/interpret.ts +41 -5
  73. package/src/agent/components/approval-mode-icons.ts +9 -0
  74. package/src/agent/components/composer-add-menu.tsx +126 -0
  75. package/src/agent/components/composer-commands.tsx +165 -0
  76. package/src/agent/components/composer-menu.tsx +33 -46
  77. package/src/agent/components/composer-settings.tsx +437 -0
  78. package/src/agent/components/composer.tsx +312 -153
  79. package/src/agent/components/context-chips.tsx +21 -8
  80. package/src/agent/components/conversation-panel.tsx +16 -9
  81. package/src/agent/components/dictation-bar.tsx +28 -23
  82. package/src/agent/components/model-picker-row.tsx +14 -24
  83. package/src/agent/components/reasoning-effort-slider.tsx +14 -10
  84. package/src/agent/components/shared-thread-notice.tsx +7 -2
  85. package/src/agent/components/transcript.tsx +2 -1
  86. package/src/agent/hooks/use-agent-conversation.ts +18 -6
  87. package/src/agent/i18n/en.ts +58 -15
  88. package/src/agent/i18n/fr.ts +77 -13
  89. package/src/agent/model-selection.ts +4 -0
  90. package/src/agent/publish-artifact/publish-artifact-tool-view.tsx +3 -2
  91. package/src/agent/run-sounds.ts +171 -0
  92. package/src/codegen.ts +44 -0
  93. package/src/createCustomApp.ts +53 -26
  94. package/src/frame-origins.ts +61 -0
  95. package/src/index.ts +5 -1
  96. package/src/pages/settings/messages.ts +8 -0
  97. package/src/pages/settings/personal.tsx +60 -3
  98. package/dist/agent/components/approval-mode-chip.d.ts +0 -15
  99. package/dist/agent/components/approval-mode-chip.d.ts.map +0 -1
  100. package/dist/agent/components/auto-model-chip.d.ts +0 -23
  101. package/dist/agent/components/auto-model-chip.d.ts.map +0 -1
  102. package/dist/agent/components/model-controls.d.ts +0 -41
  103. package/dist/agent/components/model-controls.d.ts.map +0 -1
  104. package/src/agent/components/approval-mode-chip.tsx +0 -120
  105. package/src/agent/components/auto-model-chip.tsx +0 -219
  106. package/src/agent/components/model-controls.tsx +0 -238
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sixb/app",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Custom app toolkit for Sixb projects — route scanning, dev serving, and production builds",
5
5
  "keywords": [
6
6
  "sixb",
@@ -54,8 +54,8 @@
54
54
  "prepack": "bun run build"
55
55
  },
56
56
  "dependencies": {
57
- "@sixb/client": "^0.1.23",
58
- "@sixb/core": "^0.1.24",
57
+ "@sixb/client": "^0.1.24",
58
+ "@sixb/core": "^0.1.26",
59
59
  "@sixb/ui": "^0.1.8",
60
60
  "@tailwindcss/cli": "^4.2.2",
61
61
  "@xyflow/react": "^12.10.2",
@@ -88,6 +88,8 @@ export function AgentChat({
88
88
  // Sharing needs someone signed in: without auth, the project owns every conversation.
89
89
  const sharingThread = conversation.user ? currentThread : null
90
90
  const participant = sharingThread !== null && conversation.access === "participant"
91
+ // A thread on its owner's computer runs as them, in their folder: its participants follow it.
92
+ const readOnly = participant && currentThread?.runsOn === "computer"
91
93
 
92
94
  const conversationHeaderActions =
93
95
  threadId || hostHeaderActions ? (
@@ -168,8 +170,11 @@ export function AgentChat({
168
170
  welcomeContent={welcomeContent}
169
171
  headerActions={conversationHeaderActions}
170
172
  composerNotice={
171
- participant ? <SharedThreadNotice owner={owner} sharing={sharing} /> : undefined
173
+ participant ? (
174
+ <SharedThreadNotice owner={owner} sharing={sharing} onComputer={readOnly} />
175
+ ) : undefined
172
176
  }
177
+ readOnly={readOnly}
173
178
  />
174
179
  )
175
180
  }
@@ -95,7 +95,8 @@
95
95
  overflow: hidden;
96
96
  pointer-events: none;
97
97
  border-radius: 9999px;
98
- background: var(--muted);
98
+ /* A tint, not a surface colour: it reads on a menu and on a chosen row's highlight alike. */
99
+ background: color-mix(in oklab, var(--foreground) 9%, transparent);
99
100
  }
100
101
 
101
102
  .sixb-reasoning-fill {
@@ -178,6 +179,16 @@
178
179
  background: color-mix(in oklab, var(--muted-foreground) 40%, transparent);
179
180
  }
180
181
 
182
+ /* No level chosen yet, the model's own default: the thumb waits as an outline at the start. */
183
+ .sixb-reasoning-slider[data-unset="true"] .sixb-reasoning-fill {
184
+ opacity: 0;
185
+ }
186
+
187
+ .sixb-reasoning-slider[data-unset="true"] .sixb-reasoning-thumb {
188
+ background: transparent;
189
+ box-shadow: inset 0 0 0 1.5px color-mix(in oklab, var(--foreground) 22%, transparent);
190
+ }
191
+
181
192
  .sixb-reasoning-stop[data-filled="true"] {
182
193
  background: color-mix(in oklab, var(--primary-foreground) 45%, transparent);
183
194
  }
@@ -230,34 +241,154 @@
230
241
  }
231
242
  }
232
243
 
233
- /* The composer's one surface: a hairline and a soft lift, no border. Focus darkens the hairline. */
234
- .sixb-composer-surface {
244
+ /*
245
+ * The composer and its menus are quiet glass: one translucent layer over a light blur, a highlight
246
+ * along the top edge, a hairline, and almost no shadow. Focus darkens the hairline a little.
247
+ */
248
+ .sixb-composer-surface,
249
+ .sixb-composer-glass {
250
+ background: color-mix(in oklab, var(--card) 72%, transparent);
251
+ -webkit-backdrop-filter: blur(20px) saturate(1.4);
252
+ backdrop-filter: blur(20px) saturate(1.4);
235
253
  box-shadow:
236
- 0 0 0 1px rgb(0 0 0 / 0.06),
237
- 0 1px 2px rgb(0 0 0 / 0.03),
238
- 0 4px 16px rgb(0 0 0 / 0.035);
239
- transition: box-shadow 200ms ease;
254
+ inset 0 1px 0 rgb(255 255 255 / 0.9),
255
+ 0 0 0 0.5px rgb(0 0 0 / 0.1),
256
+ 0 6px 20px -14px rgb(0 0 0 / 0.14);
257
+ }
258
+
259
+ .sixb-composer-glass {
260
+ background: color-mix(in oklab, var(--popover) 74%, transparent);
261
+ -webkit-backdrop-filter: blur(24px) saturate(1.4);
262
+ backdrop-filter: blur(24px) saturate(1.4);
263
+ box-shadow:
264
+ inset 0 1px 0 rgb(255 255 255 / 0.9),
265
+ 0 0 0 0.5px rgb(0 0 0 / 0.1),
266
+ 0 12px 32px -20px rgb(0 0 0 / 0.2);
267
+ animation: sixb-composer-menu-in 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
268
+ }
269
+
270
+ .sixb-composer-surface {
271
+ transition:
272
+ border-radius 280ms cubic-bezier(0.2, 0.8, 0.2, 1),
273
+ box-shadow 200ms ease;
240
274
  }
241
275
 
242
276
  .sixb-composer-surface:focus-within {
243
277
  box-shadow:
244
- 0 0 0 1px rgb(0 0 0 / 0.1),
245
- 0 1px 2px rgb(0 0 0 / 0.03),
246
- 0 4px 16px rgb(0 0 0 / 0.045);
278
+ inset 0 1px 0 rgb(255 255 255 / 0.9),
279
+ 0 0 0 0.5px rgb(0 0 0 / 0.16),
280
+ 0 8px 24px -14px rgb(0 0 0 / 0.18);
247
281
  }
248
282
 
249
283
  .sixb-composer-surface[data-dragging] {
250
284
  box-shadow:
251
285
  0 0 0 2px color-mix(in srgb, var(--primary) 40%, transparent),
252
- 0 4px 16px rgb(0 0 0 / 0.045);
286
+ 0 8px 24px -14px rgb(0 0 0 / 0.18);
253
287
  }
254
288
 
255
- :is(.dark *).sixb-composer-surface {
256
- box-shadow: 0 0 0 1px rgb(255 255 255 / 0.09);
289
+ :is(.dark *):is(.sixb-composer-surface, .sixb-composer-glass) {
290
+ background: color-mix(in oklab, var(--card) 72%, transparent);
291
+ box-shadow:
292
+ inset 0 1px 0 rgb(255 255 255 / 0.08),
293
+ 0 0 0 0.5px rgb(255 255 255 / 0.1);
257
294
  }
258
295
 
259
296
  :is(.dark *).sixb-composer-surface:focus-within {
260
- box-shadow: 0 0 0 1px rgb(255 255 255 / 0.16);
297
+ box-shadow:
298
+ inset 0 1px 0 rgb(255 255 255 / 0.08),
299
+ 0 0 0 0.5px rgb(255 255 255 / 0.18);
300
+ }
301
+
302
+ /* Send pops in once there is something to send. */
303
+ .sixb-composer-send {
304
+ box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18);
305
+ animation: sixb-composer-pop 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
306
+ }
307
+
308
+ @keyframes sixb-composer-menu-in {
309
+ from {
310
+ opacity: 0;
311
+ transform: scale(0.97) translateY(4px);
312
+ }
313
+ to {
314
+ opacity: 1;
315
+ transform: none;
316
+ }
317
+ }
318
+
319
+ @keyframes sixb-composer-pop {
320
+ from {
321
+ opacity: 0;
322
+ transform: scale(0.7);
323
+ }
324
+ to {
325
+ opacity: 1;
326
+ transform: none;
327
+ }
328
+ }
329
+
330
+ /*
331
+ * Dictation: the waveform fades at both ends; while the words are transcribed it freezes and dims
332
+ * under a passing sheen. A red dot pulses while recording and greys out after.
333
+ */
334
+ .sixb-dictation-wave {
335
+ -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
336
+ mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
337
+ }
338
+
339
+ .sixb-dictation-wave[data-transcribing] > * {
340
+ opacity: 0.25;
341
+ transition: opacity 300ms ease;
342
+ }
343
+
344
+ .sixb-dictation-wave[data-transcribing]::after {
345
+ content: "";
346
+ position: absolute;
347
+ inset: 0;
348
+ background: linear-gradient(90deg, transparent, var(--card), transparent) no-repeat;
349
+ background-size: 40% 100%;
350
+ animation: sixb-dictation-sweep 1.1s linear infinite;
351
+ }
352
+
353
+ .sixb-dictation-dot {
354
+ background: #ff3b30;
355
+ animation: sixb-dictation-pulse 1.6s ease-in-out infinite;
356
+ }
357
+
358
+ .sixb-dictation-dot[data-transcribing] {
359
+ background: var(--muted-foreground);
360
+ opacity: 0.5;
361
+ animation: none;
362
+ }
363
+
364
+ @keyframes sixb-dictation-sweep {
365
+ from {
366
+ background-position: -40% 0;
367
+ }
368
+ to {
369
+ background-position: 140% 0;
370
+ }
371
+ }
372
+
373
+ @keyframes sixb-dictation-pulse {
374
+ 0%,
375
+ 100% {
376
+ opacity: 1;
377
+ }
378
+ 50% {
379
+ opacity: 0.35;
380
+ }
381
+ }
382
+
383
+ @media (prefers-reduced-motion: reduce) {
384
+ .sixb-composer-surface,
385
+ .sixb-composer-glass,
386
+ .sixb-composer-send,
387
+ .sixb-dictation-dot,
388
+ .sixb-dictation-wave::after {
389
+ animation: none;
390
+ transition: none;
391
+ }
261
392
  }
262
393
 
263
394
  /* An image the agent is making: a soft glow drifting under a slow sheen, like a print developing. */
@@ -24,6 +24,11 @@ const CLI_COMMANDS = {
24
24
  files: ["upload", "download"],
25
25
  workflows: ["list", "get", "start"],
26
26
  "workflow-runs": ["list", "get"],
27
+ datasets: ["list", "get", "versions", "rows"],
28
+ syncs: ["list", "get"],
29
+ "sync-runs": ["list"],
30
+ pipelines: ["list", "get"],
31
+ "pipeline-runs": ["list", "get"],
27
32
  models: ["list", "get", "text", "image", "speech", "transcribe", "calls"],
28
33
  api: ["get", "post"],
29
34
  memory: ["save", "pull"],
@@ -37,7 +42,7 @@ type CliCommandName = {
37
42
  type SixbCommandName =
38
43
  | "help"
39
44
  | "version"
40
- | "doctor"
45
+ | "status"
41
46
  | "context"
42
47
  | "objects.query-example"
43
48
  | CliCommandName
@@ -211,8 +216,12 @@ function classifySixbCommand(
211
216
  if (cliArgs[0] === "version" || cliArgs[0] === "--version") {
212
217
  return { kind: "sixb", command: "version", args: cliArgs.slice(1) }
213
218
  }
214
- if (cliArgs[0] === "doctor" || cliArgs[0] === "context") {
215
- return { kind: "sixb", command: cliArgs[0], args: cliArgs.slice(1) }
219
+ // `doctor` is what `status` was called before; older threads still show it.
220
+ if (cliArgs[0] === "status" || cliArgs[0] === "doctor") {
221
+ return { kind: "sixb", command: "status", args: cliArgs.slice(1) }
222
+ }
223
+ if (cliArgs[0] === "context") {
224
+ return { kind: "sixb", command: "context", args: cliArgs.slice(1) }
216
225
  }
217
226
 
218
227
  const [group, operation, ...args] = cliArgs
@@ -497,7 +506,7 @@ function describeSixb(
497
506
  return icon("skill", m.help, m.helpSubjects[helpSubject(intent.args)])
498
507
  case "version":
499
508
  return icon("terminal", m.version)
500
- case "doctor":
509
+ case "status":
501
510
  return icon("terminal", m.doctor)
502
511
  case "context":
503
512
  return icon("project", m.runContext)
@@ -612,7 +621,29 @@ function describeSixb(
612
621
  count(arrayLength(parsed?.json), counts.runs)
613
622
  )
614
623
  case "workflow-runs.get":
615
- return withDetail(icon("actions", m.workflowRun), runStatus(parsed?.json, m))
624
+ return withDetail(icon("actions", m.workflowRun), runStatus(detailRun(parsed?.json), m))
625
+ case "datasets.list":
626
+ return icon("objects", m.listDatasets)
627
+ case "datasets.get":
628
+ return icon("objects", m.inspectDataset, humanize(positionals(intent.args)[0]))
629
+ case "datasets.versions":
630
+ return icon("objects", m.datasetVersions, humanize(positionals(intent.args)[0]))
631
+ case "datasets.rows":
632
+ return icon("objects", m.datasetRows, humanize(positionals(intent.args)[0]))
633
+ case "syncs.list":
634
+ return icon("actions", m.listSyncs)
635
+ case "syncs.get":
636
+ return icon("actions", m.inspectSync, humanize(positionals(intent.args)[0]))
637
+ case "sync-runs.list":
638
+ return icon("actions", m.listSyncRuns)
639
+ case "pipelines.list":
640
+ return icon("actions", m.listPipelines)
641
+ case "pipelines.get":
642
+ return icon("actions", m.inspectPipeline, humanize(positionals(intent.args)[0]))
643
+ case "pipeline-runs.list":
644
+ return icon("actions", m.listPipelineRuns)
645
+ case "pipeline-runs.get":
646
+ return withDetail(icon("actions", m.pipelineRun), runStatus(detailRun(parsed?.json), m))
616
647
  case "files.upload":
617
648
  return withDetail(icon("object", m.upload), filePath(parsed?.json))
618
649
  case "files.download":
@@ -920,6 +951,11 @@ function runOutcome(value: unknown, m: AgentMessages["bash"]): string | undefine
920
951
  }
921
952
 
922
953
  /** A run status in words; statuses Sixb does not know yet are shown as they are. */
954
+ /** A run's detail answers `{ run, steps }` or `{ run, nodes }`: its status is the run's. */
955
+ function detailRun(value: unknown): unknown {
956
+ return isRecord(value) && isRecord(value.run) ? value.run : value
957
+ }
958
+
923
959
  export function runStatus(value: unknown, m: AgentMessages["bash"] = en.bash): string | undefined {
924
960
  if (!isRecord(value) || typeof value.status !== "string") return undefined
925
961
  return Object.hasOwn(m.statuses, value.status)
@@ -0,0 +1,9 @@
1
+ import { Hand, type LucideIcon, PencilLine, Zap } from "lucide-react"
2
+ import type { AgentApprovalMode } from "../approvals"
3
+
4
+ /** Each approval mode's icon, in the composer's permissions and in Settings. */
5
+ export const APPROVAL_MODE_ICONS: Readonly<Record<AgentApprovalMode, LucideIcon>> = {
6
+ manual: Hand,
7
+ "accept-edits": PencilLine,
8
+ auto: Zap,
9
+ }
@@ -0,0 +1,126 @@
1
+ import { cn } from "@sixb/ui/lib/utils"
2
+ import { AtSign, type LucideIcon, Paperclip, Plus, Slash } from "lucide-react"
3
+ import { useRef, useState } from "react"
4
+ import { useAgentMessages } from "../i18n"
5
+ import { COMPOSER_MENU_ROW_CLASS_NAME, ComposerMenu } from "./composer-menu"
6
+
7
+ export interface ComposerAddMenuProps {
8
+ readonly onAddFiles?: () => void
9
+ /** Starts an `@` mention at the caret, which opens the context picker. */
10
+ readonly onMention: () => void
11
+ /** Starts a slash command; omitted while the message has text. */
12
+ readonly onCommand?: () => void
13
+ readonly disabled?: boolean
14
+ }
15
+
16
+ /** The composer's `+`: what a message can carry besides its text. It turns into × while open. */
17
+ export function ComposerAddMenu({
18
+ onAddFiles,
19
+ onMention,
20
+ onCommand,
21
+ disabled,
22
+ }: ComposerAddMenuProps) {
23
+ const messages = useAgentMessages().composer
24
+ const [open, setOpen] = useState(false)
25
+ // A choice that types into the message keeps the focus there, not on `+`.
26
+ const typing = useRef(false)
27
+
28
+ const choose = (action: () => void, types: boolean) => () => {
29
+ typing.current = types
30
+ setOpen(false)
31
+ action()
32
+ }
33
+
34
+ return (
35
+ <ComposerMenu
36
+ open={open}
37
+ onOpenChange={setOpen}
38
+ title={messages.add}
39
+ align="start"
40
+ className="w-[16.5rem]"
41
+ onCloseAutoFocus={(event) => {
42
+ if (!typing.current) return
43
+ typing.current = false
44
+ event.preventDefault()
45
+ }}
46
+ trigger={
47
+ <button
48
+ type="button"
49
+ disabled={disabled}
50
+ aria-label={messages.add}
51
+ aria-haspopup="menu"
52
+ aria-expanded={open}
53
+ className="flex size-[38px] shrink-0 items-center justify-center self-end rounded-full bg-black/[0.05] text-foreground/80 outline-none transition-[background-color,transform] duration-200 ease-[cubic-bezier(.2,.8,.2,1)] hover:bg-black/[0.08] focus-visible:ring-2 focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-expanded:rotate-45 aria-expanded:bg-black/[0.08] dark:bg-white/[0.1] dark:hover:bg-white/[0.14] dark:aria-expanded:bg-white/[0.14] mb-px"
54
+ >
55
+ <Plus className="size-[18px]" strokeWidth={2} aria-hidden="true" />
56
+ </button>
57
+ }
58
+ >
59
+ <div role="menu" aria-label={messages.add} className="flex flex-col gap-px">
60
+ {onAddFiles ? (
61
+ <AddMenuItem
62
+ icon={Paperclip}
63
+ label={messages.addFiles}
64
+ onSelect={choose(onAddFiles, false)}
65
+ />
66
+ ) : null}
67
+ <AddMenuItem
68
+ icon={AtSign}
69
+ label={messages.mention}
70
+ shortcut="@"
71
+ onSelect={choose(onMention, true)}
72
+ />
73
+ {onCommand ? (
74
+ <AddMenuItem
75
+ icon={Slash}
76
+ label={messages.commands}
77
+ shortcut="/"
78
+ onSelect={choose(onCommand, true)}
79
+ />
80
+ ) : null}
81
+ </div>
82
+ </ComposerMenu>
83
+ )
84
+ }
85
+
86
+ function AddMenuItem({
87
+ icon: Icon,
88
+ label,
89
+ shortcut,
90
+ onSelect,
91
+ }: {
92
+ readonly icon: LucideIcon
93
+ readonly label: string
94
+ /** The character that does the same from the message. */
95
+ readonly shortcut?: string
96
+ readonly onSelect: () => void
97
+ }) {
98
+ return (
99
+ <button
100
+ type="button"
101
+ role="menuitem"
102
+ onClick={onSelect}
103
+ className={cn(COMPOSER_MENU_ROW_CLASS_NAME, "min-h-10 gap-3")}
104
+ >
105
+ <Icon
106
+ className="size-[18px] shrink-0 text-foreground/75"
107
+ strokeWidth={1.75}
108
+ aria-hidden="true"
109
+ />
110
+ <span className="min-w-0 flex-1 truncate text-foreground">{label}</span>
111
+ {shortcut ? <ComposerKey>{shortcut}</ComposerKey> : null}
112
+ </button>
113
+ )
114
+ }
115
+
116
+ /** A keycap, for the character or key that does the same from the keyboard. */
117
+ export function ComposerKey({ children }: { readonly children: string }) {
118
+ return (
119
+ <kbd
120
+ aria-hidden="true"
121
+ className="inline-flex h-5 min-w-5 shrink-0 items-center justify-center rounded-md bg-background px-[5px] font-sans text-[11px] text-foreground/75 shadow-[0_0_0_0.5px_rgb(0_0_0/0.16),0_1px_0_rgb(0_0_0/0.08)] dark:bg-white/[0.1] dark:shadow-[0_0_0_0.5px_rgb(255_255_255/0.16)]"
122
+ >
123
+ {children}
124
+ </kbd>
125
+ )
126
+ }
@@ -0,0 +1,165 @@
1
+ import { cn } from "@sixb/ui/lib/utils"
2
+ import { AGENT_APPROVAL_MODES, type AgentApprovalMode } from "../approvals"
3
+ import { useAgentMessages } from "../i18n"
4
+ import type { AgentMessages } from "../i18n/en"
5
+ import { hasTiers } from "../model-selection"
6
+ import type { LanguageModel } from "../types"
7
+ import { ComposerKey } from "./composer-add-menu"
8
+ import {
9
+ COMPOSER_MENU_ROW_CLASS_NAME,
10
+ COMPOSER_MENU_ROW_SELECTED_CLASS_NAME,
11
+ } from "./composer-menu"
12
+
13
+ /** A slash command: typed as the whole message, `/name`, and run with Enter. */
14
+ export interface ComposerCommand {
15
+ /** What follows the slash, lowercase and without spaces: `opus` for `/opus`. */
16
+ readonly name: string
17
+ /** What it does, as the list shows it. */
18
+ readonly label: string
19
+ readonly run: () => void
20
+ }
21
+
22
+ /** The command being typed, without its slash; `null` unless the message is one slash word. */
23
+ export function commandQuery(value: string): string | null {
24
+ const match = /^\/([^\s/]*)$/.exec(value)
25
+ return match ? (match[1] ?? "").toLowerCase() : null
26
+ }
27
+
28
+ /** The commands a query names or describes, those whose name starts with it first. */
29
+ export function matchCommands(
30
+ commands: readonly ComposerCommand[],
31
+ query: string
32
+ ): readonly ComposerCommand[] {
33
+ const named = commands.filter((command) => command.name.startsWith(query))
34
+ const rest = commands.filter(
35
+ (command) =>
36
+ !named.includes(command) &&
37
+ (command.name.includes(query) || command.label.toLowerCase().includes(query))
38
+ )
39
+ return [...named, ...rest]
40
+ }
41
+
42
+ /** The permission modes by the word a command uses for each. */
43
+ const MODE_COMMANDS: Readonly<Record<AgentApprovalMode, string>> = {
44
+ manual: "ask",
45
+ "accept-edits": "edits",
46
+ auto: "full",
47
+ }
48
+
49
+ /**
50
+ * The commands the composer offers on its own: `/auto` with tiers, one per model, and one per
51
+ * permission mode. Each exists only when the composer can make that change.
52
+ */
53
+ export function builtInCommands({
54
+ models,
55
+ onSelectModel,
56
+ onResetModelSelection,
57
+ onApprovalModeChange,
58
+ messages,
59
+ }: {
60
+ readonly models: readonly LanguageModel[]
61
+ readonly onSelectModel?: (model: LanguageModel) => void
62
+ readonly onResetModelSelection?: () => void
63
+ readonly onApprovalModeChange?: (mode: AgentApprovalMode) => void
64
+ readonly messages: AgentMessages["commands"]
65
+ }): ComposerCommand[] {
66
+ const commands: ComposerCommand[] = []
67
+ if (onResetModelSelection && hasTiers(models)) {
68
+ commands.push({ name: "auto", label: messages.auto, run: onResetModelSelection })
69
+ }
70
+ if (onSelectModel) {
71
+ for (const model of models) {
72
+ commands.push({
73
+ name: commandName(model.name),
74
+ label: messages.model(model.name),
75
+ run: () => onSelectModel(model),
76
+ })
77
+ }
78
+ }
79
+ if (onApprovalModeChange) {
80
+ for (const mode of AGENT_APPROVAL_MODES) {
81
+ commands.push({
82
+ name: MODE_COMMANDS[mode],
83
+ label: messages.modes[mode],
84
+ run: () => onApprovalModeChange(mode),
85
+ })
86
+ }
87
+ }
88
+ return commands
89
+ }
90
+
91
+ /** `Claude Opus 5.5` → `claude-opus-5-5`. */
92
+ function commandName(name: string): string {
93
+ return name
94
+ .toLowerCase()
95
+ .replace(/[^a-z0-9]+/g, "-")
96
+ .replace(/^-|-$/g, "")
97
+ }
98
+
99
+ export interface ComposerCommandListProps {
100
+ readonly open: boolean
101
+ readonly query: string
102
+ readonly commands: readonly ComposerCommand[]
103
+ readonly activeIndex: number
104
+ readonly onActiveIndexChange: (index: number) => void
105
+ readonly onRun: (command: ComposerCommand) => void
106
+ }
107
+
108
+ /** The commands matching what is typed, over the composer; Enter runs the highlighted one. */
109
+ export function ComposerCommandList({
110
+ open,
111
+ query,
112
+ commands,
113
+ activeIndex,
114
+ onActiveIndexChange,
115
+ onRun,
116
+ }: ComposerCommandListProps) {
117
+ const messages = useAgentMessages().commands
118
+ if (!open) return null
119
+
120
+ return (
121
+ <div
122
+ role="listbox"
123
+ aria-label={messages.list}
124
+ className="sixb-composer-glass absolute bottom-[calc(100%+0.625rem)] left-0 z-20 flex w-[21.25rem] max-w-full flex-col gap-px rounded-[20px] p-1.5"
125
+ >
126
+ {commands.slice(0, 6).map((command, index) => {
127
+ const active = index === activeIndex
128
+ const at = command.name.indexOf(query)
129
+ return (
130
+ <button
131
+ key={`${command.name}:${index}`}
132
+ type="button"
133
+ role="option"
134
+ aria-selected={active}
135
+ onPointerEnter={() => onActiveIndexChange(index)}
136
+ // Keep the focus in the message while choosing.
137
+ onPointerDown={(event) => event.preventDefault()}
138
+ onClick={() => onRun(command)}
139
+ className={cn(
140
+ COMPOSER_MENU_ROW_CLASS_NAME,
141
+ active && COMPOSER_MENU_ROW_SELECTED_CLASS_NAME
142
+ )}
143
+ >
144
+ <span className="min-w-[62px] shrink-0 font-mono text-[12.5px] text-foreground">
145
+ /
146
+ {query && at >= 0 ? (
147
+ <>
148
+ {command.name.slice(0, at)}
149
+ <mark className="rounded-[3px] bg-black/[0.08] text-inherit dark:bg-white/[0.14]">
150
+ {command.name.slice(at, at + query.length)}
151
+ </mark>
152
+ {command.name.slice(at + query.length)}
153
+ </>
154
+ ) : (
155
+ command.name
156
+ )}
157
+ </span>
158
+ <span className="min-w-0 flex-1 truncate text-foreground/75">{command.label}</span>
159
+ {active ? <ComposerKey>↩</ComposerKey> : null}
160
+ </button>
161
+ )
162
+ })}
163
+ </div>
164
+ )
165
+ }