@guuey/chat 0.4.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 (66) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -0
  3. package/dist/history-inputs.d.ts +24 -0
  4. package/dist/history-inputs.d.ts.map +1 -0
  5. package/dist/history-inputs.js +34 -0
  6. package/dist/index.d.ts +19 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +17 -0
  9. package/dist/plan.d.ts +5 -0
  10. package/dist/plan.d.ts.map +1 -0
  11. package/dist/plan.js +629 -0
  12. package/dist/policy.d.ts +110 -0
  13. package/dist/policy.d.ts.map +1 -0
  14. package/dist/policy.js +75 -0
  15. package/dist/react/components.d.ts +87 -0
  16. package/dist/react/components.d.ts.map +1 -0
  17. package/dist/react/components.js +270 -0
  18. package/dist/react/guuey-chat.d.ts +84 -0
  19. package/dist/react/guuey-chat.d.ts.map +1 -0
  20. package/dist/react/guuey-chat.js +103 -0
  21. package/dist/react/markdown.d.ts +32 -0
  22. package/dist/react/markdown.d.ts.map +1 -0
  23. package/dist/react/markdown.js +40 -0
  24. package/dist/react/theme-css.d.ts +16 -0
  25. package/dist/react/theme-css.d.ts.map +1 -0
  26. package/dist/react/theme-css.js +37 -0
  27. package/dist/react/transcript.d.ts +42 -0
  28. package/dist/react/transcript.d.ts.map +1 -0
  29. package/dist/react/transcript.js +88 -0
  30. package/dist/react/use-transcript.d.ts +39 -0
  31. package/dist/react/use-transcript.d.ts.map +1 -0
  32. package/dist/react/use-transcript.js +201 -0
  33. package/dist/react.d.ts +21 -0
  34. package/dist/react.d.ts.map +1 -0
  35. package/dist/react.js +20 -0
  36. package/dist/strings.d.ts +74 -0
  37. package/dist/strings.d.ts.map +1 -0
  38. package/dist/strings.js +45 -0
  39. package/dist/theme.d.ts +99 -0
  40. package/dist/theme.d.ts.map +1 -0
  41. package/dist/theme.js +182 -0
  42. package/dist/types.d.ts +283 -0
  43. package/dist/types.d.ts.map +1 -0
  44. package/dist/types.js +1 -0
  45. package/package.json +87 -0
  46. package/src/corpus/README.md +40 -0
  47. package/src/corpus/__snapshots__/corpus.test.ts.snap +1590 -0
  48. package/src/corpus/capture.ts +67 -0
  49. package/src/corpus/captures/issue2627-render-capture.coalesced.sse.txt +173 -0
  50. package/src/corpus/drive.ts +184 -0
  51. package/src/corpus/fixtures.ts +338 -0
  52. package/src/history-inputs.ts +48 -0
  53. package/src/index.ts +58 -0
  54. package/src/plan.ts +740 -0
  55. package/src/policy.ts +146 -0
  56. package/src/react/components.tsx +655 -0
  57. package/src/react/guuey-chat.tsx +227 -0
  58. package/src/react/markdown.tsx +114 -0
  59. package/src/react/theme-css.ts +50 -0
  60. package/src/react/transcript.tsx +187 -0
  61. package/src/react/use-transcript.ts +274 -0
  62. package/src/react.tsx +51 -0
  63. package/src/strings.ts +144 -0
  64. package/src/theme.ts +195 -0
  65. package/src/types.ts +320 -0
  66. package/styles.css +514 -0
