@hanzo/ui 8.27.3 → 8.27.4

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 (59) hide show
  1. package/dist/backdrop/Backdrop.cjs +420 -0
  2. package/dist/backdrop/Backdrop.d.ts +53 -0
  3. package/dist/backdrop/Backdrop.d.ts.map +1 -0
  4. package/dist/backdrop/Backdrop.js +418 -0
  5. package/dist/backdrop/Backdrop.js.map +1 -0
  6. package/dist/backdrop/index.cjs +50 -0
  7. package/dist/backdrop/index.d.ts +29 -0
  8. package/dist/backdrop/index.d.ts.map +1 -0
  9. package/dist/backdrop/index.js +29 -0
  10. package/dist/backdrop/index.js.map +1 -0
  11. package/dist/backdrop/scene.cjs +439 -0
  12. package/dist/backdrop/scene.d.ts +235 -0
  13. package/dist/backdrop/scene.d.ts.map +1 -0
  14. package/dist/backdrop/scene.js +423 -0
  15. package/dist/backdrop/scene.js.map +1 -0
  16. package/dist/chat/Chat.cjs +23 -1
  17. package/dist/chat/Chat.d.ts +6 -3
  18. package/dist/chat/Chat.d.ts.map +1 -1
  19. package/dist/chat/Chat.js +23 -1
  20. package/dist/chat/Chat.js.map +1 -1
  21. package/dist/chat/Inspector.cjs +51 -0
  22. package/dist/chat/Inspector.d.ts +49 -0
  23. package/dist/chat/Inspector.d.ts.map +1 -0
  24. package/dist/chat/Inspector.js +49 -0
  25. package/dist/chat/Inspector.js.map +1 -0
  26. package/dist/chat/Message.cjs +3 -1
  27. package/dist/chat/Message.d.ts +3 -1
  28. package/dist/chat/Message.d.ts.map +1 -1
  29. package/dist/chat/Message.js +3 -1
  30. package/dist/chat/Message.js.map +1 -1
  31. package/dist/chat/Parts.cjs +159 -0
  32. package/dist/chat/Parts.d.ts +186 -0
  33. package/dist/chat/Parts.d.ts.map +1 -0
  34. package/dist/chat/Parts.js +153 -0
  35. package/dist/chat/Parts.js.map +1 -0
  36. package/dist/chat/Persona.cjs +34 -0
  37. package/dist/chat/Persona.d.ts +37 -0
  38. package/dist/chat/Persona.d.ts.map +1 -0
  39. package/dist/chat/Persona.js +30 -0
  40. package/dist/chat/Persona.js.map +1 -0
  41. package/dist/chat/Preview.cjs +42 -0
  42. package/dist/chat/Preview.d.ts +36 -0
  43. package/dist/chat/Preview.d.ts.map +1 -0
  44. package/dist/chat/Preview.js +40 -0
  45. package/dist/chat/Preview.js.map +1 -0
  46. package/dist/chat/directive.cjs +272 -0
  47. package/dist/chat/directive.d.ts +167 -0
  48. package/dist/chat/directive.d.ts.map +1 -0
  49. package/dist/chat/directive.js +266 -0
  50. package/dist/chat/directive.js.map +1 -0
  51. package/dist/chat/index.cjs +59 -4
  52. package/dist/chat/index.d.ts +31 -3
  53. package/dist/chat/index.d.ts.map +1 -1
  54. package/dist/chat/index.js +31 -3
  55. package/dist/chat/index.js.map +1 -1
  56. package/dist/gallery.html +4 -4
  57. package/dist/styles.css +3 -3
  58. package/dist/theme.css +3 -3
  59. package/package.json +7 -1
