@yadsh/dsh-qa-integrations 0.9.0 → 0.10.1

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 (184) hide show
  1. package/README.md +32 -21
  2. package/compatibility.json +7 -3
  3. package/lib/broker.js +172 -17
  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/errors.js +5 -0
  66. package/lib/errors.js.map +1 -1
  67. package/lib/index.js +176 -222
  68. package/lib/index.js.map +1 -1
  69. package/lib/providers/bitrix24/tools.js +7 -2
  70. package/lib/providers/bitrix24/tools.js.map +1 -1
  71. package/lib/providers/bitrix24/transport.js +28 -8
  72. package/lib/providers/bitrix24/transport.js.map +1 -1
  73. package/lib/providers/confluence/config.js +14 -55
  74. package/lib/providers/confluence/config.js.map +1 -1
  75. package/lib/providers/confluence/tools.js +7 -2
  76. package/lib/providers/confluence/tools.js.map +1 -1
  77. package/lib/providers/confluence/transport.js +42 -78
  78. package/lib/providers/confluence/transport.js.map +1 -1
  79. package/lib/providers/gitlab/config.js +11 -55
  80. package/lib/providers/gitlab/config.js.map +1 -1
  81. package/lib/providers/gitlab/operations.js +3 -3
  82. package/lib/providers/gitlab/operations.js.map +1 -1
  83. package/lib/providers/gitlab/tools.js +7 -2
  84. package/lib/providers/gitlab/tools.js.map +1 -1
  85. package/lib/providers/gitlab/transport.js +33 -65
  86. package/lib/providers/gitlab/transport.js.map +1 -1
  87. package/lib/providers/jira/config.js +18 -58
  88. package/lib/providers/jira/config.js.map +1 -1
  89. package/lib/providers/jira/jql.js +105 -1
  90. package/lib/providers/jira/jql.js.map +1 -1
  91. package/lib/providers/jira/tools.js +68 -2
  92. package/lib/providers/jira/tools.js.map +1 -1
  93. package/lib/providers/jira/transport.js +44 -110
  94. package/lib/providers/jira/transport.js.map +1 -1
  95. package/lib/providers/kernel/address.js +90 -0
  96. package/lib/providers/kernel/address.js.map +1 -0
  97. package/lib/providers/kernel/errors.js +42 -0
  98. package/lib/providers/kernel/errors.js.map +1 -0
  99. package/lib/providers/kernel/read-policy.js +276 -0
  100. package/lib/providers/kernel/read-policy.js.map +1 -0
  101. package/lib/providers/kernel/token.js +45 -0
  102. package/lib/providers/kernel/token.js.map +1 -0
  103. package/lib/providers/shared/service-boundary.js +31 -3
  104. package/lib/providers/shared/service-boundary.js.map +1 -1
  105. package/lib/providers/teamcity/tools.js +8 -3
  106. package/lib/providers/teamcity/tools.js.map +1 -1
  107. package/lib/providers/teamcity/transport.js +6 -8
  108. package/lib/providers/teamcity/transport.js.map +1 -1
  109. package/lib/providers/testit/config.js +12 -57
  110. package/lib/providers/testit/config.js.map +1 -1
  111. package/lib/providers/testit/tools.js +7 -2
  112. package/lib/providers/testit/tools.js.map +1 -1
  113. package/lib/providers/testit/transport.js +12 -12
  114. package/lib/providers/testit/transport.js.map +1 -1
  115. package/lib/providers/weblate/config.js +12 -55
  116. package/lib/providers/weblate/config.js.map +1 -1
  117. package/lib/providers/weblate/tools.js +7 -2
  118. package/lib/providers/weblate/tools.js.map +1 -1
  119. package/lib/providers/weblate/transport.js +21 -20
  120. package/lib/providers/weblate/transport.js.map +1 -1
  121. package/lib/public-api.js +79 -0
  122. package/lib/public-api.js.map +1 -0
  123. package/lib/repository.js +65 -16
  124. package/lib/repository.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/tool-kit.js +34 -7
  128. package/lib/tool-kit.js.map +1 -1
  129. package/lib/tools.js +49 -24
  130. package/lib/tools.js.map +1 -1
  131. package/lib/typert.host.js +455 -351
  132. package/lib/typert.remote-client.js +450 -336
  133. package/lib/types/broker.d.ts +65 -1
  134. package/lib/types/client/card.d.ts +13 -4
  135. package/lib/types/client/credential-help-note.d.ts +26 -0
  136. package/lib/types/client/index.d.ts +15 -7
  137. package/lib/types/client/integrations.d.ts +5 -4
  138. package/lib/types/client/operator-card.d.ts +56 -4
  139. package/lib/types/client/operator-controls.d.ts +31 -0
  140. package/lib/types/client/operator-sections/bitrix24.d.ts +12 -0
  141. package/lib/types/client/operator-sections/confluence.d.ts +10 -0
  142. package/lib/types/client/operator-sections/credential-help.d.ts +17 -0
  143. package/lib/types/client/operator-sections/general.d.ts +11 -0
  144. package/lib/types/client/operator-sections/gitlab.d.ts +13 -0
  145. package/lib/types/client/operator-sections/jira.d.ts +11 -0
  146. package/lib/types/client/operator-sections/provider-section.d.ts +58 -0
  147. package/lib/types/client/operator-sections/service-profiles.d.ts +13 -0
  148. package/lib/types/client/operator-sections/shared.d.ts +123 -0
  149. package/lib/types/client/operator-sections/teamcity.d.ts +11 -0
  150. package/lib/types/client/operator-sections/testit.d.ts +10 -0
  151. package/lib/types/client/operator-sections/weblate.d.ts +10 -0
  152. package/lib/types/client/operator-service-reach.d.ts +76 -0
  153. package/lib/types/client/provider-card.d.ts +14 -3
  154. package/lib/types/client/styles.d.ts +28 -4
  155. package/lib/types/config.d.ts +49 -2
  156. package/lib/types/errors.d.ts +24 -0
  157. package/lib/types/index.d.ts +54 -117
  158. package/lib/types/providers/bitrix24/tools.d.ts +2 -5
  159. package/lib/types/providers/confluence/tools.d.ts +2 -6
  160. package/lib/types/providers/confluence/transport.d.ts +0 -6
  161. package/lib/types/providers/gitlab/config.d.ts +1 -1
  162. package/lib/types/providers/gitlab/tools.d.ts +2 -6
  163. package/lib/types/providers/gitlab/transport.d.ts +3 -5
  164. package/lib/types/providers/jira/tools.d.ts +2 -6
  165. package/lib/types/providers/jira/transport.d.ts +2 -11
  166. package/lib/types/providers/kernel/address.d.ts +57 -0
  167. package/lib/types/providers/kernel/errors.d.ts +34 -0
  168. package/lib/types/providers/kernel/read-policy.d.ts +118 -0
  169. package/lib/types/providers/kernel/token.d.ts +25 -0
  170. package/lib/types/providers/shared/service-boundary.d.ts +15 -0
  171. package/lib/types/providers/teamcity/tools.d.ts +2 -6
  172. package/lib/types/providers/teamcity/transport.d.ts +1 -1
  173. package/lib/types/providers/testit/tools.d.ts +2 -6
  174. package/lib/types/providers/testit/transport.d.ts +1 -1
  175. package/lib/types/providers/weblate/tools.d.ts +2 -6
  176. package/lib/types/public-api.d.ts +80 -0
  177. package/lib/types/repository.d.ts +62 -2
  178. package/lib/types/tool-kit.d.ts +27 -1
  179. package/lib/types/tools.d.ts +26 -9
  180. package/lib/types/types.d.ts +17 -3
  181. package/package.json +25 -23
  182. package/lib/providers/shared/http.js +0 -168
  183. package/lib/providers/shared/http.js.map +0 -1
  184. package/lib/types/providers/shared/http.d.ts +0 -60
