dsh-agent-plugins-market 0.8.0 → 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 (158) hide show
  1. package/README.md +2 -2
  2. package/README.zh.md +2 -2
  3. package/client/client.js +1594 -1732
  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 +6 -21
  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 +64 -34
  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} +44 -66
  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 +24 -22
  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/index.d.ts +87 -1
  89. package/lib/types/model/types.d.ts +0 -14
  90. package/lib/types/runtime/{agent-role-router.d.ts → agents/agent-role-router.d.ts} +3 -28
  91. package/lib/types/runtime/{subagent-catalog.d.ts → agents/subagent-catalog.d.ts} +6 -6
  92. package/lib/types/runtime/core/context.d.ts +14 -0
  93. package/lib/types/runtime/{reconcile-scheduler.d.ts → core/reconcile-scheduler.d.ts} +2 -2
  94. package/lib/types/runtime/{reconciler.d.ts → core/reconciler.d.ts} +8 -8
  95. package/lib/types/runtime/host/failure-detail.d.ts +6 -0
  96. package/lib/types/runtime/host/host-locale.d.ts +66 -0
  97. package/lib/types/runtime/{model-catalog.d.ts → host/model-catalog.d.ts} +1 -1
  98. package/lib/types/runtime/{settings-namespace.d.ts → host/settings-namespace.d.ts} +42 -32
  99. package/lib/types/runtime/host/shell-path.d.ts +70 -0
  100. package/lib/types/runtime/{lsp-mounts.d.ts → lsp/lsp-mounts.d.ts} +17 -11
  101. package/lib/types/runtime/{mcp-client → mcp/bridge}/bridge.d.ts +1 -1
  102. package/lib/types/runtime/{mcp-client → mcp/bridge}/connection.d.ts +3 -11
  103. package/lib/types/runtime/{mcp-client → mcp/bridge}/host-contract.d.ts +1 -1
  104. package/lib/types/runtime/{mcp-client → mcp/bridge}/oauth.d.ts +1 -1
  105. package/lib/types/runtime/{mcp-client → mcp/bridge}/transport.d.ts +1 -1
  106. package/lib/types/runtime/{mcp-auth-record.d.ts → mcp/mcp-auth-record.d.ts} +1 -1
  107. package/lib/types/runtime/{mcp-credentials.d.ts → mcp/mcp-credentials.d.ts} +1 -1
  108. package/lib/types/runtime/{mcp-mounts.d.ts → mcp/mcp-mounts.d.ts} +5 -11
  109. package/lib/types/runtime/{user-commands.d.ts → panels/user-commands.d.ts} +1 -1
  110. package/lib/types/runtime/{user-panels.d.ts → panels/user-panels.d.ts} +1 -1
  111. package/lib/types/runtime/{commands-mounts.d.ts → surfaces/commands-mounts.d.ts} +2 -2
  112. package/lib/types/runtime/{hooks-mounts.d.ts → surfaces/hooks-mounts.d.ts} +1 -1
  113. package/lib/types/runtime/{project-runtime.d.ts → surfaces/project-runtime.d.ts} +3 -3
  114. package/lib/types/runtime/{skills-provider.d.ts → surfaces/skills-provider.d.ts} +1 -1
  115. package/package.json +39 -33
  116. package/lib/runtime/host-locale.js +0 -89
  117. package/lib/runtime/legacy-root-migration.js +0 -12
  118. package/lib/runtime/lsp-server-state.js +0 -19
  119. package/lib/runtime/mcp-client/json-schema-subset.js +0 -181
  120. package/lib/types/runtime/host-locale.d.ts +0 -31
  121. package/lib/types/runtime/legacy-root-migration.d.ts +0 -2
  122. package/lib/types/runtime/mcp-client/json-schema-subset.d.ts +0 -58
  123. package/lib/types/runtime/mcp-direct-config.d.ts +0 -39
  124. /package/lib/{runtime/mcp-client/config.js → application/mcp/mcp-bridge-config.js} +0 -0
  125. /package/lib/{runtime → application/mcp}/mcp-redaction.js +0 -0
  126. /package/lib/{runtime → application}/regions.js +0 -0
  127. /package/lib/runtime/{agent-role-names.js → agents/agent-role-names.js} +0 -0
  128. /package/lib/runtime/{mount-lifecycle.js → core/mount-lifecycle.js} +0 -0
  129. /package/lib/runtime/{reconcile-scheduler.js → core/reconcile-scheduler.js} +0 -0
  130. /package/lib/runtime/{source-auto-update.js → core/source-auto-update.js} +0 -0
  131. /package/lib/runtime/{timer-seat.js → core/timer-seat.js} +0 -0
  132. /package/lib/runtime/{model-catalog.js → host/model-catalog.js} +0 -0
  133. /package/lib/runtime/{plugin-message-source.js → host/plugin-message-source.js} +0 -0
  134. /package/lib/runtime/{mcp-client → mcp/bridge}/host-contract.js +0 -0
  135. /package/lib/runtime/{mcp-client → mcp/bridge}/host-seams.js +0 -0
  136. /package/lib/runtime/{mcp-client → mcp/bridge}/plugin-identity.js +0 -0
  137. /package/lib/runtime/{mcp-client → mcp/bridge}/projection.js +0 -0
  138. /package/lib/runtime/{mcp-client → mcp/bridge}/transport.js +0 -0
  139. /package/lib/runtime/{mcp-credentials.js → mcp/mcp-credentials.js} +0 -0
  140. /package/lib/runtime/{dynamic-context.js → surfaces/dynamic-context.js} +0 -0
  141. /package/lib/types/{runtime → application}/deadline.d.ts +0 -0
  142. /package/lib/types/{runtime → application/lsp}/lsp-server-state.d.ts +0 -0
  143. /package/lib/types/{runtime → application/lsp}/profile-seam.d.ts +0 -0
  144. /package/lib/types/{runtime → application/mcp}/mcp-redaction.d.ts +0 -0
  145. /package/lib/types/{runtime → application}/server-config.d.ts +0 -0
  146. /package/lib/types/{runtime → application/state}/storage-migration.d.ts +0 -0
  147. /package/lib/types/runtime/{agent-role-names.d.ts → agents/agent-role-names.d.ts} +0 -0
  148. /package/lib/types/runtime/{mount-lifecycle.d.ts → core/mount-lifecycle.d.ts} +0 -0
  149. /package/lib/types/runtime/{source-auto-update.d.ts → core/source-auto-update.d.ts} +0 -0
  150. /package/lib/types/runtime/{timer-seat.d.ts → core/timer-seat.d.ts} +0 -0
  151. /package/lib/types/runtime/{feedback-tool.d.ts → host/feedback-tool.d.ts} +0 -0
  152. /package/lib/types/runtime/{plugin-message-source.d.ts → host/plugin-message-source.d.ts} +0 -0
  153. /package/lib/types/runtime/{tool-registry-observer.d.ts → host/tool-registry-observer.d.ts} +0 -0
  154. /package/lib/types/runtime/{mcp-client → mcp/bridge}/host-seams.d.ts +0 -0
  155. /package/lib/types/runtime/{mcp-client → mcp/bridge}/plugin-identity.d.ts +0 -0
  156. /package/lib/types/runtime/{mcp-client → mcp/bridge}/projection.d.ts +0 -0
  157. /package/lib/types/runtime/{mcp-client → mcp/bridge}/tools.d.ts +0 -0
  158. /package/lib/types/runtime/{dynamic-context.d.ts → surfaces/dynamic-context.d.ts} +0 -0
