@yadsh/dsh-qa-surface 0.4.0 → 0.6.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 (421) hide show
  1. package/README.md +235 -14
  2. package/compatibility.json +10 -1
  3. package/cordis.patch.yml +17 -0
  4. package/lib/account-remotes.js +10 -0
  5. package/lib/account-remotes.js.map +1 -1
  6. package/lib/accounts/credentials.js +12 -4
  7. package/lib/accounts/credentials.js.map +1 -1
  8. package/lib/accounts/errors.js.map +1 -1
  9. package/lib/accounts/file.js.map +1 -1
  10. package/lib/accounts/store.js +38 -1
  11. package/lib/accounts/store.js.map +1 -1
  12. package/lib/approvals.js +179 -0
  13. package/lib/approvals.js.map +1 -0
  14. package/lib/cli.js +10 -0
  15. package/lib/cli.js.map +1 -1
  16. package/lib/client/QaAccountsController.js +29 -0
  17. package/lib/client/QaAccountsController.js.map +1 -1
  18. package/lib/client/QaSessionController.js +261 -48
  19. package/lib/client/QaSessionController.js.map +1 -1
  20. package/lib/client/QaSurface.js +138 -56
  21. package/lib/client/QaSurface.js.map +1 -1
  22. package/lib/client/QaSurfaceGuard.js +96 -0
  23. package/lib/client/QaSurfaceGuard.js.map +1 -0
  24. package/lib/client/QaTranscriptAdapter.js +11 -5
  25. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  26. package/lib/client/approvals.js +104 -0
  27. package/lib/client/approvals.js.map +1 -0
  28. package/lib/client/attestation.js +3 -0
  29. package/lib/client/attestation.js.map +1 -1
  30. package/lib/client/components/QaApproval.js +23 -0
  31. package/lib/client/components/QaApproval.js.map +1 -0
  32. package/lib/client/components/QaChangelog.js +55 -0
  33. package/lib/client/components/QaChangelog.js.map +1 -1
  34. package/lib/client/components/QaComposer.js +1 -1
  35. package/lib/client/components/QaComposer.js.map +1 -1
  36. package/lib/client/components/QaHeader.js +2 -8
  37. package/lib/client/components/QaHeader.js.map +1 -1
  38. package/lib/client/components/QaMessage.js +20 -7
  39. package/lib/client/components/QaMessage.js.map +1 -1
  40. package/lib/client/components/QaModal.js +24 -6
  41. package/lib/client/components/QaModal.js.map +1 -1
  42. package/lib/client/components/QaQuestions.js +96 -0
  43. package/lib/client/components/QaQuestions.js.map +1 -0
  44. package/lib/client/components/QaSidebar.js +2 -6
  45. package/lib/client/components/QaSidebar.js.map +1 -1
  46. package/lib/client/components/QaSourcesPanel.js +6 -5
  47. package/lib/client/components/QaSourcesPanel.js.map +1 -1
  48. package/lib/client/components/QaWidthHandle.js +21 -1
  49. package/lib/client/components/QaWidthHandle.js.map +1 -1
  50. package/lib/client/components/surface-utils.js +2 -0
  51. package/lib/client/components/surface-utils.js.map +1 -1
  52. package/lib/client/index.js +81 -22
  53. package/lib/client/index.js.map +1 -1
  54. package/lib/client/panels/PanelHost.js +209 -0
  55. package/lib/client/panels/PanelHost.js.map +1 -0
  56. package/lib/client/panels/PanelLauncher.js +39 -0
  57. package/lib/client/panels/PanelLauncher.js.map +1 -0
  58. package/lib/client/panels/contract.js +2 -0
  59. package/lib/client/panels/contract.js.map +1 -0
  60. package/lib/client/panels/index.js +2 -0
  61. package/lib/client/panels/index.js.map +1 -0
  62. package/lib/client/panels/registry.js +171 -0
  63. package/lib/client/panels/registry.js.map +1 -0
  64. package/lib/client/project-session-state.js +8 -3
  65. package/lib/client/project-session-state.js.map +1 -1
  66. package/lib/client/questions.js +114 -0
  67. package/lib/client/questions.js.map +1 -0
  68. package/lib/client/settings/card.js +2 -2
  69. package/lib/client/settings/card.js.map +1 -1
  70. package/lib/client/settings/sections/accounts.js +3 -1
  71. package/lib/client/settings/sections/accounts.js.map +1 -1
  72. package/lib/client/settings/sections/documents.js +88 -0
  73. package/lib/client/settings/sections/documents.js.map +1 -0
  74. package/lib/client/settings/sections/interface.js +2 -0
  75. package/lib/client/settings/sections/interface.js.map +1 -1
  76. package/lib/client/settings/sections/sources.js +2 -0
  77. package/lib/client/settings/sections/sources.js.map +1 -1
  78. package/lib/client/settings/sections.js +1 -0
  79. package/lib/client/settings/sections.js.map +1 -1
  80. package/lib/client/settings-extensions/contract.js +2 -0
  81. package/lib/client/settings-extensions/contract.js.map +1 -0
  82. package/lib/client/settings-extensions/index.js +2 -0
  83. package/lib/client/settings-extensions/index.js.map +1 -0
  84. package/lib/client/settings-extensions/registry.js +63 -0
  85. package/lib/client/settings-extensions/registry.js.map +1 -0
  86. package/lib/client/settlement.js +51 -5
  87. package/lib/client/settlement.js.map +1 -1
  88. package/lib/client/source-preview.js +24 -0
  89. package/lib/client/source-preview.js.map +1 -0
  90. package/lib/client/styles.js +199 -32
  91. package/lib/client/styles.js.map +1 -1
  92. package/lib/client/subagent-codenames.js +109 -0
  93. package/lib/client/subagent-codenames.js.map +1 -0
  94. package/lib/client/types.js +3 -0
  95. package/lib/client/types.js.map +1 -1
  96. package/lib/client/user-settings/GeneralSettingsPage.js +13 -0
  97. package/lib/client/user-settings/GeneralSettingsPage.js.map +1 -0
  98. package/lib/client/user-settings/ProfileSettingsPage.js +59 -0
  99. package/lib/client/user-settings/ProfileSettingsPage.js.map +1 -0
  100. package/lib/client/user-settings/SkillCatalog.js +23 -0
  101. package/lib/client/user-settings/SkillCatalog.js.map +1 -0
  102. package/lib/client/user-settings/SkillEditor.js +89 -0
  103. package/lib/client/user-settings/SkillEditor.js.map +1 -0
  104. package/lib/client/user-settings/SkillToolPicker.js +58 -0
  105. package/lib/client/user-settings/SkillToolPicker.js.map +1 -0
  106. package/lib/client/user-settings/SkillsSettingsPage.js +171 -0
  107. package/lib/client/user-settings/SkillsSettingsPage.js.map +1 -0
  108. package/lib/client/user-settings/StartersSettingsPage.js +78 -0
  109. package/lib/client/user-settings/StartersSettingsPage.js.map +1 -0
  110. package/lib/client/user-settings/UserSettingsDialog.js +50 -0
  111. package/lib/client/user-settings/UserSettingsDialog.js.map +1 -0
  112. package/lib/client/user-settings/copy.js +84 -0
  113. package/lib/client/user-settings/copy.js.map +1 -0
  114. package/lib/client/user-settings/draft.js +127 -0
  115. package/lib/client/user-settings/draft.js.map +1 -0
  116. package/lib/client/user-settings/fields.js +24 -0
  117. package/lib/client/user-settings/fields.js.map +1 -0
  118. package/lib/client.js +6629 -1579
  119. package/lib/client.js.map +1 -1
  120. package/lib/config-resolvers/accounts.js +30 -0
  121. package/lib/config-resolvers/accounts.js.map +1 -1
  122. package/lib/config-resolvers/basics.js +4 -2
  123. package/lib/config-resolvers/basics.js.map +1 -1
  124. package/lib/config-resolvers/defaults.js +27 -0
  125. package/lib/config-resolvers/defaults.js.map +1 -1
  126. package/lib/config-resolvers/lockdown.js +11 -0
  127. package/lib/config-resolvers/lockdown.js.map +1 -1
  128. package/lib/config-resolvers/session.js +2 -2
  129. package/lib/config-resolvers/session.js.map +1 -1
  130. package/lib/config-resolvers/shared.js +9 -0
  131. package/lib/config-resolvers/shared.js.map +1 -1
  132. package/lib/config-resolvers/sources.js +2 -0
  133. package/lib/config-resolvers/sources.js.map +1 -1
  134. package/lib/config-resolvers/tools.js +37 -0
  135. package/lib/config-resolvers/tools.js.map +1 -0
  136. package/lib/config-resolvers/ui.js +2 -0
  137. package/lib/config-resolvers/ui.js.map +1 -1
  138. package/lib/config.js +299 -2
  139. package/lib/config.js.map +1 -1
  140. package/lib/documents/artifacts/ids.js +43 -0
  141. package/lib/documents/artifacts/ids.js.map +1 -0
  142. package/lib/documents/artifacts/manifest.js +66 -0
  143. package/lib/documents/artifacts/manifest.js.map +1 -0
  144. package/lib/documents/artifacts/store.js +169 -0
  145. package/lib/documents/artifacts/store.js.map +1 -0
  146. package/lib/documents/capabilities.js +93 -0
  147. package/lib/documents/capabilities.js.map +1 -0
  148. package/lib/documents/config.js +302 -0
  149. package/lib/documents/config.js.map +1 -0
  150. package/lib/documents/defaults.js +78 -0
  151. package/lib/documents/defaults.js.map +1 -0
  152. package/lib/documents/errors.js +101 -0
  153. package/lib/documents/errors.js.map +1 -0
  154. package/lib/documents/index.js +80 -0
  155. package/lib/documents/index.js.map +1 -0
  156. package/lib/documents/inspect/facts.js +161 -0
  157. package/lib/documents/inspect/facts.js.map +1 -0
  158. package/lib/documents/inspect/zip.js +108 -0
  159. package/lib/documents/inspect/zip.js.map +1 -0
  160. package/lib/documents/markdown/directives.js +135 -0
  161. package/lib/documents/markdown/directives.js.map +1 -0
  162. package/lib/documents/markdown/frontmatter.js +35 -0
  163. package/lib/documents/markdown/frontmatter.js.map +1 -0
  164. package/lib/documents/markdown/normalize.js +113 -0
  165. package/lib/documents/markdown/normalize.js.map +1 -0
  166. package/lib/documents/orchestrator/assets.js +243 -0
  167. package/lib/documents/orchestrator/assets.js.map +1 -0
  168. package/lib/documents/orchestrator/convert-document.js +186 -0
  169. package/lib/documents/orchestrator/convert-document.js.map +1 -0
  170. package/lib/documents/orchestrator/create-document.js +292 -0
  171. package/lib/documents/orchestrator/create-document.js.map +1 -0
  172. package/lib/documents/orchestrator/extract-document.js +162 -0
  173. package/lib/documents/orchestrator/extract-document.js.map +1 -0
  174. package/lib/documents/orchestrator/inspect-document.js +89 -0
  175. package/lib/documents/orchestrator/inspect-document.js.map +1 -0
  176. package/lib/documents/orchestrator/runtime-deps.js +59 -0
  177. package/lib/documents/orchestrator/runtime-deps.js.map +1 -0
  178. package/lib/documents/orchestrator/scope.js +132 -0
  179. package/lib/documents/orchestrator/scope.js.map +1 -0
  180. package/lib/documents/providers/docling.js +247 -0
  181. package/lib/documents/providers/docling.js.map +1 -0
  182. package/lib/documents/providers/libreoffice.js +130 -0
  183. package/lib/documents/providers/libreoffice.js.map +1 -0
  184. package/lib/documents/providers/markitdown.js +89 -0
  185. package/lib/documents/providers/markitdown.js.map +1 -0
  186. package/lib/documents/providers/pandoc.js +161 -0
  187. package/lib/documents/providers/pandoc.js.map +1 -0
  188. package/lib/documents/providers/process.js +164 -0
  189. package/lib/documents/providers/process.js.map +1 -0
  190. package/lib/documents/providers/registry.js +152 -0
  191. package/lib/documents/providers/registry.js.map +1 -0
  192. package/lib/documents/providers/shared.js +75 -0
  193. package/lib/documents/providers/shared.js.map +1 -0
  194. package/lib/documents/runtime.js +114 -0
  195. package/lib/documents/runtime.js.map +1 -0
  196. package/lib/documents/security/file-types.js +188 -0
  197. package/lib/documents/security/file-types.js.map +1 -0
  198. package/lib/documents/security/limits.js +78 -0
  199. package/lib/documents/security/limits.js.map +1 -0
  200. package/lib/documents/security/mime.js +43 -0
  201. package/lib/documents/security/mime.js.map +1 -0
  202. package/lib/documents/security/paths.js +133 -0
  203. package/lib/documents/security/paths.js.map +1 -0
  204. package/lib/documents/templates/registry.js +147 -0
  205. package/lib/documents/templates/registry.js.map +1 -0
  206. package/lib/documents/templates/resolver.js +59 -0
  207. package/lib/documents/templates/resolver.js.map +1 -0
  208. package/lib/documents/tools/convert.js +125 -0
  209. package/lib/documents/tools/convert.js.map +1 -0
  210. package/lib/documents/tools/create.js +187 -0
  211. package/lib/documents/tools/create.js.map +1 -0
  212. package/lib/documents/tools/index.js +41 -0
  213. package/lib/documents/tools/index.js.map +1 -0
  214. package/lib/documents/tools/inspect.js +135 -0
  215. package/lib/documents/tools/inspect.js.map +1 -0
  216. package/lib/documents/tools/shared.js +88 -0
  217. package/lib/documents/tools/shared.js.map +1 -0
  218. package/lib/documents/tools/to-markdown.js +125 -0
  219. package/lib/documents/tools/to-markdown.js.map +1 -0
  220. package/lib/documents/types.js +12 -0
  221. package/lib/documents/types.js.map +1 -0
  222. package/lib/index.js +299 -24
  223. package/lib/index.js.map +1 -1
  224. package/lib/integration-principals.js +22 -0
  225. package/lib/integration-principals.js.map +1 -0
  226. package/lib/lockdown-policy.js +15 -3
  227. package/lib/lockdown-policy.js.map +1 -1
  228. package/lib/personal-skills/errors.js +9 -0
  229. package/lib/personal-skills/errors.js.map +1 -0
  230. package/lib/personal-skills/host.js +80 -0
  231. package/lib/personal-skills/host.js.map +1 -0
  232. package/lib/personal-skills/index.js +10 -0
  233. package/lib/personal-skills/index.js.map +1 -0
  234. package/lib/personal-skills/paths.js +127 -0
  235. package/lib/personal-skills/paths.js.map +1 -0
  236. package/lib/personal-skills/provider.js +109 -0
  237. package/lib/personal-skills/provider.js.map +1 -0
  238. package/lib/personal-skills/remotes.js +40 -0
  239. package/lib/personal-skills/remotes.js.map +1 -0
  240. package/lib/personal-skills/service.js +686 -0
  241. package/lib/personal-skills/service.js.map +1 -0
  242. package/lib/personal-skills/skill-file.js +278 -0
  243. package/lib/personal-skills/skill-file.js.map +1 -0
  244. package/lib/personal-skills/skill-format.js +202 -0
  245. package/lib/personal-skills/skill-format.js.map +1 -0
  246. package/lib/personal-skills/watcher.js +96 -0
  247. package/lib/personal-skills/watcher.js.map +1 -0
  248. package/lib/profile.js +6 -4
  249. package/lib/profile.js.map +1 -1
  250. package/lib/prompt-notes.js +19 -0
  251. package/lib/prompt-notes.js.map +1 -1
  252. package/lib/provenance/file-preview.js +68 -21
  253. package/lib/provenance/file-preview.js.map +1 -1
  254. package/lib/provenance/host-store.js +69 -20
  255. package/lib/provenance/host-store.js.map +1 -1
  256. package/lib/provenance/index.js +1 -0
  257. package/lib/provenance/index.js.map +1 -1
  258. package/lib/provenance/normalize.js +3 -1
  259. package/lib/provenance/normalize.js.map +1 -1
  260. package/lib/provenance/reported.js +37 -12
  261. package/lib/provenance/reported.js.map +1 -1
  262. package/lib/provenance/snapshot-store.js +154 -0
  263. package/lib/provenance/snapshot-store.js.map +1 -0
  264. package/lib/qa-tools/activation-detector.js +53 -0
  265. package/lib/qa-tools/activation-detector.js.map +1 -0
  266. package/lib/qa-tools/activation-manager.js +111 -0
  267. package/lib/qa-tools/activation-manager.js.map +1 -0
  268. package/lib/qa-tools/catalog.js +108 -0
  269. package/lib/qa-tools/catalog.js.map +1 -0
  270. package/lib/qa-tools/durable-marker.js +115 -0
  271. package/lib/qa-tools/durable-marker.js.map +1 -0
  272. package/lib/qa-tools/index.js +83 -0
  273. package/lib/qa-tools/index.js.map +1 -0
  274. package/lib/qa-tools/lifecycle.js +64 -0
  275. package/lib/qa-tools/lifecycle.js.map +1 -0
  276. package/lib/qa-tools/types.js +2 -0
  277. package/lib/qa-tools/types.js.map +1 -0
  278. package/lib/questions.js +185 -0
  279. package/lib/questions.js.map +1 -0
  280. package/lib/resolve-config.js +5 -0
  281. package/lib/resolve-config.js.map +1 -1
  282. package/lib/secure-session.js +104 -20
  283. package/lib/secure-session.js.map +1 -1
  284. package/lib/session-ownership.js +55 -0
  285. package/lib/session-ownership.js.map +1 -0
  286. package/lib/starters.js +117 -0
  287. package/lib/starters.js.map +1 -0
  288. package/lib/typert.host.js +1162 -77
  289. package/lib/typert.remote-client.d.ts +27 -1
  290. package/lib/typert.remote-client.js +879 -14
  291. package/lib/types/account-remotes.d.ts +3 -1
  292. package/lib/types/accounts/credentials.d.ts +6 -0
  293. package/lib/types/accounts/errors.d.ts +1 -1
  294. package/lib/types/accounts/file.d.ts +10 -0
  295. package/lib/types/accounts/store.d.ts +15 -1
  296. package/lib/types/approvals.d.ts +65 -0
  297. package/lib/types/client/QaAccountsController.d.ts +7 -1
  298. package/lib/types/client/QaSessionController.d.ts +50 -1
  299. package/lib/types/client/QaSurface.d.ts +21 -4
  300. package/lib/types/client/QaSurfaceGuard.d.ts +27 -0
  301. package/lib/types/client/QaTranscriptAdapter.d.ts +7 -0
  302. package/lib/types/client/approvals.d.ts +39 -0
  303. package/lib/types/client/components/QaApproval.d.ts +13 -0
  304. package/lib/types/client/components/QaComposer.d.ts +3 -1
  305. package/lib/types/client/components/QaHeader.d.ts +3 -1
  306. package/lib/types/client/components/QaModal.d.ts +5 -4
  307. package/lib/types/client/components/QaQuestions.d.ts +13 -0
  308. package/lib/types/client/components/QaSidebar.d.ts +8 -11
  309. package/lib/types/client/components/QaWidthHandle.d.ts +13 -0
  310. package/lib/types/client/index.d.ts +1 -0
  311. package/lib/types/client/panels/PanelHost.d.ts +18 -0
  312. package/lib/types/client/panels/PanelLauncher.d.ts +5 -0
  313. package/lib/types/client/panels/contract.d.ts +83 -0
  314. package/lib/types/client/panels/index.d.ts +3 -0
  315. package/lib/types/client/panels/registry.d.ts +40 -0
  316. package/lib/types/client/project-session-state.d.ts +13 -1
  317. package/lib/types/client/questions.d.ts +45 -0
  318. package/lib/types/client/settings/sections/documents.d.ts +13 -0
  319. package/lib/types/client/settings/sections.d.ts +1 -0
  320. package/lib/types/client/settings-extensions/contract.d.ts +32 -0
  321. package/lib/types/client/settings-extensions/index.d.ts +3 -0
  322. package/lib/types/client/settings-extensions/registry.d.ts +15 -0
  323. package/lib/types/client/settlement.d.ts +41 -5
  324. package/lib/types/client/source-preview.d.ts +8 -0
  325. package/lib/types/client/styles.d.ts +2 -0
  326. package/lib/types/client/subagent-codenames.d.ts +18 -0
  327. package/lib/types/client/types.d.ts +82 -3
  328. package/lib/types/client/user-settings/GeneralSettingsPage.d.ts +14 -0
  329. package/lib/types/client/user-settings/ProfileSettingsPage.d.ts +18 -0
  330. package/lib/types/client/user-settings/SkillCatalog.d.ts +16 -0
  331. package/lib/types/client/user-settings/SkillEditor.d.ts +42 -0
  332. package/lib/types/client/user-settings/SkillToolPicker.d.ts +17 -0
  333. package/lib/types/client/user-settings/SkillsSettingsPage.d.ts +15 -0
  334. package/lib/types/client/user-settings/StartersSettingsPage.d.ts +14 -0
  335. package/lib/types/client/user-settings/UserSettingsDialog.d.ts +43 -0
  336. package/lib/types/client/user-settings/copy.d.ts +25 -0
  337. package/lib/types/client/user-settings/draft.d.ts +51 -0
  338. package/lib/types/client/user-settings/fields.d.ts +43 -0
  339. package/lib/types/config-resolvers/shared.d.ts +7 -0
  340. package/lib/types/config-resolvers/tools.d.ts +6 -0
  341. package/lib/types/documents/artifacts/ids.d.ts +14 -0
  342. package/lib/types/documents/artifacts/manifest.d.ts +32 -0
  343. package/lib/types/documents/artifacts/store.d.ts +67 -0
  344. package/lib/types/documents/capabilities.d.ts +32 -0
  345. package/lib/types/documents/config.d.ts +27 -0
  346. package/lib/types/documents/defaults.d.ts +161 -0
  347. package/lib/types/documents/errors.d.ts +42 -0
  348. package/lib/types/documents/index.d.ts +63 -0
  349. package/lib/types/documents/inspect/facts.d.ts +43 -0
  350. package/lib/types/documents/inspect/zip.d.ts +28 -0
  351. package/lib/types/documents/markdown/directives.d.ts +39 -0
  352. package/lib/types/documents/markdown/frontmatter.d.ts +15 -0
  353. package/lib/types/documents/markdown/normalize.d.ts +30 -0
  354. package/lib/types/documents/orchestrator/assets.d.ts +55 -0
  355. package/lib/types/documents/orchestrator/convert-document.d.ts +25 -0
  356. package/lib/types/documents/orchestrator/create-document.d.ts +18 -0
  357. package/lib/types/documents/orchestrator/extract-document.d.ts +24 -0
  358. package/lib/types/documents/orchestrator/inspect-document.d.ts +12 -0
  359. package/lib/types/documents/orchestrator/runtime-deps.d.ts +43 -0
  360. package/lib/types/documents/orchestrator/scope.d.ts +52 -0
  361. package/lib/types/documents/providers/docling.d.ts +54 -0
  362. package/lib/types/documents/providers/libreoffice.d.ts +40 -0
  363. package/lib/types/documents/providers/markitdown.d.ts +28 -0
  364. package/lib/types/documents/providers/pandoc.d.ts +42 -0
  365. package/lib/types/documents/providers/process.d.ts +54 -0
  366. package/lib/types/documents/providers/registry.d.ts +68 -0
  367. package/lib/types/documents/providers/shared.d.ts +27 -0
  368. package/lib/types/documents/runtime.d.ts +59 -0
  369. package/lib/types/documents/security/file-types.d.ts +39 -0
  370. package/lib/types/documents/security/limits.d.ts +24 -0
  371. package/lib/types/documents/security/mime.d.ts +13 -0
  372. package/lib/types/documents/security/paths.d.ts +38 -0
  373. package/lib/types/documents/templates/registry.d.ts +50 -0
  374. package/lib/types/documents/templates/resolver.d.ts +30 -0
  375. package/lib/types/documents/tools/convert.d.ts +9 -0
  376. package/lib/types/documents/tools/create.d.ts +14 -0
  377. package/lib/types/documents/tools/index.d.ts +33 -0
  378. package/lib/types/documents/tools/inspect.d.ts +9 -0
  379. package/lib/types/documents/tools/shared.d.ts +77 -0
  380. package/lib/types/documents/tools/to-markdown.d.ts +12 -0
  381. package/lib/types/documents/types.d.ts +294 -0
  382. package/lib/types/index.d.ts +103 -5
  383. package/lib/types/integration-principals.d.ts +9 -0
  384. package/lib/types/lockdown-policy.d.ts +12 -2
  385. package/lib/types/personal-skills/errors.d.ts +11 -0
  386. package/lib/types/personal-skills/host.d.ts +42 -0
  387. package/lib/types/personal-skills/index.d.ts +10 -0
  388. package/lib/types/personal-skills/paths.d.ts +39 -0
  389. package/lib/types/personal-skills/provider.d.ts +33 -0
  390. package/lib/types/personal-skills/remotes.d.ts +35 -0
  391. package/lib/types/personal-skills/service.d.ts +131 -0
  392. package/lib/types/personal-skills/skill-file.d.ts +64 -0
  393. package/lib/types/personal-skills/skill-format.d.ts +100 -0
  394. package/lib/types/personal-skills/watcher.d.ts +39 -0
  395. package/lib/types/profile.d.ts +13 -0
  396. package/lib/types/prompt-notes.d.ts +9 -0
  397. package/lib/types/provenance/file-preview.d.ts +47 -4
  398. package/lib/types/provenance/host-store.d.ts +7 -1
  399. package/lib/types/provenance/index.d.ts +1 -0
  400. package/lib/types/provenance/reported.d.ts +9 -1
  401. package/lib/types/provenance/snapshot-store.d.ts +23 -0
  402. package/lib/types/qa-tools/activation-detector.d.ts +29 -0
  403. package/lib/types/qa-tools/activation-manager.d.ts +47 -0
  404. package/lib/types/qa-tools/catalog.d.ts +40 -0
  405. package/lib/types/qa-tools/durable-marker.d.ts +16 -0
  406. package/lib/types/qa-tools/index.d.ts +40 -0
  407. package/lib/types/qa-tools/lifecycle.d.ts +44 -0
  408. package/lib/types/qa-tools/types.d.ts +45 -0
  409. package/lib/types/questions.d.ts +83 -0
  410. package/lib/types/secure-session.d.ts +45 -4
  411. package/lib/types/session-ownership.d.ts +30 -0
  412. package/lib/types/starters.d.ts +45 -0
  413. package/lib/types/types.d.ts +282 -7
  414. package/lib/types/user-workspace.d.ts +5 -1
  415. package/lib/user-workspace.js +21 -6
  416. package/lib/user-workspace.js.map +1 -1
  417. package/package.json +22 -9
  418. package/scripts/repair-session-events.mjs +260 -0
  419. package/lib/client/components/QaProfile.js +0 -64
  420. package/lib/client/components/QaProfile.js.map +0 -1
  421. package/lib/types/client/components/QaProfile.d.ts +0 -25