@@ -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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yadsh/dsh-qa-integrations",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
4
4
  "description": "Principal-scoped, encrypted user integrations for DSH QA Surface",
5
5
  "repository": {
6
6
  "type": "git",
@@ -58,8 +58,8 @@
58
58
  ],
59
59
  "inject": [
60
60
  "@deepseek-ai/dsh-api-gateway",
61
+ "@deepseek-ai/dsh-client-ui-plugin-manager",
61
62
  "@deepseek-ai/dsh-client-ui-settings",
62
- "@deepseek-ai/dsh-client-ui-settings-plugins",
63
63
  "@yadsh/dsh-qa-surface"
64
64
  ],
65
65
  "platform": "web"
@@ -87,34 +87,35 @@
87
87
  },
88
88
  "dependencies": {
89
89
  "zod": "^4.4.3",
90
- "@yadsh/dsh-plugin-kit": "^0.4.0",
91
- "@yadsh/dsh-plugin-log": "^0.4.0",
92
- "@yadsh/dsh-qa-surface": "^0.13.0"
90
+ "@yadsh/dsh-plugin-kit": "^0.5.0",
91
+ "@yadsh/dsh-plugin-log": "^0.4.1",
92
+ "@yadsh/dsh-qa-surface": "^0.15.1"
93
93
  },
