@yadsh/dsh-qa-surface 0.19.0 → 0.21.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 (252) hide show
  1. package/README.md +235 -0
  2. package/lib/access/model-choices.js +103 -0
  3. package/lib/access/model-choices.js.map +1 -0
  4. package/lib/access/model-policy.js +79 -7
  5. package/lib/access/model-policy.js.map +1 -1
  6. package/lib/access/model.js +29 -1
  7. package/lib/access/model.js.map +1 -1
  8. package/lib/access/queue-policy.js +36 -0
  9. package/lib/access/queue-policy.js.map +1 -0
  10. package/lib/access/service.js +124 -7
  11. package/lib/access/service.js.map +1 -1
  12. package/lib/account-remotes.js +10 -1
  13. package/lib/account-remotes.js.map +1 -1
  14. package/lib/accounts/database.js +44 -3
  15. package/lib/accounts/database.js.map +1 -1
  16. package/lib/accounts/store.js +28 -0
  17. package/lib/accounts/store.js.map +1 -1
  18. package/lib/admin/service.js +6 -1
  19. package/lib/admin/service.js.map +1 -1
  20. package/lib/chat-sharing/transport.js +6 -2
  21. package/lib/chat-sharing/transport.js.map +1 -1
  22. package/lib/client/QaAccountsController.js +43 -8
  23. package/lib/client/QaAccountsController.js.map +1 -1
  24. package/lib/client/QaSessionController.js +55 -23
  25. package/lib/client/QaSessionController.js.map +1 -1
  26. package/lib/client/QaSurface.js +61 -3
  27. package/lib/client/QaSurface.js.map +1 -1
  28. package/lib/client/QaTranscriptAdapter.js +36 -1
  29. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  30. package/lib/client/admin/ModelPolicyEditor.js +28 -2
  31. package/lib/client/admin/ModelPolicyEditor.js.map +1 -1
  32. package/lib/client/admin/RoleEditor.js +18 -1
  33. package/lib/client/admin/RoleEditor.js.map +1 -1
  34. package/lib/client/admin/pages/SkillFiles.js +1 -1
  35. package/lib/client/admin/pages/SkillFiles.js.map +1 -1
  36. package/lib/client/admin/pages/Users.js +36 -16
  37. package/lib/client/admin/pages/Users.js.map +1 -1
  38. package/lib/client/admin/styles.js +3 -0
  39. package/lib/client/admin/styles.js.map +1 -1
  40. package/lib/client/chat-artifacts.js +1 -0
  41. package/lib/client/chat-artifacts.js.map +1 -1
  42. package/lib/client/code-source-styles.js +12 -0
  43. package/lib/client/code-source-styles.js.map +1 -0
  44. package/lib/client/components/QaArtifactAttachment.js +12 -0
  45. package/lib/client/components/QaArtifactAttachment.js.map +1 -0
  46. package/lib/client/components/QaChangelog.js +94 -0
  47. package/lib/client/components/QaChangelog.js.map +1 -1
  48. package/lib/client/components/QaChatActions.js +36 -14
  49. package/lib/client/components/QaChatActions.js.map +1 -1
  50. package/lib/client/components/QaCodeSourcePicker.js +18 -0
  51. package/lib/client/components/QaCodeSourcePicker.js.map +1 -0
  52. package/lib/client/components/QaComposer.js +11 -12
  53. package/lib/client/components/QaComposer.js.map +1 -1
  54. package/lib/client/components/QaComposerSettings.js +202 -0
  55. package/lib/client/components/QaComposerSettings.js.map +1 -0
  56. package/lib/client/components/QaFilesPanel.js +2 -8
  57. package/lib/client/components/QaFilesPanel.js.map +1 -1
  58. package/lib/client/components/QaFormItem.js +74 -38
  59. package/lib/client/components/QaFormItem.js.map +1 -1
  60. package/lib/client/components/QaHistoryCatalog.js +261 -0
  61. package/lib/client/components/QaHistoryCatalog.js.map +1 -0
  62. package/lib/client/components/QaInputForm.js +115 -32
  63. package/lib/client/components/QaInputForm.js.map +1 -1
  64. package/lib/client/components/QaMessage.js +3 -8
  65. package/lib/client/components/QaMessage.js.map +1 -1
  66. package/lib/client/components/QaModelSelector.js +21 -0
  67. package/lib/client/components/QaModelSelector.js.map +1 -0
  68. package/lib/client/components/QaSidebar.js +25 -24
  69. package/lib/client/components/QaSidebar.js.map +1 -1
  70. package/lib/client/components/QaWorkGroup.js +1 -3
  71. package/lib/client/components/QaWorkGroup.js.map +1 -1
  72. package/lib/client/composer-settings-styles.js +21 -0
  73. package/lib/client/composer-settings-styles.js.map +1 -0
  74. package/lib/client/forms-styles.js +35 -11
  75. package/lib/client/forms-styles.js.map +1 -1
  76. package/lib/client/history-organization-styles.js +31 -0
  77. package/lib/client/history-organization-styles.js.map +1 -0
  78. package/lib/client/history-organization.js +155 -0
  79. package/lib/client/history-organization.js.map +1 -0
  80. package/lib/client/index.js +13 -4
  81. package/lib/client/index.js.map +1 -1
  82. package/lib/client/settings/card.js +2 -2
  83. package/lib/client/settings/card.js.map +1 -1
  84. package/lib/client/settings/sections/attachments.js +7 -1
  85. package/lib/client/settings/sections/attachments.js.map +1 -1
  86. package/lib/client/settings/sections/file-writes.js +15 -0
  87. package/lib/client/settings/sections/file-writes.js.map +1 -0
  88. package/lib/client/settings/sections/session.js +1 -1
  89. package/lib/client/settings/sections/session.js.map +1 -1
  90. package/lib/client/settings/sections.js +1 -0
  91. package/lib/client/settings/sections.js.map +1 -1
  92. package/lib/client/styles.js +18 -1
  93. package/lib/client/styles.js.map +1 -1
  94. package/lib/client/tool-presentation.js +21 -3
  95. package/lib/client/tool-presentation.js.map +1 -1
  96. package/lib/client/types.js.map +1 -1
  97. package/lib/client/use-chat-code-source.js +156 -0
  98. package/lib/client/use-chat-code-source.js.map +1 -0
  99. package/lib/client/use-history-organization.js +48 -0
  100. package/lib/client/use-history-organization.js.map +1 -0
  101. package/lib/client/use-model-selection.js +96 -0
  102. package/lib/client/use-model-selection.js.map +1 -0
  103. package/lib/client/use-qa-file-drop.js +81 -0
  104. package/lib/client/use-qa-file-drop.js.map +1 -0
  105. package/lib/client/user-settings/IntegrationTokensPage.js +42 -6
  106. package/lib/client/user-settings/IntegrationTokensPage.js.map +1 -1
  107. package/lib/client/user-settings/UserSettingsDialog.js +1 -1
  108. package/lib/client/user-settings/UserSettingsDialog.js.map +1 -1
  109. package/lib/client.js +125 -27
  110. package/lib/client.js.map +1 -1
  111. package/lib/code-source-selection.js +102 -0
  112. package/lib/code-source-selection.js.map +1 -0
  113. package/lib/config-resolvers/accounts.js +26 -1
  114. package/lib/config-resolvers/accounts.js.map +1 -1
  115. package/lib/config-resolvers/defaults.js +7 -0
  116. package/lib/config-resolvers/defaults.js.map +1 -1
  117. package/lib/config-resolvers/integration.js +8 -1
  118. package/lib/config-resolvers/integration.js.map +1 -1
  119. package/lib/config-resolvers/session.js +2 -0
  120. package/lib/config-resolvers/session.js.map +1 -1
  121. package/lib/config-resolvers/tools.js +2 -0
  122. package/lib/config-resolvers/tools.js.map +1 -1
  123. package/lib/config.js +77 -4
  124. package/lib/config.js.map +1 -1
  125. package/lib/enforcement/skill-policy.js +37 -2
  126. package/lib/enforcement/skill-policy.js.map +1 -1
  127. package/lib/forms/errors.js +6 -1
  128. package/lib/forms/errors.js.map +1 -1
  129. package/lib/forms/gate.js +28 -2
  130. package/lib/forms/gate.js.map +1 -1
  131. package/lib/forms/schema-errors.js +47 -0
  132. package/lib/forms/schema-errors.js.map +1 -0
  133. package/lib/forms/schema.js +29 -20
  134. package/lib/forms/schema.js.map +1 -1
  135. package/lib/index.js +161 -9
  136. package/lib/index.js.map +1 -1
  137. package/lib/integration/http.js +9 -10
  138. package/lib/integration/http.js.map +1 -1
  139. package/lib/integration/service.js +9 -0
  140. package/lib/integration/service.js.map +1 -1
  141. package/lib/personal-skills/provider.js +9 -1
  142. package/lib/personal-skills/provider.js.map +1 -1
  143. package/lib/personal-skills/service.js +4 -0
  144. package/lib/personal-skills/service.js.map +1 -1
  145. package/lib/personal-skills/shared-seed.js +65 -0
  146. package/lib/personal-skills/shared-seed.js.map +1 -0
  147. package/lib/prompt-notes.js +24 -2
  148. package/lib/prompt-notes.js.map +1 -1
  149. package/lib/provenance/collector.js +1 -0
  150. package/lib/provenance/collector.js.map +1 -1
  151. package/lib/provenance/extractors.js +6 -1
  152. package/lib/provenance/extractors.js.map +1 -1
  153. package/lib/qa-tools/catalog.js +33 -1
  154. package/lib/qa-tools/catalog.js.map +1 -1
  155. package/lib/qa-tools/code-files.js +207 -0
  156. package/lib/qa-tools/code-files.js.map +1 -0
  157. package/lib/qa-tools/code-tools.js +158 -0
  158. package/lib/qa-tools/code-tools.js.map +1 -0
  159. package/lib/qa-tools/docs-tools.js +49 -12
  160. package/lib/qa-tools/docs-tools.js.map +1 -1
  161. package/lib/qa-tools/file-write-gate.js +47 -0
  162. package/lib/qa-tools/file-write-gate.js.map +1 -0
  163. package/lib/qa-tools/index.js +10 -0
  164. package/lib/qa-tools/index.js.map +1 -1
  165. package/lib/qa-tools/request-user-form.js +26 -6
  166. package/lib/qa-tools/request-user-form.js.map +1 -1
  167. package/lib/qa-tools/subagent-tools.js +159 -0
  168. package/lib/qa-tools/subagent-tools.js.map +1 -0
  169. package/lib/request-scheduler.js +32 -5
  170. package/lib/request-scheduler.js.map +1 -1
  171. package/lib/resolve-config.js +9 -1
  172. package/lib/resolve-config.js.map +1 -1
  173. package/lib/secure-session.js +16 -4
  174. package/lib/secure-session.js.map +1 -1
  175. package/lib/session-model.js +43 -1
  176. package/lib/session-model.js.map +1 -1
  177. package/lib/shared/file-write-policy.js +29 -0
  178. package/lib/shared/file-write-policy.js.map +1 -0
  179. package/lib/shared/history-folder.js +18 -0
  180. package/lib/shared/history-folder.js.map +1 -0
  181. package/lib/typert.host.js +757 -162
  182. package/lib/typert.remote-client.d.ts +19 -7
  183. package/lib/typert.remote-client.js +688 -153
  184. package/lib/types/access/model-choices.d.ts +16 -0
  185. package/lib/types/access/model-policy.d.ts +13 -7
  186. package/lib/types/access/model.d.ts +9 -0
  187. package/lib/types/access/queue-policy.d.ts +30 -0
  188. package/lib/types/access/service.d.ts +27 -0
  189. package/lib/types/account-remotes.d.ts +5 -4
  190. package/lib/types/accounts/database.d.ts +5 -0
  191. package/lib/types/accounts/store.d.ts +6 -0
  192. package/lib/types/chat-sharing/transport.d.ts +1 -1
  193. package/lib/types/client/QaAccountsController.d.ts +3 -1
  194. package/lib/types/client/QaSessionController.d.ts +19 -5
  195. package/lib/types/client/QaSurface.d.ts +2 -0
  196. package/lib/types/client/admin/ModelPolicyEditor.d.ts +2 -0
  197. package/lib/types/client/code-source-styles.d.ts +2 -0
  198. package/lib/types/client/components/QaArtifactAttachment.d.ts +8 -0
  199. package/lib/types/client/components/QaChatActions.d.ts +3 -1
  200. package/lib/types/client/components/QaCodeSourcePicker.d.ts +9 -0
  201. package/lib/types/client/components/QaComposer.d.ts +2 -0
  202. package/lib/types/client/components/QaComposerSettings.d.ts +16 -0
  203. package/lib/types/client/components/QaFormItem.d.ts +4 -2
  204. package/lib/types/client/components/QaHistoryCatalog.d.ts +19 -0
  205. package/lib/types/client/components/QaInputForm.d.ts +3 -2
  206. package/lib/types/client/components/QaModelSelector.d.ts +4 -0
  207. package/lib/types/client/components/QaSidebar.d.ts +3 -0
  208. package/lib/types/client/composer-settings-styles.d.ts +2 -0
  209. package/lib/types/client/forms-styles.d.ts +1 -1
  210. package/lib/types/client/history-organization-styles.d.ts +3 -0
  211. package/lib/types/client/history-organization.d.ts +38 -0
  212. package/lib/types/client/settings/sections/file-writes.d.ts +4 -0
  213. package/lib/types/client/settings/sections.d.ts +1 -0
  214. package/lib/types/client/tool-presentation.d.ts +1 -0
  215. package/lib/types/client/types.d.ts +12 -4
  216. package/lib/types/client/use-chat-code-source.d.ts +20 -0
  217. package/lib/types/client/use-history-organization.d.ts +8 -0
  218. package/lib/types/client/use-model-selection.d.ts +24 -0
  219. package/lib/types/client/use-qa-file-drop.d.ts +12 -0
  220. package/lib/types/code-source-selection.d.ts +28 -0
  221. package/lib/types/code-sources.js +2 -0
  222. package/lib/types/code-sources.js.map +1 -0
  223. package/lib/types/config-resolvers/integration.d.ts +7 -1
  224. package/lib/types/forms/errors.d.ts +3 -2
  225. package/lib/types/forms/gate.d.ts +4 -2
  226. package/lib/types/forms/schema-errors.d.ts +7 -0
  227. package/lib/types/forms/types.d.ts +14 -0
  228. package/lib/types/index.d.ts +38 -5
  229. package/lib/types/integration/http.d.ts +1 -3
  230. package/lib/types/integration/service.d.ts +2 -0
  231. package/lib/types/personal-skills/shared-seed.d.ts +12 -0
  232. package/lib/types/prompt-notes.d.ts +6 -2
  233. package/lib/types/qa-tools/catalog.d.ts +5 -2
  234. package/lib/types/qa-tools/code-files.d.ts +59 -0
  235. package/lib/types/qa-tools/code-tools.d.ts +7 -0
  236. package/lib/types/qa-tools/docs-tools.d.ts +4 -0
  237. package/lib/types/qa-tools/file-write-gate.d.ts +6 -0
  238. package/lib/types/qa-tools/index.d.ts +3 -0
  239. package/lib/types/qa-tools/subagent-tools.d.ts +40 -0
  240. package/lib/types/request-scheduler.d.ts +21 -2
  241. package/lib/types/session-model.d.ts +11 -2
  242. package/lib/types/shared/file-write-policy.d.ts +10 -0
  243. package/lib/types/shared/history-folder.d.ts +4 -0
  244. package/lib/types/types/accounts.d.ts +11 -0
  245. package/lib/types/types/capability.d.ts +31 -4
  246. package/lib/types/types/code-sources.d.ts +12 -0
  247. package/lib/types/types/config.d.ts +23 -0
  248. package/lib/types/types/documents.d.ts +2 -0
  249. package/lib/types/types.d.ts +1 -0
  250. package/lib/user-workspace.js +7 -4
  251. package/lib/user-workspace.js.map +1 -1
  252. package/package.json +6 -5