package/README.md CHANGED
@@ -15,22 +15,43 @@ Session and Agent Loop.
15
15
  a responsive first-party-style conversation layout;
16
16
  - optionally shows a minimal per-browser chat-history sidebar
17
17
  (`ui.showSessionList`) whose switching re-runs policy attestation;
18
- - blocks unsupported approvals/questions instead of auto-approving them;
18
+ - blocks unsupported approvals/questions instead of auto-approving them, and can
19
+ park them for the operator to answer (`interaction.approvals: interactive`,
20
+ `interaction.questions: interactive`) instead of refusing or stalling on a
21
+ card the QA view cannot show;
19
22
  - pins locked sessions to the configured `read-only` or isolated
20
23
  `workspace-write` policy plus `approval=never` before Send is enabled;
21
24
  - applies a Host-side tool allow-list plus a monotonic execution guard;
25
+ - attaches its own QA tool catalog per agent only after the activation skill
26
+ loads (`tools.dynamicActivation`), keeping every QA schema out of the initial
27
+ request and restoring the catalog on resume from the session's own journal;
22
28
  - optionally gates the surface behind email + password accounts
23
29
  (`accounts.enabled`) with server-side session ownership, a first-login
24
30
  migration of the browser's existing chats, a `qa-accounts` management CLI