@@ -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
  }
@@ -1,25 +1,39 @@
1
1
  /**
2
- * The host settings namespace this plugin registers.
2
+ * The market settings the host carries in this plugin's own config: the loader
3
+ * projects the entry's `Config` schema into the `dsh-agent-plugins-market`
4
+ * settings namespace, so the Plugins panel's configuration page reads and
5
+ * writes these five switches, and the host updates the volatile references in
6
+ * place on every change (emitting `loader/volatile-update`).
3
7
  *
4
- * The registration is also what makes the host's plugin-config tab serve this
5
- * plugin's card, and it carries the MCP mount backend, the download region,
6
- * the project-layout switch, the experience-feedback tool switch, and the
7
- * background source-update switch. `settings.register`
8
- * throws on a duplicate namespace, so there is exactly one inject block and one
9
- * registration.
10
- *
11
- * The whole callback is failure-contained on purpose: a throw inside it is
12
- * INVISIBLE in the UI (the inject resolves asynchronously and cordis only logs
13
- * it) and silently removes the namespace from `settings.describe`, which is
14
- * what hides the plugin-config card. Every failure mode lands in the logger
15
- * with a loud prefix instead.
8
+ * Every consumer reads through {@link MarketSettingsNamespace.settings} so
9
+ * "the field is absent" has exactly one answer —
10
+ * {@link resolveMarketSettings} — instead of each caller inventing its own
11
+ * fallback for the window before the host applies its first value.
16
12
  *
17
13
  * @module runtime/settings-namespace
18
14
  */
19
15
  import type { Context } from '@deepseek-ai/cordis';
20
- import { type DownloadRegionSetting } from '../contracts/settings.js';
16
+ import { type DownloadRegionSetting } from '../../contracts/settings.js';
21
17
  import type { HostTranslate } from './host-locale.js';