94
94
  "peerDependencies": {
95
- "@deepseek-ai/cordis": "^4.0.2",
96
- "@deepseek-ai/dsh-client-ui-settings": ">=0.1.5-rc.2 <0.2.0",
97
- "@deepseek-ai/dsh-client-ui-settings-plugins": ">=0.1.5-rc.2 <0.2.0",
98
- "@deepseek-ai/dsh-tools": ">=0.1.5-rc.2 <0.2.0",
99
- "@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.2 <0.2.0",
100
- "@deepseek-ai/schemastery": "^3.18.2",
95
+ "@deepseek-ai/cordis": "^4.0.4",
96
+ "@deepseek-ai/dsh-client-ui-plugin-manager": ">=0.1.7-rc.2 <0.2.0",
97
+ "@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.2 <0.2.0",
98
+ "@deepseek-ai/dsh-tools": ">=0.1.7-rc.2 <0.2.0",
99
+ "@deepseek-ai/dsh-typert-protocol": ">=0.1.7-rc.2 <0.2.0",
100
+ "@deepseek-ai/schemastery": "^3.18.4",
101
101
  "react": "^18.2.0"
102
102
  },
103
103
  "devDependencies": {
104
- "@deepseek-ai/cordis": "4.0.2",
105
- "@deepseek-ai/dsh-api-gateway": "0.1.5-rc.2",
106
- "@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.2",
107
- "@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.2",
108
- "@deepseek-ai/dsh-client-ui-settings-plugins": "0.1.5-rc.2",
109
- "@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.2",
110
- "@deepseek-ai/dsh-tools": "0.1.5-rc.2",
111
- "@deepseek-ai/dsh-typert-generator": "0.1.5-rc.2",
112
- "@deepseek-ai/dsh-typert-protocol": "0.1.5-rc.2",
113
- "@deepseek-ai/schemastery": "3.18.2",
104
+ "@deepseek-ai/cordis": "4.0.4",
105
+ "@deepseek-ai/dsh-api-gateway": "0.1.7-rc.2",
106
+ "@deepseek-ai/dsh-client-ui-plugin-manager": "0.1.7-rc.2",
107
+ "@deepseek-ai/dsh-client-ui-renderer": "0.1.7-rc.2",
108
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.2",
109
+ "@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
110
+ "@deepseek-ai/dsh-tools": "0.1.7-rc.2",
111
+ "@deepseek-ai/dsh-typert-generator": "0.1.7-rc.2",
112
+ "@deepseek-ai/dsh-typert-protocol": "0.1.7-rc.2",
113
+ "@deepseek-ai/schemastery": "3.18.4",
114
114
  "@testing-library/react": "^16.3.0",
115
115
  "@types/node": "^26.4.0",
116
116
  "@types/react": "18.3.28",
117
117
  "@types/react-dom": "18.3.7",
118
+ "@vitest/coverage-v8": "^4.1.8",
118
119
  "eslint": "10.9.1",
119
120
  "jsdom": "^26.1.0",
120
121
  "react": "18.3.1",
@@ -123,8 +124,8 @@
123
124
  "typescript": "^7.0.2",
124
125
  "vitest": "^4.1.11",
125
126
  "@yadsh/dsh-config": "^0.0.0",
126
- "@yadsh/dsh-test-kit": "^0.1.0",
127
- "@yadsh/dsh-plugin-scripts": "^0.0.0"
127
+ "@yadsh/dsh-plugin-scripts": "^0.0.0",
128
+ "@yadsh/dsh-test-kit": "^0.1.0"
128
129
  },
