dsh-agent-plugins-market 0.8.1 → 0.8.2

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 (157) hide show
  1. package/README.md +2 -2
  2. package/README.zh.md +2 -2
  3. package/client/client.js +1591 -1726
  4. package/client/client.js.map +1 -1
  5. package/lib/application/agent-roles.js +53 -0
  6. package/lib/application/catalog-context.js +2 -2
  7. package/lib/application/catalog.js +4 -8
  8. package/lib/{runtime → application}/deadline.js +1 -1
  9. package/lib/application/details.js +3 -3
  10. package/lib/application/json-file.js +43 -0
  11. package/lib/{runtime → application/lsp}/lsp-direct-config.js +9 -7
  12. package/lib/application/lsp/lsp-server-state.js +17 -0
  13. package/lib/{runtime → application/lsp}/lsp-status.js +22 -7
  14. package/lib/{runtime → application/lsp}/profile-seam.js +1 -1
  15. package/lib/application/lsp-service.js +5 -5
  16. package/lib/{runtime → application/mcp}/mcp-backend.js +3 -19
  17. package/lib/{runtime → application/mcp}/mcp-config.js +4 -4
  18. package/lib/{runtime → application/mcp}/mcp-direct-config.js +8 -49
  19. package/lib/{runtime → application/mcp}/mcp-overrides.js +3 -5
  20. package/lib/{runtime → application/mcp}/mcp-status.js +13 -7
  21. package/lib/application/mcp-service.js +11 -35
  22. package/lib/application/panel-resources.js +48 -11
  23. package/lib/{runtime → application/panels}/user-hooks.js +2 -2
  24. package/lib/{runtime → application/panels}/user-store.js +2 -2
  25. package/lib/application/ports.js +1 -0
  26. package/lib/application/project-agent-roles.js +1 -1
  27. package/lib/{runtime → application}/server-config.js +7 -17
  28. package/lib/application/snapshot-cache.js +1 -1
  29. package/lib/application/source-store.js +3 -4
  30. package/lib/{runtime → application/state}/state-store.js +5 -7
  31. package/lib/{runtime → application/state}/storage-migration.js +4 -4
  32. package/lib/catalog/source-catalog.js +0 -4
  33. package/lib/contracts/lsp.js +1 -0
  34. package/lib/contracts/market.js +0 -1
  35. package/lib/contracts/mcp.js +1 -0
  36. package/lib/index.js +42 -33
  37. package/lib/routes.js +2 -9
  38. package/lib/runtime/{agent-role-router.js → agents/agent-role-router.js} +7 -53
  39. package/lib/runtime/{subagent-catalog.js → agents/subagent-catalog.js} +24 -16
  40. package/lib/runtime/core/context.js +31 -0
  41. package/lib/runtime/{reconciler.js → core/reconciler.js} +5 -5
  42. package/lib/runtime/host/failure-detail.js +58 -0
  43. package/lib/runtime/{feedback-tool.js → host/feedback-tool.js} +1 -1
  44. package/lib/runtime/host/host-locale.js +83 -0
  45. package/lib/runtime/{settings-namespace.js → host/settings-namespace.js} +1 -1
  46. package/lib/runtime/host/shell-path.js +196 -0
  47. package/lib/runtime/{tool-registry-observer.js → host/tool-registry-observer.js} +2 -1
  48. package/lib/runtime/{lsp-mounts.js → lsp/lsp-mounts.js} +69 -20
  49. package/lib/runtime/{mcp-client → mcp/bridge}/bridge.js +52 -22
  50. package/lib/runtime/{mcp-client → mcp/bridge}/connection.js +2 -2
  51. package/lib/runtime/{mcp-client → mcp/bridge}/oauth.js +1 -1
  52. package/lib/runtime/{mcp-client → mcp/bridge}/tools.js +2 -2
  53. package/lib/runtime/{mcp-auth-record.js → mcp/mcp-auth-record.js} +1 -1
  54. package/lib/runtime/{mcp-mounts.js → mcp/mcp-mounts.js} +14 -7
  55. package/lib/runtime/{user-commands.js → panels/user-commands.js} +3 -3
  56. package/lib/runtime/{user-panels.js → panels/user-panels.js} +2 -2
  57. package/lib/runtime/{commands-mounts.js → surfaces/commands-mounts.js} +7 -7
  58. package/lib/runtime/{hooks-mounts.js → surfaces/hooks-mounts.js} +2 -2
  59. package/lib/runtime/{project-runtime.js → surfaces/project-runtime.js} +5 -5
  60. package/lib/runtime/{skills-provider.js → surfaces/skills-provider.js} +4 -4
  61. package/lib/types/application/agent-roles.d.ts +30 -0
  62. package/lib/types/application/catalog.d.ts +4 -7
  63. package/lib/types/application/details.d.ts +1 -1
  64. package/lib/types/application/json-file.d.ts +12 -0
  65. package/lib/types/{runtime → application/lsp}/lsp-direct-config.d.ts +1 -1
  66. package/lib/types/{runtime → application/lsp}/lsp-status.d.ts +3 -3
  67. package/lib/types/{runtime → application/mcp}/mcp-backend.d.ts +4 -9
  68. package/lib/types/{runtime/mcp-client/config.d.ts → application/mcp/mcp-bridge-config.d.ts} +11 -1
  69. package/lib/types/{runtime → application/mcp}/mcp-config.d.ts +6 -7
  70. package/lib/types/application/mcp/mcp-direct-config.d.ts +17 -0
  71. package/lib/types/{runtime → application/mcp}/mcp-overrides.d.ts +1 -1
  72. package/lib/types/{runtime → application/mcp}/mcp-status.d.ts +7 -7
  73. package/lib/types/application/mcp-service.d.ts +4 -11
  74. package/lib/types/application/panel-resources.d.ts +9 -2
  75. package/lib/types/{runtime → application/panels}/user-hooks.d.ts +1 -1
  76. package/lib/types/{runtime → application/panels}/user-store.d.ts +1 -1
  77. package/lib/types/application/ports.d.ts +17 -3
  78. package/lib/types/application/project-agent-roles.d.ts +1 -1
  79. package/lib/types/application/queries.d.ts +3 -6
  80. package/lib/types/{runtime → application}/regions.d.ts +1 -1
  81. package/lib/types/{runtime → application/state}/state-store.d.ts +2 -2
  82. package/lib/types/catalog/source-catalog.d.ts +0 -2
  83. package/lib/types/contracts/lsp-status.d.ts +6 -0
  84. package/lib/types/contracts/lsp.d.ts +16 -0
  85. package/lib/types/contracts/market.d.ts +1 -4
  86. package/lib/types/contracts/mcp-status.d.ts +21 -2
  87. package/lib/types/contracts/mcp.d.ts +20 -0
  88. package/lib/types/model/types.d.ts +0 -14
  89. package/lib/types/runtime/{agent-role-router.d.ts → agents/agent-role-router.d.ts} +3 -28
  90. package/lib/types/runtime/{subagent-catalog.d.ts → agents/subagent-catalog.d.ts} +6 -6
  91. package/lib/types/runtime/core/context.d.ts +14 -0
  92. package/lib/types/runtime/{reconcile-scheduler.d.ts → core/reconcile-scheduler.d.ts} +2 -2
  93. package/lib/types/runtime/{reconciler.d.ts → core/reconciler.d.ts} +8 -8
  94. package/lib/types/runtime/host/failure-detail.d.ts +6 -0
  95. package/lib/types/runtime/host/host-locale.d.ts +66 -0
  96. package/lib/types/runtime/{model-catalog.d.ts → host/model-catalog.d.ts} +1 -1
  97. package/lib/types/runtime/{settings-namespace.d.ts → host/settings-namespace.d.ts} +2 -2
  98. package/lib/types/runtime/host/shell-path.d.ts +70 -0
  99. package/lib/types/runtime/{lsp-mounts.d.ts → lsp/lsp-mounts.d.ts} +17 -11
  100. package/lib/types/runtime/{mcp-client → mcp/bridge}/bridge.d.ts +1 -1
  101. package/lib/types/runtime/{mcp-client → mcp/bridge}/connection.d.ts +3 -11
  102. package/lib/types/runtime/{mcp-client → mcp/bridge}/host-contract.d.ts +1 -1
  103. package/lib/types/runtime/{mcp-client → mcp/bridge}/oauth.d.ts +1 -1
  104. package/lib/types/runtime/{mcp-client → mcp/bridge}/transport.d.ts +1 -1
  105. package/lib/types/runtime/{mcp-auth-record.d.ts → mcp/mcp-auth-record.d.ts} +1 -1
  106. package/lib/types/runtime/{mcp-credentials.d.ts → mcp/mcp-credentials.d.ts} +1 -1
  107. package/lib/types/runtime/{mcp-mounts.d.ts → mcp/mcp-mounts.d.ts} +5 -11
  108. package/lib/types/runtime/{user-commands.d.ts → panels/user-commands.d.ts} +1 -1
  109. package/lib/types/runtime/{user-panels.d.ts → panels/user-panels.d.ts} +1 -1
  110. package/lib/types/runtime/{commands-mounts.d.ts → surfaces/commands-mounts.d.ts} +2 -2
  111. package/lib/types/runtime/{hooks-mounts.d.ts → surfaces/hooks-mounts.d.ts} +1 -1
  112. package/lib/types/runtime/{project-runtime.d.ts → surfaces/project-runtime.d.ts} +3 -3
  113. package/lib/types/runtime/{skills-provider.d.ts → surfaces/skills-provider.d.ts} +1 -1
  114. package/package.json +35 -32
  115. package/lib/runtime/host-locale.js +0 -89
  116. package/lib/runtime/legacy-root-migration.js +0 -12
  117. package/lib/runtime/lsp-server-state.js +0 -19
  118. package/lib/runtime/mcp-client/json-schema-subset.js +0 -181
  119. package/lib/types/runtime/host-locale.d.ts +0 -31
  120. package/lib/types/runtime/legacy-root-migration.d.ts +0 -2
  121. package/lib/types/runtime/mcp-client/json-schema-subset.d.ts +0 -58
  122. package/lib/types/runtime/mcp-direct-config.d.ts +0 -39
  123. /package/lib/{runtime/mcp-client/config.js → application/mcp/mcp-bridge-config.js} +0 -0
  124. /package/lib/{runtime → application/mcp}/mcp-redaction.js +0 -0
  125. /package/lib/{runtime → application}/regions.js +0 -0
  126. /package/lib/runtime/{agent-role-names.js → agents/agent-role-names.js} +0 -0
  127. /package/lib/runtime/{mount-lifecycle.js → core/mount-lifecycle.js} +0 -0
  128. /package/lib/runtime/{reconcile-scheduler.js → core/reconcile-scheduler.js} +0 -0
  129. /package/lib/runtime/{source-auto-update.js → core/source-auto-update.js} +0 -0
  130. /package/lib/runtime/{timer-seat.js → core/timer-seat.js} +0 -0
  131. /package/lib/runtime/{model-catalog.js → host/model-catalog.js} +0 -0
  132. /package/lib/runtime/{plugin-message-source.js → host/plugin-message-source.js} +0 -0
  133. /package/lib/runtime/{mcp-client → mcp/bridge}/host-contract.js +0 -0
  134. /package/lib/runtime/{mcp-client → mcp/bridge}/host-seams.js +0 -0
  135. /package/lib/runtime/{mcp-client → mcp/bridge}/plugin-identity.js +0 -0
  136. /package/lib/runtime/{mcp-client → mcp/bridge}/projection.js +0 -0
  137. /package/lib/runtime/{mcp-client → mcp/bridge}/transport.js +0 -0
  138. /package/lib/runtime/{mcp-credentials.js → mcp/mcp-credentials.js} +0 -0
  139. /package/lib/runtime/{dynamic-context.js → surfaces/dynamic-context.js} +0 -0
  140. /package/lib/types/{runtime → application}/deadline.d.ts +0 -0
  141. /package/lib/types/{runtime → application/lsp}/lsp-server-state.d.ts +0 -0
  142. /package/lib/types/{runtime → application/lsp}/profile-seam.d.ts +0 -0
  143. /package/lib/types/{runtime → application/mcp}/mcp-redaction.d.ts +0 -0
  144. /package/lib/types/{runtime → application}/server-config.d.ts +0 -0
  145. /package/lib/types/{runtime → application/state}/storage-migration.d.ts +0 -0
  146. /package/lib/types/runtime/{agent-role-names.d.ts → agents/agent-role-names.d.ts} +0 -0
  147. /package/lib/types/runtime/{mount-lifecycle.d.ts → core/mount-lifecycle.d.ts} +0 -0
  148. /package/lib/types/runtime/{source-auto-update.d.ts → core/source-auto-update.d.ts} +0 -0
  149. /package/lib/types/runtime/{timer-seat.d.ts → core/timer-seat.d.ts} +0 -0
  150. /package/lib/types/runtime/{feedback-tool.d.ts → host/feedback-tool.d.ts} +0 -0
  151. /package/lib/types/runtime/{plugin-message-source.d.ts → host/plugin-message-source.d.ts} +0 -0
  152. /package/lib/types/runtime/{tool-registry-observer.d.ts → host/tool-registry-observer.d.ts} +0 -0
  153. /package/lib/types/runtime/{mcp-client → mcp/bridge}/host-seams.d.ts +0 -0
  154. /package/lib/types/runtime/{mcp-client → mcp/bridge}/plugin-identity.d.ts +0 -0
  155. /package/lib/types/runtime/{mcp-client → mcp/bridge}/projection.d.ts +0 -0
  156. /package/lib/types/runtime/{mcp-client → mcp/bridge}/tools.d.ts +0 -0
  157. /package/lib/types/runtime/{dynamic-context.d.ts → surfaces/dynamic-context.d.ts} +0 -0
