@yadsh/dsh-qa-surface 0.19.0 → 0.20.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 (216) hide show
  1. package/README.md +181 -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/admin/ModelPolicyEditor.js +28 -2
  29. package/lib/client/admin/ModelPolicyEditor.js.map +1 -1
  30. package/lib/client/admin/RoleEditor.js +18 -1
  31. package/lib/client/admin/RoleEditor.js.map +1 -1
  32. package/lib/client/admin/pages/SkillFiles.js +1 -1
  33. package/lib/client/admin/pages/SkillFiles.js.map +1 -1
  34. package/lib/client/admin/pages/Users.js +36 -16
  35. package/lib/client/admin/pages/Users.js.map +1 -1
  36. package/lib/client/admin/styles.js +3 -0
  37. package/lib/client/admin/styles.js.map +1 -1
  38. package/lib/client/code-source-styles.js +12 -0
  39. package/lib/client/code-source-styles.js.map +1 -0
  40. package/lib/client/components/QaChangelog.js +69 -0
  41. package/lib/client/components/QaChangelog.js.map +1 -1
  42. package/lib/client/components/QaChatActions.js +36 -14
  43. package/lib/client/components/QaChatActions.js.map +1 -1
  44. package/lib/client/components/QaCodeSourcePicker.js +18 -0
  45. package/lib/client/components/QaCodeSourcePicker.js.map +1 -0
  46. package/lib/client/components/QaComposer.js +11 -12
  47. package/lib/client/components/QaComposer.js.map +1 -1
  48. package/lib/client/components/QaComposerSettings.js +202 -0
  49. package/lib/client/components/QaComposerSettings.js.map +1 -0
  50. package/lib/client/components/QaFormItem.js +74 -38
  51. package/lib/client/components/QaFormItem.js.map +1 -1
  52. package/lib/client/components/QaHistoryCatalog.js +261 -0
  53. package/lib/client/components/QaHistoryCatalog.js.map +1 -0
  54. package/lib/client/components/QaInputForm.js +115 -32
  55. package/lib/client/components/QaInputForm.js.map +1 -1
  56. package/lib/client/components/QaModelSelector.js +21 -0
  57. package/lib/client/components/QaModelSelector.js.map +1 -0
  58. package/lib/client/components/QaSidebar.js +25 -24
  59. package/lib/client/components/QaSidebar.js.map +1 -1
  60. package/lib/client/composer-settings-styles.js +21 -0
  61. package/lib/client/composer-settings-styles.js.map +1 -0
  62. package/lib/client/forms-styles.js +35 -11
  63. package/lib/client/forms-styles.js.map +1 -1
  64. package/lib/client/history-organization-styles.js +31 -0
  65. package/lib/client/history-organization-styles.js.map +1 -0
  66. package/lib/client/history-organization.js +155 -0
  67. package/lib/client/history-organization.js.map +1 -0
  68. package/lib/client/index.js +13 -4
  69. package/lib/client/index.js.map +1 -1
  70. package/lib/client/settings/sections/attachments.js +7 -1
  71. package/lib/client/settings/sections/attachments.js.map +1 -1
  72. package/lib/client/settings/sections/session.js +1 -1
  73. package/lib/client/settings/sections/session.js.map +1 -1
  74. package/lib/client/styles.js +18 -1
  75. package/lib/client/styles.js.map +1 -1
  76. package/lib/client/types.js.map +1 -1
  77. package/lib/client/use-chat-code-source.js +156 -0
  78. package/lib/client/use-chat-code-source.js.map +1 -0
  79. package/lib/client/use-history-organization.js +48 -0
  80. package/lib/client/use-history-organization.js.map +1 -0
  81. package/lib/client/use-model-selection.js +96 -0
  82. package/lib/client/use-model-selection.js.map +1 -0
  83. package/lib/client/use-qa-file-drop.js +81 -0
  84. package/lib/client/use-qa-file-drop.js.map +1 -0
  85. package/lib/client/user-settings/IntegrationTokensPage.js +42 -6
  86. package/lib/client/user-settings/IntegrationTokensPage.js.map +1 -1
  87. package/lib/client/user-settings/UserSettingsDialog.js +1 -1
  88. package/lib/client/user-settings/UserSettingsDialog.js.map +1 -1
  89. package/lib/client.js +123 -25
  90. package/lib/client.js.map +1 -1
  91. package/lib/code-source-selection.js +102 -0
  92. package/lib/code-source-selection.js.map +1 -0
  93. package/lib/config-resolvers/accounts.js +26 -1
  94. package/lib/config-resolvers/accounts.js.map +1 -1
  95. package/lib/config-resolvers/defaults.js +5 -0
  96. package/lib/config-resolvers/defaults.js.map +1 -1
  97. package/lib/config-resolvers/integration.js +8 -1
  98. package/lib/config-resolvers/integration.js.map +1 -1
  99. package/lib/config-resolvers/session.js +2 -0
  100. package/lib/config-resolvers/session.js.map +1 -1
  101. package/lib/config.js +51 -3
  102. package/lib/config.js.map +1 -1
  103. package/lib/enforcement/skill-policy.js +37 -2
  104. package/lib/enforcement/skill-policy.js.map +1 -1
  105. package/lib/forms/errors.js +6 -1
  106. package/lib/forms/errors.js.map +1 -1
  107. package/lib/forms/gate.js +28 -2
  108. package/lib/forms/gate.js.map +1 -1
  109. package/lib/forms/schema-errors.js +47 -0
  110. package/lib/forms/schema-errors.js.map +1 -0
  111. package/lib/forms/schema.js +29 -20
  112. package/lib/forms/schema.js.map +1 -1
  113. package/lib/index.js +148 -9
  114. package/lib/index.js.map +1 -1
  115. package/lib/integration/http.js +9 -10
  116. package/lib/integration/http.js.map +1 -1
  117. package/lib/integration/service.js +9 -0
  118. package/lib/integration/service.js.map +1 -1
  119. package/lib/personal-skills/provider.js +9 -1
  120. package/lib/personal-skills/provider.js.map +1 -1
  121. package/lib/personal-skills/service.js +4 -0
  122. package/lib/personal-skills/service.js.map +1 -1
  123. package/lib/personal-skills/shared-seed.js +65 -0
  124. package/lib/personal-skills/shared-seed.js.map +1 -0
  125. package/lib/prompt-notes.js +19 -1
  126. package/lib/prompt-notes.js.map +1 -1
  127. package/lib/provenance/collector.js +1 -0
  128. package/lib/provenance/collector.js.map +1 -1
  129. package/lib/provenance/extractors.js +6 -1
  130. package/lib/provenance/extractors.js.map +1 -1
  131. package/lib/qa-tools/catalog.js +18 -1
  132. package/lib/qa-tools/catalog.js.map +1 -1
  133. package/lib/qa-tools/code-files.js +207 -0
  134. package/lib/qa-tools/code-files.js.map +1 -0
  135. package/lib/qa-tools/code-tools.js +158 -0
  136. package/lib/qa-tools/code-tools.js.map +1 -0
  137. package/lib/qa-tools/docs-tools.js +49 -12
  138. package/lib/qa-tools/docs-tools.js.map +1 -1
  139. package/lib/qa-tools/index.js +4 -0
  140. package/lib/qa-tools/index.js.map +1 -1
  141. package/lib/qa-tools/request-user-form.js +26 -6
  142. package/lib/qa-tools/request-user-form.js.map +1 -1
  143. package/lib/request-scheduler.js +32 -5
  144. package/lib/request-scheduler.js.map +1 -1
  145. package/lib/resolve-config.js +9 -1
  146. package/lib/resolve-config.js.map +1 -1
  147. package/lib/secure-session.js +16 -4
  148. package/lib/secure-session.js.map +1 -1
  149. package/lib/session-model.js +43 -1
  150. package/lib/session-model.js.map +1 -1
  151. package/lib/shared/history-folder.js +18 -0
  152. package/lib/shared/history-folder.js.map +1 -0
  153. package/lib/typert.host.js +749 -162
  154. package/lib/typert.remote-client.d.ts +19 -7
  155. package/lib/typert.remote-client.js +684 -153
  156. package/lib/types/access/model-choices.d.ts +16 -0
  157. package/lib/types/access/model-policy.d.ts +13 -7
  158. package/lib/types/access/model.d.ts +9 -0
  159. package/lib/types/access/queue-policy.d.ts +30 -0
  160. package/lib/types/access/service.d.ts +27 -0
  161. package/lib/types/account-remotes.d.ts +5 -4
  162. package/lib/types/accounts/database.d.ts +5 -0
  163. package/lib/types/accounts/store.d.ts +6 -0
  164. package/lib/types/chat-sharing/transport.d.ts +1 -1
  165. package/lib/types/client/QaAccountsController.d.ts +3 -1
  166. package/lib/types/client/QaSessionController.d.ts +19 -5
  167. package/lib/types/client/QaSurface.d.ts +2 -0
  168. package/lib/types/client/admin/ModelPolicyEditor.d.ts +2 -0
  169. package/lib/types/client/code-source-styles.d.ts +2 -0
  170. package/lib/types/client/components/QaChatActions.d.ts +3 -1
  171. package/lib/types/client/components/QaCodeSourcePicker.d.ts +9 -0
  172. package/lib/types/client/components/QaComposer.d.ts +2 -0
  173. package/lib/types/client/components/QaComposerSettings.d.ts +16 -0
  174. package/lib/types/client/components/QaFormItem.d.ts +4 -2
  175. package/lib/types/client/components/QaHistoryCatalog.d.ts +19 -0
  176. package/lib/types/client/components/QaInputForm.d.ts +3 -2
  177. package/lib/types/client/components/QaModelSelector.d.ts +4 -0
  178. package/lib/types/client/components/QaSidebar.d.ts +3 -0
  179. package/lib/types/client/composer-settings-styles.d.ts +2 -0
  180. package/lib/types/client/forms-styles.d.ts +1 -1
  181. package/lib/types/client/history-organization-styles.d.ts +3 -0
  182. package/lib/types/client/history-organization.d.ts +38 -0
  183. package/lib/types/client/types.d.ts +12 -4
  184. package/lib/types/client/use-chat-code-source.d.ts +20 -0
  185. package/lib/types/client/use-history-organization.d.ts +8 -0
  186. package/lib/types/client/use-model-selection.d.ts +24 -0
  187. package/lib/types/client/use-qa-file-drop.d.ts +12 -0
  188. package/lib/types/code-source-selection.d.ts +28 -0
  189. package/lib/types/code-sources.js +2 -0
  190. package/lib/types/code-sources.js.map +1 -0
  191. package/lib/types/config-resolvers/integration.d.ts +7 -1
  192. package/lib/types/forms/errors.d.ts +3 -2
  193. package/lib/types/forms/gate.d.ts +4 -2
  194. package/lib/types/forms/schema-errors.d.ts +7 -0
  195. package/lib/types/forms/types.d.ts +14 -0
  196. package/lib/types/index.d.ts +38 -5
  197. package/lib/types/integration/http.d.ts +1 -3
  198. package/lib/types/integration/service.d.ts +2 -0
  199. package/lib/types/personal-skills/shared-seed.d.ts +12 -0
  200. package/lib/types/prompt-notes.d.ts +5 -1
  201. package/lib/types/qa-tools/catalog.d.ts +3 -2
  202. package/lib/types/qa-tools/code-files.d.ts +59 -0
  203. package/lib/types/qa-tools/code-tools.d.ts +7 -0
  204. package/lib/types/qa-tools/docs-tools.d.ts +4 -0
  205. package/lib/types/qa-tools/index.d.ts +2 -0
  206. package/lib/types/request-scheduler.d.ts +21 -2
  207. package/lib/types/session-model.d.ts +11 -2
  208. package/lib/types/shared/history-folder.d.ts +4 -0
  209. package/lib/types/types/accounts.d.ts +11 -0
  210. package/lib/types/types/capability.d.ts +31 -4
  211. package/lib/types/types/code-sources.d.ts +12 -0
  212. package/lib/types/types/config.d.ts +20 -0
  213. package/lib/types/types.d.ts +1 -0
  214. package/lib/user-workspace.js +7 -4
  215. package/lib/user-workspace.js.map +1 -1
  216. 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";
