@yadsh/dsh-qa-integrations 0.8.3 → 0.10.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 (188) hide show
  1. package/README.md +44 -27
  2. package/compatibility.json +7 -3
  3. package/lib/broker.js +225 -18
  4. package/lib/broker.js.map +1 -1
  5. package/lib/client/bitrix24.js +8 -6
  6. package/lib/client/bitrix24.js.map +1 -1
  7. package/lib/client/card.js +14 -13
  8. package/lib/client/card.js.map +1 -1
  9. package/lib/client/confluence.js +11 -7
  10. package/lib/client/confluence.js.map +1 -1
  11. package/lib/client/credential-help-note.js +51 -0
  12. package/lib/client/credential-help-note.js.map +1 -0
  13. package/lib/client/gitlab.js +8 -6
  14. package/lib/client/gitlab.js.map +1 -1
  15. package/lib/client/index.js +38 -32
  16. package/lib/client/index.js.map +1 -1
  17. package/lib/client/integrations.js +31 -18
  18. package/lib/client/integrations.js.map +1 -1
  19. package/lib/client/jira.js +10 -8
  20. package/lib/client/jira.js.map +1 -1
  21. package/lib/client/operator-card.js +93 -534
  22. package/lib/client/operator-card.js.map +1 -1
  23. package/lib/client/operator-controls.js +72 -23
  24. package/lib/client/operator-controls.js.map +1 -1
  25. package/lib/client/operator-sections/bitrix24.js +22 -0
  26. package/lib/client/operator-sections/bitrix24.js.map +1 -0
  27. package/lib/client/operator-sections/confluence.js +27 -0
  28. package/lib/client/operator-sections/confluence.js.map +1 -0
  29. package/lib/client/operator-sections/credential-help.js +15 -0
  30. package/lib/client/operator-sections/credential-help.js.map +1 -0
  31. package/lib/client/operator-sections/general.js +8 -0
  32. package/lib/client/operator-sections/general.js.map +1 -0
  33. package/lib/client/operator-sections/gitlab.js +41 -0
  34. package/lib/client/operator-sections/gitlab.js.map +1 -0
  35. package/lib/client/operator-sections/jira.js +25 -0
  36. package/lib/client/operator-sections/jira.js.map +1 -0
  37. package/lib/client/operator-sections/provider-section.js +21 -0
  38. package/lib/client/operator-sections/provider-section.js.map +1 -0
  39. package/lib/client/operator-sections/service-profiles.js +178 -0
  40. package/lib/client/operator-sections/service-profiles.js.map +1 -0
  41. package/lib/client/operator-sections/shared.js +192 -0
  42. package/lib/client/operator-sections/shared.js.map +1 -0
  43. package/lib/client/operator-sections/teamcity.js +42 -0
  44. package/lib/client/operator-sections/teamcity.js.map +1 -0
  45. package/lib/client/operator-sections/testit.js +35 -0
  46. package/lib/client/operator-sections/testit.js.map +1 -0
  47. package/lib/client/operator-sections/weblate.js +32 -0
  48. package/lib/client/operator-sections/weblate.js.map +1 -0
  49. package/lib/client/operator-service-reach.js +98 -0
  50. package/lib/client/operator-service-reach.js.map +1 -0
  51. package/lib/client/provider-card.js +32 -19
  52. package/lib/client/provider-card.js.map +1 -1
  53. package/lib/client/styles.js +52 -15
  54. package/lib/client/styles.js.map +1 -1
  55. package/lib/client/teamcity.js +7 -5
  56. package/lib/client/teamcity.js.map +1 -1
  57. package/lib/client/testit.js +8 -6
  58. package/lib/client/testit.js.map +1 -1
  59. package/lib/client/weblate.js +8 -6
  60. package/lib/client/weblate.js.map +1 -1
  61. package/lib/client.js +2838 -1923
  62. package/lib/client.js.map +1 -1
  63. package/lib/config.js +64 -17
  64. package/lib/config.js.map +1 -1
  65. package/lib/index.js +177 -223
  66. package/lib/index.js.map +1 -1
  67. package/lib/providers/bitrix24/tools.js +7 -2
  68. package/lib/providers/bitrix24/tools.js.map +1 -1
  69. package/lib/providers/bitrix24/transport.js +16 -6
  70. package/lib/providers/bitrix24/transport.js.map +1 -1
  71. package/lib/providers/confluence/config.js +14 -55
  72. package/lib/providers/confluence/config.js.map +1 -1
  73. package/lib/providers/confluence/tools.js +7 -2
  74. package/lib/providers/confluence/tools.js.map +1 -1
  75. package/lib/providers/confluence/transport.js +42 -78
  76. package/lib/providers/confluence/transport.js.map +1 -1
  77. package/lib/providers/gitlab/config.js +11 -55
  78. package/lib/providers/gitlab/config.js.map +1 -1
  79. package/lib/providers/gitlab/operations.js +3 -3
  80. package/lib/providers/gitlab/operations.js.map +1 -1
  81. package/lib/providers/gitlab/tools.js +7 -2
  82. package/lib/providers/gitlab/tools.js.map +1 -1
  83. package/lib/providers/gitlab/transport.js +33 -65
  84. package/lib/providers/gitlab/transport.js.map +1 -1
  85. package/lib/providers/jira/config.js +18 -58
  86. package/lib/providers/jira/config.js.map +1 -1
  87. package/lib/providers/jira/jql.js +105 -1
  88. package/lib/providers/jira/jql.js.map +1 -1
  89. package/lib/providers/jira/tools.js +68 -2
  90. package/lib/providers/jira/tools.js.map +1 -1
  91. package/lib/providers/jira/transport.js +44 -110
  92. package/lib/providers/jira/transport.js.map +1 -1
  93. package/lib/providers/kernel/address.js +90 -0
  94. package/lib/providers/kernel/address.js.map +1 -0
  95. package/lib/providers/kernel/errors.js +42 -0
  96. package/lib/providers/kernel/errors.js.map +1 -0
  97. package/lib/providers/kernel/read-policy.js +250 -0
  98. package/lib/providers/kernel/read-policy.js.map +1 -0
  99. package/lib/providers/kernel/token.js +45 -0
  100. package/lib/providers/kernel/token.js.map +1 -0
  101. package/lib/providers/shared/service-boundary.js +31 -3
  102. package/lib/providers/shared/service-boundary.js.map +1 -1
  103. package/lib/providers/teamcity/tools.js +8 -3
  104. package/lib/providers/teamcity/tools.js.map +1 -1
  105. package/lib/providers/teamcity/transport.js +6 -8
  106. package/lib/providers/teamcity/transport.js.map +1 -1
  107. package/lib/providers/testit/config.js +12 -57
  108. package/lib/providers/testit/config.js.map +1 -1
  109. package/lib/providers/testit/tools.js +7 -2
  110. package/lib/providers/testit/tools.js.map +1 -1
  111. package/lib/providers/testit/transport.js +12 -12
  112. package/lib/providers/testit/transport.js.map +1 -1
  113. package/lib/providers/weblate/config.js +12 -55
  114. package/lib/providers/weblate/config.js.map +1 -1
  115. package/lib/providers/weblate/tools.js +7 -2
  116. package/lib/providers/weblate/tools.js.map +1 -1
  117. package/lib/providers/weblate/transport.js +21 -20
  118. package/lib/providers/weblate/transport.js.map +1 -1
  119. package/lib/public-api.js +79 -0
  120. package/lib/public-api.js.map +1 -0
  121. package/lib/repository.js +96 -16
  122. package/lib/repository.js.map +1 -1
  123. package/lib/service-credentials/config.js +61 -0
  124. package/lib/service-credentials/config.js.map +1 -1
  125. package/lib/service-credentials/policy.js +14 -1
  126. package/lib/service-credentials/policy.js.map +1 -1
  127. package/lib/service-credentials/rate-limit.js +136 -0
  128. package/lib/service-credentials/rate-limit.js.map +1 -0
  129. package/lib/tool-kit.js +15 -7
  130. package/lib/tool-kit.js.map +1 -1
  131. package/lib/tools.js +49 -24
  132. package/lib/tools.js.map +1 -1
  133. package/lib/typert.host.js +460 -352
  134. package/lib/typert.remote-client.js +450 -336
  135. package/lib/types/broker.d.ts +77 -3
  136. package/lib/types/client/card.d.ts +13 -4
  137. package/lib/types/client/credential-help-note.d.ts +26 -0
  138. package/lib/types/client/index.d.ts +15 -7
  139. package/lib/types/client/integrations.d.ts +5 -4
  140. package/lib/types/client/operator-card.d.ts +56 -4
  141. package/lib/types/client/operator-controls.d.ts +31 -0
  142. package/lib/types/client/operator-sections/bitrix24.d.ts +12 -0
  143. package/lib/types/client/operator-sections/confluence.d.ts +10 -0
  144. package/lib/types/client/operator-sections/credential-help.d.ts +17 -0
  145. package/lib/types/client/operator-sections/general.d.ts +11 -0
  146. package/lib/types/client/operator-sections/gitlab.d.ts +13 -0
  147. package/lib/types/client/operator-sections/jira.d.ts +11 -0
  148. package/lib/types/client/operator-sections/provider-section.d.ts +58 -0
  149. package/lib/types/client/operator-sections/service-profiles.d.ts +13 -0
  150. package/lib/types/client/operator-sections/shared.d.ts +123 -0
  151. package/lib/types/client/operator-sections/teamcity.d.ts +11 -0
  152. package/lib/types/client/operator-sections/testit.d.ts +10 -0
  153. package/lib/types/client/operator-sections/weblate.d.ts +10 -0
  154. package/lib/types/client/operator-service-reach.d.ts +76 -0
  155. package/lib/types/client/provider-card.d.ts +14 -3
  156. package/lib/types/client/styles.d.ts +28 -4
  157. package/lib/types/config.d.ts +49 -2
  158. package/lib/types/index.d.ts +54 -117
  159. package/lib/types/providers/bitrix24/tools.d.ts +2 -5
  160. package/lib/types/providers/confluence/tools.d.ts +2 -6
  161. package/lib/types/providers/confluence/transport.d.ts +0 -6
  162. package/lib/types/providers/gitlab/config.d.ts +1 -1
  163. package/lib/types/providers/gitlab/tools.d.ts +2 -6
  164. package/lib/types/providers/gitlab/transport.d.ts +3 -5
  165. package/lib/types/providers/jira/tools.d.ts +2 -6
  166. package/lib/types/providers/jira/transport.d.ts +2 -11
  167. package/lib/types/providers/kernel/address.d.ts +57 -0
  168. package/lib/types/providers/kernel/errors.d.ts +34 -0
  169. package/lib/types/providers/kernel/read-policy.d.ts +107 -0
  170. package/lib/types/providers/kernel/token.d.ts +25 -0
  171. package/lib/types/providers/shared/service-boundary.d.ts +15 -0
  172. package/lib/types/providers/teamcity/tools.d.ts +2 -6
  173. package/lib/types/providers/teamcity/transport.d.ts +1 -1
  174. package/lib/types/providers/testit/tools.d.ts +2 -6
  175. package/lib/types/providers/testit/transport.d.ts +1 -1
  176. package/lib/types/providers/weblate/tools.d.ts +2 -6
  177. package/lib/types/public-api.d.ts +80 -0
  178. package/lib/types/repository.d.ts +64 -2
  179. package/lib/types/service-credentials/config.d.ts +22 -0
  180. package/lib/types/service-credentials/rate-limit.d.ts +66 -0
  181. package/lib/types/service-credentials/types.d.ts +18 -0
  182. package/lib/types/tool-kit.d.ts +27 -1
  183. package/lib/types/tools.d.ts +26 -9
  184. package/lib/types/types.d.ts +17 -3
  185. package/package.json +23 -21
  186. package/lib/providers/shared/http.js +0 -168
  187. package/lib/providers/shared/http.js.map +0 -1
  188. package/lib/types/providers/shared/http.d.ts +0 -60
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The token policy shared by every provider: an encrypted payload names the
3
+ * configured endpoint the secret belongs to and carries the secret itself. The
4
+ * address is never stored — it is re-resolved from operator config on every
5
+ * call, so removing or repointing an endpoint takes effect at once instead of
6
+ * at the next connect. A credential minted for an endpoint the operator has
7
+ * since removed fails closed: it never falls back to another endpoint, however
8
+ * permissive that one is.
9
+ */
10
+ /** The refusal every provider answers for a payload it cannot read. */
11
+ export declare function invalidStoredCredential(): never;
12
+ /**
13
+ * `"text"` must be a string and may be empty (a deployment type that
14
+ * authenticates on the token alone carries no account e-mail); `"nonempty"`
15
+ * additionally refuses the empty value, which is how a secret that was never
16
+ * entered reads.
17
+ */
18
+ export type CredentialFieldRule = "text" | "nonempty";
19
+ /** Decode one credential payload field by field, refusing a half-shaped blob. */
20
+ export declare function decodeCredentialFields<S extends Readonly<Record<string, CredentialFieldRule>>>(plaintext: string, schema: S): {
21
+ readonly [K in keyof S]: string;
22
+ };
23
+ /** The configured endpoint a credential names, or a fail-closed refusal. */
24
+ export declare function requireConfiguredEndpoint<T>(found: T | undefined, message: string): T;
25
+ //# sourceMappingURL=token.d.ts.map
@@ -13,6 +13,21 @@ import type { ProviderContext } from "../contract.js";
13
13
  export declare function serviceBoundaryOf(context: ProviderContext): ServiceResourceBoundary | undefined;
