@yadsh/dsh-qa-surface 0.3.0 → 0.5.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 (276) hide show
  1. package/README.md +192 -15
  2. package/cordis.patch.yml +8 -0
  3. package/lib/account-remotes.js +100 -0
  4. package/lib/account-remotes.js.map +1 -0
  5. package/lib/accounts/credentials.js +35 -0
  6. package/lib/accounts/credentials.js.map +1 -0
  7. package/lib/accounts/errors.js +9 -0
  8. package/lib/accounts/errors.js.map +1 -0
  9. package/lib/accounts/file.js +101 -0
  10. package/lib/accounts/file.js.map +1 -0
  11. package/lib/accounts/store.js +159 -161
  12. package/lib/accounts/store.js.map +1 -1
  13. package/lib/accounts/token.js +61 -0
  14. package/lib/accounts/token.js.map +1 -0
  15. package/lib/approvals.js +179 -0
  16. package/lib/approvals.js.map +1 -0
  17. package/lib/attachment-rules.js +111 -0
  18. package/lib/attachment-rules.js.map +1 -0
  19. package/lib/cli.js +132 -9
  20. package/lib/cli.js.map +1 -1
  21. package/lib/client/QaAccountsController.js +32 -2
  22. package/lib/client/QaAccountsController.js.map +1 -1
  23. package/lib/client/QaSessionController.js +140 -65
  24. package/lib/client/QaSessionController.js.map +1 -1
  25. package/lib/client/QaSurface.js +134 -107
  26. package/lib/client/QaSurface.js.map +1 -1
  27. package/lib/client/QaTranscriptAdapter.js +71 -6
  28. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  29. package/lib/client/approvals.js +104 -0
  30. package/lib/client/approvals.js.map +1 -0
  31. package/lib/client/attachments.js +150 -0
  32. package/lib/client/attachments.js.map +1 -0
  33. package/lib/client/attestation.js +4 -1
  34. package/lib/client/attestation.js.map +1 -1
  35. package/lib/client/base64.js +16 -0
  36. package/lib/client/base64.js.map +1 -0
  37. package/lib/client/chat-files.js +48 -0
  38. package/lib/client/chat-files.js.map +1 -0
  39. package/lib/client/components/Markdown.js +1 -1
  40. package/lib/client/components/Markdown.js.map +1 -1
  41. package/lib/client/components/QaApproval.js +23 -0
  42. package/lib/client/components/QaApproval.js.map +1 -0
  43. package/lib/client/components/QaChangelog.js +62 -19
  44. package/lib/client/components/QaChangelog.js.map +1 -1
  45. package/lib/client/components/QaComposer.js +56 -74
  46. package/lib/client/components/QaComposer.js.map +1 -1
  47. package/lib/client/components/QaFileAttachment.js +19 -0
  48. package/lib/client/components/QaFileAttachment.js.map +1 -0
  49. package/lib/client/components/QaFilesPanel.js +45 -0
  50. package/lib/client/components/QaFilesPanel.js.map +1 -0
  51. package/lib/client/components/QaHeader.js +34 -0
  52. package/lib/client/components/QaHeader.js.map +1 -0
  53. package/lib/client/components/QaMessage.js +17 -4
  54. package/lib/client/components/QaMessage.js.map +1 -1
  55. package/lib/client/components/QaModal.js +31 -0
  56. package/lib/client/components/QaModal.js.map +1 -0
  57. package/lib/client/components/QaProfile.js +64 -0
  58. package/lib/client/components/QaProfile.js.map +1 -0
  59. package/lib/client/components/QaQuestions.js +96 -0
  60. package/lib/client/components/QaQuestions.js.map +1 -0
  61. package/lib/client/components/QaRightRail.js +15 -0
  62. package/lib/client/components/QaRightRail.js.map +1 -0
  63. package/lib/client/components/QaSidebar.js +6 -1
  64. package/lib/client/components/QaSidebar.js.map +1 -1
  65. package/lib/client/components/{QaSourcesDrawer.js → QaSourcesPanel.js} +3 -3
  66. package/lib/client/components/QaSourcesPanel.js.map +1 -0
  67. package/lib/client/components/QaTurnRail.js +15 -0
  68. package/lib/client/components/QaTurnRail.js.map +1 -1
  69. package/lib/client/components/QaWidthHandle.js +25 -20
  70. package/lib/client/components/QaWidthHandle.js.map +1 -1
  71. package/lib/client/components/QaWorkGroup.js +19 -20
  72. package/lib/client/components/QaWorkGroup.js.map +1 -1
  73. package/lib/client/components/surface-utils.js +28 -0
  74. package/lib/client/components/surface-utils.js.map +1 -0
  75. package/lib/client/components/thinking-phrases.js +24 -0
  76. package/lib/client/components/thinking-phrases.js.map +1 -0
  77. package/lib/client/create-session.js +7 -32
  78. package/lib/client/create-session.js.map +1 -1
  79. package/lib/client/failure-copy.js +63 -0
  80. package/lib/client/failure-copy.js.map +1 -0
  81. package/lib/client/index.js +49 -7
  82. package/lib/client/index.js.map +1 -1
  83. package/lib/client/project-session-state.js +5 -3
  84. package/lib/client/project-session-state.js.map +1 -1
  85. package/lib/client/prompt-content.js +54 -0
  86. package/lib/client/prompt-content.js.map +1 -0
  87. package/lib/client/questions.js +114 -0
  88. package/lib/client/questions.js.map +1 -0
  89. package/lib/client/settings/card.js +143 -0
  90. package/lib/client/settings/card.js.map +1 -0
  91. package/lib/client/settings/fields.js +145 -0
  92. package/lib/client/settings/fields.js.map +1 -0
  93. package/lib/client/settings/format.js +255 -0
  94. package/lib/client/settings/format.js.map +1 -0
  95. package/lib/client/settings/sections/access.js +25 -0
  96. package/lib/client/settings/sections/access.js.map +1 -0
  97. package/lib/client/settings/sections/accounts.js +47 -0
  98. package/lib/client/settings/sections/accounts.js.map +1 -0
  99. package/lib/client/settings/sections/attachments.js +46 -0
  100. package/lib/client/settings/sections/attachments.js.map +1 -0
  101. package/lib/client/settings/sections/branding.js +28 -0
  102. package/lib/client/settings/sections/branding.js.map +1 -0
  103. package/lib/client/settings/sections/common.js +20 -0
  104. package/lib/client/settings/sections/common.js.map +1 -0
  105. package/lib/client/settings/sections/embedding.js +19 -0
  106. package/lib/client/settings/sections/embedding.js.map +1 -0
  107. package/lib/client/settings/sections/interface.js +60 -0
  108. package/lib/client/settings/sections/interface.js.map +1 -0
  109. package/lib/client/settings/sections/lockdown.js +82 -0
  110. package/lib/client/settings/sections/lockdown.js.map +1 -0
  111. package/lib/client/settings/sections/session.js +53 -0
  112. package/lib/client/settings/sections/session.js.map +1 -0
  113. package/lib/client/settings/sections/sources.js +74 -0
  114. package/lib/client/settings/sections/sources.js.map +1 -0
  115. package/lib/client/settings/sections/status.js +37 -0
  116. package/lib/client/settings/sections/status.js.map +1 -0
  117. package/lib/client/settings/sections.js +23 -0
  118. package/lib/client/settings/sections.js.map +1 -0
  119. package/lib/client/settings/styles.js +57 -0
  120. package/lib/client/settings/styles.js.map +1 -0
  121. package/lib/client/stream-publisher.js +47 -0
  122. package/lib/client/stream-publisher.js.map +1 -0
  123. package/lib/client/styles.js +127 -19
  124. package/lib/client/styles.js.map +1 -1
  125. package/lib/client/types.js +2 -0
  126. package/lib/client/types.js.map +1 -1
  127. package/lib/client/use-right-rail.js +96 -0
  128. package/lib/client/use-right-rail.js.map +1 -0
  129. package/lib/client/use-session-ui-state.js +26 -19
  130. package/lib/client/use-session-ui-state.js.map +1 -1
  131. package/lib/client.js +5694 -813
  132. package/lib/client.js.map +1 -1
  133. package/lib/config-resolvers/accounts.js +60 -0
  134. package/lib/config-resolvers/accounts.js.map +1 -0
  135. package/lib/config-resolvers/attachments.js +28 -0
  136. package/lib/config-resolvers/attachments.js.map +1 -0
  137. package/lib/config-resolvers/basics.js +61 -0
  138. package/lib/config-resolvers/basics.js.map +1 -0
  139. package/lib/config-resolvers/defaults.js +136 -0
  140. package/lib/config-resolvers/defaults.js.map +1 -0
  141. package/lib/config-resolvers/lockdown.js +90 -0
  142. package/lib/config-resolvers/lockdown.js.map +1 -0
  143. package/lib/config-resolvers/session.js +42 -0
  144. package/lib/config-resolvers/session.js.map +1 -0
  145. package/lib/config-resolvers/shared.js +51 -0
  146. package/lib/config-resolvers/shared.js.map +1 -0
  147. package/lib/config-resolvers/sources.js +83 -0
  148. package/lib/config-resolvers/sources.js.map +1 -0
  149. package/lib/config-resolvers/ui.js +20 -0
  150. package/lib/config-resolvers/ui.js.map +1 -0
  151. package/lib/config.js +76 -6
  152. package/lib/config.js.map +1 -1
  153. package/lib/entry-redirect.js +2 -1
  154. package/lib/entry-redirect.js.map +1 -1
  155. package/lib/index.js +198 -79
  156. package/lib/index.js.map +1 -1
  157. package/lib/profile.js +214 -0
  158. package/lib/profile.js.map +1 -0
  159. package/lib/prompt-notes.js +231 -0
  160. package/lib/prompt-notes.js.map +1 -0
  161. package/lib/provenance/host-store.js +25 -9
  162. package/lib/provenance/host-store.js.map +1 -1
  163. package/lib/provenance/reported.js +37 -12
  164. package/lib/provenance/reported.js.map +1 -1
  165. package/lib/questions.js +185 -0
  166. package/lib/questions.js.map +1 -0
  167. package/lib/resolve-config.js +35 -410
  168. package/lib/resolve-config.js.map +1 -1
  169. package/lib/secure-session.js +139 -21
  170. package/lib/secure-session.js.map +1 -1
  171. package/lib/session-ownership.js +55 -0
  172. package/lib/session-ownership.js.map +1 -0
  173. package/lib/shared/session-key.js +18 -0
  174. package/lib/shared/session-key.js.map +1 -0
  175. package/lib/shared/settings.js +10 -0
  176. package/lib/shared/settings.js.map +1 -0
  177. package/lib/thinking-phrases.js +68 -0
  178. package/lib/thinking-phrases.js.map +1 -0
  179. package/lib/typert.host.js +506 -21
  180. package/lib/typert.remote-client.d.ts +15 -1
  181. package/lib/typert.remote-client.js +407 -15
  182. package/lib/types/account-remotes.d.ts +42 -0
  183. package/lib/types/accounts/credentials.d.ts +20 -0
  184. package/lib/types/accounts/errors.d.ts +11 -0
  185. package/lib/types/accounts/file.d.ts +82 -0
  186. package/lib/types/accounts/store.d.ts +74 -43
  187. package/lib/types/accounts/token.d.ts +31 -0
  188. package/lib/types/approvals.d.ts +65 -0
  189. package/lib/types/attachment-rules.d.ts +44 -0
  190. package/lib/types/cli.d.ts +2 -2
  191. package/lib/types/client/QaAccountsController.d.ts +8 -1
  192. package/lib/types/client/QaSessionController.d.ts +53 -16
  193. package/lib/types/client/QaSurface.d.ts +14 -1
  194. package/lib/types/client/approvals.d.ts +39 -0
  195. package/lib/types/client/attachments.d.ts +54 -0
  196. package/lib/types/client/base64.d.ts +10 -0
  197. package/lib/types/client/chat-files.d.ts +30 -0
  198. package/lib/types/client/components/QaApproval.d.ts +13 -0
  199. package/lib/types/client/components/QaChangelog.d.ts +1 -1
  200. package/lib/types/client/components/QaComposer.d.ts +8 -4
  201. package/lib/types/client/components/QaFileAttachment.d.ts +14 -0
  202. package/lib/types/client/components/QaFilesPanel.d.ts +15 -0
  203. package/lib/types/client/components/QaHeader.d.ts +41 -0
  204. package/lib/types/client/components/QaMessage.d.ts +3 -1
  205. package/lib/types/client/components/QaModal.d.ts +26 -0
  206. package/lib/types/client/components/QaProfile.d.ts +25 -0
  207. package/lib/types/client/components/QaQuestions.d.ts +13 -0
  208. package/lib/types/client/components/QaRightRail.d.ts +23 -0
  209. package/lib/types/client/components/QaSidebar.d.ts +14 -0
  210. package/lib/types/client/components/{QaSourcesDrawer.d.ts → QaSourcesPanel.d.ts} +7 -4
  211. package/lib/types/client/components/QaTurnRail.d.ts +6 -0
  212. package/lib/types/client/components/QaWidthHandle.d.ts +14 -7
  213. package/lib/types/client/components/QaWorkGroup.d.ts +5 -3
  214. package/lib/types/client/components/surface-utils.d.ts +11 -0
  215. package/lib/types/client/components/thinking-phrases.d.ts +9 -0
  216. package/lib/types/client/create-session.d.ts +6 -9
  217. package/lib/types/client/failure-copy.d.ts +19 -0
  218. package/lib/types/client/project-session-state.d.ts +8 -1
  219. package/lib/types/client/prompt-content.d.ts +30 -0
  220. package/lib/types/client/questions.d.ts +45 -0
  221. package/lib/types/client/settings/card.d.ts +23 -0
  222. package/lib/types/client/settings/fields.d.ts +139 -0
  223. package/lib/types/client/settings/format.d.ts +108 -0
  224. package/lib/types/client/settings/sections/access.d.ts +9 -0
  225. package/lib/types/client/settings/sections/accounts.d.ts +9 -0
  226. package/lib/types/client/settings/sections/attachments.d.ts +15 -0
  227. package/lib/types/client/settings/sections/branding.d.ts +8 -0
  228. package/lib/types/client/settings/sections/common.d.ts +28 -0
  229. package/lib/types/client/settings/sections/embedding.d.ts +8 -0
  230. package/lib/types/client/settings/sections/interface.d.ts +9 -0
  231. package/lib/types/client/settings/sections/lockdown.d.ts +9 -0
  232. package/lib/types/client/settings/sections/session.d.ts +9 -0
  233. package/lib/types/client/settings/sections/sources.d.ts +9 -0
  234. package/lib/types/client/settings/sections/status.d.ts +22 -0
  235. package/lib/types/client/settings/sections.d.ts +25 -0
  236. package/lib/types/client/settings/styles.d.ts +8 -0
  237. package/lib/types/client/stream-publisher.d.ts +28 -0
  238. package/lib/types/client/types.d.ts +76 -1
  239. package/lib/types/client/use-right-rail.d.ts +56 -0
  240. package/lib/types/client/use-session-ui-state.d.ts +13 -7
  241. package/lib/types/config-resolvers/accounts.d.ts +15 -0
  242. package/lib/types/config-resolvers/attachments.d.ts +6 -0
  243. package/lib/types/config-resolvers/basics.d.ts +8 -0
  244. package/lib/types/config-resolvers/defaults.d.ts +4 -0
  245. package/lib/types/config-resolvers/lockdown.d.ts +10 -0
  246. package/lib/types/config-resolvers/session.d.ts +6 -0
  247. package/lib/types/config-resolvers/shared.d.ts +23 -0
  248. package/lib/types/config-resolvers/sources.d.ts +6 -0
  249. package/lib/types/config-resolvers/ui.d.ts +6 -0
  250. package/lib/types/index.d.ts +48 -15
  251. package/lib/types/profile.d.ts +76 -0
  252. package/lib/types/prompt-notes.d.ts +110 -0
  253. package/lib/types/provenance/reported.d.ts +9 -1
  254. package/lib/types/questions.d.ts +83 -0
  255. package/lib/types/resolve-config.d.ts +8 -3
  256. package/lib/types/secure-session.d.ts +46 -2
  257. package/lib/types/session-ownership.d.ts +30 -0
  258. package/lib/types/shared/session-key.d.ts +23 -0
  259. package/lib/types/shared/settings.d.ts +10 -0
  260. package/lib/types/thinking-phrases.d.ts +17 -0
  261. package/lib/types/types.d.ts +203 -9
  262. package/lib/types/user-workspace.d.ts +42 -0
  263. package/lib/user-workspace.js +246 -0
  264. package/lib/user-workspace.js.map +1 -0
  265. package/package.json +15 -8
  266. package/CHANGELOG.md +0 -176
  267. package/SPEC-dsh-qa-surface.md +0 -2425
  268. package/docs/ARCHITECTURE.md +0 -66
  269. package/docs/COMPATIBILITY.md +0 -14
  270. package/docs/CONFIGURATION.md +0 -199
  271. package/docs/EMBEDDING.md +0 -13
  272. package/docs/SOURCES-MIGRATION.md +0 -28
  273. package/docs/SOURCES-PROVENANCE-AUDIT.md +0 -88
  274. package/docs/SPEC-dsh-qa-surface-accounts.md +0 -219
  275. package/docs/SPEC-dsh-qa-surface-sources-provenance.md +0 -1692
  276. package/lib/client/components/QaSourcesDrawer.js.map +0 -1
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The browser-local key namespace every QA-side index derives from: the
3
+ * configured storage key pinned to the served route, versioned once so the
4
+ * Host's head-script injection and the client bundle cannot drift apart.
5
+ *
6
+ * Dependency-free like every `src/shared` module: both bundles inline it.
7
+ */
8
+ /**
9
+ * The versioned key prefix for browser-local QA state of one deployment.
10
+ * Callers append their own scope suffix (`:account-token`, `:welcome-notice`,
11
+ * `:chat:<id>`, …).
12
+ * @param config - configuration holding the storage key and the route path.
13
+ * @returns the versioned prefix, e.g. `dsh-qa-surface.session:v1:/qa`.
14
+ */
15
+ export declare function qaStorageNamespace(config: Readonly<{
16
+ session: {
17
+ storageKey: string;
18
+ };
19
+ route: {
20
+ path: string;
21
+ };
22
+ }>): string;
23
+ //# sourceMappingURL=session-key.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Identity shared by the Host plugin and its browser settings card.
3
+ *
4
+ * This module must stay dependency-free: the card bundle inlines it, and a
5
+ * browser build must not pull the Host config surface (schemastery) into the
6
+ * page just to learn the namespace name.
7
+ */
8
+ /** Settings namespace the QA surface owns and its card binds to. */
9
+ export declare const QA_SURFACE_SETTINGS_NAMESPACE = "qa-surface";
10
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Phrases the running indicator cycles through. The list deliberately mixes
3
+ * Russian idiom with workshop imagery: a turn that keeps reshuffling the same
4
+ * thought in new words reads as alive, while a frozen one reads as stuck.
5
+ *
6
+ * Operators replace the list through `thinkingPhrases`; this module holds the
7
+ * canonical default so the config schema, the resolver and the browser all
8
+ * read one list.
9
+ */
10
+ export declare const DEFAULT_THINKING_PHRASES: readonly string[];
11
+ /**
12
+ * Phrase shown `elapsedMs` into a running turn. The list is operator supplied,
13
+ * so an empty one falls back to the default: the indicator always needs a
14
+ * label.
15
+ */
16
+ export declare function thinkingPhrase(elapsedMs: number, phrases?: readonly string[]): string;
17
+ //# sourceMappingURL=thinking-phrases.d.ts.map
@@ -1,8 +1,27 @@
1
1
  import type { QaTurnSources } from "./provenance/types.js";