@@ -77,6 +79,7 @@ import { createQaIntegrationRunner } from "./integration/host-runner.js";
77
79
  import { QaIntegrationService } from "./integration/service.js";
78
80
  import { QaPolicyAdmission } from "./secure-session.js";
79
81
  import { QaAccessService } from "./access/service.js";
82
+ import { userModelOptions, selectUserModel } from "./access/model-choices.js";
80
83
  import { userInvocableSkillNames } from "./access/model.js";
81
84
  import { createQaSlashRemotes } from "./slash/remotes.js";
82
85
  import { QaPromptNotes } from "./prompt-notes.js";
@@ -99,6 +102,7 @@ export const inject = [
99
102
  "systemPrompt",
100
103
  "workspaceRegistry",
101
104
  "sessionController",
105
+ "llm",
102
106
  ];
103
107
  // One home for the namespace: the browser card binds to the same constant
104
108
  // through `src/shared/settings.ts`, which avoids importing this module (and
@@ -142,6 +146,8 @@ function releaseScopeLease(lease) {
142
146
  let QaSurface = (() => {
143
147
  let _classSuper = TypertRemoteService;
144
148
  let _instanceExtraInitializers = [];
149
+ let _chatCodeSources_decorators;
150
+ let _chatSelectCodeSource_decorators;
145
151
  let _accountsRegister_decorators;
146
152
  let _accountsLogin_decorators;
147
153
  let _accountsOidcStart_decorators;
@@ -160,6 +166,7 @@ let QaSurface = (() => {
160
166
  let _accountsCreateServiceToken_decorators;
161
167
  let _accountsRevokeServiceToken_decorators;
162
168
  let _accountsSetServiceTokenClarifications_decorators;
169
+ let _accountsSetServiceTokenHistoryFolder_decorators;
163
170
  let _describe_decorators;
164
171
  let _queueStatus_decorators;
165
172
  let _createSession_decorators;
@@ -170,6 +177,7 @@ let QaSurface = (() => {
170
177
  let _accessCreateSubrole_decorators;
171
178
  let _accessUpdateSubrole_decorators;
172
179
  let _accessModelCatalog_decorators;
180
+ let _accessUserModels_decorators;
173
181
  let _accessDeleteSubrole_decorators;
174
182
  let _accessUpdateCommon_decorators;
175
183
  let _accessUpdateAssignment_decorators;
@@ -255,6 +263,8 @@ let QaSurface = (() => {
255
263
  return class QaSurface extends _classSuper {
256
264
  static {
257
265
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
266
+ _chatCodeSources_decorators = [Remote("chatCodeSources")];
267
+ _chatSelectCodeSource_decorators = [Remote("chatSelectCodeSource")];
258
268
  _accountsRegister_decorators = [Remote("accountsRegister")];
259
269
  _accountsLogin_decorators = [Remote("accountsLogin")];
260
270
  _accountsOidcStart_decorators = [Remote("accountsOidcStart")];
@@ -273,6 +283,7 @@ let QaSurface = (() => {
273
283
  _accountsCreateServiceToken_decorators = [Remote("accountsCreateServiceToken")];
274
284
  _accountsRevokeServiceToken_decorators = [Remote("accountsRevokeServiceToken")];
275
285
  _accountsSetServiceTokenClarifications_decorators = [Remote("accountsSetServiceTokenClarifications")];
286
+ _accountsSetServiceTokenHistoryFolder_decorators = [Remote("accountsSetServiceTokenHistoryFolder")];
276
287
  _describe_decorators = [Remote("describe")];
277
288
  _queueStatus_decorators = [Remote("queueStatus")];
278
289
  _createSession_decorators = [Remote("createSession")];
@@ -283,6 +294,7 @@ let QaSurface = (() => {
283
294
  _accessCreateSubrole_decorators = [Remote("accessCreateSubrole")];
284
295
  _accessUpdateSubrole_decorators = [Remote("accessUpdateSubrole")];
285
296
  _accessModelCatalog_decorators = [Remote("accessModelCatalog")];
297
+ _accessUserModels_decorators = [Remote("accessUserModels")];
286
298
  _accessDeleteSubrole_decorators = [Remote("accessDeleteSubrole")];
287
299
  _accessUpdateCommon_decorators = [Remote("accessUpdateCommon")];
288
300
  _accessUpdateAssignment_decorators = [Remote("accessUpdateAssignment")];
@@ -365,6 +377,8 @@ let QaSurface = (() => {
365
377
  _skillsTools_decorators = [Remote("skillsTools")];
366
378
  _slashCatalog_decorators = [Remote("slashCatalog")];
367
379
  _slashExecute_decorators = [Remote("slashExecute")];
380
+ __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);
381
+ __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
382
  __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
383
  __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
384
  __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 +397,7 @@ let QaSurface = (() => {
383
397
  __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
398
  __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
399
  __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);
400
+ __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
401
  __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
402
  __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
403
  __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 +408,7 @@ let QaSurface = (() => {
393
408
  __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
409
  __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
410
  __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);
411
+ __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
412
  __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
413
  __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
414
  __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 +493,20 @@ let QaSurface = (() => {
477
493
  __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
494
  if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
479
495
  }
496
+ sourceSelections = __runInitializers(this, _instanceExtraInitializers);
497
+ codeSourceStore() {
498
+ 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) => {
499
+ const agent = this.ctx.agents.get(SessionId(id));
500
+ return (agent !== undefined &&
501
+ (agent.status === "running" ||
502
+ agent.inbox.nextStep.length > 0 ||
503
+ qaRequestFamilyBusy(this.ctx, agent) ||
504
+ this.requestScheduler.status(id).waiting === true));
505
+ }));
506
+ }
480
507
  static inject = inject;
481
508
  static Config = ConfigSchema;
482
- source = __runInitializers(this, _instanceExtraInitializers);
509
+ source;
483
510
  logger;
484
511
  admission;
485
512
  approvals;
@@ -560,7 +587,20 @@ let QaSurface = (() => {
560
587
  // the one live source: each read folds its current snapshots, and a settings
561
588
  // write is visible on the next read without reloading the plugin.
562
589
  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));
590
+ ctx.effect(() => ctx.on("agent/created", ({ agent }) => {
591
+ const { parentSession } = agent.session.header;
592
+ if (parentSession !== undefined &&
593
+ (qaDelegatedHeader(agent.session.header) ||
594
+ agent.session.header.isSeeded === true)) {
595
+ this.codeSourceStore().inherit(String(agent.session.id), String(parentSession), this.admission.knowsSession(String(parentSession)));
596
+ }
597
+ }, { global: true }), "dsh-qa-surface.code-source-inheritance");
598
+ ctx.effect(() => () => this.sourceSelections?.close(), "dsh-qa-surface.code-source-store");
599
+ this.requestScheduler = new QaRequestScheduler(() => this.getConfig().session.maxActiveRequests, () => qaRequestRoots(ctx, this.getConfig().session.maxActiveRequests > 0), Date.now, (agent) => qaRequestFamilyBusy(ctx, agent),
600
+ // The ceiling one turn fills against, resolved per admission: a role or
601
+ // an account that overrides the deployment's number is read here, where
602
+ // the scheduler decides, not once at boot.
603
+ (agent) => this.queueSlotsOverride(agent));
564
604
  ctx.effect(() => this.requestScheduler.install(ctx), "dsh-qa-surface.request-queue");
565
605
  this.logger = getPluginLogger({
566
606
  pluginId: "dsh-qa-surface",
@@ -766,6 +806,7 @@ let QaSurface = (() => {
766
806
  // complete persona closes the system prompt to plugins, the conversation
767
807
  // stays open.
768
808
  this.notes = new QaPromptNotes(ctx, {
809
+ codeSources: (sessionId) => this.getCodeSources(sessionId),
769
810
  config: () => this.getConfig(),
770
811
  accounts: () => this.accountRemotes.resolve(this.getConfig()),
771
812
  isQaSession: (sessionId) => this.admission.knowsSession(sessionId),
@@ -793,6 +834,10 @@ let QaSurface = (() => {
793
834
  // The QA tool catalog is attached per agent, never at boot: nothing here
794
835
  // reaches the model until a managed agent loads the activation skill.
795
836
  this.tools = new QaTools(ctx, {
837
+ codeSources: (exec) => this.getCodeSources(exec?.agent?.session?.id === undefined
838
+ ? undefined
839
+ : String(exec.agent.session.id)),
840
+ codeReadRoots: () => this.getConfig().lockdown.sharedReadOnlyRoots,
796
841
  forms: this.formGate,
797
842
  formsEnabled: () => this.getConfig().forms.enabled,
798
843
  formProjection: (submission, sessionId) => this.formAttachments.readable(submission, sessionId),
@@ -972,6 +1017,33 @@ let QaSurface = (() => {
972
1017
  modelPolicyForSession(sessionId) {
973
1018
  return this.access.modelPolicyFor(sessionId).pair;
974
1019
  }
1020
+ /** Shared source catalogue consumed by preset-mounted Git tools at call time. */
1021
+ getCodeSources(sessionId) {
1022
+ return sessionId === undefined
1023
+ ? this.getConfig().codeSources
1024
+ : this.codeSourceStore().catalog(sessionId);
1025
+ }
1026
+ getSelectedCodeSource(sessionId) {
1027
+ return this.codeSourceStore().selected(sessionId);
1028
+ }
1029
+ async chatCodeSources(token, sessionId) {
1030
+ const finish = await this.admitChatRead(token, sessionId);
1031
+ let owner = true;
1032
+ try {
1033
+ this.requireChatOwner(token, sessionId);
1034
+ }
1035
+ catch {
1036
+ owner = false;
1037
+ }
1038
+ finish();
1039
+ return this.codeSourceStore().view(sessionId, owner);
1040
+ }
1041
+ async chatSelectCodeSource(token, sessionId, source) {
1042
+ const finish = await this.admitChatRead(token, sessionId);
1043
+ this.requireChatOwner(token, sessionId);
1044
+ finish();
1045
+ return this.codeSourceStore().select(sessionId, source);
1046
+ }
975
1047
  getConfig() {
976
1048
  return resolveConfig(this.source());
977
1049
  }
@@ -1118,6 +1190,9 @@ let QaSurface = (() => {
1118
1190
  accountsSetServiceTokenClarifications(token, tokenId, allowed) {
1119
1191
  return this.accountRemotes.setServiceTokenClarifications(token, tokenId, allowed);
1120
1192
  }
1193
+ accountsSetServiceTokenHistoryFolder(token, tokenId, folder) {
1194
+ return this.accountRemotes.setServiceTokenHistoryFolder(token, tokenId, folder);
1195
+ }
1121
1196
  /**
1122
1197
  * Serve the effective QA configuration to the browser. The DSH gateway pins
1123
1198
  * settings RPCs to loopback, so a browser served over the LAN always sees
@@ -1132,12 +1207,68 @@ let QaSurface = (() => {
1132
1207
  * Report server admission. Global reads expose counts only; a chat's FIFO
1133
1208
  * position requires that account's current read access to the chat. The
1134
1209
  * scheduler gates every root turn, including native and integration sends.
1210
+ *
1211
+ * Both arguments are part of the wire contract: the gateway client counts
1212
+ * declared parameters rather than TypeScript optionals, so a call that omits
1213
+ * them is refused on the browser before the Host ever sees it. An empty
1214
+ * session id is the global read — the shape every initial send asks for,
1215
+ * while its draft chat has no session to name yet.
1135
1216
  */
1136
1217
  queueStatus(token, sessionId) {
1137
- if (sessionId !== undefined && this.getConfig().accounts.enabled) {
1138
- this.sharing().access(token ?? "", sessionId);
1218
+ const requested = sessionId === "" ? undefined : sessionId;
1219
+ if (requested !== undefined && this.getConfig().accounts.enabled) {
1220
+ this.sharing().access(token, requested);
1139
1221
  }
1140
- return this.requestScheduler.status(sessionId);
1222
+ return this.requestScheduler.status(requested, this.queueCeiling(token, requested));
1223
+ }
1224
+ /**
1225
+ * The ceiling this read answers against: the chat's own account chain when
1226
+ * the read names a chat, the caller's account chain when it does not (the
1227
+ * pre-send check carries a token but no chat yet), and the deployment's
1228
+ * number whenever accounts are off or nobody matches. `undefined` is the
1229
+ * scheduler's signal to fall back to that number, so the branch is a value
1230
+ * rather than a flag.
1231
+ */
1232
+ queueCeiling(token, sessionId) {
1233
+ const config = this.getConfig();
1234
+ if (!config.accounts.enabled)
1235
+ return undefined;
1236
+ const accounts = this.accountRemotes.resolve(config);
1237
+ if (accounts === undefined)
1238
+ return undefined;
1239
+ if (sessionId !== undefined) {
1240
+ return accounts.ownerIdOf(sessionId) === undefined
1241
+ ? undefined
1242
+ : this.access.queueSlotsFor(sessionId);
1243
+ }
1244
+ try {
1245
+ return this.access.queueSlotsForUser(accounts.currentUser(token).id);
1246
+ }
1247
+ catch {
1248
+ // An anonymous or stale browser still deserves the deployment's numbers:
1249
+ // the read is advisory, and the browser holds its question back on its
1250
+ // own only for a ceiling it can actually name.
1251
+ return undefined;
1252
+ }
1253
+ }
1254
+ /**
1255
+ * The ceiling override one arriving turn fills against, or `undefined` when
1256
+ * the deployment default governs it: without accounts every turn shares the
1257
+ * one number, and an unowned session (an integration or an admin preview)
1258
+ * stays in that shared pool whatever its role might say.
1259
+ */
1260
+ queueSlotsOverride(agent) {
1261
+ const config = this.getConfig();
1262
+ if (!config.accounts.enabled)
1263
+ return undefined;
1264
+ const sessionId = String(agent.session.id);
1265
+ if (sessionId === "")
1266
+ return undefined;
1267
+ const accounts = this.accountRemotes.resolve(config);
1268
+ if (accounts === undefined || accounts.ownerIdOf(sessionId) === undefined) {
1269
+ return undefined;
1270
+ }
1271
+ return this.access.queueSlotsFor(sessionId);
1141
1272
  }
1142
1273
  /**
1143
1274
  * Create a QA session from Host-owned inputs. With account workspaces on,
@@ -1210,6 +1341,11 @@ let QaSurface = (() => {
1210
1341
  async accessModelCatalog(token) {
1211
1342
  return await this.accountRemotes.runAsync(() => this.access.modelCatalog(token));
1212
1343
  }
1344
+ async accessUserModels(token, sessionId, subroleId, adminPreview) {
1345
+ if (sessionId !== null)
1346
+ this.requireChatOwner(token, sessionId);
1347
+ return this.accountRemotes.runAsync(() => userModelOptions(this.ctx, this.access, token, sessionId, subroleId, adminPreview));
1348
+ }
1213
1349
  accessDeleteSubrole(token, id, replacementId) {
1214
1350
  return this.accountRemotes.run(() => {
1215
1351
  this.access.deleteSubrole(token, id, replacementId);
@@ -1490,9 +1626,12 @@ let QaSurface = (() => {
1490
1626
  }
1491
1627
  chatSelectModel(token, request) {
1492
1628
  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);
1629
+ return this.chatTransport.selectModel(token, request, async () => {
1630
+ const id = String(request.sessionId);
1631
+ if (this.requestScheduler.status(id).waiting === true)
1632
+ throw new Error("Wait for the queued request before changing the model.");
1633
+ return selectUserModel(this.ctx, this.access, token, request);
1634
+ });
1496
1635
  }
1497
1636
  async chatPage(token, request, signal) {
1498
1637
  return (await this.chatTransport.page(token, request, signal));
@@ -2043,7 +2182,7 @@ let QaSurface = (() => {
2043
2182
  refreshIntegrationRoutes() {
2044
2183
  const config = this.getConfig();
2045
2184
  const key = config.integration.enabled && config.accounts.enabled
2046
- ? `${config.integration.basePath}:${String(config.integration.maxRequestBytes)}:${String(config.integration.maxAttachmentBytes)}`
2185
+ ? `${config.integration.basePath}:${String(config.integration.maxRequestBytes)}:${String(config.integration.maxAttachmentBytes)}:${String(config.integration.maxAttachments)}`
2047
2186
  : undefined;
2048
2187
  if (key === this.integrationRouteKey)
2049
2188
  return;