14
14
  /** One refusal shape, so every service-mode denial reads the same. */
15
15
  export declare function serviceResourceDenied(): IntegrationError;
16
+ /**
17
+ * What the managed credential never answers, in the words a tool says before it
18
+ * is called. The model reads this instead of discovering it in a refusal, so it
19
+ * neither promises a user a log it cannot fetch nor goes looking for a fault in
20
+ * the stand's own integration.
21
+ */
22
+ export declare const SERVICE_CEILING_NOTICE = "Needs a personal connection: under the deployment's managed service token the service ceiling refuses this reading, and the user switches this integration to their own account to get it.";
23
+ /**
24
+ * Whether the ceiling refuses one operation *as a reading* — the case worth
25
+ * warning about, because the deployment's capability switch stays on while the
26
+ * answer stays personal. A write needs no warning: it is outside a read-only
27
+ * credential whatever it returns. An operation the provider never classified is
28
+ * refused too, and says so, because that is what the lock below will answer.
29
+ */
30
+ export declare function serviceCeilingRefusedReading(security: OperationSecurityMetadata | undefined): boolean;
16
31
  /**
17
32
  * Refuse an operation the provider's own catalog does not mark as service-safe.
18
33
  * The broker decides this first and with the administrator's narrowing on top;
@@ -1,6 +1,5 @@
1
1
  import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
2
- import type { IntegrationBroker } from "../../broker.js";
3
- import type { IntegrationPrincipal } from "../../types.js";
2
+ import { type ProviderToolFactoryOptions } from "../../tool-kit.js";
4
3
  export declare const TEAMCITY_TOOL_NAMES: readonly ["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"];
5
4
  /**
6
5
  * Every tool reads what the *connected* TeamCity account may read, never a
@@ -8,8 +7,5 @@ export declare const TEAMCITY_TOOL_NAMES: readonly ["teamcity_connection_get", "
8
7
  * QA user who owns the DSH session, and no tool schema carries a user,
9
8
  * credential or server selector.
10
9
  */