2
2
  export type QaSessionPolicy = "browser-persistent" | "new-on-load" | "fixed";
3
- export type QaSandboxMode = "read-only";
3
+ export type QaSandboxMode = "read-only" | "workspace-write";
4
4
  export type QaApprovalPolicy = "never";
5
5
  export type QaToolPolicyMode = "allow-list";
6
+ /**
7
+ * How a tool policy `ask` resolves on an attested QA agent. `blocked` refuses
8
+ * the call with the surface's own reason; `interactive` parks it until the
9
+ * operator answers in the QA view.
10
+ */
11
+ export type QaApprovalInteraction = "blocked" | "interactive";
12
+ /**
13
+ * How a user-questions request resolves on an attested QA agent. `unsupported`
14
+ * refuses the ask outright; `interactive` answers it from the QA view.
15
+ */
16
+ export type QaQuestionInteraction = "unsupported" | "interactive";
17
+ /** The operator's answer to one parked tool call. */
18
+ export type QaApprovalDecision = "allowed-once" | "rejected";
19
+ /** One answered question; `custom` is free text, and may accompany `selected`. */
20
+ export interface QaQuestionAnswerItem {
21
+ readonly id: string;
22
+ readonly selected: readonly string[];
23
+ readonly custom?: string;
24
+ }
6
25
  export type QaAccountRole = "user" | "admin";
