@yadsh/dsh-qa-surface 0.6.1 → 0.7.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 (281) hide show
  1. package/README.md +136 -7
  2. package/capability-policy.json +1 -1
  3. package/lib/access/capability-catalog.js +144 -0
  4. package/lib/access/capability-catalog.js.map +1 -0
  5. package/lib/access/model.js +379 -0
  6. package/lib/access/model.js.map +1 -0
  7. package/lib/access/role-repository.js +195 -0
  8. package/lib/access/role-repository.js.map +1 -0
  9. package/lib/access/service.js +380 -0
  10. package/lib/access/service.js.map +1 -0
  11. package/lib/access/skill-metadata.js +234 -0
  12. package/lib/access/skill-metadata.js.map +1 -0
  13. package/lib/account-remotes.js +20 -10
  14. package/lib/account-remotes.js.map +1 -1
  15. package/lib/accounts/errors.js.map +1 -1
  16. package/lib/accounts/file.js.map +1 -1
  17. package/lib/accounts/store.js +202 -3
  18. package/lib/accounts/store.js.map +1 -1
  19. package/lib/admin/conversation-log.js +256 -0
  20. package/lib/admin/conversation-log.js.map +1 -0
  21. package/lib/admin/index.js +17 -0
  22. package/lib/admin/index.js.map +1 -0
  23. package/lib/admin/metrics.js +103 -0
  24. package/lib/admin/metrics.js.map +1 -0
  25. package/lib/admin/paging.js +23 -0
  26. package/lib/admin/paging.js.map +1 -0
  27. package/lib/admin/permissions.js +50 -0
  28. package/lib/admin/permissions.js.map +1 -0
  29. package/lib/admin/quality-store.js +485 -0
  30. package/lib/admin/quality-store.js.map +1 -0
  31. package/lib/admin/queue.js +107 -0
  32. package/lib/admin/queue.js.map +1 -0
  33. package/lib/admin/redaction.js +45 -0
  34. package/lib/admin/redaction.js.map +1 -0
  35. package/lib/admin/service.js +897 -0
  36. package/lib/admin/service.js.map +1 -0
  37. package/lib/admin/session-log.js +142 -0
  38. package/lib/admin/session-log.js.map +1 -0
  39. package/lib/cli.js +9 -6
  40. package/lib/cli.js.map +1 -1
  41. package/lib/client/QaSessionController.js +28 -2
  42. package/lib/client/QaSessionController.js.map +1 -1
  43. package/lib/client/QaSurface.js +143 -5
  44. package/lib/client/QaSurface.js.map +1 -1
  45. package/lib/client/QaTranscriptAdapter.js +1 -0
  46. package/lib/client/QaTranscriptAdapter.js.map +1 -1
  47. package/lib/client/admin/QaAdmin.js +458 -0
  48. package/lib/client/admin/QaAdmin.js.map +1 -0
  49. package/lib/client/admin/format.js +177 -0
  50. package/lib/client/admin/format.js.map +1 -0
  51. package/lib/client/admin/pages/Conversations.js +114 -0
  52. package/lib/client/admin/pages/Conversations.js.map +1 -0
  53. package/lib/client/admin/pages/Overview.js +24 -0
  54. package/lib/client/admin/pages/Overview.js.map +1 -0
  55. package/lib/client/admin/pages/Quality.js +71 -0
  56. package/lib/client/admin/pages/Quality.js.map +1 -0
  57. package/lib/client/admin/pages/Review.js +93 -0
  58. package/lib/client/admin/pages/Review.js.map +1 -0
  59. package/lib/client/admin/pages/Users.js +95 -0
  60. package/lib/client/admin/pages/Users.js.map +1 -0
  61. package/lib/client/admin/routes.js +127 -0
  62. package/lib/client/admin/routes.js.map +1 -0
  63. package/lib/client/admin/shared.js +91 -0
  64. package/lib/client/admin/shared.js.map +1 -0
  65. package/lib/client/admin/styles.js +111 -0
  66. package/lib/client/admin/styles.js.map +1 -0
  67. package/lib/client/components/QaChangelog.js +35 -0
  68. package/lib/client/components/QaChangelog.js.map +1 -1
  69. package/lib/client/components/QaHeader.js +3 -3
  70. package/lib/client/components/QaHeader.js.map +1 -1
  71. package/lib/client/components/QaMessage.js +61 -2
  72. package/lib/client/components/QaMessage.js.map +1 -1
  73. package/lib/client/create-session.js +1 -1
  74. package/lib/client/create-session.js.map +1 -1
  75. package/lib/client/index.js +33 -1
  76. package/lib/client/index.js.map +1 -1
  77. package/lib/client/role/RoleSelector.js +31 -0
  78. package/lib/client/role/RoleSelector.js.map +1 -0
  79. package/lib/client/session-sources.js +37 -1
  80. package/lib/client/session-sources.js.map +1 -1
  81. package/lib/client/settings/card.js +2 -2
  82. package/lib/client/settings/card.js.map +1 -1
  83. package/lib/client/settings/sections.js +0 -1
  84. package/lib/client/settings/sections.js.map +1 -1
  85. package/lib/client/styles.js +31 -0
  86. package/lib/client/styles.js.map +1 -1
  87. package/lib/client/types.js.map +1 -1
  88. package/lib/client.js +9908 -4857
  89. package/lib/client.js.map +1 -1
  90. package/lib/config-resolvers/defaults.js +0 -2
  91. package/lib/config-resolvers/defaults.js.map +1 -1
  92. package/lib/config.js +0 -249
  93. package/lib/config.js.map +1 -1
  94. package/lib/enforcement/skill-policy.js +172 -0
  95. package/lib/enforcement/skill-policy.js.map +1 -0
  96. package/lib/enforcement/tool-grants.js +151 -0
  97. package/lib/enforcement/tool-grants.js.map +1 -0
  98. package/lib/index.js +224 -42
  99. package/lib/index.js.map +1 -1
  100. package/lib/personal-skills/service.js +10 -3
  101. package/lib/personal-skills/service.js.map +1 -1
  102. package/lib/qa-tools/index.js +4 -0
  103. package/lib/qa-tools/index.js.map +1 -1
  104. package/lib/resolve-config.js +0 -2
  105. package/lib/resolve-config.js.map +1 -1
  106. package/lib/secure-session.js +71 -17
  107. package/lib/secure-session.js.map +1 -1
  108. package/lib/typert.host.js +2237 -202
  109. package/lib/typert.remote-client.d.ts +49 -3
  110. package/lib/typert.remote-client.js +1863 -183
  111. package/lib/types/access/capability-catalog.d.ts +37 -0
  112. package/lib/types/access/model.d.ts +60 -0
  113. package/lib/types/access/role-repository.d.ts +32 -0
  114. package/lib/types/access/service.d.ts +57 -0
  115. package/lib/types/access/skill-metadata.d.ts +53 -0
  116. package/lib/types/account-remotes.d.ts +6 -0
  117. package/lib/types/accounts/errors.d.ts +1 -1
  118. package/lib/types/accounts/file.d.ts +16 -5
  119. package/lib/types/accounts/store.d.ts +83 -3
  120. package/lib/types/admin/conversation-log.d.ts +39 -0
  121. package/lib/types/admin/index.d.ts +24 -0
  122. package/lib/types/admin/metrics.d.ts +29 -0
  123. package/lib/types/admin/paging.d.ts +33 -0
  124. package/lib/types/admin/permissions.d.ts +10 -0
  125. package/lib/types/admin/quality-store.d.ts +82 -0
  126. package/lib/types/admin/queue.d.ts +21 -0
  127. package/lib/types/admin/redaction.d.ts +29 -0
  128. package/lib/types/admin/service.d.ts +105 -0
  129. package/lib/types/admin/session-log.d.ts +53 -0
  130. package/lib/types/client/QaSessionController.d.ts +12 -1
  131. package/lib/types/client/QaSurface.d.ts +7 -1
  132. package/lib/types/client/admin/QaAdmin.d.ts +17 -0
  133. package/lib/types/client/admin/format.d.ts +43 -0
  134. package/lib/types/client/admin/pages/Conversations.d.ts +21 -0
  135. package/lib/types/client/admin/pages/Overview.d.ts +13 -0
  136. package/lib/types/client/admin/pages/Quality.d.ts +18 -0
  137. package/lib/types/client/admin/pages/Review.d.ts +15 -0
  138. package/lib/types/client/admin/pages/Users.d.ts +22 -0
  139. package/lib/types/client/admin/routes.d.ts +50 -0
  140. package/lib/types/client/admin/shared.d.ts +53 -0
  141. package/lib/types/client/admin/styles.d.ts +11 -0
  142. package/lib/types/client/components/QaHeader.d.ts +5 -1
  143. package/lib/types/client/components/QaMessage.d.ts +14 -1
  144. package/lib/types/client/create-session.d.ts +2 -0
  145. package/lib/types/client/role/RoleSelector.d.ts +14 -0
  146. package/lib/types/client/session-sources.d.ts +9 -0
  147. package/lib/types/client/settings/sections.d.ts +0 -1
  148. package/lib/types/client/types.d.ts +39 -2
  149. package/lib/types/enforcement/skill-policy.d.ts +29 -0
  150. package/lib/types/enforcement/tool-grants.d.ts +84 -0
  151. package/lib/types/index.d.ts +62 -14
  152. package/lib/types/qa-tools/index.d.ts +2 -0
  153. package/lib/types/secure-session.d.ts +10 -1
  154. package/lib/types/types.d.ts +568 -5
  155. package/package.json +1 -1
  156. package/lib/client/settings/sections/documents.js +0 -88
  157. package/lib/client/settings/sections/documents.js.map +0 -1
  158. package/lib/documents/artifacts/ids.js +0 -43
  159. package/lib/documents/artifacts/ids.js.map +0 -1
  160. package/lib/documents/artifacts/manifest.js +0 -66
  161. package/lib/documents/artifacts/manifest.js.map +0 -1
  162. package/lib/documents/artifacts/store.js +0 -169
  163. package/lib/documents/artifacts/store.js.map +0 -1
  164. package/lib/documents/capabilities.js +0 -93
  165. package/lib/documents/capabilities.js.map +0 -1
  166. package/lib/documents/config.js +0 -302
  167. package/lib/documents/config.js.map +0 -1
  168. package/lib/documents/defaults.js +0 -78
  169. package/lib/documents/defaults.js.map +0 -1
  170. package/lib/documents/errors.js +0 -101
  171. package/lib/documents/errors.js.map +0 -1
  172. package/lib/documents/index.js +0 -80
  173. package/lib/documents/index.js.map +0 -1
  174. package/lib/documents/inspect/facts.js +0 -161
  175. package/lib/documents/inspect/facts.js.map +0 -1
  176. package/lib/documents/inspect/zip.js +0 -108
  177. package/lib/documents/inspect/zip.js.map +0 -1
  178. package/lib/documents/markdown/directives.js +0 -135
  179. package/lib/documents/markdown/directives.js.map +0 -1
  180. package/lib/documents/markdown/frontmatter.js +0 -35
  181. package/lib/documents/markdown/frontmatter.js.map +0 -1
  182. package/lib/documents/markdown/normalize.js +0 -113
  183. package/lib/documents/markdown/normalize.js.map +0 -1
  184. package/lib/documents/orchestrator/assets.js +0 -243
  185. package/lib/documents/orchestrator/assets.js.map +0 -1
  186. package/lib/documents/orchestrator/convert-document.js +0 -186
  187. package/lib/documents/orchestrator/convert-document.js.map +0 -1
  188. package/lib/documents/orchestrator/create-document.js +0 -292
  189. package/lib/documents/orchestrator/create-document.js.map +0 -1
  190. package/lib/documents/orchestrator/extract-document.js +0 -162
  191. package/lib/documents/orchestrator/extract-document.js.map +0 -1
  192. package/lib/documents/orchestrator/inspect-document.js +0 -89
  193. package/lib/documents/orchestrator/inspect-document.js.map +0 -1
  194. package/lib/documents/orchestrator/runtime-deps.js +0 -59
  195. package/lib/documents/orchestrator/runtime-deps.js.map +0 -1
  196. package/lib/documents/orchestrator/scope.js +0 -132
  197. package/lib/documents/orchestrator/scope.js.map +0 -1
  198. package/lib/documents/providers/docling.js +0 -247
  199. package/lib/documents/providers/docling.js.map +0 -1
  200. package/lib/documents/providers/libreoffice.js +0 -130
  201. package/lib/documents/providers/libreoffice.js.map +0 -1
  202. package/lib/documents/providers/markitdown.js +0 -89
  203. package/lib/documents/providers/markitdown.js.map +0 -1
  204. package/lib/documents/providers/pandoc.js +0 -161
  205. package/lib/documents/providers/pandoc.js.map +0 -1
  206. package/lib/documents/providers/process.js +0 -164
  207. package/lib/documents/providers/process.js.map +0 -1
  208. package/lib/documents/providers/registry.js +0 -152
  209. package/lib/documents/providers/registry.js.map +0 -1
  210. package/lib/documents/providers/shared.js +0 -75
  211. package/lib/documents/providers/shared.js.map +0 -1
  212. package/lib/documents/runtime.js +0 -114
  213. package/lib/documents/runtime.js.map +0 -1
  214. package/lib/documents/security/file-types.js +0 -188
  215. package/lib/documents/security/file-types.js.map +0 -1
  216. package/lib/documents/security/limits.js +0 -78
  217. package/lib/documents/security/limits.js.map +0 -1
  218. package/lib/documents/security/mime.js +0 -43
  219. package/lib/documents/security/mime.js.map +0 -1
  220. package/lib/documents/security/paths.js +0 -133
  221. package/lib/documents/security/paths.js.map +0 -1
  222. package/lib/documents/templates/registry.js +0 -147
  223. package/lib/documents/templates/registry.js.map +0 -1
  224. package/lib/documents/templates/resolver.js +0 -59
  225. package/lib/documents/templates/resolver.js.map +0 -1
  226. package/lib/documents/tools/convert.js +0 -125
  227. package/lib/documents/tools/convert.js.map +0 -1
  228. package/lib/documents/tools/create.js +0 -187
  229. package/lib/documents/tools/create.js.map +0 -1
  230. package/lib/documents/tools/index.js +0 -41
  231. package/lib/documents/tools/index.js.map +0 -1
  232. package/lib/documents/tools/inspect.js +0 -135
  233. package/lib/documents/tools/inspect.js.map +0 -1
  234. package/lib/documents/tools/shared.js +0 -88
  235. package/lib/documents/tools/shared.js.map +0 -1
  236. package/lib/documents/tools/to-markdown.js +0 -125
  237. package/lib/documents/tools/to-markdown.js.map +0 -1
  238. package/lib/documents/types.js +0 -12
  239. package/lib/documents/types.js.map +0 -1
  240. package/lib/types/client/settings/sections/documents.d.ts +0 -13
  241. package/lib/types/documents/artifacts/ids.d.ts +0 -14
  242. package/lib/types/documents/artifacts/manifest.d.ts +0 -32
  243. package/lib/types/documents/artifacts/store.d.ts +0 -67
  244. package/lib/types/documents/capabilities.d.ts +0 -32
  245. package/lib/types/documents/config.d.ts +0 -27
  246. package/lib/types/documents/defaults.d.ts +0 -161
  247. package/lib/types/documents/errors.d.ts +0 -42
  248. package/lib/types/documents/index.d.ts +0 -63
  249. package/lib/types/documents/inspect/facts.d.ts +0 -43
  250. package/lib/types/documents/inspect/zip.d.ts +0 -28
  251. package/lib/types/documents/markdown/directives.d.ts +0 -39
  252. package/lib/types/documents/markdown/frontmatter.d.ts +0 -15
  253. package/lib/types/documents/markdown/normalize.d.ts +0 -30
  254. package/lib/types/documents/orchestrator/assets.d.ts +0 -55
  255. package/lib/types/documents/orchestrator/convert-document.d.ts +0 -25
  256. package/lib/types/documents/orchestrator/create-document.d.ts +0 -18
  257. package/lib/types/documents/orchestrator/extract-document.d.ts +0 -24
  258. package/lib/types/documents/orchestrator/inspect-document.d.ts +0 -12
  259. package/lib/types/documents/orchestrator/runtime-deps.d.ts +0 -43
  260. package/lib/types/documents/orchestrator/scope.d.ts +0 -52
  261. package/lib/types/documents/providers/docling.d.ts +0 -54
  262. package/lib/types/documents/providers/libreoffice.d.ts +0 -40
  263. package/lib/types/documents/providers/markitdown.d.ts +0 -28
  264. package/lib/types/documents/providers/pandoc.d.ts +0 -42
  265. package/lib/types/documents/providers/process.d.ts +0 -54
  266. package/lib/types/documents/providers/registry.d.ts +0 -68
  267. package/lib/types/documents/providers/shared.d.ts +0 -27
  268. package/lib/types/documents/runtime.d.ts +0 -59
  269. package/lib/types/documents/security/file-types.d.ts +0 -39
  270. package/lib/types/documents/security/limits.d.ts +0 -24
  271. package/lib/types/documents/security/mime.d.ts +0 -13
  272. package/lib/types/documents/security/paths.d.ts +0 -38
  273. package/lib/types/documents/templates/registry.d.ts +0 -50
  274. package/lib/types/documents/templates/resolver.d.ts +0 -30
  275. package/lib/types/documents/tools/convert.d.ts +0 -9
  276. package/lib/types/documents/tools/create.d.ts +0 -14
  277. package/lib/types/documents/tools/index.d.ts +0 -33
  278. package/lib/types/documents/tools/inspect.d.ts +0 -9
  279. package/lib/types/documents/tools/shared.d.ts +0 -77
  280. package/lib/types/documents/tools/to-markdown.d.ts +0 -12
  281. package/lib/types/documents/types.d.ts +0 -294