@@ -0,0 +1,283 @@
1
+ /**
2
+ * The headless view-model's public types (wave-3a design §7, guuey#135).
3
+ *
4
+ * Everything here is DATA — no clocks, no DOM, no React. `planTranscript`
5
+ * (see `plan.ts`) is a pure function of these inputs; the renderers (React in
6
+ * 3b, RN in 3c) are thin walks of its output.
7
+ *
8
+ * Category vocabulary is ADOPTED from AgJSON (`@silverprotocol/core` owns
9
+ * it — the spec's "adopt, never invent" invariant): the matrix rows R0–R15
10
+ * map onto the fold's real block types plus `invokeTurn`'s turn-level
11
+ * events. A category this UI needs but AgJSON cannot express is an upstream
12
+ * silverprotocol change, never a guuey-side extension.
13
+ */
14
+ import type { AgReduceResult, AgSource, JsonValue } from "@silverprotocol/core";
15
+ import type { AgentInvokeStatus, HistoryCard } from "@guuey/agent-client";
16
+ import type { ViewHostPhase, ViewMount, ViewMountChannel } from "@guuey/mcp-apps-host";
17
+ /**
18
+ * One settled entry of the flat conversation transcript — structurally
19
+ * compatible with the hook's `AgentMessage`, plus the optional
20
+ * `clientMessageId` the R0 send-lifecycle join needs (the 3b live assembler
21
+ * threads it through; history entries and older callers simply omit it).
22
+ */
23
+ export interface TranscriptMessage {
24
+ role: "user" | "assistant";
25
+ text: string;
26
+ /** Present on live-sent user turns — the `sendStates` join key (R0). */
27
+ clientMessageId?: string;
28
+ }
29
+ /**
30
+ * A pending/resolved consent or link ask (R10) — the turn-level
31
+ * `profile-consent` / `profile-link` events lifted into renderable state.
32
+ * The assembler (3b) accumulates these from `invokeTurn` events; `id` is
33
+ * assembler-chosen and stable for the ask's lifetime.
34
+ */
35
+ export interface PromptItemInput {
36
+ id: string;
37
+ kind: "consent" | "link";
38
+ appId: string;
39
+ requested: "read" | "read-write";
40
+ state: "pending" | "answered" | "declined" | "dismissed";
41
+ }
42
+ /** Everything the plan derives from. All fields are data — no clocks, no DOM. */
43
+ export interface TranscriptInputs {
44
+ /** The Reducer's fold (silver mode); null on bypass-frame streams. */
45
+ result: AgReduceResult | null;
46
+ /**
47
+ * The in-flight turn's cumulative text fold (ALWAYS present; the sole
48
+ * assistant text source in bypass mode). Ignored once `status` is back to
49
+ * `ready` — the settled transcript owns finished turns — EXCEPT when
50
+ * `aborted` is set, where it carries the kept partial (R1
51
+ * aborted-partial).
52
+ */
53
+ assistantText: string;
54
+ status: AgentInvokeStatus;
55
+ /** Renderer-supplied elapsed ms in the current status; drives R12 escalation. */
56
+ statusElapsedMs: number;
57
+ activeTool: string | null;
58
+ error: {
59
+ message: string;
60
+ code: string | null;
61
+ } | null;
62
+ /** Pending/answered consent + link asks (R10). */
63
+ prompts: PromptItemInput[];
64
+ /**
65
+ * The settled conversation, both roles, in order. Assistant entries are
66
+ * the flat-text projection; when `result` is present the FOLD owns
67
+ * assistant content and these entries' assistant text is not re-rendered
68
+ * (one unified plan owns both — spec §9 Change-1).
69
+ */
70
+ messages: TranscriptMessage[];
71
+ historyCards?: HistoryCard[];
72
+ /** R13 rehydration state; absent means loaded. */
73
+ historyState?: "loading" | "gone" | "loaded";
74
+ /** R0: optimistic-send lifecycle, keyed by clientMessageId; absent = settled. */
75
+ sendStates?: Readonly<Record<string, "sending" | "failed">>;
76
+ /** mountKey → live phase (R6 states). Keys match `ViewMountItem.key`. */
77
+ viewPhases?: Readonly<Record<string, ViewHostPhase>>;
78
+ /** The last turn ended by user abort (R1 aborted-partial + "Stopped."). */
79
+ aborted?: boolean;
80
+ /**
81
+ * The last turn was ADOPTED from history after a mid-stream stall
82
+ * (guuey#192's watchdog). Calm renders it identically to a streamed turn;
83
+ * debug appends the recovered marker (spec §3, F10). The hook sets this
84
+ * in the 3b live assembler.
85
+ */
86
+ adopted?: boolean;
87
+ }
88
+ /** Stable per-item identity — survives streaming updates (spec §7). */
89
+ export type ItemKey = string;
90
+ /** User-toggled collapse state — OWNED by the renderer, passed in (purity). */
91
+ export type TranscriptOverrides = Readonly<Record<ItemKey, {
92
+ expanded?: boolean;
93
+ }>>;
94
+ interface BaseItem {
95
+ key: ItemKey;
96
+ /** Resolved collapse state: policy default, then `overrides[key]` wins. */
97
+ expanded: boolean;
98
+ }
99
+ /** R0 — the caller's own turn. */
100
+ export interface UserMessageItem extends BaseItem {
101
+ kind: "user";
102
+ text: string;
103
+ state: "sending" | "sent" | "failed";
104
+ /** The failed-state affordance (policy-gated); never silently disappears. */
105
+ retry: boolean;
106
+ }
107
+ /** R1 — assistant text. */
108
+ export interface TextItem extends BaseItem {
109
+ kind: "text";
110
+ text: string;
111
+ markdown: boolean;
112
+ streaming: boolean;
113
+ /** Aborted-partial: kept, marked with `strings.stopped`. */
114
+ stopped: boolean;
115
+ }
116
+ /** R2 — reasoning. */
117
+ export interface ReasoningItem extends BaseItem {
118
+ kind: "reasoning";
119
+ label: string;
120
+ text: string;
121
+ streaming: boolean;
122
+ }
123
+ /** R5 — a data result, embedded inside its R3 row's expansion. */
124
+ export interface DataResultItem extends BaseItem {
125
+ kind: "data-result";
126
+ /**
127
+ * A bounded pretty-printed preview — NEVER the full payload (the plan
128
+ * stays cheap; fixture 6). Null for binary/unrenderable content.
129
+ */
130
+ preview: string | null;
131
+ byteCount: number;
132
+ state: "small" | "giant" | "binary" | "empty";
133
+ showBytes: boolean;
134
+ }
135
+ /** R3 — one tool call lifecycle line. */
136
+ export interface ToolItem extends BaseItem {
137
+ kind: "tool";
138
+ toolCallId: string;
139
+ /** The wire name. */
140
+ name: string;
141
+ /** The humanized display title (policy's humanizer). */
142
+ title: string;
143
+ state: "running" | "done" | "failed" | "orphaned";
144
+ /** Bounded args preview (policy-gated); null when args are hidden. */
145
+ argsPreview: string | null;
146
+ /** The result inside this row's expansion (R5); null while running. */
147
+ result: DataResultItem | null;
148
+ /**
149
+ * True when this call's result renders as its own transcript row (an R6
150
+ * view) and calm folds this line into that row's chrome as attribution
151
+ * instead of a standalone line (R4's display-bearing rule).
152
+ */
153
+ attribution: boolean;
154
+ }
155
+ /** R4 — a collapsed run of adjacent settled SILENT tools. */
156
+ export interface ToolGroupItem extends BaseItem {
157
+ kind: "tool-group";
158
+ label: string;
159
+ tools: ToolItem[];
160
+ failureCount: number;
161
+ /** Non-empty when failureCount > 0 ("1 failed" — badge without unrolling). */
162
+ failureBadge: string | null;
163
+ }
164
+ /** R6 — a renderable result mounting through the wave-2 host. */
165
+ export interface ViewMountItem extends BaseItem {
166
+ kind: "view";
167
+ /** The mount material; null when the locator is dead (R13 expired path). */
168
+ mount: ViewMount | null;
169
+ channel: ViewMountChannel | null;
170
+ /** Live host phase, or the R13 dead-locator state. */
171
+ phase: ViewHostPhase | "expired";
172
+ /** The channel-aware state label the renderer shows for non-connected phases. */
173
+ label: string | null;
174
+ /** Calm chrome: "via {tool}" when this mount broke an R4 group. */
175
+ attribution: string | null;
176
+ /** The producing call's humanized title (live mounts); null for history cards. */
177
+ toolTitle: string | null;
178
+ /**
179
+ * The persisted `ui://` locator a mounted card's runtime actions bind to
180
+ * (guuey#158) — the block's `uiData.resourceUri` for live mounts, the
181
+ * card's own persisted identity for history snapshots; never a ggui
182
+ * shell's synthetic payload uri. `null` → the host's relay answers its
183
+ * in-band "not available" stub.
184
+ */
185
+ actionScope: string | null;
186
+ }
187
+ /** R7 — media blocks. */
188
+ export interface MediaItem extends BaseItem {
189
+ kind: "media";
190
+ media: "image" | "audio" | "file" | "document";
191
+ source: AgSource;
192
+ name: string | null;
193
+ presentation: "inline" | "chip";
194
+ }
195
+ /** R8 — code blocks. */
196
+ export interface CodeItem extends BaseItem {
197
+ kind: "code";
198
+ language: string;
199
+ code: string;
200
+ wrap: boolean;
201
+ }
202
+ /** R9 — a citation run collapsed to a chip row. */
203
+ export interface CitationsItem extends BaseItem {
204
+ kind: "citations";
205
+ label: string;
206
+ sources: {
207
+ title: string | null;
208
+ url: string | null;
209
+ }[];
210
+ style: "chips" | "list";
211
+ }
212
+ /** R10 — a consent/link prompt card. */
213
+ export interface PromptItem extends BaseItem {
214
+ kind: "prompt";
215
+ /** The `PromptItemInput.id` this row records — the host's resolution key. */
216
+ promptId: string;
217
+ promptKind: "consent" | "link";
218
+ appId: string;
219
+ requested: "read" | "read-write";
220
+ state: "pending" | "answered" | "declined" | "dismissed";
221
+ /** Raw ask payload, populated only under the debug policy. */
222
+ raw: JsonValue | null;
223
+ }
224
+ /** R11 — a coded, human-worded error notice. */
225
+ export interface ErrorItem extends BaseItem {
226
+ kind: "error";
227
+ /**
228
+ * The source message (wire body or client-side error copy), regardless of
229
+ * policy — `copy` is the calm family sentence; overrides that keep a
230
+ * surface's own voice (the widget renders pod messages verbatim) need the
231
+ * original without opting into debug's `verbatim` formatting.
232
+ */
233
+ message: string;
234
+ family: "auth" | "quota" | "transient" | "invalid";
235
+ code: string | null;
236
+ copy: string;
237
+ /** The wire message verbatim, populated only under the debug policy. */
238
+ verbatim: string | null;
239
+ }
240
+ /** R13 — history rehydration boundary states. */
241
+ export interface HistoryBoundaryItem extends BaseItem {
242
+ kind: "history-boundary";
243
+ state: "loading" | "gone";
244
+ label: string;
245
+ }
246
+ /** R14 — the compaction divider. */
247
+ export interface CompactionItem extends BaseItem {
248
+ kind: "compaction";
249
+ label: string;
250
+ }
251
+ /** R15 — the trust invariant: labeled, collapsed, never blank, never raw. */
252
+ export interface UnknownItem extends BaseItem {
253
+ kind: "unknown";
254
+ label: string;
255
+ typeName: string;
256
+ byteSize: number;
257
+ /** Pretty-printed payload, populated only under the debug policy. */
258
+ raw: JsonValue | null;
259
+ }
260
+ export type DisplayItem = UserMessageItem | TextItem | ReasoningItem | ToolItem | ToolGroupItem | DataResultItem | ViewMountItem | MediaItem | CodeItem | CitationsItem | PromptItem | ErrorItem | HistoryBoundaryItem | CompactionItem | UnknownItem;
261
+ /** R12/§4 — the derived status line with its resolved copy. */
262
+ export interface StatusLineItem {
263
+ kind: "status";
264
+ key: "status";
265
+ state: "connecting" | "starting" | "long-start" | "thinking" | "using-tool" | "aborted";
266
+ copy: string;
267
+ /** Literal state + elapsed, populated only under the debug policy. */
268
+ detail: string | null;
269
+ }
270
+ export interface TranscriptPlan {
271
+ /** Ordered, stable keys (spec §7's determinism contract). */
272
+ items: DisplayItem[];
273
+ /** Null when there is nothing to show (`ready`, `responding`). */
274
+ status: StatusLineItem | null;
275
+ /**
276
+ * The #192 recovered-turn marker: the resolved marker string under the
277
+ * debug policy when `inputs.adopted` is set, else null — calm plans stay
278
+ * byte-identical to a streamed turn's (fixture 17).
279
+ */
280
+ recovery: string | null;
281
+ }
282
+ export {};
283
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAEvF;;;;;GAKG;AACH,MA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D,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,kEAAkE;IAClE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB"}
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "@guuey/chat",
3
+ "version": "0.4.0",
4
+ "description": "The default end-user transcript UI for guuey agents — the headless view-model (planTranscript), calm/debug presets, the GuueyChatTheme token schema, the ChatStrings i18n seam, and (at ./react) the component kit that renders it: per-category components, <Transcript>, the live + history input assemblers, and stick-to-bottom/windowed/accessible transcript behavior.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "src",
12
+ "!src/**/*.test.ts",
13
+ "!src/**/*.test.tsx",
14
+ "styles.css",
15
+ "README.md"
16
+ ],
17
+ "exports": {
18
+ ".": {
19
+ "react-native": "./src/index.ts",
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "default": "./dist/index.js"
23
+ },
24
+ "./react": {
25
+ "react-native": "./src/react.tsx",
26
+ "types": "./dist/react.d.ts",
27
+ "import": "./dist/react.js",
28
+ "default": "./dist/react.js"
29
+ },
30
+ "./styles.css": "./styles.css"
31
+ },
32
+ "dependencies": {
33
+ "@silverprotocol/core": "0.4.1",
34
+ "@silverprotocol/richtext": "0.4.1",
35
+ "zod": "^4.3.6",
36
+ "@guuey/agent-client": "0.4.0",
37
+ "@guuey/mcp-apps-host": "0.4.0"
38
+ },
39
+ "peerDependencies": {
40
+ "react": ">=18"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "react": {
44
+ "optional": true
45
+ }
46
+ },
47
+ "devDependencies": {
48
+ "@testing-library/dom": "^10.0.0",
49
+ "@testing-library/react": "^16.3.2",
50
+ "@types/node": "^24.0.0",
51
+ "@types/react": "^19.0.0",
52
+ "jsdom": "^25.0.1",
53
+ "react": "^19.0.0",
54
+ "react-dom": "^19.0.0",
55
+ "typescript": "^5.0.0",
56
+ "vitest": "^3.0.0"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "keywords": [
62
+ "guuey",
63
+ "chat",
64
+ "transcript",
65
+ "agent",
66
+ "generative-ui",
67
+ "view-model",
68
+ "agjson",
69
+ "react"
70
+ ],
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "git+https://github.com/withguuey/guuey-sdks.git",
74
+ "directory": "packages/chat"
75
+ },
76
+ "bugs": {
77
+ "url": "https://github.com/withguuey/guuey-sdks/issues"
78
+ },
79
+ "homepage": "https://guuey.com",
80
+ "scripts": {
81
+ "build": "tsc -p tsconfig.build.json",
82
+ "dev": "tsc --watch",
83
+ "typecheck": "tsc --noEmit",
84
+ "test": "vitest run",
85
+ "test:watch": "vitest"
86
+ }
87
+ }
@@ -0,0 +1,40 @@
1
+ # The fixture corpus
2
+
3
+ This directory is the executable definition of "comfortably readable" — the
4
+ acceptance bar for `@guuey/chat`'s default UI (wave-3a design §8, guuey#135).
5
+ Every fixture is a recorded `InvokeTurnEvent[]` sequence driven through the
6
+ real `@silverprotocol/core` `Reducer` (`drive.ts`), planned by
7
+ `planTranscript`, and pinned by both named assertions and a full plan
8
+ snapshot.
9
+
10
+ ## The standing rule
11
+
12
+ **A new weird transcript found in production becomes a fixture BEFORE its
13
+ fix lands. The corpus only grows.** Fixtures are never deleted and never
14
+ weakened to make a change pass — a change that breaks a fixture is arguing
15
+ with the product definition, and that argument happens in review, not in the
16
+ fixture file.
17
+
18
+ Fixture 17 (`stalled-then-adopted`) is this rule's first production entry:
19
+ the guuey#192 widget stall, recorded the day it was diagnosed.
20
+
21
+ Family 18 (`production-capture-ggui-render`, `capture.ts` +
22
+ `capture.test.ts`) is the rule's structural upgrade, from 3b's dogfood
23
+ finding 1: the hand-driven corpus was green while the PRODUCTION fold
24
+ shape (tool results in `role: "tool"` messages) rendered blank cards. At
25
+ least one family is therefore derived from a real redacted production
26
+ capture, replayed through the REAL `invokeTurn` with adversarial
27
+ chunking — hand-driven sequences can no longer be the corpus's only
28
+ witness.
29
+
30
+ ## Layers
31
+
32
+ - `drive.ts` — test-only assembler: events → `TranscriptInputs`, applying
33
+ the hook's documented accumulation rules. The 3b live/history assemblers
34
+ are its production twins.
35
+ - `fixtures.ts` — the 17 named fixtures, spec §8 order.
36
+ - `capture.ts` / `captures/` — family 18: production-capture replay
37
+ through the real `invokeTurn` (provenance in the module header).
38
+ - `corpus.test.ts` — the runner: per-fixture assertions + snapshots, plain
39
+ Node (mirror-CI-safe). The browser render of the SAME corpus is 3b's
40
+ Storybook/screenshot leg.