22
- import { type McpBackend } from './mcp-backend.js';
18
+ import type { McpBackend } from '../../contracts/mcp.js';
19
+ /** The five volatile references the entry's config carries for this namespace. */
20
+ export interface MarketSettingRefs {
21
+ mcpEnhanced: {
22
+ get(): boolean | undefined;
23
+ };
24
+ scanProjectLayouts: {
25
+ get(): boolean | undefined;
26
+ };
27
+ downloadRegion: {
28
+ get(): DownloadRegionSetting | undefined;
29
+ };
30
+ feedbackEnabled: {
31
+ get(): boolean | undefined;
32
+ };
33
+ autoUpdateSources: {
34
+ get(): boolean | undefined;
35
+ };
36
+ }
23
37
  /** Runtime reactions the namespace drives. */
24
38
  export interface SettingsNamespaceHost {
25
39
  /** Apply the project-layout discovery switch; rejection is logged and contained. */
@@ -31,10 +45,10 @@ export interface SettingsNamespaceHost {
31
45
  }
32
46
  export declare class MarketSettingsNamespace {
33
47
  private readonly ctx;
48
+ private readonly refs;
34
49
  private readonly dataRoot;
35
50
  private readonly locale;
36
51
  private readonly host;
37
- private scope;
38
52
  private readonly watchers;
39
53
  private feedbackDisposer;
40
54
  /**
@@ -44,31 +58,27 @@ export declare class MarketSettingsNamespace {
44
58
  * switch, or skipped because the host has no tools registry to register on.
45
59
  */
46
60
  private feedbackMountState;
47
- constructor(ctx: Context, dataRoot: string, locale: {
61
+ constructor(ctx: Context, refs: MarketSettingRefs, dataRoot: string, locale: {
48
62
  t: HostTranslate;
49
63
  }, host: SettingsNamespaceHost);
50
- /** Register the namespace; the host resolves it whenever the settings service mounts. */
64
+ /** Subscribe the runtime reactions to live settings updates. */
51
65
  mount(): void;
52
- /** The persisted MCP backend choice; the built-in client until registration lands. */
66
+ /** Release every watcher and unmount the feedback tool. */
67
+ dispose(): void;
68
+ /**
69
+ * The resolved settings, from the volatile references the host updates in place.
70
+ */
71
+ private settings;
72
+ /** The persisted MCP backend choice; the built-in client until the host applies a value. */
53
73
  backend(): Promise<McpBackend>;
54
74
  /**
55
- * Persist a backend choice.
56
- * @throws when the settings service is not mounted.
75
+ * Legacy write path for the backend choice: the value now lives in the host
76
+ * settings document, edited from the Plugins panel's configuration page, so
77
+ * this accepts the request and lets the volatile reference decide.
57
78
  */
58
79
  setBackend(backend: McpBackend): Promise<void>;
59
80
  /** The persisted download-region setting. */
60
81
  downloadRegion(): Promise<DownloadRegionSetting>;
61
- /**
62
- * The resolved settings, whether or not the namespace is registered yet.
63
- *
64
- * Every reader goes through here so "the field is absent" has exactly one
65
- * answer — {@link resolveMarketSettings} — instead of each caller inventing
66
- * its own fallback for the window before registration lands.
67
- */
68
- private settings;
69
- /** Release every watcher and unmount the feedback tool. */
70
- dispose(): void;
71
- private register;
72
82
  /** Apply the background source-update switch. */
73
83
  private syncAutoUpdateSources;
74
84
  private syncProjectLayouts;
@@ -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;
@@ -29,7 +29,7 @@
29
29
  */
30
30
  import { type OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
31
31
  import type { OAuthClientInformationMixed, OAuthClientMetadata, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
32
- import type { OAuthStorageConfig } from './config.js';
32
+ import type { OAuthStorageConfig } from '../../../application/mcp/mcp-bridge-config.js';
33
33
  /** Credential-record scope for MCP OAuth state; per-server ids follow it. */
34
34
  export declare const MCP_AUTH_RECORD_SCOPE = "mcp-auth";
35
35
  /**
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
12
12
  import { LoopbackOAuthClientProvider } from './oauth.js';
13
- import type { Config } from './config.js';
13
+ import type { Config } from '../../../application/mcp/mcp-bridge-config.js';
14
14
  /**
15
15
  * Create an MCP transport from the resolved bridge config.
16
16
  *
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * @module runtime/mcp-auth-record
10
10
  */
11
- import { type CredentialKey } from './mcp-client/host-seams.js';
11
+ import { type CredentialKey } from './bridge/host-seams.js';
12
12
  /** Credential-record scope for MCP OAuth state; per-server ids follow it. */
13
13
  export declare const MCP_AUTH_RECORD_SCOPE = "mcp-auth";
14
14
  /**
@@ -1,6 +1,6 @@
1
1
  /** Resolve MCP `${NAME}` placeholders through the optional DSH credentials seam. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
- import type { McpCredentialResolver } from './mcp-config.js';
3
+ import type { McpCredentialResolver } from '../../application/mcp/mcp-config.js';
4
4
  /**
5
5
  * Build the resolver used at mount time. Standard DSH profiles provide
6
6
  * `ctx.credentials`; minimal profiles retain the historical process-env
@@ -9,17 +9,11 @@
9
9
  * the manager's diagnostic list.
10
10
  */
11
11
  import type { Context } from '@deepseek-ai/cordis';
12
- import type { McpBackend } from './mcp-backend.js';
13
- import type { McpSuiteOverrides } from './mcp-overrides.js';
14
- import { type McpMountFailureCode } from './mcp-config.js';
15
- import type { Suite } from '../model/types.js';
16
- export interface McpMountDiagnostic {
17
- suiteId: string;
18
- serverKey: string;
19
- reason: string;
20
- code?: McpMountFailureCode;
21
- credentialRefs?: string[];
22
- }
12
+ import type { McpBackend } from '../../contracts/mcp.js';
13
+ import type { McpSuiteOverrides } from '../../application/mcp/mcp-overrides.js';
14
+ import type { Suite } from '../../model/types.js';
15
+ import type { McpMountDiagnostic } from '../../contracts/mcp.js';
16
+ export type { McpMountDiagnostic };
23
17
  export declare class McpMountRegistry {
24
18
  private readonly ctx;
25
19
  private readonly pluginDataRoot;
@@ -10,7 +10,7 @@
10
10
  * @module runtime/user-commands
11
11
  */
12
12
  import type { Context } from '@deepseek-ai/cordis';
13
- import type { HostTranslate } from './host-locale.js';
13
+ import type { HostTranslate } from '../host/host-locale.js';
14
14
  import type { UserPanelStore } from './user-panels.js';
15
15
  /** Register/unregister user-panel commands to match the panel's enabled entries. */
16
16
  export declare class UserCommandMountRegistry {
@@ -30,7 +30,7 @@
30
30
  * @module runtime/user-panels
31
31
  */
32
32
  import type { SkillCandidate, SkillDefinition, SkillLookupOptions, SkillProvider } from '@deepseek-ai/dsh-skill';
33
- import { type EntryShape, type UserEntryFile } from './user-store.js';
33
+ import { type EntryShape, type UserEntryFile } from '../../application/panels/user-store.js';
34
34
  /** The skill-source label user-panel entries carry into the skill registry. */
35
35
  export declare const USER_PANEL_SKILL_SOURCE = "user-panel";
36
36
  /** A user panel entry as the HTTP layer serializes it. */
@@ -12,8 +12,8 @@
12
12
  * reported as a diagnostic.
13
13
  */
14
14
  import type { Context } from '@deepseek-ai/cordis';
15
- import type { Suite, SuiteMarkdownResource } from '../model/types.js';
16
- import { type HostTranslate } from './host-locale.js';
15
+ import type { Suite, SuiteMarkdownResource } from '../../model/types.js';
16
+ import { type HostTranslate } from '../host/host-locale.js';
17
17
  export interface CommandMountDiagnostic {
18
18
  suiteId: string;
19
19
  command: string;
@@ -1,5 +1,5 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { Suite } from '../model/types.js';
2
+ import type { Suite } from '../../model/types.js';
3
3
  export interface HooksMountDiagnostic {
4
4
  suiteId: string;
5
5
  reason: string;
@@ -1,8 +1,8 @@
1
1
  /** Native project effects are owned by the receiving agent's scoped host context. */
2
2
  import type { Context } from '@deepseek-ai/cordis';
3
- import type { Catalog } from '../application/catalog.js';
4
- import type { HostTranslate } from './host-locale.js';
5
- import type { Suite } from '../model/types.js';
3
+ import type { Catalog } from '../../application/catalog.js';
4
+ import type { HostTranslate } from '../host/host-locale.js';
5
+ import type { Suite } from '../../model/types.js';
6
6
  /** Mount under existing and newly created agents; the caller owns refresh and teardown. */
7
7
  export declare function mountProjectCommands(ctx: Context, catalog: Catalog, t: HostTranslate, dataRoot?: string): {
8
8
  refresh(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import type { SkillCandidate, SkillDefinition, SkillLookupOptions, SkillProvider } from '@deepseek-ai/dsh-skill';
2
- import type { Catalog } from '../application/catalog.js';
2
+ import type { Catalog } from '../../application/catalog.js';
3
3
  import { type ShellSeam } from './dynamic-context.js';
4
4
  export declare const SUITE_PROJECT_SOURCE = "agent-plugin-project";
5
5
  export declare const SUITE_USER_SOURCE = "agent-plugin-user";