@@ -15,7 +15,6 @@ export { AccessSection } from "./sections/access.js";
15
15
  export { AccountsSection } from "./sections/accounts.js";
16
16
  export { AttachmentsSection } from "./sections/attachments.js";
17
17
  export { BrandingSection } from "./sections/branding.js";
18
- export { DocumentsSection } from "./sections/documents.js";
19
18
  export { EmbeddingSection } from "./sections/embedding.js";
20
19
  export { InterfaceSection } from "./sections/interface.js";
21
20
  export { LockdownSection } from "./sections/lockdown.js";
@@ -1,7 +1,7 @@
1
1
  import type { ClientRemote } from "@deepseek-ai/dsh-api-gateway/client";
2
2
  import type { ISessions, SessionFace } from "@deepseek-ai/dsh-api-session-controller/client";
3
3
  import type { UiConversation } from "@deepseek-ai/dsh-client-ui-conversation/client";
4
- import type { QaAccountProfileInput, QaAccountSession, QaAccountStartersInput, QaAccountStarter, QaAccountUserPublic, QaApprovalDecision, QaClaimResult, QaLockdownProof, QaOwnershipEntry, QaPendingApproval, QaPendingQuestion, QaQuestionAnswerItem, QaSessionState, QaSkillDocument, QaSkillDraftInput, QaSkillRemoval, QaSkillSummary, QaSkillToolDescriptor, QaSkillValidation, QaSourceFilePreview, QaTurnSources, QaWhoamiResult } from "../types.js";
4
+ import type { QaAccountProfileInput, QaAccountSession, QaAccountStartersInput, QaAccountStarter, QaAccountUserPublic, QaAccessAdminSnapshot, QaApprovalDecision, QaClaimResult, QaLockdownProof, QaOwnershipEntry, QaPendingApproval, QaPendingQuestion, QaQuestionAnswerItem, QaSessionState, QaSkillDocument, QaSkillDraftInput, QaSkillRemoval, QaSkillSummary, QaSkillToolDescriptor, QaSkillValidation, QaSourceFilePreview, QaTurnSources, QaWhoamiResult, QaCapabilitySelection, QaCurrentAccess, QaSessionAccess, QaSkillActivationRecord, QaSkillAssignmentOverride, QaSubrole, QaUserAccess, QaAdminAuditEvent, QaAdminOverview, QaAdminPage, QaAdminUserDetail, QaAdminUserRow, QaAdminUserUpdate, QaAuditQuery, QaConversationDetail, QaConversationQuery, QaConversationReview, QaConversationReviewInput, QaConversationSummary, QaFeedbackQuery, QaFeedbackRow, QaMessageFeedback, QaMessageFeedbackInput, QaQualityMetrics, QaReviewQueueItem, QaReviewQueueRow, QaUserQuery } from "../types.js";
5
5
  /** Wire content one prompt carries: text plus base64 image uploads. */