7
26
  /** The account fields projected to browsers; never includes credentials. */
8
27
  export interface QaAccountUserPublic {
@@ -13,6 +32,36 @@ export interface QaAccountUserPublic {
13
32
  readonly createdAt: string;
14
33
  readonly lastLoginAt: string | null;
15
34
  readonly disabled: boolean;
35
+ /** Self-declared identity the QA prompt renders; empty until edited. */
36
+ readonly profile: QaAccountProfile;
37
+ }
38
+ /** One external system the deployment collects a handle for. */
39
+ export interface QaAccountIdentityField {
40
+ /** Stable lowercase key: the profile's storage key and the prompt's label. */
41
+ readonly key: string;
42
+ /** Operator copy shown in the profile form. */
43
+ readonly label: string;
44
+ }
45
+ /**
46
+ * What one account says about itself. Every value is the owner's own wording,
47
+ * which is why the prompt renders it as self-declared rather than as a
48
+ * verified directory attribute.
49
+ */
50
+ export interface QaAccountProfile {
51
+ /** Full name as the user writes it; empty when unset. */
52
+ readonly fullName: string;
53
+ /** External-system handles, keyed by the declared field key. */
54
+ readonly identities: Readonly<Record<string, string>>;
55
+ /** Free-form guidance about how the user wants answers; empty when unset. */
56
+ readonly instructions: string;
57
+ /** ISO timestamp of the last edit; null while the profile is untouched. */
58
+ readonly updatedAt: string | null;
59
+ }
60
+ /** Full-replace profile write: an absent value clears the stored one. */
61
+ export interface QaAccountProfileInput {
62
+ readonly fullName: string;
63
+ readonly identities: Readonly<Record<string, string>>;
64
+ readonly instructions: string;
16
65
  }
17
66
  /** One successful login/registration: the bearer token plus the user. */
18
67
  export interface QaAccountSession {
@@ -77,6 +126,11 @@ export interface QaSourcesConfig {
77
126
  readonly inheritSources?: boolean;
78
127
  readonly enableReportToolFallback?: boolean;
79
128
  readonly markIncompleteOpaqueRuns?: boolean;
129
+ /**
130
+ * Whether a source the model writes into `qa_report_sources` must carry a
131
+ * usable path or URL. Off records the model's own type, title and snippet.
132
+ */
133
+ readonly validateReportedSources?: boolean;
80
134
  };
81
135
  readonly legacy?: {
82
136
  readonly parseAssistantSourcesBlock?: boolean;
@@ -117,13 +171,19 @@ export interface QaSurfaceConfig {
117
171
  readonly showToolActivity?: boolean;
118
172
  readonly showReasoning?: boolean;
119
173
  readonly renderMarkdown?: boolean;
120
- readonly maxContentWidth?: number;
174
+ /** Floor for the visitor-resizable transcript/composer width; the page caps it. */
175
+ readonly minContentWidth?: number;
121
176
  readonly showSessionList?: boolean;
122
177
  };
123
178
  readonly suggestedQuestions?: readonly string[];
179
+ /**
180
+ * Phrases the running indicator cycles through. An empty list restores the
181
+ * built-in phrases: the indicator always carries a label.
182
+ */
183
+ readonly thinkingPhrases?: readonly string[];
124
184
  readonly interaction?: {
125
- readonly approvals?: "blocked";
126
- readonly questions?: "unsupported";
185
+ readonly approvals?: QaApprovalInteraction;
186
+ readonly questions?: QaQuestionInteraction;
127
187
  };
128
188
  readonly lockdown?: {
129
189
  readonly enabled?: boolean;
@@ -144,6 +204,8 @@ export interface QaSurfaceConfig {
144
204
  readonly mode?: QaToolPolicyMode;
145
205
  readonly allow?: readonly string[];
146
206
  };
207
+ /** Shared directories available to read-only filesystem tools. */
208
+ readonly sharedReadOnlyRoots?: readonly string[];
147
209
  };
148
210
  readonly embedding?: {
149
211
  readonly frameAncestors?: string | null;
@@ -155,6 +217,24 @@ export interface QaSurfaceConfig {
155
217
  readonly sessionTtlDays?: number;
156
218
  /** Let admins see chats owned by other QA accounts. */
157
219
  readonly showOtherUsersChats?: boolean;
220
+ /**
221
+ * Give every account a private cwd below the configured workspaceId.
222
+ * The child directory is not registered as a separate DSH workspace.
223
+ */
224
+ readonly perUserWorkspace?: boolean;
225
+ /** Self-declared profile: storage, the owner's form, and prompt injection. */
226
+ readonly profile?: {
227
+ readonly enabled?: boolean;
228
+ /** Render the profile into the QA agent's system prompt. */
229
+ readonly inject?: boolean;
230
+ /** External systems to collect a handle for; empty declares none. */
231
+ readonly identities?: readonly {
232
+ readonly key?: string;
233
+ readonly label?: string;
234
+ }[];
235
+ /** Character cap on the user's free-form agent guidance. */
236
+ readonly instructionsMaxLength?: number;
237
+ };
158
238
  };
159
239
  readonly entry?: {
160
240
  /** Inject the root → /qa redirect for non-loopback hostnames. */
@@ -163,6 +243,26 @@ export interface QaSurfaceConfig {
163
243
  readonly cookieBootstrap?: boolean;
164
244
  };
165
245
  readonly sources?: QaSourcesConfig;
246
+ readonly attachments?: QaAttachmentsConfig;
247
+ }
248
+ /** What a QA visitor may attach to one message. */
249
+ export interface QaAttachmentsConfig {
250
+ /** Offer text files (md, txt, log, …) next to images; off = images only. */
251
+ readonly textFiles?: boolean;
252
+ /**
253
+ * Line count above which pasted plain text becomes an attached file instead
254
+ * of landing in the input field. Zero never converts.
255
+ */
256
+ readonly pastedTextLines?: number;
257
+ /** Byte ceiling for one attached file; the composer refuses anything larger. */
258
+ readonly maxFileBytes?: number;
259
+ /**
260
+ * Pending attachments (images plus text files) allowed on one message. The
261
+ * Host keeps its own authority over assembled image batches.
262
+ */
263
+ readonly maxPending?: number;
264
+ /** Accepted text-file extensions, lowercase and without the dot. */
265
+ readonly extensions?: readonly string[];
166
266
  }
167
267
  export interface ResolvedQaSurfaceConfig {
168
268
  readonly enabled: boolean;
@@ -197,13 +297,14 @@ export interface ResolvedQaSurfaceConfig {
197
297
  readonly showToolActivity: boolean;
198
298
  readonly showReasoning: boolean;
199
299
  readonly renderMarkdown: boolean;
200
- readonly maxContentWidth: number;
300
+ readonly minContentWidth: number;
201
301
  readonly showSessionList: boolean;
202
302
  };
203
303
  readonly suggestedQuestions: readonly string[];
304
+ readonly thinkingPhrases: readonly string[];
204
305
  readonly interaction: {
205
- readonly approvals: "blocked";
206
- readonly questions: "unsupported";
306
+ readonly approvals: QaApprovalInteraction;
307
+ readonly questions: QaQuestionInteraction;
207
308
  };
208
309
  readonly lockdown: {
209
310
  readonly enabled: boolean;
@@ -224,6 +325,7 @@ export interface ResolvedQaSurfaceConfig {
224
325
  readonly mode: QaToolPolicyMode;
225
326
  readonly allow: readonly string[];
226
327
  };
328
+ readonly sharedReadOnlyRoots: readonly string[];
227
329
  };
228
330
  readonly embedding: {
229
331
  readonly frameAncestors: string | null;
@@ -233,6 +335,13 @@ export interface ResolvedQaSurfaceConfig {
233
335
  readonly allowRegistration: boolean;
234
336
  readonly sessionTtlDays: number;
235
337
  readonly showOtherUsersChats: boolean;
338
+ readonly perUserWorkspace: boolean;
339
+ readonly profile: {
340
+ readonly enabled: boolean;
341
+ readonly inject: boolean;
342
+ readonly identities: readonly QaAccountIdentityField[];
343
+ readonly instructionsMaxLength: number;
344
+ };
236
345
  };
237
346
  readonly entry: {
238
347
  readonly redirectNonLoopback: boolean;
@@ -273,11 +382,19 @@ export interface ResolvedQaSurfaceConfig {
273
382
  readonly inheritSources: boolean;
274
383
  readonly enableReportToolFallback: boolean;
275
384
  readonly markIncompleteOpaqueRuns: boolean;
385
+ readonly validateReportedSources: boolean;
276
386
  };
277
387
  readonly legacy: {
278
388
  readonly parseAssistantSourcesBlock: boolean;
279
389
  };
280
390
  };
391
+ readonly attachments: {
392
+ readonly textFiles: boolean;
393
+ readonly pastedTextLines: number;
394
+ readonly maxFileBytes: number;
395
+ readonly maxPending: number;
396
+ readonly extensions: readonly string[];
397
+ };
281
398
  }
282
399
  export interface QaSourceFilePreview {
283
400
  readonly path: string;
@@ -294,7 +411,7 @@ export interface QaLockdownProof {
294
411
  readonly agentPresetMatches: boolean;
295
412
  readonly workspaceMatches: boolean;
296
413
  readonly modelMatches: boolean;
297
- readonly sandboxIsReadOnly: boolean;
414
+ readonly sandboxModeMatches: boolean;
298
415
  readonly approvalIsNever: boolean;
299
416
  readonly permissionPreset: string;
300
417
  readonly toolPolicyLoaded: boolean;
@@ -307,6 +424,8 @@ export type QaMessage = {
307
424
  readonly status: "committed";
308
425
  readonly timestamp?: number;
309
426
  readonly images?: readonly QaImageView[];
427
+ /** Durable files the user attached to this message, in prompt order. */
428
+ readonly files?: readonly QaFileView[];
310
429
  /**
311
430
  * Chat owner's display name, set only for an admin reading a foreign
312
431
  * chat; the owner themself sees their messages unlabeled.
@@ -348,7 +467,8 @@ export type QaMessage = {
348
467
  readonly id: string;
349
468
  readonly role: "work";
350
469
  readonly turn: number;
351
- readonly status: "running" | "complete";
470
+ /** "error" marks a turn the host ended with a provider failure. */
471
+ readonly status: "running" | "complete" | "error";
352
472
  readonly startedAt?: number;
353
473
  readonly endedAt?: number;
354
474
  readonly items: readonly QaWorkItem[];
@@ -380,6 +500,7 @@ export type QaSource = import("./provenance/types.js").QaSourceReference;
380
500
  export type QaImageMediaType = "image/png" | "image/jpeg" | "image/webp" | "image/gif";
381
501
  /** One image pending in the composer, browser-owned until the prompt lands. */
382
502
  export interface QaImageDraft {
503
+ readonly kind: "image";
383
504
  readonly id: string;
384
505
  readonly mediaType: QaImageMediaType;
385
506
  readonly name: string;
@@ -388,16 +509,85 @@ export interface QaImageDraft {
388
509
  /** Local object URL for the preview thumbnail. */
389
510
  readonly previewUrl: string;
390
511
  }
512
+ /**
513
+ * One file pending in the composer. The bytes stay in the browser until the
514
+ * prompt is sent: an image can ride the prompt inline, but a file must be
515
+ * staged through the Host upload route first and then cited by its receipt.
516
+ */
517
+ export interface QaFileDraft {
518
+ readonly kind: "file";
519
+ readonly id: string;
520
+ readonly name: string;
521
+ readonly bytes: number;
522
+ /** Verbatim payload; a pasted blob is a File built from the pasted text. */
523
+ readonly blob: Blob;
524
+ }
525
+ /** Anything the composer may hold before the prompt is sent. */
526
+ export type QaAttachmentDraft = QaImageDraft | QaFileDraft;
391
527
  /** A durable image attached to a sent message. */
392
528
  export interface QaImageView {
393
529
  readonly attachmentId: string;
394
530
  readonly mediaType: QaImageMediaType;
395
531
  }
532
+ /**
533
+ * A durable file attached to a sent message. The browser never reads these
534
+ * bytes back (the attachment route serves images); the row shows the handle
535
+ * the model resolves, and the Host keeps the verbatim copy.
536
+ */
537
+ export interface QaFileView {
538
+ readonly attachmentId: string;
539
+ readonly name: string;
540
+ readonly bytes: number;
541
+ }
396
542
  /** A subagent transcript opened read-only from the agents panel. */
397
543
  export interface QaSubagentView {
398
544
  readonly id: string;
399
545
  readonly title: string;
400
546
  }
547
+ /**
548
+ * One tool call waiting for the operator. The browser lists these over its own
549
+ * remote and answers them one by one; nothing here is answered automatically.
550
+ */
551
+ export interface QaPendingApproval {
552
+ readonly id: string;
553
+ /** The chat the request belongs to: a delegated child asks under its root. */
554
+ readonly sessionId: string;
555
+ readonly toolName: string;
556
+ /** The reason the composed gate gave for asking, when it gave one. */
557
+ readonly reason: string | null;
558
+ readonly createdAt: number;
559
+ /** True when a delegated child of the chat made the call. */
560
+ readonly delegated: boolean;
561
+ }
562
+ /**
563
+ * One question waiting for the operator, normalized for the form the QA view
564
+ * renders. The protocol fields are the harness user-questions contract; absent
565
+ * ones become explicit nulls so the browser never branches on undefined.
566
+ */
567
+ export interface QaPendingQuestionItem {
568
+ readonly id: string;
569
+ readonly question: string;
570
+ readonly header: string | null;
571
+ readonly detail: string | null;
572
+ readonly options: readonly QaPendingQuestionOption[];
573
+ readonly multiSelect: boolean;
574
+ }
575
+ export interface QaPendingQuestionOption {
576
+ readonly label: string;
577
+ readonly description: string | null;
578
+ }
579
+ /**
580
+ * One user-questions request parked for the operator. A single request carries
581
+ * every question the model asked in one call, so the card is a form with a
582
+ * pager, not a list of independent prompts.
583
+ */
584
+ export interface QaPendingQuestion {
585
+ readonly id: string;
586
+ /** The chat the request belongs to. */
587
+ readonly sessionId: string;
588
+ readonly questions: readonly QaPendingQuestionItem[];
589
+ readonly createdAt: number;
590
+ }
401
591
  export interface QaSessionState {
402
592
  readonly phase: QaSessionPhase;
403
593
  readonly sessionId: string | null;
@@ -413,5 +603,9 @@ export interface QaSessionState {
413
603
  readonly incompleteSourceOrigins: QaTurnSources["incompleteOrigins"];
414
604
  /** Set while the bound session is a subagent watched from the panel. */
415
605
  readonly viewingSubagent: QaSubagentView | null;
606
+ /** Tool calls parked for the operator's answer, oldest first. */
607
+ readonly approvals: readonly QaPendingApproval[];
608
+ /** Question requests parked for the operator's answer, oldest first. */
609
+ readonly questions: readonly QaPendingQuestion[];
416
610
  }
417
611
  //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,42 @@
1
+ /** Stable, non-workspace child used to keep account directories out of sight. */
2
+ export declare const QA_USER_WORKSPACES_DIRECTORY = ".qa-users";
3
+ /** Conservative fixed budgets; there is deliberately no browser override. */
4
+ export declare const QA_USER_WORKSPACE_MAX_BYTES: number;
5
+ export declare const QA_USER_WORKSPACE_MAX_WRITE_BYTES: number;
6
+ export interface QaToolExecutionLike {
7
+ readonly name: string;
8
+ readonly arguments: unknown;
9
+ }
10
+ export interface QaUserWorkspaceReadPolicy {
11
+ /** Shared directories exposed only to read-only filesystem tools. */
12
+ readonly sharedReadOnlyRoots?: readonly string[];
13
+ }
14
+ export declare function pathIsInside(target: string, root: string): boolean;
15
+ /**
16
+ * Resolve the deepest existing ancestor, preserving the missing suffix. This
17
+ * catches symlink escapes for reads and for files which a write is about to
18
+ * create.
19
+ */
20
+ export declare function canonicalCandidate(input: string): string;
21
+ /**
22
+ * Materialize `<registered workspace>/.qa-users/<account UUID>` without
23
+ * registering the child as a DSH Workspace. Both directory levels reject
24
+ * symlinks, and their real paths must stay below the configured workspace.
25
+ */
26
+ export declare function prepareQaUserWorkspace(workspaceRoot: string, userId: string): string;
27
+ /** Resolve an already provisioned account directory for admission checks. */
28
+ export declare function existingQaUserWorkspace(workspaceRoot: string, userId: string): string;
29
+ /**
30
+ * Monotonic guard used in addition to DSH's workspace-write sandbox. It
31
+ * fences model-controlled file paths for both reads and writes, rejects tools
32
+ * whose implementation can walk above cwd, and enforces bounded scratch use.
33
+ *
34
+ * `attachmentRoot` is the one deliberate read exemption: an uploaded file is
35
+ * an immutable content-addressed copy the deployment stores outside every
36
+ * workspace, and the model reaches it exactly as the harness intends (the
37
+ * prompt carries the stored path). Reads of a single such file are allowed;
38
+ * directory-wide tools stay confined because the store is shared by every
39
+ * account, and writes are never exempted.
40
+ */
41
+ export declare function qaUserWorkspaceDenial(execution: QaToolExecutionLike, root: string, attachmentRoot?: string, readPolicy?: QaUserWorkspaceReadPolicy): string | undefined;
42
+ //# sourceMappingURL=user-workspace.d.ts.map