25
- (list/add/set-role/disable/revoke), and a coarse honest boundary:
31
+ (list/add/set-password/set-role/disable/revoke), and a coarse honest boundary:
26
32
  accounts identify QA users, they do not fence the harness root;
33
+ - gives each account a `Настройки` dialog — profile, starter messages,
34
+ general, and **personal skills**: ordinary Agent Skills stored as `SKILL.md` in the account's own
35
+ directory (`accounts.skills`), edited with a catalog, an invocation-flag
36
+ form, a Markdown body, a tool picker over the deployment's registry, and a
37
+ preview of the exact file a save writes. Skills reach the model through a
38
+ provider this plugin registers instead of the filesystem one, so no account
39
+ can see another's, and `allowed-tools` is stored as declared but never
40
+ grants anything the session does not already allow;
27
41
  - optionally redirects non-loopback hostnames from the harness root into the
28
42
  QA route (`entry.redirectNonLoopback`), keeping the operator's localhost
29
43
  harness UI untouched;
30
44
  - ships an operator settings card (Settings → Plugins → plugin configuration →
31
45
  «Помощник QA») that edits the `qa-surface` namespace in place — route,
32
- branding, session, interface, lockdown, accounts, sources, embedding — and
33
- reports the configuration the running Host resolved;
46
+ branding, session, interface, lockdown, accounts, sources, attachments,
47
+ documents, embedding — and reports the configuration the running Host
48
+ resolved;
49
+ - registers four document tools (`document_create`, `document_to_markdown`,
50
+ `document_convert`, `document_inspect`) behind `documents.enabled`: the agent
51
+ writes Markdown and receives DOCX/PDF, or hands over a DOCX/PDF and receives
52
+ Markdown, while the pipeline owns every backend command line, keeps source,
53
+ assets, outputs and a manifest in one artifact bundle, and is visible to a QA
54
+ chat only through the tool allow-list;
34
55
  - uses the existing same-origin DSH connection and trust boundary.