@@ -12,9 +12,21 @@
12
12
  import type { LspServerSpec, SourceKind } from '../model/types.js';
13
13
  export type { McpBackendInfo } from '../contracts/market.js';
14
14
  import type { DownloadRegionSetting } from '../contracts/settings.js';
15
- import type { McpBackend } from '../runtime/mcp-backend.js';
16
- import type { LspMountStatusSource } from '../runtime/lsp-status.js';
17
- import type { McpToolSnapshot } from '../runtime/mcp-status.js';
15
+ import type { McpBackend } from '../contracts/mcp.js';
16
+ import type { LspMountDiagnostic } from '../contracts/lsp.js';
17
+ /** One MCP tool observed from the host tool registry (structural). */
18
+ export interface McpToolSnapshot {
19
+ name: string;
20
+ description?: string;
21
+ /** The input schema the server advertised, when the host exposes it. */
22
+ parameters?: unknown;
23
+ }
24
+ /** The LSP mount-registry surface the aggregator consumes (structural, for tests). */
25
+ export interface LspMountStatusSource {
26
+ diagnosticsSnapshot(): Map<string, LspMountDiagnostic>;
27
+ hasLiveMounts(): boolean;
28
+ disabledServers?(): Set<string>;
29
+ }
18
30
  /** A new source: its location, optional branch, and acquisition kind. */
