reifyui 0.5.1 → 0.6.0

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 (43) hide show
  1. package/README.md +40 -3
  2. package/dist/{chunk-2LYV4PIX.js → chunk-NTIWFHR4.js} +26 -2
  3. package/dist/chunk-NTIWFHR4.js.map +1 -0
  4. package/dist/harness.cjs +72 -21
  5. package/dist/harness.cjs.map +1 -1
  6. package/dist/harness.d.ts +23 -0
  7. package/dist/harness.js +52 -23
  8. package/dist/harness.js.map +1 -1
  9. package/dist/index.cjs +1125 -296
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +260 -1
  12. package/dist/index.js +1100 -293
  13. package/dist/index.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/components/Card.jsx +49 -0
  16. package/src/components/Carousel.jsx +73 -0
  17. package/src/components/ChatPanel.jsx +461 -0
  18. package/src/components/Chip.jsx +61 -0
  19. package/src/components/Composer.jsx +20 -1
  20. package/src/components/Dialog.jsx +5 -10
  21. package/src/components/Modal.jsx +75 -0
  22. package/src/components/Popover.jsx +86 -0
  23. package/src/components/SearchField.jsx +30 -0
  24. package/src/components/icons.jsx +9 -0
  25. package/src/components/overlay.js +63 -0
  26. package/src/format.js +10 -0
  27. package/src/harness/attach.js +63 -0
  28. package/src/harness/index.d.ts +23 -0
  29. package/src/harness/index.js +6 -18
  30. package/src/hooks/useTypewriter.js +53 -0
  31. package/src/index.d.ts +260 -1
  32. package/src/index.js +27 -1
  33. package/src/input/dictate.js +60 -0
  34. package/src/state/turns.js +30 -0
  35. package/styles/chat.css +127 -1
  36. package/styles/chip.css +53 -0
  37. package/styles/dialog.css +42 -37
  38. package/styles/library.css +205 -0
  39. package/styles/preview.css +73 -0
  40. package/styles/sheet.css +16 -14
  41. package/styles/themes/dark.css +20 -0
  42. package/styles/themes/light.css +23 -0
  43. package/dist/chunk-2LYV4PIX.js.map +0 -1
package/styles/dialog.css CHANGED
@@ -1,13 +1,18 @@
1
1
  /* Dialog — in-app alert / confirm / prompt. Theme-driven: every colour is a variable with a
2
- sensible fallback, so this inherits the host app's palette without configuration. */
2
+ sensible fallback, so this inherits the host app's palette without configuration.
3
3
 
4
- .rui-dlg-root { position: fixed; inset: 0; z-index: 9000; pointer-events: none; }
4
+ The variables are the package's --uic-* set (themes/light.css, themes/dark.css). They used to
5
+ be a private --rui-* set that no theme defined and no app overrode, which meant this stylesheet
6
+ ran entirely on its fallbacks and painted a light dialog inside a dark app while every other
7
+ surface followed the theme. Class names are unchanged — those are published. */
8
+
9
+ .rui-dlg-root { position: fixed; inset: 0; z-index: var(--uic-z-overlay, 9000); pointer-events: none; }
5
10
 