35
56
 
36
57
  It does not add another HTTP server, provider proxy, permissive CORS rule, or
@@ -125,6 +146,9 @@ config:
125
146
  inject: true
126
147
  identities: [] # e.g. [{ key: jira, label: Jira }]
127
148
  instructionsMaxLength: 2000
149
+ # Per-account starter buttons above an empty composer (optional).
150
+ starters:
151
+ enabled: true
128
152
  suggestedQuestions:
129
153
  - Как запросить доступ?
130
154
  - Где лежит инструкция?
@@ -142,7 +166,11 @@ config:
142
166
  maxPending: 8
143
167
  extensions: [md, txt, log, json, yaml, csv, sql]
144
168
  interaction:
169
+ # blocked: refuse a composed gate's `ask` with the QA reason.
170
+ # interactive: park it over the composer for the operator to answer.
145
171
  approvals: blocked
172
+ # unsupported: refuse ask_user_question with an actionable reason.
173
+ # interactive: park the request over the composer as an answerable form.
146
174
  questions: unsupported
147
175
  lockdown:
148
176
  enabled: true
@@ -192,8 +220,18 @@ config:
192
220
  inheritSources: true
193
221
  enableReportToolFallback: true
194
222
  markIncompleteOpaqueRuns: true
223
+ validateReportedSources: true
195
224
  legacy:
