@flamingo-stack/openframe-frontend-core 0.0.823 → 0.0.825

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 (119) hide show
  1. package/dist/build/export-map.json +1 -1
  2. package/dist/chat-protocol/events.d.ts +0 -3
  3. package/dist/chat-protocol/events.d.ts.map +1 -1
  4. package/dist/chat-protocol/frames.d.ts +10 -7
  5. package/dist/chat-protocol/frames.d.ts.map +1 -1
  6. package/dist/chat-protocol/index.cjs +238 -234
  7. package/dist/chat-protocol/leading-frames.d.ts.map +1 -1
  8. package/dist/chat-protocol/leading-frames.js +6 -3
  9. package/dist/chat-protocol/progress.d.ts +13 -20
  10. package/dist/chat-protocol/progress.d.ts.map +1 -1
  11. package/dist/chat-protocol/progress.js +13 -11
  12. package/dist/{chunk-QCRJVO6Y.cjs → chunk-2IWAHBCC.cjs} +1 -1
  13. package/dist/{chunk-2LT2WR4O.cjs → chunk-2U7GXE3T.cjs} +2789 -2819
  14. package/dist/{chunk-DEWT25QK.cjs → chunk-47SHKOCY.cjs} +65 -72
  15. package/dist/{chunk-UUFL4FDS.cjs → chunk-4IY5FKYL.cjs} +14 -14
  16. package/dist/{chunk-TJFVIJPV.cjs → chunk-5S2GW6YG.cjs} +2 -2
  17. package/dist/{chunk-AK7MYM25.cjs → chunk-6LVJKPR3.cjs} +3 -3
  18. package/dist/{chunk-HWXFUI3R.cjs → chunk-7DJWIVQC.cjs} +30 -30
  19. package/dist/{chunk-K7NGDYBG.cjs → chunk-AO6YVNAH.cjs} +136 -136
  20. package/dist/{chunk-Y7BTM2NC.cjs → chunk-APTFXX2C.cjs} +39 -39
  21. package/dist/{chunk-L7YE6APP.cjs → chunk-AUBR3FGY.cjs} +11 -11
  22. package/dist/{chunk-XEIZL3I3.cjs → chunk-B7NSH7IK.cjs} +6 -6
  23. package/dist/{chunk-3JCDSZ6D.cjs → chunk-BN7QENV7.cjs} +4 -4
  24. package/dist/{chunk-U7CH53FT.cjs → chunk-DNZCSPMU.cjs} +13 -13
  25. package/dist/{chunk-KWS7YKCO.cjs → chunk-IMMTH3F3.cjs} +13 -13
  26. package/dist/{chunk-GP2Y3DBE.cjs → chunk-MALCUN2G.cjs} +6 -6
  27. package/dist/{chunk-Y3MPERIZ.cjs → chunk-MHR4C465.cjs} +3 -3
  28. package/dist/{chunk-YMDSCI4E.cjs → chunk-N7IDLF2G.cjs} +32 -32
  29. package/dist/{chunk-2U6MAM6D.cjs → chunk-NL34HKLS.cjs} +63 -63
  30. package/dist/{chunk-SBXL5EKE.cjs → chunk-P25RVNGX.cjs} +23 -23
  31. package/dist/{chunk-GBILLSRM.cjs → chunk-QOOMUGF2.cjs} +4 -4
  32. package/dist/{chunk-DYSMAPSI.cjs → chunk-XJMLZ63Y.cjs} +4 -4
  33. package/dist/{chunk-2YUWBIZM.cjs → chunk-Z7BLMJEI.cjs} +46 -46
  34. package/dist/{cloud-tenants-VQQ2KNJI.cjs → cloud-tenants-M4VFFN33.cjs} +6 -6
  35. package/dist/components/case-studies/index.cjs +20 -20
  36. package/dist/components/chat/embeddable-chat.d.ts +0 -2
  37. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  38. package/dist/components/chat/embeddable-chat.js +1 -5
  39. package/dist/components/chat/entity-cards/blog-card.js +1 -1
  40. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  41. package/dist/components/chat/hooks/use-sse-chat-adapter.js +0 -2
  42. package/dist/components/chat/hooks/use-unified-chat.d.ts.map +1 -1
  43. package/dist/components/chat/hooks/use-unified-chat.js +0 -1
  44. package/dist/components/chat/index.cjs +5 -5
  45. package/dist/components/chat/mingo-welcome.js +1 -1
  46. package/dist/components/chat/stream/chat-dialog-store.d.ts.map +1 -1
  47. package/dist/components/chat/stream/chat-dialog-store.js +0 -1
  48. package/dist/components/chat/stream/chat-stream-reducer.d.ts +0 -4
  49. package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -1
  50. package/dist/components/chat/stream/chat-stream-reducer.js +6 -13
  51. package/dist/components/chat/types/unified-chat-state.types.d.ts +0 -5
  52. package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -1
  53. package/dist/components/contact/index.cjs +7 -7
  54. package/dist/components/docs/index.cjs +10 -10
  55. package/dist/components/embeds/index.cjs +7 -7
  56. package/dist/components/faq/index.cjs +8 -8
  57. package/dist/components/features/filters-dropdown.js +2 -2
  58. package/dist/components/features/index.cjs +6 -6
  59. package/dist/components/features/notifications/approval-request-notification-tile.js +1 -1
  60. package/dist/components/help-center-pages/index.cjs +80 -80
  61. package/dist/components/index.cjs +48 -48
  62. package/dist/components/loading/index.d.ts.map +1 -1
  63. package/dist/components/meeting-scheduler/index.cjs +31 -31
  64. package/dist/components/navigation/index.cjs +9 -9
  65. package/dist/components/onboarding-guides/index.cjs +9 -9
  66. package/dist/components/product-demo/index.cjs +15 -15
  67. package/dist/components/related-content/index.cjs +4 -4
  68. package/dist/components/shared/article-author-byline.js +4 -4
  69. package/dist/components/tickets/index.cjs +11 -11
  70. package/dist/components/tickets/ticket-row.js +10 -17
  71. package/dist/components/ui/date-picker.js +1 -1
  72. package/dist/components/ui/index.cjs +6 -6
  73. package/dist/components/ui/markdown/base-components.js +1 -1
  74. package/dist/components/ui/markdown/engine.js +2 -2
  75. package/dist/components/ui/navigation-menu.js +1 -1
  76. package/dist/components/ui/radio-group.d.ts.map +1 -1
  77. package/dist/components/ui/radio-group.js +1 -1
  78. package/dist/components/ui/sticky-action-bar.js +1 -1
  79. package/dist/{devices-KKJHYQ72.cjs → devices-DW5NDXMD.cjs} +7 -7
  80. package/dist/{embeddable-chat-MQGYFYGX.cjs → embeddable-chat-NBJMXEXB.cjs} +67 -71
  81. package/dist/index.cjs +10 -10
  82. package/dist/{knowledge-VMLXNFDI.cjs → knowledge-EYJG2TNW.cjs} +7 -7
  83. package/dist/loading-standard/engine.d.mts.map +1 -1
  84. package/dist/{logs-EFXRQ6LV.cjs → logs-2LV7DTSL.cjs} +14 -14
  85. package/dist/{policies-SU3NQPFV.cjs → policies-HSDYIQBX.cjs} +10 -10
  86. package/dist/{scripts-WLLAUOAA.cjs → scripts-UI6V7ANQ.cjs} +11 -11
  87. package/dist/{software-update-WKUDBC3U.cjs → software-update-WMLY7VHH.cjs} +9 -9
  88. package/eslint-config/README.md +21 -0
  89. package/eslint-config/base.js +12 -0
  90. package/eslint-config/dead-classes.js +256 -0
  91. package/package.json +2 -1
  92. package/src/chat-protocol/events.ts +0 -3
  93. package/src/chat-protocol/frames.ts +12 -8
  94. package/src/chat-protocol/leading-frames.ts +7 -4
  95. package/src/chat-protocol/progress.ts +31 -28
  96. package/src/components/chat/embeddable-chat.tsx +2 -12
  97. package/src/components/chat/entity-cards/blog-card.tsx +1 -1
  98. package/src/components/chat/hooks/use-sse-chat-adapter.ts +0 -2
  99. package/src/components/chat/hooks/use-unified-chat.ts +0 -1
  100. package/src/components/chat/mingo-welcome.tsx +1 -1
  101. package/src/components/chat/stream/chat-dialog-store.ts +0 -1
  102. package/src/components/chat/stream/chat-stream-reducer.ts +6 -17
  103. package/src/components/chat/types/unified-chat-state.types.ts +0 -6
  104. package/src/components/features/filters-dropdown.tsx +2 -2
  105. package/src/components/features/notifications/approval-request-notification-tile.tsx +1 -1
  106. package/src/components/loading/index.ts +0 -5
  107. package/src/components/shared/article-author-byline.tsx +4 -4
  108. package/src/components/tickets/ticket-row.tsx +1 -4
  109. package/src/components/ui/date-picker.tsx +1 -1
  110. package/src/components/ui/markdown/base-components.tsx +1 -1
  111. package/src/components/ui/markdown/engine.tsx +4 -4
  112. package/src/components/ui/navigation-menu.tsx +1 -1
  113. package/src/components/ui/radio-group.tsx +1 -2
  114. package/src/components/ui/sticky-action-bar.tsx +1 -1
  115. package/src/loading-standard/engine.mjs +1 -2
  116. package/dist/components/loading/openmsp-heartbeat.d.ts +0 -7
  117. package/dist/components/loading/openmsp-heartbeat.d.ts.map +0 -1
  118. package/dist/components/loading/openmsp-heartbeat.js +0 -68
  119. package/src/components/loading/openmsp-heartbeat.tsx +0 -69
