@hanzo/browser-extension 1.9.56 → 1.9.65

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 (60) hide show
  1. package/README.md +11 -0
  2. package/chrome/background.js +527 -0
  3. package/chrome/content-script.js +550 -0
  4. package/{src → chrome}/manifest.json +2 -12
  5. package/chrome/newtab.js +230 -0
  6. package/chrome/onboarding.js +31 -0
  7. package/chrome/page.js +35 -0
  8. package/{src → chrome}/popup.html +8 -0
  9. package/chrome/popup.js +48 -0
  10. package/chrome/sidebar.js +291 -0
  11. package/firefox/ai-worker.js +571 -0
  12. package/firefox/background.js +235 -0
  13. package/firefox/callback.html +17 -0
  14. package/firefox/content-script.js +550 -0
  15. package/firefox/icon128.png +0 -0
  16. package/firefox/icon16.png +0 -0
  17. package/firefox/icon48.png +0 -0
  18. package/{src/manifest-firefox.json → firefox/manifest.json} +2 -3
  19. package/firefox/newtab.css +543 -0
  20. package/firefox/newtab.html +13 -0
  21. package/firefox/newtab.js +230 -0
  22. package/firefox/onboarding.css +78 -0
  23. package/firefox/onboarding.html +45 -0
  24. package/firefox/onboarding.js +31 -0
  25. package/firefox/page.js +35 -0
  26. package/firefox/popup.css +761 -0
  27. package/firefox/popup.html +413 -0
  28. package/firefox/popup.js +48 -0
  29. package/firefox/sidebar.css +1350 -0
  30. package/firefox/sidebar.html +388 -0
  31. package/firefox/sidebar.js +291 -0
  32. package/package.json +4 -53
  33. package/manifest.json +0 -34
  34. package/src/Chat.tsx +0 -164
  35. package/src/answer/AnswerEngine.tsx +0 -410
  36. package/src/answer/Mark.tsx +0 -14
  37. package/src/answer/Rail.tsx +0 -95
  38. package/src/answer/Stories.tsx +0 -27
  39. package/src/answer/Toolbar.tsx +0 -93
  40. package/src/answer/WidgetView.tsx +0 -136
  41. package/src/icon128.png +0 -0
  42. package/src/icon16.png +0 -0
  43. package/src/icon32.png +0 -0
  44. package/src/icon48.png +0 -0
  45. package/src/package.json +0 -41
  46. package/src/safari/SafariWebExtensionHandler.swift +0 -153
  47. package/src/shared/Prose.tsx +0 -29
  48. package/src/webgpu.d.ts +0 -131
  49. /package/{src → chrome}/ai-worker.js +0 -0
  50. /package/{src → chrome}/callback.html +0 -0
  51. /package/{images → chrome}/icon128.png +0 -0
  52. /package/{images → chrome}/icon16.png +0 -0
  53. /package/{images → chrome}/icon48.png +0 -0
  54. /package/{src → chrome}/newtab.css +0 -0
  55. /package/{src → chrome}/newtab.html +0 -0
  56. /package/{src → chrome}/onboarding.css +0 -0
  57. /package/{src → chrome}/onboarding.html +0 -0
  58. /package/{src → chrome}/popup.css +0 -0
  59. /package/{src → chrome}/sidebar.css +0 -0
  60. /package/{src → chrome}/sidebar.html +0 -0