196
225
  parseAssistantSourcesBlock: false
226
+ # QA tool delivery (optional). The plugin's own tool catalog stays out of the
227
+ # model request until the activation skill has actually been loaded.
228
+ tools:
229
+ dynamicActivation: true
230
+ activationSkill: qa-surface
231
+ activationMode: all
232
+ # Presets whose sessions may unlock the catalog. Empty leaves the gate open:
233
+ # only do that when this Host serves one agent composition.
234
+ activationPresets: []
197
235
  ```
198
236
 
199
237
  `workspaceId` is recommended for a deterministic assistant. Without it, DSH
@@ -201,6 +239,46 @@ uses the Host's normal default working directory. Put the system prompt, tools,
201
239
  skills, knowledge connections and permission policy in `agentPreset`, not in
202
240
  this UI plugin.
203
241
 
242
+ ### Dynamic QA tools
243
+
244
+ A QA deployment tends to grow a large toolset, and attaching all of it at boot
245
+ puts every schema into every request — including the first small talk of a chat
246
+ that will never use them. `tools.dynamicActivation` (the default) inverts that:
247
+ the plugin's catalog is registered into the agent's own scope only after the
248
+ model successfully loads `tools.activationSkill`, and `qa_tools_selfcheck`
249
+ reports the resulting state.
250
+
251
+ The trigger is the authoritative result of the built-in `skill` tool, not the
252
+ model's attempt, not a keyword in the transcript, and not a coincidentally
253
+ matching skill description. A failed or refused load activates nothing, loading
254
+ an unrelated skill activates nothing, and loading the same skill again is a
255
+ no-op. If one tool fails to register, the whole attempt is unwound and the agent
256
+ stays inactive — a half-attached surface would leave the model with a tool it
257
+ cannot rely on. Registrations live exactly as long as the agent that owns them,
258
+ so disposal and plugin unload leave no scoped tool behind.
259
+
260
+ A resumed chat is restored from its own journal: the successful `skill` load is
261
+ already recorded there as a standard `tool/call`/`tool/result` pair, so the
262
+ current catalog is re-attached before the first model step. The plugin appends
263
+ no session event of its own — an unknown event type without an `ignorable`
264
+ marker makes the whole log unreadable to a harness that does not mount this
265
+ plugin.
266
+
267
+ Set `tools.activationPresets` to the preset your QA surface pins (`qa-research`
268
+ in the deploy kit) in any Host that composes more than one agent type. With an
269
+ empty list the catalog is reachable by any agent that loads a skill of the same
270
+ name. `tools.dynamicActivation: false` restores the always-on behaviour and
271
+ attaches the catalog to every managed agent at creation — useful for a
272
+ deployment that would rather debug the tool surface than the trigger.
273
+
274
+ These tools are not `lockdown.toolPolicy.allow` entries, and cannot be: that
275
+ list is validated against the mounted catalog at attestation time, and a tool
276
+ that only appears later would fail the check. The QA execution guard authorizes
277
+ exactly the names the activation manager reports for the calling agent, so a
278
+ dynamically attached tool gets the same scrutiny as an allow-listed one. Tool
279
+ visibility is not an authorization boundary — a QA tool that writes must still
280
+ enforce its own permissions.
281
+
204
282
  ### Writable per-user research space
205
283
 
206
284
  Set `accounts.perUserWorkspace: true` only together with accounts, a registered
@@ -221,7 +299,24 @@ lockdown:
221
299
  permissionPreset: qa-workspace-write
222
300
  toolPolicy:
223
301
  mode: allow-list
224
- allow: [read, read_image, glob, grep, write, edit, web_search, web_fetch]
302
+ allow:
303
+ [
304
+ read,
305
+ read_image,
306
+ glob,
307
+ grep,
308
+ write,
309
+ edit,
310
+ web_search,
311
+ web_fetch,
312
+ dsh_git_context,
313
+ dsh_git_history,
314
+ dsh_git_show,
315
+ dsh_git_blame,
316
+ ]
317
+ sharedReadOnlyRoots:
318
+ - E:/qa-assistant/workspaces/docs
319
+ - E:/qa-assistant/workspaces/code
225
320
  ```
