@hanzo/browser-extension 1.9.54 → 1.9.55

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.
package/src/sidebar.css CHANGED
@@ -189,149 +189,6 @@ html {
189
189
  object-fit: cover;
190
190
  }
191
191
 
192
- /* ==================== Auth ==================== */
193
-
194
- .auth-section {
195
- flex: 1;
196
- display: flex;
197
- align-items: center;
198
- justify-content: center;
199
- padding: 32px 20px;
200
- }
201
-
202
- .auth-card {
203
- text-align: center;
204
- }
205
-
206
- .auth-logo {
207
- width: 56px;
208
- height: 56px;
209
- color: var(--text-primary);
210
- margin-bottom: 20px;
211
- }
212
-
213
- .auth-card h2 {
214
- font-size: 18px;
215
- font-weight: 600;
216
- margin-bottom: 8px;
217
- }
218
-
219
- .auth-card p {
220
- color: var(--text-secondary);
221
- font-size: 13px;
222
- margin-bottom: 24px;
223
- line-height: 1.5;
224
- }
225
-
226
- /* In-chat login prompt */
227
- .chat-login-prompt {
228
- display: flex;
229
- align-items: center;
230
- justify-content: center;
231
- padding: 40px 24px;
232
- flex: 1;
233
- animation: fadeIn 0.4s ease;
234
- }
235
-
236
- .auth-card.compact {
237
- text-align: center;
238
- max-width: 280px;
239
- width: 100%;
240
- }
241
-
242
- .auth-card.compact .auth-logo {
243
- width: 56px;
244
- height: 56px;
245
- color: var(--text-primary);
246
- margin: 0 auto 24px;
247
- display: block;
248
- filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.15));
249
- }
250
-
251
- .auth-card.compact .auth-headline {
252
- font-size: 22px;
253
- font-weight: 700;
254
- color: var(--text-primary);
255
- margin-bottom: 10px;
256
- letter-spacing: -0.02em;
257
- }
258
-
259
- .auth-card.compact .auth-sub {
260
- font-size: 13px;
261
- color: var(--text-secondary);
262
- margin-bottom: 24px;
263
- line-height: 1.5;
264
- }
265
-
266
- /* Sign-in button — matches @hanzo/gui primary button on dark (monochrome) */
267
- .auth-signin-btn {
268
- width: 100%;
269
- padding: 10px 16px;
270
- height: 40px;
271
- background: var(--accent);
272
- color: #0a0a0a;
273
- border: none;
274
- border-radius: var(--radius-md);
275
- font-size: 14px;
276
- font-weight: 600;
277
- cursor: pointer;
278
- transition: background 0.15s, box-shadow 0.15s;
279
- margin-bottom: 10px;
280
- letter-spacing: -0.01em;
281
- }
282
-
283
- .auth-signin-btn:hover {
284
- background: var(--accent-hover);
285
- box-shadow: 0 0 12px rgba(255, 255, 255, 0.1);
286
- }
287
-
288
- .auth-signin-btn:active {
289
- transform: scale(0.98);
290
- }
291
-
292
- .auth-signin-btn:disabled {
293
- opacity: 0.5;
294
- cursor: not-allowed;
295
- }
296
-
297
- /* Ghost create account button */
298
- .auth-create-btn {
299
- width: 100%;
300
- padding: 10px 16px;
301
- height: 36px;
302
- background: transparent;
303
- color: var(--text-secondary);
304
- border: 1px solid var(--border);
305
- border-radius: var(--radius-md);
306
- font-size: 13px;
307
- font-weight: 500;
308
- cursor: pointer;
309
- transition: all 0.15s;
310
- margin-bottom: 16px;
311
- }
312
-
313
- .auth-create-btn:hover {
314
- color: var(--text-primary);
315
- background: var(--glass);
316
- border-color: var(--border-strong);
317
- }
318
-
319
- .auth-card.compact .auth-note {
320
- font-size: 11px;
321
- color: var(--text-tertiary);
322
- margin-bottom: 0;
323
- line-height: 1.5;
324
- }
325
-
326
- .auth-card.compact .auth-note a {
327
- color: var(--text-secondary);
328
- text-decoration: underline;
329
- text-underline-offset: 2px;
330
- }
331
-
332
- .auth-card.compact .auth-note a:hover {
333
- color: var(--text-primary);
334
- }
335
192
 