11
- export declare function createTeamcityTools(options: {
12
- readonly broker: IntegrationBroker;
13
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
- }): readonly ToolDefinition[];
10
+ export declare function createTeamcityTools(options: ProviderToolFactoryOptions): readonly ToolDefinition[];
15
11
  //# sourceMappingURL=tools.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ResolvedQaIntegrationsConfig } from "../../config.js";
2
- import { type BoundedText } from "../shared/http.js";
2
+ import { type BoundedText } from "../kernel/read-policy.js";
3
3
  import type { TeamCityFlags } from "./config.js";
4
4
  /**
5
5
  * Encrypted payload of one TeamCity connection: the personal access token the
@@ -1,6 +1,5 @@
1
1
  import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
2
- import type { IntegrationBroker } from "../../broker.js";
3
- import type { IntegrationPrincipal } from "../../types.js";
2
+ import { type ProviderToolFactoryOptions } from "../../tool-kit.js";
4
3
  export declare const TESTIT_TOOL_NAMES: readonly ["testit_connection_get", "testit_projects", "testit_project_get", "testit_sections", "testit_work_items", "testit_work_item_get", "testit_work_item_history", "testit_work_item_comments", "testit_work_item_test_results", "testit_test_plans", "testit_test_plan_get", "testit_test_plan_summary", "testit_test_runs", "testit_test_run_get", "testit_test_run_results", "testit_test_result_get", "testit_test_result_attachments", "testit_attachment_metadata", "testit_attachment_text", "testit_auto_tests", "testit_auto_test_get", "testit_configurations"];
5
4
  /**
6
5
  * Every tool reads what the *connected* Test IT token may read, never a
@@ -8,8 +7,5 @@ export declare const TESTIT_TOOL_NAMES: readonly ["testit_connection_get", "test
8
7
  * the QA user who owns the DSH session, and no tool schema carries a user,
9
8
  * credential, token or installation selector.
10
9
  */
11
- export declare function createTestitTools(options: {
12
- readonly broker: IntegrationBroker;
13
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
- }): readonly ToolDefinition[];
10
+ export declare function createTestitTools(options: ProviderToolFactoryOptions): readonly ToolDefinition[];
15
11
  //# sourceMappingURL=tools.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { ResolvedQaIntegrationsConfig } from "../../config.js";
2
- import { type BoundedText } from "../shared/http.js";
2
+ import { type BoundedText } from "../kernel/read-policy.js";
3
3
  import { type TestitFlags, type TestitInstance } from "./config.js";
4
4
  /**
5
5
  * Encrypted credential payload of one Test IT connection: which configured
@@ -1,6 +1,5 @@
1
1
  import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
2
- import type { IntegrationBroker } from "../../broker.js";
3
- import type { IntegrationPrincipal } from "../../types.js";
2
+ import { type ProviderToolFactoryOptions } from "../../tool-kit.js";
4
3
  export declare const WEBLATE_TOOL_NAMES: readonly ["weblate_connection_get", "weblate_projects_list", "weblate_project_get", "weblate_project_statistics_get", "weblate_components_list", "weblate_component_get", "weblate_component_statistics_get", "weblate_translations_list", "weblate_translation_get", "weblate_translation_statistics_get", "weblate_units_search", "weblate_units_find", "weblate_unit_get", "weblate_unit_comments_list", "weblate_unit_suggestions_list", "weblate_failing_units_list", "weblate_changes_list", "weblate_screenshots_list", "weblate_screenshot_get"];
5
4
  /**
6
5
  * Every tool reports what the *connected* Weblate account may read, never a
@@ -8,8 +7,5 @@ export declare const WEBLATE_TOOL_NAMES: readonly ["weblate_connection_get", "we
8
7
  * QA user who owns the DSH session, and the tool schemas carry no user,
9
8
  * credential or instance selector.
10
9
  */
11
- export declare function createWeblateTools(options: {
12
- readonly broker: IntegrationBroker;
13
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
- }): readonly ToolDefinition[];
10
+ export declare function createWeblateTools(options: ProviderToolFactoryOptions): readonly ToolDefinition[];
15
11
  //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The published surface of this package, in one list.