@@ -0,0 +1,266 @@
1
+ /** The moods a persona can be asked for — `Emotion`, as a schema enum. */
2
+ const MOODS = [
3
+ 'idle',
4
+ 'listening',
5
+ 'thinking',
6
+ 'speaking',
7
+ 'happy',
8
+ 'sad',
9
+ 'surprised',
10
+ ];
11
+ const KINDS = ['canvas', 'code', 'view'];
12
+ /**
13
+ * The three tools, ready to pass to `messages.stream`.
14
+ *
15
+ * Descriptions say WHEN to call, not just what the tool is: a model reaches for
16
+ * a tool on its trigger condition, and a description that only names the tool
17
+ * is the common way to get a tool that never fires.
18
+ */
19
+ export const TOOLS = [
20
+ {
21
+ name: 'feel',
22
+ description: 'Set the mood of the on-screen persona. Call it when what you are doing changes — before a long piece of work, when you reach an answer, when something goes wrong. The mood holds until you change it, so call it again rather than leaving a stale one.',
23
+ input_schema: {
24
+ type: 'object',
25
+ properties: {
26
+ emotion: { type: 'string', enum: MOODS, description: 'The mood to hold.' },
27
+ },
28
+ required: ['emotion'],
29
+ },
30
+ },
31
+ {
32
+ name: 'show',
33
+ description: 'Render an interface inline for the person to look at. Call it whenever a layout, a screen, a chart or a mockup would answer better than prose. `markup` is a self-contained HTML document including its own <style>; it is displayed with scripting disabled, so write markup and CSS, never script.',
34
+ input_schema: {
35
+ type: 'object',
36
+ properties: {
37
+ title: { type: 'string', description: 'A short name for the thing.' },
38
+ kind: {
39
+ type: 'string',
40
+ enum: KINDS,
41
+ description: 'view for a rendered interface, canvas for a document, code for source.',
42
+ },
43
+ markup: { type: 'string', description: 'A self-contained HTML document.' },
44
+ },
45
+ required: ['title', 'kind', 'markup'],
46
+ },
47
+ },
48
+ {
49
+ name: 'report',
50
+ description: 'Fill the side panel with an account of this run. Call it once you know what the run did: a one-paragraph summary, what you were given, and what you produced. The panel is what the person reads to check your work, so name real values rather than describing them.',
51
+ input_schema: {
52
+ type: 'object',
53
+ properties: {
54
+ summary: { type: 'string', description: 'One paragraph: what happened.' },
55
+ inputs: { type: 'object', description: 'Name to value, what the run was given.' },
56
+ outputs: { type: 'object', description: 'Name to value, what the run produced.' },
57
+ },
58
+ required: ['summary'],
59
+ },
60
+ },
61
+ ];
62
+ /* -------------------------------------------------------------------- reading */
63
+ /** One field off an untrusted object. The wire is a boundary; nothing below
64
+ * trusts a shape it has not checked. */
65
+ const str = (value, key) => {
66
+ const x = value?.[key];
67
+ return typeof x === 'string' ? x : undefined;
68
+ };
69
+ const facts = (value, key) => {
70
+ const x = value?.[key];
71
+ return x != null && typeof x === 'object' && !Array.isArray(x) ? x : undefined;
72
+ };
73
+ const one = (value, key, set) => {
74
+ const x = str(value, key);
75
+ return set.includes(x) ? x : undefined;
76
+ };
77
+ /**
78
+ * A tool call, narrowed to a directive — or `undefined` for anything else.
79
+ *
80
+ * `undefined` is not a failure. Most tool calls in a turn are the caller's own
81
+ * tools, and those belong in the transcript as steps; this answers only "is
82
+ * this one of ours, and is it well-formed". A directive missing a required
83
+ * field is not ours either — a half-read `show` would draw an empty frame.
84
+ */
85
+ export function read(name, id, input) {
86
+ switch (name) {
87
+ case 'feel': {
88
+ const emotion = one(input, 'emotion', MOODS);
89
+ return emotion ? { name, id, emotion } : undefined;
90
+ }
91
+ case 'show': {
92
+ const title = str(input, 'title');
93
+ const markup = str(input, 'markup');
94
+ const kind = one(input, 'kind', KINDS) ?? 'view';
95
+ return title && markup ? { name, id, title, kind, markup } : undefined;
96
+ }
97
+ case 'report': {
98
+ const summary = str(input, 'summary');
99
+ return summary
100
+ ? { name, id, summary, inputs: facts(input, 'inputs'), outputs: facts(input, 'outputs') }
101
+ : undefined;
102
+ }
103
+ default:
104
+ return undefined;
105
+ }
106
+ }
107
+ /** What a directive is answered with. Drawing IS the execution, so the result
108
+ * is a confirmation — but it has to be sent, or the turn never continues. */
109
+ export const answer = (directive) => ({
110
+ type: 'tool_result',
111
+ tool_use_id: directive.id,
112
+ content: SAID[directive.name],
113
+ });
114
+ const SAID = {
115
+ feel: 'The persona is showing it.',
116
+ show: 'Rendered for the person to see.',
117
+ report: 'The panel is showing it.',
118
+ };
119
+ /** A stage with nothing on it. The starting value for a turn. */
120
+ export const EMPTY = { emotion: 'idle', parts: [], ran: [], open: {} };
121
+ /** Adjacent prose, kept as one part. `join` does this at render time too, but
122
+ * a fold that appends per delta would hand it thousands of fragments. */
123
+ const add = (parts, part) => {
124
+ const last = parts[parts.length - 1];
125
+ if ((part.type === 'text' || part.type === 'reasoning') && last?.type === part.type) {
126
+ return [...parts.slice(0, -1), { type: part.type, text: last.text + part.text }];
127
+ }
128
+ return [...parts, part];
129
+ };
130
+ /** The mood the stream implies, unless the model has fixed one. */
131
+ const move = (prev, emotion) => prev.held ?? emotion;
132
+ /** Apply a directive. */
133
+ const apply = (prev, d) => {
134
+ const ran = [...prev.ran, d];
135
+ switch (d.name) {
136
+ case 'feel':
137
+ return { ...prev, ran, held: d.emotion, emotion: d.emotion };
138
+ case 'show':
139
+ return {
140
+ ...prev,
141
+ ran,
142
+ parts: add(prev.parts, {
143
+ type: 'artifact',
144
+ title: d.title,
145
+ kind: d.kind,
146
+ id: d.id,
147
+ markup: d.markup,
148
+ }),
149
+ };
150
+ case 'report':
151
+ return {
152
+ ...prev,
153
+ ran,
154
+ report: { summary: d.summary, inputs: d.inputs, outputs: d.outputs },
155
+ };
156
+ }
157
+ };
158
+ /**
159
+ * The stream, folded into what is on screen.
160
+ *
161
+ * Pure, and total over the wire: an event this does not recognise returns the
162
+ * stage unchanged rather than throwing, because a stream carries `ping` and
163
+ * `message_delta` and whatever it gains next.
164
+ */
165
+ export function stage(prev, frame) {
166
+ switch (frame.type) {
167
+ // A new turn reads fresh. Only the held mood clears — the parts and the
168
+ // report belong to whoever is keeping them.
169
+ case 'message_start':
170
+ return { ...prev, held: undefined, emotion: 'thinking' };
171
+ case 'content_block_start': {
172
+ const kind = str(frame.content_block, 'type');
173
+ if (kind === 'tool_use') {
174
+ const id = str(frame.content_block, 'id') ?? '';
175
+ const name = str(frame.content_block, 'name') ?? '';
176
+ return {
177
+ ...prev,
178
+ emotion: move(prev, 'thinking'),
179
+ open: { ...prev.open, [frame.index ?? 0]: { id, name, json: '' } },
180
+ };
181
+ }
182
+ if (kind === 'thinking')
183
+ return { ...prev, emotion: move(prev, 'thinking') };
184
+ if (kind === 'text')
185
+ return { ...prev, emotion: move(prev, 'speaking') };
186
+ return prev;
187
+ }
188
+ case 'content_block_delta': {
189
+ const kind = str(frame.delta, 'type');
190
+ if (kind === 'text_delta') {
191
+ const text = str(frame.delta, 'text') ?? '';
192
+ return {
193
+ ...prev,
194
+ emotion: move(prev, 'speaking'),
195
+ parts: add(prev.parts, { type: 'text', text }),
196
+ };
197
+ }
198
+ if (kind === 'thinking_delta') {
199
+ const text = str(frame.delta, 'thinking') ?? '';
200
+ return {
201
+ ...prev,
202
+ emotion: move(prev, 'thinking'),
203
+ parts: add(prev.parts, { type: 'reasoning', text }),
204
+ };
205
+ }
206
+ if (kind === 'input_json_delta') {
207
+ const at = frame.index ?? 0;
208
+ const call = prev.open[at];
209
+ if (!call)
210
+ return prev;
211
+ const json = call.json + (str(frame.delta, 'partial_json') ?? '');
212
+ return { ...prev, open: { ...prev.open, [at]: { ...call, json } } };
213
+ }
214
+ return prev;
215
+ }
216
+ case 'content_block_stop': {
217
+ const at = frame.index ?? 0;
218
+ const call = prev.open[at];
219
+ if (!call)
220
+ return prev;
221
+ const { [at]: _closed, ...open } = prev.open;
222
+ const next = { ...prev, open };
223
+ const directive = read(call.name, call.id, parse(call.json));
224
+ if (directive)
225
+ return apply(next, directive);
226
+ // Somebody else's tool. It belongs in the transcript as a step.
227
+ return {
228
+ ...next,
229
+ parts: add(next.parts, {
230
+ type: 'toolCall',
231
+ name: call.name,
232
+ id: call.id,
233
+ args: parse(call.json),
234
+ }),
235
+ };
236
+ }
237
+ // The turn is over. The mood the model chose survives it — a turn that
238
+ // ended happy rests happy; one that said nothing rests idle.
239
+ case 'message_stop':
240
+ return { ...prev, emotion: prev.held ?? 'idle' };
241
+ case 'error':
242
+ return { ...prev, emotion: move(prev, 'sad') };
243
+ default:
244
+ return prev;
245
+ }
246
+ }
247
+ /** A tool's arguments. An empty block sends no deltas at all, and a truncated
248
+ * turn leaves a fragment; neither should take the page down. */
249
+ const parse = (json) => {
250
+ if (!json)
251
+ return undefined;
252
+ try {
253
+ return JSON.parse(json);
254
+ }
255
+ catch {
256
+ return undefined;
257
+ }
258
+ };
259
+ /**
260
+ * What the turn produced, for the panel.
261
+ *
262
+ * Prose is the answer and belongs in the thread; everything else is evidence —
263
+ * what ran, what came back, what was made — and that is what the panel is for.
264
+ */
265
+ export const made = (from) => from.parts.filter((part) => part.type !== 'text' && part.type !== 'reasoning');
266
+ //# sourceMappingURL=directive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directive.js","sourceRoot":"","sources":["../../src/chat/directive.ts"],"names":[],"mappings":"AA0EA,0EAA0E;AAC1E,MAAM,KAAK,GAAc;IACvB,MAAM;IACN,WAAW;IACX,UAAU;IACV,UAAU;IACV,OAAO;IACP,KAAK;IACL,WAAW;CACZ,CAAA;AAED,MAAM,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AAC,IAAI,CAAC,IAAI,CAAC;iBACvB,CAAC;aACH,CAAA;QACH,CAAC;QAED,uEAAuE;QACvE,6DAA6D;QAC7D,KAAK,cAAc;YACjB,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,IAAI,MAAM,EAAE,CAAA;QAElD,KAAK,OAAO;YACV,OAAO,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAA;QAEhD;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAED;iEACiE;AACjE,MAAM,KAAK,GAAG,CAAC,IAAY,EAAW,EAAE;IACtC,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAA;IAC3B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAW,EAAiB,EAAE,CACjD,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,CAAC,CAAA"}
@@ -1,6 +1,20 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SourceCard = exports.Sources = exports.Failure = exports.Step = exports.Code = exports.Aside = exports.AsideToggle = exports.ShareButton = exports.HeaderButton = exports.Header = exports.SidebarUser = exports.SidebarFolder = exports.SidebarItem = exports.SidebarSection = exports.SidebarScroll = exports.SidebarNewChat = exports.SidebarIconButton = exports.SidebarHeader = exports.Sidebar = exports.SLACK = exports.pinned = exports.sends = exports.ready = exports.Thread = exports.Message = exports.Caret = exports.ASK = exports.Composer = exports.words = exports.Chat = void 0;
17
+ exports.clip = exports.Persona = exports.SourceCard = exports.Sources = exports.Inspector = exports.Preview = exports.made = exports.answer = exports.read = exports.stage = exports.EMPTY = exports.TOOLS = exports.Failure = exports.Step = exports.Code = exports.Aside = exports.AsideToggle = exports.ShareButton = exports.HeaderButton = exports.Header = exports.SidebarUser = exports.SidebarFolder = exports.SidebarItem = exports.SidebarSection = exports.SidebarScroll = exports.SidebarNewChat = exports.SidebarIconButton = exports.SidebarHeader = exports.Sidebar = exports.SLACK = exports.pinned = exports.sends = exports.ready = exports.Thread = exports.Message = exports.Caret = exports.ASK = exports.Composer = exports.join = exports.Piece = exports.Parts = exports.words = exports.Chat = void 0;
4
18
  /**
5
19
  * @hanzo/ui/chat — the one chat shell, on @hanzo/gui primitives.
6
20
  *
@@ -10,9 +24,14 @@ exports.SourceCard = exports.Sources = exports.Failure = exports.Step = exports.
10
24
  *
11
25
  * The markdown pipeline is the surface's and arrives as `children`: the three
12
26
  * surfaces run nine plugins, one plugin, and a regex under a bundle ceiling
13
- * that cannot afford a parser. There is no `renderPart` prop for the same
14
- * reason — the part union is per-surface too, so a callback here would take a
15
- * Part type matching nobody's.
27
+ * that cannot afford a parser.
28
+ *
29
+ * THE PART UNION IS NOT PER-SURFACE, and this file used to say it was — which is
30
+ * why it refused a `renderPart` callback and why every surface then wrote the
31
+ * same switch. There is one canonical set (`MessagePart`), it is CLOSED, and
32
+ * `Parts` is the dispatcher over it: no callback to hand in, because each arm
33
+ * already resolves to a piece that ships here. `words`'s `Part` stays open
34
+ * beside it — that one reads the wire, and the wire is not ours to close.
16
35
  *
17
36
  * Everything else about a turn is presentational and lives here: the code
18
37
  * frame, the step disclosure, the failure, the streaming caret.
@@ -35,6 +54,10 @@ var Chat_1 = require("./Chat.cjs");
35
54
  Object.defineProperty(exports, "Chat", { enumerable: true, get: function () { return Chat_1.Chat; } });
36
55
  var words_1 = require("./words.cjs");
37
56
  Object.defineProperty(exports, "words", { enumerable: true, get: function () { return words_1.words; } });
57
+ var Parts_1 = require("./Parts.cjs");
58
+ Object.defineProperty(exports, "Parts", { enumerable: true, get: function () { return Parts_1.Parts; } });
59
+ Object.defineProperty(exports, "Piece", { enumerable: true, get: function () { return Parts_1.Piece; } });
60
+ Object.defineProperty(exports, "join", { enumerable: true, get: function () { return Parts_1.join; } });
38
61
  var Composer_1 = require("./Composer.cjs");
39
62
  Object.defineProperty(exports, "Composer", { enumerable: true, get: function () { return Composer_1.Composer; } });
40
63
  Object.defineProperty(exports, "ASK", { enumerable: true, get: function () { return Composer_1.ASK; } });
@@ -71,6 +94,38 @@ var Step_1 = require("./Step.cjs");
71
94
  Object.defineProperty(exports, "Step", { enumerable: true, get: function () { return Step_1.Step; } });
72
95
  var Failure_1 = require("./Failure.cjs");
73
96
  Object.defineProperty(exports, "Failure", { enumerable: true, get: function () { return Failure_1.Failure; } });
97
+ /**
98
+ * Generative UI — the model drives the interface.
99
+ *
100
+ * `TOOLS` are three ordinary Anthropic tools a caller hands to
101
+ * `messages.stream`; `stage` folds the raw `content_block_*` events into what
102
+ * is on screen, so the persona moves whether or not the model calls anything;
103
+ * `Preview` draws an interface the model wrote, inert; `Inspector` is the side
104
+ * panel that says what the run did. `answer` closes the round trip.
105
+ */
106
+ var directive_1 = require("./directive.cjs");
107
+ Object.defineProperty(exports, "TOOLS", { enumerable: true, get: function () { return directive_1.TOOLS; } });
108
+ Object.defineProperty(exports, "EMPTY", { enumerable: true, get: function () { return directive_1.EMPTY; } });
109
+ Object.defineProperty(exports, "stage", { enumerable: true, get: function () { return directive_1.stage; } });
110
+ Object.defineProperty(exports, "read", { enumerable: true, get: function () { return directive_1.read; } });
111
+ Object.defineProperty(exports, "answer", { enumerable: true, get: function () { return directive_1.answer; } });
112
+ Object.defineProperty(exports, "made", { enumerable: true, get: function () { return directive_1.made; } });
113
+ var Preview_1 = require("./Preview.cjs");
114
+ Object.defineProperty(exports, "Preview", { enumerable: true, get: function () { return Preview_1.Preview; } });
115
+ var Inspector_1 = require("./Inspector.cjs");
116
+ Object.defineProperty(exports, "Inspector", { enumerable: true, get: function () { return Inspector_1.Inspector; } });
74
117
  var Sources_1 = require("./Sources.cjs");
