@yadsh/dsh-qa-surface 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 (161) hide show
  1. package/CHANGELOG.md +84 -1
  2. package/README.md +87 -12
  3. package/compatibility.json +11 -3
  4. package/docs/ARCHITECTURE.md +1 -1
  5. package/docs/COMPATIBILITY.md +1 -1
  6. package/docs/CONFIGURATION.md +88 -1
  7. package/docs/SOURCES-MIGRATION.md +28 -0
  8. package/docs/SOURCES-PROVENANCE-AUDIT.md +88 -0
  9. package/docs/SPEC-dsh-qa-surface-accounts.md +219 -0
  10. package/docs/SPEC-dsh-qa-surface-sources-provenance.md +1692 -0
  11. package/lib/accounts/index.js +2 -0
  12. package/lib/accounts/index.js.map +1 -0
  13. package/lib/accounts/store.js +478 -0
  14. package/lib/accounts/store.js.map +1 -0
  15. package/lib/attestation.js.map +1 -1
  16. package/lib/cli.js +143 -0
  17. package/lib/cli.js.map +1 -0
  18. package/lib/client/QaAccountsController.js +329 -0
  19. package/lib/client/QaAccountsController.js.map +1 -0
  20. package/lib/client/QaSessionController.js +203 -127
  21. package/lib/client/QaSessionController.js.map +1 -1
  22. package/lib/client/QaSurface.js +234 -72
  23. package/lib/client/QaSurface.js.map +1 -1
  24. package/lib/client/QaTranscriptAdapter.js +27 -241
  25. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  26. package/lib/client/attestation.js +6 -0
  27. package/lib/client/attestation.js.map +1 -1
  28. package/lib/client/components/Markdown.js +54 -13
  29. package/lib/client/components/Markdown.js.map +1 -1
  30. package/lib/client/components/QaAuthGate.js +40 -0
  31. package/lib/client/components/QaAuthGate.js.map +1 -0
  32. package/lib/client/components/QaChangelog.js +112 -0
  33. package/lib/client/components/QaChangelog.js.map +1 -0
  34. package/lib/client/components/QaMessage.js +47 -17
  35. package/lib/client/components/QaMessage.js.map +1 -1
  36. package/lib/client/components/QaSidebar.js +63 -20
  37. package/lib/client/components/QaSidebar.js.map +1 -1
  38. package/lib/client/components/QaSourcesDrawer.js +113 -32
  39. package/lib/client/components/QaSourcesDrawer.js.map +1 -1
  40. package/lib/client/components/QaTurnRail.js +281 -0
  41. package/lib/client/components/QaTurnRail.js.map +1 -0
  42. package/lib/client/components/QaWelcomeNotice.js +125 -0
  43. package/lib/client/components/QaWelcomeNotice.js.map +1 -0
  44. package/lib/client/components/QaWidthHandle.js +142 -0
  45. package/lib/client/components/QaWidthHandle.js.map +1 -0
  46. package/lib/client/components/source-refs.js +78 -0
  47. package/lib/client/components/source-refs.js.map +1 -0
  48. package/lib/client/create-session.js +51 -0
  49. package/lib/client/create-session.js.map +1 -0
  50. package/lib/client/index.js +100 -12
  51. package/lib/client/index.js.map +1 -1
  52. package/lib/client/project-session-state.js +78 -0
  53. package/lib/client/project-session-state.js.map +1 -0
  54. package/lib/client/session-admission.js +38 -0
  55. package/lib/client/session-admission.js.map +1 -0
  56. package/lib/client/session-assets.js +52 -0
  57. package/lib/client/session-assets.js.map +1 -0
  58. package/lib/client/session-sources.js +61 -0
  59. package/lib/client/session-sources.js.map +1 -0
  60. package/lib/client/settlement.js +24 -0
  61. package/lib/client/settlement.js.map +1 -0
  62. package/lib/client/styles.js +151 -9
  63. package/lib/client/styles.js.map +1 -1
  64. package/lib/client/tool-presentation.js +102 -0
  65. package/lib/client/tool-presentation.js.map +1 -0
  66. package/lib/client/turn-sources.js +98 -0
  67. package/lib/client/turn-sources.js.map +1 -0
  68. package/lib/client/types.js +2 -0
  69. package/lib/client/types.js.map +1 -1
  70. package/lib/client/use-session-ui-state.js +68 -0
  71. package/lib/client/use-session-ui-state.js.map +1 -0
  72. package/lib/client/use-transcript-view.js +44 -0
  73. package/lib/client/use-transcript-view.js.map +1 -0
  74. package/lib/client.js +4649 -861
  75. package/lib/client.js.map +1 -1
  76. package/lib/config.js +218 -102
  77. package/lib/config.js.map +1 -1
  78. package/lib/entry-redirect.js +44 -0
  79. package/lib/entry-redirect.js.map +1 -0
  80. package/lib/host-route.js +25 -1
  81. package/lib/host-route.js.map +1 -1
  82. package/lib/index.js +209 -23
  83. package/lib/index.js.map +1 -1
  84. package/lib/launch-token.js +42 -0
  85. package/lib/launch-token.js.map +1 -0
  86. package/lib/provenance/collector.js +40 -0
  87. package/lib/provenance/collector.js.map +1 -0
  88. package/lib/provenance/connectors.js +147 -0
  89. package/lib/provenance/connectors.js.map +1 -0
  90. package/lib/provenance/dedupe.js +89 -0
  91. package/lib/provenance/dedupe.js.map +1 -0
  92. package/lib/provenance/extractors.js +340 -0
  93. package/lib/provenance/extractors.js.map +1 -0
  94. package/lib/provenance/file-preview.js +39 -0
  95. package/lib/provenance/file-preview.js.map +1 -0
  96. package/lib/provenance/host-store.js +387 -0
  97. package/lib/provenance/host-store.js.map +1 -0
  98. package/lib/provenance/index.js +9 -0
  99. package/lib/provenance/index.js.map +1 -0
  100. package/lib/provenance/normalize.js +128 -0
  101. package/lib/provenance/normalize.js.map +1 -0
  102. package/lib/provenance/reported.js +53 -0
  103. package/lib/provenance/reported.js.map +1 -0
  104. package/lib/provenance/types.js +2 -0
  105. package/lib/provenance/types.js.map +1 -0
  106. package/lib/resolve-config.js +161 -0
  107. package/lib/resolve-config.js.map +1 -1
  108. package/lib/secure-session.js +50 -8
  109. package/lib/secure-session.js.map +1 -1
  110. package/lib/typert.host.js +599 -6
  111. package/lib/typert.remote-client.d.ts +19 -3
  112. package/lib/typert.remote-client.js +471 -3
  113. package/lib/types/accounts/index.d.ts +2 -0
  114. package/lib/types/accounts/store.d.ts +121 -0
  115. package/lib/types/attestation.d.ts +1 -1
  116. package/lib/types/cli.d.ts +9 -0
  117. package/lib/types/client/QaAccountsController.d.ts +95 -0
  118. package/lib/types/client/QaConfigController.d.ts +1 -1
  119. package/lib/types/client/QaSessionController.d.ts +46 -7
  120. package/lib/types/client/QaSurface.d.ts +8 -3
  121. package/lib/types/client/QaTranscriptAdapter.d.ts +5 -10
  122. package/lib/types/client/components/Markdown.d.ts +11 -1
  123. package/lib/types/client/components/QaAgentsDrawer.d.ts +1 -1
  124. package/lib/types/client/components/QaAuthGate.d.ts +15 -0
  125. package/lib/types/client/components/QaChangelog.d.ts +21 -0
  126. package/lib/types/client/components/QaMessage.d.ts +10 -3
  127. package/lib/types/client/components/QaSidebar.d.ts +30 -2
  128. package/lib/types/client/components/QaSourcesDrawer.d.ts +15 -3
  129. package/lib/types/client/components/QaTurnRail.d.ts +59 -0
  130. package/lib/types/client/components/QaWelcomeNotice.d.ts +27 -0
  131. package/lib/types/client/components/QaWidthHandle.d.ts +36 -0
  132. package/lib/types/client/components/source-refs.d.ts +16 -0
  133. package/lib/types/client/create-session.d.ts +16 -0
  134. package/lib/types/client/index.d.ts +1 -0
  135. package/lib/types/client/project-session-state.d.ts +30 -0
  136. package/lib/types/client/session-admission.d.ts +23 -0
  137. package/lib/types/client/session-assets.d.ts +20 -0
  138. package/lib/types/client/session-sources.d.ts +28 -0
  139. package/lib/types/client/settlement.d.ts +6 -0
  140. package/lib/types/client/tool-presentation.d.ts +6 -0
  141. package/lib/types/client/turn-sources.d.ts +14 -0
  142. package/lib/types/client/types.d.ts +73 -9
  143. package/lib/types/client/use-session-ui-state.d.ts +35 -0
  144. package/lib/types/client/use-transcript-view.d.ts +20 -0
  145. package/lib/types/entry-redirect.d.ts +20 -0
  146. package/lib/types/host-route.d.ts +14 -1
  147. package/lib/types/index.d.ts +47 -3
  148. package/lib/types/launch-token.d.ts +21 -0
  149. package/lib/types/provenance/collector.d.ts +26 -0
  150. package/lib/types/provenance/connectors.d.ts +11 -0
  151. package/lib/types/provenance/dedupe.d.ts +6 -0
  152. package/lib/types/provenance/extractors.d.ts +14 -0
  153. package/lib/types/provenance/file-preview.d.ts +10 -0
  154. package/lib/types/provenance/host-store.d.ts +54 -0
  155. package/lib/types/provenance/index.d.ts +10 -0
  156. package/lib/types/provenance/normalize.d.ts +13 -0
  157. package/lib/types/provenance/reported.d.ts +5 -0
  158. package/lib/types/provenance/types.d.ts +78 -0
  159. package/lib/types/secure-session.d.ts +11 -2
  160. package/lib/types/types.d.ts +167 -11
  161. package/package.json +58 -41
