@flamingo-stack/openframe-frontend-core 0.0.657 → 0.0.658-snapshot.20260923121054

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 (121) hide show
  1. package/dist/{chunk-73G2JJZQ.cjs → chunk-46UQKEAZ.cjs} +5 -5
  2. package/dist/{chunk-73G2JJZQ.cjs.map → chunk-46UQKEAZ.cjs.map} +1 -1
  3. package/dist/{chunk-AYVTBCYB.js → chunk-4NKKPGDN.js} +49 -24
  4. package/dist/{chunk-AYVTBCYB.js.map → chunk-4NKKPGDN.js.map} +1 -1
  5. package/dist/{chunk-PDMIYWKB.js → chunk-53ZSKYNS.js} +3 -3
  6. package/dist/{chunk-HCCX6DMN.js → chunk-6AN26DYW.js} +6 -6
  7. package/dist/{chunk-PPQLBZ5X.cjs → chunk-6AX7QQLS.cjs} +20 -20
  8. package/dist/{chunk-PPQLBZ5X.cjs.map → chunk-6AX7QQLS.cjs.map} +1 -1
  9. package/dist/{chunk-XC4UQ4QP.js → chunk-6DZQCZA4.js} +4 -4
  10. package/dist/{chunk-45UD5DWC.js → chunk-7L4C7BIN.js} +3 -3
  11. package/dist/{chunk-BACI3M4T.cjs → chunk-BF52HR6O.cjs} +15 -15
  12. package/dist/{chunk-BACI3M4T.cjs.map → chunk-BF52HR6O.cjs.map} +1 -1
  13. package/dist/{chunk-BLXMHTEO.js → chunk-C3SONLPV.js} +7 -7
  14. package/dist/{chunk-H4EVZRNR.cjs → chunk-D54B6FP5.cjs} +12 -12
  15. package/dist/{chunk-H4EVZRNR.cjs.map → chunk-D54B6FP5.cjs.map} +1 -1
  16. package/dist/{chunk-NLGTHKU3.cjs → chunk-DCPWZKHS.cjs} +81 -81
  17. package/dist/{chunk-NLGTHKU3.cjs.map → chunk-DCPWZKHS.cjs.map} +1 -1
  18. package/dist/{chunk-WQ7GXPTR.js → chunk-DIFZMDTP.js} +4 -4
  19. package/dist/{chunk-43UWVVPF.js → chunk-FPGT4R2K.js} +5 -5
  20. package/dist/{chunk-ZHR5RWCF.js → chunk-GDARHYGJ.js} +3 -3
  21. package/dist/{chunk-64AZNJIZ.js → chunk-GFRATFKJ.js} +2 -2
  22. package/dist/{chunk-LACNKEJO.js → chunk-GK2ZJ74J.js} +6 -6
  23. package/dist/{chunk-PEK6JBTK.cjs → chunk-GXHZCGVJ.cjs} +197 -172
  24. package/dist/chunk-GXHZCGVJ.cjs.map +1 -0
  25. package/dist/{chunk-KIRDULVH.js → chunk-GXLFOJ65.js} +3 -3
  26. package/dist/{chunk-FXVAUABF.cjs → chunk-JTFRTSCA.cjs} +205 -205
  27. package/dist/{chunk-FXVAUABF.cjs.map → chunk-JTFRTSCA.cjs.map} +1 -1
  28. package/dist/{chunk-LMJ47EPZ.js → chunk-JZTU2BT7.js} +3 -3
  29. package/dist/{chunk-YPNLR6L2.cjs → chunk-KPQ4I2KN.cjs} +33 -33
  30. package/dist/{chunk-YPNLR6L2.cjs.map → chunk-KPQ4I2KN.cjs.map} +1 -1
  31. package/dist/{chunk-XGOQZJ7O.cjs → chunk-NAD5FOQ2.cjs} +6 -6
  32. package/dist/{chunk-XGOQZJ7O.cjs.map → chunk-NAD5FOQ2.cjs.map} +1 -1
  33. package/dist/{chunk-XX6Z63VU.cjs → chunk-NH66OMVD.cjs} +28 -28
  34. package/dist/{chunk-XX6Z63VU.cjs.map → chunk-NH66OMVD.cjs.map} +1 -1
  35. package/dist/{chunk-ATVY6VKT.js → chunk-NNWFKTRQ.js} +3 -3
  36. package/dist/{chunk-WA7ZDMVF.cjs → chunk-NQAVFZCR.cjs} +32 -32
  37. package/dist/{chunk-WA7ZDMVF.cjs.map → chunk-NQAVFZCR.cjs.map} +1 -1
  38. package/dist/{chunk-L6OYSRJT.cjs → chunk-ODB2AEUW.cjs} +9 -2
  39. package/dist/chunk-ODB2AEUW.cjs.map +1 -0
  40. package/dist/{chunk-OYLAWIUG.cjs → chunk-OOLGEKQR.cjs} +59 -59
  41. package/dist/{chunk-OYLAWIUG.cjs.map → chunk-OOLGEKQR.cjs.map} +1 -1
  42. package/dist/{chunk-IXD25DBI.js → chunk-OQXPXA3Q.js} +5 -5
  43. package/dist/{chunk-EA7W7OJZ.js → chunk-PKFNFBYD.js} +9 -2
  44. package/dist/{chunk-EA7W7OJZ.js.map → chunk-PKFNFBYD.js.map} +1 -1
  45. package/dist/{chunk-ZKS4OMO4.cjs → chunk-POSBGHZ5.cjs} +29 -29
  46. package/dist/{chunk-ZKS4OMO4.cjs.map → chunk-POSBGHZ5.cjs.map} +1 -1
  47. package/dist/{chunk-WL4QOUQN.js → chunk-SLGXA2LA.js} +2 -2
  48. package/dist/{chunk-WWXQ7WUE.js → chunk-UWKWMXTI.js} +3 -3
  49. package/dist/{chunk-Y3Z2EO4C.cjs → chunk-XDTIW3QV.cjs} +22 -22
  50. package/dist/{chunk-Y3Z2EO4C.cjs.map → chunk-XDTIW3QV.cjs.map} +1 -1
  51. package/dist/{chunk-UQBOEQOK.cjs → chunk-XEV2Z4X6.cjs} +7 -7
  52. package/dist/{chunk-UQBOEQOK.cjs.map → chunk-XEV2Z4X6.cjs.map} +1 -1
  53. package/dist/{chunk-QQ72MAPB.cjs → chunk-Z4LUUEIK.cjs} +3 -3
  54. package/dist/{chunk-QQ72MAPB.cjs.map → chunk-Z4LUUEIK.cjs.map} +1 -1
  55. package/dist/{chunk-RNXQGKU3.cjs → chunk-ZDFCBNNU.cjs} +10 -10
  56. package/dist/{chunk-RNXQGKU3.cjs.map → chunk-ZDFCBNNU.cjs.map} +1 -1
  57. package/dist/components/case-studies/index.cjs +16 -16
  58. package/dist/components/case-studies/index.js +4 -4
  59. package/dist/components/chat/entity-cards/dispatch.d.ts.map +1 -1
  60. package/dist/components/chat/index.cjs +3 -3
  61. package/dist/components/chat/index.js +2 -2
  62. package/dist/components/chat/utils/history-merge.d.ts +6 -0
  63. package/dist/components/chat/utils/history-merge.d.ts.map +1 -1
  64. package/dist/components/contact/index.cjs +5 -5
  65. package/dist/components/contact/index.js +4 -4
  66. package/dist/components/docs/index.cjs +8 -8
  67. package/dist/components/docs/index.js +7 -7
  68. package/dist/components/embeds/index.cjs +5 -5
  69. package/dist/components/embeds/index.js +4 -4
  70. package/dist/components/faq/index.cjs +5 -5
  71. package/dist/components/faq/index.js +4 -4
  72. package/dist/components/features/index.cjs +4 -4
  73. package/dist/components/features/index.js +3 -3
  74. package/dist/components/help-center-pages/index.cjs +24 -24
  75. package/dist/components/help-center-pages/index.js +15 -15
  76. package/dist/components/index.cjs +54 -54
  77. package/dist/components/index.js +15 -15
  78. package/dist/components/meeting-scheduler/index.cjs +40 -40
  79. package/dist/components/meeting-scheduler/index.js +3 -3
  80. package/dist/components/navigation/index.cjs +7 -7
  81. package/dist/components/navigation/index.js +6 -6
  82. package/dist/components/onboarding-guides/index.cjs +7 -7
  83. package/dist/components/onboarding-guides/index.js +6 -6
  84. package/dist/components/related-content/index.cjs +3 -3
  85. package/dist/components/related-content/index.js +2 -2
  86. package/dist/components/tickets/index.cjs +8 -8
  87. package/dist/components/tickets/index.js +7 -7
  88. package/dist/components/ui/index.cjs +4 -4
  89. package/dist/components/ui/index.js +3 -3
  90. package/dist/index.cjs +9 -9
  91. package/dist/index.js +7 -7
  92. package/dist/utils/index.cjs +23 -4
  93. package/dist/utils/index.cjs.map +1 -1
  94. package/dist/utils/index.js +23 -4
  95. package/dist/utils/index.js.map +1 -1
  96. package/dist/utils/list-url.d.ts.map +1 -1
  97. package/dist/utils/source-icons.d.ts.map +1 -1
  98. package/package.json +1 -1
  99. package/src/components/chat/entity-cards/dispatch.tsx +11 -0
  100. package/src/components/chat/utils/__tests__/history-merge.test.ts +62 -0
  101. package/src/components/chat/utils/history-merge.ts +31 -17
  102. package/src/utils/list-url.ts +7 -0
  103. package/src/utils/source-icons.ts +12 -0
  104. package/dist/chunk-L6OYSRJT.cjs.map +0 -1
  105. package/dist/chunk-PEK6JBTK.cjs.map +0 -1
  106. /package/dist/{chunk-PDMIYWKB.js.map → chunk-53ZSKYNS.js.map} +0 -0
  107. /package/dist/{chunk-HCCX6DMN.js.map → chunk-6AN26DYW.js.map} +0 -0
  108. /package/dist/{chunk-XC4UQ4QP.js.map → chunk-6DZQCZA4.js.map} +0 -0
  109. /package/dist/{chunk-45UD5DWC.js.map → chunk-7L4C7BIN.js.map} +0 -0
  110. /package/dist/{chunk-BLXMHTEO.js.map → chunk-C3SONLPV.js.map} +0 -0
  111. /package/dist/{chunk-WQ7GXPTR.js.map → chunk-DIFZMDTP.js.map} +0 -0
  112. /package/dist/{chunk-43UWVVPF.js.map → chunk-FPGT4R2K.js.map} +0 -0
  113. /package/dist/{chunk-ZHR5RWCF.js.map → chunk-GDARHYGJ.js.map} +0 -0
  114. /package/dist/{chunk-64AZNJIZ.js.map → chunk-GFRATFKJ.js.map} +0 -0
  115. /package/dist/{chunk-LACNKEJO.js.map → chunk-GK2ZJ74J.js.map} +0 -0
  116. /package/dist/{chunk-KIRDULVH.js.map → chunk-GXLFOJ65.js.map} +0 -0
  117. /package/dist/{chunk-LMJ47EPZ.js.map → chunk-JZTU2BT7.js.map} +0 -0
  118. /package/dist/{chunk-ATVY6VKT.js.map → chunk-NNWFKTRQ.js.map} +0 -0
  119. /package/dist/{chunk-IXD25DBI.js.map → chunk-OQXPXA3Q.js.map} +0 -0
  120. /package/dist/{chunk-WL4QOUQN.js.map → chunk-SLGXA2LA.js.map} +0 -0
  121. /package/dist/{chunk-WWXQ7WUE.js.map → chunk-UWKWMXTI.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"list-url.d.ts","sourceRoot":"","sources":["../../src/utils/list-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH;;;;iEAIiE;AACjE,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAKtE;AA0ED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,SAAK,GAAG,MAAM,GAAG,IAAI,CAa5F"}
1
+ {"version":3,"file":"list-url.d.ts","sourceRoot":"","sources":["../../src/utils/list-url.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAWH;;;;iEAIiE;AACjE,wBAAgB,uBAAuB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAKtE;AAiFD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,IAAI,SAAK,GAAG,MAAM,GAAG,IAAI,CAa5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"source-icons.d.ts","sourceRoot":"","sources":["../../src/utils/source-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2DpD,CAAC;AAEF;;6DAE6D;AAC7D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGxF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiEzD,CAAC;AAEF;;kEAEkE;AAClE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA2DpE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK5E"}
1
+ {"version":3,"file":"source-icons.d.ts","sourceRoot":"","sources":["../../src/utils/source-icons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,6EAA6E;AAC7E,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+DpD,CAAC;AAEF;;6DAE6D;AAC7D,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAGxF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqEzD,CAAC;AAEF;;kEAEkE;AAClE,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+DpE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEjF;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK5E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flamingo-stack/openframe-frontend-core",
3
- "version": "0.0.657",
3
+ "version": "0.0.658-snapshot.20260923121054",
4
4
  "description": "Shared design system and components for all Flamingo platforms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -48,6 +48,7 @@ import { PresentationBarIcon } from '../../icons-v2-generated/charts/presentatio
48
48
  import { PresentationLineIcon } from '../../icons-v2-generated/charts/presentation-line-icon';
49
49
  import { BracketCurlyCheckIcon } from '../../icons-v2-generated/coding/bracket-curly-check-icon';
50
50
  import { CodeIcon } from '../../icons-v2-generated/coding/code-icon';
51
+ import { CodeSquareIcon } from '../../icons-v2-generated/coding/code-square-icon';
51
52
  import { CodingBranchIcon } from '../../icons-v2-generated/coding/coding-branch-icon';
52
53
  import { CodingCommitIcon } from '../../icons-v2-generated/coding/coding-commit-icon';
53
54
  import { CodingPullRequestIcon } from '../../icons-v2-generated/coding/coding-pull-request-icon';
@@ -56,6 +57,8 @@ import { CallIcon } from '../../icons-v2-generated/communication/call-icon';
56
57
  import { ChatQuoteIcon } from '../../icons-v2-generated/communication/chat-quote-icon';
57
58
  import { CalendarIcon } from '../../icons-v2-generated/date-and-time/calendar-icon';
58
59
  import { ClipboardListIcon } from '../../icons-v2-generated/documents/clipboard-list-icon';
60
+ import { Copy01Icon } from '../../icons-v2-generated/documents/copy-01-icon';
61
+ import { FileCodeIcon } from '../../icons-v2-generated/documents/file-code-icon';
59
62
  import { FileContentIcon } from '../../icons-v2-generated/documents/file-content-icon';
60
63
  import { NewspaperIcon } from '../../icons-v2-generated/documents/newspaper-icon';
61
64
  import { BankIcon } from '../../icons-v2-generated/finance/bank-icon';
@@ -1358,6 +1361,14 @@ const REF_GLYPH_CARD_CONFIGS: Record<string, GlyphCardConfig> = {
1358
1361
  code_rule: { label: 'Code rule', icon: () => <BracketCurlyCheckIcon size={24} /> },
1359
1362
  code_repo: { label: 'Repository', icon: () => <CodingBranchIcon size={24} /> },
1360
1363
  code_deployment: { label: 'Deployment', icon: () => <PackageIcon size={24} /> },
1364
+ // The graph's own objects: one source file's public surface, one public
1365
+ // symbol, a near-duplicate cluster, and a pull request's blast radius.
1366
+ // Glyph cards for the same reason as their three siblings — none carries a
1367
+ // cover image, and each links to the admin screen that renders it in full.
1368
+ code_file: { label: 'Code file', icon: () => <FileCodeIcon size={24} /> },
1369
+ code_symbol: { label: 'Code symbol', icon: () => <CodeSquareIcon size={24} /> },
1370
+ code_duplicate: { label: 'Duplicate code', icon: () => <Copy01Icon size={24} /> },
1371
+ code_impact: { label: 'Change impact', icon: () => <CodingPullRequestIcon size={24} /> },
1361
1372
  };
1362
1373
  function refGlyphRegistryEntries(): Record<string, ChatCardRegistryEntry> {
1363
1374
  return registryEntries(REF_GLYPH_CARD_CONFIGS, (cfg, docType) =>
@@ -332,6 +332,68 @@ describe('mergeHistoryWithRealtime', () => {
332
332
  expect(ids(merged)).toEqual([U0.id, A0.id, persistedFirst.id, asstFirst.id, synSecond.id]);
333
333
  });
334
334
 
335
+ // Technician and system lines render under role `user` on every host, so a
336
+ // user row's twin must match on author kind too. Repro (tickets client chat):
337
+ // the technician typed "?", the end user replied "?", the refetch raced the
338
+ // persistence of the reply - the reply's bubble was taken for the twin of
339
+ // the technician's row and dropped, and the user's message vanished.
340
+ it('keeps the own `user-` bubble when only a TECHNICIAN row holds the same text', () => {
341
+ const techQ: TestMessage = { id: 'aaaa0008', role: 'user', authorType: 'admin', content: '?', timestamp: t(3000) };
342
+ const ownQ: TestMessage = { id: 'user-4000-q', role: 'user', content: '?', timestamp: t(4000) };
343
+ const merged = mergeHistoryWithRealtime({
344
+ processedHistory: [U0, A0, techQ],
345
+ existingMessages: [U0, A0, techQ, ownQ],
346
+ streamingMessageId: null,
347
+ historyFetchedAt: 5000,
348
+ });
349
+ expect(ids(merged)).toEqual([U0.id, A0.id, techQ.id, ownQ.id]);
350
+ });
351
+
352
+ it('still drops the own `user-` bubble once its OWN row is persisted beside a same-text technician row', () => {
353
+ const techQ: TestMessage = { id: 'aaaa0008', role: 'user', authorType: 'admin', content: '?', timestamp: t(3000) };
354
+ const ownPersisted: TestMessage = {
355
+ id: 'aaaa0009',
356
+ role: 'user',
357
+ authorType: 'user',
358
+ content: '?',
359
+ timestamp: t(4500),
360
+ };
361
+ const ownQ: TestMessage = { id: 'user-4000-q', role: 'user', content: '?', timestamp: t(4000) };
362
+ const merged = mergeHistoryWithRealtime({
363
+ processedHistory: [U0, A0, techQ, ownPersisted],
364
+ existingMessages: [U0, A0, techQ, ownQ],
365
+ streamingMessageId: null,
366
+ historyFetchedAt: 5000,
367
+ });
368
+ expect(ids(merged)).toEqual([U0.id, A0.id, techQ.id, ownPersisted.id]);
369
+ });
370
+
371
+ it('twins an admin-authored optimistic row with its admin-authored persisted row (Mingo)', () => {
372
+ // The rule is per author kind, not "admin rows never twin": on Mingo the
373
+ // operator IS the admin, so the host stamps `admin` on both copies.
374
+ const adminRow: TestMessage = {
375
+ id: 'aaaa0010',
376
+ role: 'user',
377
+ authorType: 'admin',
378
+ content: 'hello',
379
+ timestamp: t(3000),
380
+ };
381
+ const adminOpt: TestMessage = {
382
+ id: 'optimistic-2500-a',
383
+ role: 'user',
384
+ authorType: 'admin',
385
+ content: 'hello',
386
+ timestamp: t(2500),
387
+ };
388
+ const merged = mergeHistoryWithRealtime({
389
+ processedHistory: [U0, A0, adminRow],
390
+ existingMessages: [U0, A0, adminOpt],
391
+ streamingMessageId: null,
392
+ historyFetchedAt: 5000,
393
+ });
394
+ expect(ids(merged)).toEqual([U0.id, A0.id, adminRow.id]);
395
+ });
396
+
335
397
  it('KEEPS a `user-` synthetic when a seq-stamped ASSISTANT row raised the global max but the user turn is not persisted', () => {
336
398
  // The reload+stop loss: history has a seq-stamped assistant row (so
337
399
  // anyHistoryRowSeq is true and the global max is high) and a live `user-`
@@ -24,6 +24,12 @@ export interface MergeableChatMessage {
24
24
  role: string;
25
25
  content: MessageContent;
26
26
  timestamp?: Date;
27
+ /** Who authored a `user`-role row: the host's own user (`'user'` / unset),
28
+ * a technician (`'admin'`) or the system (`'system'`). Every host renders
29
+ * technician and system lines under role `user`, so a user row's twin must
30
+ * match on this as well as on text - otherwise the end user's "?" is taken
31
+ * for the twin of the technician's "?" and dropped from the thread. */
32
+ authorType?: string;
27
33
  /** Highest CONTENT chunk streamSeq that composed this message (text / tool /
28
34
  * approval / error / compaction — never the non-persisted MESSAGE_END /
29
35
  * TOKEN_USAGE control chunks). Hosts stamp it on realtime synthetics so the
@@ -154,10 +160,17 @@ function sharesRequestKey(keys: ReadonlySet<string>, others: ReadonlySet<string>
154
160
  return false;
155
161
  }
156
162
 
157
- /** A user row's identity is its text; empty text is no identity (system rows
158
- * persist with `content: ''`). `''` for any other row. */
159
- function userText(m: MergeableChatMessage): string {
160
- return m.role === 'user' && typeof m.content === 'string' ? m.content : '';
163
+ /** A user row's identity is its text under its author kind; empty text is no
164
+ * identity (system rows persist with `content: ''`). `''` for any other row.
165
+ * The kind is part of the key because technician (`authorType: 'admin'`) and
166
+ * system rows share role `user` with the host's own sends: without it a
167
+ * technician who typed the same text is the own bubble's "twin", and the own
168
+ * bubble is dropped while its row is not in the snapshot yet. An unset
169
+ * authorType is the own user (hosts stamp `'admin'` on their own sends where
170
+ * the operator IS the admin, so the rule stays symmetric per host). */
171
+ function userTwinKey(m: MergeableChatMessage): string {
172
+ if (m.role !== 'user' || typeof m.content !== 'string' || m.content === '') return '';
173
+ return `${m.authorType ?? 'user'}\u0000${m.content}`;
161
174
  }
162
175
 
163
176
  /** What a set of rows says about the turns they render, so another copy of one
@@ -182,8 +195,8 @@ function collectTwinSignals(rows: readonly MergeableChatMessage[]): TwinSignals
182
195
  if (text !== '') signals.assistantTexts.set(text, (signals.assistantTexts.get(text) ?? 0) + 1);
183
196
  continue;
184
197
  }
185
- const text = userText(row);
186
- if (text !== '') signals.userContents.set(text, (signals.userContents.get(text) ?? 0) + 1);
198
+ const key = userTwinKey(row);
199
+ if (key !== '') signals.userContents.set(key, (signals.userContents.get(key) ?? 0) + 1);
187
200
  }
188
201
  return signals;
189
202
  }
@@ -198,9 +211,9 @@ type TwinVerdict = 'twin' | 'distinct' | 'unknown';
198
211
  * request id, no answer text), so "no match" says nothing about it. */
199
212
  function twinVerdict(signals: TwinSignals, m: MergeableChatMessage): TwinVerdict {
200
213
  if (m.role !== 'assistant') {
201
- const text = userText(m);
202
- if (text === '') return 'unknown';
203
- return signals.userContents.has(text) ? 'twin' : 'distinct';
214
+ const key = userTwinKey(m);
215
+ if (key === '') return 'unknown';
216
+ return signals.userContents.has(key) ? 'twin' : 'distinct';
204
217
  }
205
218
  const keys = turnRequestKeys(m.content);
206
219
  if (keys.size > 0) return sharesRequestKey(keys, signals.requestKeys) ? 'twin' : 'distinct';
@@ -529,7 +542,7 @@ export function mergeHistoryWithRealtime<M extends MergeableChatMessage>(input:
529
542
  // optimistic messages are minted on send, never by chunk replay, so
530
543
  // their timestamps are trustworthy.
531
544
  const canBeInSnapshot = (m.timestamp?.getTime() ?? 0) <= historyFetchedAt;
532
- return !(canBeInSnapshot && windowSignals.userContents.has(m.content));
545
+ return !(canBeInSnapshot && windowSignals.userContents.has(userTwinKey(m)));
533
546
  }
534
547
  // Freshness rule: a synthetic whose turn is represented in the snapshot
535
548
  // (under its persisted Mongo id) must be dropped or the turn renders
@@ -560,10 +573,11 @@ export function mergeHistoryWithRealtime<M extends MergeableChatMessage>(input:
560
573
  // already does for DIRECT/SYSTEM), which also stops the replay at the
561
574
  // source via a correct `optStartSeq`.
562
575
  if (m.role === 'user' && isUserRequestSyntheticId(m.id) && typeof m.content === 'string') {
563
- const seen = (seenUserSyntheticByContent.get(m.content) ?? 0) + 1;
564
- seenUserSyntheticByContent.set(m.content, seen);
576
+ const twinKey = userTwinKey(m);
577
+ const seen = (seenUserSyntheticByContent.get(twinKey) ?? 0) + 1;
578
+ seenUserSyntheticByContent.set(twinKey, seen);
565
579
  // No persisted row for THIS occurrence slot → keep (nothing renders it).
566
- if ((windowSignals.userContents.get(m.content) ?? 0) < seen) return true;
580
+ if ((windowSignals.userContents.get(twinKey) ?? 0) < seen) return true;
567
581
  // A same-text persisted twin exists for this slot. User rows carry no
568
582
  // persisted seq, so that twin may be THIS message's OWN row (drop — it
569
583
  // renders the message) OR an OLDER identical-text turn while this is a
@@ -582,7 +596,7 @@ export function mergeHistoryWithRealtime<M extends MergeableChatMessage>(input:
582
596
  if (typeof m.streamSeq !== 'number' || historyMaxStreamSeq <= 0) return false;
583
597
  if (historyMaxStreamSeq >= m.streamSeq) return false;
584
598
  const lastPersisted = processedToUse[processedToUse.length - 1];
585
- if (lastPersisted && lastPersisted.role === 'user' && lastPersisted.content === m.content) return false;
599
+ if (lastPersisted && userTwinKey(lastPersisted) === twinKey) return false;
586
600
  return true;
587
601
  }
588
602
  // Per-message seq coverage for the remaining synthetics (assistant /
@@ -701,10 +715,10 @@ export function computeHistoryPrepend<M extends MergeableChatMessage>(
701
715
  for (let i = newEnd - 1; i >= 0; i--) {
702
716
  const pm = processedHistory[i];
703
717
  if (pm.role === 'user') {
704
- const text = userText(pm);
705
- const left = text === '' ? 0 : (userTwinsLeft.get(text) ?? 0);
718
+ const key = userTwinKey(pm);
719
+ const left = key === '' ? 0 : (userTwinsLeft.get(key) ?? 0);
706
720
  if (left === 0) continue;
707
- userTwinsLeft.set(text, left - 1);
721
+ userTwinsLeft.set(key, left - 1);
708
722
  twinIndices.add(i);
709
723
  } else if (pm.role === 'assistant') {
710
724
  const keys = turnRequestKeys(pm.content);
@@ -119,6 +119,13 @@ const BUILDERS: Record<string, (ids: string[], base: string) => string> = {
119
119
  code_rule: (ids, b) => `${b}/api/code-rules/cards?ids=${ids.join(',')}`,
120
120
  code_repo: (ids, b) => `${b}/api/code-graph/repos?ids=${ids.join(',')}`,
121
121
  code_deployment: (ids, b) => `${b}/api/code-graph/deployments?ids=${ids.join(',')}`,
122
+ code_file: (ids, b) => `${b}/api/code-graph/files?ids=${ids.join(',')}`,
123
+ // `code_symbol` / `code_duplicate` ids are SYMBOL KEYS with their member
124
+ // separator re-spelled `~` (`codeGraphCardId`), because the ids are joined
125
+ // RAW here and the hub's `?ids=` reader refuses `#`.
126
+ code_symbol: (ids, b) => `${b}/api/code-graph/symbols?ids=${ids.join(',')}`,
127
+ code_duplicate: (ids, b) => `${b}/api/code-graph/duplicates?ids=${ids.join(',')}`,
128
+ code_impact: (ids, b) => `${b}/api/code-graph/impacts?ids=${ids.join(',')}`,
122
129
  };
123
130
 
124
131
  /**
@@ -84,6 +84,10 @@ export const SOURCE_ICON_NAMES: Record<string, string> = {
84
84
  'code-rules': 'check-square',
85
85
  'code-graph-repos': 'github',
86
86
  'code-graph-deployments': 'package',
87
+ 'code-graph-files': 'file-text',
88
+ 'code-symbols': 'box',
89
+ 'code-duplicates': 'search',
90
+ 'code-impact': 'activity',
87
91
  };
88
92
 
89
93
  /** Lookup an icon name by RagTableConfig.id. Returns undefined when
@@ -171,6 +175,10 @@ export const SOURCE_LABELS_BY_TABLE: Record<string, string> = {
171
175
  'code-rules': 'Code Rules',
172
176
  'code-graph-repos': 'Repositories',
173
177
  'code-graph-deployments': 'Deployments',
178
+ 'code-graph-files': 'Code Files',
179
+ 'code-symbols': 'Code Symbols',
180
+ 'code-duplicates': 'Duplicates',
181
+ 'code-impact': 'Change Impact',
174
182
  };
175
183
 
176
184
  /** Lookup a human-readable label by RagTableConfig.id. Falls back
@@ -260,6 +268,10 @@ export const DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID: Record<string, string> = {
260
268
  code_rule: 'code-rules',
261
269
  code_repo: 'code-graph-repos',
262
270
  code_deployment: 'code-graph-deployments',
271
+ code_file: 'code-graph-files',
272
+ code_symbol: 'code-symbols',
273
+ code_duplicate: 'code-duplicates',
274
+ code_impact: 'code-impact',
263
275
  };
264
276
 
265
277
  /**