75
118
  Object.defineProperty(exports, "Sources", { enumerable: true, get: function () { return Sources_1.Sources; } });
76
119
  Object.defineProperty(exports, "SourceCard", { enumerable: true, get: function () { return Sources_1.SourceCard; } });
120
+ /**
121
+ * The canvas behind the conversation, and the persona on it.
122
+ *
123
+ * `Backdrop` lives at `@hanzo/ui/backdrop` — it is web-only and nothing about it
124
+ * is chat-specific — and is re-exported here because a chat surface is what
125
+ * mounts one. `Persona` is chat's own: an emotion picks a clip, and the
126
+ * backdrop's crossfade plays it.
127
+ */
128
+ __exportStar(require("../backdrop/index.cjs"), exports);
129
+ var Persona_1 = require("./Persona.cjs");
130
+ Object.defineProperty(exports, "Persona", { enumerable: true, get: function () { return Persona_1.Persona; } });
131
+ Object.defineProperty(exports, "clip", { enumerable: true, get: function () { return Persona_1.clip; } });
@@ -7,9 +7,14 @@
7
7
  *
8
8
  * The markdown pipeline is the surface's and arrives as `children`: the three
9
9
  * surfaces run nine plugins, one plugin, and a regex under a bundle ceiling
10
- * that cannot afford a parser. There is no `renderPart` prop for the same
11
- * reason — the part union is per-surface too, so a callback here would take a
12
- * Part type matching nobody's.
10
+ * that cannot afford a parser.
11
+ *
12
+ * THE PART UNION IS NOT PER-SURFACE, and this file used to say it was — which is
13
+ * why it refused a `renderPart` callback and why every surface then wrote the
14
+ * same switch. There is one canonical set (`MessagePart`), it is CLOSED, and
15
+ * `Parts` is the dispatcher over it: no callback to hand in, because each arm
16
+ * already resolves to a piece that ships here. `words`'s `Part` stays open
17
+ * beside it — that one reads the wire, and the wire is not ours to close.
13
18
  *
