@tinyweb_dev/agent-framework-chat-ui 0.2.0 → 0.3.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 (101) hide show
  1. package/dist/components/Composer.d.ts +38 -0
  2. package/dist/components/Composer.d.ts.map +1 -0
  3. package/dist/components/Header.d.ts +7 -0
  4. package/dist/components/Header.d.ts.map +1 -0
  5. package/dist/components/Hero.d.ts +6 -0
  6. package/dist/components/Hero.d.ts.map +1 -0
  7. package/dist/components/RealtimeCallOverlay.d.ts +68 -0
  8. package/dist/components/RealtimeCallOverlay.d.ts.map +1 -0
  9. package/dist/components/RealtimeOrb.d.ts +21 -0
  10. package/dist/components/RealtimeOrb.d.ts.map +1 -0
  11. package/{src/components/Sidebar.tsx → dist/components/Sidebar.d.ts} +5 -9
  12. package/dist/components/Sidebar.d.ts.map +1 -0
  13. package/dist/components/TinywebChat.d.ts +3 -0
  14. package/dist/components/TinywebChat.d.ts.map +1 -0
  15. package/dist/components/Transcript.d.ts +20 -0
  16. package/dist/components/Transcript.d.ts.map +1 -0
  17. package/dist/components/WireOrbEffect.d.ts +17 -0
  18. package/dist/components/WireOrbEffect.d.ts.map +1 -0
  19. package/dist/components/condense/CondensePill.d.ts +11 -0
  20. package/dist/components/condense/CondensePill.d.ts.map +1 -0
  21. package/dist/components/messages/AssistantMessage.d.ts +10 -0
  22. package/dist/components/messages/AssistantMessage.d.ts.map +1 -0
  23. package/dist/components/messages/ErrorMessage.d.ts +7 -0
  24. package/dist/components/messages/ErrorMessage.d.ts.map +1 -0
  25. package/dist/components/messages/ToolMessage.d.ts +17 -0
  26. package/dist/components/messages/ToolMessage.d.ts.map +1 -0
  27. package/dist/components/messages/UserMessage.d.ts +7 -0
  28. package/dist/components/messages/UserMessage.d.ts.map +1 -0
  29. package/dist/components/tool/ExecRenderer.d.ts +14 -0
  30. package/dist/components/tool/ExecRenderer.d.ts.map +1 -0
  31. package/dist/components/tool/ImageRenderer.d.ts +16 -0
  32. package/dist/components/tool/ImageRenderer.d.ts.map +1 -0
  33. package/dist/components/tool/JsonRenderer.d.ts +11 -0
  34. package/dist/components/tool/JsonRenderer.d.ts.map +1 -0
  35. package/dist/components/tool/ToolCard.d.ts +29 -0
  36. package/dist/components/tool/ToolCard.d.ts.map +1 -0
  37. package/dist/components/tool/builtinRenderers.d.ts +9 -0
  38. package/dist/components/tool/builtinRenderers.d.ts.map +1 -0
  39. package/dist/hooks/useAgentChat.d.ts +46 -0
  40. package/dist/hooks/useAgentChat.d.ts.map +1 -0
  41. package/dist/hooks/useAnchorLatestUser.d.ts +15 -0
  42. package/dist/hooks/useAnchorLatestUser.d.ts.map +1 -0
  43. package/dist/hooks/useInitialScrollToEnd.d.ts +15 -0
  44. package/dist/hooks/useInitialScrollToEnd.d.ts.map +1 -0
  45. package/dist/hooks/useNdjsonStream.d.ts +11 -0
  46. package/dist/hooks/useNdjsonStream.d.ts.map +1 -0
  47. package/dist/hooks/useRealtimeCall.d.ts +112 -0
  48. package/dist/hooks/useRealtimeCall.d.ts.map +1 -0
  49. package/dist/index.cjs +3160 -0
  50. package/dist/index.cjs.map +1 -0
  51. package/dist/index.d.ts +20 -0
  52. package/dist/index.d.ts.map +1 -0
  53. package/dist/index.js +3126 -0
  54. package/dist/index.js.map +1 -0
  55. package/dist/markdown/render.d.ts +2 -0
  56. package/dist/markdown/render.d.ts.map +1 -0
  57. package/dist/types.d.ts +257 -0
  58. package/dist/types.d.ts.map +1 -0
  59. package/dist/util/attachments.d.ts +28 -0
  60. package/dist/util/attachments.d.ts.map +1 -0
  61. package/dist/util/escape.d.ts +2 -0
  62. package/dist/util/escape.d.ts.map +1 -0
  63. package/dist/util/theme.d.ts +13 -0
  64. package/dist/util/theme.d.ts.map +1 -0
  65. package/dist/util/tool-detect.d.ts +26 -0
  66. package/dist/util/tool-detect.d.ts.map +1 -0
  67. package/dist/util/tool-labels.d.ts +11 -0
  68. package/dist/util/tool-labels.d.ts.map +1 -0
  69. package/package.json +14 -14
  70. package/src/components/Composer.tsx +0 -267
  71. package/src/components/Header.tsx +0 -16
  72. package/src/components/Hero.tsx +0 -16
  73. package/src/components/RealtimeCallOverlay.tsx +0 -894
  74. package/src/components/RealtimeOrb.tsx +0 -388
  75. package/src/components/TinywebChat.tsx +0 -95
  76. package/src/components/Transcript.tsx +0 -146
  77. package/src/components/WireOrbEffect.tsx +0 -556
  78. package/src/components/condense/CondensePill.tsx +0 -77
  79. package/src/components/messages/AssistantMessage.tsx +0 -15
  80. package/src/components/messages/ErrorMessage.tsx +0 -12
  81. package/src/components/messages/ToolMessage.tsx +0 -49
  82. package/src/components/messages/UserMessage.tsx +0 -37
  83. package/src/components/tool/ExecRenderer.tsx +0 -71
  84. package/src/components/tool/ImageRenderer.tsx +0 -47
  85. package/src/components/tool/JsonRenderer.tsx +0 -24
  86. package/src/components/tool/ToolCard.tsx +0 -65
  87. package/src/components/tool/builtinRenderers.tsx +0 -456
  88. package/src/hooks/useAgentChat.ts +0 -454
  89. package/src/hooks/useAnchorLatestUser.ts +0 -99
  90. package/src/hooks/useInitialScrollToEnd.ts +0 -41
  91. package/src/hooks/useNdjsonStream.ts +0 -71
  92. package/src/hooks/useRealtimeCall.ts +0 -452
  93. package/src/index.ts +0 -45
  94. package/src/markdown/render.ts +0 -121
  95. package/src/types.ts +0 -241
  96. package/src/util/attachments.ts +0 -87
  97. package/src/util/escape.ts +0 -16
  98. package/src/util/theme.ts +0 -40
  99. package/src/util/tool-detect.ts +0 -65
  100. package/src/util/tool-labels.ts +0 -34
  101. /package/{src → dist}/styles.css +0 -0
