@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,50 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ /**
3
+ * One GitLab deployment the operator allows. A user never types a host: the
4
+ * connect form only picks from this list, so the broker cannot be pointed at an
5
+ * arbitrary origin (the specification's SSRF rule).
6
+ */
7
+ export interface GitlabInstance {
8
+ readonly id: string;
9
+ readonly label: string;
10
+ /** Canonical `<origin><path>`, without a trailing slash. */
11
+ readonly baseUrl: string;
12
+ }
13
+ /**
14
+ * Deployment switches for the GitLab provider. Every read capability is on by
15
+ * default: a capability reaches the agent only when the connected token was
16
+ * actually granted the matching GitLab scope, so these switches bound what this
17
+ * deployment allows, they do not grant it.
18
+ */
19
+ export interface GitlabFlags {
20
+ readonly enabled: boolean;
21
+ /** Development escape hatch; production instances must answer over HTTPS. */
22
+ readonly allowInsecureHttp: boolean;
23
+ readonly instances: readonly GitlabInstance[];
24
+ readonly identityRead: boolean;
25
+ readonly projectsRead: boolean;
26
+ readonly repositoryRead: boolean;
27
+ readonly searchRead: boolean;
28
+ readonly issuesRead: boolean;
29
+ readonly mergeRequestsRead: boolean;
30
+ readonly ciRead: boolean;
31
+ /** Largest file body handed to the model, in bytes. */
32
+ readonly maxFileBytes: number;
33
+ /** Largest CI job log handed to the model, in bytes. */
34
+ readonly maxJobLogBytes: number;
35
+ /** Result cap for the search operations, which GitLab bounds per page. */
36
+ readonly maxSearchResults: number;
37
+ /** Extra attempts for a rate-limited or transient read; writes never retry. */
38
+ readonly retries: number;
39
+ }
40
+ export declare const GITLAB_DEFAULTS: GitlabFlags;
41
+ /**
42
+ * Config slice of this provider, as it appears under `gitlab:` in YAML. The
43
+ * instance list is validated and canonicalized by `resolveGitlabConfig`, which
44
+ * is where a deployment typo fails loudly.
45
+ */
46
+ export declare const gitlabConfigSchema: z<Partial<GitlabFlags>>;
47
+ export declare function resolveGitlabConfig(input?: Partial<GitlabFlags>): GitlabFlags;
48
+ /** The configured instance a stored credential names, or a fail-closed error. */
49
+ export declare function gitlabInstance(flags: GitlabFlags, instanceId: string): GitlabInstance | undefined;
50
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,49 @@
1
+ import type { ResolvedQaIntegrationsConfig } from "../../config.js";
2
+ import type { IntegrationCapability, IntegrationCapabilityInfo, ProviderValidation } from "../../types.js";
3
+ import type { IntegrationProvider, ProviderContext } from "../contract.js";
4
+ export { credentialFromPlaintext, credentialInstance, type GitlabCredential, } from "./transport.js";
5
+ /** GitLab provider: operator-configured instances over a personal access token. */
6
+ export declare class GitlabProvider implements IntegrationProvider {
7
+ private readonly config;
8
+ readonly id = "gitlab";
9
+ readonly displayName = "GitLab";
10
+ /** What this deployment allows; the token scope probe narrows it per user. */
11
+ readonly capabilities: readonly IntegrationCapability[];
12
+ readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
13
+ private readonly transport;
14
+ constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
15
+ /**
16
+ * Keep only the token, tagged with the instance it was minted for. The
17
+ * instance comes from the connect form and from operator config, never from a
18
+ * tool argument, which is what keeps the broker from dialling any host the
19
+ * caller names.
20
+ */
21
+ parseCredential(raw: string, options?: Readonly<Record<string, string>>): {
22
+ readonly credential: string;
23
+ readonly portal: string;
24
+ };
25
+ operationCapability(operation: string): IntegrationCapability | undefined;
26
+ validate(context: ProviderContext): Promise<ProviderValidation>;
27
+ execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
28
+ /**
29
+ * A file read answers with metadata and content in one call. GitLab returns
30
+ * the body base64-encoded inside that JSON, so a file bigger than the
31
+ * transport cap cannot be parsed at all; the raw endpoint is then read
32
+ * instead, which streams and lets us keep a bounded prefix plus a marker.
33
+ */
34
+ private readFile;
35
+ /**
36
+ * A job log is a stream of text, not JSON. It is bounded and stripped of the
37
+ * secrets a log can carry; GitLab's own masking is a filter, not a promise.
38
+ */
39
+ private readJobLog;
40
+ private resolveInstance;
41
+ /**
42
+ * The scopes the connected token was actually granted, read from GitLab's
43
+ * self-inspection endpoint. A token that cannot read itself only costs
44
+ * precision: the deployment switches still bound what the agent may try.
45
+ */
46
+ private grantedScopes;
47
+ }
48
+ export default GitlabProvider;
49
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,40 @@
1
+ import type { GitlabFlags } from "./config.js";
2
+ import type { GitlabQuery } from "./transport.js";
3
+ /** A project id or path, canonicalized into one URL path segment. */
4
+ export declare function projectRef(value: unknown, field?: string): string;
5
+ export declare function groupRef(value: unknown, field?: string): string;
6
+ export interface OperationContext {
7
+ /**
8
+ * GitLab numeric user id of the token owner, read from the stored
9
+ * integration. Reserved for "mine" defaults that GitLab cannot express with a
10
+ * scope keyword; no operation substitutes it for a model argument.
11
+ */
12
+ readonly externalUserId?: string | undefined;
13
+ readonly flags: GitlabFlags;
14
+ }
15
+ export interface GitlabRequest {
16
+ readonly path: string;
17
+ readonly query: GitlabQuery;
18
+ }
19
+ export type GitlabOperationHandler = (input: Readonly<Record<string, unknown>>, context: OperationContext) => GitlabRequest;
20
+ /**
21
+ * Search scopes the model may name. GitLab spells code search `blobs`; the
22
+ * catalog only allows the scopes it can actually honour, so a request for
23
+ * advanced search degrades into a refusal instead of a broader search.
24
+ */
25
+ export declare const SEARCH_SCOPES: readonly string[];
26
+ export declare const ISSUE_SCOPES: readonly string[];
27
+ export declare const MR_SCOPES: readonly string[];
28
+ export declare const GITLAB_HANDLERS: Readonly<Record<string, GitlabOperationHandler>>;
29
+ export interface GitlabProjectionContext {
30
+ readonly flags: GitlabFlags;
31
+ /** Body budget for the operations that hand a file or a log to the model. */
32
+ readonly byteLimit?: number | undefined;
33
+ }
34
+ export type GitlabProjection = (data: unknown, context: GitlabProjectionContext) => unknown;
35
+ export declare const GITLAB_PROJECTIONS: Readonly<Record<string, GitlabProjection>>;
36
+ /** Byte size of a project's file that this deployment is willing to hand over. */
37
+ export declare function fileByteLimit(requested: unknown, flags: GitlabFlags): number;
38
+ /** Byte size of a job log this deployment is willing to hand over. */
39
+ export declare function jobLogByteLimit(requested: unknown, flags: GitlabFlags): number;
40
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1,15 @@
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 declare const GITLAB_TOOL_NAMES: readonly ["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"];
5
+ /**
6
+ * Every tool reports what the *connected* GitLab account may read, never a
7
+ * caller-supplied identity: the account comes from the stored integration of
8
+ * the QA user who owns the DSH session, and the tool schemas carry no user,
9
+ * credential or instance selector.
10
+ */
11
+ export declare function createGitlabTools(options: {
12
+ readonly broker: IntegrationBroker;
13
+ readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
+ }): readonly ToolDefinition[];
15
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1,52 @@
1
+ import type { ResolvedQaIntegrationsConfig } from "../../config.js";
2
+ import { type BoundedText } from "../shared/http.js";
3
+ import { type GitlabFlags, type GitlabInstance } from "./config.js";
4
+ /**
5
+ * Encrypted credential payload of one GitLab connection: which configured
6
+ * instance the token belongs to, and the token itself. The base URL is not
7
+ * stored — it is re-resolved from operator config on every call, so removing or
8
+ * repointing an instance takes effect at once instead of at the next connect.
9
+ */
10
+ export interface GitlabCredential {
11
+ readonly instanceId: string;
12
+ readonly token: string;
13
+ }
14
+ export declare function credentialFromPlaintext(plaintext: string): GitlabCredential;
15
+ /**
16
+ * The configured instance a credential belongs to. A credential minted for an
17
+ * instance the operator has since removed fails closed: it never falls back to
18
+ * another instance, however permissive that one is.
19
+ */
20
+ export declare function credentialInstance(flags: GitlabFlags, credential: GitlabCredential): GitlabInstance;
21
+ export interface GitlabQuery {
22
+ readonly [key: string]: string | number | boolean | undefined;
23
+ }
24
+ export interface GitlabPage {
25
+ readonly page: number;
26
+ readonly perPage: number;
27
+ readonly nextPage?: number;
28
+ readonly total?: number;
29
+ }
30
+ export interface GitlabJsonResponse<T> {
31
+ readonly data: T;
32
+ readonly page?: GitlabPage;
33
+ }
34
+ export type GitlabTextResponse = BoundedText;
35
+ /**
36
+ * HTTP boundary of the provider: one documented GitLab REST call, bounded in
37
+ * time and size, with upstream failures folded into safe domain errors and
38
+ * bounded retries for the transient ones.
39
+ */
40
+ export declare class GitlabTransport {
41
+ private readonly config;
42
+ private readonly flags;
43
+ private readonly fetcher;
44
+ constructor(config: ResolvedQaIntegrationsConfig, flags: GitlabFlags, fetcher?: typeof fetch);
45
+ getJson<T>(instance: GitlabInstance, token: string, path: string, query?: GitlabQuery): Promise<GitlabJsonResponse<T>>;
46
+ /** Plain-text read: the CI job trace, and anything we never parse as JSON. */
47
+ getText(instance: GitlabInstance, token: string, path: string, query?: GitlabQuery, maxBytes?: number): Promise<GitlabTextResponse>;
48
+ private url;
49
+ private request;
50
+ private failure;
51
+ }
52
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Atlassian Document Format is Jira's rich-text body: descriptions, comments and
3
+ * rich custom fields arrive as a JSON tree of `doc`/`paragraph`/`text` nodes.
4
+ * The model asks for text, not for a tree, so this converter renders the
5
+ * structure into markdown-like lines — headings, lists, code, links, tables,
6
+ * mentions — and never fetches anything a node points at: an embedded card or a
7
+ * media node becomes a marker, not a request.
8
+ *
9
+ * The render is a pure function of an already size-bounded payload (the
10
+ * transport caps the body it reads), so it can build the whole text and cut it
11
+ * once, instead of threading a budget through every recursion.
12
+ */
13
+ export interface AdfText {
14
+ readonly text: string;
15
+ readonly truncated: boolean;
16
+ }
17
+ /** A value that is an ADF document rather than a plain string. */
18
+ export declare function isAdf(value: unknown): boolean;
19
+ /** Render an ADF document to bounded markdown-like text. */
20
+ export declare function adfToText(value: unknown, maxChars: number): AdfText;
21
+ /**
22
+ * Text of a body that may be ADF or a plain string, bounded by the deployment
23
+ * limit. Jira answers both: older issues and some custom fields carry plain
24
+ * text, while Cloud writes ADF.
25
+ */
26
+ export declare function bodyText(value: unknown, maxChars: number): AdfText;
27
+ //# sourceMappingURL=adf.d.ts.map
@@ -0,0 +1,74 @@
1
+ import type { IntegrationCapability, IntegrationCapabilityInfo } from "../../types.js";
2
+ import type { JiraFlags } from "./config.js";
3
+ /**
4
+ * Capabilities this provider offers, one per kind of Jira data a user may hand
5
+ * to the agent. They are narrower than what an Atlassian account can read on
6
+ * purpose: an API token carries the whole user's permissions, while the agent
7
+ * gets one switch per area, so "поищи задачи" does not have to hand over fields
8
+ * or attachments too.
9
+ *
10
+ * Jira Cloud reports no granted scopes for an API token the way GitLab's
11
+ * self-inspection endpoint does, and probing with a write the provider has no
12
+ * right to make is not an option, so these switches are bounded by the
13
+ * deployment alone and Jira's own permissions decide upstream.
14
+ */
15
+ export type JiraCapability = "identity.read" | "issues.read" | "comments.read" | "attachments.read" | "transitions.read" | "projects.read" | "fields.read";
16
+ /** Boolean deployment switches of this provider, one per capability. */
17
+ export type JiraReadFlag = "identityRead" | "issuesRead" | "commentsRead" | "attachmentsRead" | "transitionsRead" | "projectsRead" | "fieldsRead";
18
+ export interface JiraCapabilityDefinition {
19
+ readonly capability: JiraCapability;
20
+ readonly flag: JiraReadFlag;
21
+ readonly label: string;
22
+ readonly hint: string;
23
+ }
24
+ export declare const JIRA_CAPABILITIES: readonly JiraCapabilityDefinition[];
25
+ export interface JiraOperationDefinition {
26
+ readonly capability: JiraCapability;
27
+ /**
28
+ * REST path under the site's `/rest/api/3` root. `:placeholders` are filled by
29
+ * the handler built for that operation; the value is a fixed string, so the
30
+ * model can never pick an endpoint of its own.
31
+ */
32
+ readonly path: string;
33
+ /**
34
+ * Every operation of this catalog is a read. The field exists so the package
35
+ * gate can assert that, instead of trusting the path names to look harmless:
36
+ * Jira serves the same paths writes land on (`/transitions` is a POST).
37
+ */
38
+ readonly method: "GET";
39
+ /** Set when the operation answers with one page of a collection. */
40
+ readonly list?: boolean;
41
+ }
42
+ /**
43
+ * Every model-reachable operation. The provider refuses any operation that is
44
+ * not listed here, so this table — together with `capability` — is the
45
+ * permission surface. The catalog carries no operation that could change Jira
46
+ * state: creating, editing, assigning, commenting and transitioning wait for the
47
+ * two-phase confirmation the specification requires for them, which does not
48
+ * exist yet.
49
+ *
50
+ * `issues.search` reads the enhanced search endpoint Jira Cloud serves today;
51
+ * the legacy `/search` was removed by Atlassian, so a catalog that still named
52
+ * it would answer with an error page instead of issues.
53
+ */
54
+ export declare const JIRA_OPERATIONS: Readonly<Record<string, JiraOperationDefinition>>;
55
+ /**
56
+ * Reads the provider performs next to a catalog operation, never as one
57
+ * themselves: the deployment type behind a connect and the people directory
58
+ * behind a name filter. They are declared here so the same allow-list governs
59
+ * every request this provider makes.
60
+ */
61
+ export declare const JIRA_COMPANION_PATHS: readonly string[];
62
+ /**
63
+ * The read-only endpoint allow-list of this provider, as path templates. Nothing
64
+ * outside it is reachable: a new operation has to be declared here on purpose,
65
+ * in the same change as the catalog entry that uses it.
66
+ */
67
+ export declare const JIRA_READ_PATHS: readonly string[];
68
+ /** Capabilities this deployment allows, in catalog order. */
69
+ export declare function enabledCapabilities(flags: JiraFlags): readonly JiraCapability[];
70
+ /** Label and hint per capability, for clients that render what we declare. */
71
+ export declare const JIRA_CAPABILITY_INFO: Readonly<Record<JiraCapability, IntegrationCapabilityInfo>>;
72
+ /** Capability an operation needs, or undefined when the catalog has none. */
73
+ export declare function jiraOperationCapability(operation: string): IntegrationCapability | undefined;
74
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1,73 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ /**
3
+ * One Jira Cloud site the operator allows. A user never types a host: the
4
+ * connect form picks from this list, so the broker cannot be pointed at an
5
+ * arbitrary origin (the specification's SSRF rule) and a credential minted for
6
+ * a site cannot be spent against another one.
7
+ *
8
+ * The Atlassian account behind a site is a tenant of this deployment, not a
9
+ * global discriminator: the same person may reach several sites, and the
10
+ * credential records which one it belongs to.
11
+ */
12
+ export interface JiraSite {
13
+ readonly id: string;
14
+ readonly label: string;
15
+ /** Canonical `<origin><path>`, without a trailing slash. */
16
+ readonly baseUrl: string;
17
+ }
18
+ /**
19
+ * Deployment switches for the Jira provider. Every read capability is on by
20
+ * default; unlike GitLab there is no scope self-inspection to intersect them
21
+ * with, so these switches are the whole local boundary and the site's own
22
+ * permissions apply upstream (the specification's permission intersection).
23
+ */
24
+ export interface JiraFlags {
25
+ readonly enabled: boolean;
26
+ /** Development escape hatch; production sites must answer over HTTPS. */
27
+ readonly allowInsecureHttp: boolean;
28
+ readonly sites: readonly JiraSite[];
29
+ readonly identityRead: boolean;
30
+ readonly issuesRead: boolean;
31
+ readonly commentsRead: boolean;
32
+ readonly attachmentsRead: boolean;
33
+ readonly transitionsRead: boolean;
34
+ readonly projectsRead: boolean;
35
+ readonly fieldsRead: boolean;
36
+ /**
37
+ * Names this deployment gives to the instance's custom fields, so a question
38
+ * about "the product" does not have to carry a `customfield_…` id, and the
39
+ * mapping between a business term and a field stays where the instance is —
40
+ * in the operator's config, not in a catalog or a skill file. See
41
+ * {@link JiraFlags} consumers: `customFields[].field` accepts either form.
42
+ */
43
+ readonly fieldAliases: Readonly<Record<string, string>>;
44
+ /** Rows of a search answer when the model names no limit. */
45
+ readonly defaultSearchLimit: number;
46
+ /** Hard ceiling for one search answer, whatever the model asks for. */
47
+ readonly maxSearchLimit: number;
48
+ /** Hard ceiling for one page of issue comments. */
49
+ readonly maxCommentLimit: number;
50
+ /** Characters of one description, comment or rich custom field. */
51
+ readonly maxTextChars: number;
52
+ /** Extra attempts for a rate-limited or transient read; writes never retry. */
53
+ readonly retries: number;
54
+ }
55
+ /** Jira Cloud caps one search page at 100 issues once fields are requested. */
56
+ export declare const SEARCH_PAGE_CAP = 100;
57
+ /**
58
+ * The shape of a custom field id, as Jira spells it. The provider never carries
59
+ * one itself: an id belongs to an instance, so it arrives either from the
60
+ * field catalog or from the operator's aliases.
61
+ */
62
+ export declare const CUSTOM_FIELD_ID: RegExp;
63
+ export declare const JIRA_DEFAULTS: JiraFlags;
64
+ /**
65
+ * Config slice of this provider, as it appears under `jira:` in YAML. The site
66
+ * list is validated and canonicalized by `resolveJiraConfig`, which is where a
67
+ * deployment typo fails loudly.
68
+ */
69
+ export declare const jiraConfigSchema: z<Partial<JiraFlags>>;
70
+ export declare function resolveJiraConfig(input?: Partial<JiraFlags>): JiraFlags;
71
+ /** The configured site a stored credential names, or undefined. */
72
+ export declare function jiraSite(flags: JiraFlags, siteId: string): JiraSite | undefined;
73
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,79 @@
1
+ import type { ResolvedQaIntegrationsConfig } from "../../config.js";
2
+ import type { IntegrationCapability, IntegrationCapabilityInfo, ProviderValidation } from "../../types.js";
3
+ import type { IntegrationProvider, ProviderContext } from "../contract.js";
4
+ export { credentialFromPlaintext, credentialSite, type JiraCredential, } from "./transport.js";
5
+ /**
6
+ * Jira Cloud provider: operator-configured sites over an Atlassian API token.
7
+ *
8
+ * The token is spent against the site the credential names, and that site is
9
+ * re-resolved from operator config on every call, so a site the deployment
10
+ * removed or repointed closes the connection instead of redirecting it.
11
+ */
12
+ export declare class JiraProvider implements IntegrationProvider {
13
+ private readonly config;
14
+ readonly id = "jira";
15
+ readonly displayName = "Jira";
16
+ /** What this deployment allows; Jira's own permissions narrow it upstream. */
17
+ readonly capabilities: readonly IntegrationCapability[];
18
+ readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
19
+ private readonly transport;
20
+ constructor(config: ResolvedQaIntegrationsConfig, fetcher?: typeof fetch);
21
+ /**
22
+ * Keep the token, the account it belongs to and the site it was minted for.
23
+ * Both non-secret choices come from the connect form and from operator config,
24
+ * never from a tool argument, which is what keeps the broker from dialling any
25
+ * host the caller names.
26
+ */
27
+ parseCredential(raw: string, options?: Readonly<Record<string, string>>): {
28
+ readonly credential: string;
29
+ readonly portal: string;
30
+ };
31
+ operationCapability(operation: string): IntegrationCapability | undefined;
32
+ validate(context: ProviderContext): Promise<ProviderValidation>;
33
+ execute(context: ProviderContext, operation: string, input: Readonly<Record<string, unknown>>): Promise<unknown>;
34
+ /**
35
+ * Replace a custom field's alias with the instance id the operator mapped it
36
+ * to. The mapping lives in the deployment's config on purpose: which of an
37
+ * instance's fields carries "the product" is knowledge about that instance,
38
+ * not about this provider, so the repository ships no field id and the
39
+ * deployment declares its own names.
40
+ *
41
+ * A name that is neither an id nor a configured alias is refused here, with
42
+ * the aliases this deployment does declare, because a silently unresolved
43
+ * field would answer "no such issues" instead of "unknown field".
44
+ */
45
+ private applyFieldAliases;
46
+ /**
47
+ * Replace a person's name with the account id Jira filters on, for the two
48
+ * filters that can carry one. `me` and an account id are already what Jira
49
+ * wants and cost no call.
50
+ *
51
+ * The directory is a read of the site's own user list, bounded to ten hits,
52
+ * and its answer is never handed to the model: it only decides the id the
53
+ * query is built from. A name nobody matches, or a name several people share,
54
+ * is refused with what to do next — an account id from an issue — because the
55
+ * alternative is a query that quietly answers "no such issues".
56
+ */
57
+ private resolvePeople;
58
+ private accountIdFor;
59
+ /**
60
+ * The site's field schema, read only when an issue read was asked to name
61
+ * custom fields. It is not cached: the same site answers a different list to
62
+ * two users with different permissions, and a cross-user cache would be a leak
63
+ * for the sake of one call.
64
+ */
65
+ private fieldNames;
66
+ /**
67
+ * The provider speaks the Cloud-only `/rest/api/3` surface. A Data Center
68
+ * instance answers a different API, and the specification forbids treating it
69
+ * as silently compatible, so the deployment type is checked once, at connect:
70
+ * a site that names a type other than Cloud is refused. A site that does not
71
+ * serve the endpoint at all — an older tenant, a proxy that hides it — is left
72
+ * to the identity call that already succeeded instead of failing on a probe
73
+ * that proves nothing either way.
74
+ */
75
+ private requireCloud;
76
+ private resolveSite;
77
+ }
78
+ export default JiraProvider;
79
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { type JiraFlags } from "./config.js";
2
+ /** One JQL string literal: quoted, with the quote and the backslash escaped. */
3
+ export declare function jqlLiteral(value: string, field: string): string;
4
+ /**
5
+ * A Jira date or timestamp as JQL takes it. A bare date stays a date; a signed
6
+ * token such as `-3w` stays Jira's own relative date, unquoted, because that is
7
+ * what the language expects; anything with a time is rendered as Jira's
8
+ * `yyyy-MM-dd HH:mm`, since an ISO `T`/`Z` would be a syntax error.
9
+ */
10
+ export declare function jqlDateValue(value: unknown, field: string): string;
11
+ export declare function projectKey(value: unknown, field?: string): string;
12
+ export declare function issueKey(value: unknown, field?: string): string;
13
+ /**
14
+ * Whether a person filter needs the directory before it becomes JQL: `me` and
15
+ * an account id are already unambiguous, a free-text name is not.
16
+ */
17
+ export declare function needsUserLookup(value: unknown): boolean;
18
+ /** One free-text fragment: every word searched, or the exact phrase. */
19
+ export declare function textClauses(value: unknown, match: "all" | "phrase" | undefined): string[];
20
+ /**
21
+ * One custom-field constraint. The field is named by id — the one
22
+ * `jira_get_fields` returned — and the value is escaped like any other, so an
23
+ * instance field can be queried without putting JQL in the model's hands.
24
+ */
25
+ export interface CustomFieldClause {
26
+ readonly field: string;
27
+ readonly value?: string;
28
+ readonly empty?: boolean;
29
+ readonly match?: "equals" | "contains";
30
+ }
31
+ /** The match mode of a free-text query: every word, or the exact phrase. */
32
+ export declare function textMatch(value: unknown): "all" | "phrase";
33
+ /**
34
+ * Build the one JQL query behind `jira_search_issues`. The model contributes
35
+ * values only; the operators, the clauses and the ordering are decided here, so
36
+ * "OR project = SECRET" is a text fragment to search for rather than a clause
37
+ * that widens the search.
38
+ */
39
+ export declare function buildJql(input: Readonly<Record<string, unknown>>): string;
40
+ /**
41
+ * Rows of one search page: the model may lower the deployment's default but
42
+ * never raise its ceiling.
43
+ */
44
+ export declare function searchLimit(requested: unknown, flags: JiraFlags): number;
45
+ /** Rows of one comment page, capped the same way. */
46
+ export declare function commentLimit(requested: unknown, flags: JiraFlags): number;
47
+ /** The offset of a comment page; Jira still pages comments by position. */
48
+ export declare function commentStart(value: unknown): number;
49
+ /** An opaque continuation token from a previous search answer. */
50
+ export declare function pageToken(value: unknown): string | undefined;
51
+ //# sourceMappingURL=jql.d.ts.map
@@ -0,0 +1,58 @@
1
+ import type { JiraFlags, JiraSite } from "./config.js";
2
+ import type { JiraQuery } from "./transport.js";
3
+ /** What a search answer carries about every issue it returns. */
4
+ export declare const SEARCH_FIELDS: readonly string[];
5
+ /** Optional groups `jira_get_issue` can add to the core card. */
6
+ export declare const ISSUE_INCLUDES: readonly string[];
7
+ export interface OperationContext {
8
+ /**
9
+ * Atlassian account id of the connection owner, read from the stored
10
+ * integration. Reserved for "mine" defaults Jira cannot express with a
11
+ * keyword; no operation substitutes it for a model argument.
12
+ */
13
+ readonly externalUserId?: string | undefined;
14
+ readonly flags: JiraFlags;
15
+ }
16
+ export interface JiraRequest {
17
+ readonly path: string;
18
+ readonly query: JiraQuery;
19
+ }
20
+ export type JiraOperationHandler = (input: Readonly<Record<string, unknown>>, context: OperationContext) => JiraRequest;
21
+ /** The include groups a `jira_get_issue` call asked for, in catalog order. */
22
+ export declare function requestedIncludes(value: unknown): readonly string[];
23
+ /**
24
+ * The `fields` selector of one issue read. Custom fields are the one group Jira
25
+ * only answers in full, so asking for them switches the selector to `*all`;
26
+ * everything else is an explicit list, which is what keeps an issue read from
27
+ * dragging the whole site schema into the answer.
28
+ *
29
+ * Custom fields are also the group that depends on the site's field catalog, so
30
+ * a deployment that switched that catalog off refuses them here rather than
31
+ * answering with a page of `customfield_…` ids nobody can interpret.
32
+ */
33
+ export declare function issueFields(include: readonly string[], flags: JiraFlags): string;
34
+ /** Whether an issue read needs the site's field schema to name custom fields. */
35
+ export declare function wantsFieldNames(include: readonly string[]): boolean;
36
+ export declare const JIRA_HANDLERS: Readonly<Record<string, JiraOperationHandler>>;
37
+ /** The one thing about an issue that is a person's to click. */
38
+ export declare function issueUrl(site: JiraSite, key: string): string;
39
+ /**
40
+ * One custom field value, reduced to what the model can read: rich text becomes
41
+ * text, a picker keeps its name, and a shape nothing here recognizes is rendered
42
+ * as bounded JSON rather than dropped silently.
43
+ */
44
+ export declare function customFieldValue(value: unknown, maxChars: number): unknown;
45
+ export interface JiraProjectionContext {
46
+ readonly flags: JiraFlags;
47
+ /** The configured site this answer came from, for the issue permalink. */
48
+ readonly site: JiraSite;
49
+ /** Groups a `jira_get_issue` call asked for. */
50
+ readonly include: readonly string[];
51
+ /** Field id to name, when the call resolved the site's field schema. */
52
+ readonly fieldNames?: ReadonlyMap<string, string> | undefined;
53
+ /** The issue a one-issue operation was asked about, when Jira omits it. */
54
+ readonly issueKey?: string | undefined;
55
+ }
56
+ export type JiraProjection = (data: unknown, context: JiraProjectionContext) => unknown;
57
+ export declare const JIRA_PROJECTIONS: Readonly<Record<string, JiraProjection>>;
58
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1,17 @@
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 declare const JIRA_TOOL_NAMES: readonly ["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"];
5
+ /**
6
+ * Every tool reports what the *connected* Jira account may read, never a
7
+ * caller-supplied identity: the account and the site come from the stored
8
+ * integration of the QA user who owns the DSH session, and the tool schemas
9
+ * carry no user, credential or site selector.
10
+ */
11
+ export declare function createJiraTools(options: {
12
+ readonly broker: IntegrationBroker;
13
+ readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
+ }): readonly ToolDefinition[];
15
+ /** Field names a search answer carries, for documentation and tests. */
16
+ export declare const JIRA_SEARCH_FIELDS: readonly string[];
17
+ //# sourceMappingURL=tools.d.ts.map