@yadsh/dsh-qa-integrations 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +617 -0
  3. package/compatibility.json +10 -0
  4. package/cordis.patch.yml +5 -0
  5. package/lib/broker.js +239 -0
  6. package/lib/broker.js.map +1 -0
  7. package/lib/client/bitrix24.js +33 -0
  8. package/lib/client/bitrix24.js.map +1 -0
  9. package/lib/client/card.js +33 -0
  10. package/lib/client/card.js.map +1 -0
  11. package/lib/client/confluence.js +148 -0
  12. package/lib/client/confluence.js.map +1 -0
  13. package/lib/client/copy.js +18 -0
  14. package/lib/client/copy.js.map +1 -0
  15. package/lib/client/gitlab.js +64 -0
  16. package/lib/client/gitlab.js.map +1 -0
  17. package/lib/client/index.js +71 -0
  18. package/lib/client/index.js.map +1 -0
  19. package/lib/client/integrations.js +34 -0
  20. package/lib/client/integrations.js.map +1 -0
  21. package/lib/client/jira.js +150 -0
  22. package/lib/client/jira.js.map +1 -0
  23. package/lib/client/provider-card.js +143 -0
  24. package/lib/client/provider-card.js.map +1 -0
  25. package/lib/client/styles.js +35 -0
  26. package/lib/client/styles.js.map +1 -0
  27. package/lib/client/teamcity.js +55 -0
  28. package/lib/client/teamcity.js.map +1 -0
  29. package/lib/client.js +8069 -0
  30. package/lib/client.js.map +1 -0
  31. package/lib/coerce.js +69 -0
  32. package/lib/coerce.js.map +1 -0
  33. package/lib/config.js +51 -0
  34. package/lib/config.js.map +1 -0
  35. package/lib/errors.js +14 -0
  36. package/lib/errors.js.map +1 -0
  37. package/lib/index.js +510 -0
  38. package/lib/index.js.map +1 -0
  39. package/lib/providers/bitrix24/catalog.js +245 -0
  40. package/lib/providers/bitrix24/catalog.js.map +1 -0
  41. package/lib/providers/bitrix24/config.js +40 -0
  42. package/lib/providers/bitrix24/config.js.map +1 -0
  43. package/lib/providers/bitrix24/index.js +128 -0
  44. package/lib/providers/bitrix24/index.js.map +1 -0
  45. package/lib/providers/bitrix24/operations.js +491 -0
  46. package/lib/providers/bitrix24/operations.js.map +1 -0
  47. package/lib/providers/bitrix24/tools.js +1035 -0
  48. package/lib/providers/bitrix24/tools.js.map +1 -0
  49. package/lib/providers/bitrix24/transport.js +142 -0
  50. package/lib/providers/bitrix24/transport.js.map +1 -0
  51. package/lib/providers/confluence/adf.js +348 -0
  52. package/lib/providers/confluence/adf.js.map +1 -0
  53. package/lib/providers/confluence/catalog.js +135 -0
  54. package/lib/providers/confluence/catalog.js.map +1 -0
  55. package/lib/providers/confluence/config.js +196 -0
  56. package/lib/providers/confluence/config.js.map +1 -0
  57. package/lib/providers/confluence/cql.js +78 -0
  58. package/lib/providers/confluence/cql.js.map +1 -0
  59. package/lib/providers/confluence/index.js +319 -0
  60. package/lib/providers/confluence/index.js.map +1 -0
  61. package/lib/providers/confluence/operations.js +653 -0
  62. package/lib/providers/confluence/operations.js.map +1 -0
  63. package/lib/providers/confluence/tools.js +282 -0
  64. package/lib/providers/confluence/tools.js.map +1 -0
  65. package/lib/providers/confluence/transport.js +247 -0
  66. package/lib/providers/confluence/transport.js.map +1 -0
  67. package/lib/providers/contract.js +2 -0
  68. package/lib/providers/contract.js.map +1 -0
  69. package/lib/providers/gitlab/catalog.js +171 -0
  70. package/lib/providers/gitlab/catalog.js.map +1 -0
  71. package/lib/providers/gitlab/config.js +141 -0
  72. package/lib/providers/gitlab/config.js.map +1 -0
  73. package/lib/providers/gitlab/index.js +227 -0
  74. package/lib/providers/gitlab/index.js.map +1 -0
  75. package/lib/providers/gitlab/operations.js +794 -0
  76. package/lib/providers/gitlab/operations.js.map +1 -0
  77. package/lib/providers/gitlab/tools.js +859 -0
  78. package/lib/providers/gitlab/tools.js.map +1 -0
  79. package/lib/providers/gitlab/transport.js +140 -0
  80. package/lib/providers/gitlab/transport.js.map +1 -0
  81. package/lib/providers/jira/adf.js +235 -0
  82. package/lib/providers/jira/adf.js.map +1 -0
  83. package/lib/providers/jira/catalog.js +145 -0
  84. package/lib/providers/jira/catalog.js.map +1 -0
  85. package/lib/providers/jira/config.js +198 -0
  86. package/lib/providers/jira/config.js.map +1 -0
  87. package/lib/providers/jira/index.js +301 -0
  88. package/lib/providers/jira/index.js.map +1 -0
  89. package/lib/providers/jira/jql.js +299 -0
  90. package/lib/providers/jira/jql.js.map +1 -0
  91. package/lib/providers/jira/operations.js +617 -0
  92. package/lib/providers/jira/operations.js.map +1 -0
  93. package/lib/providers/jira/tools.js +341 -0
  94. package/lib/providers/jira/tools.js.map +1 -0
  95. package/lib/providers/jira/transport.js +227 -0
  96. package/lib/providers/jira/transport.js.map +1 -0
  97. package/lib/providers/registry.js +21 -0
  98. package/lib/providers/registry.js.map +1 -0
  99. package/lib/providers/shared/account.js +20 -0
  100. package/lib/providers/shared/account.js.map +1 -0
  101. package/lib/providers/shared/host.js +15 -0
  102. package/lib/providers/shared/host.js.map +1 -0
  103. package/lib/providers/shared/http.js +148 -0
  104. package/lib/providers/shared/http.js.map +1 -0
  105. package/lib/providers/teamcity/artifacts.js +155 -0
  106. package/lib/providers/teamcity/artifacts.js.map +1 -0
  107. package/lib/providers/teamcity/catalog.js +155 -0
  108. package/lib/providers/teamcity/catalog.js.map +1 -0
  109. package/lib/providers/teamcity/config.js +262 -0
  110. package/lib/providers/teamcity/config.js.map +1 -0
  111. package/lib/providers/teamcity/index.js +228 -0
  112. package/lib/providers/teamcity/index.js.map +1 -0
  113. package/lib/providers/teamcity/locators.js +95 -0
  114. package/lib/providers/teamcity/locators.js.map +1 -0
  115. package/lib/providers/teamcity/logs.js +113 -0
  116. package/lib/providers/teamcity/logs.js.map +1 -0
  117. package/lib/providers/teamcity/network.js +160 -0
  118. package/lib/providers/teamcity/network.js.map +1 -0
  119. package/lib/providers/teamcity/operations.js +625 -0
  120. package/lib/providers/teamcity/operations.js.map +1 -0
  121. package/lib/providers/teamcity/tools.js +480 -0
  122. package/lib/providers/teamcity/tools.js.map +1 -0
  123. package/lib/providers/teamcity/transport.js +126 -0
  124. package/lib/providers/teamcity/transport.js.map +1 -0
  125. package/lib/redaction.js +38 -0
  126. package/lib/redaction.js.map +1 -0
  127. package/lib/repository.js +414 -0
  128. package/lib/repository.js.map +1 -0
  129. package/lib/secrets/key-provider.js +76 -0
  130. package/lib/secrets/key-provider.js.map +1 -0
  131. package/lib/secrets/secret-store.js +93 -0
  132. package/lib/secrets/secret-store.js.map +1 -0
  133. package/lib/shared/settings.js +19 -0
  134. package/lib/shared/settings.js.map +1 -0
  135. package/lib/tool-kit.js +55 -0
  136. package/lib/tool-kit.js.map +1 -0
  137. package/lib/tools.js +28 -0
  138. package/lib/tools.js.map +1 -0
  139. package/lib/typert.host.d.ts +3 -0
  140. package/lib/typert.host.js +1689 -0
  141. package/lib/typert.remote-client.d.ts +84 -0
  142. package/lib/typert.remote-client.js +1429 -0
  143. package/lib/types/broker.d.ts +30 -0
  144. package/lib/types/client/bitrix24.d.ts +18 -0
  145. package/lib/types/client/card.d.ts +13 -0
  146. package/lib/types/client/confluence.d.ts +17 -0
  147. package/lib/types/client/copy.d.ts +7 -0
  148. package/lib/types/client/gitlab.d.ts +15 -0
  149. package/lib/types/client/index.d.ts +13 -0
  150. package/lib/types/client/integrations.d.ts +28 -0
  151. package/lib/types/client/jira.d.ts +17 -0
  152. package/lib/types/client/provider-card.d.ts +63 -0
  153. package/lib/types/client/styles.d.ts +7 -0
  154. package/lib/types/client/teamcity.d.ts +19 -0
  155. package/lib/types/coerce.d.ts +18 -0
  156. package/lib/types/config.d.ts +48 -0
  157. package/lib/types/errors.d.ts +26 -0
  158. package/lib/types/index.d.ts +170 -0
  159. package/lib/types/providers/bitrix24/catalog.d.ts +48 -0
  160. package/lib/types/providers/bitrix24/config.d.ts +43 -0
  161. package/lib/types/providers/bitrix24/index.d.ts +31 -0
  162. package/lib/types/providers/bitrix24/operations.d.ts +13 -0
  163. package/lib/types/providers/bitrix24/tools.d.ts +9 -0
  164. package/lib/types/providers/bitrix24/transport.d.ts +26 -0
  165. package/lib/types/providers/confluence/adf.d.ts +22 -0
  166. package/lib/types/providers/confluence/catalog.d.ts +59 -0
  167. package/lib/types/providers/confluence/config.d.ts +68 -0
  168. package/lib/types/providers/confluence/cql.d.ts +43 -0
  169. package/lib/types/providers/confluence/index.d.ts +73 -0
  170. package/lib/types/providers/confluence/operations.d.ts +92 -0
  171. package/lib/types/providers/confluence/tools.d.ts +15 -0
  172. package/lib/types/providers/confluence/transport.d.ts +77 -0
  173. package/lib/types/providers/contract.d.ts +33 -0
  174. package/lib/types/providers/gitlab/catalog.d.ts +49 -0
  175. package/lib/types/providers/gitlab/config.d.ts +50 -0
  176. package/lib/types/providers/gitlab/index.d.ts +49 -0
  177. package/lib/types/providers/gitlab/operations.d.ts +40 -0
  178. package/lib/types/providers/gitlab/tools.d.ts +15 -0
  179. package/lib/types/providers/gitlab/transport.d.ts +52 -0
  180. package/lib/types/providers/jira/adf.d.ts +27 -0
  181. package/lib/types/providers/jira/catalog.d.ts +74 -0
  182. package/lib/types/providers/jira/config.d.ts +73 -0
  183. package/lib/types/providers/jira/index.d.ts +79 -0
  184. package/lib/types/providers/jira/jql.d.ts +51 -0
  185. package/lib/types/providers/jira/operations.d.ts +58 -0
  186. package/lib/types/providers/jira/tools.d.ts +17 -0
  187. package/lib/types/providers/jira/transport.d.ts +65 -0
  188. package/lib/types/providers/registry.d.ts +9 -0
  189. package/lib/types/providers/shared/account.d.ts +10 -0
  190. package/lib/types/providers/shared/host.d.ts +9 -0
  191. package/lib/types/providers/shared/http.d.ts +51 -0
  192. package/lib/types/providers/teamcity/artifacts.d.ts +45 -0
  193. package/lib/types/providers/teamcity/catalog.d.ts +55 -0
  194. package/lib/types/providers/teamcity/config.d.ts +66 -0
  195. package/lib/types/providers/teamcity/index.d.ts +62 -0
  196. package/lib/types/providers/teamcity/locators.d.ts +47 -0
  197. package/lib/types/providers/teamcity/logs.d.ts +31 -0
  198. package/lib/types/providers/teamcity/network.d.ts +32 -0
  199. package/lib/types/providers/teamcity/operations.d.ts +84 -0
  200. package/lib/types/providers/teamcity/tools.d.ts +15 -0
  201. package/lib/types/providers/teamcity/transport.d.ts +53 -0
  202. package/lib/types/redaction.d.ts +3 -0
  203. package/lib/types/repository.d.ts +48 -0
  204. package/lib/types/secrets/key-provider.d.ts +30 -0
  205. package/lib/types/secrets/secret-store.d.ts +12 -0
  206. package/lib/types/shared/settings.d.ts +19 -0
  207. package/lib/types/tool-kit.d.ts +26 -0
  208. package/lib/types/tools.d.ts +16 -0
  209. package/lib/types/types.d.ts +138 -0
  210. package/lib/types.js +2 -0
  211. package/lib/types.js.map +1 -0
  212. package/package.json +143 -0