3
+ *
4
+ * The plugin's composition root and this list answer different questions — which
5
+ * providers a deployment mounts, and which names another plugin may import from
6
+ * @yadsh/dsh-qa-integrations — so they live apart: adding a provider adds its own
7
+ * row to the list and its own module, and changes nothing about how the plugin is
8
+ * composed. The entry module re-exports this file, so a consumer of the package
9
+ * cannot tell the two apart, which is the point.
10
+ */
11
+ export { IntegrationBroker } from "./broker.js";
12
+ export { ConfigSchema, resolveConfig, snapshotConfig, type LiveQaIntegrationsConfig, type QaIntegrationsConfig, type QaIntegrationsSnapshot, type ResolvedQaIntegrationsConfig, } from "./config.js";
13
+ export { MANAGED_SERVICE_CREDENTIALS_DEFAULTS, managedServiceCredentialsSchema, resolveManagedServiceCredentials, type ManagedServiceCredentialProfileConfig, type ManagedServiceCredentialProfileInput, type ManagedServiceCredentialsConfig, type ManagedServiceCredentialsInput, } from "./service-credentials/config.js";
14
+ export { evaluateServiceOperation, narrowBoundary, SERVICE_CEILING, type ServiceOperationQuery, type ServicePolicyDecision, } from "./service-credentials/policy.js";
15
+ export { ServiceCredentialRegistry } from "./service-credentials/registry.js";
16
+ export { operationCapabilityServiceState } from "./service-credentials/state.js";
17
+ export { profilePolicyRevision } from "./service-credentials/config.js";
18
+ export { CREDENTIAL_SOURCES, isCredentialSource, UNCLASSIFIED_OPERATION, type CredentialSource as ManagedCredentialSource, type DataSensitivity, type OperationEffect, type OperationSecurityMetadata, type OperationServiceDecision, type ResolvedCredentialContext, type ResolvedServiceCredential, type SafeExternalIdentity, type ServiceCredentialHealth, type ServiceCredentialProfile, type ServiceCredentialStatus, type ServiceResourceBoundary, } from "./service-credentials/types.js";
19
+ export { IntegrationError } from "./errors.js";
20
+ export { BITRIX_CAPABILITIES, BITRIX_OPERATIONS, BITRIX24_CAPABILITY_INFO, bitrix24OperationCapability, enabledCapabilities, type Bitrix24Capability, type Bitrix24CapabilityDefinition, type BitrixOperationDefinition, } from "./providers/bitrix24/catalog.js";
21
+ export { BITRIX24_DEFAULTS, bitrix24ConfigSchema, resolveBitrix24Config, type Bitrix24Flags, } from "./providers/bitrix24/config.js";
22
+ export { Bitrix24Provider, parseBitrixWebhook, } from "./providers/bitrix24/index.js";
23
+ export { BITRIX_HANDLERS, BITRIX_PROJECTIONS, } from "./providers/bitrix24/operations.js";
24
+ export { createBitrix24Tools, BITRIX24_TOOL_NAMES, } from "./providers/bitrix24/tools.js";
25
+ export { GitlabProvider, groupAllowed as gitlabGroupAllowed, projectAllowed as gitlabProjectAllowed, } from "./providers/gitlab/index.js";
26
+ export { GITLAB_CAPABILITIES, GITLAB_CAPABILITY_INFO, GITLAB_CI_SPLIT_CAPABILITIES, GITLAB_LEGACY_CI_CAPABILITY, GITLAB_OPERATIONS, GITLAB_RESOURCE_KIND, capabilitiesForScopes, gitlabOperationCapability, gitlabOperationMetadata, type GitlabCapability, type GitlabCapabilityDefinition, type GitlabOperationDefinition, } from "./providers/gitlab/catalog.js";
27
+ export { GITLAB_DEFAULTS, gitlabConfigSchema, resolveGitlabConfig, type GitlabConfigInput, type GitlabFlags, type GitlabInstance, } from "./providers/gitlab/config.js";
28
+ export { createGitlabTools, GITLAB_TOOL_NAMES, } from "./providers/gitlab/tools.js";
29
+ export { GitlabTransport, credentialFromPlaintext as gitlabCredentialFromPlaintext, credentialInstance, type GitlabCredential, } from "./providers/gitlab/transport.js";
30
+ export { GITLAB_HANDLERS, GITLAB_PROJECTIONS, } from "./providers/gitlab/operations.js";
31
+ export { ConfluenceProvider } from "./providers/confluence/index.js";
32
+ export { adfToText as confluenceAdfToText, textBudget, } from "./providers/confluence/adf.js";
33
+ export { CONFLUENCE_CAPABILITIES, CONFLUENCE_CAPABILITY_INFO, CONFLUENCE_OPERATIONS, confluenceOperationCapability, type ConfluenceCapability, type ConfluenceCapabilityDefinition, type ConfluenceOperationDefinition, } from "./providers/confluence/catalog.js";
34
+ export { CONFLUENCE_DEFAULTS, confluenceConfigSchema, resolveConfluenceConfig, spaceAllowed, type ConfluenceFlags, type ConfluenceInstance, } from "./providers/confluence/config.js";
35
+ export { buildCql, cqlLiteral, CONTENT_TYPES, ORDER_BY, type ConfluenceOrder, type ConfluenceSearchFilter, } from "./providers/confluence/cql.js";
36
+ export { COMMENT_KINDS, CONFLUENCE_HANDLERS, CONFLUENCE_PROJECTIONS, DEFAULT_LIMIT, bodyLimit, commentChildrenPath, commentCollections, commentKind, commentPath, commentReplies, isNumericSpace, modifiedAfterDate, numericId, offsetCursor, pageLimit, plainExcerpt, spaceRef, upstreamCursor, type ConfluenceCommentKind, type ConfluenceProjection, type ConfluenceProjectionContext, type ConfluenceRequest, } from "./providers/confluence/operations.js";
37
+ export { createConfluenceTools, CONFLUENCE_TOOL_NAMES, } from "./providers/confluence/tools.js";
38
+ export { ConfluenceTransport, credentialFromPlaintext as confluenceCredentialFromPlaintext, credentialInstance as confluenceCredentialInstance, type ConfluenceCredential, } from "./providers/confluence/transport.js";
39
+ export { TeamcityProvider, buildTypeAllowed as teamcityBuildTypeAllowed, projectAllowed as teamcityProjectAllowed, } from "./providers/teamcity/index.js";
40
+ export { TEAMCITY_CAPABILITIES, TEAMCITY_CAPABILITY_INFO, TEAMCITY_INSTANCE_ID, TEAMCITY_OPERATIONS, TEAMCITY_RESOURCE_KIND, TEAMCITY_STREAM_OPERATIONS, enabledCapabilities as enabledTeamcityCapabilities, teamcityOperationCapability, teamcityOperationMetadata, type TeamCityCapability, type TeamCityCapabilityDefinition, type TeamCityOperationDefinition, } from "./providers/teamcity/catalog.js";
41
+ export { TEAMCITY_DEFAULTS, DEFAULT_LOG_LINES, resolveTeamCityConfig, teamcityConfigSchema, type TeamCityConfigInput, type TeamCityFlags, } from "./providers/teamcity/config.js";
42
+ export { artifactBinaryProblem, artifactByteLimit, artifactPath, textArtifact, type ArtifactPath, } from "./providers/teamcity/artifacts.js";
43
+ export { LOG_MODES, logLines, logMode, sanitizeLog, selectLogWindow, trimToBytes, type LogMode, type LogWindow, } from "./providers/teamcity/logs.js";
44
+ export { PRIVATE_CIDRS, canonicalServerUrl, cidrProblem, hostPatternProblem, isIpLiteral, serverUrlProblem, type TeamCityNetworkMode, type TeamCityNetworkPolicy, } from "./providers/teamcity/network.js";
45
+ export { buildBuildLocator, dimension, joinDimensions, locatorValue, nested, teamCityDate, type BuildLocatorInput, } from "./providers/teamcity/locators.js";
46
+ export { TEAMCITY_HANDLERS, TEAMCITY_LIMITS, TEAMCITY_PROJECTIONS, isoDate, listLimit, type TeamCityProjection, type TeamCityRequest, } from "./providers/teamcity/operations.js";
47
+ export { TeamCityTransport, configuredServer as teamcityConfiguredServer, credentialFromPlaintext as teamcityCredentialFromPlaintext, type TeamCityCredential, } from "./providers/teamcity/transport.js";
48
+ export { createTeamcityTools, TEAMCITY_TOOL_NAMES, } from "./providers/teamcity/tools.js";
49
+ export { JiraProvider } from "./providers/jira/index.js";
50
+ export { JIRA_CAPABILITIES, JIRA_CAPABILITY_INFO, JIRA_COMPANION_PATHS, JIRA_OPERATIONS, JIRA_READ_PATHS, enabledCapabilities as enabledJiraCapabilities, jiraOperationCapability, type JiraCapability, type JiraCapabilityDefinition, type JiraOperationDefinition, } from "./providers/jira/catalog.js";
51
+ export { JIRA_DEFAULTS, SEARCH_PAGE_CAP, jiraConfigSchema, jiraSite, resolveJiraConfig, type JiraFlags, type JiraSite, } from "./providers/jira/config.js";
52
+ export { adfToText as jiraAdfToText, bodyText, isAdf, type AdfText, } from "./providers/jira/adf.js";
53
+ export { buildJql, commentLimit, commentStart, issueKey as jiraIssueKey, jqlDateValue, jqlLiteral, needsUserLookup, pageToken, projectKey as jiraProjectKey, searchLimit, textClauses, textMatch, type CustomFieldClause, } from "./providers/jira/jql.js";
54
+ export { ISSUE_INCLUDES, JIRA_HANDLERS, JIRA_PROJECTIONS, SEARCH_FIELDS as JIRA_SEARCH_FIELDS, customFieldValue, issueFields, issueUrl, requestedIncludes, wantsFieldNames, type JiraProjection, } from "./providers/jira/operations.js";
55
+ export { JiraTransport, basicAuthorization, credentialFromPlaintext as jiraCredentialFromPlaintext, credentialSite, type JiraCredential, } from "./providers/jira/transport.js";
56
+ export { createJiraTools, JIRA_TOOL_NAMES } from "./providers/jira/tools.js";
57
+ export { TestitProvider } from "./providers/testit/index.js";
58
+ export { TESTIT_CAPABILITIES, TESTIT_CAPABILITY_INFO, TESTIT_OPERATIONS, enabledCapabilities as enabledTestitCapabilities, testitOperationCapability, type TestitCapability, type TestitCapabilityDefinition, type TestitListKind, type TestitOperationDefinition, } from "./providers/testit/catalog.js";
59
+ export { TESTIT_DEFAULTS, resolveTestitConfig, testitConfigSchema, testitInstance, type TestitFlags, type TestitInstance, } from "./providers/testit/config.js";
60
+ export { assertReadableSize, attachmentBinaryProblem, attachmentByteLimit, attachmentExtension, attachmentName, } from "./providers/testit/attachments.js";
61
+ export { RESULT_OUTCOMES, TESTIT_HANDLERS, TESTIT_LIMITS, TESTIT_PROJECTIONS, TEST_RUN_STATES, WORK_ITEM_ENTITY_TYPES, WORK_ITEM_PRIORITIES, WORK_ITEM_STATES, bounded as testitBounded, capped, contentBlock as testitContentBlock, listLimit as testitListLimit, listOffset as testitListOffset, paged, type TestitProjection, type TestitProjectionContext, type TestitRequest, } from "./providers/testit/operations.js";
62
+ export { TestitTransport, credentialFromPlaintext as testitCredentialFromPlaintext, credentialInstance as testitCredentialInstance, type TestitCredential, type TestitPage, } from "./providers/testit/transport.js";
63
+ export { createTestitTools, TESTIT_TOOL_NAMES, } from "./providers/testit/tools.js";
64
+ export { WeblateProvider } from "./providers/weblate/index.js";
65
+ export { WEBLATE_CAPABILITIES, WEBLATE_CAPABILITY_INFO, WEBLATE_OPERATIONS, enabledCapabilities as weblateEnabledCapabilities, weblateOperationCapability, type WeblateCapability, type WeblateCapabilityDefinition, type WeblateOperationDefinition, } from "./providers/weblate/catalog.js";
66
+ export { WEBLATE_DEFAULTS, resolveWeblateConfig, weblateConfigSchema, weblateInstance, type WeblateFlags, type WeblateInstance, } from "./providers/weblate/config.js";
67
+ export { WEBLATE_HANDLERS, WEBLATE_PROJECTIONS, WEBLATE_UNTRUSTED_OPERATIONS, accountFromUsers, componentRef, projectRef as weblateProjectRef, sameOriginUrl, translationRef as weblateTranslationRef, unitState as weblateUnitState, type WeblateProjection, type WeblateProjectionContext, } from "./providers/weblate/operations.js";
68
+ export { FAILING_CHECK_CLAUSE, UNIT_STATE_FILTERS, UNIT_TEXT_FIELDS, buildUnitQuery, exactClause as weblateExactClause, quoteQueryValue, stateClause as weblateStateClause, textClause as weblateTextClause, type UnitStateFilter, type UnitTextField, } from "./providers/weblate/query.js";
69
+ export { WeblateTransport, credentialFromPlaintext as weblateCredentialFromPlaintext, credentialInstance as weblateCredentialInstance, resultsOf, type WeblateCredential, } from "./providers/weblate/transport.js";
70
+ export { createWeblateTools, WEBLATE_TOOL_NAMES, } from "./providers/weblate/tools.js";
71
+ export { IntegrationProviderRegistry } from "./providers/registry.js";
72
+ export { serviceBoundaryOf, serviceResourceDenied, } from "./providers/shared/service-boundary.js";
73
+ export { IntegrationRepository } from "./repository.js";
74
+ export { DockerSecretKeyProvider, MemoryKeyProvider, type KeyProvider, } from "./secrets/key-provider.js";
75
+ export { SecretStore } from "./secrets/secret-store.js";
76
+ export { createToolKit, type ToolKitOptions } from "./tool-kit.js";
77
+ export { createIntegrationTools, INTEGRATION_TOOL_NAMES, integrationToolNames, } from "./tools.js";
78
+ export type * from "./types.js";
79
+ export { BitrixTransport, credentialFromPlaintext, type BitrixCredential, } from "./providers/bitrix24/transport.js";
80
+ //# sourceMappingURL=public-api.d.ts.map
@@ -1,4 +1,33 @@
1
1
  import type { CredentialSource, EncryptedSecretRecord, IntegrationAuditEntry, IntegrationCapability, IntegrationFile, IntegrationPolicyMode, IntegrationPrincipal, IntegrationProviderId, IntegrationServiceBoundary, StoredIntegration } from "./types.js";