226
321
 
227
322
  The Host resolves that Workspace record's path and creates
@@ -233,12 +328,19 @@ global DSH session list rather than creating one Workspace row per account.
233
328
  The boundary combines DSH `workspace-write` with a Host tool guard for both
234
329
  read and write paths, canonicalizes existing ancestors to reject symlink
235
330
  escapes, propagates the root to subagent sessions, rejects shell/process/LSP
236
- and `dsh_git_*` escape hatches, limits one model-controlled write to 10 MiB,
331
+ escape hatches, permits filesystem reads in explicitly configured shared
332
+ read-only roots, and leaves repository selection to the separately configured
333
+ read-only Git plugin. Writes remain confined to the account directory. The
334
+ guard limits one model-controlled write to 10 MiB,
237
335
  and limits an account directory to 256 MiB. `web_fetch` plus `write` is the
238
336
  intended bounded research-download path; there is no unrestricted URL-to-disk
239
337
  or shell downloader. Account directories are persistent scratch space and are
240
338
  not deleted automatically.
241
339
 
340
+ For the layout above, configure `@yadsh/dsh-git-readonly` separately with
341
+ `repositoryRoots: ["E:/qa-assistant/workspaces/code"]`. That plugin is the
342
+ single repository-selection authority and exposes no mutating Git operation.
343
+
242
344
  Model override is opt-in: `provider` and `model` must be set together. Slash
243
345
  commands are rejected as plain QA input. Reasoning and tool details remain
244
346
  hidden by default. Enabling `ui.showReasoning` and `ui.showToolActivity` adds a
@@ -283,6 +385,19 @@ in. See
283
385
  [Configuration](https://github.com/xarleyn/dsh-plugins/blob/main/plugins/dsh-qa-surface/docs/CONFIGURATION.md)
284
386
  for the limits and the prompt's exact wording.
285
387
 
388
+ ### Starter messages
389
+
390
+ The same `Настройки` dialog carries a «Быстрые сообщения» section where the
391
+ signed-in user defines their own starter buttons: each entry is a label (what
392
+ the button reads) and a prompt (what pressing it sends), so a button can say
393
+ «Мои задачи» while sending a full tracker request. The deployment's
394
+ `suggestedQuestions` stay visible next to the user's own buttons unless the
395
+ user hides them with the section's toggle. The list is stored on the account
396
+ (next to the profile, in the accounts file), replaces wholesale on save, and
397
+ is pure UI preference — none of it reaches the agent prompt.
398
+ `accounts.starters.enabled` (default `true`) turns the section off for
399
+ deployments that want the buttons to stay operator-defined.
400
+
286
401
  Session policies:
287
402
 
288
403
  - `browser-persistent` restores the id stored in this browser, replacing stale
@@ -309,15 +424,30 @@ Sources are structured Host-owned provenance, independent of
309
424
  `ui.showToolActivity`. Successful reads/fetches, bounded web-search evidence,
310
425
  Jira/Confluence/knowledge results, and inherited subagent sources are
311
426
  normalized and deduplicated into one turn bundle. That exact bundle feeds the
312
- answer footer and the right rail's sources tab and is persisted as
313
- `qa/sources`, so reload does not rerun tools. Search-only discovery stays
314
- hidden by default.
427
+ answer footer and the right rail's sources tab and is persisted in the
428
+ plugin-owned `$DSH_HOME/qa-sources.json`, so reload does not rerun tools and
429
+ no custom event enters the Harness session journal. Search-only discovery
430
+ stays hidden by default.
431
+
432
+ Legacy sessions written by earlier releases can be repaired while DSH is
433
+ stopped. Preview changes first, then apply them with an automatic backup:
434
+
435
+ ```bash
436
+ qa-repair-sessions
437
+ qa-repair-sessions --write
438
+ ```
439
+
440
+ The repair only marks legacy `safety-gate/*` and `qa/sources` records as
441
+ ignorable; it does not delete them. Each changed session file is backed up as
442
+ `*.pre-plugin-event-repair.bak` before atomic replacement.
315
443
 
316
444
  Local file cards open a source-scoped, read-only preview after Host-side real
317
- path validation against the attested session root. Markdown opens rendered by
318
- default with an HTML-free renderer and offers `Rendered / Raw`; raw mode jumps
319
- to recorded line ranges. The endpoint cannot browse or write files and refuses
320
- paths that are not evidence in the canonical bundle.
445
+ path validation against the roots the QA read policy opens: the chat's own
446
+ directory, the configured shared read-only directories, and the attachment
447
+ store. Markdown opens rendered by default with an HTML-free renderer and offers
448
+ `Rendered / Raw`; raw mode jumps to recorded line ranges. The endpoint cannot
449
+ browse or write files and refuses paths that are not evidence in the canonical
450
+ bundle.
321
451
 
322
452
  Observable local subagents are inherited recursively. The internal
323
453
  `qa_report_sources` tool covers opaque delegated providers and is admitted as
@@ -357,6 +487,90 @@ transcript shows and image thumbnails resolved from the session's asset
357
487
  repository; each group jumps back to its message. Below 600px the rail goes
358
488
  full-bleed. The agents drawer keeps its own header drawer for now.
359
489
 
490
+ ### Panel extensions
491
+
492
+ QA Surface can host optional feature panels without importing those features.
493
+ The shell owns the launcher, side-by-side/fullscreen layout, resizing and
494
+ generic close chrome; an extension owns its feature state and controls. No
495
+ panel is shown, and no launcher space is reserved, when no extension is
496
+ installed.
497
+
498
+ An external client plugin uses two registrations. Metadata and navigation go
499
+ through the `qaSurfacePanels` service; the React body is registered separately
500
+ in the keyed `qa.surface.panel` slot under the same implementation id:
501
+
502
+ ```ts
503
+ import type { Context } from "@deepseek-ai/cordis"
504
+ import type { PropsRuntime } from "@deepseek-ai/dsh-client-ui-slots"
505
+ import type {} from "@deepseek-ai/dsh-client-ui-renderer/client"
506
+ import { QA_SURFACE_PANEL_SLOT } from "@yadsh/dsh-qa-surface/client/panels"
507
+
508
+ const id = "@example/dsh-qa-browser"
509
+
510
+ function BrowserPanel(props: PropsRuntime<typeof QA_SURFACE_PANEL_SLOT>) {
511
+ // panelId, panelKind, sessionId, visible, presentation, params,
512
+ // actions and a registration-lifetime AbortSignal arrive in props.
513
+ return null
514
+ }
515
+
516
+ export const inject = ["slots", "qaSurfacePanels"]
517
+
518
+ export function apply(ctx: Context) {
519
+ ctx.effect(() => ctx.qaSurfacePanels.register({
520
+ id,
521
+ kind: "browser",
522
+ title: () => "Browser",
523
+ icon: "browser",
524
+ order: 100,
525
+ keepMounted: true,
526
+ }))
527
+
528
+ ctx.slots.inject(QA_SURFACE_PANEL_SLOT, () =>
529
+ ctx.slots.register(
530
+ { name: QA_SURFACE_PANEL_SLOT, key: id },
531
+ BrowserPanel,
532
+ ),
533
+ )
534
+
535
+ ctx.qaSurfacePanels.open("browser", {
536
+ reason: "extension",
537
+ focus: false,
538
+ })
539
+ }
540
+ ```
541
+
542
+ The extension should declare both `slots` and `qaSurfacePanels` in its client
543
+ `inject` list instead of polling for load order. `keepMounted: true` preserves
544
+ local/continuous UI state while another panel is active; hidden retained bodies
545
+ are removed from keyboard navigation. Presentation state is browser-local and
546
+ never enters the DSH Session log. Browser processes, tools, security policy and
547
+ artifacts remain the responsibility of the Browser plugin, not QA Surface.
548
+
549
+ ### User Settings extensions
550
+
551
+ An optional client plugin can add a first-class page to the signed-in user's
552
+ existing `Настройки` dialog through the published
553
+ `@yadsh/dsh-qa-surface/client/settings` contract. Register the page with the
554
+ `qaUserSettingsSections` service; QA Surface owns the navigation and supplies
555
+ only the current account token to the selected page. The extension must still
556
+ authorize every Host call server-side and must not persist credentials in the
557
+ browser.
558
+
559
+ ```ts
560
+ import type { Context } from "@deepseek-ai/cordis"
561
+
562
+ export const inject = ["qaUserSettingsSections"]
563
+
564
+ export function apply(ctx: Context) {
565
+ ctx.effect(() => ctx.qaUserSettingsSections.register({
566
+ id: "integrations",
567
+ title: "Интеграции",
568
+ order: 40,
569
+ component: IntegrationsPage,
570
+ }))
571
+ }
572
+ ```
573
+
360
574
  Subagents: the deployment may opt the delegation family (`subagent`,
361
575
  `subagent_fork`, `send_message`, `list_agents`, `interrupt_agent`) into the
362
576
  lockdown allow-list; the preset must mount them. Launches then render as
@@ -374,7 +588,11 @@ used first) and intersects it with the Host session list, so users sharing the
374
588
  deployment never see each other's chats. An admin can explicitly enable