14
19
  * Everything else about a turn is presentational and lives here: the code
15
20
  * frame, the step disclosure, the failure, the streaming caret.
@@ -30,6 +35,7 @@
30
35
  */
31
36
  export { Chat, type ChatProps, type Turn } from './Chat.js';
32
37
  export { words, type Part, type Said } from './words.js';
38
+ export { Parts, Piece, join, type MessagePart, type PartActions, type PartsProps, type PieceProps, } from './Parts.js';
33
39
  export { Composer, ASK, type ComposerProps } from './Composer.js';
34
40
  export { Caret, Message, type MessageProps, type Role } from './Message.js';
35
41
  export { Thread, type ThreadProps } from './Thread.js';
@@ -40,5 +46,27 @@ export { Header, HeaderButton, ShareButton, AsideToggle, Aside, type HeaderProps
40
46
  export { Code, type CodeProps } from './Code.js';
41
47
  export { Step, type StepProps, type Ran } from './Step.js';
42
48
  export { Failure, type FailureProps } from './Failure.js';
49
+ /**
50
+ * Generative UI — the model drives the interface.
51
+ *
52
+ * `TOOLS` are three ordinary Anthropic tools a caller hands to
53
+ * `messages.stream`; `stage` folds the raw `content_block_*` events into what
54
+ * is on screen, so the persona moves whether or not the model calls anything;
55
+ * `Preview` draws an interface the model wrote, inert; `Inspector` is the side
56
+ * panel that says what the run did. `answer` closes the round trip.
57
+ */
58
+ export { TOOLS, EMPTY, stage, read, answer, made, type Directive, type Facts, type Frame, type Report, type Stage, type Tool, } from './directive.js';
59
+ export { Preview, type PreviewProps } from './Preview.js';
60
+ export { Inspector, type InspectorProps, type Section } from './Inspector.js';
43
61
  export { Sources, SourceCard, type Source, type SourcesProps, type SourceCardProps, } from './Sources.js';
62
+ /**
63
+ * The canvas behind the conversation, and the persona on it.
64
+ *
65
+ * `Backdrop` lives at `@hanzo/ui/backdrop` — it is web-only and nothing about it
66
+ * is chat-specific — and is re-exported here because a chat surface is what
67
+ * mounts one. `Persona` is chat's own: an emotion picks a clip, and the
68
+ * backdrop's crossfade plays it.
69
+ */
70
+ export * from '../backdrop/index.js';
71
+ export { Persona, clip, type Emotion, type PersonaProps, type Scenes } from './Persona.js';
44
72
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,IAAI,EAAE,MAAM,WAAW,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,SAAS,CAAA;AAEnD,OAAO,EACL,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,G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E,OAAO,EACL,OAAO,EACP,UAAU,EACV,KAAK,MAAM,EACX,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,WAAW,CAAA;AAElB;;;;;;;GAOG;AACH,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAA"}
@@ -7,9 +7,14 @@
7
7
  *
8
8
  * The markdown pipeline is the surface's and arrives as `children`: the three
9
9
  * surfaces run nine plugins, one plugin, and a regex under a bundle ceiling
10
- * that cannot afford a parser. There is no `renderPart` prop for the same
11
- * reason — the part union is per-surface too, so a callback here would take a
12
- * Part type matching nobody's.
10
+ * that cannot afford a parser.
11
+ *
12
+ * THE PART UNION IS NOT PER-SURFACE, and this file used to say it was — which is
13
+ * why it refused a `renderPart` callback and why every surface then wrote the
14
+ * same switch. There is one canonical set (`MessagePart`), it is CLOSED, and
15
+ * `Parts` is the dispatcher over it: no callback to hand in, because each arm
16
+ * already resolves to a piece that ships here. `words`'s `Part` stays open
17
+ * beside it — that one reads the wire, and the wire is not ours to close.
13
18
  *
14
19
  * Everything else about a turn is presentational and lives here: the code
15
20
  * frame, the step disclosure, the failure, the streaming caret.
@@ -30,6 +35,7 @@
30
35
  */
31
36
  export { Chat } from './Chat.js';
32
37
  export { words } from './words.js';
38
+ export { Parts, Piece, join, } from './Parts.js';
33
39
  export { Composer, ASK } from './Composer.js';
34
40
  export { Caret, Message } from './Message.js';
35
41
  export { Thread } from './Thread.js';
@@ -40,5 +46,27 @@ export { Header, HeaderButton, ShareButton, AsideToggle, Aside, } from './Header
40
46
  export { Code } from './Code.js';
41
47
  export { Step } from './Step.js';
42
48
  export { Failure } from './Failure.js';
49
+ /**
50
+ * Generative UI — the model drives the interface.
51
+ *
52
+ * `TOOLS` are three ordinary Anthropic tools a caller hands to
53
+ * `messages.stream`; `stage` folds the raw `content_block_*` events into what
54
+ * is on screen, so the persona moves whether or not the model calls anything;
55
+ * `Preview` draws an interface the model wrote, inert; `Inspector` is the side
56
+ * panel that says what the run did. `answer` closes the round trip.
57
+ */
58
+ export { TOOLS, EMPTY, stage, read, answer, made, } from './directive.js';
59
+ export { Preview } from './Preview.js';
60
+ export { Inspector } from './Inspector.js';
43
61
  export { Sources, SourceCard, } from './Sources.js';
62
+ /**
63
+ * The canvas behind the conversation, and the persona on it.
64
+ *
65
+ * `Backdrop` lives at `@hanzo/ui/backdrop` — it is web-only and nothing about it
66
+ * is chat-specific — and is re-exported here because a chat surface is what
67
+ * mounts one. `Persona` is chat's own: an emotion picks a clip, and the
68
+ * backdrop's crossfade plays it.
69
+ */
70
+ export * from '../backdrop/index.js';
71
+ export { Persona, clip } from './Persona.js';
44
72
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chat/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,IAAI,EAA6B,MAAM,QAAQ,CAAA;AACxD,OAAO,EAAE,KAAK,EAAwB,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAsB,MAAM,YAAY,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAA;AACxE,OAAO,EAAE,MAAM,EAAoB,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAa,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAc,MAAM,SAAS,CAAA;AAEnD,OAAO,EACL,OAAO,EACP,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,cAAc,EACd,WAAW,EACX,aAAa,EACb,WAAW,GASZ,MAAM,WAAW,CAAA;AAElB,OAAO,EACL,MAAM,EACN,YAAY,EACZ,WAAW,EACX,WAAW,EACX,KAAK,G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O,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,GAOL,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,OAAO,EAAqB,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,SAAS,EAAqC,MAAM,aAAa,CAAA;AAE1E,OAAO,EACL,OAAO,EACP,UAAU,GAIX,MAAM,WAAW,CAAA;AAElB;;;;;;;GAOG;AACH,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAgD,MAAM,WAAW,CAAA"}
package/dist/gallery.html CHANGED
@@ -1,4 +1,4 @@
1
- <!doctype html><html lang="en" class="t_dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@hanzo/ui 8.27.3</title><style>/* @hanzo/ui — generated by scripts/gen-css.mjs. Do not edit. */
1
+ <!doctype html><html lang="en" class="t_dark"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>@hanzo/ui 8.27.4</title><style>/* @hanzo/ui — generated by scripts/gen-css.mjs. Do not edit. */
2
2
  :root { --hanzo-ui-styles: 1; }
3
3
  /* Hanzo Design System — the entry point. Import THIS one file.
4
4
  *
@@ -1368,7 +1368,7 @@
1368
1368
  .hz-prose > h1, .hz-prose > h2, .hz-prose > h3,
1369
1369
  .hz-prose > h4, .hz-prose > h5, .hz-prose > h6 {
1370
1370
  font-family: var(--font-display, var(--font-sans)), sans-serif;
1371
- font-weight: 600;
1371
+ font-weight: 606;
1372
1372
  line-height: var(--leading-tight);
1373
1373
  letter-spacing: var(--tracking-tight);
1374
1374
  margin: 0;
@@ -1384,7 +1384,7 @@
1384
1384
  stack. */
1385
1385
  .hz-prose > h6 {
1386
1386
  font-size: var(--text-base);
1387
- font-weight: 400;
1387
+ font-weight: 497;
1388
1388
  color: var(--muted-foreground);
1389
1389
  }
1390
1390
 
@@ -1432,7 +1432,7 @@
1432
1432
  font-size: 0.9em;
1433
1433
  }