2
+ /**
3
+ * The identity a binding had when a probe started against it. A verdict is only
4
+ * worth storing while the row still carries all four: any reconnect bumps the
5
+ * revision and may swap the secret, a mode switch names another profile, and
6
+ * either makes the older answer about a credential that is no longer in use.
7
+ *
8
+ * The row id is part of that identity because the revision alone does not
9
+ * separate a replaced connection from a new one: `disconnect` deletes the row
10
+ * and the next `connect` mints a fresh id with the revision restarted at its
11
+ * column default. A service binding that holds no personal credential then
12
+ * matches on every other field — no secret, the same profile, revision 1 — so a
13
+ * verdict written before the disconnect would land on the healthy connection
14
+ * that took its place.
15
+ */
16
+ export interface IntegrationBindingGeneration {
17
+ readonly bindingId: string;
18
+ readonly bindingRevision: number;
19
+ readonly secretRef: string | null;
20
+ readonly serviceProfileId: string | null;
21
+ }
22
+ /**
23
+ * How a write guarded by a binding generation turned out. `stale` and `missing`
24
+ * both mean nothing was written, and both are the caller's refusal to make, but
25
+ * they are two different stories for whoever reads the log afterwards: the
26
+ * first is a probe that lost the connection to a newer generation of it, the
27
+ * second is a connection that was disconnected and never made again. Filing
28
+ * them under one key leaves the reader to work out which race happened.
29
+ */
30
+ export type IntegrationWriteFate = "applied" | "stale" | "missing";
2
31
  /**
3
32
  * Durable plugin-owned store, as tables. Every lookup starts from principal +
4
33
  * provider, which is the pair the unique index covers, so a lookup reads the
@@ -19,7 +48,21 @@ export declare class IntegrationRepository {
19
48
  /** The whole store, for maintenance surfaces that need the aggregate. */