19
31
  export interface SourceInput {
20
32
  url: string;
@@ -60,6 +72,8 @@ export interface CatalogPorts {
60
72
  setMcpBackend(backend: McpBackend): Promise<void>;
61
73
  /** The persisted download-region setting. */
62
74
  downloadRegion(): Promise<DownloadRegionSetting>;
75
+ /** The host locale preference ('zh' default when unset). */
76
+ localePreference(): string;
63
77
  }
64
78
  /** The seams a composition root may wire; the rest fall back to the defaults. */
65
79
  export type CatalogPortsOverride = Partial<CatalogPorts>;
@@ -1,3 +1,3 @@
1
- import { type AgentRoleEntry } from '../runtime/agent-role-router.js';
1
+ import { type AgentRoleEntry } from './agent-roles.js';
2
2
  import type { Catalog } from './catalog.js';
3
3
  export declare function projectAgentRoles(catalog: Catalog, parent: unknown): Promise<AgentRoleEntry[]>;
@@ -1,11 +1,10 @@
1
1
  /** Narrow application interfaces consumed by the HTTP transport adapter. */
2
- import type { McpStatusPayload } from '../contracts/mcp-status.js';
2
+ import type { McpStatusPayload } from './mcp/mcp-status.js';
3
3
  import type { LspLegacySeamMigration, LspStatusPayload } from '../contracts/lsp-status.js';
4
4
  import type { OverviewPayload, SkillContent, SourceProgress, SuiteDetail } from '../contracts/market.js';
5
5
  import type { SourceRef, SuiteSurfaceKey } from '../model/types.js';
6
- import type { McpServerOverride, McpSuiteOverrides } from '../runtime/mcp-overrides.js';
7
- import type { McpBackend } from '../runtime/mcp-backend.js';
8
- import type { McpImportResult } from '../runtime/mcp-direct-config.js';
6
+ import type { McpServerOverride, McpSuiteOverrides } from './mcp/mcp-overrides.js';
7
+ import type { McpBackend } from '../contracts/mcp.js';
9
8
  import type { ServerConfigPayload } from '../contracts/market.js';
10
9
  import type { LspServerTable, McpBackendInfo, SourceInput, SourcePatch } from './ports.js';
11
10
  /** Read-only market operations required by HTTP routes. */
@@ -25,8 +24,6 @@ export interface MarketQueries {
25
24
  export interface MarketMutations {
26
25
  saveServerConfig(kind: 'mcp' | 'lsp', id: string, config: unknown, policy?: unknown): Promise<void>;
27
26
  addMcpServer(name: string, server: unknown): Promise<void>;
28
- /** Import several pasted services in one write; each entry reports its own outcome. */
29
- importMcpServers(servers: unknown, overwrite: boolean): Promise<McpImportResult>;
30
27
  addLspServer(name: string, config: unknown): Promise<void>;
31
28
  addSource(input: SourceInput): Promise<SourceRef>;
32
29
  updateSource(sourceId: string, patch: SourcePatch): Promise<void>;
@@ -11,7 +11,7 @@
11
11
  * can flip at any time; sources already cloned keep their proxied origin and
12
12
  * follow it on refresh.
13
13
  *
14
- * @module runtime/regions
14
+ * @module application/regions
15
15
  */
16
16
  import type { DownloadRegionSetting } from '../contracts/settings.js';
17
17
  /** The route downloads actually take. */
@@ -1,6 +1,6 @@
1
- import { type SuiteState } from '../model/types.js';
1
+ import { type SuiteState } from '../../model/types.js';
2
2
  export declare const EMPTY_STATE: SuiteState;
3
3
  /** Parse persisted state; unreadable or wrong-version files yield a contained empty state. */
4
4
  export declare function loadState(statePath: string): Promise<SuiteState>;
5
- /** Persist state atomically through the harness's atomic-write helper. */
5
+ /** Persist state atomically through the shared JSON document writer. */
6
6
  export declare function saveState(statePath: string, state: SuiteState): Promise<void>;
@@ -1,6 +1,4 @@
1
1
  import type { DiscoveredSuite, SourceRef, SuiteDimension } from '../model/types.js';
2
- /** Discover suites from the selected configured or project checkouts. */
3
- export declare function discoverSourceList(sources: SourceRef[], dimension: SuiteDimension, dimensionRoot: string): Promise<DiscoveredSuite[]>;
4
2
  /**
5
3
  * Discover suites plus per-source scan diagnostics for one dimension.
6
4
  * @param scanProjectLayouts - whether the project's own native Agent directories
@@ -3,6 +3,8 @@
3
3
  export type LspStatusKind = 'plugin' | 'direct';
4
4
  /** Operational state rendered for an LSP server row. */
5
5
  export type LspStatusState = 'mounted' | 'starting' | 'host-missing' | 'failed' | 'conflict' | 'disabled';
6
+ /** Why a row reports a reason; also the key the panel localizes it by. */
7
+ export type LspStatusCode = 'mount-failed' | 'unmount-failed' | 'seam-conflict' | 'host-missing';
6
8
  /**
7
9
  * One declared language-server row for the status surface.
8
10
  *
@@ -34,6 +36,10 @@ export interface LspStatusEntry {
34
36
  state: LspStatusState;
35
37
  /** Latest diagnostic reason, when the state is not `mounted`/`disabled`. */
36
38
  reason?: string;
39
+ /** Why this row carries a reason; also the key the panel localizes it by. */
40
+ code?: LspStatusCode;
41
+ /** The messages under the failure's `cause` chain, outermost first. */
42
+ causes?: string[];
37
43
  /** Whether a failed mount will be retried automatically. */
38
44
  retryable?: boolean;
39
45
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * LSP wire vocabulary shared by the application services and the runtime
3
+ * mounts: the mount-diagnostic shape the status payload carries. Contracts
4
+ * import nothing; these are data only.
5
+ * @module contracts/lsp
6
+ */
7
+ import type { LspStatusCode } from './lsp-status.js';
8
+ /** One LSP mount failure as the registry records it for the status surface. */
9
+ export interface LspMountDiagnostic {
10
+ suiteId: string;
11
+ serverKey: string;
12
+ reason: string;
13
+ code?: LspStatusCode;
14
+ /** The messages under the failure's `cause` chain, outermost first. */
15
+ causes?: string[];
16
+ }
@@ -6,7 +6,6 @@ export declare const MARKET_ROUTES: {
6
6
  readonly overview: "/api/agent-plugins/overview";
7
7
  readonly mcpStatus: "/api/agent-plugins/mcp-status";
8
8
  readonly addMcpServer: "/api/agent-plugins/mcp-servers/add";
9
- readonly importMcpServers: "/api/agent-plugins/mcp-servers/import";
10
9
  readonly lspStatus: "/api/agent-plugins/lsp-status";
11
10
  readonly lspServers: "/api/agent-plugins/lsp-servers";
12
11
  readonly addLspServer: "/api/agent-plugins/lsp-servers/add";
@@ -259,8 +258,6 @@ export interface MarkdownPreview {
259
258
  description?: string;
260
259
  content: string;
261
260
  }
262
- /** Claude Code command preview alias retained for feature-specific readability. */
263
- export type CommandPreview = MarkdownPreview;
264
261
  /** Claude Code agent preview alias retained for feature-specific readability. */
265
262
  export type AgentPreview = MarkdownPreview;
266
263
  /** One LSP definition preview in a suite detail response. */
@@ -351,7 +348,7 @@ export interface UserPanelEntryWire {
351
348
  name: string;
352
349
  description: string;
353
350
  disabled: boolean;
354
- /** User and managed plugin entries are editable; external source files remain read-only. */
351
+ /** User entries are editable; suite-owned plugin entries answer only to the enable switch. */
355
352
  origin: 'user' | 'plugin';
356
353
  id?: string;
357
354
  rawText: string;
@@ -10,6 +10,18 @@ export interface McpStatusTool {
10
10
  export type McpStatusKind = 'plugin' | 'direct';
11
11
  /** Operational state rendered for an MCP row. `foreign` = mounted by another MCP client (informational). */
12
12
  export type McpStatusState = 'connected' | 'degraded' | 'failed' | 'needs-credentials' | 'orphaned' | 'disabled' | 'foreign';
13
+ /**
14
+ * Why a row carries a reason. The mount failures explain a failed connection;
15
+ * the remaining entries are the states that have something to say without
16
+ * being broken, and each one has its own wording in the panel.
17
+ */
18
+ export type McpStatusCode = 'unsupported-transport' | 'missing-credential' | 'credential-error' | 'unmount-failed' | 'mount-failed' | 'foreign-mount' | 'duplicate-mount'
19
+ /** Tools are still registered although the surface that declared them is gone. */
20
+ | 'orphaned-tools'
21
+ /** Switched off through this plugin's own override record. */
22
+ | 'disabled-override'
23
+ /** A stored override changed the configuration the suite declares. */
24
+ | 'modified-override';
13
25
  /** One MCP service row for the status surface. */
14
26
  export interface McpStatusEntry {
15
27
  id: string;
@@ -27,9 +39,16 @@ export interface McpStatusEntry {
27
39
  endpoint?: string;
28
40
  config?: Record<string, unknown>;
29
41
  tools: McpStatusTool[];
42
+ /** The one-line diagnostic this row reports, in the words of the layer that failed. */
30
43
  reason?: string;
31
- /** Mount-path classification when a diagnostic produced this row. */
32
- code?: 'unsupported-transport' | 'missing-credential' | 'credential-error' | 'unmount-failed' | 'mount-failed' | 'foreign-mount' | 'duplicate-mount';
44
+ /** Why this row carries a reason; also the key the panel localizes it by. */
45
+ code?: McpStatusCode;
46
+ /**
47
+ * The messages under the failure's `cause` chain, outermost first. A wrapper
48
+ * sentence such as `initial connection … failed` names no cause by itself, so
49
+ * the detail that points at the real problem travels beside it.
50
+ */
51
+ causes?: string[];
33
52
  /** Environment-variable credential references required by this server. */
34
53
  credentialRefs?: string[];
35
54
  /** Whether this server advertised zero tools at observation time. Zero-tool
@@ -0,0 +1,20 @@
1
+ /**
2
+ * MCP wire vocabulary shared by the host surface, the application services and
3
+ * the runtime mounts: the backend selector and the diagnostic shape the status
4
+ * payload carries. Contracts import nothing; these are data only. The mount
5
+ * registries narrow `code` to their own failure-code unions at the source.
6
+ * @module contracts/mcp
7
+ */
8
+ import type { McpStatusCode } from './mcp-status.js';
9
+ /** The MCP mount backend the market uses for suite servers. */
10
+ export type McpBackend = 'builtin' | 'host';
11
+ /** One MCP mount failure as the registries record it for the status surface. */
12
+ export interface McpMountDiagnostic {
13
+ suiteId: string;
14
+ serverKey: string;
15
+ reason: string;
16
+ code?: McpStatusCode;
17
+ /** The messages under the failure's `cause` chain, outermost first. */
18
+ causes?: string[];
19
+ credentialRefs?: string[];
20
+ }
@@ -112,20 +112,6 @@ export interface SuiteSurfaceCounts {
112
112
  agents: number;
113
113
  lsp: number;
114
114
  }
115
- /**
116
- * Client-specific manifest data under the `com.deepseek.harness` extension
117
- * namespace (Agent Plugins §8.1), carried by `plugin.json` `extensions`.
118
- */
119
- export interface HarnessExtension {
120
- /** Namespace contract version this suite was written against. */
121
- schemaVersion: string;
122
- /**
123
- * Client policy for portable `mcp.json` servers, keyed by the server's own
124
- * name in `mcp.json`; entries without a matching server are reported and
125
- * ignored.
126
- */
127
- mcpServers?: Record<string, HarnessMcpPolicy>;
128
- }
129
115
  /**
130
116
  * dsh-owned per-server policy for a portable MCP server: OAuth 2.1
131
117
  * authorization for servers that answer `401` with a challenge, tool
@@ -1,32 +1,9 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import { type SubagentCatalogEntry } from './subagent-catalog.js';
3
+ import { parseAgentRole, type AgentRoleEntry, type AgentRolePolicy } from '../../application/agent-roles.js';
4
+ export { parseAgentRole };
5
+ export type { AgentRoleEntry, AgentRolePolicy };
3
6
  export declare const AGENT_ROLE_TOOL_NAME = "subagent_role";
4
- /** Panel identity is preserved so identically named cards from different suites remain addressable. */
5
- export interface AgentRoleEntry {
6
- name: string;
7
- path: string;
8
- description: string;
9
- disabled: boolean;
10
- title?: string;
11
- rawText?: string;
12
- /** Suite checkout root the card's `${PLUGIN_ROOT}` variables resolve to; absent for project-native files. */
13
- suiteRoot?: string;
14
- /** The suite's `${PLUGIN_DATA}` directory; absent for project-native files. */
15
- suiteData?: string;
16
- }
17
- /**
18
- * The executable part of one card. `tools` / `disallowedTools` stay in the file
19
- * and are preserved by the editors, but they are not applied.
20
- */
21
- export interface AgentRolePolicy {
22
- content: string;
23
- model?: string;
24
- provider?: string;
25
- reasoningEffort?: string;
26
- title?: string;
27
- description?: string;
28
- disabled: boolean;
29
- }
30
7
  /** Child LLM options this plugin sends; never carries inherited parent values. */
31
8
  export interface AgentRoleOptions {
32
9
  provider?: string;
@@ -108,8 +85,6 @@ export interface AgentRoleJobs {
108
85
  run(): AgentRoleJob;
109
86
  }): string;
110
87
  }
111
- /** Strict YAML parsing prevents malformed routing metadata from silently inheriting wider privileges. */
112
- export declare function parseAgentRole(text: string): AgentRolePolicy;
113
88
  /**
114
89
  * Resolve the child LLM options for one role call.
115
90
  *
@@ -52,12 +52,12 @@ export declare function mountSubagentCatalog(ctx: Context, tool: {
52
52
  name: string;
53
53
  }, snapshot: (agent: CatalogAgent, signal: AbortSignal) => Promise<SubagentCatalogEntry[]>): () => void;
54
54
  /**
55
- * Model-facing catalog text: the role list followed by the same guidance on
56
- * first publication and on every update, so a replacement never arrives without
57
- * the rules that govern it. The guidance covers how to brief a child, how to
58
- * work with one while it runs, and when a role child is the wrong answer; the
59
- * per-channel arbitration between the host's delegation tools stays in the tool
60
- * descriptions the harness owns.
55
+ * Model-facing catalog text: the delegation triggers, then the role list, then
56
+ * the same guidance on first publication and on every update, so a replacement
57
+ * never arrives without the rules that govern it. The guidance covers when a
58
+ * role child is the default, how to brief one, and how to work with one while
59
+ * it runs; the per-channel arbitration between the host's delegation tools
60
+ * stays in the tool descriptions the harness owns.
61
61
  *
62
62
  * Role lines carry a name and a description only. The configured route stays in
63
63
  * the durable entries for execution and change detection; publishing it would
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Tolerant reads of optional services off a cordis context.
3
+ * @module runtime/core/context
4
+ */
5
+ /**
6
+ * Read one optional service off a cordis context, tolerating every access
7
+ * style the host shows.
8
+ *
9
+ * Cordis strict mode throws instead of returning `undefined` for an
10
+ * unregistered service, and contexts vary in which access style they expose —
11
+ * some the bare property, some only a `get()` accessor — so each read is
12
+ * guarded and absence always comes back as `undefined`, never a throw.
13
+ */
14
+ export declare function optionalService(ctx: unknown, name: string): unknown;
@@ -10,8 +10,8 @@
10
10
  * @module runtime/reconcile-scheduler
11
11
  */
12
12
  import type { Context } from '@deepseek-ai/cordis';
13
- import type { Suite } from '../model/types.js';
14
- import type { McpMountDiagnostic } from './mcp-mounts.js';
13
+ import type { Suite } from '../../model/types.js';
14
+ import type { McpMountDiagnostic } from '../mcp/mcp-mounts.js';
15
15
  import type { RuntimeReconciler } from './reconciler.js';
16
16
  /** The catalog surface one reconcile pass reads from and publishes to. */
17
17
  export interface ReconcileHost {
@@ -7,12 +7,12 @@
7
7
  * disposal only.
8
8
  */
9
9
  import type { Context } from '@deepseek-ai/cordis';
10
- import { type CommandMountDiagnostic } from './commands-mounts.js';
11
- import { type HooksMountDiagnostic } from './hooks-mounts.js';
12
- import { LspMountRegistry, type LspMountDiagnostic } from './lsp-mounts.js';
13
- import { type McpMountDiagnostic } from './mcp-mounts.js';
14
- import type { Suite } from '../model/types.js';
15
- import { type HostTranslate } from './host-locale.js';
10
+ import { type CommandMountDiagnostic } from '../surfaces/commands-mounts.js';
11
+ import { type HooksMountDiagnostic } from '../surfaces/hooks-mounts.js';
12
+ import { LspMountRegistry, type LspMountDiagnostic } from '../lsp/lsp-mounts.js';
13
+ import { type McpMountDiagnostic } from '../mcp/mcp-mounts.js';
14
+ import type { Suite } from '../../model/types.js';
15
+ import { type HostTranslate } from '../host/host-locale.js';
16
16
  /** Diagnostics returned by one runtime reconciliation pass. */
17
17
  export interface RuntimeDiagnostics {
18
18
  mcp: McpMountDiagnostic[];
@@ -35,11 +35,11 @@ export declare class RuntimeReconciler {
35
35
  /** The LSP mount registry, consumed by the LSP status surface. */
36
36
  get lsp(): LspMountRegistry;
37
37
  /** Install the per-suite MCP overrides provider used at mount time. */
38
- setMcpOverridesProvider(provider: () => Promise<Map<string, import('./mcp-overrides.js').McpSuiteOverrides>>): void;
38
+ setMcpOverridesProvider(provider: () => Promise<Map<string, import('../../application/mcp/mcp-overrides.js').McpSuiteOverrides>>): void;
39
39
  /** Install the live tool-name provider used for foreign-namespace mount guards. */
40
40
  setMcpToolNamesProvider(provider: () => string[]): void;
41
41
  /** Install the backend provider deciding which MCP client mounts each server. */
42
- setMcpBackendProvider(provider: () => Promise<import('./mcp-backend.js').McpBackend>): void;
42
+ setMcpBackendProvider(provider: () => Promise<import('../../application/mcp/mcp-backend.js').McpBackend>): void;
43
43
  /** Whether the current MCP snapshot uses one credential reference. */
44
44
  usesCredential(ref: string): boolean;
45
45
  /** Flag one MCP mount for an explicit rebuild on the next reconcile. */
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The chain of messages below one error, outermost first, redacted and
3
+ * de-duplicated. A repeated link ends the walk, so a chain that points back at
4
+ * itself cannot loop.
5
+ */
6
+ export declare function causeMessages(error: unknown): string[];
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Host-side runtime locale: bilingual copy for the host-facing strings a person
3
+ * reads, resolved from the harness's `locale.preference` setting.
4
+ *
5
+ * The model-facing subagent catalog is not here. It is fixed English, because it
6
+ * is a contract read alongside the harness's own English tool descriptions and
7
+ * must not change with the operator's interface language.
8
+ *
9
+ * The web client resolves locale through its own injected service. The host
10
+ * process reads the same setting off the harness settings service, which
11
+ * projects every active profile entry's live configuration: the `locale` entry
12
+ * carries `preference`. Every absence — no settings service, the entry not
13
+ * active, no preference written, a value that is not a string — means zh.
14
+ */
15
+ /** Host runtime dictionary keys (mirrored for zh and en). */
16
+ export type HostLocaleKey = 'commandAcknowledged' | 'userCommandSourceLabel' | 'feedbackToolCardTitle';
17
+ export type HostTranslate = (key: HostLocaleKey, params?: Record<string, string>) => string;
18
+ /**
19
+ * The settings entry the harness locale plugin owns. The web bundle patch
20
+ * inserts it as `- id: locale` / `name: '@deepseek-ai/dsh-client-locale'`, and
21
+ * that package's host half declares `Config = { preference: volatile(string) }`.
22
+ */
23
+ export declare const LOCALE_SETTINGS_ENTRY = "locale";
24
+ /**
25
+ * The slice of the host settings service this module reads: the projection of
26
+ * every active profile entry's live configuration that
27
+ * `@deepseek-ai/dsh-settings`'s `SettingsForms.describe()` returns. The
28
+ * namespace getter this read once called (`settings.get(ns)`) does not exist on
29
+ * the pinned host line — harness `601d6761e4` replaced it with this projection —
30
+ * so the shape is declared here against the published service.
31
+ */
32
+ export interface LocaleSettingsSource {
33
+ describe(): ReadonlyArray<{
34
+ ns: string;
35
+ value: unknown;
36
+ }>;
37
+ }
38
+ /** Resolve the active host language from settings; unknown values default to zh. */
39
+ export declare function bindHostLocale(preference: string | undefined): HostTranslate;
40
+ /**
41
+ * Wire the reader the host-facing copy resolves through. The caller registers
42
+ * the returned disposer with its own effects, so the wiring lives exactly as
43
+ * long as the fiber that installed it; the disposer clears this reader only, so
44
+ * a reload that installs a newer reader first keeps the newer one.
45
+ * @param read - reads the active `locale.preference`, or `undefined`.
46
+ * @returns the disposer that clears this wiring.
47
+ */
48
+ export declare function setHostLocaleSource(read: () => string | undefined): () => void;
49
+ /**
50
+ * The persisted locale preference: what {@link setHostLocaleSource} wired, and
51
+ * `undefined` while the entry has not wired a reader.
52
+ */
53
+ export declare function readLocalePreference(): string | undefined;
54
+ /**
55
+ * Read `locale.preference` off the settings service's entry projection.
56
+ *
57
+ * `ctx.get` resolves the service from the store, and the store answers for as
58
+ * long as the provider is active, so the caller can read it from the entry's
59
+ * own context. The property read this replaces walks the reading fiber's
60
+ * ancestors and throws `cannot get required service "settings" in inactive
61
+ * context` once that fiber unloads, the state a profile reload leaves an
62
+ * injection callback's context in.
63
+ * @param settings - the host settings service, when the profile mounts one.
64
+ * @returns the preference string, or `undefined` for every absence.
65
+ */
66
+ export declare function readHostLocalePreference(settings: LocaleSettingsSource | undefined): string | undefined;
@@ -1,4 +1,4 @@
1
- import type { ModelCatalogPayload } from '../contracts/market.js';
1
+ import type { ModelCatalogPayload } from '../../contracts/market.js';
2
2
  interface ModelCatalogHost {
3
3
  get?(name: string): unknown;
4
4
  }
@@ -13,9 +13,9 @@
13
13
  * @module runtime/settings-namespace
14
14
  */
15
15
  import type { Context } from '@deepseek-ai/cordis';
16
- import { type DownloadRegionSetting } from '../contracts/settings.js';
16
+ import { type DownloadRegionSetting } from '../../contracts/settings.js';
17
17
  import type { HostTranslate } from './host-locale.js';
18
- import type { McpBackend } from './mcp-backend.js';
18
+ import type { McpBackend } from '../../contracts/mcp.js';
19
19
  /** The five volatile references the entry's config carries for this namespace. */
20
20
  export interface MarketSettingRefs {
21
21
  mcpEnhanced: {
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Probe the user's login shell for the `PATH` it exports, once per process.
3
+ *
4
+ * `-i` is required, not incidental: Homebrew's `shellenv` line lives in
5
+ * `.zshrc`, which a non-interactive `zsh -lc` never reads. The probe prints
6
+ * one marker line and then the value, so a shell that writes banners or
7
+ * prompts to stdout cannot be mistaken for the value. Every failure —
8
+ * non-darwin, no shell, timeout, malformed output — resolves to `undefined`
9
+ * rather than throwing, because a caller must be able to fall back silently
10
+ * to today's behavior.
11
+ *
12
+ * @returns the absolute directories the login shell resolves, or `undefined`
13
+ * when the probe could not produce a usable `PATH`.
14
+ */
15
+ export declare function loginShellPathEntries(): Promise<string[] | undefined>;
16
+ /**
17
+ * Read the executable lookup path out of the environment the way the host
18
+ * subprocess provider does: a non-empty `PATH` entry, or the platform
19
+ * default when the variable is absent (as `child_process.spawn` itself
20
+ * resolves it).
21
+ */
22
+ export declare function environmentPath(env: Readonly<Record<string, string | undefined>> | undefined): string;
23
+ /**
24
+ * Append every directory the login shell has and `basePath` lacks, keeping
25
+ * `basePath`'s order and precedence intact.
26
+ *
27
+ * @returns the merged `PATH` and the appended directories, or `undefined`
28
+ * when the probe failed or added nothing.
29
+ */
30
+ export declare function augmentChildPath(basePath: string): Promise<{
31
+ path: string;
32
+ added: string[];
33
+ } | undefined>;
34
+ /**
35
+ * Read the host's executable lookup seam from a cordis context, tolerantly.
36
+ * The service is optional — a context without a subprocess runtime resolves
37
+ * nothing and the caller keeps today's behavior.
38
+ */
39
+ export declare function subprocessResolver(ctx: unknown): ((command: string, env: Record<string, string>) => Promise<string>) | undefined;
40
+ /**
41
+ * How one declared command resolved for a spawn.
42
+ *
43
+ * `path` is the `PATH` a child must carry, present only when the login shell
44
+ * added directories. `diagnostic` is the fact to report — the extension, or
45
+ * the searched `PATH` when resolution still failed; it is absent on the happy
46
+ * path where the base environment resolved the command unchanged.
47
+ */
48
+ export interface DeclaredCommandResolution {
49
+ /** `PATH` the child must carry so `command` resolves; absent when the base `PATH` suffices. */
50
+ path?: string;
51
+ /** The resolution fact to report; absent when the base environment resolved the command. */
52
+ diagnostic?: string;
53
+ }
54
+ /**
55
+ * Resolve one command a suite or the user declared, against the environment a
56
+ * spawn would inherit, extending `PATH` from the login shell only when that
57
+ * environment cannot find the command.
58
+ *
59
+ * The rule the two consumers share: an explicit `env.PATH` is a declaration
60
+ * and is never touched, so the caller gets `undefined` and keeps it verbatim.
61
+ * The plugin never rewrites the command itself — the bare name stays the
62
+ * command, and only the child's `PATH` grows.
63
+ *
64
+ * @param ctx - the cordis context carrying the host subprocess seam.
65
+ * @param command - the declared command, exactly as written.
66
+ * @param declaredEnv - the environment the suite/user declared for the child.
67
+ * @returns the extension to apply and its fact, or `undefined` when there is
68
+ * nothing to do (no seam, or an explicit `PATH`).
69
+ */
70
+ export declare function resolveDeclaredCommand(ctx: unknown, command: string, declaredEnv: Readonly<Record<string, string>>): Promise<DeclaredCommandResolution | undefined>;
@@ -28,15 +28,11 @@
28
28
  * user resolves it through per-suite surface toggles.
29
29
  */
30
30
  import type { Context } from '@deepseek-ai/cordis';
31
- import { type LegacyLspSeam } from './profile-seam.js';
32
- import { type PluginPathContext } from '../catalog/plugin-variables.js';
33
- import { type Suite } from '../model/types.js';
34
- export interface LspMountDiagnostic {
35
- suiteId: string;
36
- serverKey: string;
37
- reason: string;
38
- code?: 'mount-failed' | 'unmount-failed' | 'seam-conflict' | 'host-missing';
39
- }
31
+ import { type LegacyLspSeam } from '../../application/lsp/profile-seam.js';
32
+ import { type PluginPathContext } from '../../catalog/plugin-variables.js';
33
+ import { type Suite } from '../../model/types.js';
34
+ import type { LspMountDiagnostic } from '../../contracts/lsp.js';
35
+ export type { LspMountDiagnostic };
40
36
  /** One dsh-lsp-stdio server configuration row (its Config.servers entry). */
41
37
  export interface LspStdioServerConfig {
42
38
  command: string;
@@ -101,6 +97,17 @@ export declare class LspMountRegistry {
101
97
  reconcile(enabledSuites: Suite[]): Promise<LspMountDiagnostic[]>;
102
98
  /** Mount/unmount LSP servers to match the enabled suites plus direct config exactly. */
103
99
  private reconcileNow;
100
+ /**
101
+ * Resolve one server's declared command, extending its `PATH` from the
102
+ * login shell only when the current environment cannot find the command.
103
+ *
104
+ * An explicit `env.PATH` is a declaration and is left verbatim; the command
105
+ * itself is never rewritten. A resolution fact (the extension, or the
106
+ * searched `PATH` when it still failed) is appended to the suite's facts so
107
+ * it reaches the mount diagnostic; a fact is also a PATH extension exactly
108
+ * when `resolution.path` is set, and rides `pathExtensions` for the trace log.
109
+ */
110
+ private resolveServerCommand;
104
111
  /**
105
112
  * Mount the capability seam this plugin delivers end to end: `ctx.lsp`, then the model-facing
106
113
  * `lsp` tool.
@@ -127,7 +134,7 @@ export declare class LspMountRegistry {
127
134
  /** Install the plugin storage root per-suite data directories resolve against. */
128
135
  setPluginDataRoot(root: string): void;
129
136
  /** Install the direct (user-configured) server provider used at reconcile time. */
130
- setDirectProvider(provider: () => Promise<Record<string, import('../model/types.js').LspServerSpec>>): void;
137
+ setDirectProvider(provider: () => Promise<Record<string, import('../../model/types.js').LspServerSpec>>): void;
131
138
  setDisabledProvider(provider: () => Promise<Set<string>>): void;
132
139
  disabledServers(): Set<string>;
133
140
  /** The latest mount diagnostic per suite, for the LSP status surface. */
@@ -140,4 +147,3 @@ export declare class LspMountRegistry {
140
147
  /** Dispose every live mount after queued reconciliation passes settle. */
141
148
  disposeAll(): Promise<void>;
142
149
  }
143
- export {};
@@ -20,7 +20,7 @@
20
20
  * @module runtime/mcp-client/bridge
21
21
  */
22
22
  import type { Context } from '@deepseek-ai/cordis';
23
- import type { Config } from './config.js';
23
+ import type { Config } from '../../../application/mcp/mcp-bridge-config.js';
24
24
  /** Cordis plugin name used by loader diagnostics. */
25
25
  export declare const name = "market-mcp-client";
26
26
  /** Services required by this plugin. */
@@ -21,18 +21,10 @@
21
21
  * @module runtime/mcp-client/connection
22
22
  */
23
23
  import type { ToolHost } from './tools.js';
24
- import type { Config } from './config.js';
24
+ import type { Config } from '../../../application/mcp/mcp-bridge-config.js';
25
25
  /** Automatic reconnect policy for one MCP server connection. */
26
- export interface ReconnectConfig {
27
- /** Reconnect automatically after a lost connection (default true). */
28
- enabled?: boolean;
29
- /** First reconnect delay in milliseconds; doubles per consecutive failed attempt (default 500). */
30
- initialDelayMs?: number;
31
- /** Backoff ceiling in milliseconds; also the uptime after which the attempt budget resets (default 30000). */
32
- maxDelayMs?: number;
33
- /** Consecutive failed attempts per outage before giving up for good (default 10). */
34
- maxAttempts?: number;
35
- }
26
+ import type { ReconnectConfig } from '../../../application/mcp/mcp-bridge-config.js';
27
+ export type { ReconnectConfig };
36
28
  /** Defaults shared by the config and {@link resolveReconnectPolicy}. */
37
29
  export declare const RECONNECT_DEFAULTS: Required<ReconnectConfig>;
38
30
  /** Fully resolved reconnect policy captured at plugin load. */
@@ -8,7 +8,7 @@
8
8
  * @module runtime/mcp-client/host-contract
9
9
  */
10
10
  import type { ContentBlock } from '@deepseek-ai/dsh-llm';
11
- import type { JsonSchemaNode } from './json-schema-subset.js';
11
+ import type { JsonSchemaNode } from '@deepseek-ai/dsh-tools';
12
12
  /** Lossless JSON value vocabulary the bridge exchanges with the registry. */
13
13
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
14
14
  [key: string]: JsonValue;