1434
1434
  .hz-prose a { color: inherit; text-decoration: underline }
1435
- .hz-prose strong { font-weight: 600 }
1435
+ .hz-prose strong { font-weight: 606 }
1436
1436
  .hz-prose :where(img, video) { max-width: 100%; height: auto }
1437
1437
 
1438
1438
  /* The named rungs. `responsive` is the default and is the only one that moves
package/dist/styles.css CHANGED
@@ -1368,7 +1368,7 @@
1368
1368
  .hz-prose > h1, .hz-prose > h2, .hz-prose > h3,
1369
1369
  .hz-prose > h4, .hz-prose > h5, .hz-prose > h6 {
1370
1370
  font-family: var(--font-display, var(--font-sans)), sans-serif;
1371
- font-weight: 600;
1371
+ font-weight: 606;
1372
1372
  line-height: var(--leading-tight);
1373
1373
  letter-spacing: var(--tracking-tight);
1374
1374
  margin: 0;
@@ -1384,7 +1384,7 @@
1384
1384
  stack. */
1385
1385
  .hz-prose > h6 {
1386
1386
  font-size: var(--text-base);
1387
- font-weight: 400;
1387
+ font-weight: 497;
1388
1388
  color: var(--muted-foreground);
1389
1389
  }
1390
1390
 