375
589
  `accounts.showOtherUsersChats: true` to add chats owned by other QA accounts,
376
590
  grouped by owner. Switching re-runs the full policy
377
- attestation; a chat the Host no longer lists is pruned from the index. Each
591
+ attestation, and that attestation materializes the chat's agent when the Host
592
+ does not hold one: DSH builds an agent on demand, so a chat restored after a
593
+ Host restart still opens (its composition is resumed from what the session
594
+ recorded) instead of failing as unavailable. A chat the Host no longer lists is
595
+ pruned from the index. Each
378
596
  row carries a two-click delete control that removes the chat from this
379
597
  browser's index; deleting the chat that is currently open continues in a
380
598
  fresh attested session. Host-side sessions are not deleted — DSH 0.1.x
@@ -430,6 +648,9 @@ from the actual deployment. A name that is not registered fails closed. The
430
648
  Host restriction retains exact allow-listed tools from the agent preset's
431
649
  ancestor scope, and the additional execution guard also denies session-scoped
432
650
  tools and `run_code` unless their exact names are allowed.
651
+ Host-installed integration plugins may add their own narrowly scoped tool names
652
+ through the QA Surface service; those executors must independently resolve the
653
+ owner-attested root principal and fail closed for unowned or child sessions.
433
654
 
434
655
  ## Security and deployment
435
656
 
@@ -11,10 +11,12 @@
11
11
  "sessions.binding",
12
12
  "settingsScope",
13
13
  "settings.onboarding list-slot shadowing",
14
+ "keyed child slots with owner props",
14
15
  "webServer.register",
15
16
  "typert.remote",
16
17
  "agentPresets.composedPreset",
17
18
  "permissionPresets.set",
19
+ "tools.schemas",
18
20
  "tools.restrict",
19
21
  "tools.guard",
20
22
  "tools.register",
@@ -22,8 +24,15 @@
22
24
  "agent.turn-stopping",
23
25
  "agent.currentInitiator",
24
26
  "systemPrompt.section",
25
- "workspaceRegistry.get"
27
+ "workspaceRegistry.get",
28
+ "skills.registerProvider",
29
+ "skills.change"
26
30
  ]
27
31
  },
32
+ "qaSurfacePanelExtensions": {
33
+ "version": 1,
34
+ "service": "qaSurfacePanels",
35
+ "bodySlot": "qa.surface.panel"
36
+ },
28
37
  "node": "^22.19.0 || >=24.0.0"
29
38
  }
package/cordis.patch.yml CHANGED
@@ -9,6 +9,14 @@
9
9
  matchChildren: true
10
10
  ui:
11
11
  showReset: false
12
+ # Fail closed: a composed tool gate's `ask` is refused, not answered.
13
+ # A deployment that wants the operator to answer it opts in with
14
+ # `interaction: { approvals: interactive }`.
15
+ interaction:
16
+ approvals: blocked
17
+ # Ask_user_question is refused, not answered (the tool is mounted per
18
+ # preset; opt in with `interaction: { questions: interactive }`).
19
+ questions: unsupported
12
20
  lockdown:
13
21
  enabled: true
14
22
  sandboxMode: read-only
@@ -17,4 +25,13 @@
17
25
  allowSessionReset: false
18
26
  toolPolicy:
19
27
  mode: allow-list
28
+ # Documents are the plugin's own tools, not preset tools: the four
29
+ # names below are registered by `documents.enabled` (default true)
30
+ # and stay invisible to a chat until they are listed here. They
31
+ # write an artifact bundle into the session workspace themselves,
32
+ # so `sandboxMode: read-only` is not what stops them.
33
+ # - document_create
34
+ # - document_to_markdown
35
+ # - document_convert
36
+ # - document_inspect
20
37
  allow: []
@@ -95,6 +95,16 @@ export function createQaAccountRemotes(options) {
95
95
  return store.updateOwnProfile(token, input);
96
96
  });
97
97
  },
98
+ updateStarters: (token, input) => {
99
+ const config = getConfig();
100
+ const store = requireAccounts();
101
+ return run(() => {
102
+ if (!config.accounts.starters.enabled) {
103
+ throw new QaAccountsError("starters-disabled", "self-service starter messages are disabled on this deployment");
104
+ }
105
+ return store.updateOwnStarters(token, input);
106
+ });
107
+ },
98
108
  };
99
109
  }
100
110
  //# sourceMappingURL=account-remotes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-remotes.js","sourceRoot":"","sources":["../src/account-remotes.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,eAAe,EACf,uBAAuB,GACxB,MAAM,qBAAqB,CAAC;AAW7B,MAAM,uBAAuB,GAC3B,iDAAiD,CAAC;AAqCpD,8EAA8E;AAC9E,MAAM,UAAU,sBAAsB,CAAC,OAGtC;IACC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACtC,2EAA2E;IAC3E,8CAA8C;IAC9C,IAA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AC;YAC3B,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;oBACrC,MAAM,IAAI,eAAe,CACvB,kBAAkB,EAClB,uDAAuD,CACxD,CAAC;gBACJ,CAAC;gBACD,OAAO,KAAK,CAAC,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;QACL,CAAC;QACD,cAAc,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;YAC/B,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,KAAK,GAAG,eAAe,EAAE,CAAC;YAChC,OAAO,GAAG,CAAC,GAAG,EAAE;gBACd,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;oBACtC,MAAM,IAAI,eAAe,CACvB,mBAAmB,EACnB,+DAA+D,CAChE,CAAC;gBACJ,CAAC;gBACD,OAAO,KAAK,CAAC,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -3,6 +3,17 @@ const MIN_PASSWORD_LENGTH = 8;