@@ -0,0 +1,2 @@
1
+ export declare const renderMarkdown: (src: string | null | undefined) => string;
2
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/markdown/render.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,MAwG/D,CAAA"}
@@ -0,0 +1,257 @@
1
+ import type { ReactNode } from "react";
2
+ import type { AgentEvent, FinishEvent } from "@tinyweb_dev/agent-framework-protocol";
3
+ export type ChatTheme = {
4
+ bg: string;
5
+ panel: string;
6
+ border: string;
7
+ text: string;
8
+ muted: string;
9
+ accent: string;
10
+ accent2: string;
11
+ warn: string;
12
+ err: string;
13
+ /**
14
+ * Optional theme tokens for the realtime / voice call panel
15
+ * (`RealtimeCallOverlay` + `RealtimeOrb`). Each key maps 1:1 to a
16
+ * `--rt-*` CSS custom property. Undefined keys keep the defaults.
17
+ *
18
+ * See [plan 0019](../../plans/0019-voice-call-ui-animations.md) §3.1.
19
+ */
20
+ realtime?: {
21
+ /** Top of the dark navy gradient (`--rt-bg-from`). */
22
+ bgFrom?: string;
23
+ /** Bottom of the dark navy gradient (`--rt-bg-to`). */
24
+ bgTo?: string;
25
+ /** Innermost halo ring color (`--rt-halo-1`). */
26
+ halo1?: string;
27
+ /** Middle halo ring color (`--rt-halo-2`). */
28
+ halo2?: string;
29
+ /** Outer halo ring color (`--rt-halo-3`). */
30
+ halo3?: string;
31
+ /** Inner black "void" disc color (`--rt-core`). */
32
+ core?: string;
33
+ /** Text accent + ripple stroke color (`--rt-accent`). */
34
+ accent?: string;
35
+ /** Mic FAB background (`--rt-mic-bg`). */
36
+ micBg?: string;
37
+ /** Mic icon foreground (`--rt-mic-fg`). */
38
+ micFg?: string;
39
+ };
40
+ };
41
+ export type ToolRendererContext = {
42
+ toolName: string;
43
+ result: unknown;
44
+ /** Raw `tool-result` event for renderers that need the full payload. */
45
+ raw: unknown;
46
+ };
47
+ export type ToolRenderer = {
48
+ /** Returns true if this renderer should render the given tool. */
49
+ match: (toolName: string, result: unknown) => boolean;
50
+ /** React node — return null to fall back to subsequent renderers / default. */
51
+ render: (ctx: ToolRendererContext) => ReactNode | null;
52
+ };
53
+ /**
54
+ * Image attachment shape mirrored from `@tinyweb_dev/agent-framework-agent`'s
55
+ * `AttachmentInput`. The UI carries an extra optional `previewUrl`
56
+ * (object URL) that is stripped before POSTing to the server.
57
+ */
58
+ export type ImageAttachment = {
59
+ readonly type: "image";
60
+ readonly mediaType: string;
61
+ /** Raw base64 body (no `data:` prefix). Either `data` OR `url` must be set. */
62
+ readonly data?: string;
63
+ readonly url?: string;
64
+ readonly filename?: string;
65
+ /** Object URL used only by the Composer thumbnail strip — never POSTed. */
66
+ readonly previewUrl?: string;
67
+ };
68
+ /**
69
+ * Optional client-side validation knobs. Defaults mirror the server
70
+ * (4 files / 8MB per file / 16MB total / png|jpeg|webp|gif).
71
+ */
72
+ export type AttachmentLimits = {
73
+ readonly maxCount?: number;
74
+ readonly maxBytesPerFile?: number;
75
+ readonly maxBytesTotal?: number;
76
+ readonly imageMimes?: ReadonlyArray<string>;
77
+ };
78
+ export type ChatMessage = {
79
+ role: "user";
80
+ content: string;
81
+ images?: ReadonlyArray<ImageAttachment>;
82
+ } | {
83
+ role: "assistant";
84
+ content: string;
85
+ };
86
+ /**
87
+ * Realtime / voice call config. When present, the Composer renders a
88
+ * Call button that opens [`<RealtimeCallOverlay />`](../components/RealtimeCallOverlay.tsx:1).
89
+ *
90
+ * The values are forwarded verbatim to the
91
+ * [`useRealtimeCall`](../hooks/useRealtimeCall.ts:1) hook. Plan 0014 §9.
92
+ */
93
+ export type RealtimeProp = {
94
+ /**
95
+ * Host route that mints ephemeral Gemini tokens. The host MUST gate
96
+ * this endpoint with the same auth as the chat endpoint.
97
+ */
98
+ readonly tokenEndpoint: string;
99
+ /** Extra headers forwarded to the token endpoint (Bearer, cookie). */
100
+ readonly tokenHeaders?: HeadersInit;
101
+ /**
102
+ * Extra body merged into the token POST. Function form runs once per
103
+ * call open so consumers can refresh ids (sessionId, agentId, …).
104
+ */
105
+ readonly tokenBody?: Record<string, unknown> | (() => Record<string, unknown>);
106
+ /**
107
+ * Map of client-side tool handlers keyed by tool name. Each handler
108
+ * receives the JSON args Gemini supplies and resolves to a JSON-safe
109
+ * result. Handlers run in the browser — DO NOT put server secrets in
110
+ * them. Use this only for genuinely client-safe tools (e.g. pure JS
111
+ * `time_now`). For everything else use `toolProxyPath`. See plan
112
+ * 0014 §6.2.
113
+ */
114
+ readonly toolHandlers?: Record<string, (args: Record<string, unknown>) => Promise<unknown>>;
115
+ /**
116
+ * Optional base path for a server tool proxy (e.g. `/api/tools`). When
117
+ * set, any `tool-call` whose name is NOT in `toolHandlers` falls back
118
+ * to `POST {toolProxyPath}/{name}` with the call args as JSON. The
119
+ * server is expected to execute the framework tool and return the
120
+ * JSON result. Use
121
+ * [`serverExecuteTool`](../../../realtime/src/tools/server.ts:1) on
122
+ * the server side. This is the recommended path for tools that need
123
+ * API keys or CORS-restricted network access.
124
+ */
125
+ readonly toolProxyPath?: string;
126
+ /** Optional headers (auth cookie / Bearer) forwarded to the proxy. */
127
+ readonly toolProxyHeaders?: HeadersInit;
128
+ /** Auto-hangup after N idle ms. Default 10 minutes. */
129
+ readonly idleTimeoutMs?: number;
130
+ /** Optional human title shown on the overlay header. */
131
+ readonly title?: string;
132
+ /**
133
+ * Fired when the user's voice turn finishes transcribing (Gemini emits
134
+ * `inputTranscription.finished`). The host can persist the line to its
135
+ * own message store so a page reload reconstructs the voice history.
136
+ * Skipped when the transcript is empty / whitespace.
137
+ *
138
+ * Async errors are swallowed by the overlay — host should handle its
139
+ * own retry/backoff.
140
+ */
141
+ readonly onUserTurn?: (text: string) => void | Promise<void>;
142
+ /**
143
+ * Fired when the agent's voice turn finishes (`turnComplete` or
144
+ * `agent-transcript-final`). The accumulated transcript for that turn
145
+ * is passed verbatim — no leading/trailing whitespace trim. Empty
146
+ * turns (audio-only with no transcription) are skipped.
147
+ *
148
+ * Async errors are swallowed by the overlay — host should handle its
149
+ * own retry/backoff.
150
+ */
151
+ readonly onAssistantTurn?: (text: string) => void | Promise<void>;
152
+ };
153
+ export type TinywebChatProps = {
154
+ /**
155
+ * POST endpoint returning NDJSON stream of AgentEvent.
156
+ * Body shape: `{ prompt: string, ...extraBody }`.
157
+ */
158
+ endpoint: string;
159
+ /**
160
+ * Extra fields merged into the POST body. Function form is invoked once
161
+ * per turn so consumers can re-evaluate session/owner ids on every send.
162
+ */
163
+ extraBody?: Record<string, unknown> | (() => Record<string, unknown>);
164
+ /** Extra headers (Authorization, X-Owner-Id, ...). Function form is fresh each turn. */
165
+ headers?: HeadersInit | (() => HeadersInit);
166
+ /** Header title. Default: "Tinyweb Agent". */
167
+ title?: string;
168
+ /** Hero empty-state. Pass `null` to hide entirely. */
169
+ hero?: {
170
+ title?: string;
171
+ subtitle?: string;
172
+ } | null;
173
+ /** Left sidebar slot. Pass undefined to render chat full-width. */
174
+ sidebar?: ReactNode;
175
+ /** Placeholder text on the composer textarea. */
176
+ placeholder?: string;
177
+ /** Override theme CSS custom properties. Merged with default dark theme. */
178
+ theme?: Partial<ChatTheme>;
179
+ /** Custom tool renderers — first match wins; defaults run after. */
180
+ toolRenderers?: ToolRenderer[];
181
+ /** Callback fired for every parsed event — useful for analytics. */
182
+ onEvent?: (event: AgentEvent) => void;
183
+ /** Callback fired when the stream emits a `finish` event. */
184
+ onFinish?: (event: FinishEvent) => void;
185
+ /** Lock composer (e.g. while parent loads session). */
186
+ disabled?: boolean;
187
+ /** Initial chat replay. Tool/condense events are NOT replayed (v0). */
188
+ initialMessages?: ChatMessage[];
189
+ /** Override client-side attachment limits. Server still enforces its own. */
190
+ attachmentLimits?: AttachmentLimits;
191
+ /**
192
+ * Optional realtime call config. When present, Composer shows a
193
+ * Call button. See [`RealtimeProp`](./types.ts:1) and plan 0014.
194
+ */
195
+ realtime?: RealtimeProp;
196
+ };
197
+ /**
198
+ * Internal transcript node — what the renderer walks. Not exported as
199
+ * `ChatMessage` because tool/condense rows aren't part of the public
200
+ * replay contract yet (see [plan 0011 §4.1](../../../manager/plans/0011-chat-ui-package.md)).
201
+ */
202
+ export type TranscriptNode = {
203
+ kind: "user";
204
+ id: string;
205
+ content: string;
206
+ images?: ReadonlyArray<ImageAttachment>;
207
+ } | {
208
+ kind: "assistant";
209
+ id: string;
210
+ content: string;
211
+ } | {
212
+ kind: "tool-call";
213
+ id: string;
214
+ callId: string;
215
+ name: string;
216
+ input: unknown;
217
+ } | {
218
+ kind: "tool-result";
219
+ id: string;
220
+ name: string;
221
+ result: unknown;
222
+ raw: unknown;
223
+ } | {
224
+ kind: "tool-error";
225
+ id: string;
226
+ name: string;
227
+ message: string;
228
+ } | {
229
+ kind: "error";
230
+ id: string;
231
+ message: string;
232
+ } | {
233
+ kind: "condense";
234
+ id: string;
235
+ trigger: string;
236
+ state: CondenseState;
237
+ };
238
+ export type CondenseState = {
239
+ phase: "start";
240
+ trigger: string;
241
+ estimatedTokens?: number;
242
+ budgetTokens?: number;
243
+ } | {
244
+ phase: "success";
245
+ trigger: string;
246
+ summary: string;
247
+ prevTokens?: number;
248
+ newTokens?: number;
249
+ cost?: number;
250
+ modelId?: string;
251
+ } | {
252
+ phase: "error";
253
+ trigger: string;
254
+ message: string;
255
+ retryExhausted?: boolean;
256
+ };
257
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAA;AAEhF,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE;QACT,sDAAsD;QACtD,MAAM,CAAC,EAA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,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GACD;IACE,KAAK,EAAE,SAAS,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GACD;IACE,KAAK,EAAE,OAAO,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA"}
@@ -0,0 +1,28 @@
1
+ import type { AttachmentLimits, ImageAttachment } from "../types";
2
+ export declare const DEFAULT_IMAGE_MIMES: readonly ["image/png", "image/jpeg", "image/webp", "image/gif"];
3
+ export declare const DEFAULT_MAX_BYTES_PER_FILE: number;
4
+ export declare const DEFAULT_MAX_BYTES_TOTAL: number;
5
+ export declare const DEFAULT_MAX_COUNT = 4;
6
+ export type AttachmentError = {
7
+ code: "attachment_too_large";
8
+ message: string;
9
+ } | {
10
+ code: "attachment_unsupported_type";
11
+ message: string;
12
+ } | {
13
+ code: "attachment_too_many";
14
+ message: string;
15
+ } | {
16
+ code: "attachment_invalid";
17
+ message: string;
18
+ };
19
+ export type ConvertResult = {
20
+ ok: true;
21
+ image: ImageAttachment;
22
+ } | {
23
+ ok: false;
24
+ error: AttachmentError;
25
+ };
26
+ export declare const convertFile: (file: File, current: ReadonlyArray<ImageAttachment>, limits?: AttachmentLimits) => Promise<ConvertResult>;
27
+ export declare const revokePreview: (img: ImageAttachment) => void;
28
+ //# sourceMappingURL=attachments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments.d.ts","sourceRoot":"","sources":["../../src/util/attachments.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEjE,eAAO,MAAM,mBAAmB,iEAAkE,CAAA;AAClG,eAAO,MAAM,0BAA0B,QAAkB,CAAA;AACzD,eAAO,MAAM,uBAAuB,QAAmB,CAAA;AACvD,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,6BAA6B,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAA;AAenD,MAAM,MAAM,aAAa,GACrB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GACpC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAA;AAEzC,eAAO,MAAM,WAAW,GACtB,MAAM,IAAI,EACV,SAAS,aAAa,CAAC,eAAe,CAAC,EACvC,SAAS,gBAAgB,KACxB,OAAO,CAAC,aAAa,CA2CvB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,KAAK,eAAe,KAAG,IAEpD,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const escapeHtml: (input: string) => string;
2
+ //# sourceMappingURL=escape.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../src/util/escape.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,UAAU,GAAI,OAAO,MAAM,KAAG,MACqB,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { CSSProperties } from "react";
2
+ import type { ChatTheme } from "../types";
3
+ /**
4
+ * Maps the user-facing `theme` keys to the CSS custom properties consumed
5
+ * by [`styles.css`](../styles.css). Returns a `style` object the caller can
6
+ * spread onto the root `.tinyweb-chat` element so overrides cascade
7
+ * naturally.
8
+ *
9
+ * The optional `theme.realtime` map is bridged to the `--rt-*` tokens
10
+ * used by the voice-call panel (plan 0019).
11
+ */
12
+ export declare const themeToStyle: (theme?: Partial<ChatTheme>) => CSSProperties;
13
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/util/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,OAAO,CAAC,SAAS,CAAC,KAAG,aA2BzD,CAAA"}
@@ -0,0 +1,26 @@
1
+ export type ImagePayload = {
2
+ mime: string;
3
+ base64: string;
4
+ width?: number;
5
+ height?: number;
6
+ };
7
+ export type ExecPayload = {
8
+ exitCode: number;
9
+ stdout: string;
10
+ stderr: string;
11
+ durationMs?: number;
12
+ timedOut?: boolean;
13
+ truncated?: boolean;
14
+ };
15
+ export declare const extractToolImage: (result: unknown) => ImagePayload | undefined;
16
+ export declare const extractExec: (result: unknown) => ExecPayload | undefined;
17
+ /**
18
+ * Replaces long `imageBase64`/`base64` string values inside a pretty-printed
19
+ * JSON dump with a short `<N bytes base64 elided>` marker. Keeps the "View
20
+ * JSON" affordance readable when the underlying payload is an image
21
+ * (otherwise the dump is one giant base64 blob).
22
+ *
23
+ * Ported from [`app.js`](../../../../examples/device-pilot/public/app.js:662).
24
+ */
25
+ export declare const truncateBase64InJson: (text: string) => string;
26
+ //# sourceMappingURL=tool-detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-detect.d.ts","sourceRoot":"","sources":["../../src/util/tool-detect.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,KAAG,YAAY,GAAG,SAUjE,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,QAAQ,OAAO,KAAG,WAAW,GAAG,SAc3D,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAKjD,CAAA"}
@@ -0,0 +1,11 @@
1
+ type Label = {
2
+ icon: string;
3
+ verb: string;
4
+ };
5
+ /**
6
+ * Pick a Vietnamese-friendly icon + verb for a tool name. Falls back to a
7
+ * generic "Đang gọi công cụ <name>" so unknown tools still render politely.
8
+ */
9
+ export declare const friendlyToolLabel: (toolName: string) => Label;
10
+ export {};
11
+ //# sourceMappingURL=tool-labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-labels.d.ts","sourceRoot":"","sources":["../../src/util/tool-labels.ts"],"names":[],"mappings":"AAOA,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAkB3C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,KAAG,KAIpD,CAAA"}
package/package.json CHANGED
@@ -1,35 +1,32 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@tinyweb_dev/agent-framework-chat-ui",
4
- "version": "0.2.0",
4
+ "version": "0.3.0",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "sideEffects": [
8
8
  "**/*.css"
9
9
  ],