6
6
  export type QaPromptContent = Parameters<SessionFace["prompt"]>[0];
7
7
  /** DSH session runtime surface the QA controller is allowed to touch. */
@@ -29,7 +29,44 @@ export type QaSecureSession = (token: string, sessionId: string) => Promise<{
29
29
  readonly error: unknown;
30
30
  }>;
31
31
  /** Host-authoritative creation: identity, cwd and policy never come from the browser. */
32
- export type QaCreateSession = (token: string) => Promise<RemoteResult<string>>;
32
+ export type QaCreateSession = (token: string, subroleId: string | null, adminPreview: boolean) => Promise<RemoteResult<string>>;
33
+ /** Role selector plus administrator mutation channel. */
34
+ export interface QaAccessApi {
35
+ current(token: string): Promise<RemoteResult<QaCurrentAccess>>;
36
+ session(token: string, sessionId: string): Promise<RemoteResult<QaSessionAccess>>;
37
+ admin(token: string): Promise<RemoteResult<QaAccessAdminSnapshot>>;
38
+ createSubrole(token: string, input: QaSubrole): Promise<RemoteResult<QaSubrole>>;
39
+ updateSubrole(token: string, id: string, input: QaSubrole): Promise<RemoteResult<QaSubrole>>;
40
+ deleteSubrole(token: string, id: string, replacementId: string | null): Promise<RemoteResult<{
41
+ readonly deleted: boolean;
42
+ }>>;
43
+ updateCommon(token: string, input: QaCapabilitySelection): Promise<RemoteResult<QaCapabilitySelection>>;
44
+ updateAssignment(token: string, userId: string, input: QaUserAccess): Promise<RemoteResult<QaUserAccess>>;
45
+ updateSkillOverride(token: string, input: QaSkillAssignmentOverride): Promise<RemoteResult<readonly QaSkillAssignmentOverride[]>>;
46
+ skillActivations(token: string, sessionId: string): Promise<RemoteResult<readonly QaSkillActivationRecord[]>>;
47
+ }
48
+ /**
49
+ * The administrative console's wire surface. Every call carries the caller's
50
+ * token and nothing else identifying: the Host resolves the actor, checks the
51
+ * permission the method needs and answers with the audience-safe refusal code
52
+ * the page renders.
53
+ */
54
+ export interface QaAdminApi {
55
+ overview(token: string): Promise<RemoteResult<QaAdminOverview>>;
56
+ users(token: string, query: QaUserQuery, cursor: string | null, limit: number | null): Promise<RemoteResult<QaAdminPage<QaAdminUserRow>>>;
57
+ user(token: string, userId: string): Promise<RemoteResult<QaAdminUserDetail>>;
58
+ updateUser(token: string, userId: string, update: QaAdminUserUpdate): Promise<RemoteResult<QaAdminUserDetail>>;
59
+ conversations(token: string, query: QaConversationQuery, cursor: string | null, limit: number | null): Promise<RemoteResult<QaAdminPage<QaConversationSummary>>>;
60
+ conversation(token: string, conversationId: string): Promise<RemoteResult<QaConversationDetail>>;
61
+ feedback(token: string, query: QaFeedbackQuery, cursor: string | null, limit: number | null): Promise<RemoteResult<QaAdminPage<QaFeedbackRow>>>;
62
+ /** The signed-in user's own verdict on one of their assistant messages. */
63
+ rateMessage(token: string, conversationId: string, messageId: string, input: QaMessageFeedbackInput): Promise<RemoteResult<QaMessageFeedback>>;
64
+ reviewQueue(token: string, cursor: string | null, limit: number | null): Promise<RemoteResult<QaAdminPage<QaReviewQueueRow>>>;
65
+ queueConversation(token: string, conversationId: string, messageId: string | null): Promise<RemoteResult<QaReviewQueueItem>>;
66
+ saveReview(token: string, input: QaConversationReviewInput): Promise<RemoteResult<QaConversationReview>>;
67
+ metrics(token: string): Promise<RemoteResult<QaQualityMetrics>>;
68
+ audit(token: string, query: QaAuditQuery, cursor: string | null, limit: number | null): Promise<RemoteResult<QaAdminPage<QaAdminAuditEvent>>>;
69
+ }
33
70
  /**
34
71
  * Browser file-upload service (`ctx.fileUpload`), described structurally on
35
72
  * purpose: files do not ride the prompt inline the way images do, they are
@@ -0,0 +1,29 @@
1
+ import type { Agent } from "@deepseek-ai/dsh-agent";
2
+ import type { SkillSummary } from "@deepseek-ai/dsh-skill";
3
+ import type { PluginLogger } from "@yadsh/dsh-plugin-log";
4
+ import type { QaEffectiveCapabilityPolicy } from "../types.js";
5
+ import type { QaAgentToolGrants } from "./tool-grants.js";
6
+ declare const SKILL_NOT_AVAILABLE = "SKILL_NOT_AVAILABLE";
7
+ export interface QaSkillPolicyOptions {
8
+ readonly agent: Agent;
9
+ readonly policy: QaEffectiveCapabilityPolicy;
10
+ readonly discovered: ReadonlyMap<string, SkillSummary>;
11
+ /** The agent's live tool policy; loading a skill may widen it. */
12
+ readonly grants: QaAgentToolGrants;
13
+ readonly logger: PluginLogger;
14
+ /** Preview sessions exercise the real policy and label their own records. */
15
+ readonly preview?: boolean;
16
+ }
17
+ /**
18
+ * Agent-local skill consumer. The local `skill` registration shadows the
19
+ * standard loader; discovery, direct loading and a `/name` gesture all enforce
20
+ * the same frozen allow-list, and every successful load activates the tool
21
+ * grant the skill declares — still capped by the subrole's ceiling.
22
+ *
23
+ * Loading the instructions and widening the toolset is one operation: a skill
24
+ * that cannot be granted what it requires is refused instead of being handed
25
+ * instructions it has no tools to follow.
26
+ */
27
+ export declare function installQaSkillPolicy(options: QaSkillPolicyOptions): () => void;
28
+ export { SKILL_NOT_AVAILABLE };
29
+ //# sourceMappingURL=skill-policy.d.ts.map
@@ -0,0 +1,84 @@
1
+ import type { Agent } from "@deepseek-ai/dsh-agent";
2
+ import type { PluginLogger } from "@yadsh/dsh-plugin-log";
3
+ import type { QaSkillActivationOrigin, QaSkillActivationRecord, QaSkillDescriptor } from "../types.js";
4
+ /** One live grant: the skill that asked for tools and what it actually got. */
5
+ export interface QaSkillGrant {
6
+ readonly skillName: string;
7
+ readonly origin: QaSkillActivationOrigin;
8
+ readonly requestedTools: readonly string[];
9
+ readonly grantedTools: readonly string[];
10
+ readonly deniedTools: readonly string[];
11
+ readonly activatedAt: string;
12
+ }
13
+ export type QaSkillActivationOutcome = {
14
+ readonly status: "activated";
15
+ readonly grant: QaSkillGrant;
16
+ /** Present when a best-effort skill had to give up a required tool. */
17
+ readonly warning?: string;
18
+ } | {
19
+ readonly status: "rejected";
20
+ readonly reason: string;
21
+ };
22
+ export interface QaAgentToolGrantsOptions {
23
+ readonly agent: Agent;
24
+ /** Tools visible from the first model step; the restriction keeps admitting them. */
25
+ readonly baseTools: readonly string[];
26
+ /** Ceiling for grants, already narrowed to tools that exist right now. */
27
+ readonly grantableTools: readonly string[];
28
+ /** Normalized `metadata.qa-surface` of every discovered skill. */
29
+ readonly descriptors: ReadonlyMap<string, QaSkillDescriptor>;
30
+ readonly logger: PluginLogger;
31
+ /** Append one attempt to the session record for later review. */
32
+ readonly record?: (entry: QaSkillActivationRecord) => void;
33
+ }
34
+ /**
35
+ * The scoped tool policy of one live agent.
36
+ *
37
+ * Two independent layers enforce the same effective set. `restrict()` decides
38
+ * what the model can see at the next step, and the admission's guard decides
39
+ * what may actually run; a grant widens both, and only up to the ceiling the
40
+ * subrole was configured with. A skill file can therefore ask for anything —
41
+ * the intersection with the role ceiling is what it gets.
42
+ *
43
+ * A restriction may only name tools the scope inherits, so a grant is verified
44
+ * by applying it: a name the registry refuses (agent-local, unregistered) is
45
+ * dropped from the grant instead of breaking the session.
46
+ */
47
+ export declare class QaAgentToolGrants {
48
+ private readonly options;
49
+ private readonly active;
50
+ private readonly tools;
51
+ private disposeRestriction;
52
+ constructor(options: QaAgentToolGrantsOptions);
53
+ /** Whether the model would see this tool right now. */
54
+ effectiveTools(): ReadonlySet<string>;
55
+ /** Grants currently held, newest last; one entry per activated skill. */
56
+ activeGrants(): readonly QaSkillGrant[];
57
+ /**
58
+ * Activate one skill's declared tool requirements.
59
+ *
60
+ * The whole operation is atomic from the caller's point of view: either the
61
+ * grant is recorded and the restriction admits it, or nothing changed and
62
+ * the reason is returned. A strict skill refuses the activation outright; a
63
+ * best-effort one activates and reports what it had to give up.
64
+ * @param skillName - the skill the agent asked to load.
65
+ * @param origin - which activation path asked, for the session record.
66
+ * @returns the outcome, including the model-facing reason on refusal.
67
+ */
68
+ activate(skillName: string, origin: QaSkillActivationOrigin): QaSkillActivationOutcome;
69
+ /** Record an audience refusal; no tool state changes. */
70
+ deny(skillName: string, origin: QaSkillActivationOrigin, reason: string): void;
71
+ /** Lift the restriction this instance owns. Safe to call more than once. */
72
+ dispose(): void;
73
+ /**
74
+ * Swap the scoped restriction, newest first.
75
+ *
76
+ * The new mask is installed before the previous one is lifted: restrictions
77
+ * intersect, so lifting first would leave a window in which the agent is
78
+ * unrestricted, and a rejected name would then leave it that way.
79
+ */
80
+ private applyRestriction;
81
+ private restore;
82
+ private commit;
83
+ }
84
+ //# sourceMappingURL=tool-grants.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
2
2
  import type { Context } from "@deepseek-ai/cordis";