package/lib/index.js CHANGED
@@ -34,6 +34,8 @@ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn,
34
34
  };
35
35
  import { readSourceImage as readSourceImagePreview } from "./provenance/source-image.js";
36
36
  import path from "node:path";
37
+ import { QaCodeSourceSelection } from "./code-source-selection.js";
38
+ import { qaDelegatedHeader } from "./shared/session-lineage.js";
37
39
  import { defaultAccountsFilePath } from "./accounts/store.js";
38
40
  import { QaChatSharingStore } from "./chat-sharing/store.js";
39
41
  import { QaChatTransport } from "./chat-sharing/transport.js";
@@ -56,6 +58,7 @@ import { createQaPersonalSkillRemotes, QaPersonalSkillsHost, } from "./personal-
56
58
  import { QaApprovalGate } from "./approvals.js";
57
59
  import { QaAttestationError } from "./attestation.js";
58
60
  import { QaFileDeleteGate } from "./qa-tools/file-delete-gate.js";
61
+ import { installQaFileWriteGate } from "./qa-tools/file-write-gate.js";
59
62
  import { QaQuestionGate } from "./questions.js";
60
63
  import { QaFormStore } from "./forms/store.js";
61
64
  import { QaFormService } from "./forms/service.js";
@@ -77,6 +80,7 @@ import { createQaIntegrationRunner } from "./integration/host-runner.js";
77
80
  import { QaIntegrationService } from "./integration/service.js";