20
49
  read(): IntegrationFile;
21
50
  find(principal: IntegrationPrincipal, provider: IntegrationProviderId): StoredIntegration | undefined;
51
+ /** Whether this account explicitly disconnected this provider. */
52
+ serviceOptedOut(principal: IntegrationPrincipal, provider: IntegrationProviderId): boolean;
22
53
  secretFor(principal: IntegrationPrincipal, provider: IntegrationProviderId): EncryptedSecretRecord | undefined;
54
+ /**
55
+ * The secret one binding's reference names, for the account that asked for it.
56
+ * Like every other lookup in this store it starts from principal + provider —
57
+ * a bare reference would be a way to unlock any account's credential from
58
+ * anywhere the id is readable — and the reference then picks which generation
59
+ * of that connection is being unlocked: it is honored only while the live row
60
+ * still carries it. A probe asked for the credential of the binding it started
61
+ * from, so looked up by principal and provider alone it would spend whatever
62
+ * took that binding's place and file a verdict about a connection the
63
+ * generation guard has no reason to accept.
64
+ */
65
+ secretByRef(principal: IntegrationPrincipal, provider: IntegrationProviderId, secretRef: string | null): EncryptedSecretRecord | undefined;
23
66
  policy(integration: StoredIntegration, operation: IntegrationCapability): IntegrationPolicyMode;
24
67
  connect(options: {
25
68
  principal: IntegrationPrincipal;
@@ -38,12 +81,30 @@ export declare class IntegrationRepository {
38
81
  credentialSource?: CredentialSource;
39
82
  serviceProfileId?: string | null;
40
83
  }): StoredIntegration;
41
- updateValidation(principal: IntegrationPrincipal, provider: IntegrationProviderId, success: boolean, errorCode: string | null, capabilities?: readonly IntegrationCapability[]): void;
84
+ /**
85
+ * Record one validation verdict, optionally with the capabilities the probe
86
+ * found. `expected` is the binding the probe was started against: a verdict
87
+ * that lands after a reconnect or a mode switch describes the credential that
88
+ * used to be there, so the write is compare-and-swapped against that row — its
89
+ * id, revision, secret reference and profile, read from the same principal and
90
+ * provider the lookup always starts from — and the answer says whether it
91
+ * arrived, and if not whether the row had moved on or had gone away.
92
+ */
93
+ updateValidation(principal: IntegrationPrincipal, provider: IntegrationProviderId, success: boolean, errorCode: string | null, capabilities: readonly IntegrationCapability[] | undefined, expected: IntegrationBindingGeneration): IntegrationWriteFate;
42
94
  /**
43
95
  * Move a binding between credential sources without touching upstream. The
44
96
  * binding revision is bumped, so everything derived from the previous identity
45
97
  * — caches, cursors, prepared actions — is stale from this moment on; the
46
98
  * personal credential, if there is one, stays stored but unused.
99
+ *
100
+ * `expected` is the generation the caller read before it reached upstream for
101
+ * the switch, and the write only lands while that row is still the live one
102
+ * under the same revision and credential: a reconnect that happened inside the
103
+ * probe's await would otherwise file the replaced token's identity and grant
104
+ * onto the connection that took its place. The profile is deliberately not part
105
+ * of the comparison — naming another one is what this call is for. The answer
106
+ * is the fate of the write: whoever asked reports a switch that did not happen
107
+ * either way, and only the log tells a moved binding from a deleted one.
47
108
  */
48
109
  setCredentialSource(options: {
49
110
  principal: IntegrationPrincipal;
@@ -54,7 +115,8 @@ export declare class IntegrationRepository {
54
115
  tenantId: string;
55
116
  externalUserId: string;
56
117
  displayName: string;
57
- }): StoredIntegration | undefined;
118
+ expected: IntegrationBindingGeneration;
119
+ }): IntegrationWriteFate;
58
120
  /** Store what this binding narrows the profile's allowlist to. */
59
121
  setServiceSelection(principal: IntegrationPrincipal, provider: IntegrationProviderId, selection: IntegrationServiceBoundary | null): void;
60
122
  /** Record which profile revision the binding was last resolved against. */
@@ -1,4 +1,5 @@
1
1
  import z from "@deepseek-ai/schemastery";
2
+ import type { ServiceRateLimitConfig } from "./types.js";
2
3
  /**
3
4
  * One deployment-managed credential, as it appears under
4
5
  * `managedServiceCredentials.profiles[]` in YAML. Everything here is operator
@@ -28,11 +29,25 @@ export interface ManagedServiceCredentialProfileInput {
28
29
  /** Administrator narrowing of the service ceiling. Only `deny` is accepted. */
29
30
  readonly policy?: Readonly<Record<string, string | undefined>>;
30
31
  }
32
+ /**
33
+ * Operator request ceiling of the service mode; §27 of
34
+ * `docs/specs/managed-service-credentials.md`.
35
+ */
36
+ export interface ManagedServiceRateLimitInput {
37
+ readonly perPrincipal?: {
38
+ readonly requestsPerMinute?: number | undefined;
39
+ } | undefined;
40
+ readonly perCredential?: {
41
+ readonly requestsPerMinute?: number | undefined;
42
+ readonly maxConcurrent?: number | undefined;
43
+ } | undefined;
44
+ }
31
45
  export interface ManagedServiceCredentialsInput {
32
46
  readonly enabled?: boolean;
33
47
  /** Whether a new connection starts in service mode when a profile exists. */
34
48
  readonly defaultForNewConnections?: boolean;
35
49
  readonly profiles?: readonly ManagedServiceCredentialProfileInput[];
50
+ readonly rateLimit?: ManagedServiceRateLimitInput | undefined;
36
51
  }