3
3
  import type { QaTurnSources } from "./provenance/types.js";
4
- import type { QaAccountProfileInput, QaAccountSession, QaAccountStartersInput, QaAccountUserPublic, QaApprovalDecision, QaClaimResult, QaLockdownProof, QaOwnershipEntry, QaPendingApproval, QaPendingQuestion, QaQuestionAnswerItem, QaSurfaceConfig, ResolvedQaSurfaceConfig, QaSkillDocument, QaSkillDraftInput, QaSkillRemoval, QaSkillSummary, QaSkillToolDescriptor, QaSkillValidation, QaSourceFilePreview, QaWhoamiResult, QaPrincipal } from "./types.js";
4
+ import type { QaAccountProfileInput, QaAccountSession, QaAccountStartersInput, QaAccountUserPublic, QaApprovalDecision, QaClaimResult, QaLockdownProof, QaOwnershipEntry, QaPendingApproval, QaPendingQuestion, QaQuestionAnswerItem, QaSurfaceConfig, ResolvedQaSurfaceConfig, QaSkillDocument, QaSkillDraftInput, QaSkillRemoval, QaSkillSummary, QaSkillToolDescriptor, QaSkillValidation, QaSourceFilePreview, QaWhoamiResult, QaPrincipal, QaAccessAdminSnapshot, QaAdminAuditEvent, QaAdminOverview, QaAdminPage, QaAdminUserDetail, QaAdminUserRow, QaAdminUserUpdate, QaAuditQuery, QaCapabilitySelection, QaConversationDetail, QaConversationQuery, QaConversationReview, QaConversationReviewInput, QaConversationSummary, QaCurrentAccess, QaFeedbackQuery, QaFeedbackRow, QaMessageFeedback, QaMessageFeedbackInput, QaQualityMetrics, QaReviewQueueItem, QaReviewQueueRow, QaSessionAccess, QaSkillActivationRecord, QaSkillAssignmentOverride, QaSubrole, QaUserAccess, QaUserQuery } from "./types.js";
5
5
  export declare const name = "qa-surface";