@@ -1432,7 +1432,7 @@
1432
1432
  font-size: 0.9em;
1433
1433
  }
1434
1434
  .hz-prose a { color: inherit; text-decoration: underline }
1435
- .hz-prose strong { font-weight: 600 }
1435
+ .hz-prose strong { font-weight: 606 }
1436
1436
  .hz-prose :where(img, video) { max-width: 100%; height: auto }
1437
1437
 
1438
1438
  /* The named rungs. `responsive` is the default and is the only one that moves
package/dist/theme.css CHANGED
@@ -1366,7 +1366,7 @@
1366
1366
  .hz-prose > h1, .hz-prose > h2, .hz-prose > h3,
1367
1367
  .hz-prose > h4, .hz-prose > h5, .hz-prose > h6 {
1368
1368
  font-family: var(--font-display, var(--font-sans)), sans-serif;
1369
- font-weight: 600;
1369
+ font-weight: 606;
1370
1370
  line-height: var(--leading-tight);
1371
1371
  letter-spacing: var(--tracking-tight);
1372
1372
  margin: 0;
@@ -1382,7 +1382,7 @@
1382
1382
  stack. */
1383
1383
  .hz-prose > h6 {
1384
1384
  font-size: var(--text-base);
1385
- font-weight: 400;
1385
+ font-weight: 497;
1386
1386
  color: var(--muted-foreground);
1387
1387
  }