129
130
  "publishConfig": {
130
131
  "access": "public",
@@ -136,6 +137,7 @@
136
137
  "lint": "eslint src tests scripts tsdown.config.ts",
137
138
  "typecheck": "tsc -p tsconfig.json --noEmit",
138
139
  "test": "vitest run",
140
+ "test:coverage": "vitest run --coverage",
139
141
  "verify:package": "node scripts/verify-package.mjs",
140
142
  "verify": "pnpm run verify:package",
141
143
  "check": "pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run build && pnpm run verify"
@@ -1,168 +0,0 @@
1
- import { IntegrationError } from "../../errors.js";
2
- export const RETRY_CAP_MS = 2_000;
3
- export const BACKOFF_BASE_MS = 250;
4
- /** Upstream codes that mean "the TLS handshake did not succeed". */
5
- export const TLS_FAILURE = /CERT|TLS|SSL|UNABLE_TO_VERIFY|SELF_SIGNED|DEPTH_ZERO|ERR_TLS/u;
6
- /** Content types that must never be handed to the model as text. */
7
- export const BINARY_TYPE = /^(?:image|audio|video)\/|application\/(?:octet-stream|zip|gzip|pdf|x-tar|x-7z-compressed|wasm)/u;
8
- export function numberFrom(value) {
9
- if (value === null || value.trim() === "")
10
- return undefined;
11
- const parsed = Number(value);
12
- return Number.isFinite(parsed) ? parsed : undefined;
13
- }
14
- export function looksBinary(contentType, bytes) {
15
- if (contentType !== null && BINARY_TYPE.test(contentType))
16
- return true;
17
- if (contentType !== null && /charset=/u.test(contentType))
18
- return false;
19
- if (contentType !== null &&
20
- /^(?:text\/|application\/(?:json|xml))/u.test(contentType)) {
21
- return false;
22
- }
23
- // No usable content type: a NUL byte in the head is the classic text/binary
24
- // split, and it costs nothing to be conservative about the rest.
25
- for (const byte of bytes.subarray(0, 8_192)) {
26
- if (byte === 0)
27
- return true;
28
- }
29
- return false;
30
- }
31
- export function sleep(ms) {
32
- return new Promise((resolve) => setTimeout(resolve, ms));
33
- }
34
- /** The first upstream error code in a fetch failure chain, if any. */
35
- export function causeCode(error) {
36
- let current = error;
37
- for (let depth = 0; depth < 4; depth += 1) {
38
- if (typeof current !== "object" || current === null)
39
- break;
40
- const code = current.code;
41
- if (typeof code === "string")
42
- return code;
43
- current = current.cause;
44
- }
45
- return "";
46
- }
47
- export function backoff(response, attempt) {
48
- const header = response.headers.get("retry-after");
49
- const seconds = header === null ? Number.NaN : Number(header.trim());
50
- if (Number.isFinite(seconds) && seconds >= 0) {
51
- return Math.min(seconds * 1_000, RETRY_CAP_MS);
52
- }
53
- return retryDelay(attempt);
54
- }
55
- export function retryDelay(attempt) {
56
- const backoff = BACKOFF_BASE_MS * 2 ** attempt;
57
- return Math.min(backoff + Math.floor(Math.random() * 100), RETRY_CAP_MS);
58
- }
59
- /**
60
- * Read a body without letting upstream decide how much memory the broker
61
- * spends. A body over the cap is reported as truncated instead of surfacing a
62
- * raw `content-length` nobody can verify.
63
- */
64
- export async function readBoundedText(response, maxBytes) {
65
- const contentType = response.headers.get("content-type");
66
- if (response.body === null) {
67
- return { text: "", bytes: 0, truncated: false, binary: false };
68
- }
69
- const declared = numberFrom(response.headers.get("content-length"));
70
- const reader = response.body.getReader();
71
- const chunks = [];
72
- let bytes = 0;
73
- let truncated = declared !== undefined && declared > maxBytes;
74
- for (;;) {
75
- const next = await reader.read();
76
- if (next.done)
77
- break;
78
- bytes += next.value.byteLength;
79
- if (bytes > maxBytes) {
80
- // Keep the prefix that still fits: a bounded preview is what makes a
81
- // truncated answer useful, an empty one is not.
82
- const room = maxBytes - (bytes - next.value.byteLength);
83
- if (room > 0)
84
- chunks.push(next.value.subarray(0, room));
85
- await reader.cancel();
86
- truncated = true;
87
- break;
88
- }
89
- chunks.push(next.value);
90
- }
91
- const body = Buffer.concat(chunks.map((chunk) => Buffer.from(chunk)));
92
- const binary = looksBinary(contentType, body);
93
- return {
94
- text: binary ? "" : body.toString("utf8"),
95
- bytes: Math.max(bytes, body.byteLength),
96
- truncated,
97
- binary,
98
- };
99
- }
100
- /**
101
- * Read one JSON body under the deployment cap, folding what a capped or
102
- * unreadable body means into a domain error. The cap, the prefix-keeping
103
- * truncation and the binary classification are the shared policy; a transport
104
- * only supplies the label it answers with, so the same limit cannot mean
105
- * "narrow the request" in one provider and "try again later" in another, and
106
- * no transport can quietly skip the cap.
107
- */
108
- export async function readBoundedJson(response, maxBytes, label) {
109
- const body = await readBoundedText(response, maxBytes);
110
- if (body.truncated) {
111
- throw new IntegrationError("ResultTooLarge", `${label} response is too large`);
112
- }
113
- try {
114
- return JSON.parse(body.text);
115
- }
116
- catch {
117
- throw new IntegrationError("ProviderUnavailable", `${label} returned invalid JSON`);
118
- }
119
- }
120
- /**
121
- * The shared transport loop: one bounded GET per attempt, transient answers
122
- * retried with backoff, upstream failures folded into safe domain errors. The
123
- * deadline is per attempt, and a fetch that answered is never retried by this
124
- * loop unless its status says the upstream fault may be gone on a later try.
125
- */
126
- export async function fetchWithRetries(fetcher, target, policy) {
127
- let lastError;
128
- for (let attempt = 0;; attempt += 1) {
129
- let response;
130
- let timedOut = false;
131
- const controller = new AbortController();
132
- const timer = setTimeout(() => {
133
- timedOut = true;
134
- controller.abort();
135
- }, policy.timeoutMs);
136
- try {
137
- response = await fetcher(target, {
138
- method: "GET",
139
- // An upstream that answers with a redirect is never followed: the
140
- // credential must not travel to another origin.
141
- redirect: "error",
142
- headers: policy.headers,
143
- signal: controller.signal,
144
- });
145
- }
146
- catch (error) {
147
- lastError = policy.transportFailure(error, timedOut);
148
- if (attempt >= policy.retries || !policy.retriable(lastError)) {
149
- throw lastError;
150
- }
151
- await sleep(retryDelay(attempt));
152
- continue;
153
- }
154
- finally {
155
- clearTimeout(timer);
156
- }
157
- if (response.ok)
158
- return response;
159
- lastError = policy.statusFailure(response);
160
- // Only throttling and upstream faults are retried; an authorization or
161
- // not-found answer will not change by asking again.
162
- const transient = response.status === 429 || response.status >= 500;
163
- if (!transient || attempt >= policy.retries)
164
- throw lastError;
165
- await sleep(backoff(response, attempt));
166
- }
167
- }
168
- //# sourceMappingURL=http.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"http.js","sourceRoot":"","sources":["../../../src/providers/shared/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GACtB,+DAA+D,CAAC;AAElE,oEAAoE;AACpE,MAAM,CAAC,MAAM,WAAW,GACtB,iGAAiG,CAAC;AAWpG,MAAM,UAAU,UAAU,CAAC,KAAoB;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,WAA0B,EAC1B,KAAiB;IAEjB,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;QAAE,OAAO,IAAI,CAAC;IACvE,IAAI,WAAW,KAAK,IAAI,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAC;IACxE,IACE,WAAW,KAAK,IAAI;QACpB,wCAAwC,CAAC,IAAI,CAAC,WAAW,CAAC,EAC1D,CAAC;QACD,O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jC,SAAS;QACX,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,QAAQ,CAAC,EAAE;YAAE,OAAO,QAAQ,CAAC;QACjC,SAAS,GAAG,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC3C,uEAAuE;QACvE,oDAAoD;QACpD,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,MAAM,IAAI,GAAG,CAAC;QACpE,IAAI,CAAC,SAAS,IAAI,OAAO,IAAI,MAAM,CAAC,OAAO;YAAE,MAAM,SAAS,CAAC;QAC7D,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1C,CAAC;AACH,CAAC"}
@@ -1,60 +0,0 @@
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
- * Read a body without letting upstream decide how much memory the broker
25
- * spends. A body over the cap is reported as truncated instead of surfacing a
26
- * raw `content-length` nobody can verify.
27
- */
28
- export declare function readBoundedText(response: Response, maxBytes: number): Promise<BoundedText>;
29
- /**
30
- * Read one JSON body under the deployment cap, folding what a capped or
31
- * unreadable body means into a domain error. The cap, the prefix-keeping
32
- * truncation and the binary classification are the shared policy; a transport
33
- * only supplies the label it answers with, so the same limit cannot mean
34
- * "narrow the request" in one provider and "try again later" in another, and
35
- * no transport can quietly skip the cap.
36
- */
37
- export declare function readBoundedJson<T>(response: Response, maxBytes: number, label: string): Promise<T>;
38
- /**
39
- * How a provider folds transport outcomes into its own safe domain errors:
40
- * each transport keeps the wording, the shared loop keeps the mechanics.
41
- */
42
- export interface FetchRetryPolicy {
43
- readonly timeoutMs: number;
44
- readonly retries: number;
45
- readonly headers: Record<string, string>;
46
- /** Fold a thrown fetch (abort, DNS, refused connection) into a safe error. */
47
- readonly transportFailure: (error: unknown, timedOut: boolean) => IntegrationError;
48
- /** Whether a folded transport failure earns another attempt. */
49
- readonly retriable: (error: IntegrationError) => boolean;
50
- /** Fold a non-2xx answer into the provider's safe domain error. */
51
- readonly statusFailure: (response: Response) => IntegrationError;
52
- }
53
- /**
54
- * The shared transport loop: one bounded GET per attempt, transient answers
55
- * retried with backoff, upstream failures folded into safe domain errors. The
56
- * deadline is per attempt, and a fetch that answered is never retried by this
57
- * loop unless its status says the upstream fault may be gone on a later try.
58
- */
59
- export declare function fetchWithRetries(fetcher: typeof fetch, target: string, policy: FetchRetryPolicy): Promise<Response>;
60
- //# sourceMappingURL=http.d.ts.map