336
193
  /* ==================== Tab Bar ==================== */
337
194
 
@@ -413,80 +270,30 @@ html {
413
270
  scrollbar-color: rgba(255,255,255,0.08) transparent;
414
271
  }
415
272
 
273
+
416
274
  /* ==================== Chat ==================== */
417
275
 
418
- .chat-messages {
276
+ /* The chat tab is one mount node; the shell fills it. */
277
+ #chat {
419
278
  flex: 1;
420
279
  min-height: 0;
421
- overflow-y: auto;
422
- overflow-x: hidden;
423
- padding: 16px;
424
- display: flex;
425
- flex-direction: column;
426
- gap: 12px;
427
- scrollbar-width: thin;
428
- scrollbar-color: rgba(255,255,255,0.08) transparent;
429
- }
430
-
431
- .chat-welcome {
432
280
  display: flex;
433
281
  flex-direction: column;
434
- align-items: center;
435
- justify-content: center;
436
- flex: 1;
437
- text-align: center;
438
- color: var(--text-tertiary);
439
- padding: 40px 20px;
440
- font-size: 12px;
441
- letter-spacing: 0.01em;
442
- gap: 8px;
443
- }
444
-
445
- .chat-welcome p {
446
- animation: breathe 4s infinite ease-in-out;
447
- }
448
-
449
- .msg {
450
- max-width: 90%;
451
- padding: 10px 14px;
452
- border-radius: var(--radius);
453
- font-size: 13px;
454
- line-height: 1.5;
455
- word-wrap: break-word;
456
- animation: fadeIn 0.3s ease;
457
- }
458
-
459
- .msg-user {
460
- align-self: flex-end;
461
- background: var(--glass-strong);
462
- backdrop-filter: blur(12px);
463
- -webkit-backdrop-filter: blur(12px);
464
- color: var(--text-primary);
465
- border: 1px solid var(--border);
466
- border-bottom-right-radius: 4px;
467
- }
468
-
469
- .msg-assistant {
470
- align-self: flex-start;
471
- background: var(--bg-tertiary);
472
- color: var(--text-primary);
473
- border-bottom-left-radius: 4px;
474
- border: 1px solid var(--border);
475
- }
476
-
477
- .msg-assistant pre {
478
- background: var(--bg-primary);
479
- border: 1px solid var(--border);
480
- border-radius: var(--radius-sm);
481
- padding: 10px 12px;
482
- margin: 8px 0;
483
- overflow-x: auto;
484
- font-family: 'Geist Mono', 'Monaco', 'Consolas', monospace;
485
- font-size: 12px;
486
- line-height: 1.4;
487
282
  }
488
283
 
