@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
@@ -2,11 +2,11 @@ import type { Context } from "@deepseek-ai/cordis";
2
2
  import { TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
3
3
  import type { QaSurface } from "@yadsh/dsh-qa-surface";
4
4
  import { IntegrationBroker } from "./broker.js";
5
- import { type QaIntegrationsConfig } from "./config.js";
5
+ import { type LiveQaIntegrationsConfig } from "./config.js";
6
6
  import type { CredentialSource, IntegrationInstanceSummary, ServiceCredentialHealth, IntegrationProviderId, IntegrationProviderSummary, IntegrationServiceBoundary, IntegrationSummary, PolicyPatch } from "./types.js";
7
7
  export declare const name = "dsh-qa-integrations";
8
8
  export declare const inject: readonly ["qaSurface", "tools"];
9
- export declare const Config: import("@deepseek-ai/schemastery").default<QaIntegrationsConfig>;
9
+ export declare const Config: import("@deepseek-ai/schemastery").default<import("./config.js").QaIntegrationsConfig, LiveQaIntegrationsConfig>;
10
10
  type IntegrationsContext = Context & {
11
11
  readonly qaSurface: QaSurface;
12
12
  };
@@ -18,7 +18,7 @@ declare module "@deepseek-ai/cordis" {
18
18
  /** Host remote, broker owner, and registration point for read-only tools. */
19
19
  export declare class QaIntegrations extends TypertRemoteService {
20
20
  static inject: readonly ["qaSurface", "tools"];
21
- static Config: import("@deepseek-ai/schemastery").default<QaIntegrationsConfig>;
21
+ static Config: import("@deepseek-ai/schemastery").default<import("./config.js").QaIntegrationsConfig, LiveQaIntegrationsConfig>;
22
22
  readonly broker: IntegrationBroker;
23
23
  private readonly logger;
24
24
  private readonly owner;
@@ -43,13 +43,13 @@ export declare class QaIntegrations extends TypertRemoteService {
43
43
  /** The Bitrix24 portals this deployment allows, in config order. */
44
44
  private configuredBitrix24Portals;
45
45
  /**
46
- * The composition row the Host resolved at load. It stays the base of the
47
- * settings section, and the configuration source until the namespace takes
48
- * over, so a deployment without a settings provider keeps booting on it.
46
+ * The configuration source is the plugin's own profile entry: on a 0.1.7
47
+ * host the entry id *is* the settings namespace, and a field the operator
48
+ * card may edit is a volatile node in `ConfigSchema` rather than a section
49
+ * installed beside it. A composition without a settings surface keeps the
50
+ * same source, so nothing here depends on the surface being reachable.
49
51
  */
50
- private readonly entryConfig;
51
- /** Where the live configuration is read from; the settings namespace swaps this. */
52
- private configSource;
52
+ private readonly liveConfig;
53
53
  /**
54
54
  * The connection store and its key live for the whole process: connections
55
55
  * and wrapped secrets belong to the boot path, and only derivations of the
@@ -64,7 +64,7 @@ export declare class QaIntegrations extends TypertRemoteService {
64
64
  private toolRemovers;
65
65
  /** The mounted tool-name list; an unchanged signature never re-registers. */
66
66
  private toolsKey;
67
- constructor(ctx: IntegrationsContext, rawConfig?: QaIntegrationsConfig);
67
+ constructor(ctx: IntegrationsContext, rawConfig: LiveQaIntegrationsConfig);
68
68
  /**
69
69
  * Rebuild every configuration-derived surface: the provider registry, the
70
70
  * deployment instance lists, the service-credential registry and the tool
@@ -74,24 +74,29 @@ export declare class QaIntegrations extends TypertRemoteService {
74
74
  */
75
75
  private applyConfig;
76
76
  /**
77
- * Mount the tools the configuration asks for. The mounted set changes only
78
- * when the plugin or its one write capability flips, so an unrelated card
79
- * edit never churns the Host tool registry.
77
+ * Mount the tools the configuration asks for. The mounted surface changes only
78
+ * when the plugin, its one write capability, or the managed service credential
79
+ * flips, so an unrelated card edit never churns the Host tool registry.
80
80
  */
81
81
  private syncTools;
82
82
  /**
83
- * Attach the settings namespace. The installed section becomes the plugin's
84
- * configuration source, so an operator card edit re-applies the running
85
- * service instead of waiting for a restart; without a settings provider the
86
- * composition entry stays authoritative. The read is structural and optional:
87
- * a Host without a mounted settings provider keeps this plugin fully working.
83
+ * Keep the running service in step with the settings namespace this entry
84
+ * owns. There is nothing to install: the namespace *is* the profile entry,
85
+ * and the Host serves whatever `ConfigSchema` marks `.volatile()`. Two things
86
+ * are left to do — decline the generated page the Host would otherwise draw
87
+ * for it, because this plugin ships its own operator card, and re-apply when
88
+ * a committed edit lands on the live references. The read is structural and
89
+ * optional: a Host without a mounted settings provider keeps this plugin
90
+ * fully working.
88
91
  */
89
- private installSettings;
92
+ private watchSettings;
90
93
  /**
91
94
  * Re-resolve the source after a committed settings change and rebuild what
92
- * derives from it. A source the resolvers refuse keeps the running state:
93
- * the settings provider validates on write, so this only covers a value
94
- * that arrived through another path.
95
+ * derives from it. The Host validates an edit against `ConfigSchema` before
96
+ * it persists, so the resolvers here only refuse what a schema node cannot
97
+ * express — a TeamCity host pattern that matches nothing, an instance list
98
+ * with a duplicate id. Such a value keeps the running state and is logged
99
+ * rather than half-applied.
95
100
  */
96
101
  private reapply;
97
102
  describe(): {
@@ -111,11 +116,6 @@ export declare class QaIntegrations extends TypertRemoteService {
111
116
  testBitrix24(token: string): Promise<IntegrationSummary>;
112
117
  patchBitrix24Policy(token: string, patch: PolicyPatch): IntegrationSummary;
113
118
  disconnectBitrix24(token: string): boolean;
114
- /**
115
- * Instances this deployment allows. The connect form picks from this list and
116
- * never takes a hostname, which is what keeps the broker from being pointed at
117
- * an origin the operator did not configure.
118
- */
119
119
  gitlabInstances(token: string): readonly IntegrationInstanceSummary[];
120
120
  getGitlab(token: string): IntegrationSummary;
121
121
  putGitlabCredential(token: string, input: {
@@ -127,11 +127,6 @@ export declare class QaIntegrations extends TypertRemoteService {
127
127
  testGitlab(token: string): Promise<IntegrationSummary>;
128
128
  patchGitlabPolicy(token: string, patch: PolicyPatch): IntegrationSummary;
129
129
  disconnectGitlab(token: string): boolean;
130
- /**
131
- * Sites this deployment allows. The connect form picks from this list and
132
- * never takes a hostname, which is what keeps the broker from being pointed
133
- * at an origin the operator did not configure.
134
- */
135
130
  confluenceSites(token: string): readonly IntegrationInstanceSummary[];
136
131
  getConfluence(token: string): IntegrationSummary;
137
132
  /**
@@ -175,12 +170,6 @@ export declare class QaIntegrations extends TypertRemoteService {
175
170
  testTeamcity(token: string): Promise<IntegrationSummary>;
176
171
  patchTeamcityPolicy(token: string, patch: PolicyPatch): IntegrationSummary;
177
172
  disconnectTeamcity(token: string): boolean;
178
- /**
179
- * Sites this deployment allows. Like the GitLab instance list, the connect
180
- * form picks from it and never takes a hostname: the Atlassian site a token is
181
- * spent against is operator configuration, and the e-mail the form collects
182
- * next to the token is an identity, not a secret.
183
- */
184
173
  jiraSites(token: string): readonly IntegrationInstanceSummary[];
185
174
  getJira(token: string): IntegrationSummary;
186
175
  putJiraCredential(token: string, input: {
@@ -197,11 +186,6 @@ export declare class QaIntegrations extends TypertRemoteService {
197
186
  testJira(token: string): Promise<IntegrationSummary>;
198
187
  patchJiraPolicy(token: string, patch: PolicyPatch): IntegrationSummary;
199
188
  disconnectJira(token: string): boolean;
200
- /**
201
- * Installations this deployment allows. Like the GitLab instance list, the
202
- * connect form picks from it and never takes a hostname: the Test IT address a
203
- * token is spent against is operator configuration.
204
- */
205
189
  testitInstances(token: string): readonly IntegrationInstanceSummary[];
206
190
  getTestit(token: string): IntegrationSummary;
207
191
  putTestitCredential(token: string, input: {
@@ -213,11 +197,6 @@ export declare class QaIntegrations extends TypertRemoteService {
213
197
  testTestit(token: string): Promise<IntegrationSummary>;
214
198
  patchTestitPolicy(token: string, patch: PolicyPatch): IntegrationSummary;
215
199
  disconnectTestit(token: string): boolean;
216
- /**
217
- * Instances this deployment allows. The connect form picks from this list and
218
- * never takes a hostname, which is what keeps the broker from being pointed at
219
- * an origin the operator did not configure.
220
- */
221
200
  weblateInstances(token: string): readonly IntegrationInstanceSummary[];
222
201
  getWeblate(token: string): IntegrationSummary;
223
202
  putWeblateCredential(token: string, input: {
@@ -266,78 +245,36 @@ export declare class QaIntegrations extends TypertRemoteService {
266
245
  }): Promise<ServiceCredentialHealth | null>;
267
246
  /** The safe alias of the managed credential bound to one instance, if any. */
268
247
  private serviceBinding;
248
+ /**
249
+ * The six calls one provider's connect card makes, and the fields that card
250
+ * spends. What a provider owns is the address list it offers and the fields
251
+ * its form collects; the questions the card asks the broker — what is bound,
252
+ * does the credential still reach the upstream, narrow its policy, let it go —
253
+ * are the same seven times over, and a copy per provider is where the seventh
254
+ * starts answering one of them differently.
255
+ */
256
+ private summaryOf;
257
+ private validateOf;
258
+ private patchPolicyOf;
259
+ private disconnectOf;
260
+ /**
261
+ * The endpoints this deployment declared for one provider. A connect form
262
+ * picks from this list and never takes a hostname, which is what keeps the
263
+ * broker from being pointed at an origin the operator did not configure.
264
+ * TeamCity answers with the single server or `null`, so the row shape is the
265
+ * caller's.
266
+ */
267
+ private endpointsOf;
268
+ /** Spend one connect form's fields on a provider's credential. */
269
+ private putCredentialOf;
269
270
  private requirePrincipal;
270
271
  private run;
271
272
  private runAsync;
272
273
  }
273
- export { IntegrationBroker } from "./broker.js";
274
- export { ConfigSchema, resolveConfig, type QaIntegrationsConfig, type ResolvedQaIntegrationsConfig, } from "./config.js";
275
- export { MANAGED_SERVICE_CREDENTIALS_DEFAULTS, managedServiceCredentialsSchema, resolveManagedServiceCredentials, type ManagedServiceCredentialProfileConfig, type ManagedServiceCredentialProfileInput, type ManagedServiceCredentialsConfig, type ManagedServiceCredentialsInput, } from "./service-credentials/config.js";
276
- export { evaluateServiceOperation, narrowBoundary, SERVICE_CEILING, type ServiceOperationQuery, type ServicePolicyDecision, } from "./service-credentials/policy.js";
277
- export { ServiceCredentialRegistry } from "./service-credentials/registry.js";
278
- export { operationCapabilityServiceState } from "./service-credentials/state.js";
279
- export { profilePolicyRevision } from "./service-credentials/config.js";
280
- 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";
281
- export { IntegrationError } from "./errors.js";
282
- export { BITRIX_CAPABILITIES, BITRIX_OPERATIONS, BITRIX24_CAPABILITY_INFO, bitrix24OperationCapability, enabledCapabilities, type Bitrix24Capability, type Bitrix24CapabilityDefinition, type BitrixOperationDefinition, } from "./providers/bitrix24/catalog.js";
283
- export { BITRIX24_DEFAULTS, bitrix24ConfigSchema, resolveBitrix24Config, type Bitrix24Flags, } from "./providers/bitrix24/config.js";
284
- export { Bitrix24Provider, parseBitrixWebhook, } from "./providers/bitrix24/index.js";
285
- export { BITRIX_HANDLERS, BITRIX_PROJECTIONS, } from "./providers/bitrix24/operations.js";
286
- export { createBitrix24Tools, BITRIX24_TOOL_NAMES, } from "./providers/bitrix24/tools.js";
287
- export { GitlabProvider, groupAllowed as gitlabGroupAllowed, projectAllowed as gitlabProjectAllowed, } from "./providers/gitlab/index.js";
288
- 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";
289
- export { GITLAB_DEFAULTS, gitlabConfigSchema, resolveGitlabConfig, type GitlabConfigInput, type GitlabFlags, type GitlabInstance, } from "./providers/gitlab/config.js";
290
- export { createGitlabTools, GITLAB_TOOL_NAMES, } from "./providers/gitlab/tools.js";
291
- export { GitlabTransport, credentialFromPlaintext as gitlabCredentialFromPlaintext, credentialInstance, type GitlabCredential, } from "./providers/gitlab/transport.js";
292
- export { GITLAB_HANDLERS, GITLAB_PROJECTIONS, } from "./providers/gitlab/operations.js";
293
- export { ConfluenceProvider } from "./providers/confluence/index.js";
294
- export { adfToText as confluenceAdfToText, textBudget, } from "./providers/confluence/adf.js";
295
- export { CONFLUENCE_CAPABILITIES, CONFLUENCE_CAPABILITY_INFO, CONFLUENCE_OPERATIONS, confluenceOperationCapability, type ConfluenceCapability, type ConfluenceCapabilityDefinition, type ConfluenceOperationDefinition, } from "./providers/confluence/catalog.js";
296
- export { CONFLUENCE_DEFAULTS, confluenceConfigSchema, resolveConfluenceConfig, spaceAllowed, type ConfluenceFlags, type ConfluenceInstance, } from "./providers/confluence/config.js";
297
- export { buildCql, cqlLiteral, CONTENT_TYPES, ORDER_BY, type ConfluenceOrder, type ConfluenceSearchFilter, } from "./providers/confluence/cql.js";
298
- 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";
299
- export { createConfluenceTools, CONFLUENCE_TOOL_NAMES, } from "./providers/confluence/tools.js";
300
- export { ConfluenceTransport, credentialFromPlaintext as confluenceCredentialFromPlaintext, credentialInstance as confluenceCredentialInstance, type ConfluenceCredential, } from "./providers/confluence/transport.js";
301
- export { TeamcityProvider, buildTypeAllowed as teamcityBuildTypeAllowed, projectAllowed as teamcityProjectAllowed, } from "./providers/teamcity/index.js";
302
- 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";
303
- export { TEAMCITY_DEFAULTS, DEFAULT_LOG_LINES, resolveTeamCityConfig, teamcityConfigSchema, type TeamCityConfigInput, type TeamCityFlags, } from "./providers/teamcity/config.js";
304
- export { artifactBinaryProblem, artifactByteLimit, artifactPath, textArtifact, type ArtifactPath, } from "./providers/teamcity/artifacts.js";
305
- export { LOG_MODES, logLines, logMode, sanitizeLog, selectLogWindow, trimToBytes, type LogMode, type LogWindow, } from "./providers/teamcity/logs.js";
306
- export { PRIVATE_CIDRS, canonicalServerUrl, cidrProblem, hostPatternProblem, isIpLiteral, serverUrlProblem, type TeamCityNetworkMode, type TeamCityNetworkPolicy, } from "./providers/teamcity/network.js";
307
- export { buildBuildLocator, dimension, joinDimensions, locatorValue, nested, teamCityDate, type BuildLocatorInput, } from "./providers/teamcity/locators.js";
308
- export { TEAMCITY_HANDLERS, TEAMCITY_LIMITS, TEAMCITY_PROJECTIONS, isoDate, listLimit, type TeamCityProjection, type TeamCityRequest, } from "./providers/teamcity/operations.js";
309
- export { TeamCityTransport, configuredServer as teamcityConfiguredServer, credentialFromPlaintext as teamcityCredentialFromPlaintext, type TeamCityCredential, } from "./providers/teamcity/transport.js";
310
- export { createTeamcityTools, TEAMCITY_TOOL_NAMES, } from "./providers/teamcity/tools.js";
311
- export { JiraProvider } from "./providers/jira/index.js";
312
- 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";
313
- export { JIRA_DEFAULTS, SEARCH_PAGE_CAP, jiraConfigSchema, jiraSite, resolveJiraConfig, type JiraFlags, type JiraSite, } from "./providers/jira/config.js";
314
- export { adfToText as jiraAdfToText, bodyText, isAdf, type AdfText, } from "./providers/jira/adf.js";
315
- export { buildJql, commentLimit, commentStart, issueKey as jiraIssueKey, jqlDateValue, jqlLiteral, needsUserLookup, pageToken, projectKey as jiraProjectKey, searchLimit, textClauses, textMatch, type CustomFieldClause, } from "./providers/jira/jql.js";
316
- 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";
317
- export { JiraTransport, basicAuthorization, credentialFromPlaintext as jiraCredentialFromPlaintext, credentialSite, type JiraCredential, } from "./providers/jira/transport.js";
318
- export { createJiraTools, JIRA_TOOL_NAMES } from "./providers/jira/tools.js";
319
- export { TestitProvider } from "./providers/testit/index.js";
320
- 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";
321
- export { TESTIT_DEFAULTS, resolveTestitConfig, testitConfigSchema, testitInstance, type TestitFlags, type TestitInstance, } from "./providers/testit/config.js";
322
- export { assertReadableSize, attachmentBinaryProblem, attachmentByteLimit, attachmentExtension, attachmentName, } from "./providers/testit/attachments.js";
323
- 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";
324
- export { TestitTransport, credentialFromPlaintext as testitCredentialFromPlaintext, credentialInstance as testitCredentialInstance, type TestitCredential, type TestitPage, } from "./providers/testit/transport.js";
325
- export { createTestitTools, TESTIT_TOOL_NAMES, } from "./providers/testit/tools.js";
326
- export { WeblateProvider } from "./providers/weblate/index.js";
327
- export { WEBLATE_CAPABILITIES, WEBLATE_CAPABILITY_INFO, WEBLATE_OPERATIONS, enabledCapabilities as weblateEnabledCapabilities, weblateOperationCapability, type WeblateCapability, type WeblateCapabilityDefinition, type WeblateOperationDefinition, } from "./providers/weblate/catalog.js";
328
- export { WEBLATE_DEFAULTS, resolveWeblateConfig, weblateConfigSchema, weblateInstance, type WeblateFlags, type WeblateInstance, } from "./providers/weblate/config.js";
329
- 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";
330
- 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";
331
- export { WeblateTransport, credentialFromPlaintext as weblateCredentialFromPlaintext, credentialInstance as weblateCredentialInstance, resultsOf, type WeblateCredential, } from "./providers/weblate/transport.js";
332
- export { createWeblateTools, WEBLATE_TOOL_NAMES, } from "./providers/weblate/tools.js";
333
- export { IntegrationProviderRegistry } from "./providers/registry.js";
334
- export { serviceBoundaryOf, serviceResourceDenied, } from "./providers/shared/service-boundary.js";
335
- export { IntegrationRepository } from "./repository.js";
336
- export { DockerSecretKeyProvider, MemoryKeyProvider, type KeyProvider, } from "./secrets/key-provider.js";
337
- export { SecretStore } from "./secrets/secret-store.js";
338
- export { createToolKit, type ToolKitOptions } from "./tool-kit.js";
339
- export { createIntegrationTools, INTEGRATION_TOOL_NAMES, integrationToolNames, } from "./tools.js";
340
- export type * from "./types.js";
341
- export { BitrixTransport, credentialFromPlaintext, type BitrixCredential, } from "./providers/bitrix24/transport.js";
274
+ /**
275
+ * The published names of this package are listed once, in `public-api.ts`;
276
+ * re-exported here so the entry module stays the one thing a consumer resolves.
277
+ */
278
+ export * from "./public-api.js";
342
279
  export default QaIntegrations;
343
280
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,9 @@
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 BITRIX24_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"];
5
4
  /** The provider's single write tool; mounted only when the operator opts in. */
6
5
  export declare const BITRIX24_COMMENT_TOOL_NAME: "bitrix_add_crm_timeline_comment";
7
- export declare function createBitrix24Tools(options: {
8
- readonly broker: IntegrationBroker;
9
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
6
+ export declare function createBitrix24Tools(options: ProviderToolFactoryOptions & {
10
7
  /** Mount the timeline-comment write tool; default stays read-only. */
11
8
  readonly crmCommentWrite?: boolean;
12
9
  }): readonly ToolDefinition[];
@@ -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 CONFLUENCE_TOOL_NAMES: readonly ["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"];
5
4
  /**
6
5
  * Every tool reports what the *connected* Confluence account may read, never a
@@ -8,8 +7,5 @@ export declare const CONFLUENCE_TOOL_NAMES: readonly ["confluence_connection_get
8
7
  * QA user who owns the DSH session, and the tool schemas carry no user,
9
8
  * credential, e-mail or site selector.
10
9
  */
11
- export declare function createConfluenceTools(options: {
12
- readonly broker: IntegrationBroker;
13
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
- }): readonly ToolDefinition[];
10
+ export declare function createConfluenceTools(options: ProviderToolFactoryOptions): readonly ToolDefinition[];
15
11
  //# sourceMappingURL=tools.d.ts.map
@@ -56,11 +56,5 @@ export declare class ConfluenceTransport {
56
56
  getJson<T>(instance: ConfluenceInstance, credential: ConfluenceCredential, path: string, query?: ConfluenceQuery): Promise<ConfluenceJsonResponse<T>>;
57
57
  private url;
58
58
  private request;
59
- /**
60
- * Confluence answers a page the account may not see with the same 404 as a
61
- * page that does not exist, and the provider keeps that ambiguity: the model
62
- * must not learn from an error whether someone else's page is there.
63
- */
64
- private failure;
65
59
  }
66
60
  //# sourceMappingURL=transport.d.ts.map
@@ -56,6 +56,6 @@ export type GitlabConfigInput = Partial<GitlabFlags> & {
56
56
  */
57
57
  export declare const gitlabConfigSchema: z<GitlabConfigInput>;
58
58
  export declare function resolveGitlabConfig(input?: GitlabConfigInput): GitlabFlags;
59
- /** The configured instance a stored credential names, or a fail-closed error. */
59
+ /** The configured instance a stored credential names, or undefined. */
60
60
  export declare function gitlabInstance(flags: GitlabFlags, instanceId: string): GitlabInstance | undefined;
61
61
  //# sourceMappingURL=config.d.ts.map
@@ -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 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
4
  /**
6
5
  * Every tool reports what the *connected* GitLab account may read, never a
@@ -8,8 +7,5 @@ export declare const GITLAB_TOOL_NAMES: readonly ["gitlab_connection_get", "gitl
8
7
  * the 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 createGitlabTools(options: {
12
- readonly broker: IntegrationBroker;
13
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
- }): readonly ToolDefinition[];
10
+ export declare function createGitlabTools(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 GitlabFlags, type GitlabInstance } from "./config.js";
4
4
  /**
5
5
  * Encrypted credential payload of one GitLab connection: which configured
@@ -13,9 +13,8 @@ export interface GitlabCredential {
13
13
  }
14
14
  export declare function credentialFromPlaintext(plaintext: string): GitlabCredential;
15
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.
16
+ * The configured instance a credential belongs to: a credential minted for an
17
+ * instance the operator has since removed fails closed.
19
18
  */
20
19
  export declare function credentialInstance(flags: GitlabFlags, credential: GitlabCredential): GitlabInstance;
21
20
  export interface GitlabQuery {
@@ -47,6 +46,5 @@ export declare class GitlabTransport {
47
46
  getText(instance: GitlabInstance, token: string, path: string, query?: GitlabQuery, maxBytes?: number): Promise<GitlabTextResponse>;
48
47
  private url;
49
48
  private request;
50
- private failure;
51
49
  }
52
50
  //# sourceMappingURL=transport.d.ts.map
@@ -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 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
4
  /**
6
5
  * Every tool reports what the *connected* Jira account may read, never a
@@ -8,10 +7,7 @@ export declare const JIRA_TOOL_NAMES: readonly ["jira_get_current_user", "jira_s
8
7
  * integration of the QA user who owns the DSH session, and the tool schemas
9
8
  * carry no user, credential or site selector.
10
9
  */
11
- export declare function createJiraTools(options: {
12
- readonly broker: IntegrationBroker;
13
- readonly principalForSession: (sessionId: string) => IntegrationPrincipal | undefined;
14
- }): readonly ToolDefinition[];
10
+ export declare function createJiraTools(options: ProviderToolFactoryOptions): readonly ToolDefinition[];
15
11
  /** Field names a search answer carries, for documentation and tests. */
16
12
  export declare const JIRA_SEARCH_FIELDS: readonly string[];
17
13
  //# sourceMappingURL=tools.d.ts.map
@@ -23,9 +23,8 @@ export interface JiraCredential {
23
23
  }
24
24
  export declare function credentialFromPlaintext(plaintext: string): JiraCredential;
25
25
  /**
26
- * The configured site a credential belongs to. A credential minted for a site
27
- * the operator has since removed fails closed: it never falls back to another
28
- * site, however permissive that one is.
26
+ * The configured site a credential belongs to: a credential minted for a site
27
+ * the operator has since removed fails closed.
29
28
  */
30
29
  export declare function credentialSite(flags: JiraFlags, credential: JiraCredential): JiraSite;
31
30
  export type JiraQuery = Readonly<Record<string, string | number | boolean | undefined>>;
@@ -46,13 +45,5 @@ export declare class JiraTransport {
46
45
  getJson<T>(site: JiraSite, credential: JiraCredential, path: string, query?: JiraQuery): Promise<T>;
47
46
  private url;
48
47
  private request;
49
- /**
50
- * The provider error model. Jira answers a refused permission with 403 — a
51
- * permission scheme the connected user is not in, an issue security level, or
52
- * a project they cannot browse — and an unknown or invisible resource with
53
- * 404; both stay distinct so the model can tell "you may not" from "it is not
54
- * there". Neither answer ever carries the upstream body.
55
- */
56
- private failure;
57
48
  }
58
49
  //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The address policy shared by every provider: the operator declares the
3
+ * endpoints a deployment may be dialled at, a stored credential only names one
4
+ * of them, and a user never types a host — the connect form picks from the
5
+ * list, so the broker cannot be pointed at an arbitrary origin (the
6
+ * specification's SSRF rule) and a credential minted for a site cannot be spent
7
+ * against another.
8
+ *
9
+ * Canonicalization is the same question for every upstream — which id forms
10
+ * are legal, whether an address may be plain HTTP, which parts pasted onto a
11
+ * URL make it not an endpoint, how `<origin><path>` is folded — so one
12
+ * implementation answers it and a provider supplies only the words its config
13
+ * error carries and, when it differs from the shared shape, the extra row
14
+ * members it resolves itself.
15
+ */
16
+ /** The id shape every provider list shares. */
17
+ export declare const ENDPOINT_ID: RegExp;
18
+ /** How many endpoints one deployment may declare. */
19
+ export declare const MAX_ENDPOINTS = 16;
20
+ /** One allowed endpoint, canonicalized: `<origin><path>`, no trailing slash. */
21
+ export interface EndpointAddress {
22
+ readonly id: string;
23
+ readonly label: string;
24
+ readonly baseUrl: string;
25
+ }
26
+ export interface EndpointListPolicy<T extends object = Record<never, never>> {
27
+ /** The failure factory of the provider's config module. */
28
+ readonly error: (message: string) => Error;
29
+ /** The config field carrying the list, as a load failure names it. */
30
+ readonly field: string;
31
+ /** The noun a development exception is explained in. */
32
+ readonly noun: string;
33
+ /**
34
+ * The phrase the HTTPS rule names what is being developed against, when a
35
+ * provider's own words differ from `a development <noun>`. An installation
36
+ * that legitimately has no certificate is often called internal rather than
37
+ * development, and the operator reading the refusal looks for the word their
38
+ * own product uses.
39
+ */
40
+ readonly insecureTarget?: string;
41
+ /** How many endpoints one deployment may declare. */
42
+ readonly max?: number;
43
+ /**
44
+ * Provider-specific members of one row, resolved after the shared ones —
45
+ * e.g. which product answers at the address.
46
+ */
47
+ readonly extra?: (record: Record<string, unknown>, index: number) => T;
48
+ }
49
+ /**
50
+ * Validate and canonicalize the operator's endpoint list. Everything here is
51
+ * operator input, so a typo must fail loudly at load: a silently dropped entry
52
+ * would leave users with a provider they cannot connect to and no explanation.
53
+ */
54
+ export declare function resolveEndpointList<T extends object = Record<never, never>>(input: unknown, allowInsecureHttp: boolean, policy: EndpointListPolicy<T>): readonly (EndpointAddress & T)[];
55
+ /** The configured endpoint an id names, or undefined. */
56
+ export declare function findEndpoint<T extends EndpointAddress>(endpoints: readonly T[], id: string): T | undefined;
57
+ //# sourceMappingURL=address.d.ts.map
@@ -0,0 +1,34 @@
1
+ import { IntegrationError, type IntegrationErrorCode } from "../../errors.js";
2
+ /**
3
+ * The error policy shared by every provider: upstream failures fold into the
4
+ * same safe domain errors — a refused permission stays distinct from a
5
+ * missing resource, neither answer ever carries the upstream body, and the
6
+ * status mapping is alike wherever two upstreams answer alike. A provider
7
+ * supplies only the word it calls itself in a message and, where it answers
8
+ * differently from the common rule, the statuses it reads differently.
9
+ */
10
+ export interface StatusErrorPolicy {
11
+ /** How the provider names itself in a folded message. */
12
+ readonly label: string;
13
+ /** The 401 wording; defaults to the stored token being rejected. */
14
+ readonly rejectedCredential?: string;
15
+ /** Statuses meaning "the call itself is wrong"; defaults to 400 and 422. */
16
+ readonly invalidRequestStatuses?: readonly number[];
17
+ /** A status the default mapping does not describe: its code and wording. */
18
+ readonly overrides?: Readonly<Record<number, readonly [IntegrationErrorCode, string]>>;
19
+ }
20
+ /** The provider's status folding, in the shape `FetchRetryPolicy` takes. */
21
+ export declare function statusErrorOf(policy: StatusErrorPolicy): (response: Response) => IntegrationError;
22
+ export interface TransportFailurePolicy {
23
+ /** How the provider names itself in a folded message. */
24
+ readonly label: string;
25
+ /** The wording of a connection failure that is neither timeout nor TLS. */
26
+ readonly unreachable?: string;
27
+ }
28
+ /**
29
+ * The provider's transport folding: this deployment's own deadline, a TLS
30
+ * handshake the user cannot fix from the connect form, and everything else
31
+ * that means the upstream is not answering.
32
+ */
33
+ export declare function transportFailureOf(policy: TransportFailurePolicy): (error: unknown, timedOut: boolean) => IntegrationError;
34
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,107 @@
1
+ import { IntegrationError } from "../../errors.js";
2
+ export declare const RETRY_CAP_MS = 2000;
3
+ export declare const BACKOFF_BASE_MS = 250;
4
+ /** Upstream codes that mean "the TLS handshake did not succeed". */
5
+ export declare const TLS_FAILURE: RegExp;
6
+ /** Content types that must never be handed to the model as text. */
7
+ export declare const BINARY_TYPE: RegExp;
8
+ /** A body read up to a cap; the text is empty for a payload that looks binary. */
9
+ export interface BoundedText {
10
+ /** Body prefix; empty for a payload that looks binary. */
11
+ readonly text: string;
12
+ readonly bytes: number;
13
+ readonly truncated: boolean;
14
+ readonly binary: boolean;
15
+ }
16
+ export declare function numberFrom(value: string | null): number | undefined;
17
+ export declare function looksBinary(contentType: string | null, bytes: Uint8Array): boolean;
18
+ export declare function sleep(ms: number): Promise<void>;
19
+ /** The first upstream error code in a fetch failure chain, if any. */
20
+ export declare function causeCode(error: unknown): string;
21
+ export declare function backoff(response: Response, attempt: number): number;
22
+ export declare function retryDelay(attempt: number): number;
23
+ /**
24
+ * A requested ceiling folded into the deployment's own, never past it: a
25
+ * request naming no ceiling gets the default, one naming more than the cap
26
+ * gets the cap rather than an error — an operator asking for more only wants
27
+ * the maximum.
28
+ */
29
+ export declare function withinCap(requested: number | undefined, fallback: number, cap: number): number;
30
+ /**
31
+ * Read a body without letting upstream decide how much memory the broker
32
+ * spends, or for how long it spends the request's time. A body over the cap is
33
+ * reported as truncated instead of surfacing a raw `content-length` nobody can
34
+ * verify, and a body that stops arriving is refused by `signal` — the same
35
+ * deadline the headers had to meet.
36
+ */
37
+ export declare function readBoundedText(response: Response, maxBytes: number, label: string, signal: AbortSignal): Promise<BoundedText>;
38
+ /**
39
+ * Read one JSON body under the deployment cap and inside the request deadline,
40
+ * folding what a capped, stalled or unreadable body means into a domain error.
41
+ * The cap, the prefix-keeping truncation, the deadline and the binary
42
+ * classification are the shared policy; a transport only supplies the label it
43
+ * answers with, so the same limit cannot mean "narrow the request" in one
44
+ * provider and "try again later" in another, and no transport can quietly skip
45
+ * either of them.
46
+ */
47
+ export declare function readBoundedJson<T>(response: Response, maxBytes: number, label: string, signal: AbortSignal): Promise<T>;
48
+ /**
49
+ * Whether a folded transport failure earns another attempt. Re-spending a
50
+ * deadline is a latency decision, not a detail of the API behind it, so the
51
+ * kernel holds the two rules a deployment chooses between and a provider names
52
+ * its choice — an upstream that answers in five different ways here cannot say
53
+ * what one `timeoutMs` promised the operator.
54
+ */
55
+ export type TransportRetriable = (error: IntegrationError) => boolean;
56
+ /**
57
+ * The default, and the rule a provider gets when it names no other: one
58
+ * deadline is the whole budget. A call this deployment already gave up on is
59
+ * not re-sent, so one read costs `timeoutMs` rather than `retries × timeoutMs`.
60
+ */
61
+ export declare const DEADLINE_IS_THE_BUDGET: TransportRetriable;
62
+ /**
63
+ * The rule for an upstream more often busy than gone: every fault that left no
64
+ * answer earns another attempt, and the worst case of one read is `retries ×
65
+ * timeoutMs` — a longer wait, paid for by the answers it still gets. A body this
66
+ * deployment stopped reading is not among them: that request answered, and what
67
+ * the read made of it is a verdict, not a fault that may be gone on a later try.
68
+ */
69
+ export declare const RESEND_AFTER_EVERY_FAULT: TransportRetriable;
70
+ /**
71
+ * How a provider folds transport outcomes into its own safe domain errors:
72
+ * each transport keeps the wording, the shared loop keeps the mechanics.
73
+ */
74
+ export interface FetchRetryPolicy {
75
+ readonly timeoutMs: number;
76
+ readonly retries: number;
77
+ readonly headers: Record<string, string>;
78
+ /** Fold a thrown fetch or a broken body read into a safe error. */
79
+ readonly transportFailure: (error: unknown, timedOut: boolean) => IntegrationError;
80
+ /**
81
+ * Whether a folded transport failure earns another attempt; {@link
82
+ * DEADLINE_IS_THE_BUDGET} unless the provider names its choice.
83
+ */
84
+ readonly retriable?: TransportRetriable;
85
+ /** Fold a non-2xx answer into the provider's safe domain error. */
86
+ readonly statusFailure: (response: Response) => IntegrationError;
87
+ }
88
+ /**
89
+ * What the transport does with an answer that arrived: read the body it came
90
+ * for, under `signal` — the deadline of the attempt that produced the response.
91
+ * The read is the transport's because only it knows which of its shapes the
92
+ * body carries; the deadline is the loop's because the loop set it.
93
+ */
94
+ export type ResponseRead<T> = (response: Response, signal: AbortSignal) => Promise<T>;
95
+ /**
96
+ * The shared transport loop: one bounded GET per attempt, transient answers
97
+ * retried with backoff, upstream failures folded into safe domain errors. The
98
+ * deadline is per attempt and covers the whole exchange — the loop hands the
99
+ * answer to `read` while its own timer is still armed, so an upstream that
100
+ * replies with the headers and then stops sending chunks is refused by the
101
+ * budget instead of leaving the call pending. A fetch that answered is never
102
+ * retried by this loop unless its status says the upstream fault may be gone on
103
+ * a later try, and what `read` refuses on its own (a body over the cap, a body
104
+ * that is not JSON) stays the domain error it named.
105
+ */
106
+ export declare function fetchWithRetries<T>(fetcher: typeof fetch, target: string, policy: FetchRetryPolicy, read: ResponseRead<T>): Promise<T>;
107
+ //# sourceMappingURL=read-policy.d.ts.map