37
52
  export interface ManagedServiceCredentialProfileConfig {
38
53
  readonly id: string;
@@ -49,7 +64,14 @@ export interface ManagedServiceCredentialsConfig {
49
64
  readonly enabled: boolean;
50
65
  readonly defaultForNewConnections: boolean;
51
66
  readonly profiles: readonly ManagedServiceCredentialProfileConfig[];
67
+ readonly rateLimit: ServiceRateLimitConfig;
52
68
  }
69
+ /**
70
+ * The design document's own §27 example, used as the shipped ceiling: a service
71
+ * credential is shared, so an unconfigured deployment is the case that needs
72
+ * the limit most. An operator who wants a dimension unbounded sets it to `0`.
73
+ */
74
+ export declare const DEFAULT_SERVICE_RATE_LIMIT: ServiceRateLimitConfig;
53
75
  export declare const MANAGED_SERVICE_CREDENTIALS_DEFAULTS: Readonly<{
54
76
  enabled: false;
55
77
  defaultForNewConnections: true;
@@ -0,0 +1,66 @@
1
+ import { IntegrationError } from "../errors.js";
2
+ import type { ServiceRateLimitConfig } from "./types.js";
3
+ export interface ServiceCallKeys {
4
+ readonly principal: string;
5
+ readonly provider: string;
6
+ /** The managed credential the call spends: the shared side of the limit. */
7
+ readonly profileId: string;
8
+ }
9
+ /** Which ceiling refused, for the operator-facing log line only. */
10
+ export type ServiceRateLimitReason = "principal" | "concurrency" | "credential";
11
+ export declare class ServiceRateLimitError extends IntegrationError {
12
+ readonly reason: ServiceRateLimitReason;
13
+ constructor(reason: ServiceRateLimitReason);
14
+ }
15
+ /**
16
+ * Refill-on-read limiting of service-mode calls.
17
+ *
18
+ * A managed credential is one upstream identity shared by every user of the
19
+ * deployment, so the ceiling that protects it has to be two-sided at once: one
20
+ * principal must not exhaust the shared quota, and the shared quota must not be
21
+ * multiplied per principal. Both buckets are therefore read before either is
22
+ * written — a call refused by the shared ceiling leaves the individual balance
23
+ * untouched and one refused by the individual ceiling leaves the shared balance
24
+ * untouched. Otherwise a noisy user would pay for the bottleneck they create
25
+ * with everybody else's allowance.
26
+ *
27
+ * A bucket holds `requestsPerMinute` tokens and refills at that rate, so the
28
+ * allowance is spent continuously rather than reset on a wall-clock minute: a
29
+ * burst may take a full minute of requests and is then throttled to the steady
30
+ * rate. A rate of `0` disables that dimension.
31
+ *
32
+ * State lives in this process only, which is where the only path to a managed
33
+ * credential lives.
34
+ */
35
+ export declare class ServiceRateLimiter {
36
+ private readonly now;
37
+ private readonly principals;
38
+ private readonly credentials;
39
+ private readonly inflight;
40
+ private readonly maxTrackedKeys;
41
+ private config;
42
+ constructor(config: ServiceRateLimitConfig, now?: () => number, options?: {
43
+ readonly maxTrackedKeys?: number;
44
+ });
45
+ /**
46
+ * Take in new operator values. Balances survive: re-tuning a limit must not
47
+ * hand a fresh minute of requests to everyone at once.
48
+ */
49
+ configure(config: ServiceRateLimitConfig): void;
50
+ /**
51
+ * Spend one request or refuse it. The returned function gives the concurrency
52
+ * slot back and is safe to call more than once, because the caller releases it
53
+ * from a `finally` that may have run already.
54
+ */
55
+ acquire(keys: ServiceCallKeys): () => void;
56
+ private spend;
57
+ /**
58
+ * Free room for a new principal. A stored balance only refills when it is
59
+ * read, so "idle" is measured against now rather than against what is in the
60
+ * entry: a bucket that has earned its whole allowance back is equivalent to
61
+ * an absent one, and forgetting it costs nobody anything. If every entry is
62
+ * still spending, the longest untouched one goes.
63
+ */
64
+ private retire;
65
+ }
66
+ //# sourceMappingURL=rate-limit.d.ts.map
@@ -43,6 +43,24 @@ export declare const UNCLASSIFIED_OPERATION: OperationSecurityMetadata;
43
43
  * contract because it crosses the remote boundary as well.
44
44
  */
45
45
  export type ServiceResourceBoundary = IntegrationServiceBoundary;
46
+ /**
47
+ * Request ceiling of the service mode, as operator configuration resolves it.
48
+ * A rate of `0` leaves that dimension unbounded.
49
+ */
50
+ export interface ServiceRateLimitConfig {
51
+ /** What one real user may ask of one provider through any managed credential. */
52
+ readonly perPrincipal: {
53
+ readonly requestsPerMinute: number;
54
+ };
55
+ /**
56
+ * What one shared upstream identity may carry in total, and how many calls
57
+ * may be in flight against it at once.
58
+ */
59
+ readonly perCredential: {
60
+ readonly requestsPerMinute: number;
61
+ readonly maxConcurrent: number;
62
+ };
63
+ }
46
64
  /**
47
65
  * One administrator-managed credential. It belongs to the deployment, not to a
48
66
  * user: a user cannot create one, cannot change its secret, cannot move its
@@ -1,11 +1,37 @@
1
1
  import { type ParameterSchemaSpec, type ToolDefinition, type ToolRunContext } from "@deepseek-ai/dsh-tools";
2
2
  import type { IntegrationBroker } from "./broker.js";
3
+ import type { OperationSecurityMetadata } from "./service-credentials/types.js";
3
4
  import type { IntegrationPrincipal, IntegrationProviderId } from "./types.js";
4
5
  type ToolExecution = Pick<ToolRunContext, "agent">;
5
- export interface ToolKitOptions {
6
+ /**
7
+ * What a provider's tool factory takes from the deployment. One type for all
8
+ * seven, so no factory can be built on a broker alone and go on describing a
9
+ * managed credential this stand never issues.
10
+ */
11
+ export interface ProviderToolFactoryOptions {
6
12
  readonly broker: IntegrationBroker;
7
13
  readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
+ /**
15
+ * Whether this deployment hands out managed service credentials at all. The
16
+ * ceiling is a property of those credentials, so with the slice off a warning
17
+ * about it would send a model away from a reading its own personal connection
18
+ * does answer — the symptom #285 is about, caused by the warning itself. The
19
+ * operator card drops the same note for the same reason.
20
+ */
21
+ readonly managedServiceCredentialsEnabled: boolean;
22
+ }
23
+ export interface ToolKitOptions extends ProviderToolFactoryOptions {
8
24
  readonly provider: IntegrationProviderId;
25
+ /**
26
+ * The provider's own catalog. A tool reads its operation's classification from
27
+ * it and warns in its description when the managed service credential will
28
+ * refuse that reading, so the condition the ceiling enforces is what the model
29
+ * is told before it tries — and a reclassified operation cannot leave the
30
+ * description behind.
31
+ */
32
+ readonly operations: Readonly<Record<string, {
33
+ readonly security: OperationSecurityMetadata;
34
+ }>>;
9
35
  }
10
36
  /**
11
37
  * Shared plumbing for provider tool modules. It owns the one security-relevant
@@ -1,25 +1,42 @@
1
1
  import type { ToolDefinition } from "@deepseek-ai/dsh-tools";
2
2
  import type { IntegrationBroker } from "./broker.js";
3
- import type { IntegrationPrincipal } from "./types.js";
3
+ import type { IntegrationPrincipal, IntegrationProviderId } from "./types.js";
4
4
  export interface IntegrationToolOptions {
5
5
  readonly broker: IntegrationBroker;
6
6
  readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
7
7
  /** Mount the Bitrix24 timeline-comment tool; default stays read-only. */
8
8
  readonly bitrix24CrmCommentWrite?: boolean;
9
+ /**
10
+ * Whether this deployment hands out managed service credentials, which is what
11
+ * decides whether a tool warns about the ceiling those credentials meet. Off
12
+ * by default: a stand without a shared token has no ceiling to describe, and a
13
+ * tool that claimed one would talk a model out of a reading its own personal
14
+ * connection answers.
15
+ */
16
+ readonly managedServiceCredentialsEnabled?: boolean;
17
+ /**
18
+ * The providers this deployment actually enables. Absent means every one,
19
+ * which is what a caller that has no configuration to speak of asks for;
20
+ * present means the tools of a provider the operator switched off are neither
21
+ * mounted nor admitted.
22
+ */
23
+ readonly enabledProviders?: readonly IntegrationProviderId[];
9
24
  }
10
25
  /**
11
- * Model-facing tool names of every enabled provider, in registration order. The
12
- * QA surface admits exactly these names as principal-scoped, so this list is the
13
- * single place where the tool surface is declared.
26
+ * Model-facing tool names of every provider the code knows about, in
27
+ * registration order. The QA surface admits exactly these names as
28
+ * principal-scoped, so this list is the single place where the tool surface is
29
+ * declared; `integrationToolNames` is what narrows it to one deployment.
14
30
  */
15
31
  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", "testit_connection_get", "testit_projects", "testit_project_get", "testit_sections", "testit_work_items", "testit_work_item_get", "testit_work_item_history", "testit_work_item_comments", "testit_work_item_test_results", "testit_test_plans", "testit_test_plan_get", "testit_test_plan_summary", "testit_test_runs", "testit_test_run_get", "testit_test_run_results", "testit_test_result_get", "testit_test_result_attachments", "testit_attachment_metadata", "testit_attachment_text", "testit_auto_tests", "testit_auto_test_get", "testit_configurations", "weblate_connection_get", "weblate_projects_list", "weblate_project_get", "weblate_project_statistics_get", "weblate_components_list", "weblate_component_get", "weblate_component_statistics_get", "weblate_translations_list", "weblate_translation_get", "weblate_translation_statistics_get", "weblate_units_search", "weblate_units_find", "weblate_unit_get", "weblate_unit_comments_list", "weblate_unit_suggestions_list", "weblate_failing_units_list", "weblate_changes_list", "weblate_screenshots_list", "weblate_screenshot_get"];
32
+ export type IntegrationToolNamesOptions = Pick<IntegrationToolOptions, "bitrix24CrmCommentWrite" | "enabledProviders">;
16
33
  /**
17
- * The names to admit and mount for one deployment: the read-only catalog plus,
18
- * only when the operator switched it on, the Bitrix24 timeline comment. The
19
- * mount and the admission list must always be derived through this function so
20
- * the two cannot drift apart.
34
+ * The names to admit and mount for one deployment: the read-only catalog of the
35
+ * providers it enables plus, only when the operator switched it on, the Bitrix24
36
+ * timeline comment. The mount and the admission list must always be derived
37
+ * through this function so the two cannot drift apart.
21
38
  */
22
- export declare function integrationToolNames(options?: Pick<IntegrationToolOptions, "bitrix24CrmCommentWrite">): readonly string[];
39
+ export declare function integrationToolNames(options?: IntegrationToolNamesOptions): readonly string[];
23
40
  /** Provider tool modules, composed into one registration list. */
24
41
  export declare function createIntegrationTools(options: IntegrationToolOptions): readonly ToolDefinition[];
25
42
  //# sourceMappingURL=tools.d.ts.map
@@ -120,10 +120,20 @@ export interface IntegrationSummary {
120
120
  readonly externalAccountName: string | null;
121
121
  readonly credentialConfigured: boolean;
122
122
  readonly credentialUpdatedAt: string | null;
123
+ /**
124
+ * What the connection may use as it stands: the stored grant, minus anything
125
+ * this deployment has since withdrawn from the provider. {@link policy} is
126
+ * built from this list, so a capability missing here is one a call would
127
+ * refuse. A withdrawn capability keeps its row on the card, because that list
128
+ * is drawn from {@link capabilityInfo} — the provider's catalog, not this
129
+ * grant — but the row is rendered unavailable and carries no switch.
130
+ */
123
131
  readonly capabilities: readonly IntegrationCapability[];
124
132
  /**
125
133
  * Labels and hints for every capability the provider declares, so a client
126
- * can render a provider it has never heard of.
134
+ * can render a provider it has never heard of. This is the catalog, not the
135
+ * grant: whether a row is offered as usable is decided by
136
+ * {@link capabilities}.
127
137
  */
128
138
  readonly capabilityInfo: Readonly<Record<IntegrationCapability, IntegrationCapabilityInfo>>;
129
139
  /**
@@ -181,8 +191,12 @@ export interface StoredIntegration {
181
191
  /** Managed profile this binding resolves to, when it runs in service mode. */
182
192
  readonly serviceProfileId: string | null;
183
193
  /**
184
- * Incremented on every credential-mode switch. Cache keys, cursors and pending
185
- * actions are bound to it, so switching modes invalidates them all at once.
194
+ * Incremented on every reconnect and on every credential-mode switch. Cache
195
+ * keys, cursors, pending actions and validation verdicts are bound to it, so
196
+ * either move invalidates everything derived from the previous identity —
197
+ * including a re-save of the profile the binding already ran under. It counts
198
+ * from one again on a binding made after a disconnect, which is why a write-back
199
+ * compares the row it names as well (`IntegrationBindingGeneration`).
186
200
  */
187
201
  readonly bindingRevision: number;
188
202
  /** What this binding narrows the profile's allowlist to, if anything. */