1388
1388
 
@@ -1430,7 +1430,7 @@
1430
1430
  font-size: 0.9em;
1431
1431
  }
1432
1432
  .hz-prose a { color: inherit; text-decoration: underline }
1433
- .hz-prose strong { font-weight: 600 }
1433
+ .hz-prose strong { font-weight: 606 }
1434
1434
  .hz-prose :where(img, video) { max-width: 100%; height: auto }
1435
1435
 
1436
1436
  /* The named rungs. `responsive` is the default and is the only one that moves
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hanzo/ui",
3
- "version": "8.27.3",
3
+ "version": "8.27.4",
4
4
  "type": "module",
5
5
  "description": "Hanzo UI — the one canonical Hanzo component library, on @hanzo/gui + @hanzo/design. ONE substrate: every component renders through @hanzo/gui primitives, so the same import works on web, native (expo) and desktop (Tauri). Self-contained (theme.css), presentational, host-agnostic, clean-room.",
6
6
  "exports": {
@@ -39,6 +39,12 @@
39
39
  "require": "./dist/chat/index.cjs",
40
40
  "default": "./dist/chat/index.js"
41
41
  },
42
+ "./backdrop": {
43
+ "types": "./dist/backdrop/index.d.ts",
44
+ "import": "./dist/backdrop/index.js",
45
+ "require": "./dist/backdrop/index.cjs",
46
+ "default": "./dist/backdrop/index.js"
47
+ },
42
48
  "./chat/pure": {
43
49
  "types": "./dist/chat/pure.d.ts",
44
50
  "import": "./dist/chat/pure.js",