3
3
  const MAX_PASSWORD_LENGTH = 200;
4
4
  const MAX_DISPLAY_NAME_LENGTH = 100;
5
5
  const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/u;
6
+ /**
7
+ * The length gate every path that sets a password goes through — registration,
8
+ * the operator's addUser, and a reset — so a password good enough to register is
9
+ * exactly the one an operator can put back.
10
+ */
11
+ export function validatePassword(password) {
12
+ if (password.length < MIN_PASSWORD_LENGTH ||
13
+ password.length > MAX_PASSWORD_LENGTH) {
14
+ throw new QaAccountsError("weak-password", `password must be ${MIN_PASSWORD_LENGTH} to ${MAX_PASSWORD_LENGTH} characters`);
15
+ }
16
+ }
6
17
  /**
7
18
  * The email/password/display-name gate shared by self-registration and the
8
19
  * operator's addUser, so both paths reject unusable input with the same
@@ -14,10 +25,7 @@ export function validateCredentials(email, password, displayName) {
14
25
  if (!EMAIL_PATTERN.test(normalized) || normalized.length > 254) {
15
26
  throw new QaAccountsError("invalid-email", "email is not a usable address");
16
27
  }
17
- if (password.length < MIN_PASSWORD_LENGTH ||
18
- password.length > MAX_PASSWORD_LENGTH) {
19
- throw new QaAccountsError("weak-password", `password must be ${MIN_PASSWORD_LENGTH} to ${MAX_PASSWORD_LENGTH} characters`);
20
- }
28
+ validatePassword(password);
21
29
  const name = (displayName ?? "").trim();
22
30
  if (name.length > MAX_DISPLAY_NAME_LENGTH) {
23
31
  throw new QaAccountsError("invalid-display-name", `display name must be at most ${MAX_DISPLAY_NAME_LENGTH} characters`);
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/accounts/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAChC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AACpC,MAAM,aAAa,GAAG,6BAA6B,CAAC;AASpD;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,QAAgB,EAChB,WAA+B;IAE/B,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC9C,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QAC/D,MAAM,IAAI,eAAe,CAAC,eAAe,EAAE,+BAA+B,CAAC,CAAC;IAC9E,CAAC;IACD,IACE,QAAQ,CAAC,MAAM,GAAG,mBAAmB;QACrC,QAAQ,CAAC,MAAM,GA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C;QAC/D,MAAM,IAAI,eAAe,CAAC,eAAe,EAAE,+BAA+B,CAAC,CAAC;IAC9E,CAAC;IACD,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3B,MAAM,IAAI,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,IAAI,IAAI,CAAC,MAAM,GAAG,uBAAuB,EAAE,CAAC;QAC1C,MAAM,IAAI,eAAe,CACvB,sBAAsB,EACtB,gCAAgC,uBAAuB,aAAa,CACrE,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/accounts/errors.ts"],"names":[],"mappings":"AAqBA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAE7B,MAAM;IADjB,YACW,MAA6B,EACtC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;sBAHN,MAAM;QAIf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/accounts/errors.ts"],"names":[],"mappings":"AAuBA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAE7B,MAAM;IADjB,YACW,MAA6B,EACtC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;sBAHN,MAAM;QAIf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/accounts/file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EACL,SAAS,EACT,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,IAAI,MAAM,WAAW,CA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ACnB,CAAC;IACD,IACE,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO;QACtC,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,CAAC,IAAI,EAChC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { randomBytes, randomUUID, scryptSync, timingSafeEqual, } from "node:crypto";
2
2
  import { QA_PROFILE_DEFAULT_INSTRUCTIONS_MAX, normalizeProfile, validateProfileWrite, } from "../profile.js";
3
- import { validateCredentials } from "./credentials.js";
3
+ import { normalizeStarters, validateStartersWrite } from "../starters.js";
4
+ import { validateCredentials, validatePassword } from "./credentials.js";
4
5
  import { QaAccountsError } from "./errors.js";
5
6
  import { createFileStampRef, defaultAccountsFilePath, loadAccountsFile, persistAccountsFile, reloadAccountsFileIfChanged, } from "./file.js";
6
7
  import { mintToken, verifyToken } from "./token.js";
@@ -19,6 +20,7 @@ function toPublic(user) {
19
20
  lastLoginAt: user.lastLoginAt,
20
21
  disabled: user.disabled === true,
21
22
  profile: normalizeProfile(user.profile),
23
+ starters: normalizeStarters(user.starters),
22
24
  };
23
25
  }
24
26
  function hashPassword(password) {
@@ -361,6 +363,21 @@ export class QaAccounts {
361
363
  setUserRole(email, role) {
362
364
  return toPublic(this.editUser(email, (user) => ({ ...user, role })));
363
365
  }
366
+ /**
367
+ * Replace an account's password, which is what a forgotten one needs. The
368
+ * token version bumps with it, so every token minted under the old password
369
+ * dies server-side: a reset is also the response to a leaked credential.
370
+ * Ownership, profile and the account id survive, so the user's chats are
371
+ * still theirs after signing in again.
372
+ */
373
+ setPassword(email, password) {
374
+ validatePassword(password);
375
+ return toPublic(this.editUser(email, (user) => ({
376
+ ...user,
377
+ passwordHash: hashPassword(password),
378
+ tokenVersion: (user.tokenVersion ?? 0) + 1,
379
+ })));
380
+ }
364
381
  /**
365
382
  * Disable an account: future logins are refused and every live token is
366
383
  * invalidated (the token version bumps). `enable` does not resurrect old
@@ -432,6 +449,26 @@ export class QaAccounts {
432
449
  const user = this.requireUser(token);
433
450
  return this.setProfile(user.email, input);
434
451
  }
452
+ /**
453
+ * Replace the token account's starter buttons. Same self-service shape as
454
+ * {@link updateOwnProfile}: the token is the only identity, and a rejected
455
+ * write leaves the stored record untouched.
456
+ */
457
+ updateOwnStarters(token, input) {
458
+ this.reloadIfChanged();
459
+ const user = this.requireUser(token);
460
+ const result = validateStartersWrite(input);
461
+ if (!result.ok) {
462
+ throw new QaAccountsError("invalid-starters", result.message);
463
+ }
464
+ return toPublic(this.editUser(user.email, (current) => ({
465
+ ...current,
466
+ starters: {
467
+ items: result.value.items.map((item) => ({ ...item })),
468
+ hideDefaults: result.value.hideDefaults,
469
+ },
470
+ })));
471
+ }
435
472
  /**
436
473
  * Validate one profile write and stamp it onto the account. Throws before
437
474
  * anything is mutated, so a rejected write leaves the stored profile, and