489
- .msg-assistant code {
284
+ /* Prose inside an assistant turn. The shell renders the turn; markdown is the
285
+ surface's own pipeline, so this is its stylesheet — the same rules the new
286
+ tab uses, at the sidebar's size. */
287
+ .markdown { font-size: 13px; line-height: 1.55; color: var(--text-primary); }
288
+ .markdown > *:last-child { margin-bottom: 0; }
289
+ .markdown h2 { font-size: 15px; margin: 14px 0 6px; font-weight: 600; }
290
+ .markdown h3 { font-size: 14px; margin: 12px 0 6px; font-weight: 600; }
291
+ .markdown h4, .markdown h5 { font-size: 13px; margin: 10px 0 4px; font-weight: 600; }
292
+ .markdown p { margin: 0 0 8px; }
293
+ .markdown ul, .markdown ol { margin: 0 0 8px; padding-left: 20px; }
294
+ .markdown li { margin: 3px 0; }
295
+ .markdown a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 2px; }
296
+ .markdown code {
490
297
  font-family: 'Geist Mono', 'Monaco', 'Consolas', monospace;
491
298
  font-size: 12px;
492
299
  background: rgba(255,255,255,0.06);
@@ -494,215 +301,6 @@ html {
494
301
  border-radius: 3px;
495
302
  }
496
303
 
497
- .msg-assistant pre code {
498
- background: none;
499
- padding: 0;
500
- }
501
-
502
- .msg-error {
503
- align-self: center;
504
- background: var(--error);
505
- color: white;
506
- font-size: 12px;
507
- padding: 6px 12px;
508
- border-radius: var(--radius-sm);
509
- }
510
-
511
- .typing-indicator {
512
- align-self: flex-start;
513
- color: var(--text-tertiary);
514
- font-size: 12px;
515
- padding: 6px 0;
516
- display: flex;
517
- align-items: center;
518
- gap: 4px;
519
- }
520
-
521
- .typing-indicator span {
522
- display: inline-block;
523
- width: 6px;
524
- height: 6px;
525
- background: var(--text-tertiary);
526
- border-radius: 50%;
527
- animation: typingBounce 1.4s infinite;
528
- }
529
-
530
- .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
531
- .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
532
-
533
- /* ==================== Composer (Modern Chat Input) ==================== */
534
-
535
- .composer {
536
- padding: 10px;
537
- flex-shrink: 0;
538
- position: relative;
539
- z-index: 10;
540
- border-top: 1px solid rgba(255,255,255,0.10);
541
- background: #0f0f0f;
542
- }
543
-
544
- .composer-box {
545
- background: #171717;
546
- border: 1px solid rgba(255,255,255,0.15);
547
- border-radius: 10px;
548
- overflow: hidden;
549
- transition: border-color 0.2s, box-shadow 0.2s;
550
- }
551
-
552
- .composer-box:focus-within {
553
- border-color: rgba(255,255,255,0.22);
554
- box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
555
- }
556
-
557
- .composer-box textarea {
558
- display: block;
559
- width: 100%;
560
- padding: 10px 12px 4px;
561
- background: transparent;
562
- border: none;
563
- color: #fafafa;
564
- font-size: 13px;
565
- font-family: 'Geist Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
566
- line-height: 1.5;
567
- resize: none;
568
- outline: none;
569
- min-height: 36px;
570
- max-height: 120px;
571
- box-sizing: border-box;
572
- }
573
-
574
- .composer-box textarea::placeholder {
575
- color: #666;
576
- }
577
-
578
- .composer-bar {
579
- display: flex;
580
- align-items: center;
581
- justify-content: space-between;
582
- padding: 4px 8px 8px;
583
- gap: 4px;
584
- }
585
-
586
- .composer-controls {
587
- display: flex;
588
- align-items: center;
589
- gap: 4px;
590
- flex: 1;
591
- min-width: 0;
592
- overflow: hidden;
593
- }
594
-
595
- .composer-model {
596
- padding: 3px 18px 3px 6px;
597
- background: rgba(255,255,255,0.07);
598
- border: 1px solid rgba(255,255,255,0.10);
599
- border-radius: 6px;
600
- color: #a3a3a3;
601
- font-size: 10px;
602
- font-family: inherit;
603
- cursor: pointer;
604
- -webkit-appearance: none;
605
- -moz-appearance: none;
606
- appearance: none;
607
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2.5 4l2.5 2.5 2.5-2.5' stroke='%236B6B6B' stroke-width='1.2'/%3E%3C/svg%3E");
608
- background-repeat: no-repeat;
609
- background-position: right 4px center;
610
- white-space: nowrap;
611
- max-width: 110px;
612
- text-overflow: ellipsis;
613
- overflow: hidden;
614
- transition: border-color 0.2s;
615
- height: 22px;
616
- flex-shrink: 0;
617
- line-height: 16px;
618
- }
619
-
620
- .composer-model:hover {
621
- border-color: rgba(255,255,255,0.16);
622
- }
623
-
624
- .composer-model:focus {
625
- border-color: rgba(255,255,255,0.16);
626
- outline: none;
627
- }
628
-
629
- .composer-toggle {
630
- display: inline-flex;
631
- align-items: center;
632
- gap: 2px;
633
- font-size: 10px;
634
- color: #666;
635
- user-select: none;
636
- cursor: pointer;
637
- white-space: nowrap;
638
- padding: 2px 4px;
639
- border-radius: 4px;
640
- transition: background 0.15s;
641
- flex-shrink: 0;
642
- }
643
-
644
- .composer-toggle:hover {
645
- background: rgba(255,255,255,0.04);
646
- }
647
-
648
- .composer-toggle input[type="checkbox"] {
649
- width: 11px;
650
- height: 11px;
651
- accent-color: #fafafa;
652
- cursor: pointer;
653
- margin: 0;
654
- }
655
-
656
- .composer-toggle:has(input:checked) {
657
- color: #a3a3a3;
658
- }
659
-
660
- .composer-status {
661
- font-size: 9px;
662
- color: var(--text-tertiary);
663
- white-space: nowrap;
664
- padding: 1px 5px;
665
- border-radius: 3px;
666
- background: var(--glass);
667
- }
668
-
669
- .composer-send {
670
- width: 30px;
671
- height: 30px;
672
- display: flex;
673
- align-items: center;
674
- justify-content: center;
675
- background: var(--accent);
676
- border: none;
677
- border-radius: 50%;
678
- color: #000;
679
- cursor: pointer;
680
- flex-shrink: 0;
681
- transition: all 0.2s;
682
- }
683
-
684
- .composer-send:hover {
685
- background: var(--accent-hover);
686
- box-shadow: 0 0 12px rgba(255,255,255,0.15);
687
- transform: scale(1.05);
688
- }
689
-
690
- .composer-send:active {
691
- transform: scale(0.95);
692
- }
693
-
694
- .composer-send:disabled {
695
- opacity: 0.15;
696
- cursor: not-allowed;
697
- box-shadow: none;
698
- transform: none;
699
- }
700
-
701
- .composer-send svg {
702
- width: 13px;
703
- height: 13px;
704
- }
705
-
706
304
  /* ==================== Buttons ==================== */
707
305
 
708
306
  .icon-btn {
package/src/sidebar.html CHANGED
@@ -8,9 +8,6 @@
8
8
  </head>
9
9
  <body>
10
10
  <div class="sidebar-container">
11
- <!-- Auth section (hidden — login prompt is inside Chat tab) -->
12
- <section id="auth-section" class="hidden"></section>
13
-
14
11
  <!-- Tab Bar (always visible) -->
15
12
  <nav id="tab-bar" class="tab-bar hidden">
16
13
  <button class="tab active" data-tab="chat">Chat</button>
@@ -18,72 +15,13 @@
18
15
  <button class="tab" data-tab="settings">Settings</button>
19
16
  </nav>
20
17
 
21
- <!-- Chat Tab -->
18
+ <!-- Chat Tab.
19
+ One mount node and nothing else. The thread, the composer and the
20
+ signed-out card are `@hanzo/ui/chat`, rendered by sidebar.ts — markup
21
+ here would be a second implementation of controls this page already
22
+ has, which is exactly how the composer forked the first time. -->
22
23
  <div id="tab-chat" class="tab-content hidden">
23
- <!-- Login prompt (shown when not authenticated) -->
24
- <div id="chat-login-prompt" class="chat-login-prompt hidden">
25
- <div class="auth-card compact">
26
- <svg class="auth-logo" viewBox="0 0 67 67" xmlns="http://www.w3.org/2000/svg">
27
- <path d="M22.21 67V44.6369H0V67H22.21Z" fill="currentColor"/>
28
- <path d="M0 44.6369L22.21 46.8285V44.6369H0Z" fill="currentColor" opacity="0.75"/>
29
- <path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" fill="currentColor"/>
30
- <path d="M22.21 0H0V22.3184H22.21V0Z" fill="currentColor"/>
31
- <path d="M66.7198 0H44.5098V22.3184H66.7198V0Z" fill="currentColor"/>
32
- <path d="M66.6753 22.3185L44.5098 20.0822V22.3185H66.6753Z" fill="currentColor" opacity="0.75"/>
33
- <path d="M66.7198 67V44.6369H44.5098V67H66.7198Z" fill="currentColor"/>
34
- </svg>
35
- <p class="auth-headline">Sign in to Hanzo AI</p>
36
- <p class="auth-sub">Chat with Zen AI models, use browser tools, and build with AI agents.</p>
37
- <button id="auth-btn" class="auth-signin-btn">Sign in</button>
38
- <button id="signup-btn" class="auth-create-btn">Create account</button>
39
- <p class="auth-note">Browser tools work without sign-in. <a href="https://docs.hanzo.ai" target="_blank">Learn more</a></p>
40
- </div>
41
- </div>
42
- <div id="chat-messages" class="chat-messages">
43
- <div class="chat-welcome">
44
- <svg viewBox="0 0 67 67" xmlns="http://www.w3.org/2000/svg" width="28" height="28" style="opacity:0.25">
45
- <path d="M22.21 67V44.6369H0V67H22.21Z" fill="currentColor"/>
46
- <path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z" fill="currentColor"/>
47
- <path d="M22.21 0H0V22.3184H22.21V0Z" fill="currentColor"/>
48
- <path d="M66.7198 0H44.5098V22.3184H66.7198V0Z" fill="currentColor"/>
49
- <path d="M66.7198 67V44.6369H44.5098V67H66.7198Z" fill="currentColor"/>
50
- </svg>
51
- <p>Ask anything. Powered by Hanzo Cloud.</p>
52
- </div>
53
- </div>
54
- <div id="chat-composer" style="padding:10px;flex-shrink:0;border-top:1px solid rgba(255,255,255,0.10);background:#0f0f0f;">
55
- <div style="background:#171717;border:1px solid rgba(255,255,255,0.15);border-radius:10px;overflow:hidden;">
56
- <textarea id="chat-input" placeholder="Ask anything..." rows="1"
57
- style="display:block;width:100%;padding:10px 12px 4px;background:transparent;border:none;color:#fafafa;font-size:13px;font-family:inherit;line-height:1.5;resize:none;outline:none;min-height:36px;max-height:120px;box-sizing:border-box;"></textarea>
58
- <div style="display:flex;align-items:center;justify-content:space-between;padding:4px 8px 8px;gap:4px;">
59
- <div style="display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden;">
60
- <select id="model-select"
61
- style="padding:3px 18px 3px 6px;background:rgba(255,255,255,0.07);border:1px solid rgba(255,255,255,0.10);border-radius:6px;color:#a3a3a3;font-size:10px;font-family:inherit;cursor:pointer;-moz-appearance:none;appearance:none;white-space:nowrap;max-width:110px;text-overflow:ellipsis;overflow:hidden;height:22px;line-height:16px;flex-shrink:0;">
62
- <!-- Auto is the only hand-written entry: it is the router, always
63
- valid. Every other option is appended by loadModels() from
64
- chat.listModels, so the picker can never advertise a model the
65
- account cannot reach. -->
66
- <option value="auto">Auto</option>
67
- </select>
68
- <label title="RAG context" style="display:inline-flex;align-items:center;gap:2px;font-size:10px;color:#666;cursor:pointer;white-space:nowrap;padding:2px 4px;flex-shrink:0;">
69
- <input type="checkbox" id="rag-enabled" checked style="width:11px;height:11px;accent-color:#fafafa;cursor:pointer;margin:0;">
70
- <span>RAG</span>
71
- </label>
72
- <label title="Include active tab" style="display:inline-flex;align-items:center;gap:2px;font-size:10px;color:#666;cursor:pointer;white-space:nowrap;padding:2px 4px;flex-shrink:0;">
73
- <input type="checkbox" id="tab-context-enabled" checked style="width:11px;height:11px;accent-color:#fafafa;cursor:pointer;margin:0;">
74
- <span>Tab</span>
75
- </label>
76
- <span id="rag-status" style="font-size:9px;color:#666;white-space:nowrap;padding:1px 5px;border-radius:3px;background:rgba(255,255,255,0.04);">Ready</span>
77
- </div>
78
- <button id="send-btn" title="Send (Enter)"
79
- style="width:30px;height:30px;display:flex;align-items:center;justify-content:center;background:#fafafa;border:none;border-radius:50%;color:#000;cursor:pointer;flex-shrink:0;">
80
- <svg viewBox="0 0 16 16" fill="none" style="width:13px;height:13px;">
81
- <path d="M3 13V3l10 5-10 5z" fill="currentColor"/>
82
- </svg>
83
- </button>
84
- </div>
85
- </div>
86
- </div>
24
+ <div id="chat"></div>
87
25
  </div>
88
26
 
89
27
  <!-- Tools Tab -->
@@ -343,9 +281,10 @@
343
281
  <h3>AI Models</h3>
344
282
  <label class="setting-item">
345
283
  <span>Default Model</span>
346
- <select id="default-model">
347
- <option value="auto">Auto (cost-aware)</option>
348
- </select>
284
+ <!-- Filled by setModels() from the one catalog the chat picker
285
+ reads. Empty here on purpose: a hand-written option is a model
286
+ offered without the account being asked. -->
287
+ <select id="default-model"></select>
349
288
  </label>
350
289
  <label class="setting-item">
351
290
  <span>Enable WebGPU</span>
@@ -1,147 +0,0 @@
1
- import React from 'react';
2
- import type { SearchMode } from '@hanzo/ai';
3
- import { Button, Textarea } from '@hanzo/ui';
4
- import { Models } from './Models.js';
5
- import type { ChatModel, ModelGroup } from './model-catalog.js';
6
-
7
- /**
8
- * The composer: an auto-growing field over one toolbar row — source pills on the
9
- * left, mode tabs + model picker + a single send control on the right.
10
- *
11
- * Enter sends; Shift+Enter writes a newline. The send control is also the busy
12
- * indicator, so there is exactly one control for "go" and one signal for "running".
13
- *
14
- * Presentational: every value and every effect is injected. It owns no query
15
- * state and never calls a backend — mount it wherever the answer surface lives.
16
- */
17
-
18
- /** What the composer sends. `chat` goes straight to the model; the rest ground
19
- * the question on the live web (`SearchMode` is the wire's own vocabulary).
20
- *
21
- * `deep` is EXCLUDED rather than absent. The wire still names it — dropping it
22
- * from `MODES` only stopped it being offered, it stayed a legal `Mode`, so any
23
- * call site could still hold one and put the retired name back on the surface.
24
- * Excluding it makes the collapse structural. Derived from `SearchMode` and not
25
- * restated, so a mode this surface invents is still a type error, and the day
26
- * the wire drops `deep` this narrows to nothing on its own. */
27
- export type Mode = Exclude<SearchMode, 'deep'> | 'chat';
28
-
29
- /** The modes, in the order they read as escalating effort. */
30
- export const MODES: { id: Mode; label: string; hint: string }[] = [
31
- { id: 'chat', label: 'Chat', hint: 'Straight to the model' },
32
- { id: 'search', label: 'Search', hint: 'Fast grounded answer' },
33
- { id: 'news', label: 'News', hint: 'Recency-biased' },
34
- // No 'deep'. It was research with the dials up — same system prompt, same
35
- // models, same gate — so two names offered a choice that was really an
36
- // intensity, and hid a 2x price behind an adjective. Cloud folded them into
37
- // one research mode (apps/answer/mode.go) that always does the deeper pass;
38
- // 'deep' still RESOLVES there, so a client that has not shipped this does not
39
- // 400 — which is why dropping the tab is safe on its own.
40
- { id: 'research', label: 'Research', hint: 'Plans, reads sources, synthesizes' },
41
- ];
42
-
43
- export const SOURCES = ['web', 'news', 'academic', 'github', 'reddit', 'x'];
44
-
45
- export interface ComposerProps {
46
- value: string;
47
- onChange: (value: string) => void;
48
- onSubmit: () => void;
49
- mode: Mode;
50
- setMode: (mode: Mode) => void;
51
- sources: Set<string>;
52
- toggleSource: (source: string) => void;
53
- models: ModelGroup[];
54
- model: ChatModel;
55
- setModel: (model: ChatModel) => void;
56
- busy: boolean;
57
- }
58
-
59
- export function Composer({
60
- value,
61
- onChange,
62
- onSubmit,
63
- mode,
64
- setMode,
65
- sources,
66
- toggleSource,
67
- models,
68
- model,
69
- setModel,
70
- busy,
71
- }: ComposerProps) {
72
- return (
73
- <div className="ae-card">
74
- {/* @hanzo/ui field — auto-grows by line count (rows is the floor), so the
75
- DOM-measured resize effect the raw <textarea> needed is gone. Blends
76
- into .ae-card with transparent bg / no border, matching .ae-input. */}
77
- <Textarea
78
- placeholder={mode === 'chat' ? 'Ask anything' : 'Type @ for sources or / for modes'}
79
- value={value}
80
- rows={1}
81
- maxH={200}
82
- bg="transparent"
83
- borderWidth={0}
84
- px={18}
85
- fontSize={15}
86
- onChangeText={onChange}
87
- onKeyDown={(e) => {
88
- if (e.key === 'Enter' && !e.shiftKey) {
89
- e.preventDefault();
90
- onSubmit();
91
- }
92
- }}
93
- />
94
- <div className="ae-card-row">
95
- {/* The container stays in the row whatever the mode: it is the left half
96
- of a space-between, so dropping it would slide the toolbar left.
97
- Chat is ungrounded, so it offers no sources to pick. */}
98
- <div className="ae-chips">
99
- {mode !== 'chat' &&
100
- SOURCES.map((s) => (
101
- <button
102
- key={s}
103
- className={'ae-chip' + (sources.has(s) ? ' on' : '')}
104
- onClick={() => toggleSource(s)}
105
- title={`@${s}`}
106
- >
107
- @{s}
108
- </button>
109
- ))}
110
- </div>
111
- <div className="ae-card-right">
112
- <div className="ae-modes">
113
- {MODES.map((m) => (
114
- <button
115
- key={m.id}
116
- className={'ae-mode' + (mode === m.id ? ' on' : '')}
117
- onClick={() => setMode(m.id)}
118
- title={m.hint}
119
- >
120
- {m.label}
121
- </button>
122
- ))}
123
- </div>
124
- <Models groups={models} current={model} onPick={setModel} />
125
- {/* @hanzo/ui send control — `isLoading` is the built-in busy signal,
126
- so the hand-rolled .ae-spinner is gone with the raw <button>. */}
127
- <Button
128
- size="icon"
129
- rounded={999}
130
- width={34}
131
- height={34}
132
- onPress={onSubmit}
133
- disabled={busy || !value.trim()}
134
- isLoading={busy}
135
- aria-label="Search (Enter)"
136
- >
137
- {busy ? null : (
138
- <svg viewBox="0 0 16 16" width="15" height="15" aria-hidden="true">
139
- <path d="M3 13V3l10 5-10 5z" fill="currentColor" />
140
- </svg>
141
- )}
142
- </Button>
143
- </div>
144
- </div>
145
- </div>
146
- );
147
- }