78
81
  import { QaPolicyAdmission } from "./secure-session.js";
79
82
  import { QaAccessService } from "./access/service.js";
83
+ import { userModelOptions, selectUserModel } from "./access/model-choices.js";
80
84
  import { userInvocableSkillNames } from "./access/model.js";
81
85
  import { createQaSlashRemotes } from "./slash/remotes.js";
82
86
  import { QaPromptNotes } from "./prompt-notes.js";
@@ -99,6 +103,7 @@ export const inject = [
99
103
  "systemPrompt",
100
104
  "workspaceRegistry",
101
105
  "sessionController",
106
+ "llm",
102
107
  ];
103
108
  // One home for the namespace: the browser card binds to the same constant
104
109
  // through `src/shared/settings.ts`, which avoids importing this module (and
@@ -142,6 +147,8 @@ function releaseScopeLease(lease) {
142
147
  let QaSurface = (() => {
143
148
  let _classSuper = TypertRemoteService;
144
149
  let _instanceExtraInitializers = [];
150
+ let _chatCodeSources_decorators;
151
+ let _chatSelectCodeSource_decorators;
145
152
  let _accountsRegister_decorators;
146
153
  let _accountsLogin_decorators;
147
154
  let _accountsOidcStart_decorators;
@@ -160,6 +167,7 @@ let QaSurface = (() => {
160
167
  let _accountsCreateServiceToken_decorators;
161
168
  let _accountsRevokeServiceToken_decorators;
162
169
  let _accountsSetServiceTokenClarifications_decorators;
170
+ let _accountsSetServiceTokenHistoryFolder_decorators;
163
171
  let _describe_decorators;
164
172
  let _queueStatus_decorators;
165
173
  let _createSession_decorators;
@@ -170,6 +178,7 @@ let QaSurface = (() => {
170
178
  let _accessCreateSubrole_decorators;
171
179
  let _accessUpdateSubrole_decorators;
172
180
  let _accessModelCatalog_decorators;
181
+ let _accessUserModels_decorators;
173
182
  let _accessDeleteSubrole_decorators;
174
183
  let _accessUpdateCommon_decorators;
175
184
  let _accessUpdateAssignment_decorators;
@@ -255,6 +264,8 @@ let QaSurface = (() => {
255
264
  return class QaSurface extends _classSuper {
256
265
  static {
257
266
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
267
+ _chatCodeSources_decorators = [Remote("chatCodeSources")];
268
+ _chatSelectCodeSource_decorators = [Remote("chatSelectCodeSource")];
258
269
  _accountsRegister_decorators = [Remote("accountsRegister")];
259
270
  _accountsLogin_decorators = [Remote("accountsLogin")];
260
271
  _accountsOidcStart_decorators = [Remote("accountsOidcStart")];
@@ -273,6 +284,7 @@ let QaSurface = (() => {
273
284
  _accountsCreateServiceToken_decorators = [Remote("accountsCreateServiceToken")];
274
285
  _accountsRevokeServiceToken_decorators = [Remote("accountsRevokeServiceToken")];
275
286
  _accountsSetServiceTokenClarifications_decorators = [Remote("accountsSetServiceTokenClarifications")];
287
+ _accountsSetServiceTokenHistoryFolder_decorators = [Remote("accountsSetServiceTokenHistoryFolder")];
276
288
  _describe_decorators = [Remote("describe")];
277
289
  _queueStatus_decorators = [Remote("queueStatus")];
278
290
  _createSession_decorators = [Remote("createSession")];
@@ -283,6 +295,7 @@ let QaSurface = (() => {
283
295
  _accessCreateSubrole_decorators = [Remote("accessCreateSubrole")];
284
296
  _accessUpdateSubrole_decorators = [Remote("accessUpdateSubrole")];
285
297
  _accessModelCatalog_decorators = [Remote("accessModelCatalog")];
298
+ _accessUserModels_decorators = [Remote("accessUserModels")];
286
299
  _accessDeleteSubrole_decorators = [Remote("accessDeleteSubrole")];
287
300
  _accessUpdateCommon_decorators = [Remote("accessUpdateCommon")];
288
301
  _accessUpdateAssignment_decorators = [Remote("accessUpdateAssignment")];
@@ -365,6 +378,8 @@ let QaSurface = (() => {
365
378
  _skillsTools_decorators = [Remote("skillsTools")];
366
379
  _slashCatalog_decorators = [Remote("slashCatalog")];
367
380
  _slashExecute_decorators = [Remote("slashExecute")];
381
+ __esDecorate(this, null, _chatCodeSources_decorators, { kind: "method", name: "chatCodeSources", static: false, private: false, access: { has: obj => "chatCodeSources" in obj, get: obj => obj.chatCodeSources }, metadata: _metadata }, null, _instanceExtraInitializers);
382
+ __esDecorate(this, null, _chatSelectCodeSource_decorators, { kind: "method", name: "chatSelectCodeSource", static: false, private: false, access: { has: obj => "chatSelectCodeSource" in obj, get: obj => obj.chatSelectCodeSource }, metadata: _metadata }, null, _instanceExtraInitializers);
368
383
  __esDecorate(this, null, _accountsRegister_decorators, { kind: "method", name: "accountsRegister", static: false, private: false, access: { has: obj => "accountsRegister" in obj, get: obj => obj.accountsRegister }, metadata: _metadata }, null, _instanceExtraInitializers);
369
384
  __esDecorate(this, null, _accountsLogin_decorators, { kind: "method", name: "accountsLogin", static: false, private: false, access: { has: obj => "accountsLogin" in obj, get: obj => obj.accountsLogin }, metadata: _metadata }, null, _instanceExtraInitializers);
370
385
  __esDecorate(this, null, _accountsOidcStart_decorators, { kind: "method", name: "accountsOidcStart", static: false, private: false, access: { has: obj => "accountsOidcStart" in obj, get: obj => obj.accountsOidcStart }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -383,6 +398,7 @@ let QaSurface = (() => {
383
398
  __esDecorate(this, null, _accountsCreateServiceToken_decorators, { kind: "method", name: "accountsCreateServiceToken", static: false, private: false, access: { has: obj => "accountsCreateServiceToken" in obj, get: obj => obj.accountsCreateServiceToken }, metadata: _metadata }, null, _instanceExtraInitializers);
384
399
  __esDecorate(this, null, _accountsRevokeServiceToken_decorators, { kind: "method", name: "accountsRevokeServiceToken", static: false, private: false, access: { has: obj => "accountsRevokeServiceToken" in obj, get: obj => obj.accountsRevokeServiceToken }, metadata: _metadata }, null, _instanceExtraInitializers);
385
400
  __esDecorate(this, null, _accountsSetServiceTokenClarifications_decorators, { kind: "method", name: "accountsSetServiceTokenClarifications", static: false, private: false, access: { has: obj => "accountsSetServiceTokenClarifications" in obj, get: obj => obj.accountsSetServiceTokenClarifications }, metadata: _metadata }, null, _instanceExtraInitializers);
401
+ __esDecorate(this, null, _accountsSetServiceTokenHistoryFolder_decorators, { kind: "method", name: "accountsSetServiceTokenHistoryFolder", static: false, private: false, access: { has: obj => "accountsSetServiceTokenHistoryFolder" in obj, get: obj => obj.accountsSetServiceTokenHistoryFolder }, metadata: _metadata }, null, _instanceExtraInitializers);
386
402
  __esDecorate(this, null, _describe_decorators, { kind: "method", name: "describe", static: false, private: false, access: { has: obj => "describe" in obj, get: obj => obj.describe }, metadata: _metadata }, null, _instanceExtraInitializers);
387
403
  __esDecorate(this, null, _queueStatus_decorators, { kind: "method", name: "queueStatus", static: false, private: false, access: { has: obj => "queueStatus" in obj, get: obj => obj.queueStatus }, metadata: _metadata }, null, _instanceExtraInitializers);
388
404
  __esDecorate(this, null, _createSession_decorators, { kind: "method", name: "createSession", static: false, private: false, access: { has: obj => "createSession" in obj, get: obj => obj.createSession }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -393,6 +409,7 @@ let QaSurface = (() => {
393
409
  __esDecorate(this, null, _accessCreateSubrole_decorators, { kind: "method", name: "accessCreateSubrole", static: false, private: false, access: { has: obj => "accessCreateSubrole" in obj, get: obj => obj.accessCreateSubrole }, metadata: _metadata }, null, _instanceExtraInitializers);
394
410
  __esDecorate(this, null, _accessUpdateSubrole_decorators, { kind: "method", name: "accessUpdateSubrole", static: false, private: false, access: { has: obj => "accessUpdateSubrole" in obj, get: obj => obj.accessUpdateSubrole }, metadata: _metadata }, null, _instanceExtraInitializers);
395
411
  __esDecorate(this, null, _accessModelCatalog_decorators, { kind: "method", name: "accessModelCatalog", static: false, private: false, access: { has: obj => "accessModelCatalog" in obj, get: obj => obj.accessModelCatalog }, metadata: _metadata }, null, _instanceExtraInitializers);
412
+ __esDecorate(this, null, _accessUserModels_decorators, { kind: "method", name: "accessUserModels", static: false, private: false, access: { has: obj => "accessUserModels" in obj, get: obj => obj.accessUserModels }, metadata: _metadata }, null, _instanceExtraInitializers);
396
413
  __esDecorate(this, null, _accessDeleteSubrole_decorators, { kind: "method", name: "accessDeleteSubrole", static: false, private: false, access: { has: obj => "accessDeleteSubrole" in obj, get: obj => obj.accessDeleteSubrole }, metadata: _metadata }, null, _instanceExtraInitializers);
397
414
  __esDecorate(this, null, _accessUpdateCommon_decorators, { kind: "method", name: "accessUpdateCommon", static: false, private: false, access: { has: obj => "accessUpdateCommon" in obj, get: obj => obj.accessUpdateCommon }, metadata: _metadata }, null, _instanceExtraInitializers);
398
415
  __esDecorate(this, null, _accessUpdateAssignment_decorators, { kind: "method", name: "accessUpdateAssignment", static: false, private: false, access: { has: obj => "accessUpdateAssignment" in obj, get: obj => obj.accessUpdateAssignment }, metadata: _metadata }, null, _instanceExtraInitializers);
@@ -477,9 +494,20 @@ let QaSurface = (() => {
477
494
  __esDecorate(this, null, _slashExecute_decorators, { kind: "method", name: "slashExecute", static: false, private: false, access: { has: obj => "slashExecute" in obj, get: obj => obj.slashExecute }, metadata: _metadata }, null, _instanceExtraInitializers);
478
495
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
479
496
  }
497
+ sourceSelections = __runInitializers(this, _instanceExtraInitializers);
498
+ codeSourceStore() {
499
+ return (this.sourceSelections ??= new QaCodeSourceSelection(path.join(path.dirname(defaultAccountsFilePath()), "qa-code-sources.db"), () => this.getConfig().codeSources, (id) => this.ctx.sessions.get(SessionId(id)), (id) => {
500
+ const agent = this.ctx.agents.get(SessionId(id));
501
+ return (agent !== undefined &&
502
+ (agent.status === "running" ||
503
+ agent.inbox.nextStep.length > 0 ||
504
+ qaRequestFamilyBusy(this.ctx, agent) ||
505
+ this.requestScheduler.status(id).waiting === true));
506
+ }));
507
+ }
480
508
  static inject = inject;
481
509
  static Config = ConfigSchema;
482
- source = __runInitializers(this, _instanceExtraInitializers);
510
+ source;
483
511
  logger;
484
512
  admission;
485
513
  approvals;
@@ -560,7 +588,20 @@ let QaSurface = (() => {
560
588
  // the one live source: each read folds its current snapshots, and a settings
561
589
  // write is visible on the next read without reloading the plugin.
562
590
  this.source = () => readConfigRefs(entry);
563
- this.requestScheduler = new QaRequestScheduler(() => this.getConfig().session.maxActiveRequests, () => qaRequestRoots(ctx, this.getConfig().session.maxActiveRequests > 0), Date.now, (agent) => qaRequestFamilyBusy(ctx, agent));
591
+ ctx.effect(() => ctx.on("agent/created", ({ agent }) => {
592
+ const { parentSession } = agent.session.header;
593
+ if (parentSession !== undefined &&
594
+ (qaDelegatedHeader(agent.session.header) ||
595
+ agent.session.header.isSeeded === true)) {
596
+ this.codeSourceStore().inherit(String(agent.session.id), String(parentSession), this.admission.knowsSession(String(parentSession)));
597
+ }
598
+ }, { global: true }), "dsh-qa-surface.code-source-inheritance");
599
+ ctx.effect(() => () => this.sourceSelections?.close(), "dsh-qa-surface.code-source-store");
600
+ this.requestScheduler = new QaRequestScheduler(() => this.getConfig().session.maxActiveRequests, () => qaRequestRoots(ctx, this.getConfig().session.maxActiveRequests > 0), Date.now, (agent) => qaRequestFamilyBusy(ctx, agent),
601
+ // The ceiling one turn fills against, resolved per admission: a role or
602
+ // an account that overrides the deployment's number is read here, where
603
+ // the scheduler decides, not once at boot.
604
+ (agent) => this.queueSlotsOverride(agent));
564
605
  ctx.effect(() => this.requestScheduler.install(ctx), "dsh-qa-surface.request-queue");
565
606
  this.logger = getPluginLogger({
566
607
  pluginId: "dsh-qa-surface",
@@ -752,6 +793,8 @@ let QaSurface = (() => {
752
793
  this.approvals.install();
753
794
  this.userQuestions.install();
754
795
  this.fileDeleteGate.install();
796
+ const disposeFileWriteGate = installQaFileWriteGate(ctx, ownership, () => this.getConfig().tools.fileWritePolicy);
797
+ ctx.effect(() => disposeFileWriteGate, "dsh-qa-surface.file-write-gate");
755
798
  // A turn the Host ended with a provider failure is written to the plugin's
756
799
  // log with its code and the provider the request was routed to. The chat row
757
800
  // names the code only, and the durable journal that holds the rest is a zstd
@@ -766,6 +809,7 @@ let QaSurface = (() => {
766
809
  // complete persona closes the system prompt to plugins, the conversation
767
810
  // stays open.
768
811
  this.notes = new QaPromptNotes(ctx, {
812
+ codeSources: (sessionId) => this.getCodeSources(sessionId),
769
813
  config: () => this.getConfig(),
770
814
  accounts: () => this.accountRemotes.resolve(this.getConfig()),
771
815
  isQaSession: (sessionId) => this.admission.knowsSession(sessionId),
@@ -793,6 +837,20 @@ let QaSurface = (() => {
793
837
  // The QA tool catalog is attached per agent, never at boot: nothing here
794
838
  // reaches the model until a managed agent loads the activation skill.
795
839
  this.tools = new QaTools(ctx, {
840
+ subagents: {
841
+ ctx,
842
+ runtime: () => ctx.get("subagents"),
843
+ policy: (agent) => {
844
+ const root = ownership.rootOf(String(agent.session.id));
845
+ if (root === undefined)
846
+ throw new Error("An attested QA conversation is required.");
847
+ return this.access.modelPolicyFor(root);
848
+ },
849
+ },
850
+ codeSources: (exec) => this.getCodeSources(exec?.agent?.session?.id === undefined
851
+ ? undefined
852
+ : String(exec.agent.session.id)),
853
+ codeReadRoots: () => this.getConfig().lockdown.sharedReadOnlyRoots,
796
854
  forms: this.formGate,
797
855
  formsEnabled: () => this.getConfig().forms.enabled,
798
856
  formProjection: (submission, sessionId) => this.formAttachments.readable(submission, sessionId),
@@ -972,6 +1030,33 @@ let QaSurface = (() => {
972
1030
  modelPolicyForSession(sessionId) {
973
1031
  return this.access.modelPolicyFor(sessionId).pair;
974
1032
  }
1033
+ /** Shared source catalogue consumed by preset-mounted Git tools at call time. */
1034
+ getCodeSources(sessionId) {
1035
+ return sessionId === undefined
1036
+ ? this.getConfig().codeSources
1037
+ : this.codeSourceStore().catalog(sessionId);
1038
+ }
1039
+ getSelectedCodeSource(sessionId) {
1040
+ return this.codeSourceStore().selected(sessionId);
1041
+ }
1042
+ async chatCodeSources(token, sessionId) {
1043
+ const finish = await this.admitChatRead(token, sessionId);
1044
+ let owner = true;
1045
+ try {
1046
+ this.requireChatOwner(token, sessionId);
1047
+ }
1048
+ catch {
1049
+ owner = false;
1050
+ }
1051
+ finish();
1052
+ return this.codeSourceStore().view(sessionId, owner);
1053
+ }
1054
+ async chatSelectCodeSource(token, sessionId, source) {
1055
+ const finish = await this.admitChatRead(token, sessionId);
1056
+ this.requireChatOwner(token, sessionId);
1057
+ finish();
1058
+ return this.codeSourceStore().select(sessionId, source);
1059
+ }
975
1060
  getConfig() {
976
1061
  return resolveConfig(this.source());
977
1062
  }
@@ -1118,6 +1203,9 @@ let QaSurface = (() => {
1118
1203
  accountsSetServiceTokenClarifications(token, tokenId, allowed) {
1119
1204
  return this.accountRemotes.setServiceTokenClarifications(token, tokenId, allowed);
1120
1205
  }
1206
+ accountsSetServiceTokenHistoryFolder(token, tokenId, folder) {
1207
+ return this.accountRemotes.setServiceTokenHistoryFolder(token, tokenId, folder);
1208
+ }
1121
1209
  /**
1122
1210
  * Serve the effective QA configuration to the browser. The DSH gateway pins
1123
1211
  * settings RPCs to loopback, so a browser served over the LAN always sees
@@ -1132,12 +1220,68 @@ let QaSurface = (() => {
1132
1220
  * Report server admission. Global reads expose counts only; a chat's FIFO
1133
1221
  * position requires that account's current read access to the chat. The
1134
1222
  * scheduler gates every root turn, including native and integration sends.
1223
+ *
1224
+ * Both arguments are part of the wire contract: the gateway client counts
1225
+ * declared parameters rather than TypeScript optionals, so a call that omits
1226
+ * them is refused on the browser before the Host ever sees it. An empty
1227
+ * session id is the global read — the shape every initial send asks for,
1228
+ * while its draft chat has no session to name yet.
1135
1229
  */
1136
1230
  queueStatus(token, sessionId) {
1137
- if (sessionId !== undefined && this.getConfig().accounts.enabled) {
1138
- this.sharing().access(token ?? "", sessionId);
1231
+ const requested = sessionId === "" ? undefined : sessionId;
1232
+ if (requested !== undefined && this.getConfig().accounts.enabled) {
1233
+ this.sharing().access(token, requested);
1234
+ }
1235
+ return this.requestScheduler.status(requested, this.queueCeiling(token, requested));
1236
+ }
1237
+ /**
1238
+ * The ceiling this read answers against: the chat's own account chain when
1239
+ * the read names a chat, the caller's account chain when it does not (the
1240
+ * pre-send check carries a token but no chat yet), and the deployment's
1241
+ * number whenever accounts are off or nobody matches. `undefined` is the
1242
+ * scheduler's signal to fall back to that number, so the branch is a value
1243
+ * rather than a flag.
1244
+ */
1245
+ queueCeiling(token, sessionId) {
1246
+ const config = this.getConfig();
1247
+ if (!config.accounts.enabled)
1248
+ return undefined;
1249
+ const accounts = this.accountRemotes.resolve(config);
1250
+ if (accounts === undefined)
1251
+ return undefined;
1252
+ if (sessionId !== undefined) {
1253
+ return accounts.ownerIdOf(sessionId) === undefined
1254
+ ? undefined
1255
+ : this.access.queueSlotsFor(sessionId);
1256
+ }
1257
+ try {
1258
+ return this.access.queueSlotsForUser(accounts.currentUser(token).id);
1259
+ }
1260
+ catch {
1261
+ // An anonymous or stale browser still deserves the deployment's numbers:
1262
+ // the read is advisory, and the browser holds its question back on its
1263
+ // own only for a ceiling it can actually name.
1264
+ return undefined;
1139
1265
  }
1140
- return this.requestScheduler.status(sessionId);
1266
+ }
1267
+ /**
1268
+ * The ceiling override one arriving turn fills against, or `undefined` when
1269
+ * the deployment default governs it: without accounts every turn shares the
1270
+ * one number, and an unowned session (an integration or an admin preview)
1271
+ * stays in that shared pool whatever its role might say.
1272
+ */
1273
+ queueSlotsOverride(agent) {
1274
+ const config = this.getConfig();
1275
+ if (!config.accounts.enabled)
1276
+ return undefined;
1277
+ const sessionId = String(agent.session.id);
1278
+ if (sessionId === "")
1279
+ return undefined;
1280
+ const accounts = this.accountRemotes.resolve(config);
1281
+ if (accounts === undefined || accounts.ownerIdOf(sessionId) === undefined) {
1282
+ return undefined;
1283
+ }
1284
+ return this.access.queueSlotsFor(sessionId);
1141
1285
  }
1142
1286
  /**
1143
1287
  * Create a QA session from Host-owned inputs. With account workspaces on,
@@ -1210,6 +1354,11 @@ let QaSurface = (() => {
1210
1354
  async accessModelCatalog(token) {
1211
1355
  return await this.accountRemotes.runAsync(() => this.access.modelCatalog(token));
1212
1356
  }
1357
+ async accessUserModels(token, sessionId, subroleId, adminPreview) {
1358
+ if (sessionId !== null)
1359
+ this.requireChatOwner(token, sessionId);
1360
+ return this.accountRemotes.runAsync(() => userModelOptions(this.ctx, this.access, token, sessionId, subroleId, adminPreview));
1361
+ }
1213
1362
  accessDeleteSubrole(token, id, replacementId) {
1214
1363
  return this.accountRemotes.run(() => {
1215
1364
  this.access.deleteSubrole(token, id, replacementId);
@@ -1490,9 +1639,12 @@ let QaSurface = (() => {
1490
1639
  }
1491
1640
  chatSelectModel(token, request) {
1492
1641
  this.requireChatOwner(token, String(request.sessionId));
1493
- if (this.getConfig().lockdown.enforceFixedModel)
1494
- throw new Error("The chat model is fixed by its policy.");
1495
- return this.chatTransport.selectModel(token, request);
1642
+ return this.chatTransport.selectModel(token, request, async () => {
1643
+ const id = String(request.sessionId);
1644
+ if (this.requestScheduler.status(id).waiting === true)
1645
+ throw new Error("Wait for the queued request before changing the model.");
1646
+ return selectUserModel(this.ctx, this.access, token, request);
1647
+ });
1496
1648
  }
1497
1649
  async chatPage(token, request, signal) {
1498
1650
  return (await this.chatTransport.page(token, request, signal));
@@ -2043,7 +2195,7 @@ let QaSurface = (() => {
2043
2195
  refreshIntegrationRoutes() {
2044
2196
  const config = this.getConfig();
2045
2197
  const key = config.integration.enabled && config.accounts.enabled
2046
- ? `${config.integration.basePath}:${String(config.integration.maxRequestBytes)}:${String(config.integration.maxAttachmentBytes)}`
2198
+ ? `${config.integration.basePath}:${String(config.integration.maxRequestBytes)}:${String(config.integration.maxAttachmentBytes)}:${String(config.integration.maxAttachments)}`
2047
2199
  : undefined;
2048
2200
  if (key === this.integrationRouteKey)
2049
2201
  return;