6
6
  export declare const inject: string[];
7
7
  import { QA_SURFACE_SETTINGS_NAMESPACE } from "./shared/settings.js";
@@ -27,6 +27,13 @@ export declare class QaSurface extends TypertRemoteService {
27
27
  private readonly tools;
28
28
  /** Account-remote bodies; the wire signatures stay on this class. */
29
29
  private readonly accountRemotes;
30
+ /** Roles, assignments, discovery and immutable per-session capability sets. */
31
+ private readonly access;
32
+ /**
33
+ * The administrative console: authorization, conversation queries over
34
+ * stored logs, quality records and their aggregations.
35
+ */
36
+ private readonly admin;
30
37
  /** Personal skills: storage, the DSH provider and the manual-edit watcher. */
31
38
  private readonly personalSkills;
32
39
  /** Personal-skill remote bodies; the wire signatures stay on this class. */
@@ -38,13 +45,13 @@ export declare class QaSurface extends TypertRemoteService {
38
45
  private disposeRoute;
39
46
  private routeKey;
40
47
  /**
41
- * The document subsystem: its own runtime and the four tool registrations.
42
- * Rebuilt when the document configuration changes and torn down while the
43
- * subsystem or the whole surface is disabled.
48
+ * The quality store opens its file on first use, so a deployment that never
49
+ * opens the admin console never grows one.
44
50
  */
45
- private documents;
46
- private documentsKey;
51
+ private qualityStore;
47
52
  constructor(ctx: Context, entry?: QaSurfaceConfig);
53
+ /** The quality store, opening its file the first time anyone needs it. */
54
+ private quality;
48
55
  /** Resolve browser authentication to the caller only; never accepts an id. */
49
56
  principalForToken(token: string): QaPrincipal | undefined;
50
57
  /** Resolve only a directly QA-owned root session; delegated children fail closed. */
@@ -101,7 +108,45 @@ export declare class QaSurface extends TypertRemoteService {
101
108
  * cwd is `<configured workspace>/.qa-users/<account UUID>` and the child is
102
109
  * intentionally not registered or attached as another DSH workspace.
103
110
  */
104
- createSession(token: string): Promise<string>;
111
+ createSession(token: string, subroleId: string | null, adminPreview: boolean): Promise<string>;
112
+ /** The selector model for the signed-in user; admin grants are irrelevant. */
113
+ accessCurrent(token: string): QaCurrentAccess;
114
+ /** The immutable role pinned to an existing session. */
115
+ accessSession(token: string, sessionId: string): QaSessionAccess;
116
+ /** Complete administrator projection; authorization is checked before discovery. */
117
+ accessAdminSnapshot(token: string): Promise<QaAccessAdminSnapshot>;
118
+ accessCreateSubrole(token: string, input: QaSubrole): QaSubrole;
119
+ accessUpdateSubrole(token: string, id: string, input: QaSubrole): QaSubrole;
120
+ accessDeleteSubrole(token: string, id: string, replacementId: string | null): {
121
+ readonly deleted: boolean;
122
+ };
123
+ accessUpdateCommon(token: string, input: QaCapabilitySelection): QaCapabilitySelection;
124
+ accessUpdateAssignment(token: string, userId: string, input: QaUserAccess): QaUserAccess;
125
+ /** Layer one administrator assignment over what a SKILL.md declares. */
126
+ accessUpdateSkillOverride(token: string, input: QaSkillAssignmentOverride): readonly QaSkillAssignmentOverride[];
127
+ /** What each skill activation actually granted in this session. */
128
+ accessSkillActivations(token: string, sessionId: string): readonly QaSkillActivationRecord[];
129
+ /** Counters, attention lines and the newest quality signals. */
130
+ adminOverview(token: string): Promise<QaAdminOverview>;
131
+ adminUsers(token: string, query: QaUserQuery, cursor: string | null, limit: number | null): Promise<QaAdminPage<QaAdminUserRow>>;
132
+ adminUser(token: string, userId: string): Promise<QaAdminUserDetail>;
133
+ /** Authorization role, status and subrole assignment of one account. */
134
+ adminUpdateUser(token: string, userId: string, update: QaAdminUserUpdate): Promise<QaAdminUserDetail>;
135
+ adminConversations(token: string, query: QaConversationQuery, cursor: string | null, limit: number | null): Promise<QaAdminPage<QaConversationSummary>>;
136
+ /** One conversation with its messages, tool calls and review state. */
137
+ adminConversation(token: string, conversationId: string): Promise<QaConversationDetail>;
138
+ adminFeedback(token: string, query: QaFeedbackQuery, cursor: string | null, limit: number | null): Promise<QaAdminPage<QaFeedbackRow>>;
139
+ /**
140
+ * Rate one of the caller's own assistant messages. The token names the only
141
+ * ratable conversation, exactly as the self-service profile write does.
142
+ */
143
+ adminRateMessage(token: string, conversationId: string, messageId: string, input: QaMessageFeedbackInput): QaMessageFeedback;
144
+ adminReviewQueue(token: string, cursor: string | null, limit: number | null): Promise<QaAdminPage<QaReviewQueueRow>>;
145
+ /** Park a conversation for review without rating it. */
146
+ adminQueueConversation(token: string, conversationId: string, messageId: string | null): QaReviewQueueItem;
147
+ adminSaveReview(token: string, input: QaConversationReviewInput): QaConversationReview;
148
+ adminMetrics(token: string): Promise<QaQualityMetrics>;
149
+ adminAudit(token: string, query: QaAuditQuery, cursor: string | null, limit: number | null): Promise<QaAdminPage<QaAdminAuditEvent>>;
105
150
  /** Pin and attest the effective policy. The browser supplies identity only. */
106
151
  secureSession(token: string, sessionId: string): Promise<QaLockdownProof>;
107
152
  /** Return canonical Host snapshots from plugin-owned durable provenance. */
@@ -169,13 +214,12 @@ export declare class QaSurface extends TypertRemoteService {
169
214
  };
170
215
  private refreshRoute;
171
216
  /**
172
- * Install, rebuild or tear down the document subsystem. The raw entry is
173
- * resolved with the documented environment overrides applied, so a
174
- * deployment can point `QA_DOCLING_BASE_URL` at its own service without
175
- * touching the settings namespace; the settings layer stays authoritative
176
- * for everything it declares.
217
+ * The document pipeline moved out of this plugin into `@yadsh/dsh-documents`.
218
+ * A deployment whose profile still carries the old `documents` section would
219
+ * otherwise lose its Docling endpoint and artifact root silently, so the
220
+ * leftover section is reported once per configuration change instead.
177
221
  */
178
- private refreshDocuments;
222
+ private warnDocumentsMoved;
179
223
  }
180
224
  export { ConfigSchema, DEFAULT_QA_SURFACE_CONFIG, normalizeRoutePath, resolveConfig, } from "./config.js";
181
225
  export { QaAttestationError } from "./attestation.js";
@@ -185,8 +229,12 @@ export { entryRedirectRow, entryRedirectScript } from "./entry-redirect.js";
185
229
  export { registerQaNavigationRoute } from "./host-route.js";
186
230
  export { QaIntegrationPrincipalBindings } from "./integration-principals.js";
187
231
  export { qaToolDenial, qaToolPolicyPlan } from "./lockdown-policy.js";
188
- export * from "./documents/index.js";
189
232
  export { QaPolicyAdmission } from "./secure-session.js";
233
+ export { QaAccessService } from "./access/service.js";
234
+ export { QaRoleRepository } from "./access/role-repository.js";
235
+ export { QaAgentToolGrants } from "./enforcement/tool-grants.js";
236
+ export { defaultCapabilityConfig, normalizeCapabilityConfig, normalizeUserAccess, resolveCapabilityPolicy, resolveSkillAccess, } from "./access/model.js";
237
+ export { parseQaSkillMetadata, resolveSkillVisibility, } from "./access/skill-metadata.js";
190
238
  export { QaPromptNotes, renderUserIdentity, QA_IDENTITY_NOTE, QA_SOURCES_NOTE, } from "./prompt-notes.js";
191
239
  export * from "./provenance/index.js";
192
240
  export type * from "./types.js";
@@ -28,6 +28,8 @@ export declare class QaTools implements QaToolActivation {
28
28
  constructor(ctx: Context, options: QaToolsOptions);
29
29
  /** Names currently registered on one agent; the admission guard reads this per call. */
30
30
  activeToolNames(agent: Agent): readonly string[];
31
+ /** Shipped scope-local names, including entries not activated on an agent yet. */
32
+ catalogToolNames(): readonly string[];
31
33
  dispose(): void;
32
34
  /**
33
35
  * The preset gate. An empty `activationPresets` leaves it open, which is only
@@ -1,6 +1,7 @@
1
1
  import type { Agent } from "@deepseek-ai/dsh-agent";
2
2
  import type { Context } from "@deepseek-ai/cordis";
3
3
  import type { PluginLogger } from "@yadsh/dsh-plugin-log";
4
+ import type { QaResolvedSessionPolicy } from "./access/service.js";
4
5
  import type { QaLockdownProof, ResolvedQaSurfaceConfig } from "./types.js";
5
6
  /**
6
7
  * The accounts half of admission, resolved per call by the entry (accounts
@@ -32,6 +33,10 @@ export declare class QaPolicyAdmission {
32
33
  * it is registered and stops being callable once the agent is disposed.
33
34
  */
34
35
  private readonly dynamicToolNames;
36
+ /** Resolve and freeze the session's subrole policy after its agent exists. */
37
+ private readonly capabilityPolicy?;
38
+ /** Scope-local catalog entries may be known before they are activated. */
39
+ private readonly knownDynamicToolNames;
35
40
  private readonly appliedPolicies;
36
41
  /** Host-trusted principal-scoped plugin tools enabled outside static config. */
37
42
  private readonly principalScopedTools;
@@ -49,7 +54,11 @@ export declare class QaPolicyAdmission {
49
54
  * skill loaded. Read per execution, so a tool becomes callable exactly when
50
55
  * it is registered and stops being callable once the agent is disposed.
51
56
  */
52
- dynamicToolNames?: (agent: Agent) => readonly string[]);
57
+ dynamicToolNames?: (agent: Agent) => readonly string[],
58
+ /** Resolve and freeze the session's subrole policy after its agent exists. */
59
+ capabilityPolicy?: ((token: string, sessionId: string, agent: Agent) => Promise<QaResolvedSessionPolicy | undefined>) | undefined,
60
+ /** Scope-local catalog entries may be known before they are activated. */
61
+ knownDynamicToolNames?: () => readonly string[]);
53
62
  /**
54
63
  * Add tools whose own executor resolves the QA principal server-side.
55
64
  * Enabling the contributing plugin is the operator decision; model arguments