@@ -0,0 +1,48 @@
1
+ import type { EncryptedSecretRecord, IntegrationAuditEntry, IntegrationCapability, IntegrationFile, IntegrationPolicyMode, IntegrationPrincipal, IntegrationProviderId, StoredIntegration } from "./types.js";
2
+ /**
3
+ * Durable plugin-owned store, as tables. Every lookup starts from principal +
4
+ * provider, which is the pair the unique index covers, so a lookup reads the
5
+ * one row it needs instead of parsing the whole store — including the audit
6
+ * log, which was inside the same document as the connections.
7
+ *
8
+ * The audit trail is the part that grows with usage, so it is bounded twice
9
+ * over: a hard row count, and an age bound the operator can set. Rows are
10
+ * deleted as a set on the next write rather than rewritten per row.
11
+ */
12
+ export declare class IntegrationRepository {
13
+ private readonly storage;
14
+ private readonly auditRetentionDays;
15
+ constructor(filePath: string, options?: {
16
+ readonly auditRetentionDays?: number;
17
+ });
18
+ close(): void;
19
+ /** The whole store, for maintenance surfaces that need the aggregate. */
20
+ read(): IntegrationFile;
21
+ find(principal: IntegrationPrincipal, provider: IntegrationProviderId): StoredIntegration | undefined;
22
+ secretFor(principal: IntegrationPrincipal, provider: IntegrationProviderId): EncryptedSecretRecord | undefined;
23
+ policy(integration: StoredIntegration, operation: IntegrationCapability): IntegrationPolicyMode;
24
+ connect(options: {
25
+ principal: IntegrationPrincipal;
26
+ provider: IntegrationProviderId;
27
+ secret: EncryptedSecretRecord;
28
+ tenantId: string;
29
+ externalUserId: string;
30
+ displayName: string;
31
+ capabilities: readonly IntegrationCapability[];
32
+ }): StoredIntegration;
33
+ updateValidation(principal: IntegrationPrincipal, provider: IntegrationProviderId, success: boolean, errorCode: string | null, capabilities?: readonly IntegrationCapability[]): void;
34
+ setPolicy(principal: IntegrationPrincipal, provider: IntegrationProviderId, operation: IntegrationCapability, mode: IntegrationPolicyMode): void;
35
+ disconnect(principal: IntegrationPrincipal, provider: IntegrationProviderId): boolean;
36
+ audit(entry: Omit<IntegrationAuditEntry, "id" | "createdAt">): void;
37
+ /**
38
+ * Import a pre-SQLite `qa-integrations.json` exactly once, then rename it
39
+ * aside. A database that already holds a connection is never overwritten by
40
+ * a leftover file: the operator's live credential wins.
41
+ */
42
+ importLegacyFile(legacyFilePath: string | undefined): void;
43
+ private assertImportArrived;
44
+ private writeSecret;
45
+ /** Keep the newest rows, then the youngest ones. */
46
+ private applyAuditRetention;
47
+ }
48
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1,30 @@
1
+ export interface WrappedKey {
2
+ readonly ciphertext: Uint8Array;
3
+ readonly nonce: Uint8Array;
4
+ readonly authTag: Uint8Array;
5
+ readonly keyVersion: number;
6
+ }
7
+ export interface KeyProvider {
8
+ readonly currentVersion: number;
9
+ wrapKey(rawDek: Uint8Array): Promise<WrappedKey>;
10
+ unwrapKey(wrapped: WrappedKey): Promise<Uint8Array>;
11
+ }
12
+ /** MVP key provider: a 256-bit key read from a Docker secret file. */
13
+ export declare class DockerSecretKeyProvider implements KeyProvider {
14
+ private readonly filePath;
15
+ readonly currentVersion: number;
16
+ private key;
17
+ constructor(filePath: string, currentVersion: number);
18
+ wrapKey(rawDek: Uint8Array): Promise<WrappedKey>;
19
+ unwrapKey(wrapped: WrappedKey): Promise<Uint8Array>;
20
+ private load;
21
+ }
22
+ /** Multi-version test/rotation provider; production KMS adapters follow this seam. */
23
+ export declare class MemoryKeyProvider implements KeyProvider {
24
+ readonly currentVersion: number;
25
+ private readonly keys;
26
+ constructor(keys: ReadonlyMap<number, Uint8Array>, currentVersion: number);
27
+ wrapKey(rawDek: Uint8Array): Promise<WrappedKey>;
28
+ unwrapKey(wrapped: WrappedKey): Promise<Uint8Array>;
29
+ }
30
+ //# sourceMappingURL=key-provider.d.ts.map
@@ -0,0 +1,12 @@
1
+ import type { EncryptedSecretRecord, IntegrationAuthKind } from "../types.js";
2
+ import type { KeyProvider } from "./key-provider.js";
3
+ /** Envelope-encrypted, AEAD-authenticated secret codec. */
4
+ export declare class SecretStore {
5
+ private readonly keys;
6
+ constructor(keys: KeyProvider);
7
+ encrypt(plaintext: string, secretType: IntegrationAuthKind, expiresAt?: string | null): Promise<EncryptedSecretRecord>;
8
+ decrypt(record: EncryptedSecretRecord): Promise<string>;
9
+ /** Rewrap only the DEK; provider ciphertext never needs plaintext re-encryption. */
10
+ rewrap(record: EncryptedSecretRecord): Promise<EncryptedSecretRecord>;
11
+ }
12
+ //# sourceMappingURL=secret-store.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The one place that names the settings namespace. The Host serves the section
3
+ * and the browser card keys on it, so both halves must agree without importing
4
+ * each other (the host entry pulls Node code into the bundle, the card pulls
5
+ * DOM code into the Host).
6
+ * @module shared/settings
7
+ */
8
+ /**
9
+ * Settings namespace of the Integrations card.
10
+ *
11
+ * The Plugins tab dispatches a card by the namespace its Host serves, so the
12
+ * deployment mounts this section to give the browser half a key. It carries no
13
+ * editable value on purpose: the provider switches, the address policy and the
14
+ * vault path are composition-time decisions (`cordis.patch.yml`) that the
15
+ * runtime resolves once at boot, and a settings field the runtime only honored
16
+ * after a restart would read as a save that applied.
17
+ */
18
+ export declare const QA_INTEGRATIONS_SETTINGS_NAMESPACE = "qa-integrations";
19
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1,26 @@
1
+ import { type ParameterSchemaSpec, type ToolDefinition, type ToolRunContext } from "@deepseek-ai/dsh-tools";
2
+ import type { IntegrationBroker } from "./broker.js";
3
+ import type { IntegrationPrincipal, IntegrationProviderId } from "./types.js";
4
+ type ToolExecution = Pick<ToolRunContext, "agent">;
5
+ export interface ToolKitOptions {
6
+ readonly broker: IntegrationBroker;
7
+ readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
8
+ readonly provider: IntegrationProviderId;
9
+ }
10
+ /**
11
+ * Shared plumbing for provider tool modules. It owns the one security-relevant
12
+ * step every tool repeats: resolve the QA principal from the DSH session, never
13
+ * from the arguments, and refuse when the session is not bound to a QA user.
14
+ */
15
+ export declare function createToolKit(options: ToolKitOptions): {
16
+ tool: <const S extends ParameterSchemaSpec>(definition: {
17
+ readonly name: string;
18
+ readonly description: string;
19
+ readonly parameters: S;
20
+ readonly operation: string;
21
+ readonly input: (args: Record<string, unknown>) => Record<string, unknown>;
22
+ }) => ToolDefinition;
23
+ run: (exec: ToolExecution, operation: string, input: Readonly<Record<string, unknown>>) => Promise<import("./types.js").IntegrationToolResult>;
24
+ };
25
+ export {};
26
+ //# sourceMappingURL=tool-kit.d.ts.map
@@ -0,0 +1,16 @@
1
+ import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
2
+ import type { IntegrationBroker } from "./broker.js";
3
+ import type { IntegrationPrincipal } from "./types.js";
4
+ export interface IntegrationToolOptions {
5
+ readonly broker: IntegrationBroker;
6
+ readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
7
+ }
8
+ /**
9
+ * Model-facing tool names of every enabled provider, in registration order. The
10
+ * QA surface admits exactly these names as principal-scoped, so this list is the
11
+ * single place where the tool surface is declared.
12
+ */
13
+ export declare const INTEGRATION_TOOL_NAMES: readonly ["bitrix_search_crm", "bitrix_get_crm_item", "bitrix_get_crm_fields", "bitrix_get_crm_funnels", "bitrix_get_crm_statuses", "bitrix_get_crm_activities", "bitrix_get_crm_activity", "bitrix_get_crm_timeline", "bitrix_get_crm_stage_history", "bitrix_get_crm_product_rows", "bitrix_find_crm_duplicates", "bitrix_get_crm_requisites", "bitrix_get_call_transcript", "bitrix_get_current_user", "bitrix_search_users", "bitrix_get_departments", "bitrix_get_user_fields", "bitrix_search_chats", "bitrix_get_chat_messages", "bitrix_search_chat_messages", "bitrix_get_recent_chats", "bitrix_search_chat_users", "bitrix_find_chat", "bitrix_get_chat_participants", "bitrix_get_chat_user_data", "bitrix_get_openline_dialog", "bitrix_get_openline_history", "bitrix_search_tasks", "bitrix_get_task", "bitrix_get_task_history", "bitrix_get_task_results", "bitrix_get_task_elapsed_time", "bitrix_get_calendar_events", "bitrix_get_calendar_accessibility", "bitrix_search_files", "bitrix_get_file", "bitrix_get_drives", "bitrix_get_storage_items", "bitrix_get_folder_items", "confluence_connection_get", "confluence_search", "confluence_get_page", "confluence_get_page_comments", "confluence_get_page_attachments", "confluence_get_page_versions", "confluence_get_space", "confluence_list_spaces", "gitlab_connection_get", "gitlab_projects_list", "gitlab_project_get", "gitlab_repository_tree", "gitlab_repository_file_get", "gitlab_commits_list", "gitlab_commit_get", "gitlab_compare", "gitlab_search", "gitlab_issues_list", "gitlab_issue_get", "gitlab_issue_notes_list", "gitlab_merge_requests_list", "gitlab_merge_request_get", "gitlab_merge_request_changes_get", "gitlab_merge_request_discussions_list", "gitlab_merge_request_approvals_get", "gitlab_merge_request_pipelines_list", "gitlab_pipelines_list", "gitlab_pipeline_get", "gitlab_pipeline_jobs_list", "gitlab_job_get", "gitlab_job_log_get", "teamcity_connection_get", "teamcity_projects", "teamcity_build_configs", "teamcity_builds", "teamcity_build", "teamcity_build_changes", "teamcity_build_failures", "teamcity_build_log", "teamcity_queue", "teamcity_investigations", "teamcity_agents", "teamcity_artifacts", "teamcity_artifact_text", "jira_get_current_user", "jira_search_issues", "jira_get_issue", "jira_get_issue_comments", "jira_get_issue_attachments", "jira_get_available_transitions", "jira_get_project", "jira_get_fields"];
14
+ /** Provider tool modules, composed into one registration list. */
15
+ export declare function createIntegrationTools(options: IntegrationToolOptions): readonly ToolDefinition[];
16
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1,138 @@
1
+ export type IntegrationProviderId = string;
2
+ export type IntegrationAuthKind = "token" | "oauth" | "mcp_token";
3
+ export type IntegrationStatus = "pending" | "connected" | "error" | "revoked";
4
+ export type IntegrationPolicyMode = "allow" | "confirm" | "deny";
5
+ /**
6
+ * Capability id, free-form on purpose: every provider declares its own set in
7
+ * its own catalog (`providers/<id>/catalog.ts`) and this framework only moves
8
+ * ids around. A capability exists for a user when the deployment enables it AND
9
+ * the connected credential really grants it, so the Settings card never offers
10
+ * the agent more than the external service allows.
11
+ */
12
+ export type IntegrationCapability = string;
13
+ /** How a capability is presented to the user; supplied by its provider. */
14
+ export interface IntegrationCapabilityInfo {
15
+ readonly label: string;
16
+ readonly hint: string;
17
+ }
18
+ /** Effective policy of one granted capability. */
19
+ export interface IntegrationPolicyEntry {
20
+ readonly capability: IntegrationCapability;
21
+ readonly mode: IntegrationPolicyMode;
22
+ }
23
+ export interface IntegrationPrincipal {
24
+ readonly userId: string;
25
+ }
26
+ export interface IntegrationSummary {
27
+ readonly provider: IntegrationProviderId;
28
+ readonly displayName: string;
29
+ readonly status: IntegrationStatus | "not_connected";
30
+ readonly portal: string | null;
31
+ readonly externalAccountName: string | null;
32
+ readonly credentialConfigured: boolean;
33
+ readonly credentialUpdatedAt: string | null;
34
+ readonly capabilities: readonly IntegrationCapability[];
35
+ /**
36
+ * Labels and hints for every capability the provider declares, so a client
37
+ * can render a provider it has never heard of.
38
+ */
39
+ readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
40
+ /**
41
+ * Effective policy of every capability the connected credential grants; a
42
+ * capability outside this list is not granted at all.
43
+ */
44
+ readonly policy: readonly IntegrationPolicyEntry[];
45
+ readonly lastValidatedAt: string | null;
46
+ readonly errorCode: string | null;
47
+ }
48
+ export interface IntegrationProviderSummary {
49
+ readonly id: IntegrationProviderId;
50
+ readonly displayName: string;
51
+ readonly enabled: boolean;
52
+ readonly authModes: readonly IntegrationAuthKind[];
53
+ readonly capabilities: readonly IntegrationCapability[];
54
+ }
55
+ /**
56
+ * One external service instance the operator configured, as shown in the
57
+ * connect form. It carries no secret and no endpoint the user picked: the
58
+ * client offers this list and the host resolves the address from its own config.
59
+ */
60
+ export interface IntegrationInstanceSummary {
61
+ readonly id: string;
62
+ readonly label: string;
63
+ readonly baseUrl: string;
64
+ }
65
+ export interface CredentialInput {
66
+ /** Write-only credential; never appears in a response. */
67
+ readonly token: string;
68
+ /**
69
+ * Non-secret choices made next to the secret in the connect form, such as
70
+ * which configured instance the token belongs to. Operator-facing only.
71
+ */
72
+ readonly options?: Readonly<Record<string, string>>;
73
+ }
74
+ export interface PolicyPatch {
75
+ readonly operation: IntegrationCapability;
76
+ readonly mode: IntegrationPolicyMode;
77
+ }
78
+ export interface StoredIntegration {
79
+ readonly id: string;
80
+ readonly ownerUserId: string;
81
+ readonly provider: IntegrationProviderId;
82
+ readonly authKind: IntegrationAuthKind;
83
+ readonly status: IntegrationStatus;
84
+ readonly externalTenantId: string | null;
85
+ readonly externalUserId: string | null;
86
+ readonly displayName: string | null;
87
+ readonly capabilities: readonly IntegrationCapability[];
88
+ readonly secretRef: string | null;
89
+ readonly createdAt: string;
90
+ readonly updatedAt: string;
91
+ readonly lastValidatedAt: string | null;
92
+ readonly lastErrorCode: string | null;
93
+ }
94
+ export interface EncryptedSecretRecord {
95
+ readonly id: string;
96
+ readonly ciphertext: string;
97
+ readonly nonce: string;
98
+ readonly authTag: string;
99
+ readonly wrappedDek: string;
100
+ readonly wrapNonce: string;
101
+ readonly wrapAuthTag: string;
102
+ readonly keyVersion: number;
103
+ readonly secretType: IntegrationAuthKind;
104
+ readonly expiresAt: string | null;
105
+ readonly createdAt: string;
106
+ readonly updatedAt: string;
107
+ }
108
+ export interface IntegrationAuditEntry {
109
+ readonly id: string;
110
+ readonly ownerUserId: string;
111
+ readonly provider: IntegrationProviderId;
112
+ readonly operation: string;
113
+ readonly result: "success" | "denied" | "error";
114
+ readonly sourceSessionId: string | null;
115
+ readonly createdAt: string;
116
+ }
117
+ export interface IntegrationFile {
118
+ readonly version: 1;
119
+ readonly integrations: readonly StoredIntegration[];
120
+ readonly secrets: Readonly<Record<string, EncryptedSecretRecord>>;
121
+ readonly policies: Readonly<Record<string, IntegrationPolicyMode>>;
122
+ readonly audit: readonly IntegrationAuditEntry[];
123
+ }
124
+ export interface ProviderValidation {
125
+ readonly tenantId: string;
126
+ readonly externalUserId: string;
127
+ readonly displayName: string;
128
+ readonly capabilities: readonly IntegrationCapability[];
129
+ }
130
+ export type IntegrationJsonValue = null | boolean | number | string | IntegrationJsonValue[] | {
131
+ [key: string]: IntegrationJsonValue;
132
+ };
133
+ export interface IntegrationToolResult {
134
+ readonly provider: IntegrationProviderId;
135
+ readonly operation: string;
136
+ readonly data: Record<string, IntegrationJsonValue>;
137
+ }
138
+ //# sourceMappingURL=types.d.ts.map
package/lib/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,143 @@
1
+ {
2
+ "name": "@yadsh/dsh-qa-integrations",
3
+ "version": "0.5.0",
4
+ "description": "Principal-scoped, encrypted user integrations for DSH QA Surface",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/xarleyn/dsh-plugins.git",
8
+ "directory": "plugins/dsh-qa-integrations"
9
+ },
10
+ "homepage": "https://github.com/xarleyn/dsh-plugins/tree/main/plugins/dsh-qa-integrations#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/xarleyn/dsh-plugins/issues"
13
+ },
14
+ "license": "MIT",
15
+ "type": "module",
16
+ "main": "./lib/index.js",
17
+ "types": "./lib/types/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./lib/types/index.d.ts",
21
+ "default": "./lib/index.js"
22
+ },
23
+ "./client": {
24
+ "types": "./lib/types/client/index.d.ts",
25
+ "default": "./lib/client.js"
26
+ },
27
+ "./remote": {
28
+ "types": "./lib/typert.remote-client.d.ts",
29
+ "default": "./lib/typert.remote-client.js"
30
+ },
31
+ "./typert": {
32
+ "types": "./lib/typert.host.d.ts",
33
+ "default": "./lib/typert.host.js"
34
+ },
35
+ "./types": {
36
+ "types": "./lib/types/types.d.ts",
37
+ "default": "./lib/types.js"
38
+ },
39
+ "./package.json": "./package.json"
40
+ },
41
+ "files": [
42
+ "lib/**/*.js",
43
+ "lib/**/*.js.map",
44
+ "lib/**/*.d.ts",
45
+ "cordis.patch.yml",
46
+ "compatibility.json",
47
+ "README.md",
48
+ "LICENSE"
49
+ ],
50
+ "dsh": {
51
+ "bundle": {
52
+ "patch": "./cordis.patch.yml"
53
+ },
54
+ "client": {
55
+ "external": [
56
+ "@deepseek-ai/dsh-client-ui-slots",
57
+ "@yadsh/dsh-qa-surface"
58
+ ],
59
+ "inject": [
60
+ "@deepseek-ai/dsh-api-gateway",
61
+ "@deepseek-ai/dsh-client-ui-settings",
62
+ "@deepseek-ai/dsh-client-ui-settings-plugins",
63
+ "@yadsh/dsh-qa-surface"
64
+ ],
65
+ "platform": "web"
66
+ }
67
+ },
68
+ "keywords": [
69
+ "deepseek",
70
+ "deepseek-harness",
71
+ "dsh",
72
+ "dsh-plugin",
73
+ "cordis",
74
+ "qa",
75
+ "integrations",
76
+ "bitrix24",
77
+ "confluence",
78
+ "gitlab",
79
+ "teamcity",
80
+ "jira",
81
+ "credentials"
82
+ ],
83
+ "engines": {
84
+ "node": ">=22"
85
+ },
86
+ "dependencies": {
87
+ "zod": "^4.4.3",
88
+ "@yadsh/dsh-plugin-log": "^0.4.0",
89
+ "@yadsh/dsh-qa-surface": "^0.8.0",
90
+ "@yadsh/dsh-plugin-kit": "^0.2.0"
91
+ },
92
+ "peerDependencies": {
93
+ "@deepseek-ai/cordis": "^4.0.2",
94
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.2 <0.2.0",
95
+ "@deepseek-ai/dsh-client-ui-settings-plugins": ">=0.1.5-rc.2 <0.2.0",
96
+ "@deepseek-ai/dsh-settings": ">=0.1.5-rc.2 <0.2.0",
97
+ "@deepseek-ai/dsh-tools": ">=0.1.5-rc.2 <0.2.0",
98
+ "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.2 <0.2.0",
99
+ "@deepseek-ai/schemastery": "^3.18.2",
100
+ "react": "^18.2.0"
101
+ },
102
+ "devDependencies": {
103
+ "@deepseek-ai/cordis": "4.0.2",
104
+ "@deepseek-ai/dsh-api-gateway": "0.1.5-rc.2",
105
+ "@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.2",
106
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2",
107
+ "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.5-rc.2",
108
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.2",
109
+ "@deepseek-ai/dsh-settings": "0.1.5-rc.2",
110
+ "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
111
+ "@deepseek-ai/dsh-typert-generator": "0.1.5-rc.2",
112
+ "@deepseek-ai/dsh-typert-protocol": "0.1.5-rc.2",
113
+ "@deepseek-ai/schemastery": "3.18.2",
114
+ "@testing-library/react": "^16.3.0",
115
+ "@types/node": "^26.4.0",
116
+ "@types/react": "18.3.28",
117
+ "@types/react-dom": "18.3.7",
118
+ "eslint": "10.9.1",
119
+ "jsdom": "^26.1.0",
120
+ "react": "18.3.1",
121
+ "react-dom": "18.3.1",
122
+ "tsdown": "^0.22.14",
123
+ "typescript": "^7.0.2",
124
+ "vitest": "^4.1.11",
125
+ "@yadsh/dsh-plugin-scripts": "^0.0.0",
126
+ "@yadsh/dsh-test-kit": "^0.1.0",
127
+ "@yadsh/dsh-config": "^0.0.0"
128
+ },
129
+ "publishConfig": {
130
+ "access": "public",
131
+ "registry": "https://registry.npmjs.org/"
132
+ },
133
+ "scripts": {
134
+ "clean": "node -e \"require('node:fs').rmSync('lib', { recursive: true, force: true })\"",
135
+ "build": "pnpm run clean && node scripts/generate-typert.mjs && tsc -p tsconfig.build.json && tsdown",
136
+ "lint": "eslint src tests scripts tsdown.config.ts",
137
+ "typecheck": "tsc -p tsconfig.json --noEmit",
138
+ "test": "vitest run",
139
+ "verify:package": "node scripts/verify-package.mjs",
140
+ "verify": "pnpm run verify:package",
141
+ "check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && pnpm run verify"
142
+ }
143
+ }