@@ -33,13 +33,31 @@ const QA_BRAND_PALETTE = {
33
33
  warningHover: "#DF9911",
34
34
  // Text/icon color placed on top of an accent fill.
35
35
  accentContrast: "#FFFFFF",
36
+ // Translucent dialog backdrop over the conversation.
37
+ overlay: "rgba(15, 22, 26, 0.55)",
36
38
  };
37
39
  const QA_BRAND_TOKENS = Object.entries(QA_BRAND_PALETTE)
38
40
  .map(([token, value]) => `--dsh-qa-${token.replace(/[A-Z]/gu, (letter) => `-${letter.toLowerCase()}`)}:${value}`)
39
41
  .join(";");
40
42
  export const QA_SURFACE_STYLES = String.raw `
41
43
  .dsh-qa-surface{${QA_BRAND_TOKENS};position:fixed;inset:0;z-index:2147483000;pointer-events:auto;display:flex;flex-direction:row;min-width:0;height:100vh;height:100dvh;overflow:hidden;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-family:inherit}
44
+ .dsh-qa-onboarding{${QA_BRAND_TOKENS};position:fixed;inset:0;z-index:2147483640;display:grid;place-items:center;padding:24px;background:var(--dsh-qa-overlay);color:var(--dsw-alias-label-primary);font-family:inherit}
45
+ .dsh-qa-onboarding__panel{display:grid;grid-template-columns:auto minmax(0,1fr);gap:18px;width:min(620px,100%);max-height:100%;overflow-y:auto;padding:28px;border:1px solid var(--dsw-alias-border-l2);border-radius:18px;background:var(--dsw-alias-bg-layer-2);box-shadow:0 22px 64px rgba(0,0,0,.28)}
46
+ .dsh-qa-onboarding__mark{display:grid;place-items:center;width:44px;height:44px;border-radius:13px;background:var(--dsh-qa-accent-soft);color:var(--dsh-qa-accent-hover)}
47
+ .dsh-qa-onboarding__mark svg{width:25px;height:25px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
48
+ .dsh-qa-onboarding__content{min-width:0}
49
+ .dsh-qa-onboarding__title{margin:2px 0 12px;color:var(--dsw-alias-label-primary);font-size:20px;font-weight:650;line-height:1.35}
50
+ .dsh-qa-onboarding__description{color:var(--dsw-alias-label-secondary);font-size:14px;line-height:1.65}
51
+ .dsh-qa-onboarding__description p{margin:0 0 12px}
52
+ .dsh-qa-onboarding__description p:last-child{margin-bottom:0}
53
+ .dsh-qa-onboarding__actions{display:flex;justify-content:flex-end;margin-top:22px}
54
+ .dsh-qa-onboarding__continue{appearance:none;min-width:164px;padding:10px 18px;border:0;border-radius:999px;background:var(--dsh-qa-accent);color:var(--dsh-qa-accent-contrast);font:inherit;font-size:14px;font-weight:600;line-height:20px;cursor:pointer;transition:background .14s,transform .14s}
55
+ .dsh-qa-onboarding__continue:hover{background:var(--dsh-qa-accent-hover)}
56
+ .dsh-qa-onboarding__continue:active{transform:translateY(1px)}
57
+ .dsh-qa-onboarding__continue:focus-visible{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px}
58
+ @media (max-width:600px){.dsh-qa-onboarding{padding:14px}.dsh-qa-onboarding__panel{grid-template-columns:1fr;gap:12px;padding:22px;border-radius:15px}.dsh-qa-onboarding__mark{width:38px;height:38px;border-radius:11px}.dsh-qa-onboarding__title{font-size:18px}.dsh-qa-onboarding__actions{margin-top:18px}.dsh-qa-onboarding__continue{width:100%}}
42
59
  .dsh-qa-body{flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
60
+ .dsh-qa-chat{position:relative;flex:1;min-width:0;min-height:0;display:flex;flex-direction:column}
43
61
  .dsh-qa-sidebar{flex:none;width:264px;display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base)}
44
62
  .dsh-qa-sidebar--collapsed{width:52px;align-items:center;padding-top:12px}
45
63
  .dsh-qa-sidebar__head{display:flex;align-items:center;justify-content:space-between;gap:6px;flex:none;padding:14px 10px 10px 16px}
@@ -59,17 +77,25 @@ export const QA_SURFACE_STYLES = String.raw `
59
77
  .dsh-qa-sidebar__new:disabled{color:var(--dsw-alias-label-tertiary);cursor:default}
60
78
  .dsh-qa-sidebar__new svg{width:14px;height:14px;flex:none;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
61
79
  .dsh-qa-sidebar__search{position:relative;flex:none;padding:0 12px 10px}
62
- .dsh-qa-sidebar__search svg{position:absolute;top:7px;left:22px;width:14px;height:14px;fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round;pointer-events:none}
63
- .dsh-qa-sidebar__search input{display:block;width:100%;padding:7px 10px 7px 32px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:18px;-webkit-appearance:none;appearance:none}
80
+ .dsh-qa-sidebar__search>svg{position:absolute;top:17px;left:22px;width:14px;height:14px;fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round;pointer-events:none;transform:translateY(-50%)}
81
+ .dsh-qa-sidebar__search input{display:block;width:100%;height:34px;min-width:0;padding:0 34px 0 32px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:18px;-webkit-appearance:none;appearance:none}
82
+ .dsh-qa-sidebar__search input::-webkit-search-cancel-button{-webkit-appearance:none;appearance:none}
64
83
  .dsh-qa-sidebar__search input::placeholder{color:var(--dsw-alias-label-tertiary)}
65
84
  .dsh-qa-sidebar__search input:focus{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px;border-color:transparent}
85
+ .dsh-qa-sidebar__search-clear{position:absolute;top:17px;right:18px;display:grid;place-items:center;width:24px;height:24px;padding:0;border:0;border-radius:6px;background:transparent;color:var(--dsw-alias-label-tertiary);cursor:pointer;transform:translateY(-50%)}
86
+ .dsh-qa-sidebar__search-clear:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
87
+ .dsh-qa-sidebar__search-clear:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
88
+ .dsh-qa-sidebar__search-clear svg{width:12px;height:12px;fill:none;stroke:currentColor;stroke-width:1.35;stroke-linecap:round;stroke-linejoin:round}
66
89
  .dsh-qa-sidebar__list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 8px 12px}