10
- "scripts": {
11
- "typecheck": "tsc --noEmit",
12
- "test": "bun test --timeout 30000"
13
- },
14
10
  "files": [
15
- "src",
11
+ "dist",
16
12
  "README.md",
17
13
  "LICENSE"
18
14
  ],
19
15
  "exports": {
20
16
  ".": {
21
- "types": "./src/index.ts",
22
- "default": "./src/index.ts"
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.cjs"
23
20
  },
24
- "./styles.css": "./src/styles.css"
21
+ "./styles.css": "./dist/styles.css"
25
22
  },
26
23
  "peerDependencies": {
27
24
  "react": ">=19.0.0",
28
25
  "react-dom": ">=19.0.0",
29
26
  "three": ">=0.160.0",
30
27
  "@react-three/fiber": ">=8.16.0 || >=9.0.0",
31
- "@tinyweb_dev/agent-framework-protocol": "0.2.0",
32
- "@tinyweb_dev/agent-framework-realtime": "0.2.0"
28
+ "@tinyweb_dev/agent-framework-protocol": "0.3.0",
29
+ "@tinyweb_dev/agent-framework-realtime": "0.3.0"
33
30
  },
34
31
  "peerDependenciesMeta": {
35
32
  "@tinyweb-agent-framework/realtime": {
@@ -55,7 +52,10 @@
55
52
  "react-dom": "19.0.0",
56
53
  "three": "0.184.0",
57
54
  "typescript": "5.8.2",
58
- "@tinyweb_dev/agent-framework-protocol": "0.2.0",
59
- "@tinyweb_dev/agent-framework-realtime": "0.2.0"
60
- }
55
+ "@tinyweb_dev/agent-framework-protocol": "0.3.0",
56
+ "@tinyweb_dev/agent-framework-realtime": "0.3.0"
57
+ },
58
+ "main": "./dist/index.cjs",
59
+ "module": "./dist/index.js",
60
+ "types": "./dist/index.d.ts"
61
61
  }