@@ -0,0 +1,543 @@
1
+ /* Hanzo Answer Engine — strict monochrome (brand primaryColor #FFFFFF).
2
+ Shared tokens mirror popup.css / sidebar.css. */
3
+ :root {
4
+ /* hanzo.chat dark palette — the exact gray scale from chat/client/src/style.css
5
+ (.dark). One brand, one set of tokens; the extension is no longer its own look. */
6
+ --bg: #000000; /* surface-primary / gray-975 */
7
+ --surface: #050505; /* surface-secondary / gray-950 — source & hero cards */
8
+ --surface-2: #0d0d0d; /* surface-primary-contrast / gray-900 — hover fills */
9
+ --surface-3: #171717; /* surface-tertiary / gray-850 — number pills, selected mode */
10
+ --surface-active: #2f2f2f; /* surface-active / gray-700 — selected chip (NOT a white lozenge) */
11
+ --text: #ececec; /* text-primary / gray-100 */
12
+ --text-2: #cdcdcd; /* text-secondary / gray-300 */
13
+ --text-3: #999696; /* text-secondary-alt / gray-400 */
14
+ --border: #171717; /* border-light / gray-850 */
15
+ --border-2: #212121; /* border-medium / gray-800 */
16
+ --glass: rgba(255, 255, 255, 0.03);
17
+ --glass-2: rgba(255, 255, 255, 0.06);
18
+ --radius: 12px;
19
+ --radius-sm: 8px;
20
+ --radius-xs: 6px;
21
+ --sidebar-w: 232px;
22
+ /* The icon-rail width is @hanzo/ui primitives/sidebar's SIDEBAR_WIDTH_ICON
23
+ (3rem). Kept as that value, not a local guess, so the rail here and the
24
+ shared primitive collapse to the same size on every surface. */
25
+ --rail-w: 3rem;
26
+ }
27
+
28
+ * {
29
+ box-sizing: border-box;
30
+ }
31
+
32
+ html,
33
+ body {
34
+ margin: 0;
35
+ height: 100%;
36
+ background: var(--bg);
37
+ color: var(--text);
38
+ font-family:
39
+ "Zen",
40
+ -apple-system,
41
+ BlinkMacSystemFont,
42
+ "SF Pro Text",
43
+ "Segoe UI",
44
+ sans-serif;
45
+ -webkit-font-smoothing: antialiased;
46
+ }
47
+
48
+ a {
49
+ color: inherit;
50
+ text-decoration: none;
51
+ }
52
+
53
+ .ae-root {
54
+ display: grid;
55
+ grid-template-columns: var(--sidebar-w) 1fr;
56
+ height: 100vh;
57
+ transition: grid-template-columns 0.18s ease;
58
+ }
59
+ /* COLLAPSED IS AN ICON RAIL, NEVER NOTHING.
60
+ `grid-template-columns: 0` + `display:none` erased the sidebar outright, so the
61
+ surface had no brand, no way back, and read as a blank page. This is the
62
+ `collapsible="icon"` behaviour of @hanzo/ui primitives/sidebar, and the width is
63
+ ITS token (SIDEBAR_WIDTH_ICON = 3rem) rather than a number picked here — so
64
+ swapping this rail for the shared primitive is a substitution, not a redesign. */
65
+ .ae-root.collapsed {
66
+ grid-template-columns: var(--rail-w) 1fr;
67
+ }
68
+
69
+ /* Collapse is an EXPLICIT, remembered choice — the rail does NOT spring open
70
+ under the pointer. Hover-to-expand is the model console and hanzo.app both
71
+ retired (their pin/hover props are marked deprecated), because a rail that
72
+ opens when the pointer merely crosses it moves the page out from under the
73
+ thing you were reaching for. The mark expands it; the toggle collapses it. */
74
+ .ae-root.collapsed .ae-brand span,
75
+ .ae-root.collapsed .ae-new span,
76
+ .ae-root.collapsed .ae-nav,
77
+ .ae-root.collapsed .ae-signin-label {
78
+ display: none;
79
+ }
80
+
81
+ /* ── Sidebar ─────────────────────────────────────────────── */
82
+ .ae-sidebar {
83
+ display: flex;
84
+ flex-direction: column;
85
+ gap: 6px;
86
+ padding: 14px 12px;
87
+ border-right: 1px solid var(--border);
88
+ background: var(--surface);
89
+ min-width: 0;
90
+ }
91
+ .ae-side-top {
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: space-between;
95
+ }
96
+ .ae-brand {
97
+ display: flex;
98
+ align-items: center;
99
+ gap: 9px;
100
+ background: none;
101
+ border: none;
102
+ color: var(--text);
103
+ font-size: 15px;
104
+ font-weight: 600;
105
+ letter-spacing: -0.01em;
106
+ cursor: pointer;
107
+ padding: 4px;
108
+ min-width: 0;
109
+ }
110
+ .ae-brand span {
111
+ white-space: nowrap;
112
+ overflow: hidden;
113
+ }
114
+ .ae-collapse,
115
+ .ae-new,
116
+ .ae-signin {
117
+ cursor: pointer;
118
+ font-family: inherit;
119
+ }
120
+ .ae-collapse {
121
+ background: none;
122
+ border: none;
123
+ color: var(--text-3);
124
+ padding: 4px;
125
+ border-radius: var(--radius-xs);
126
+ display: flex;
127
+ }
128
+ .ae-collapse:hover {
129
+ color: var(--text);
130
+ background: var(--glass);
131
+ }
132
+ .ae-new {
133
+ display: flex;
134
+ align-items: center;
135
+ gap: 8px;
136
+ margin-top: 8px;
137
+ padding: 9px 12px;
138
+ background: var(--surface-3);
139
+ color: var(--text);
140
+ border: 1px solid var(--border-2);
141
+ border-radius: var(--radius-sm);
142
+ font-size: 13px;
143
+ font-weight: 500;
144
+ white-space: nowrap;
145
+ overflow: hidden;
146
+ }
147
+ .ae-new:hover {
148
+ background: var(--surface-hover, #212121);
149
+ border-color: var(--border-2);
150
+ }
151
+ .ae-nav {
152
+ display: flex;
153
+ flex-direction: column;
154
+ margin-top: 12px;
155
+ gap: 1px;
156
+ }
157
+ .ae-nav a {
158
+ padding: 8px 10px;
159
+ border-radius: var(--radius-xs);
160
+ color: var(--text-2);
161
+ font-size: 13px;
162
+ white-space: nowrap;
163
+ }
164
+ .ae-nav a:hover {
165
+ background: var(--glass);
166
+ color: var(--text);
167
+ }
168
+ .ae-side-bottom {
169
+ margin-top: auto;
170
+ }
171
+ .ae-signin {
172
+ width: 100%;
173
+ padding: 9px 12px;
174
+ background: var(--glass-2);
175
+ border: 1px solid var(--border);
176
+ color: var(--text);
177
+ border-radius: var(--radius-sm);
178
+ font-size: 12.5px;
179
+ font-weight: 500;
180
+ white-space: nowrap;
181
+ overflow: hidden;
182
+ }
183
+ .ae-signin:hover {
184
+ border-color: var(--border-2);
185
+ background: var(--surface-2);
186
+ }
187
+ .ae-signin.big {
188
+ width: auto;
189
+ padding: 10px 18px;
190
+ font-size: 14px;
191
+ }
192
+ /* Icon-rail geometry. Centre the glyphs and drop the label gaps so a 3rem rail
193
+ holds them without clipping; the collapse rules above own visibility. */
194
+ .ae-root.collapsed .ae-sidebar {
195
+ padding: 14px 6px;
196
+ align-items: center;
197
+ overflow: hidden;
198
+ }
199
+ .ae-root.collapsed .ae-sidebar .ae-side-top {
200
+ justify-content: center;
201
+ }
202
+ .ae-root.collapsed .ae-sidebar .ae-collapse {
203
+ display: none;
204
+ }
205
+ .ae-root.collapsed .ae-sidebar .ae-brand,
206
+ .ae-root.collapsed .ae-sidebar .ae-new,
207
+ .ae-root.collapsed .ae-sidebar .ae-signin {
208
+ gap: 0;
209
+ padding: 8px;
210
+ justify-content: center;
211
+ width: auto;
212
+ }
213
+
214
+ /* ── Main ────────────────────────────────────────────────── */
215
+ .ae-main {
216
+ min-width: 0;
217
+ overflow: hidden;
218
+ display: flex;
219
+ flex-direction: column;
220
+ }
221
+
222
+ /* Hero (empty state) */
223
+ .ae-hero {
224
+ flex: 1;
225
+ display: flex;
226
+ flex-direction: column;
227
+ align-items: center;
228
+ justify-content: center;
229
+ gap: 26px;
230
+ padding: 24px;
231
+ overflow-y: auto;
232
+ }
233
+ .ae-news {
234
+ width: 100%;
235
+ max-width: 720px;
236
+ }
237
+ .ae-news-head,
238
+ .ae-news-grid {
239
+ display: grid;
240
+ grid-template-columns: 1fr 1fr;
241
+ gap: 8px;
242
+ }
243
+ .ae-news-item {
244
+ display: flex;
245
+ flex-direction: column;
246
+ gap: 4px;
247
+ padding: 11px 13px;
248
+ border: 1px solid var(--border);
249
+ border-radius: var(--radius-sm);
250
+ background: var(--surface);
251
+ }
252
+ .ae-news-item:hover {
253
+ border-color: var(--border-2);
254
+ background: var(--surface-2);
255
+ }
256
+ .ae-news-title {
257
+ font-size: 13px;
258
+ color: var(--text);
259
+ line-height: 1.35;
260
+ }
261
+ .ae-news-meta {
262
+ font-size: 11px;
263
+ color: var(--text-3);
264
+ }
265
+
266
+ /* ── Answer prose ────────────────────────────────────────────
267
+ The turn is `@hanzo/ui/chat` Message; markdown is this surface's own
268
+ pipeline, so this is its stylesheet and the only CSS left for an answer. */
269
+
270
+ .markdown {
271
+ font-size: 15px;
272
+ line-height: 1.65;
273
+ color: var(--text);
274
+ }
275
+
276
+ .markdown > *:last-child {
277
+ margin-bottom: 0;
278
+ }
279
+
280
+ .markdown h2 {
281
+ font-size: 20px;
282
+ margin: 22px 0 10px;
283
+ font-weight: 600;
284
+ }
285
+ .markdown h3 {
286
+ font-size: 17px;
287
+ margin: 18px 0 8px;
288
+ font-weight: 600;
289
+ }
290
+ .markdown h4,
291
+ .markdown h5 {
292
+ font-size: 15px;
293
+ margin: 14px 0 6px;
294
+ font-weight: 600;
295
+ }
296
+ .markdown p {
297
+ margin: 0 0 12px;
298
+ }
299
+ .markdown ul,
300
+ .markdown ol {
301
+ margin: 0 0 12px;
302
+ padding-left: 22px;
303
+ }
304
+ .markdown li {
305
+ margin: 4px 0;
306
+ }
307
+ .markdown a {
308
+ color: var(--text);
309
+ text-decoration: underline;
310
+ text-decoration-color: var(--text-3);
311
+ text-underline-offset: 2px;
312
+ }
313
+ .markdown a:hover {
314
+ text-decoration-color: var(--text);
315
+ }
316
+ .markdown code {
317
+ background: var(--surface-2);
318
+ padding: 1px 5px;
319
+ border-radius: 4px;
320
+ font-size: 0.9em;
321
+ font-family: "Zen Mono", ui-monospace, monospace;
322
+ }
323
+
324
+ /* ── Spinner ─────────────────────────────────────────────── */
325
+ @keyframes ae-spin {
326
+ to {
327
+ transform: rotate(360deg);
328
+ }
329
+ }
330
+
331
+ @media (max-width: 720px) {
332
+ /* The rail SURVIVES on mobile as icons. `display:none` here used to be safe only
333
+ because a fixed reveal button floated above it; that button is gone (the rail
334
+ carries its own control now), so hiding the sidebar would leave a phone with no
335
+ brand, no new-thread and no sign-in at all. 3rem is 48px — it costs almost
336
+ nothing and keeps one layout from phone to desktop.
337
+ Hover-open does not apply here: the rule above is gated on (hover: hover), so a
338
+ touch device toggles with the button rather than sticking half-open. */
339
+ .ae-root,
340
+ .ae-root.collapsed {
341
+ grid-template-columns: var(--rail-w) 1fr;
342
+ }
343
+ /* Explicitly opened, the sidebar OVERLAYS rather than pushing: the grid keeps
344
+ the rail's width so the content column never shrinks. */
345
+ .ae-root:not(.collapsed) {
346
+ grid-template-columns: var(--rail-w) 1fr;
347
+ }
348
+ .ae-root:not(.collapsed) .ae-sidebar {
349
+ position: fixed;
350
+ top: 0;
351
+ bottom: 0;
352
+ left: 0;
353
+ width: var(--sidebar-w);
354
+ z-index: 60;
355
+ box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
356
+ }
357
+ .ae-news-grid {
358
+ grid-template-columns: 1fr;
359
+ }
360
+ .ae-hero {
361
+ gap: 20px;
362
+ padding: 20px 16px;
363
+ justify-content: flex-start;
364
+ padding-top: 48px;
365
+ }
366
+ }
367
+
368
+ /* ── Generative result widgets ───────────────────────────── */
369
+ /* margin-left/right stay AUTO: the thread centres its children at a reading
370
+ measure, and a `margin: 4px 0 18px` shorthand here silently resets those to 0 —
371
+ the widgets then hugged the left edge while the prose beside them stayed
372
+ centred. Set only the block margins. */
373
+ .ae-widgets {
374
+ display: flex;
375
+ flex-direction: column;
376
+ gap: 14px;
377
+ margin-top: 4px;
378
+ margin-bottom: 18px;
379
+ }
380
+ .ae-widget {
381
+ border: 1px solid var(--border);
382
+ border-radius: var(--radius);
383
+ background: var(--surface);
384
+ padding: 16px 18px;
385
+ }
386
+ .ae-widget-title {
387
+ margin: 0 0 10px;
388
+ font-size: 14px;
389
+ font-weight: 600;
390
+ color: var(--text);
391
+ letter-spacing: -0.01em;
392
+ }
393
+ .ae-widget-subtitle {
394
+ margin: -6px 0 12px;
395
+ font-size: 13px;
396
+ color: var(--text-3);
397
+ }
398
+
399
+ /* A wide table scrolls INSIDE its own box; the page never scrolls sideways. */
400
+ .ae-widget-scroll {
401
+ overflow-x: auto;
402
+ }
403
+ .ae-widget-table {
404
+ border-collapse: collapse;
405
+ width: 100%;
406
+ font-size: 13px;
407
+ }
408
+ .ae-widget-table th,
409
+ .ae-widget-table td {
410
+ text-align: left;
411
+ padding: 8px 12px;
412
+ border-bottom: 1px solid var(--border);
413
+ vertical-align: top;
414
+ }
415
+ .ae-widget-table thead th {
416
+ color: var(--text-3);
417
+ font-weight: 500;
418
+ white-space: nowrap;
419
+ }
420
+ .ae-widget-table tbody th {
421
+ color: var(--text);
422
+ font-weight: 500;
423
+ }
424
+ .ae-widget-table td {
425
+ color: var(--text-2);
426
+ }
427
+ .ae-widget-table tr:last-child th,
428
+ .ae-widget-table tr:last-child td {
429
+ border-bottom: none;
430
+ }
431
+
432
+ .ae-widget-steplist {
433
+ margin: 0;
434
+ padding-left: 20px;
435
+ display: flex;
436
+ flex-direction: column;
437
+ gap: 8px;
438
+ }
439
+ .ae-widget-steplist li {
440
+ font-size: 13.5px;
441
+ line-height: 1.5;
442
+ color: var(--text-2);
443
+ }
444
+ .ae-widget-steplist li::marker {
445
+ color: var(--text-3);
446
+ }
447
+
448
+ .ae-widget-statgrid {
449
+ display: grid;
450
+ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
451
+ gap: 12px;
452
+ }
453
+ .ae-widget-stat {
454
+ display: flex;
455
+ flex-direction: column;
456
+ gap: 2px;
457
+ }
458
+ .ae-widget-statvalue {
459
+ font-size: 20px;
460
+ font-weight: 600;
461
+ color: var(--text);
462
+ font-variant-numeric: tabular-nums;
463
+ letter-spacing: -0.02em;
464
+ }
465
+ .ae-widget-statlabel {
466
+ font-size: 12px;
467
+ color: var(--text-3);
468
+ }
469
+
470
+ .ae-widget-events {
471
+ margin: 0;
472
+ padding: 0;
473
+ list-style: none;
474
+ display: flex;
475
+ flex-direction: column;
476
+ gap: 10px;
477
+ }
478
+ .ae-widget-events li {
479
+ display: grid;
480
+ grid-template-columns: minmax(72px, auto) 1fr;
481
+ gap: 14px;
482
+ }
483
+ .ae-widget-when {
484
+ font-size: 12.5px;
485
+ color: var(--text-3);
486
+ font-variant-numeric: tabular-nums;
487
+ }
488
+ .ae-widget-what {
489
+ font-size: 13.5px;
490
+ color: var(--text-2);
491
+ line-height: 1.5;
492
+ }
493
+
494
+ .ae-widget-facts {
495
+ margin: 0;
496
+ display: grid;
497
+ grid-template-columns: minmax(96px, auto) 1fr;
498
+ gap: 8px 16px;
499
+ }
500
+ .ae-widget-facts dt {
501
+ font-size: 12.5px;
502
+ color: var(--text-3);
503
+ }
504
+ .ae-widget-facts dd {
505
+ margin: 0;
506
+ font-size: 13.5px;
507
+ color: var(--text-2);
508
+ }
509
+
510
+ .ae-widget-meaning {
511
+ margin: 0;
512
+ font-size: 14px;
513
+ line-height: 1.55;
514
+ color: var(--text-2);
515
+ }
516
+ .ae-widget-example {
517
+ margin: 12px 0 0;
518
+ padding: 10px 12px;
519
+ overflow-x: auto;
520
+ background: var(--bg);
521
+ border: 1px solid var(--border);
522
+ border-radius: var(--radius-sm);
523
+ font-size: 12.5px;
524
+ color: var(--text-2);
525
+ white-space: pre-wrap;
526
+ }
527
+
528
+ @media (max-width: 720px) {
529
+ .ae-widget {
530
+ padding: 14px;
531
+ }
532
+ .ae-widget-events li {
533
+ grid-template-columns: 1fr;
534
+ gap: 2px;
535
+ }
536
+ .ae-widget-facts {
537
+ grid-template-columns: 1fr;
538
+ gap: 2px 0;
539
+ }
540
+ .ae-widget-facts dd {
541
+ margin-bottom: 8px;
542
+ }
543
+ }
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Hanzo</title>
7
+ <link rel="stylesheet" href="newtab.css" />
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script src="newtab.js"></script>
12
+ </body>
13
+ </html>