90
+ .dsh-qa-sidebar__group{margin-top:6px}
91
+ .dsh-qa-sidebar__group:first-child{margin-top:0}
92
+ .dsh-qa-sidebar__group-name{padding:4px 6px 2px;color:var(--dsw-alias-label-tertiary);font-size:11px;font-weight:600;line-height:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
67
93
  .dsh-qa-sidebar__empty{margin:8px 8px 0;color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:18px}
68
- .dsh-qa-sidebar__item{display:flex;align-items:center;gap:2px;width:100%;padding:2px;border-radius:8px}
94
+ .dsh-qa-sidebar__item{position:relative;display:flex;align-items:center;width:100%;padding:2px;border-radius:8px}
69
95
  .dsh-qa-sidebar__item:hover,.dsh-qa-sidebar__item--active{background:var(--dsw-alias-bg-layer-2)}
70
- .dsh-qa-sidebar__item-main{appearance:none;display:flex;align-items:center;gap:8px;flex:1;min-width:0;border:0;background:0 0;cursor:pointer;text-align:left;font:inherit;padding:7px 6px;border-radius:8px}
96
+ .dsh-qa-sidebar__item-main{appearance:none;display:flex;align-items:center;gap:8px;width:100%;min-width:0;border:0;background:0 0;cursor:pointer;text-align:left;font:inherit;padding:7px 8px;border-radius:8px}
71
97
  .dsh-qa-sidebar__item-main:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
72
- .dsh-qa-sidebar__item-delete{appearance:none;flex:none;display:flex;align-items:center;justify-content:center;border:0;background:0 0;cursor:pointer;color:var(--dsw-alias-label-tertiary);padding:5px;border-radius:6px;opacity:0;transition:opacity .12s}
98
+ .dsh-qa-sidebar__item-delete{appearance:none;position:absolute;top:50%;right:4px;display:flex;align-items:center;justify-content:center;width:26px;height:26px;border:0;background:var(--dsw-alias-bg-layer-2);cursor:pointer;color:var(--dsw-alias-label-tertiary);padding:5px;border-radius:6px;opacity:0;transform:translateY(-50%);transition:opacity .12s}
73
99
  .dsh-qa-sidebar__item:hover .dsh-qa-sidebar__item-delete,.dsh-qa-sidebar__item-delete:focus-visible,.dsh-qa-sidebar__item-delete--confirm{opacity:1}
74
100
  .dsh-qa-sidebar__item-delete:hover{color:var(--dsw-alias-label-primary)}
75
101
  .dsh-qa-sidebar__item-delete:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
@@ -79,6 +105,55 @@ export const QA_SURFACE_STYLES = String.raw `
79
105
  .dsh-qa-sidebar__item--active .dsh-qa-sidebar__item-title{color:var(--dsw-alias-label-primary);font-weight:500}
80
106
  .dsh-qa-sidebar__item-meta{flex:none;display:flex;align-items:center;gap:5px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:14px}
81
107
  .dsh-qa-sidebar__dot{width:7px;height:7px;border-radius:999px;background:var(--dsh-qa-brand);flex:none}
108
+ .dsh-qa-sidebar__footer{flex:none;padding:8px 16px 12px;border-top:1px solid var(--dsw-alias-border-l2)}
109
+ .dsh-qa-sidebar__version{appearance:none;display:inline-flex;align-items:center;padding:2px 0;border:0;background:0 0;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:12px;line-height:16px;cursor:pointer;transition:color .12s}
110
+ .dsh-qa-sidebar__version:hover{color:var(--dsw-alias-label-primary)}
111
+ .dsh-qa-sidebar__version:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:2px;border-radius:4px}
112
+ .dsh-qa-sidebar__account{display:flex;align-items:center;gap:6px;min-width:0;margin-bottom:6px}
113
+ .dsh-qa-sidebar__account-name{min-width:0;overflow:hidden;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
114
+ .dsh-qa-sidebar__account-role{flex:none;padding:1px 6px;border-radius:999px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-tertiary);font-size:10px;font-weight:500;line-height:15px}
115
+ .dsh-qa-sidebar__account-exit{appearance:none;display:grid;place-items:center;flex:none;width:24px;height:24px;padding:0;border:0;border-radius:7px;background:0 0;color:var(--dsw-alias-label-tertiary);cursor:pointer}
116
+ .dsh-qa-sidebar__account-exit:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
117
+ .dsh-qa-sidebar__account-exit:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
118
+ .dsh-qa-sidebar__account-exit svg{width:13px;height:13px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
119
+ .dsh-qa-auth{align-items:center;justify-content:center;padding:24px}
120
+ .dsh-qa-auth__card{display:flex;flex-direction:column;gap:14px;width:min(360px,100%);padding:28px;border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-layer-2);box-shadow:0 18px 48px var(--dsh-qa-overlay)}
121
+ .dsh-qa-auth__brand{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
122
+ .dsh-qa-auth__logo{width:32px;height:32px;fill:none;stroke:var(--dsh-qa-brand);stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
123
+ .dsh-qa-auth__brand h1{margin:0;color:var(--dsw-alias-label-primary);font-size:19px;font-weight:600;line-height:26px}
124
+ .dsh-qa-auth__tabs{display:flex;gap:4px;padding:3px;border-radius:9px;background:var(--dsw-alias-bg-module-platform)}
125
+ .dsh-qa-auth__tab{appearance:none;flex:1;padding:6px 0;border:0;border-radius:7px;background:0 0;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;font-weight:500;line-height:18px;cursor:pointer;transition:background .12s,color .12s}
126
+ .dsh-qa-auth__tab:hover{color:var(--dsw-alias-label-primary)}
127
+ .dsh-qa-auth__tab--active{background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}
128
+ .dsh-qa-auth__tab:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
129
+ .dsh-qa-auth__field{display:flex;flex-direction:column;gap:5px}
130
+ .dsh-qa-auth__field span{color:var(--dsw-alias-label-secondary);font-size:12px;line-height:16px}
131
+ .dsh-qa-auth__field input{appearance:none;width:100%;padding:9px 11px;border:1px solid var(--dsw-alias-border-l2);border-radius:9px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:14px;line-height:20px}
132
+ .dsh-qa-auth__field input:focus{outline:none;border-color:var(--dsh-qa-brand)}
133
+ .dsh-qa-auth__field input:disabled{opacity:.55}
134
+ .dsh-qa-auth__error{margin:0;color:var(--dsh-qa-error);font-size:12px;line-height:17px}
135
+ .dsh-qa-auth__submit{appearance:none;margin-top:2px;padding:10px 0;border:0;border-radius:9px;background:var(--dsh-qa-brand);color:var(--dsh-qa-accent-contrast);font:inherit;font-size:14px;font-weight:600;line-height:20px;cursor:pointer;transition:background .12s}
136
+ .dsh-qa-auth__submit:hover{background:var(--dsh-qa-accent-hover)}
137
+ .dsh-qa-auth__submit:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:2px}
138
+ .dsh-qa-auth__submit:disabled{opacity:.6;cursor:default}
139
+ .dsh-qa-changelog{position:fixed;inset:0;z-index:2147483600;display:grid;place-items:center;padding:24px;background:var(--dsh-qa-overlay)}
140
+ .dsh-qa-changelog__panel{display:flex;flex-direction:column;width:min(560px,100%);max-height:min(640px,100%);border:1px solid var(--dsw-alias-border-l2);border-radius:14px;background:var(--dsw-alias-bg-layer-2);box-shadow:0 18px 48px var(--dsh-qa-overlay);overflow:hidden}
141
+ .dsh-qa-changelog__head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:none;padding:16px 18px 12px;border-bottom:1px solid var(--dsw-alias-border-l2)}
142
+ .dsh-qa-changelog__title{margin:0;color:var(--dsw-alias-label-primary);font-size:15px;font-weight:600;line-height:20px}
143
+ .dsh-qa-changelog__close{appearance:none;display:grid;place-items:center;flex:none;width:28px;height:28px;padding:0;border:0;border-radius:8px;background:0 0;color:var(--dsw-alias-label-tertiary);cursor:pointer}
144
+ .dsh-qa-changelog__close:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary)}
145
+ .dsh-qa-changelog__close:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
146
+ .dsh-qa-changelog__close svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round}
147
+ .dsh-qa-changelog__body{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:6px 18px 18px}
148
+ .dsh-qa-changelog__entry{padding-top:10px}
149
+ .dsh-qa-changelog__version{display:flex;align-items:baseline;gap:8px;margin:0 0 2px;color:var(--dsw-alias-label-primary);font-size:13px;font-weight:600;line-height:20px}
150
+ .dsh-qa-changelog__date{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:16px}
151
+ .dsh-qa-changelog__current{padding:0 8px;border-radius:999px;background:var(--dsh-qa-accent-soft);color:var(--dsh-qa-accent-hover);font-size:11px;font-weight:500;line-height:17px;white-space:nowrap}
152
+ .dsh-qa-changelog__section{margin:6px 0 0}
153
+ .dsh-qa-changelog__section-title{margin:0;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600;line-height:18px}
154
+ .dsh-qa-changelog__list{margin:4px 0 0;padding-left:18px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
155
+ .dsh-qa-changelog__list li{margin:3px 0}
156
+ .dsh-qa-changelog__list li::marker{color:var(--dsw-alias-label-tertiary)}
82
157
  .dsh-qa-surface *{box-sizing:border-box}
83
158
  .dsh-qa-surface ::selection{background:var(--dsh-qa-text-select)}
84
159
  .dsh-qa-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@@ -139,7 +214,14 @@ export const QA_SURFACE_STYLES = String.raw `
139
214
  .dsh-qa-header__tabs span{position:relative;padding:0 0 11px;color:var(--dsh-qa-accent);font-size:13px;font-weight:500;line-height:16px}
140
215
  .dsh-qa-header__tabs span::after{content:"";position:absolute;right:0;bottom:1px;left:0;height:2px;border-radius:2px;background:var(--dsh-qa-accent)}
141
216
  .dsh-qa-transcript{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
142
- .dsh-qa-transcript__inner{width:100%;min-height:100%;margin:0 auto;padding:18px 16px 42px}
217
+ .dsh-qa-transcript__inner{width:100%;max-width:var(--dsh-qa-content-width);min-height:100%;margin:0 auto;padding:18px 16px 42px}
218
+ .dsh-qa-width-handle{position:absolute;z-index:8;top:0;bottom:0;width:max(0px,min(40px,calc((100% - var(--dsh-qa-content-width)) / 2 - 48px)));cursor:col-resize;touch-action:none;user-select:none}
219
+ .dsh-qa-width-handle[data-side="left"]{right:calc(50% + var(--dsh-qa-content-width) / 2 + 24px)}
220
+ .dsh-qa-width-handle[data-side="right"]{left:calc(50% + var(--dsh-qa-content-width) / 2 + 24px)}
221
+ .dsh-qa-width-handle::after{content:"";position:absolute;top:0;bottom:0;width:3px;border-radius:3px;background:linear-gradient(to bottom,transparent calc(var(--dsh-qa-width-handle-pointer-y,50%) - 52px),var(--dsw-alias-scrollbar-hover-l1) calc(var(--dsh-qa-width-handle-pointer-y,50%) - 12px),var(--dsw-alias-scrollbar-hover-l1) calc(var(--dsh-qa-width-handle-pointer-y,50%) + 12px),transparent calc(var(--dsh-qa-width-handle-pointer-y,50%) + 52px));opacity:0;pointer-events:none}
222
+ .dsh-qa-width-handle[data-side="left"]::after{right:16px}
223
+ .dsh-qa-width-handle[data-side="right"]::after{left:16px}
224
+ .dsh-qa-width-handle:hover::after,.dsh-qa-width-handle[data-dragging]::after{opacity:1}
143
225
  .dsh-qa-welcome{min-height:calc(100% - 40px);display:flex;flex-direction:column;justify-content:center;align-items:center;text-align:center;padding:48px 0 88px}
144
226
  .dsh-qa-welcome h2{max-width:620px;margin:0;color:var(--dsw-alias-label-primary);font-size:clamp(25px,4vw,34px);font-weight:600;line-height:1.24;letter-spacing:-.02em}
145
227
  .dsh-qa-welcome p{max-width:520px;margin:10px 0 0;color:var(--dsw-alias-label-tertiary);font-size:14px;line-height:21px}
@@ -158,6 +240,13 @@ export const QA_SURFACE_STYLES = String.raw `
158
240
  .dsh-qa-sources__head button:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:-2px}
159
241
  .dsh-qa-sources__head button svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round}
160
242
  .dsh-qa-sources__list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:0 10px 12px}
243
+ .dsh-qa-sources__group{margin:0 0 14px}
244
+ .dsh-qa-sources__group h3{display:flex;align-items:center;gap:7px;margin:4px 4px 8px;color:var(--dsw-alias-label-secondary);font-size:12px;font-weight:600;line-height:18px}
245
+ .dsh-qa-sources__group h3 span{display:inline-grid;place-items:center;min-width:19px;height:18px;padding:0 5px;border-radius:999px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-tertiary);font-size:10px}
246
+ .dsh-qa-sources__incomplete{margin:0 2px 12px;padding:9px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:9px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:12px;line-height:17px}
247
+ .dsh-qa-sources__more{appearance:none;width:100%;padding:5px;border:0;background:transparent;color:var(--dsh-qa-accent);font:inherit;font-size:12px;cursor:pointer}
248
+ .dsh-qa-sources__badges{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}
249
+ .dsh-qa-sources__badges>span{padding:1px 6px;border-radius:999px;background:var(--dsw-alias-bg-module-platform);color:var(--dsw-alias-label-secondary);font-size:10px;line-height:15px}
161
250
  button.dsh-qa-sources__item{display:flex;gap:10px;width:100%;margin:0 0 8px;padding:10px 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:12px;background:var(--dsw-alias-bg-layer-2);font:inherit;text-align:left;cursor:pointer;transition:border-color .12s}
162
251
  .dsh-qa-sources__kind{display:grid;place-items:center;width:18px;height:18px;flex:none;margin-top:1px;color:var(--dsw-alias-label-tertiary)}
163
252
  .dsh-qa-sources__kind svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.2;stroke-linecap:round;stroke-linejoin:round}
@@ -185,6 +274,21 @@ a.dsh-qa-sources__title:hover{text-decoration:underline}
185
274
  .dsh-qa-sourcedetail__body a{color:var(--dsh-qa-accent);text-decoration:underline}
186
275
  .dsh-qa-sourcedetail__body p{margin:0}
187
276
  .dsh-qa-sourcedetail__empty{margin:0;color:var(--dsw-alias-label-tertiary)}
277
+ .dsh-qa-sourcedetail__provenance{display:flex;flex-wrap:wrap;gap:3px 10px;margin-top:10px!important;color:var(--dsw-alias-label-tertiary)}
278
+ .dsh-qa-preview__toggle{display:flex;flex:none;padding:2px;border:1px solid var(--dsw-alias-border-l2);border-radius:8px;background:var(--dsw-alias-bg-layer-3)}
279
+ .dsh-qa-preview__toggle button{appearance:none;padding:2px 7px;border:0;border-radius:5px;background:transparent;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:10px;line-height:16px;cursor:pointer}
280
+ .dsh-qa-preview__toggle button[aria-pressed="true"]{background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-primary)}
281
+ .dsh-qa-preview__toggle button:disabled{opacity:.45;cursor:not-allowed}
282
+ .dsh-qa-preview__notice{margin:0 0 9px!important;padding:7px 9px;border-radius:7px;background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-secondary)}
283
+ .dsh-qa-preview__range{display:flex;align-items:center;gap:8px;margin:0 0 9px!important;color:var(--dsw-alias-label-secondary);font-size:11px}
284
+ .dsh-qa-preview__range button{appearance:none;padding:1px 6px;border:0;background:transparent;color:var(--dsh-qa-accent);font:inherit;font-size:11px;cursor:pointer}
285
+ .dsh-qa-preview__markdown{white-space:normal;color:var(--dsw-alias-label-primary);font-size:13px;line-height:1.6}
286
+ .dsh-qa-preview__markdown p,.dsh-qa-preview__markdown ul,.dsh-qa-preview__markdown ol,.dsh-qa-preview__markdown blockquote,.dsh-qa-preview__markdown pre,.dsh-qa-preview__markdown table{margin:0 0 10px}
287
+ .dsh-qa-preview__raw{max-width:100%;margin:0;overflow:auto;white-space:pre;background:var(--dsw-alias-bg-layer-3);font:11px/18px ui-monospace,SFMono-Regular,Consolas,monospace}
288
+ .dsh-qa-preview__raw code{display:block;min-width:max-content}
289
+ .dsh-qa-preview__line{display:flex;min-height:18px}
290
+ .dsh-qa-preview__line--highlight{background:var(--dsw-alias-interactive-bg-hover)}
291
+ .dsh-qa-preview__number{width:46px;flex:none;padding-right:10px;color:var(--dsw-alias-label-tertiary);text-align:right;user-select:none}
188
292
  .dsh-qa-message{display:flex;flex-direction:column;width:100%;min-width:0;margin:0 0 20px}
189
293
  .dsh-qa-message--user{align-items:flex-end;margin-left:auto}
190
294
  .dsh-qa-message--assistant{align-items:flex-start;margin-right:auto}
@@ -192,6 +296,7 @@ a.dsh-qa-sources__title:hover{text-decoration:underline}
192
296
  .dsh-qa-message--system{align-items:center;margin:4px auto 20px}
193
297
  .dsh-qa-message__content{max-width:100%;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dsw-alias-label-primary);font-size:15px;line-height:1.62}
194
298
  .dsh-qa-message--user .dsh-qa-message__content{max-width:min(525px,82%);padding:10px 16px;border-radius:22px;background:var(--dsw-specific-bubble);font-size:16px;line-height:24px}
299
+ .dsh-qa-message__byline{display:block;margin-bottom:2px;color:var(--dsw-alias-label-secondary);font-size:12px;line-height:16px;font-weight:500}
195
300
  .dsh-qa-message__images{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 8px}
196
301
  .dsh-qa-message--user .dsh-qa-message__images{justify-content:flex-end}
197
302
  .dsh-qa-message__image{display:block;width:132px;height:96px;border-radius:12px;border:1px solid var(--dsw-alias-border-l2);object-fit:cover;background:var(--dsw-alias-bg-layer-2)}
@@ -200,6 +305,9 @@ span.dsh-qa-message__image{display:grid;place-items:center;color:var(--dsw-alias
200
305
  span.dsh-qa-message__image[data-state="broken"]::after{content:"Не удалось загрузить"}
201
306
  span.dsh-qa-message__image[data-state="loading"]{animation:dsh-qa-spin 1.2s linear infinite;border-style:dashed}
202
307
  .dsh-qa-message--assistant .dsh-qa-message__content{width:100%;padding:2px 0}
308
+ .dsh-qa-message__sources{appearance:none;margin-top:10px;padding:4px 9px;border:1px solid var(--dsw-alias-border-l2);border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font:inherit;font-size:12px;line-height:18px;cursor:pointer}
309
+ .dsh-qa-message__sources:hover{border-color:var(--dsw-alias-label-dimmed);color:var(--dsw-alias-label-primary)}
310
+ .dsh-qa-message__sources:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:1px}
203
311
  .dsh-qa-message--system .dsh-qa-message__content{padding:7px 11px;border-radius:9px;background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
204
312
  .dsh-qa-message[data-status="info"] .dsh-qa-message__content{color:var(--dsh-qa-info)}
205
313
  .dsh-qa-message[data-status="error"] .dsh-qa-message__content{color:var(--dsh-qa-error)}
@@ -212,6 +320,40 @@ span.dsh-qa-message__image[data-state="loading"]{animation:dsh-qa-spin 1.2s line
212
320
  .dsh-qa-message__actions button[data-active]{color:var(--dsh-qa-accent)}
213
321
  .dsh-qa-message__actions button[data-active]:hover{color:var(--dsh-qa-accent)}
214
322
  .dsh-qa-message__meta{display:flex;align-items:center;gap:12px;min-width:0;padding:0 8px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:20px;white-space:nowrap}
323
+ .dsh-qa-rail{position:sticky;top:0;z-index:7;height:0;pointer-events:none}.dsh-qa-rail__frame{--dsh-qa-rail-band:320px;--dsh-qa-rail-natural:0px;--dsh-qa-rail-inset:6px;--dsh-qa-rail-scroll-top:0px;--dsh-qa-rail-preview-height:100px;position:absolute;top:calc(var(--dsh-qa-rail-band)/2);right:12px;width:28px;height:min(var(--dsh-qa-rail-natural),max(0px,calc(var(--dsh-qa-rail-band) - 64px)),420px);cursor:pointer;pointer-events:auto;transform:translateY(-50%);transition:height 220ms cubic-bezier(.2,.8,.2,1)}
324
+ .dsh-qa-rail__scroll{position:absolute;inset:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:none}
325
+ .dsh-qa-rail__scroll::-webkit-scrollbar{display:none}
326
+ .dsh-qa-rail__scroll--fade-top{mask-image:linear-gradient(to bottom,transparent 0,#000 24px,#000 100%)}
327
+ .dsh-qa-rail__scroll--fade-bottom{mask-image:linear-gradient(to bottom,#000 0,#000 calc(100% - 24px),transparent 100%)}
328
+ .dsh-qa-rail__scroll--fade-top.dsh-qa-rail__scroll--fade-bottom{mask-image:linear-gradient(to bottom,transparent 0,#000 24px,#000 calc(100% - 24px),transparent 100%)}
329
+ .dsh-qa-rail__marks{position:relative;height:var(--dsh-qa-rail-natural)}
330
+ .dsh-qa-rail__pos{position:absolute;top:calc(var(--dsh-qa-rail-pos) + var(--dsh-qa-rail-inset));right:0;left:0;height:10px;transform:translateY(-50%);transition:top 220ms cubic-bezier(.2,.8,.2,1);animation:dsh-qa-rail-enter 150ms ease-out}
331
+ .dsh-qa-rail__mark{position:absolute;inset:0 0 0 auto;width:20px;padding:0;border:0;border-radius:8px;background:transparent;cursor:pointer;pointer-events:none}
332
+ .dsh-qa-rail__mark::before{position:absolute;top:50%;right:0;width:12px;height:2px;border-radius:2px;background:var(--dsw-alias-border-l4,var(--dsw-alias-border-l2));content:"";transform:translateY(-50%);transition:width 140ms ease,background-color 140ms ease}
333
+ .dsh-qa-rail__mark--preview::before{width:18px;background:var(--dsw-alias-label-tertiary)}
334
+ .dsh-qa-rail__mark--busy::before{animation:dsh-qa-rail-busy 1s ease-in-out infinite}
335
+ .dsh-qa-rail__mark--active::before{width:20px;background:var(--dsw-alias-label-primary)}
336
+ .dsh-qa-rail__mark:focus-visible{outline:1px solid var(--dsh-qa-accent);outline-offset:2px}
337
+ .dsh-qa-rail__mark:focus-visible::before{width:20px;background:var(--dsh-qa-accent)}
338
+ .dsh-qa-rail__preview{position:absolute;top:clamp(0px,calc(var(--dsh-qa-rail-pos) + var(--dsh-qa-rail-inset) - var(--dsh-qa-rail-scroll-top) - var(--dsh-qa-rail-preview-height)/2),calc(100% - var(--dsh-qa-rail-preview-height)));right:calc(100% + 10px);box-sizing:border-box;width:min(300px,60vw);max-height:var(--dsh-qa-rail-preview-height);overflow:hidden;padding:10px 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-shadow-lv2);pointer-events:none;animation:dsh-qa-rail-preview-enter 120ms ease-out;transition:top 140ms cubic-bezier(.2,.8,.2,1)}
339
+ .dsh-qa-rail__preview-prompt,.dsh-qa-rail__preview-response{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical}
340
+ .dsh-qa-rail__preview-prompt{font-size:13px;font-weight:600;line-height:18px;-webkit-line-clamp:1}
341
+ .dsh-qa-rail__preview-response{margin-top:4px;color:var(--dsw-alias-label-caption,var(--dsw-alias-label-tertiary));font-size:12px;line-height:17px;-webkit-line-clamp:3}
342
+ @keyframes dsh-qa-rail-enter{from{opacity:0}to{opacity:1}}
343
+ @keyframes dsh-qa-rail-preview-enter{from{opacity:0;transform:translateX(4px)}to{opacity:1;transform:translateX(0)}}
344
+ @keyframes dsh-qa-rail-busy{0%,100%{opacity:1}50%{opacity:.35}}
345
+ @media (max-width:900px){.dsh-qa-rail{display:none}}
346
+ .dsh-qa-srcref{position:relative;display:inline-flex;align-items:center;gap:5px;max-width:320px;margin:0 1px;padding:2px 9px 2px 7px;border:1px solid var(--dsw-alias-border-l2);border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary);font-size:13px;line-height:18px;font-weight:500;text-decoration:none;vertical-align:baseline;cursor:pointer;transition:border-color .12s,color .12s}
347
+ a.dsh-qa-srcref:hover,button.dsh-qa-srcref:hover{border-color:var(--dsw-alias-label-dimmed);color:var(--dsw-alias-label-primary)}
348
+ .dsh-qa-srcref:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:1px}
349
+ .dsh-qa-srcref__icon{display:grid;place-items:center;width:14px;height:14px;flex:none;color:var(--dsw-alias-label-tertiary)}
350
+ .dsh-qa-srcref__icon svg{width:13px;height:13px;display:block;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round;stroke-linejoin:round}
351
+ .dsh-qa-srcref__label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
352
+ .dsh-qa-srcref__card{position:absolute;top:calc(100% + 6px);left:0;z-index:9;display:none;width:min(320px,calc(100vw - 48px));padding:10px 12px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);box-shadow:var(--dsw-shadow-lv2);color:var(--dsw-alias-label-primary);font-size:12px;line-height:17px;font-weight:400;text-align:left;white-space:normal;cursor:default}
353
+ .dsh-qa-srcref:hover .dsh-qa-srcref__card,.dsh-qa-srcref:focus-visible .dsh-qa-srcref__card{display:block}
354
+ .dsh-qa-srcref__card-title{display:flex;align-items:center;gap:6px;min-width:0;overflow:hidden;color:var(--dsw-alias-label-primary);font-weight:600;text-overflow:ellipsis;white-space:nowrap}
355
+ .dsh-qa-srcref__card-target{display:block;overflow:hidden;margin-top:2px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;text-overflow:ellipsis;white-space:nowrap}
356
+ .dsh-qa-srcref__card-snippet{display:-webkit-box;overflow:hidden;margin-top:6px;color:var(--dsw-alias-label-secondary);-webkit-box-orient:vertical;-webkit-line-clamp:3}
215
357
 
216
358
  .dsh-qa-message__content p,.dsh-qa-message__content ul,.dsh-qa-message__content blockquote,.dsh-qa-message__content pre{margin:0 0 14px}
217
359
  .dsh-qa-message__content :last-child{margin-bottom:0}
@@ -277,7 +419,7 @@ span.dsh-qa-message__image[data-state="loading"]{animation:dsh-qa-spin 1.2s line
277
419
  .dsh-qa-error{display:flex;align-items:center;justify-content:center;gap:10px;margin:16px auto;padding:10px 12px;border:1px solid var(--dsh-qa-error);border-radius:10px;color:var(--dsw-alias-label-primary);font-size:13px}
278
420
  .dsh-qa-error button{border:0;background:transparent;color:var(--dsh-qa-accent);font:inherit;font-weight:600;cursor:pointer}
279
421
  .dsh-qa-footer{position:relative;flex:none;padding:28px 16px max(12px,env(safe-area-inset-bottom));background:linear-gradient(180deg,color-mix(in srgb,var(--dsw-alias-bg-base) 0%,transparent) 0,var(--dsw-alias-bg-base) 28px)}
280
- .dsh-qa-footer__inner{width:100%;margin:0 auto}
422
+ .dsh-qa-footer__inner{width:100%;max-width:var(--dsh-qa-content-width);margin:0 auto}
281
423
  .dsh-qa-composer-wrap{display:flex;flex-direction:column;gap:10px;width:100%}
282
424
  .dsh-qa-footer__disclaimer{display:flex;align-items:flex-start;justify-content:center;gap:6px;margin:10px auto 0;max-width:640px;color:var(--dsw-alias-label-tertiary);font-size:11px;line-height:16px;text-align:left}
283
425
  .dsh-qa-footer__disclaimer svg{width:13px;height:13px;flex:none;margin-top:1px;fill:none;stroke:currentColor;stroke-width:1.2;stroke-linecap:round}
@@ -316,8 +458,8 @@ span.dsh-qa-message__image[data-state="loading"]{animation:dsh-qa-spin 1.2s line
316
458
  .dsh-qa-composer__action:disabled{opacity:.4;cursor:default}
317
459
  .dsh-qa-composer__action:focus-visible,.dsh-qa-error button:focus-visible,.dsh-qa-header__reset:focus-visible{outline:2px solid var(--dsh-qa-accent);outline-offset:2px}
318
460
  @media (hover:hover){.dsh-qa-message__actions .dsh-qa-message__meta{opacity:0;transition:opacity 80ms ease}.dsh-qa-message:hover .dsh-qa-message__actions .dsh-qa-message__meta,.dsh-qa-message:focus-within .dsh-qa-message__actions .dsh-qa-message__meta,.dsh-qa-message__actions[data-persistent] .dsh-qa-message__meta{opacity:1}}.dsh-qa-message__actions[data-persistent] .dsh-qa-message__meta{opacity:1}
319
- @media (max-width:600px){.dsh-qa-sidebar{display:none}.dsh-qa-sources,.dsh-qa-agents{position:absolute;inset:0;z-index:6;width:100%;border-left:0}.dsh-qa-header__inner{padding-left:16px;padding-right:16px}.dsh-qa-header h1{max-width:48vw}.dsh-qa-header__mode{font-size:12px}.dsh-qa-transcript__inner{padding:16px 16px 28px}.dsh-qa-message{margin-bottom:16px}.dsh-qa-message--user .dsh-qa-message__content{max-width:88%;font-size:15px}.dsh-qa-message__content{font-size:14px}.dsh-qa-footer{padding-left:10px;padding-right:10px;padding-bottom:max(8px,env(safe-area-inset-bottom))}.dsh-qa-composer{min-height:84px;padding-top:12px}.dsh-qa-composer__hint{font-size:0}.dsh-qa-composer__hint::after{content:"Enter: отправить";font-size:11px}}
461
+ @media (max-width:600px){.dsh-qa-sidebar{display:none}.dsh-qa-sources,.dsh-qa-agents{position:absolute;inset:0;z-index:6;width:100%;border-left:0}.dsh-qa-header__inner{padding-left:16px;padding-right:16px}.dsh-qa-header h1{max-width:48vw}.dsh-qa-header__mode{font-size:12px}.dsh-qa-width-handle{display:none}.dsh-qa-transcript__inner{max-width:100%;padding:16px 16px 28px}.dsh-qa-footer__inner{max-width:100%}.dsh-qa-message{margin-bottom:16px}.dsh-qa-message--user .dsh-qa-message__content{max-width:88%;font-size:15px}.dsh-qa-message__content{font-size:14px}.dsh-qa-footer{padding-left:10px;padding-right:10px;padding-bottom:max(8px,env(safe-area-inset-bottom))}.dsh-qa-composer{min-height:84px;padding-top:12px}.dsh-qa-composer__hint{font-size:0}.dsh-qa-composer__hint::after{content:"Enter: отправить";font-size:11px}}
320
462
  @media (max-height:480px) and (orientation:landscape){.dsh-qa-header__inner{padding-top:6px}.dsh-qa-header__tabs{display:none}.dsh-qa-transcript__inner{padding-top:12px}.dsh-qa-footer{padding-top:12px}.dsh-qa-composer{min-height:72px;gap:4px;padding-top:8px}}
321
- @media (prefers-reduced-motion:reduce){.dsh-qa-message__cursor,.dsh-qa-work__spinner,.dsh-qa-work-item__spinner{animation:none}.dsh-qa-work__chevron{transition:none}}
463
+ @media (prefers-reduced-motion:reduce){.dsh-qa-message__cursor,.dsh-qa-work__spinner,.dsh-qa-work-item__spinner{animation:none}.dsh-qa-work__chevron{transition:none}.dsh-qa-rail__frame,.dsh-qa-rail__pos,.dsh-qa-rail__mark::before,.dsh-qa-rail__mark--busy::before,.dsh-qa-rail__preview{transition:none;animation:none}}
322
464
  `;
323
465
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/client/styles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,gBAAgB,GAAG;IACvB,KAAK,EAAE,SAAS;IAChB,yDAAyD;IACzD,MAAM,EAAE,SAAS;IACjB,UAAU,EAAE,SAAS;IACrB,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,SAAS;IACtB,uBAAuB;IACvB,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,kBAAkB;IAClB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,gBAAgB;IAChB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,SAAS;IACrB,yBAAyB;IACzB,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,YAAY,EAAE,SAAS;IACvB,mDAAmD;IACnD,cAAc,EAAE,SAAS;CACjB,CAAC;AAEX,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;KACrD,GAAG,CACF,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CACjB,YAAY,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MA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E,wBAAwB;CACzB,CAAC;AAEX,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;KACrD,GAAG,CACF,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,EAAE,CACjB,YAAY,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAC1F;KACA,IAAI,CAAC,GAAG,CAAC,CAAC;AAEb,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAA;kBACzB,eAAe;qBACZ,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoanC,CAAC"}
@@ -0,0 +1,102 @@
1
+ function firstLine(value) {
2
+ return value.split(/\r?\n/u, 1)[0]?.trim() ?? "";
3
+ }
4
+ function truncate(value, length = 140) {
5
+ return value.length <= length ? value : `${value.slice(0, length - 3)}...`;
6
+ }
7
+ export function flattenToolOutput(node) {
8
+ const parts = node.content.map((block) => block.type === "text" ? block.text : JSON.stringify(block, null, 2));
9
+ if (parts.length === 0 && node.error !== undefined) {
10
+ parts.push(`${node.error.name}: ${node.error.code}`);
11
+ }
12
+ return parts.join("\n") || null;
13
+ }
14
+ function formatToolInput(argsRaw) {
15
+ if (argsRaw === "")
16
+ return null;
17
+ try {
18
+ return JSON.stringify(JSON.parse(argsRaw), null, 2);
19
+ }
20
+ catch {
21
+ return argsRaw;
22
+ }
23
+ }
24
+ function toolSummary(name, argsRaw) {
25
+ try {
26
+ const parsed = JSON.parse(argsRaw);
27
+ if (typeof parsed === "object" && parsed !== null) {
28
+ const values = parsed;
29
+ for (const key of [
30
+ "description",
31
+ "path",
32
+ "file_path",
33
+ "query",
34
+ "pattern",
35
+ "url",
36
+ "command",
37
+ ]) {
38
+ const value = values[key];
39
+ if (typeof value === "string" && value.trim() !== "") {
40
+ return truncate(firstLine(value));
41
+ }
42
+ }
43
+ const fallback = Object.values(values).find((value) => typeof value === "string" && value.trim() !== "");
44
+ if (fallback !== undefined)
45
+ return truncate(firstLine(fallback));
46
+ }
47
+ }
48
+ catch {
49
+ const raw = firstLine(argsRaw);
50
+ if (raw !== "")
51
+ return truncate(raw);
52
+ }
53
+ return name;
54
+ }
55
+ const TOOL_LABELS = Object.freeze({
56
+ bash: "Bash",
57
+ pwsh: "PowerShell",
58
+ read: "Чтение",
59
+ web_fetch: "Загрузка",
60
+ web_search: "Поиск",
61
+ grep: "Поиск",
62
+ glob: "Поиск",
63
+ write: "Запись",
64
+ edit: "Правка",
65
+ str_replace_editor: "Правка",
66
+ run_code: "Код",
67
+ subagent: "Субагент",
68
+ subagent_fork: "Субагент (форк)",
69
+ send_message: "Сообщение агенту",
70
+ list_agents: "Список агентов",
71
+ interrupt_agent: "Остановка агента",
72
+ });
73
+ /** The durable id a continuable launch reports back ("started subagent <id>"). */
74
+ const SUBAGENT_STARTED = /started subagent ([0-9a-f][0-9a-f-]*)/iu;
75
+ function toolLabel(name) {
76
+ return (TOOL_LABELS[name] ?? name.replaceAll("_", " ")) || "Инструмент";
77
+ }
78
+ export function toolStatus(node) {
79
+ if (node.error?.code === "interrupted")
80
+ return "stopped";
81
+ return node.isError ? "error" : "ok";
82
+ }
83
+ export function workTool(callId, name, argsRaw, status, startedAt, endedAt, output) {
84
+ const launched = name === "subagent" || name === "subagent_fork"
85
+ ? (SUBAGENT_STARTED.exec(output ?? "")?.[1] ??
86
+ SUBAGENT_STARTED.exec(argsRaw)?.[1])
87
+ : undefined;
88
+ return {
89
+ id: `tool:${callId}`,
90
+ kind: "tool",
91
+ name,
92
+ label: toolLabel(name),
93
+ summary: toolSummary(name, argsRaw),
94
+ input: formatToolInput(argsRaw),
95
+ output,
96
+ status,
97
+ ...(launched === undefined ? {} : { subagentId: launched }),
98
+ ...(startedAt === undefined ? {} : { startedAt }),
99
+ ...(endedAt === undefined ? {} : { endedAt }),
100
+ };
101
+ }
102
+ //# sourceMappingURL=tool-presentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-presentation.js","sourceRoot":"","sources":["../../src/client/tool-presentation.ts"],"names":[],"mappings":"AAGA,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa,EAAE,MAAM,GAAG,GAAG;IAC3C,OAAO,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAoB;IACpD,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CACvC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EA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EAAE,IAAI,KAAK,aAAa;QAAE,OAAO,SAAS,CAAC;IACzD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,IAAY,EACZ,OAAe,EACf,MAA8C,EAC9C,SAA6B,EAC7B,OAA2B,EAC3B,MAAqB;IAErB,MAAM,QAAQ,GACZ,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,eAAe;QAC7C,CAAC,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACzC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO;QACL,EAAE,EAAE,QAAQ,MAAM,EAAE;QACpB,IAAI,EAAE,MAAM;QACZ,IAAI;QACJ,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC;QACtB,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC;QACnC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC;QAC/B,MAAM;QACN,MAAM;QACN,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;QAC3D,GAAG,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC;QACjD,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;KAC9C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,98 @@
1
+ import { QaSourceCollector } from "../provenance/collector.js";
2
+ import { createDefaultSourceExtractorRegistry } from "../provenance/extractors.js";
3
+ /** Empty Chat slice matching the host's EMPTY_CHAT_SNAPSHOT, without a value import. */
4
+ const EMPTY_LEGACY = Object.freeze({
5
+ nodes: Object.freeze([]),
6
+ turnTimings: new Map(),
7
+ turnEnds: new Map(),
8
+ partial: null,
9
+ runningCalls: Object.freeze([]),
10
+ });
11
+ /** The transcript-bearing Chat slice of one Conversation snapshot (absent before the view activates). */
12
+ export function chatLegacyOf(snapshot) {
13
+ return snapshot?.views.get("chat")?.legacy ?? EMPTY_LEGACY;
14
+ }
15
+ const DEFAULT_SOURCE_EXTRACTORS = createDefaultSourceExtractorRegistry();
16
+ /**
17
+ * Rebuild canonical turn bundles from durable tool-result metadata. Since the
18
+ * metadata is persisted by DSH, this projection is identical on live updates
19
+ * and replay and requires no assistant-authored bibliography.
20
+ */
21
+ export function projectTurnSources(snapshot, sessionId = "unknown", workspaceRoot) {
22
+ const legacy = chatLegacyOf(snapshot);
23
+ const heads = new Map();
24
+ for (const node of legacy.nodes) {
25
+ if (node.kind !== "assistant")
26
+ continue;
27
+ for (const block of node.blocks) {
28
+ if (block.kind !== "tool-call" || block.callId === "")
29
+ continue;
30
+ heads.set(block.callId, {
31
+ turn: node.turn,
32
+ step: node.step,
33
+ name: block.name,
34
+ argsRaw: block.argsRaw,
35
+ });
36
+ }
37
+ }
38
+ const collectors = new Map();
39
+ const collectorFor = (turn) => {
40
+ let collector = collectors.get(turn);
41
+ if (collector === undefined) {
42
+ collector = new QaSourceCollector({
43
+ sessionId,
44
+ turn,
45
+ registry: DEFAULT_SOURCE_EXTRACTORS,
46
+ });
47
+ collectors.set(turn, collector);
48
+ }
49
+ return collector;
50
+ };
51
+ for (const node of legacy.nodes) {
52
+ if (node.kind === "assistant")
53
+ collectorFor(node.turn);
54
+ }
55
+ let nearestTurn;
56
+ let nearestStep;
57
+ for (const node of legacy.nodes) {
58
+ if (node.kind === "assistant") {
59
+ nearestTurn = node.turn;
60
+ nearestStep = node.step;
61
+ continue;
62
+ }
63
+ if (node.kind !== "tool-result" || node.isError)
64
+ continue;
65
+ const head = heads.get(node.callId);
66
+ // A truncated event window can retain a result after its assistant call
67
+ // head. Keep it addressable in the synthetic turn 0 instead of dropping
68
+ // durable evidence altogether.
69
+ const turn = head?.turn ?? nearestTurn ?? 0;
70
+ const name = head?.name ?? node.call?.name ?? node.callId;
71
+ const argsRaw = head?.argsRaw ?? node.call?.argsRaw ?? "";
72
+ collectorFor(turn).observe({
73
+ toolName: name,
74
+ args: argsRaw,
75
+ result: node.content,
76
+ presentation: node.meta,
77
+ origin: {
78
+ sessionId,
79
+ turn,
80
+ ...((head?.step ?? nearestStep) === undefined
81
+ ? {}
82
+ : { step: head?.step ?? nearestStep }),
83
+ toolCallId: node.callId,
84
+ toolName: name,
85
+ role: "parent",
86
+ },
87
+ ...(workspaceRoot === undefined ? {} : { workspaceRoot }),
88
+ });
89
+ }
90
+ return [...collectors.entries()]
91
+ .sort(([left], [right]) => left - right)
92
+ .map(([, collector]) => collector.snapshot());
93
+ }
94
+ /** Visible evidence sources for the latest turn, shared by the drawer/footer. */
95
+ export function projectSources(snapshot, sessionId = "unknown", workspaceRoot) {
96
+ return (projectTurnSources(snapshot, sessionId, workspaceRoot).at(-1)?.sources ?? []);
97
+ }
98
+ //# sourceMappingURL=turn-sources.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"turn-sources.js","sourceRoot":"","sources":["../../src/client/turn-sources.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,oCAAoC,EAAE,MAAM,6BAA6B,CAAC;AAEnF,wFAAwF;AACxF,MAAM,YAAY,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC1D,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IACxB,WAAW,EAAE,IAAI,GAAG,EAAE;IACtB,QAAQ,EAAE,IAAI,GAAG,EAAE;IACnB,OAAO,EAAE,IAAI;IACb,YAAY,EAAE,MAAM,CAAC,MAAM,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AM,EAAE;gBACN,SAAS;gBACT,IAAI;gBACJ,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,WAAW,CAAC,KAAK,SAAS;oBAC3C,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,IAAI,WAAW,EAAE,CAAC;gBACxC,UAAU,EAAE,IAAI,CAAC,MAAM;gBACvB,QAAQ,EAAE,IAAI;gBACd,IAAI,EAAE,QAAQ;aACf;YACD,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;SAC1D,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;SAC7B,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;SACvC,GAAG,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;AAClD,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAC5B,QAA0C,EAC1C,SAAS,GAAG,SAAS,EACrB,aAAsB;IAEtB,OAAO,CACL,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI,EAAE,CAC7E,CAAC;AACJ,CAAC"}
@@ -8,6 +8,8 @@ export const QA_SESSION_IDLE_STATE = Object.freeze({
8
8
  canStop: false,
9
9
  chatsRevision: 0,
10
10
  sources: Object.freeze([]),
11
+ sourcesComplete: true,
12
+ incompleteSourceOrigins: undefined,
11
13
  viewingSubagent: null,
12
14
  });
13
15
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAkCA,iFAAiF;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAmB,MAAM,CAAC,MAAM,CAAC;IACjE,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,eAAe,EAAE,IAAI;CACtB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAuHA,iFAAiF;AACjF,MAAM,CAAC,MAAM,qBAAqB,GAAmB,MAAM,CAAC,MAAM,CAAC;IACjE,KAAK,EAAE,MAAM;IACb,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;IACd,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,eAAe,EAAE,IAAI;IACrB,uBAAuB,EAAE,SAAS;IAClC,eAAe,EAAE,IAAI;CACtB,CAAC,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { useCallback, useEffect, useRef, useState, } from "react";
2
+ import { revokeObjectUrlIfBlob } from "./session-assets.js";
3
+ /**
4
+ * Per-chat UI state: composer attachments, variant offsets, the rail mark and
5
+ * the drawers. Everything here describes the chat it was made in, so a
6
+ * session change clears it instead of leaking a draft, an image or a drawer
7
+ * from one conversation into the next.
8
+ */
9
+ export function useSessionUiState(sessionId) {
10
+ /** Per group: how many answers back from the newest is shown (0 = newest). */
11
+ const [variantOffsets, setVariantOffsets] = useState({});
12
+ const [activeTurn, setActiveTurn] = useState(null);
13
+ const [agentsOpen, setAgentsOpen] = useState(false);
14
+ const [sourcesOpen, setSourcesOpen] = useState(false);
15
+ const [drawerSources, setDrawerSources] = useState(null);
16
+ const [drawerCompleteness, setDrawerCompleteness] = useState(null);
17
+ const [drawerDetail, setDrawerDetail] = useState(null);
18
+ const [pendingImages, setPendingImagesState] = useState([]);
19
+ /** Mirror of the live drafts: blob URLs to revoke when they leave state. */
20
+ const pendingImagesRef = useRef([]);
21
+ /**
22
+ * The single entry point that changes the draft set: every image that
23
+ * leaves state has its preview blob URL revoked here, whether it was
24
+ * removed by the composer, cleared by a send or dropped on a chat switch.
25
+ */
26
+ const setPendingImages = useCallback((next) => {
27
+ for (const draft of pendingImagesRef.current) {
28
+ if (!next.includes(draft))
29
+ revokeObjectUrlIfBlob(draft.previewUrl);
30
+ }
31
+ pendingImagesRef.current = next;
32
+ setPendingImagesState(next);
33
+ }, []);
34
+ useEffect(() => {
35
+ setVariantOffsets({});
36
+ setActiveTurn(null);
37
+ setAgentsOpen(false);
38
+ setSourcesOpen(false);
39
+ setDrawerSources(null);
40
+ setDrawerCompleteness(null);
41
+ setDrawerDetail(null);
42
+ setPendingImages([]);
43
+ }, [sessionId, setPendingImages]);
44
+ // Whatever is still attached dies with the surface, and its URLs with it.
45
+ useEffect(() => () => {
46
+ for (const draft of pendingImagesRef.current)
47
+ revokeObjectUrlIfBlob(draft.previewUrl);
48
+ }, []);
49
+ return {
50
+ variantOffsets,
51
+ setVariantOffsets,
52
+ activeTurn,
53
+ setActiveTurn,
54
+ agentsOpen,
55
+ setAgentsOpen,
56
+ sourcesOpen,
57
+ setSourcesOpen,
58
+ drawerSources,
59
+ setDrawerSources,
60
+ drawerCompleteness,
61
+ setDrawerCompleteness,
62
+ drawerDetail,
63
+ setDrawerDetail,
64
+ pendingImages,
65
+ setPendingImages,
66
+ };
67
+ }
68
+ //# sourceMappingURL=use-session-ui-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-session-ui-state.js","s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