@@ -0,0 +1,256 @@
1
+ /**
2
+ * A class that styles nothing is an error. See "Dead classes" in ./README.md.
3
+ *
4
+ * Tailwind writes no rule for a class it does not know, and says nothing about it: `bg-ods-background`
5
+ * (the token is `bg-ods-bg`), `text-body-sm`, `prose` (no typography plugin), `md:w-full!` (the
6
+ * `!` goes first) and `duration-[180ms]` (ambiguous beside tailwindcss-animate's own `duration-*`) all
7
+ * reached production that way, each one a style the author meant and no visitor ever got.
8
+ *
9
+ * The rule asks Tailwind itself, with the ODS preset (`../tailwind.config.ts`, the whole theme of every
10
+ * app that uses this config), whether it knows each class in a class string (`getClassOrder`, the
11
+ * lookup the official Prettier plugin sorts with). A class Tailwind does not know is still fine when a
12
+ * stylesheet defines it: this package's own (`../src/styles`) and the app's, named by the `css` option.
13
+ *
14
+ * Only class strings are read: a `className` / `class` attribute, the arguments of `cn`, `clsx`, `cva`,
15
+ * `twMerge`, `twJoin` and `classNames`, and a variable or property whose name ends in `class`,
16
+ * `className` or `classes`. Only a token shaped like a Tailwind utility is judged, so a hook class
17
+ * (`simple-markdown-renderer`) or a word in a cva key is never reported.
18
+ *
19
+ * Options: `{ css: ['app/globals.css'], allow: ['m-btn'] }`. `css` are files or directories relative to
20
+ * the working directory whose `.class` selectors count as defined; `allow` names classes defined
21
+ * somewhere a file cannot be read from (an email's inline `<style>`).
22
+ */
23
+ import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
24
+ import { createRequire } from 'node:module';
25
+ import { dirname, join, resolve } from 'node:path';
26
+ import { fileURLToPath } from 'node:url';
27
+
28
+ const HERE = dirname(fileURLToPath(import.meta.url));
29
+ const PRESET = join(HERE, '..', 'tailwind.config.ts');
30
+ const OWN_CSS = join(HERE, '..', 'src', 'styles');
31
+
32
+ /** Calls whose string arguments are class lists. */
33
+ const CLASS_CALLS = new Set(['cn', 'clsx', 'cva', 'twMerge', 'twJoin', 'classNames', 'classnames']);
34
+ const CLASS_ATTRIBUTES = new Set(['className', 'class']);
35
+ const CLASS_BINDING =
36
+ /(?:^|_|[a-z])(?:[cC]lass(?:[nN]ame)?(?:es)?|CLASS(?:_?NAME)?(?:ES)?)$|^[a-z]\w*(?:Class|ClassName)$/;
37
+
38
+ /** The utility families Tailwind and the ODS preset generate. A token outside them is a hook, not a utility. */
39
+ const UTILITY =
40
+ /^(?:bg|text|border|ring|fill|stroke|shadow|outline|p[xytrbl]?|m[xytrbl]?|w|h|size|min-w|max-w|min-h|max-h|gap|space-[xy]|inset(?:-[xy])?|top|left|right|bottom|start|end|z|order|grid|col|row|flex|basis|grow|shrink|items|justify|content|self|place|font|leading|tracking|line-clamp|rounded|opacity|duration|ease|delay|transition|animate|translate-[xyz]|scale(?:-[xy])?|rotate|skew-[xy]|origin|cursor|select|overflow|overscroll|whitespace|break|truncate|list|decoration|underline|object|aspect|columns|divide|backdrop|blur|brightness|contrast|drop-shadow|grayscale|invert|saturate|sepia|filter|mix-blend|bg-blend|from|via|to|prose|align|appearance|accent|caret|scroll|snap|touch|will-change|visible|invisible|static|fixed|absolute|relative|sticky|block|inline|hidden|table|contents|float|clear|box|indent|hyphens|tabular)(?:-|$)/;
41
+ /** An arbitrary duration, easing or delay: tailwindcss-animate defines the same names, so Tailwind writes neither. */
42
+ const AMBIGUOUS = /^(?:duration|ease|delay)-\[/;
43
+
44
+ let tailwind;
45
+ /** One Tailwind context for the preset, built on first use and kept for the process. */
46
+ function knownClasses(classes) {
47
+ if (!tailwind) {
48
+ const requireTailwind = createRequire(join(process.cwd(), 'package.json'));
49
+ const fromHere = createRequire(import.meta.url);
50
+ const load = id => {
51
+ try {
52
+ return requireTailwind(id);
53
+ } catch {
54
+ return fromHere(id);
55
+ }
56
+ };
57
+ const loadConfig = load('tailwindcss/loadConfig');
58
+ const resolveConfig = load('tailwindcss/resolveConfig');
59
+ const { createContext } = load('tailwindcss/lib/lib/setupContextUtils');
60
+ const preset = loadConfig(PRESET);
61
+ tailwind = createContext(resolveConfig({ presets: [preset.default ?? preset], content: [] }));
62
+ }
63
+ // Tailwind prints its own "ambiguous class" warning to the console; this rule reports it instead.
64
+ const warn = console.warn;
65
+ console.warn = () => {};
66
+ try {
67
+ return new Map(tailwind.getClassOrder(classes));
68
+ } finally {
69
+ console.warn = warn;
70
+ }
71
+ }
72
+
73
+ const cssClasses = new Map();
74
+ /** The class names the `.class` selectors of the CSS files under `paths` define. */
75
+ function definedInCss(paths) {
76
+ const key = paths.join('\n');
77
+ if (!cssClasses.has(key)) {
78
+ const names = new Set();
79
+ const read = path => {
80
+ if (!existsSync(path)) return;
81
+ if (statSync(path).isDirectory()) {
82
+ for (const entry of readdirSync(path)) read(join(path, entry));
83
+ return;
84
+ }
85
+ if (!path.endsWith('.css')) return;
86
+ const text = readFileSync(path, 'utf8').replace(/\/\*[\s\S]*?\*\//g, '');
87
+ for (const match of text.matchAll(/\.(-?[_a-zA-Z][\w-]*(?:\\.[\w-]*)*)/g)) names.add(match[1].replace(/\\/g, ''));
88
+ };
89
+ for (const path of paths) read(path);
90
+ cssClasses.set(key, names);
91
+ }
92
+ return cssClasses.get(key);
93
+ }
94
+
95
+ /** The utility a token applies, without its variants (`md:`, `[&_svg]:`), `!` and `-`. */
96
+ function utilityOf(token) {
97
+ let depth = 0;
98
+ let last = -1;
99
+ for (let i = 0; i < token.length; i++) {
100
+ const char = token[i];
101
+ if (char === '[') depth++;
102
+ else if (char === ']') depth--;
103
+ else if (char === ':' && depth === 0) last = i;
104
+ }
105
+ return token.slice(last + 1).replace(/^!?-?/, '');
106
+ }
107
+
108
+ /** Is this node where a class string is expected? */
109
+ function isClassContext(node) {
110
+ if (node.type === 'JSXAttribute') return CLASS_ATTRIBUTES.has(node.name?.name);
111
+ if (node.type === 'CallExpression') {
112
+ const callee = node.callee.type === 'MemberExpression' ? node.callee.property : node.callee;
113
+ return callee?.type === 'Identifier' && CLASS_CALLS.has(callee.name);
114
+ }
115
+ if (node.type === 'VariableDeclarator') return node.id.type === 'Identifier' && CLASS_BINDING.test(node.id.name);
116
+ if (node.type === 'AssignmentPattern') return node.left.type === 'Identifier' && CLASS_BINDING.test(node.left.name);
117
+ if (node.type === 'Property') {
118
+ const name = node.key?.type === 'Identifier' ? node.key.name : node.key?.value;
119
+ return typeof name === 'string' && CLASS_BINDING.test(name);
120
+ }
121
+ return false;
122
+ }
123
+
124
+ /** @type {import('eslint').Rule.RuleModule} */
125
+ const noDeadClass = {
126
+ meta: {
127
+ type: 'problem',
128
+ docs: { description: 'Disallow class names that no Tailwind utility and no stylesheet defines' },
129
+ schema: [
130
+ {
131
+ type: 'object',
132
+ properties: {
133
+ css: { type: 'array', items: { type: 'string' } },
134
+ allow: { type: 'array', items: { type: 'string' } },
135
+ },
136
+ additionalProperties: false,
137
+ },
138
+ ],
139
+ messages: {
140
+ dead:
141
+ '`{{token}}` styles nothing: Tailwind with the ODS preset has no utility by that name and no stylesheet ' +
142
+ 'defines it, so it is dropped without a warning. Use an ODS token (src/ODS_TOKEN_RULES.md) or delete it.',
143
+ ambiguous:
144
+ '`{{token}}` styles nothing: tailwindcss-animate defines `{{family}}-*` too, so Tailwind writes neither ' +
145
+ 'rule. Write the property itself: `[{{property}}:{{value}}]`.',
146
+ },
147
+ },
148
+ create(context) {
149
+ const { css = [], allow = [] } = context.options[0] ?? {};
150
+ const allowed = new Set(allow);
151
+ const defined = definedInCss([OWN_CSS, ...css.map(path => resolve(process.cwd(), path))]);
152
+
153
+ const check = (node, text, { openStart, openEnd }) => {
154
+ const tokens = text.split(/\s+/);
155
+ if (openStart) tokens.shift();
156
+ if (openEnd) tokens.pop();
157
+ const candidates = tokens.filter(token => token && !allowed.has(token) && UTILITY.test(utilityOf(token)));
158
+ if (candidates.length === 0) return;
159
+ const known = knownClasses(candidates);
160
+ for (const token of candidates) {
161
+ if (known.get(token) !== null || defined.has(token) || defined.has(utilityOf(token))) continue;
162
+ const utility = utilityOf(token);
163
+ if (AMBIGUOUS.test(utility)) {
164
+ const family = utility.slice(0, utility.indexOf('-'));
165
+ const property = {
166
+ duration: 'transition-duration',
167
+ ease: 'transition-timing-function',
168
+ delay: 'transition-delay',
169
+ }[family];
170
+ const value = utility.slice(utility.indexOf('[') + 1, utility.lastIndexOf(']'));
171
+ context.report({ node, messageId: 'ambiguous', data: { token, family, property, value } });
172
+ } else {
173
+ context.report({ node, messageId: 'dead', data: { token } });
174
+ }
175
+ }
176
+ };
177
+
178
+ /** Every string literal and template part under a class context, once each. */
179
+ const seen = new WeakSet();
180
+ const visit = node => {
181
+ if (!node || typeof node.type !== 'string' || seen.has(node)) return;
182
+ seen.add(node);
183
+ if (node.type === 'Literal' && typeof node.value === 'string') {
184
+ // A value compared or switched on (`side === 'right' && 'right-0'`) is a value, not a class; so is a
185
+ // lone word (a variant name such as `'accent'`): a class list that is one bare word is a utility
186
+ // Tailwind knows (`'hidden'`) or not a class at all.
187
+ const parent = node.parent;
188
+ if ((parent?.type === 'BinaryExpression' && parent.operator !== '+') || parent?.type === 'SwitchCase') return;
189
+ if (/^[a-z]+$/.test(node.value.trim())) return;
190
+ check(node, node.value, {});
191
+ return;
192
+ }
193
+ // An index (`ALIGN_CLASS[align ?? 'left']`) names an entry, not a class.
194
+ if (node.type === 'MemberExpression') {
195
+ visit(node.object);
196
+ return;
197
+ }
198
+ // cva: `defaultVariants` names variants; a `compoundVariants` entry names variants beside its `class`.
199
+ if (node.type === 'Property') {
200
+ const key = node.key?.type === 'Identifier' ? node.key.name : node.key?.value;
201
+ if (key === 'defaultVariants') return;
202
+ if (key === 'compoundVariants' && node.value.type === 'ArrayExpression') {
203
+ for (const entry of node.value.elements) {
204
+ if (entry?.type !== 'ObjectExpression') continue;
205
+ for (const property of entry.properties) {
206
+ const name = property.key?.type === 'Identifier' ? property.key.name : property.key?.value;
207
+ if (name === 'class' || name === 'className') visit(property.value);
208
+ }
209
+ }
210
+ return;
211
+ }
212
+ visit(node.value);
213
+ return;
214
+ }
215
+ if (node.type === 'TemplateLiteral') {
216
+ node.quasis.forEach((quasi, index) => {
217
+ check(quasi, quasi.value.cooked ?? quasi.value.raw, {
218
+ openStart: index > 0 && !/^\s/.test(quasi.value.raw),
219
+ openEnd: !quasi.tail && !/\s$/.test(quasi.value.raw),
220
+ });
221
+ });
222
+ node.expressions.forEach(visit);
223
+ return;
224
+ }
225
+ // A nested function is behaviour, not a class list (an event handler inside a cn() call's arguments).
226
+ if (/Function/.test(node.type)) return;
227
+ for (const key of Object.keys(node)) {
228
+ if (key === 'parent' || key === 'loc' || key === 'range') continue;
229
+ const value = node[key];
230
+ if (Array.isArray(value)) value.forEach(visit);
231
+ else if (value && typeof value.type === 'string') visit(value);
232
+ }
233
+ };
234
+
235
+ const enter = node => {
236
+ if (!isClassContext(node)) return;
237
+ if (node.type === 'JSXAttribute') visit(node.value);
238
+ else if (node.type === 'CallExpression') node.arguments.forEach(visit);
239
+ else if (node.type === 'VariableDeclarator') visit(node.init);
240
+ else if (node.type === 'AssignmentPattern') visit(node.right);
241
+ else visit(node.value);
242
+ };
243
+ return {
244
+ JSXAttribute: enter,
245
+ CallExpression: enter,
246
+ VariableDeclarator: enter,
247
+ Property: enter,
248
+ AssignmentPattern: enter,
249
+ };
250
+ },
251
+ };
252
+
253
+ export const deadClassesPlugin = {
254
+ meta: { name: 'flamingo-dead-classes' },
255
+ rules: { 'no-dead-class': noDeadClass },
256
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flamingo-stack/openframe-frontend-core",
3
- "version": "0.0.823",
3
+ "version": "0.0.825",
4
4
  "description": "Shared design system and components for all Flamingo platforms",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -378,6 +378,7 @@
378
378
  "./eslint-config": "./eslint-config/index.js",
379
379
  "./eslint-config/base": "./eslint-config/base.js",
380
380
  "./eslint-config/image-sizes": "./eslint-config/image-sizes.js",
381
+ "./eslint-config/dead-classes": "./eslint-config/dead-classes.js",
381
382
  "./eslint-config/next": "./eslint-config/next.js",
382
383
  "./eslint-config/react": "./eslint-config/react.js",
383
384
  "./eslint-config/relay": "./eslint-config/relay.js",
@@ -17,7 +17,6 @@ import type { AskOptionData, ChatSource } from '../components/chat/types/message
17
17
  // The wire-frame shapes these events carry through are defined ONCE in
18
18
  // `./frames.ts` — reuse them here rather than restating their fields.
19
19
  import type { ApprovalRequestField, DecisionResolvedFrame, UsageTelemetry } from './frames';
20
- import type { ChatProgress } from './progress';
21
20
 
22
21
  /** Optional envelope on every event. `seq` carries the transport's
23
22
  * stream sequence (JetStream `streamSeq` on NATS; unused on SSE). */
@@ -73,8 +72,6 @@ export interface AskEvent extends ChatStreamEventBase {
73
72
  export interface StatusEvent extends ChatStreamEventBase {
74
73
  type: 'status';
75
74
  phase: 'thinking';
76
- /** What the turn is doing right now, when the server says (`./progress`). */
77
- progress?: ChatProgress;
78
75
  }
79
76
 
80
77
  /** NATS tool execution progress (EXECUTING_TOOL / EXECUTED_TOOL). */
@@ -18,8 +18,6 @@
18
18
  * Server-safe: no React, no browser APIs beyond TextEncoder/TextDecoder.
19
19
  */
20
20
 
21
- import type { ChatProgressStage } from './progress';
22
-
23
21
  // =============================================================================
24
22
  // Sentinel constants
25
23
  // =============================================================================
@@ -84,11 +82,16 @@ export interface RoutedAnswerBreakdown {
84
82
  * within ~200ms, before any upstream byte arrives. */
85
83
  export interface StatusThinkingFrame {
86
84
  status: 'thinking';
87
- /** What the turn is doing right now (`./progress`): a fixed vocabulary, shown
88
- * as one line while the user waits. May be sent again as the stage moves. */
89
- stage?: ChatProgressStage;
90
- /** How many of the thing the stage works on (sources searched, results read). */
91
- count?: number;
85
+ }
86
+
87
+ /** A step of the turn (`./progress`), in the chunk shape a NATS tool run has: the decoder reads it with
88
+ * `decodeNatsChunk` and the chat draws it as that run's row. */
89
+ export interface ToolExecutionFrame {
90
+ type: 'EXECUTING_TOOL' | 'EXECUTED_TOOL';
91
+ toolFunction: string;
92
+ title: string;
93
+ toolExecutionRequestId: string;
94
+ success?: boolean;
92
95
  }
93
96
 
94
97
  /** Per-turn metadata frame. The emitter sends `options.metadata`
@@ -231,7 +234,8 @@ export type SseLeadingFrame =
231
234
  | ToolErrorFrame
232
235
  | ApprovalRequestFrame
233
236
  | ApprovalBatchFrame
234
- | DecisionResolvedFrame;
237
+ | DecisionResolvedFrame
238
+ | ToolExecutionFrame;
235
239
 
236
240
  // =============================================================================
237
241
  // Trailing usage frame
@@ -9,8 +9,9 @@
9
9
  * Server-safe: no React, no browser APIs.
10
10
  */
11
11
 
12
+ import { MESSAGE_TYPE } from '../components/chat/types/message.types';
12
13
  import type { ChatStreamEvent } from './events';
13
- import { chatProgressOf } from './progress';
14
+ import { decodeNatsChunk } from './nats-decoder';
14
15
 
15
16
  /**
16
17
  * Escape `<` so markdown renderers that pass HTML through (rehypeRaw)
@@ -51,9 +52,11 @@ export function frameNum(value: unknown): number | undefined {
51
52
  */
52
53
  export function mapLeadingFrame(meta: Record<string, unknown>, out: ChatStreamEvent[]): void {
53
54
  if (meta.status === 'thinking') {
54
- // The frame may name the stage the turn is in; an unknown stage is a plain "thinking".
55
- const progress = chatProgressOf(meta);
56
- out.push(progress ? { type: 'status', phase: 'thinking', progress } : { type: 'status', phase: 'thinking' });
55
+ out.push({ type: 'status', phase: 'thinking' });
56
+ } else if (meta.type === MESSAGE_TYPE.EXECUTING_TOOL || meta.type === MESSAGE_TYPE.EXECUTED_TOOL) {
57
+ // A step of the turn, in the chunk shape a NATS tool run has, read by the NATS decoder itself.
58
+ const event = decodeNatsChunk(meta);
59
+ if (event) out.push(event);
57
60
  } else if (meta.kind === 'thinking-delta' && typeof meta.text === 'string') {
58
61
  // Wire is ALREADY delta — emit verbatim, append-only contract.
59
62
  out.push({ type: 'thinking-delta', text: meta.text });
@@ -1,23 +1,18 @@
1
1
  /**
2
- * What a turn is doing before its first answer token: the named stages a server
3
- * reports while it works, and the line a client shows for each.
2
+ * What a turn is doing before its first answer token: the named stages a server reports while it works, and the line
3
+ * a client shows for each.
4
4
  *
5
- * A retrieval chat spends seconds before any text exists (reading the question,
6
- * searching, reading what it found). A generic spinner for that whole time says
7
- * nothing; a line naming the real step ("Searching 28 sources") does, and people
8
- * wait more willingly for it. The stage is a FIXED vocabulary on the wire (never
9
- * model text, a rewritten query or a source name), so it is safe on a public
10
- * chat and the wording stays the client's: `chatProgressLabel` is the one place
11
- * the copy lives.
12
- *
13
- * Wire: the existing `{ status: 'thinking' }` leading frame, with an optional
14
- * `stage` and `count`. A client that predates the stage reads the frame exactly
15
- * as before; a client that knows it shows the line. A stage it does not know is
16
- * dropped (the frame is still a plain "thinking").
5
+ * A retrieval chat spends seconds before any text exists (reading the question, searching, reading what it found). Each
6
+ * stage is reported as a step of the turn, in the chunk shape a NATS tool run has (`ToolExecutionFrame`), so the chat
7
+ * draws it as the row it draws for a tool run: working while the stage runs, done when it ends. The stage is a FIXED
8
+ * vocabulary (never model text, a rewritten query or a source name), so it is safe on a public chat, and its line lives
9
+ * here only (`chatProgressLabel`).
17
10
  *
18
11
  * Server-safe: no React, no browser APIs.
19
12
  */
20
13
 
14
+ import type { ToolExecutionFrame } from './frames';
15
+
21
16
  export const CHAT_PROGRESS_STAGES = ['understanding', 'searching', 'searching_again', 'reading'] as const;
22
17
 
23
18
  export type ChatProgressStage = (typeof CHAT_PROGRESS_STAGES)[number];
@@ -28,20 +23,6 @@ export interface ChatProgress {
28
23
  count?: number;
29
24
  }
30
25
 
31
- export function isChatProgressStage(value: unknown): value is ChatProgressStage {
32
- return typeof value === 'string' && (CHAT_PROGRESS_STAGES as readonly string[]).includes(value);
33
- }
34
-
35
- /** A parsed status frame's progress, or null when it carries no stage this client knows. */
36
- export function chatProgressOf(frame: { stage?: unknown; count?: unknown }): ChatProgress | null {
37
- if (!isChatProgressStage(frame.stage)) return null;
38
- const count =
39
- typeof frame.count === 'number' && Number.isFinite(frame.count) && frame.count > 0
40
- ? Math.floor(frame.count)
41
- : undefined;
42
- return count === undefined ? { stage: frame.stage } : { stage: frame.stage, count };
43
- }
44
-
45
26
  const PROGRESS_LABEL: Record<ChatProgressStage, (count: number | undefined) => string> = {
46
27
  understanding: () => 'Understanding your question',
47
28
  searching: count => (count ? `Searching ${count} ${count === 1 ? 'source' : 'sources'}` : 'Searching'),
@@ -53,3 +34,25 @@ const PROGRESS_LABEL: Record<ChatProgressStage, (count: number | undefined) => s
53
34
  export function chatProgressLabel(progress: ChatProgress): string {
54
35
  return PROGRESS_LABEL[progress.stage](progress.count);
55
36
  }
37
+
38
+ /**
39
+ * The frame for a stage of one turn: `running` opens its row, `done` or `failed` closes it. `turnId` keeps the row's id
40
+ * unique to the turn, since a closing frame updates the open row of the same id anywhere in the thread.
41
+ */
42
+ export function chatProgressFrame(
43
+ progress: ChatProgress,
44
+ state: 'running' | 'done' | 'failed',
45
+ turnId: string,
46
+ ): ToolExecutionFrame {
47
+ const id = `${turnId}:${progress.stage}`;
48
+ const title = chatProgressLabel(progress);
49
+ return state === 'running'
50
+ ? { type: 'EXECUTING_TOOL', toolFunction: progress.stage, title, toolExecutionRequestId: id }
51
+ : {
52
+ type: 'EXECUTED_TOOL',
53
+ toolFunction: progress.stage,
54
+ title,
55
+ toolExecutionRequestId: id,
56
+ success: state === 'done',
57
+ };
58
+ }
@@ -40,7 +40,6 @@ import { usePreventScroll } from '@react-aria/overlays';
40
40
  import { isIOS } from '@react-aria/utils';
41
41
  import { MessageSquare } from 'lucide-react';
42
42
  import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
43
- import { chatProgressLabel } from '../../chat-protocol/progress';
44
43
  import { useRequiredChatRuntime } from '../../contexts/chat-runtime-context';
45
44
  import { useIsHydrated } from '../../hooks/ui/use-is-hydrated';
46
45
  import { cn } from '../../utils/cn';
@@ -304,9 +303,6 @@ export interface EmbeddableChatProps {
304
303
  */
305
304
  activeAgentSlug?: string;
306
305
 
307
- /** Optional agent switcher callback (host renders the agent picker UI). */
308
- onAgentChange?: (slug: string) => void;
309
-
310
306
  /**
311
307
  * Per-component override for the agent display-config route. Highest
312
308
  * precedence (over `runtime.endpoints.aiAgentConfigUrl` and the built-in
@@ -616,8 +612,7 @@ function useRailPresence(open: boolean): { mounted: boolean; active: boolean } {
616
612
  * and the body's list column). The OUTER box transitions its width 0 ⇄ 320 +
617
613
  * opacity (so the neighbouring chat block slides smoothly); the INNER keeps a
618
614
  * fixed `w-80` so the rail content never squishes mid-animation — it's just
619
- * clipped by the shrinking outer (`overflow-hidden`). One easing both ways;
620
- * the collapse runs a touch longer than the open for a soft close.
615
+ * clipped by the shrinking outer (`overflow-hidden`).
621
616
  */
622
617
  function RailSlot({
623
618
  active,
@@ -640,7 +635,7 @@ function RailSlot({
640
635
  // Border on the OUTER so the rail/chat divider tracks the animating
641
636
  // boundary (and fades out with the panel) instead of vanishing early.
642
637
  'shrink-0 overflow-hidden border-r border-ods-border transition-[width,opacity] ease-out',
643
- active ? cn('duration-[240ms] opacity-100', width) : 'duration-[300ms] w-0 opacity-0',
638
+ active ? cn('opacity-100', width) : 'w-0 opacity-0',
644
639
  className,
645
640
  )}
646
641
  >
@@ -1018,7 +1013,6 @@ function EmbeddableChatInner({
1018
1013
  activeMode: controlledActiveMode,
1019
1014
  onActiveModeChange,
1020
1015
  activeAgentSlug,
1021
- onAgentChange: _onAgentChange,
1022
1016
  aiAgentConfigUrl: aiAgentConfigUrlProp,
1023
1017
  defaultActiveMode,
1024
1018
  shell = 'drawer',
@@ -1283,7 +1277,6 @@ function EmbeddableChatInner({
1283
1277
  const {
1284
1278
  messages: rawMessages,
1285
1279
  isLoading: chatLoading,
1286
- streamingProgress,
1287
1280
  sendMessage: sendMessageRaw,
1288
1281
  discussRef,
1289
1282
  stopMessage,
@@ -2917,9 +2910,6 @@ function EmbeddableChatInner({
2917
2910
  // faces, 16px between messages (shared with fae v2).
2918
2911
  appearance={appearance}
2919
2912
  isTyping={chatLoading}
2920
- // The stage the turn reports while the user waits
2921
- // ("Searching 28 sources"); the generic phrase otherwise.
2922
- typingMessage={streamingProgress ? chatProgressLabel(streamingProgress) : undefined}
2923
2913
  // Sticky footer for approvals the host lifted out of the
2924
2914
  // thread — see the prop's docblock.
2925
2915
  pendingApprovals={pendingApprovals}
@@ -265,7 +265,7 @@ function LoadedBlogCard({
265
265
  alt={post.title}
266
266
  fill
267
267
  priority={priority}
268
- className={cn('object-cover object-center', 'duration-400 transition-all ease-out', 'hover:scale-[1.02]')}
268
+ className={cn('object-cover object-center', 'transition-all ease-out', 'hover:scale-[1.02]')}
269
269
  sizes={IMAGE_SLOT.card}
270
270
  unoptimized
271
271
  onError={onImageError}
@@ -846,8 +846,6 @@ export function useSseChatAdapter(
846
846
  stopMessage,
847
847
  clearMessages,
848
848
  streamingPhase,
849
- /** The stage the pending turn reports before its first token, or null. */
850
- streamingProgress: state.streamingProgress,
851
849
  /** True while the mount-time rebuild from the server transcript runs. */
852
850
  isHydratingHistory,
853
851
  /** Provider key for the lib's `<ModelDisplay>` icon. */
@@ -214,7 +214,6 @@ export function useUnifiedChat(options: UseUnifiedChatOptions): UnifiedChatState
214
214
  messages: activeState.messages,
215
215
  isLoading: activeState.isLoading,
216
216
  streamingPhase: activeState.streamingPhase,
217
- streamingProgress: activeState.streamingProgress ?? null,
218
217
  sendMessage,
219
218
  stopMessage,
220
219
  clearMessages,
@@ -234,7 +234,7 @@ export function MingoWelcome({
234
234
  <AlertCircleIcon className="h-8 w-8 shrink-0 text-ods-text-secondary" />
235
235
  <div className="flex flex-col gap-[var(--spacing-system-xxs)]">
236
236
  <p className="text-ods-text-primary text-h4">Couldn’t load your chats</p>
237
- <p className="text-body-sm text-ods-text-secondary">
237
+ <p className="text-ods-text-secondary">
238
238
  Something went wrong reaching the server. Check your connection and try again.
239
239
  </p>
240
240
  </div>
@@ -199,7 +199,6 @@ export interface EvictedReducerState {
199
199
  const EMPTY_STATE: ChatReducerState = Object.freeze({
200
200
  messages: Object.freeze([]) as unknown as ChatReducerState['messages'],
201
201
  streamingPhase: 'idle',
202
- streamingProgress: null,
203
202
  turnMeta: Object.freeze({
204
203
  meta: new Map(),
205
204
  sources: new Map(),
@@ -60,7 +60,6 @@ import {
60
60
  type UsageEvent,
61
61
  } from '../../../chat-protocol/events';
62
62
  import { escapeThinkingTags } from '../../../chat-protocol/leading-frames';
63
- import type { ChatProgress } from '../../../chat-protocol/progress';
64
63
  import { mergeSourceMetadata, type SourceMetadata } from '../../../chat-protocol/source-metadata';
65
64
  import type {
66
65
  ApprovalBatchSegment,
@@ -156,9 +155,6 @@ export interface ChatTurnMetaState {
156
155
  export interface ChatReducerState {
157
156
  messages: UnifiedChatMessage[];
158
157
  streamingPhase: StreamingPhase;
159
- /** What the pending turn is doing, while it is still thinking and the server
160
- * has said (`chat-protocol/progress`). Null once text streams or the turn ends. */
161
- streamingProgress: ChatProgress | null;
162
158
  turnMeta: ChatTurnMetaState;
163
159
  dialogTokenUsage?: DialogTokenUsage | null;
164
160
  liveModel?: {
@@ -534,7 +530,6 @@ export function createChatStreamReducer(options: ChatStreamReducerOptions = {}):
534
530
  // ── Mutable internals ──────────────────────────────────────────────────
535
531
  let messages: UnifiedChatMessage[] = [];
536
532
  let streamingPhase: StreamingPhase = 'idle';
537
- let streamingProgress: ChatProgress | null = null;
538
533
  let dialogTokenUsage: DialogTokenUsage | null = null;
539
534
  let liveModel: ChatReducerState['liveModel'] = null;
540
535
  let approvalStatuses: Record<string, ChatApprovalStatus> = {
@@ -694,8 +689,6 @@ export function createChatStreamReducer(options: ChatStreamReducerOptions = {}):
694
689
  stateCache = {
695
690
  messages,
696
691
  streamingPhase,
697
- // A stage describes the wait before the first token only.
698
- streamingProgress: streamingPhase === 'thinking' ? streamingProgress : null,
699
692
  turnMeta: { meta: metaMap, sources: sourcesMap, sendCount },
700
693
  dialogTokenUsage,
701
694
  liveModel,
@@ -1589,10 +1582,6 @@ export function createChatStreamReducer(options: ChatStreamReducerOptions = {}):
1589
1582
  const sendIdx = sendCount - 1;
1590
1583
  switch (event.type) {
1591
1584
  case 'status':
1592
- if (event.progress) {
1593
- streamingProgress = event.progress;
1594
- invalidate();
1595
- }
1596
1585
  setPhaseInternal('thinking');
1597
1586
  break;
1598
1587
  case 'thinking-delta':
@@ -1697,10 +1686,12 @@ export function createChatStreamReducer(options: ChatStreamReducerOptions = {}):
1697
1686
  case 'usage':
1698
1687
  applySseUsage(event, sendIdx);
1699
1688
  break;
1700
- // NOTE: 'tool-execution' is intentionally NOT handled on the SSE
1701
- // kernel — the SSE wire never carries it, and routing it through the
1702
- // accumulator would invoke resolvePendingApprovalForExecution, which
1703
- // is a NATS-only semantic (observer streams without APPROVAL_RESULT).
1689
+ // A step the server reports before the answer (the hub's turn stages): the same row a NATS tool run is,
1690
+ // through the same message updater (it merges EXECUTED into its EXECUTING row). Not through the accumulator:
1691
+ // that would invoke resolvePendingApprovalForExecution, a NATS-only semantic.
1692
+ case 'tool-execution':
1693
+ setMessagesInternal(applyToolExecutionToMessages(messages, { type: 'tool_execution', data: event.data }));
1694
+ break;
1704
1695
  default:
1705
1696
  break;
1706
1697
  }
@@ -1913,7 +1904,6 @@ export function createChatStreamReducer(options: ChatStreamReducerOptions = {}):
1913
1904
  { id: nextId('assistant'), role: 'assistant', content: '', segments: [] },
1914
1905
  ];
1915
1906
  streamingPhase = 'thinking';
1916
- streamingProgress = null;
1917
1907
  invalidate();
1918
1908
  },
1919
1909
  clearThread() {
@@ -1961,7 +1951,6 @@ export function createChatStreamReducer(options: ChatStreamReducerOptions = {}):
1961
1951
  sendCount += 1;
1962
1952
  sseCurrentText = '';
1963
1953
  streamingPhase = 'thinking';
1964
- streamingProgress = null;
1965
1954
  invalidate();
1966
1955
  },
1967
1956
  endSseTurn() {
@@ -16,7 +16,6 @@
16
16
  * `sources`). In the off-mode they're null/undefined.
17
17
  */
18
18
 
19
- import type { ChatProgress } from '../../../chat-protocol/progress';
20
19
  import type { ChatRef } from '../chat-ref.types';
21
20
  import type { ChatAttachment } from '../utils/chat-attachment-markdown';
22
21
  import type { AuthorType } from './chat.types';
@@ -336,11 +335,6 @@ export interface UnifiedChatState {
336
335
  /** Granular phase for the "Thinking..."/"Streaming..." status row above input. */
337
336
  streamingPhase: StreamingPhase;
338
337
 
339
- /** What the pending turn is doing before its first token ("searching 28
340
- * sources"), when the transport reports it. Optional: a transport with no
341
- * stages leaves it out and the status row keeps its generic phrase. */
342
- streamingProgress?: ChatProgress | null;
343
-
344
338
  /** True while the adapter is rebuilding the message list from the
345
339
  * server-side transcript store (SSE/Guide mount-time hydration). Optional —
346
340
  * transports without server hydration (NATS manages its own dialog