6
11
  .rui-dlg-backdrop {
7
12
  position: fixed; inset: 0;
8
13
  display: flex; align-items: center; justify-content: center;
9
14
  padding: 16px;
10
- background: var(--rui-scrim, rgba(15, 23, 42, .34));
15
+ background: var(--uic-scrim, rgba(15, 23, 42, .34));
11
16
  backdrop-filter: blur(2px);
12
17
  pointer-events: auto;
13
18
  animation: rui-dlg-fade 120ms ease-out;
@@ -18,10 +23,10 @@
18
23
  width: min(440px, 100%);
19
24
  max-height: 90vh;
20
25
  display: flex; flex-direction: column;
21
- background: var(--rui-surface, #fff);
22
- border: 1px solid var(--rui-border, rgba(15, 23, 42, .08));
26
+ background: var(--uic-surface, #fff);
27
+ border: 1px solid var(--uic-line, rgba(15, 23, 42, .08));
23
28
  border-radius: 14px;
24
- box-shadow: 0 24px 60px rgba(15, 23, 42, .18), 0 4px 16px rgba(15, 23, 42, .08);
29
+ box-shadow: var(--uic-shadow-2, 0 24px 60px rgba(15, 23, 42, .18), 0 4px 16px rgba(15, 23, 42, .08));
25
30
  overflow: hidden;
26
31
  animation: rui-dlg-pop 140ms cubic-bezier(.2, .7, .2, 1.05);
27
32
  }
@@ -37,44 +42,44 @@
37
42
  .rui-dlg-h { padding: 16px 20px 0; }
38
43
  .rui-dlg-title {
39
44
  font-size: 15px; font-weight: 600; line-height: 1.4;
40
- color: var(--rui-text, #0f172a);
45
+ color: var(--uic-ink, #0f172a);
41
46
  }
42
47
  .rui-dlg-h.is-destructive .rui-dlg-title,
43
- .rui-dlg-h.is-error .rui-dlg-title { color: var(--rui-danger, #b91c1c); }
44
- .rui-dlg-h.is-warning .rui-dlg-title { color: var(--rui-warn, #b45309); }
45
- .rui-dlg-h.is-success .rui-dlg-title { color: var(--rui-ok, #047857); }
48
+ .rui-dlg-h.is-error .rui-dlg-title { color: var(--uic-fail-ink, #b91c1c); }
49
+ .rui-dlg-h.is-warning .rui-dlg-title { color: var(--uic-warn, #b45309); }
50
+ .rui-dlg-h.is-success .rui-dlg-title { color: var(--uic-ok, #047857); }
46
51
 
47
52
  .rui-dlg-b { padding: 12px 20px 4px; overflow-y: auto; }
48
53
  .rui-dlg-msg {
49
54
  font-size: 13px; line-height: 1.55;
50
- color: var(--rui-text-mute, #475569);
55
+ color: var(--uic-mute, #475569);
51
56
  margin-bottom: 8px;
52
57
  white-space: pre-wrap; word-break: break-word;
53
58
  }
54
59
  .rui-dlg-label {
55
60
  display: block; margin: 10px 0 6px;
56
61
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
57
- color: var(--rui-text-mute, #475569);
62
+ color: var(--uic-mute, #475569);
58
63
  }
59
64
  .rui-dlg-input {
60
65
  width: 100%; padding: 9px 11px;
61
66
  font: inherit; font-size: 13px;
62
- color: var(--rui-text, #0f172a);
63
- background: var(--rui-surface, #fff);
64
- border: 1px solid var(--rui-border, rgba(15, 23, 42, .16));
67
+ color: var(--uic-ink, #0f172a);
68
+ background: var(--uic-surface, #fff);
69
+ border: 1px solid var(--uic-line, rgba(15, 23, 42, .16));
65
70
  border-radius: 8px; outline: none;
66
71
  transition: border-color .12s ease, box-shadow .12s ease;
67
72
  }
68
73
  .rui-dlg-input:focus {
69
- border-color: var(--rui-accent, #285aff);
70
- box-shadow: 0 0 0 3px var(--rui-accent-ring, rgba(40, 90, 255, .14));
74
+ border-color: var(--uic-brand, #285aff);
75
+ box-shadow: 0 0 0 3px var(--uic-focus-ring, rgba(40, 90, 255, .14));
71
76
  }
72
- .rui-dlg-input.is-err { border-color: var(--rui-danger, #dc2626); }
77
+ .rui-dlg-input.is-err { border-color: var(--uic-fail-ink, #dc2626); }
73
78
  .rui-dlg-input.is-err:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .12); }
74
79
  textarea.rui-dlg-input { resize: vertical; min-height: 80px; line-height: 1.5; }
75
80
 
76
- .rui-dlg-help { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--rui-text-mute, #475569); }
77
- .rui-dlg-err { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--rui-danger, #b91c1c); }
81
+ .rui-dlg-help { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--uic-mute, #475569); }
82
+ .rui-dlg-err { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--uic-fail-ink, #b91c1c); }
78
83
 
79
84
  .rui-dlg-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 16px; }
80
85
 
@@ -83,28 +88,28 @@ textarea.rui-dlg-input { resize: vertical; min-height: 80px; line-height: 1.5; }
83
88
  font: inherit; font-size: 13px; font-weight: 500;
84
89
  padding: 8px 16px; min-width: 76px;
85
90
  border: 1px solid transparent; border-radius: 8px;
86
- background: transparent; color: var(--rui-text, #0f172a);
91
+ background: transparent; color: var(--uic-ink, #0f172a);
87
92
  transition: background .12s, border-color .12s, color .12s, transform .04s;
88
93
  }
89
- .rui-dlg-btn:focus-visible { outline: 2px solid var(--rui-accent, #285aff); outline-offset: 2px; }
94
+ .rui-dlg-btn:focus-visible { outline: 2px solid var(--uic-brand, #285aff); outline-offset: 2px; }
90
95
  .rui-dlg-btn:active { transform: translateY(1px); }
91
96
 
92
97
  .rui-dlg-secondary {
93
- background: var(--rui-surface, #fff);
94
- border-color: var(--rui-border, rgba(15, 23, 42, .18));
95
- color: var(--rui-text, #0f172a);
98
+ background: var(--uic-surface, #fff);
99
+ border-color: var(--uic-line, rgba(15, 23, 42, .18));
100
+ color: var(--uic-ink, #0f172a);
96
101
  }
97
- .rui-dlg-secondary:hover { background: var(--rui-surface-2, #f8fafc); }
102
+ .rui-dlg-secondary:hover { background: var(--uic-surface-2, #f8fafc); }
98
103
 
99
104
  .rui-dlg-primary {
100
- background: var(--rui-accent, #285aff);
101
- border-color: var(--rui-accent, #285aff);
102
- color: #fff;
105
+ background: var(--uic-brand, #285aff);
106
+ border-color: var(--uic-brand, #285aff);
107
+ color: var(--uic-on-brand, #fff);
103
108
  }
104
109
  .rui-dlg-primary:hover { filter: brightness(1.06); }
105
110
  .rui-dlg-primary.is-destructive {
106
- background: var(--rui-danger, #dc2626);
107
- border-color: var(--rui-danger, #dc2626);
111
+ background: var(--uic-fail-ink, #dc2626);
112
+ border-color: var(--uic-fail-ink, #dc2626);
108
113
  }
109
114
 
110
115
  .rui-dlg-typegrid {
@@ -115,15 +120,15 @@ textarea.rui-dlg-input { resize: vertical; min-height: 80px; line-height: 1.5; }
115
120
  display: flex; align-items: center; gap: 8px;
116
121
  padding: 10px 12px; cursor: pointer;
117
122
  font: inherit; font-size: 13px; text-align: left;
118
- color: var(--rui-text, #0f172a);
119
- background: var(--rui-surface, #fff);
120
- border: 1px solid var(--rui-border, rgba(15, 23, 42, .14));
123
+ color: var(--uic-ink, #0f172a);
124
+ background: var(--uic-surface, #fff);
125
+ border: 1px solid var(--uic-line, rgba(15, 23, 42, .14));
121
126
  border-radius: 10px;
122
127
  }
123
- .rui-dlg-type:hover { background: var(--rui-surface-2, #f8fafc); }
128
+ .rui-dlg-type:hover { background: var(--uic-surface-2, #f8fafc); }
124
129
  .rui-dlg-type.is-on {
125
- border-color: var(--rui-accent, #285aff);
126
- box-shadow: 0 0 0 2px var(--rui-accent-ring, rgba(40, 90, 255, .14));
130
+ border-color: var(--uic-brand, #285aff);
131
+ box-shadow: 0 0 0 2px var(--uic-focus-ring, rgba(40, 90, 255, .14));
127
132
  }
128
133
  .rui-dlg-type-ic {
129
134
  display: inline-flex; align-items: center; justify-content: center;
@@ -0,0 +1,205 @@
1
+ /* The library page — the surface a document product opens on: a prompt box, a strip of
2
+ templates, and the things you already made.
3
+
4
+ 190 selectors of this were byte-identical across four products' app.css files (189 of them to
5
+ the byte, after whitespace normalisation), under names owned by whichever product wrote them
6
+ first. Adopting this file is meant to DELETE those copies, not to be overridden by them: if
7
+ every caller would pass the same override string, that string was the default.
8
+
9
+ Only some of these have components in the package (Carousel, Card, SearchField, Chip). The
10
+ rest are structure a page composes directly — a shell, a hero, a table — where a component
11
+ would have been an `as` prop and an `id` prop wrapping one flex div.
12
+
13
+ Token contract: styles/chat.css, plus --uic-bg, --uic-shadow-2, --uic-focus-ring,
14
+ --uic-r-card/-input/-pill, --uic-line-strong, --uic-hover-wash, --uic-on-brand.
15
+ Presets: themes/light.css / themes/dark.css define all of them. */
16
+
17
+ /* ── shell + topbar ─────────────────────────────────────────────────────────
18
+ The topbar is a PAGE-level bar and belongs to the shell, not to the content column. One app
19
+ nested it inside its 1080px centred column and shipped a floating white slab with square
20
+ corners inset 204px from each edge. */
21
+ .uic-shell { min-height: 100vh; display: flex; flex-direction: column;
22
+ background: var(--uic-bg, #F7F8FB); }
23
+ .uic-topbar { height: 56px; flex-shrink: 0; display: flex; align-items: center; gap: 14px;
24
+ padding: 0 20px; position: sticky; top: 0; z-index: 30;
25
+ background: var(--uic-surface, #FFFFFF); border-bottom: 1px solid var(--uic-line, #DDDFE6); }
26
+ .uic-topbar-spacer { flex: 1; }
27
+ .uic-wordmark { display: inline-flex; align-items: center; gap: 8px; padding: 0;
28
+ font-family: inherit; font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
29
+ color: var(--uic-brand, #285AFF); text-decoration: none;
30
+ background: none; border: none; cursor: pointer; }
31
+
32
+ /* ── the page column ── */
33
+ .uic-page { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 24px 64px; }
34
+ .uic-hero { padding: 64px 0 36px; text-align: center; }
35
+ .uic-hero h1 { margin: 0 0 10px; font-size: 32px; font-weight: 700; letter-spacing: -0.02em;
36
+ color: var(--uic-ink, #111317); }
37
+ .uic-hero p { margin: 0 0 26px; font-size: 15px; color: var(--uic-mute, #5B5D66); }
38
+ .uic-hero .uic-hint { display: block; font-size: 12.5px; color: var(--uic-mute, #5B5D66); }
39
+
40
+ /* ── prompt box: the big chatbox that starts a document ── */
41
+ .uic-promptbox { max-width: 720px; margin: 0 auto; padding: 14px 14px 10px; text-align: left;
42
+ display: flex; flex-direction: column; gap: 8px;
43
+ background: var(--uic-surface, #FFFFFF); border: 1.5px solid var(--uic-line, #DDDFE6);
44
+ border-radius: 18px; box-shadow: var(--uic-shadow-2, 0 8px 24px -12px rgba(17, 24, 39, .12)); }
45
+ .uic-promptbox:focus-within { border-color: var(--uic-brand, #285AFF);
46
+ box-shadow: 0 0 0 4px var(--uic-focus-ring, rgba(40, 90, 255, .14)),
47
+ var(--uic-shadow-2, 0 8px 24px -12px rgba(17, 24, 39, .12)); }
48
+ .uic-promptbox-input { border: none; outline: none; resize: none; font-family: inherit;
49
+ font-size: 15px; line-height: 1.55; min-height: 66px;
50
+ color: var(--uic-ink, #111317); background: transparent; }
51
+ .uic-promptbox-input::placeholder { color: var(--uic-mute-2, #8E9199); }
52
+ /* Wraps, so several chips flow onto extra rows instead of pushing the send button off. */
53
+ .uic-promptbox-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
54
+
55
+ /* ── section header ── */
56
+ .uic-section { margin-top: 40px; }
57
+ .uic-section-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
58
+ .uic-section-h h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--uic-ink, #111317); }
59
+ .uic-section-h .uic-hint { font-size: 12.5px; color: var(--uic-mute, #5B5D66); }
60
+ .uic-section-tools { display: flex; align-items: center; gap: 8px; }
61
+
62
+ /* ── SearchField ── */
63
+ .uic-search { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
64
+ border-radius: var(--uic-r-input, 8px);
65
+ background: var(--uic-surface, #FFFFFF); border: 1px solid var(--uic-line, #DDDFE6);
66
+ color: var(--uic-mute, #5B5D66); }
67
+ .uic-search:focus-within { border-color: var(--uic-brand, #285AFF); color: var(--uic-ink-2, #3A3D45); }
68
+ .uic-search-ic { display: inline-flex; line-height: 0; }
69
+ .uic-search input { border: none; outline: none; background: transparent; width: 168px;
70
+ font-family: inherit; font-size: 12.5px; color: var(--uic-ink, #111317); }
71
+ .uic-search input::placeholder { color: var(--uic-mute-2, #8E9199); }
72
+ .uic-search input::-webkit-search-cancel-button { display: none; }
73
+ .uic-search-x { display: inline-flex; align-items: center; justify-content: center;
74
+ border: none; background: none; padding: 2px; border-radius: 999px; cursor: pointer;
75
+ color: var(--uic-mute, #5B5D66); }
76
+ .uic-search-x:hover { background: var(--uic-line-soft, #EFF1F4); color: var(--uic-ink, #111317); }
77
+
78
+ /* ── Carousel ──────────────────────────────────────────────────────────────
79
+ Item width is a custom property so the product sizes its own cards. The nav buttons are
80
+ rendered only when the strip actually overflows (Carousel.jsx measures), and hidden entirely
81
+ on narrow viewports where touch scrolling is the better control. */
82
+ .uic-carousel-wrap { position: relative; }
83
+ .uic-carousel { display: flex; gap: 12px; overflow-x: auto; scroll-behavior: smooth;
84
+ padding: 2px; scrollbar-width: none; scroll-snap-type: x proximity; }
85
+ .uic-carousel::-webkit-scrollbar { display: none; }
86
+ .uic-carousel > * { flex: 0 0 var(--uic-car-item, 236px); scroll-snap-align: start; }
87
+ .uic-carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
88
+ width: 32px; height: 32px; border-radius: 999px; cursor: pointer;
89
+ display: flex; align-items: center; justify-content: center;
90
+ color: var(--uic-ink-2, #3A3D45);
91
+ background: var(--uic-surface, #FFFFFF); border: 1px solid var(--uic-line, #DDDFE6);
92
+ box-shadow: var(--uic-shadow-2, 0 8px 24px -12px rgba(17, 24, 39, .12)); }
93
+ .uic-carousel-nav:hover:not(:disabled) { border-color: var(--uic-brand, #285AFF); color: var(--uic-brand, #285AFF); }
94
+ .uic-carousel-nav:disabled { opacity: .35; cursor: default; }
95
+ .uic-carousel-nav.is-left { left: -14px; }
96
+ .uic-carousel-nav.is-right { right: -14px; }
97
+
98
+ /* ── Card ──────────────────────────────────────────────────────────────────
99
+ Root is a div; the primary action is the inner button; overlay and actions are siblings of it,
100
+ never children — nesting them made every card a button inside a button. */
101
+ .uic-card { position: relative; display: flex; flex-direction: column; overflow: hidden;
102
+ background: var(--uic-surface, #FFFFFF); border: 1px solid var(--uic-line, #DDDFE6);
103
+ border-radius: var(--uic-r-card, 12px);
104
+ box-shadow: var(--uic-shadow-1, 0 1px 2px rgba(17, 24, 39, .04)); }
105
+ .uic-card:hover { border-color: var(--uic-brand, #285AFF);
106
+ box-shadow: var(--uic-shadow-2, 0 8px 24px -12px rgba(17, 24, 39, .12)); }
107
+ .uic-card.is-selected { border-color: var(--uic-brand, #285AFF);
108
+ box-shadow: 0 0 0 2px var(--uic-brand-soft, #E1E9FF); }
109
+ .uic-card-main { flex: 1; display: flex; flex-direction: column; text-align: left; padding: 0;
110
+ font-family: inherit; background: none; border: none; cursor: pointer; color: inherit; }
111
+ div.uic-card-main { cursor: default; }
112
+ .uic-card-art { display: flex; align-items: center; justify-content: center; overflow: hidden;
113
+ width: 100%; aspect-ratio: 16 / 9;
114
+ background: var(--uic-surface-2, #F7F8FA); border-bottom: 1px solid var(--uic-line-soft, #EFF1F4); }
115
+ .uic-card-art > * { max-width: 100%; }
116
+ .uic-card-foot { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; }
117
+ .uic-card-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 600;
118
+ color: var(--uic-ink, #111317); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
119
+ .uic-card-sub { flex-shrink: 0; font-size: 11.5px; color: var(--uic-mute-2, #8E9199); }
120
+ .uic-card-overlay { position: absolute; top: 8px; right: 8px; z-index: 2;
121
+ opacity: 0; transition: opacity .12s ease; }
122
+ .uic-card:hover .uic-card-overlay, .uic-card:focus-within .uic-card-overlay { opacity: 1; }
123
+ /* No hover on touch, and no room to spare on a phone: show it. */
124
+ @media (hover: none), (max-width: 760px) { .uic-card-overlay { opacity: 1; } }
125
+ .uic-card-actions { position: absolute; right: 8px; bottom: 7px; z-index: 2;
126
+ display: inline-flex; gap: 2px; opacity: 0; }
127
+ .uic-card:hover .uic-card-actions, .uic-card:focus-within .uic-card-actions { opacity: 1; }
128
+ @media (hover: none) { .uic-card-actions { opacity: 1; } }
129
+ /* Keep the name clear of the actions that float over its row. */
130
+ .uic-card:has(.uic-card-actions) .uic-card-foot { padding-right: 66px; }
131
+
132
+ .uic-cardgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
133
+
134
+ /* ── icon button (rename / delete on a row or a card) ── */
135
+ .uic-iconbtn { width: 26px; height: 26px; border-radius: 7px; border: none; background: transparent;
136
+ display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
137
+ color: var(--uic-mute, #5B5D66); }
138
+ .uic-iconbtn:hover { background: var(--uic-line-soft, #EFF1F4); color: var(--uic-ink, #111317); }
139
+ .uic-iconbtn.is-danger:hover { background: var(--uic-fail-bg, #fef2f2); color: var(--uic-fail-ink, #b91c1c); }
140
+
141
+ /* ── the document table ────────────────────────────────────────────────────
142
+ The wrap is not decoration: it is the card AND the overflow clip. Without it a long unbroken
143
+ name escapes the table and pushes the whole document sideways — 173px past the viewport at
144
+ 390px wide, in the one copy that left it off. Fixed layout so the name column absorbs the
145
+ leftover width and long names ellipsize against it instead of widening the column. */
146
+ .uic-table-wrap { overflow: hidden;
147
+ background: var(--uic-surface, #FFFFFF); border: 1px solid var(--uic-line, #DDDFE6);
148
+ border-radius: var(--uic-r-card, 12px);
149
+ box-shadow: var(--uic-shadow-1, 0 1px 2px rgba(17, 24, 39, .04)); }
150
+ .uic-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
151
+ .uic-table th { text-align: left; padding: 10px 14px;
152
+ font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
153
+ color: var(--uic-mute, #5B5D66); background: var(--uic-surface-2, #F7F8FA); }
154
+ .uic-table td { padding: 8px 14px; }
155
+ .uic-table tbody tr { cursor: pointer; }
156
+ .uic-table tbody tr:hover, .uic-table tbody tr:focus-within { background: var(--uic-line-soft, #EFF1F4); }
157
+ .uic-table .uic-col-last { width: 140px; }
158
+ .uic-table .uic-col-access { width: 170px; }
159
+ .uic-table-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
160
+ .uic-table-name > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
161
+ .uic-table-thumb { width: 58px; height: 34px; flex-shrink: 0; border-radius: 7px; overflow: hidden;
162
+ background: var(--uic-surface-2, #F7F8FA); border: 1px solid var(--uic-line-soft, #EFF1F4); }
163
+ .uic-table-thumb > * { width: 100%; height: 100%; }
164
+ .uic-table-quiet { color: var(--uic-mute, #5B5D66); font-size: 12.5px; white-space: nowrap; }
165
+ .uic-table-actions { width: 76px; text-align: right; white-space: nowrap; }
166
+ .uic-table-actions .uic-iconbtn { opacity: 0; }
167
+ .uic-table tbody tr:hover .uic-iconbtn, .uic-table tbody tr:focus-within .uic-iconbtn { opacity: 1; }
168
+ @media (hover: none) { .uic-table-actions .uic-iconbtn { opacity: 1; } }
169
+
170
+ /* ── a quiet line where content would have been ────────────────────────────
171
+ Not a component: four apps spelled this four ways (.empty-note, .page-note, .auth-err,
172
+ .chip-pop-note) and a `tone` prop over four unrelated treatments discriminates rather than
173
+ consolidates. Two classes, zero behaviour. */
174
+ .uic-note { padding: 36px 16px; text-align: center; font-size: 13px; color: var(--uic-mute, #5B5D66); }
175
+ .uic-note.is-err { padding: 0; text-align: left; color: var(--uic-fail-ink, #b91c1c); margin: 8px 0; }
176
+
177
+ /* ── skeleton block: a neutral pulse in the shape of what is coming ── */
178
+ .uic-skel { background: var(--uic-skel, var(--uic-line, #DDDFE6)); border-radius: 8px;
179
+ animation: uic-skel-pulse 1.6s ease-in-out infinite; }
180
+ @keyframes uic-skel-pulse { 0%, 100% { opacity: .55; } 50% { opacity: .9; } }
181
+ @media (prefers-reduced-motion: reduce) { .uic-skel { animation: none; } }
182
+
183
+ /* ── narrow widths ─────────────────────────────────────────────────────────
184
+ The table sheds Access, then Last (Name and Actions always stay); the header tools wrap under
185
+ the heading; the prompt row wraps; the carousel yields to touch scrolling. */
186
+ @media (max-width: 760px) {
187
+ .uic-table .uic-col-access { display: none; }
188
+ }
189
+ @media (max-width: 560px) {
190
+ .uic-page { padding: 0 14px 48px; }
191
+ .uic-topbar { padding: 0 14px; }
192
+ .uic-hero { padding: 40px 0 28px; }
193
+ .uic-hero h1 { font-size: 24px; }
194
+ .uic-promptbox { padding: 12px 12px 8px; }
195
+ .uic-section-h { flex-wrap: wrap; gap: 10px; }
196
+ .uic-section-tools { flex: 1 1 100%; }
197
+ .uic-section-tools .uic-search { flex: 1; }
198
+ .uic-search input { width: auto; flex: 1; min-width: 0; }
199
+ .uic-carousel-nav { display: none; }
200
+ }
201
+ @media (max-width: 500px) {
202
+ .uic-table .uic-col-last { display: none; }
203
+ .uic-table th, .uic-table td { padding: 8px 10px; }
204
+ .uic-table-actions { width: 64px; }
205
+ }
@@ -0,0 +1,73 @@
1
+ /* Modal — the shell for a dialog whose body is the caller's: a template preview, a comparison,
2
+ a big form. Only the shell is here; what goes inside arrives as children, because that is the
3
+ part that is genuinely different per product (a slide, a grid, a chart).
4
+
5
+ Shares the dialog layer with styles/dialog.css through --uic-z-overlay, and the same scrim
6
+ colour, so a Modal opened over a confirm does not sit under it or tint differently. */
7
+
8
+ .uic-modal-backdrop { position: fixed; inset: 0; z-index: var(--uic-z-overlay, 9000);
9
+ display: flex; align-items: center; justify-content: center; padding: 22px;
10
+ background: var(--uic-scrim, rgba(17, 24, 39, .42));
11
+ animation: uic-modal-fade 120ms ease-out; }
12
+ @keyframes uic-modal-fade { from { opacity: 0 } to { opacity: 1 } }
13
+
14
+ .uic-modal { display: flex; flex-direction: column; overflow: hidden;
15
+ width: min(880px, 100%); max-height: calc(100vh - 44px);
16
+ background: var(--uic-surface, #FFFFFF); border-radius: 16px;
17
+ box-shadow: var(--uic-shadow-2, 0 8px 24px -12px rgba(17, 24, 39, .18));
18
+ animation: uic-modal-pop 140ms cubic-bezier(.2, .7, .2, 1.05); }
19
+ @keyframes uic-modal-pop {
20
+ from { transform: translateY(8px) scale(.98); opacity: 0 }
21
+ to { transform: translateY(0) scale(1); opacity: 1 }
22
+ }
23
+ @media (prefers-reduced-motion: reduce) {
24
+ .uic-modal-backdrop, .uic-modal { animation: none; }
25
+ }
26
+ .uic-modal.is-sm { width: min(480px, 100%); }
27
+ .uic-modal.is-md { width: min(880px, 100%); }
28
+ .uic-modal.is-lg { width: min(1240px, 100%); }
29
+ /* Full: as much room as the viewport has. A preview of a whole document needs the height too,
30
+ not just the width. */
31
+ .uic-modal.is-full { width: min(1240px, 100%); height: 100%; }
32
+
33
+ .uic-modal-h { flex-shrink: 0; display: flex; align-items: center; gap: 12px;
34
+ padding: 14px 16px; border-bottom: 1px solid var(--uic-line-soft, #EFF1F4); }
35
+ .uic-modal-title { flex: 1; min-width: 0; }
36
+ .uic-modal-title h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--uic-ink, #111317); }
37
+ .uic-modal-title p { margin: 2px 0 0; font-size: 12.5px; color: var(--uic-mute, #5B5D66);
38
+ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
39
+ .uic-modal-x { flex-shrink: 0; width: 30px; height: 30px; border-radius: 7px;
40
+ display: inline-flex; align-items: center; justify-content: center;
41
+ border: none; background: none; cursor: pointer; color: var(--uic-mute, #5B5D66); }
42
+ .uic-modal-x:hover { background: var(--uic-hover-wash, rgba(0, 0, 0, .05)); color: var(--uic-ink, #111317); }
43
+ .uic-modal-b { flex: 1; min-height: 0; display: flex; overflow: auto;
44
+ background: var(--uic-bg, #F7F8FB); }
45
+
46
+ /* Optional three-pane body (rail · canvas · side) for previewing a document: the arrangement
47
+ every preview in these products converged on. Use the parts you need. */
48
+ .uic-modal-rail { flex: 0 0 172px; overflow-y: auto; padding: 12px;
49
+ display: flex; flex-direction: column; gap: 10px;
50
+ background: var(--uic-surface, #FFFFFF); border-right: 1px solid var(--uic-line, #DDDFE6); }
51
+ .uic-modal-canvas { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding: 22px; }
52
+ .uic-modal-canvas-note { text-align: center; font-size: 12px; color: var(--uic-mute-2, #8E9199); }
53
+ .uic-modal-side { flex: 0 0 280px; overflow-y: auto; padding: 18px;
54
+ background: var(--uic-surface, #FFFFFF); border-left: 1px solid var(--uic-line, #DDDFE6); }
55
+ .uic-modal-side h4 { margin: 0 0 10px; font-size: 12px; font-weight: 700;
56
+ letter-spacing: .06em; text-transform: uppercase; color: var(--uic-mute, #5B5D66); }
57
+
58
+ /* Narrow: shed the side panel, shrink the rail, and let the card use the whole screen. */
59
+ @media (max-width: 900px) {
60
+ .uic-modal-backdrop { padding: 8px; }
61
+ .uic-modal { max-height: calc(100vh - 16px); border-radius: 12px; }
62
+ .uic-modal-side { display: none; }
63
+ .uic-modal-rail { flex: 0 0 116px; }
64
+ .uic-modal-canvas { padding: 14px; }
65
+ }
66
+ @media (max-width: 560px) {
67
+ .uic-modal-backdrop { padding: 0; align-items: flex-end; }
68
+ .uic-modal, .uic-modal.is-sm, .uic-modal.is-md, .uic-modal.is-lg, .uic-modal.is-full {
69
+ width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
70
+ .uic-modal-b { flex-direction: column; }
71
+ .uic-modal-rail { flex: 0 0 auto; flex-direction: row; overflow-x: auto;
72
+ border-right: none; border-bottom: 1px solid var(--uic-line, #DDDFE6); }
73
+ }
package/styles/sheet.css CHANGED
@@ -50,7 +50,7 @@
50
50
  border: none; background: transparent; color: var(--uic-mute-2, #8E9199);
51
51
  cursor: pointer; font-size: 15px; line-height: 1; padding: 2px 5px; border-radius: 4px;
52
52
  }
53
- .shg-coldel:hover { background: var(--uic-fail-bg, #FEF2F2); color: #B91C1C; }
53
+ .shg-coldel:hover { background: var(--uic-fail-bg, #FEF2F2); color: var(--uic-fail-ink, #B91C1C); }
54
54
  .shg-add:hover { background: var(--uic-line-soft, #EFF1F4); color: var(--uic-ink, #111317); }
55
55
  .shg-add-col { width: auto; min-width: 40px; text-align: left; background: var(--uic-surface, #FFFFFF); position: sticky; top: 0; z-index: 4; }
56
56
 
@@ -77,14 +77,14 @@
77
77
  .shg-cell:hover .shg-runcell { opacity: 1; }
78
78
 
79
79
  /* Computed cell status tints + dot */
80
- .shg-cell-running { background: #EFF6FF; }
81
- .shg-cell-failed { background: #FEF2F2; }
80
+ .shg-cell-running { background: var(--uic-brand-faint, #EFF6FF); }
81
+ .shg-cell-failed { background: var(--uic-fail-bg, #FEF2F2); }
82
82
  .shg-cell-skipped { opacity: .6; }
83
83
  .shg-dot { width: 7px; height: 7px; border-radius: 999px; flex-shrink: 0; background: var(--uic-mute-2, #8E9199); }
84
- .shg-dot-running { background: #2563EB; animation: shg-pulse 1s ease-in-out infinite; }
85
- .shg-dot-done { background: #10B981; }
86
- .shg-dot-failed { background: #EF4444; }
87
- .shg-dot-skipped { background: #CBD5E1; }
84
+ .shg-dot-running { background: var(--uic-brand, #2563EB); animation: shg-pulse 1s ease-in-out infinite; }
85
+ .shg-dot-done { background: var(--uic-ok, #10B981); }
86
+ .shg-dot-failed { background: var(--uic-fail-ink, #EF4444); }
87
+ .shg-dot-skipped { background: var(--uic-mute-2, #CBD5E1); }
88
88
  @keyframes shg-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
89
89
 
90
90
  .shg-add-row {
@@ -98,14 +98,14 @@
98
98
  .shg-pill {
99
99
  display: inline-flex; align-items: center; max-width: 100%;
100
100
  padding: 1.5px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
101
- color: #1F2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
101
+ color: var(--uic-ink, #1F2937); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
102
102
  }
103
103
  .shg-pills { display: flex; gap: 4px; overflow: hidden; flex: 1; min-width: 0;
104
104
  flex-wrap: wrap; max-height: 100%; align-content: center; }
105
105
  .shg-check {
106
106
  width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--uic-line, #DDDFE6);
107
107
  display: inline-flex; align-items: center; justify-content: center;
108
- font-size: 12px; font-weight: 700; color: #fff; background: var(--uic-surface, #FFFFFF);
108
+ font-size: 12px; font-weight: 700; color: var(--uic-on-brand, #fff); background: var(--uic-surface, #FFFFFF);
109
109
  }
110
110
  .shg-check.on { background: var(--uic-brand, #285AFF); border-color: var(--uic-brand, #285AFF); }
111
111
  .shg-link { color: var(--uic-brand, #285AFF); text-decoration: none; overflow: hidden;
@@ -117,7 +117,7 @@
117
117
  .shg-select-pop {
118
118
  position: absolute; z-index: 30; margin-top: 2px; min-width: 160px;
119
119
  background: var(--uic-surface, #FFFFFF); border: 1px solid var(--uic-line, #DDDFE6);
120
- border-radius: 10px; box-shadow: 0 12px 28px -8px rgba(15,23,42,.18);
120
+ border-radius: 10px; box-shadow: var(--uic-shadow-2, 0 12px 28px -8px rgba(15,23,42,.18));
121
121
  padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
122
122
  }
123
123
  .shg-pill-btn { border: none; cursor: pointer; font-family: inherit; }
@@ -139,7 +139,7 @@
139
139
  .shg-menu {
140
140
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: 250px;
141
141
  background: var(--uic-surface, #FFFFFF); border: 1px solid var(--uic-line, #DDDFE6);
142
- border-radius: 12px; box-shadow: 0 16px 40px -10px rgba(15,23,42,.22);
142
+ border-radius: 12px; box-shadow: var(--uic-shadow-2, 0 16px 40px -10px rgba(15,23,42,.22));
143
143
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
144
144
  font-weight: 400; text-align: left; cursor: default;
145
145
  }
@@ -157,12 +157,12 @@
157
157
  font-weight: 400; color: var(--uic-ink-2, #3A3D45); cursor: pointer; }
158
158
  .shg-menu-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; }
159
159
  .shg-menu-del {
160
- border: none; background: transparent; color: #B91C1C; font-size: 12px; font-weight: 600;
160
+ border: none; background: transparent; color: var(--uic-fail-ink, #B91C1C); font-size: 12px; font-weight: 600;
161
161
  cursor: pointer; padding: 5px 8px; border-radius: 7px; font-family: inherit;
162
162
  }
163
163
  .shg-menu-del:hover { background: var(--uic-fail-bg, #FEF2F2); }
164
164
  .shg-menu-apply {
165
- border: none; background: var(--uic-brand, #285AFF); color: #fff; font-size: 12.5px;
165
+ border: none; background: var(--uic-brand, #285AFF); color: var(--uic-on-brand, #fff); font-size: 12.5px;
166
166
  font-weight: 600; cursor: pointer; padding: 6px 16px; border-radius: 8px; font-family: inherit;
167
167
  }
168
168
  .shg-menu-apply:hover { filter: brightness(1.06); }
@@ -236,7 +236,7 @@
236
236
  .shg-tab-del { border: none; background: transparent; color: var(--uic-mute-2, #8E9199);
237
237
  cursor: pointer; font-size: 13px; padding: 0 2px; opacity: 0; }
238
238
  .shg-tab:hover .shg-tab-del { opacity: 1; }
239
- .shg-tab-del:hover { color: #B91C1C; }
239
+ .shg-tab-del:hover { color: var(--uic-fail-ink, #B91C1C); }
240
240
 
241
241
  /* ── Drag-to-reorder (columns via header, rows via number cell) ─────────── */
242
242
  .shg-rownum { cursor: grab; }
@@ -252,6 +252,8 @@
252
252
  .shg-cell-peer { position: relative; }
253
253
  .shg-peer-flag {
254
254
  position: absolute; top: -1px; left: -1px; z-index: 4;
255
+ /* Not --uic-on-brand: the background here is the PEER's colour, an arbitrary saturated value
256
+ from the host's palette rather than the theme's brand, and white reads on all of them. */
255
257
  font-size: 9.5px; font-weight: 700; color: #fff; line-height: 1;
256
258
  padding: 2px 6px; border-radius: 0 0 6px 0; max-width: 140px;
257
259
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
@@ -26,4 +26,24 @@
26
26
  --uic-turn-pad-x: 28px;
27
27
  --uic-bubble-max-w: 80%;
28
28
  --uic-working-ink: var(--uic-mute);
29
+
30
+ /* ── page surfaces beyond the conversation (library.css, preview.css) ── */
31
+ --uic-bg: #16171B;
32
+ --uic-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
33
+ --uic-shadow-2: 0 10px 30px -12px rgba(0, 0, 0, .60), 0 2px 8px -2px rgba(0, 0, 0, .50);
34
+ --uic-shadow-3: -16px 0 40px rgba(0, 0, 0, .55);
35
+ /* Same formula as light: the glow is the brand, whatever the brand is. */
36
+ --uic-focus-ring: color-mix(in srgb, var(--uic-brand) 22%, transparent);
37
+ --uic-line-strong: #454852;
38
+ --uic-hover-wash: rgba(255, 255, 255, .07);
39
+ /* Text on a brand fill: on a dark theme the brand is light, so the readable ink is dark. */
40
+ --uic-on-brand: #0E0F13;
41
+ --uic-warn: #FBBF24;
42
+ --uic-warn-bg: rgba(251, 191, 36, .12);
43
+ --uic-status-pulse: color-mix(in srgb, var(--uic-brand) 45%, transparent);
44
+ --uic-r-card: 12px;
45
+ --uic-r-input: 8px;
46
+ --uic-r-pill: 999px;
47
+ --uic-z-overlay: 9000;
48
+ --uic-scrim: rgba(0, 0, 0, .58);
29
49
  }
@@ -26,4 +26,27 @@
26
26
  --uic-turn-pad-x: 28px;
27
27
  --uic-bubble-max-w: 80%;
28
28
  --uic-working-ink: var(--uic-mute);
29
+
30
+ /* ── page surfaces beyond the conversation (library.css, preview.css) ── */
31
+ --uic-bg: #F7F8FB;
32
+ --uic-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
33
+ --uic-shadow-2: 0 8px 24px -12px rgba(17, 24, 39, .12), 0 2px 6px -2px rgba(17, 24, 39, .06);
34
+ --uic-shadow-3: -16px 0 40px rgba(15, 23, 42, .22);
35
+ /* One focus glow, derived from the brand. Hand-written rgba() glows are how an emerald product
36
+ ends up ringing another product's teal on every focused input. */
37
+ --uic-focus-ring: color-mix(in srgb, var(--uic-brand) 14%, transparent);
38
+ --uic-line-strong: #CBD0DA;
39
+ --uic-hover-wash: rgba(0, 0, 0, .05);
40
+ --uic-on-brand: #FFFFFF;
41
+ --uic-warn: #F59E0B;
42
+ --uic-warn-bg: #FEF1D6;
43
+ /* The "a turn is running" ring. Also brand-derived, for the same reason. */
44
+ --uic-status-pulse: color-mix(in srgb, var(--uic-brand) 45%, transparent);
45
+ --uic-r-card: 12px;
46
+ --uic-r-input: 8px;
47
+ --uic-r-pill: 999px;
48
+ /* Everything that floats over the page — dialogs, modals, popovers — sits on ONE layer, so
49
+ their order is the order they opened in rather than a race between two stylesheets. */
50
+ --uic-z-overlay: 9000;
51
+ --uic-scrim: rgba(17, 24, 39, .42);
29
52
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/stream/responses.js"],"sourcesContent":["// OpenAI Responses SSE event parsing — extracted from HarnessRouter's chat client\n// (harnessrouter/src/lib/chat.ts streamResponse). Transport-agnostic: the caller does the\n// fetch/POST however it likes (BFF, broker, direct) and hands the response body (a\n// ReadableStream) plus a handlers object here.\n//\n// Two layers:\n// readSSEStream(body, onData) — raw SSE framing (blank-line separated, data: lines)\n// createResponsesDispatcher(handlers) — native Responses event -> handler dispatch\n// pumpResponsesStream(body, handlers) — both together; resolves to the response id\n//\n// Handlers (all optional):\n// onCreated(responseId) response.created\n// onSession(sessionId) response.created metadata.session_id (continuation)\n// onReasoningDelta(text) response.reasoning_summary_text.delta\n// onToolCall(name, args, callId) response.function_call_arguments.done (name + call_id\n// captured from the matching output_item.added, keyed by\n// output_index — the same pairing HR ships)\n// onToolResult(callId, output) function_call_output items\n// onTextDelta(text) response.output_text.delta\n// onFile({container_id,file_id,filename}) container_file_citation annotations\n// onDone(status, response) response.completed / .incomplete / .failed (a failed\n// response's own status distinguishes user cancels)\n// onError(message) error events\n\nexport function createResponsesDispatcher(h) {\n // function_call name + call_id live on output_item.added; arguments finalize on .done — key by\n // output_index. function_call_output (the tool result) carries the same call_id → pair them.\n const fnByIdx = {};\n const self = {\n responseId: null,\n dispatch(ev) {\n const t = ev.type;\n switch (t) {\n case 'response.created': {\n const resp = ev.response || {};\n self.responseId = resp.id || self.responseId;\n if (self.responseId) h.onCreated?.(self.responseId);\n const sid = (resp.metadata && resp.metadata.session_id) || '';\n if (sid) h.onSession?.(sid);\n break;\n }\n case 'response.reasoning_summary_text.delta':\n h.onReasoningDelta?.(ev.delta || '');\n break;\n case 'response.output_item.added': {\n const item = ev.item || {};\n if (item.type === 'function_call') {\n fnByIdx[ev.output_index] = { name: item.name || 'tool', callId: item.call_id || '' };\n } else if (item.type === 'function_call_output') {\n h.onToolResult?.(item.call_id || '', String(item.output ?? ''));\n }\n break;\n }\n case 'response.function_call_arguments.done': {\n const fn = fnByIdx[ev.output_index] || { name: 'tool', callId: '' };\n h.onToolCall?.(fn.name, ev.arguments || '', fn.callId);\n break;\n }\n case 'response.output_text.delta':\n h.onTextDelta?.(ev.delta || '');\n break;\n case 'response.output_text.annotation.added': {\n const a = ev.annotation || {};\n if (a.type === 'container_file_citation') {\n h.onFile?.({ container_id: a.container_id, file_id: a.file_id, filename: a.filename });\n }\n break;\n }\n case 'response.completed':\n h.onDone?.('completed', ev.response);\n break;\n case 'response.incomplete':\n h.onDone?.('incomplete', ev.response);\n break;\n case 'response.failed':\n // the response object's own status distinguishes a user cancel ('cancelled')\n // from a real failure — surface it so the UI can badge them differently\n h.onDone?.((ev.response && ev.response.status) || 'failed', ev.response);\n break;\n case 'error':\n h.onError?.(ev.message || 'stream error');\n break;\n default:\n break;\n }\n },\n };\n return self;\n}\n\n/** Read an SSE body stream, calling onData(dataString) per frame (data: lines joined). */\nexport async function readSSEStream(body, onData) {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buf = '';\n for (;;) {\n const { value, done } = await reader.read();\n if (done) break;\n buf += decoder.decode(value, { stream: true });\n let nl;\n // SSE frames are separated by a blank line; each frame has one or more `data:` lines.\n while ((nl = buf.indexOf('\\n\\n')) !== -1) {\n const frame = buf.slice(0, nl);\n buf = buf.slice(nl + 2);\n const data = frame.split('\\n').filter((l) => l.startsWith('data:')).map((l) => l.slice(5).trim()).join('');\n if (!data) continue;\n onData(data);\n }\n }\n}\n\n/**\n * Convenience: parse a Responses SSE body end-to-end, dispatching to handlers.\n * Resolves to the response id (for previous_response_id chaining), or null.\n */\nexport async function pumpResponsesStream(body, handlers) {\n const d = createResponsesDispatcher(handlers);\n await readSSEStream(body, (data) => {\n try { d.dispatch(JSON.parse(data)); } catch { /* ignore malformed frame */ }\n });\n return d.responseId;\n}\n"],"mappings":"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","names":[]}