@lmzhen/dsh-evolution-core 0.49.0 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/lib/authority-plugin.js +2 -1
  2. package/lib/citations-CZKTUGQF.js +198 -0
  3. package/lib/composition/index.js +3 -3
  4. package/lib/{composition-Cqjbho0t.js → composition-CtNbVHq3.js} +1 -1
  5. package/lib/connection-DAJy7Xjm.js +28 -0
  6. package/lib/{ensure-CAjLGd9f.js → ensure-BLmEW0Ju.js} +25 -7
  7. package/lib/errors.js +2 -0
  8. package/lib/extract-plan-D6o__2Kf.js +271 -0
  9. package/lib/extract.js +240 -0
  10. package/lib/http-routes.js +27 -7
  11. package/lib/index.js +100 -811
  12. package/lib/{numeric-D8js3sqC.js → limits-C9jfvxBl.js} +1 -43
  13. package/lib/{mutation-authority-l57R626O.js → mutation-authority-DQfpXs1O.js} +2 -54
  14. package/lib/numeric-Dc53KQoe.js +43 -0
  15. package/lib/platform/index.js +4 -3
  16. package/lib/platform-DyHnHUmQ.js +251 -0
  17. package/lib/policy.js +3 -2
  18. package/lib/quality-DpAS0rd9.js +554 -0
  19. package/lib/restrictor.js +1 -1
  20. package/lib/result.js +33 -0
  21. package/lib/runtime/plugin.js +97 -43
  22. package/lib/{session-projection-DSXnUNZG.js → session-projection-ByNxQi9O.js} +2 -198
  23. package/lib/skill-health-BQCM4N8z.js +1419 -0
  24. package/lib/{skill-history-CxrDE3Rb.js → skill-history-CZp8vhyL.js} +46 -2
  25. package/lib/skills.js +140 -20
  26. package/lib/state-store-Jpa-iYIZ.js +54 -0
  27. package/lib/subagent/index.js +214 -176
  28. package/lib/{tools-DzcNFex2.js → tools-BrUswg8v.js} +3 -1
  29. package/lib/types/composition/ensure.js +21 -7
  30. package/lib/types/composition/preset-ids.d.ts +2 -1
  31. package/lib/types/composition/preset-ids.js +7 -1
  32. package/lib/types/events.d.ts +3 -0
  33. package/lib/types/extract-plan.d.ts +2 -0
  34. package/lib/types/extract.d.ts +12 -0
  35. package/lib/types/extract.js +12 -0
  36. package/lib/types/http-routes.js +32 -9
  37. package/lib/types/index.d.ts +0 -3
  38. package/lib/types/index.js +0 -3
  39. package/lib/types/opt-in.js +4 -3
  40. package/lib/types/params.js +2 -1
  41. package/lib/types/platform/agents.d.ts +32 -0
  42. package/lib/types/platform/agents.js +26 -0
  43. package/lib/types/platform/commands.d.ts +14 -0
  44. package/lib/types/platform/commands.js +9 -0
  45. package/lib/types/platform/connection.d.ts +26 -0
  46. package/lib/types/platform/connection.js +27 -0
  47. package/lib/types/platform/index.d.ts +26 -0
  48. package/lib/types/platform/index.js +13 -0
  49. package/lib/types/platform/llm.d.ts +3 -1
  50. package/lib/types/platform/llm.js +1 -0
  51. package/lib/types/platform/platformView.d.ts +21 -0
  52. package/lib/types/platform/platformView.js +29 -0
  53. package/lib/types/platform/profileContext.d.ts +16 -0
  54. package/lib/types/platform/profileContext.js +14 -0
  55. package/lib/types/platform/sessionQuery.d.ts +14 -0
  56. package/lib/types/platform/sessionQuery.js +9 -0
  57. package/lib/types/platform/settings.d.ts +22 -0
  58. package/lib/types/platform/settings.js +14 -0
  59. package/lib/types/platform/skills.d.ts +16 -0
  60. package/lib/types/platform/skills.js +9 -0
  61. package/lib/types/platform/storageDomain.d.ts +13 -0
  62. package/lib/types/platform/storageDomain.js +9 -0
  63. package/lib/types/platform/subagents.d.ts +25 -0
  64. package/lib/types/platform/subagents.js +17 -0
  65. package/lib/types/platform/systemPrompt.d.ts +16 -0
  66. package/lib/types/platform/systemPrompt.js +13 -0
  67. package/lib/types/platform/tools.d.ts +4 -0
  68. package/lib/types/platform/tools.js +2 -0
  69. package/lib/types/platform/userQuestions.d.ts +33 -0
  70. package/lib/types/platform/userQuestions.js +9 -0
  71. package/lib/types/platform/workingDirectory.d.ts +14 -0
  72. package/lib/types/platform/workingDirectory.js +9 -0
  73. package/lib/types/platform-line.generated.d.ts +5 -5
  74. package/lib/types/platform-line.generated.js +5 -5
  75. package/lib/types/platform-services.js +4 -0
  76. package/lib/types/prompts.d.ts +9 -8
  77. package/lib/types/prompts.js +20 -1
  78. package/lib/types/result.d.ts +35 -0
  79. package/lib/types/result.js +25 -0
  80. package/lib/types/review-context.d.ts +8 -0
  81. package/lib/types/review-context.js +11 -0
  82. package/lib/types/run-registry.d.ts +2 -1
  83. package/lib/types/run-registry.js +37 -7
  84. package/lib/types/runtime/llm.d.ts +2 -2
  85. package/lib/types/runtime/llm.js +5 -8
  86. package/lib/types/runtime/platform.d.ts +37 -4
  87. package/lib/types/runtime/platform.js +40 -5
  88. package/lib/types/runtime/projections.d.ts +9 -4
  89. package/lib/types/runtime/projections.js +64 -28
  90. package/lib/types/section-selection.js +5 -0
  91. package/lib/types/skill-history.d.ts +29 -3
  92. package/lib/types/skill-history.js +30 -0
  93. package/lib/types/skill-store.d.ts +32 -4
  94. package/lib/types/skill-store.js +109 -15
  95. package/lib/types/subagent/channel.d.ts +1 -3
  96. package/lib/types/subagent/channel.js +2 -332
  97. package/lib/types/subagent/index.d.ts +2 -0
  98. package/lib/types/subagent/index.js +2 -0
  99. package/lib/types/subagent/kernel.d.ts +4 -0
  100. package/lib/types/subagent/kernel.js +234 -0
  101. package/lib/types/subagent/readiness.js +5 -7
  102. package/lib/types/subagent/run.d.ts +53 -0
  103. package/lib/types/subagent/run.js +125 -0
  104. package/lib/types/subagent/types.d.ts +3 -3
  105. package/lib/types/write-gates.js +11 -1
  106. package/lib/usage-B5a90TKv.js +1257 -0
  107. package/lib/write.js +1 -1
  108. package/package.json +37 -25
  109. package/lib/platform-Cc9cNt5j.js +0 -111
  110. package/lib/skill-health-DP8z9TPf.js +0 -2923
@@ -11,6 +11,7 @@
11
11
  * @module @lmzhen/dsh-evolution-core/http-routes
12
12
  */
13
13
  import { isRecord } from "./guards.js";
14
+ import { connectionPort } from "./platform/connection.js";
14
15
  /** Largest request body a family route accepts; a bigger one reads as "no body" (400 from the handler). */
15
16
  export const MAX_REQUEST_BODY_BYTES = 64 * 1024;
16
17
  /**
@@ -63,12 +64,26 @@ export const HOST_ROUTES = {
63
64
  view: '/api/dsh-evolution/diagnostics',
64
65
  },
65
66
  };
67
+ /** Resolve through the port; only a context with NO platform service falls back to its direct service (legacy tests/fakes). */
68
+ function connectionFor(ctx) {
69
+ const platform = ctx.get('evolutionPlatform');
70
+ const port = platform?.ports?.connection ?? connectionPort(ctx);
71
+ if (port !== undefined)
72
+ return port;
73
+ // Cordis' inject callback hands the service on the scope for fake contexts that do not implement get().
74
+ const raw = ctx.connection;
75
+ if (raw?.fetch?.register === undefined)
76
+ return undefined;
77
+ return {
78
+ allowsRemoteAuthorities: raw.allowsRemoteAuthorities === true,
79
+ register: route => raw.fetch.register(route),
80
+ };
81
+ }
66
82
  export function hostSurface(ctx) {
67
- const connection = ctx.get('connection');
68
- if (connection === undefined)
83
+ const port = connectionFor(ctx);
84
+ if (port === undefined)
69
85
  return { available: false, code: 'E-325', reason: 'connection-missing' };
70
- const allows = connection.allowsRemoteAuthorities === true;
71
- return { available: true, allowsRemoteAuthorities: allows };
86
+ return { available: true, allowsRemoteAuthorities: port.allowsRemoteAuthorities };
72
87
  }
73
88
  /**
74
89
  * Register the family host surface on the platform's exact-route carrier.
@@ -84,7 +99,7 @@ export function registerHostRoutes(owner, build) {
84
99
  if (typeof injecting.inject !== 'function')
85
100
  throw new Error('host routes require a context that owns inject()');
86
101
  injecting.inject(['connection'], (scope) => {
87
- const connection = scope.connection;
102
+ const connection = connectionFor(scope);
88
103
  const audit = {
89
104
  channel: 'connection.fetch',
90
105
  principal: 'owner',
@@ -103,15 +118,23 @@ export function registerHostRoutes(owner, build) {
103
118
  // installable platform (rc.1) always carries connection.fetch. A missing register is an
104
119
  // assembly error, not a reason to fall back to a loopback webserver bridge — that bridge was
105
120
  // the second admission path the audit found (G4 had already deleted the fence it duplicated).
106
- if (connection?.fetch === undefined || typeof connection.fetch.register !== 'function') {
121
+ if (connection === undefined) {
107
122
  throw new Error('connection.fetch.register() is required to register family host routes (platform >= 0.2.2-rc.1); no fallback admission path exists');
108
123
  }
109
- const register = connection.fetch.register.bind(connection.fetch);
124
+ const register = connection.register.bind(connection);
110
125
  effect.call(scope, () => {
111
126
  const disposers = [];
112
127
  try {
113
- for (const route of routes)
114
- disposers.push(register(route));
128
+ for (const route of routes) {
129
+ const outcome = connection.tryRegister?.(route);
130
+ if (outcome === undefined) {
131
+ disposers.push(register(route));
132
+ continue;
133
+ }
134
+ if (!outcome.ok)
135
+ throw new Error(outcome.error.message);
136
+ disposers.push(outcome.value);
137
+ }
115
138
  }
116
139
  catch (error) {
117
140
  for (const dispose of disposers) {
@@ -40,13 +40,10 @@ export * from './write-gates.ts';
40
40
  export * from './reference-rewrite.ts';
41
41
  export * from './support-refs.ts';
42
42
  export * from './section-selection.ts';
43
- export * from './extract-plan.ts';
44
- export * from './extract-request.ts';
45
43
  export * from './owner-resolver.ts';
46
44
  export * from './proposal-view.ts';
47
45
  export * from './proposal-report.ts';
48
46
  export * from './external-support.ts';
49
- export * from './extract-prompt.ts';
50
47
  export * from './cost.ts';
51
48
  export * from './health-baseline.ts';
52
49
  export * from './curator.ts';
@@ -41,13 +41,10 @@ export * from "./write-gates.js";
41
41
  export * from "./reference-rewrite.js";
42
42
  export * from "./support-refs.js";
43
43
  export * from "./section-selection.js";
44
- export * from "./extract-plan.js";
45
- export * from "./extract-request.js";
46
44
  export * from "./owner-resolver.js";
47
45
  export * from "./proposal-view.js";
48
46
  export * from "./proposal-report.js";
49
47
  export * from "./external-support.js";
50
- export * from "./extract-prompt.js";
51
48
  export * from "./cost.js";
52
49
  export * from "./health-baseline.js";
53
50
  export * from "./curator.js";
@@ -1,3 +1,4 @@
1
+ import { toolsPort } from "./platform/tools.js";
1
2
  import { scopeOf } from "./platform/index.js";
2
3
  /**
3
4
  * Tool names only a session that mounted the family's MODEL rows can see.
@@ -46,11 +47,11 @@ export function scopedProbeReport() {
46
47
  * @returns true when at least one family model tool is visible to that session.
47
48
  */
48
49
  export function sessionSeesFamilyTools(ctx, sessionId) {
49
- const probe = ctx;
50
- const tools = probe.get('tools');
50
+ const platform = ctx.get('evolutionPlatform');
51
+ const tools = platform?.ports.tools ?? toolsPort(ctx);
51
52
  if (tools === undefined)
52
53
  return false;
53
- const agent = probe.get('agents')?.get(sessionId);
54
+ const agent = platform?.ports.agents?.get(sessionId);
54
55
  const scope = agent?.ctx === undefined ? undefined : scopeOf(agent.ctx);
55
56
  return FAMILY_SESSION_TOOL_NAMES.some(name => tools.get(name, scope) !== undefined);
56
57
  }
@@ -12,6 +12,7 @@
12
12
  * Writing is canonical-only (a deprecated name is not a live row field in 0.48).
13
13
  * @module
14
14
  */
15
+ import { settingsPort } from "./platform/settings.js";
15
16
  /** Deprecated alias (plugin-row name) -> canonical id (policy/snapshot name).
16
17
  * Retained for the one-time legacy-document migration and the doctor's old-key report;
17
18
  * live readers use the canonical id only. */
@@ -237,7 +238,7 @@ export function paramSettingsId(owner) {
237
238
  */
238
239
  export function userSetKeys(ctx, rowId) {
239
240
  // platform-declaration anchor: the platform’s `settings` service (optional; undefined ⇒ the source column reports “unknown”)
240
- const settings = ctx.get('settings');
241
+ const settings = settingsPort(ctx);
241
242
  const entry = settings?.describe?.({ redactSecrets: false }).find(item => item.ns === rowId);
242
243
  return new Set(Object.keys(entry?.user ?? {}));
243
244
  }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The agents half of the family's host platform boundary.
3
+ *
4
+ * The platform no longer maintains a runtime parent/child tree; root identity is
5
+ * derived from the exact live registry entry and its session origin. Features
6
+ * receive that rule here, not as a `roots()` call.
7
+ */
8
+ import type { Context } from '@deepseek-ai/cordis';
9
+ /** The part of an Agent this port needs; the platform Agent has more fields. */
10
+ export interface AgentIdentity {
11
+ readonly id: string;
12
+ readonly ctx?: Context;
13
+ readonly session?: {
14
+ readonly header?: {
15
+ readonly origin?: string;
16
+ };
17
+ };
18
+ }
19
+ export interface AgentsPort {
20
+ /** @returns the live agent registered under this id, if any. */
21
+ get(id: string): AgentIdentity | undefined;
22
+ /** @returns every live agent, or an empty list when the service has no list face. */
23
+ list(): readonly AgentIdentity[];
24
+ /**
25
+ * Whether the agent is an exact live registry entry and is not a subagent.
26
+ * This mirrors `user-questions`'s `assertLiveRoot` without importing it.
27
+ */
28
+ isRoot(agent: AgentIdentity): boolean;
29
+ }
30
+ /** Resolve the agents port; undefined means the host has no agents service. */
31
+ export declare function agentsPort(ctx: Context): AgentsPort | undefined;
32
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1,26 @@
1
+ const asIdentity = (value) => {
2
+ if (value === null || typeof value !== 'object')
3
+ return undefined;
4
+ const id = value.id;
5
+ return typeof id === 'string' ? value : undefined;
6
+ };
7
+ /** Resolve the agents port; undefined means the host has no agents service. */
8
+ export function agentsPort(ctx) {
9
+ // platform-declaration anchor: agents is declared in core PLATFORM_SERVICE_PROBES.
10
+ const agents = ctx.get('agents');
11
+ if (agents === undefined)
12
+ return undefined;
13
+ if (typeof agents.get !== 'function' && typeof agents.list !== 'function')
14
+ return undefined;
15
+ const get = typeof agents.get === 'function' ? agents.get.bind(agents) : undefined;
16
+ const list = typeof agents.list === 'function' ? agents.list.bind(agents) : undefined;
17
+ return {
18
+ get: (id) => get === undefined ? undefined : asIdentity(get(id)),
19
+ list: () => list === undefined ? [] : list().map(asIdentity).filter((agent) => agent !== undefined),
20
+ isRoot: (agent) => {
21
+ const live = get === undefined ? undefined : asIdentity(get(agent.id));
22
+ return live !== undefined && live === agent && live.session?.header?.origin !== 'subagent';
23
+ },
24
+ };
25
+ }
26
+ //# sourceMappingURL=agents.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The commands half of the family's host platform boundary.
3
+ *
4
+ * Feature packages register command definitions through this port; the platform
5
+ * command runtime remains the owner of dispatch, client behavior and disposal.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ import type { CommandDefinition } from '@deepseek-ai/dsh-commands';
9
+ export interface CommandsPort {
10
+ register(definition: CommandDefinition): () => void;
11
+ }
12
+ /** Resolve the commands port; undefined means the host has no commands service. */
13
+ export declare function commandsPort(ctx: Context): CommandsPort | undefined;
14
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Resolve the commands port; undefined means the host has no commands service. */
2
+ export function commandsPort(ctx) {
3
+ // platform-declaration anchor: commands is declared in core PLATFORM_SERVICE_PROBES.
4
+ const service = ctx.get('commands');
5
+ if (service === undefined || typeof service.register !== 'function')
6
+ return undefined;
7
+ return { register: (definition) => service.register(definition) };
8
+ }
9
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The connection half of the family's host platform boundary.
3
+ *
4
+ * The platform owns admission on the fetch carrier; the family only registers
5
+ * exact routes and reports whether remote authorities are configured. A service
6
+ * without `fetch.register` still exists as a port so `hostSurface` can report
7
+ * the deployment fact, while registration fails loud at the call site.
8
+ */
9
+ import type { Context } from '@deepseek-ai/cordis';
10
+ import { type FamilyError, type Result } from '../result.ts';
11
+ export interface ConnectionRoute {
12
+ readonly path: string;
13
+ readonly methods: readonly string[];
14
+ readonly requestBody: 'buffered' | 'streaming';
15
+ fetch(request: Request): Promise<Response>;
16
+ }
17
+ export type ConnectionRegisterResult = Result<() => Promise<void>, FamilyError>;
18
+ export interface ConnectionPort {
19
+ readonly allowsRemoteAuthorities: boolean;
20
+ register(route: ConnectionRoute): () => Promise<void>;
21
+ /** Typed registration for callers that do not want to catch; optional during migration. */
22
+ tryRegister?(route: ConnectionRoute): ConnectionRegisterResult;
23
+ }
24
+ /** Resolve the connection port; undefined means the host has no connection service. */
25
+ export declare function connectionPort(ctx: Context): ConnectionPort | undefined;
26
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1,27 @@
1
+ import { err, ok } from "../result.js";
2
+ const REGISTER_REQUIRED = 'connection.fetch.register() is required to register family host routes (platform >= 0.2.2-rc.1); no fallback admission path exists';
3
+ /** Resolve the connection port; undefined means the host has no connection service. */
4
+ export function connectionPort(ctx) {
5
+ // platform-declaration anchor: connection is declared in core PLATFORM_SERVICE_PROBES.
6
+ const connection = ctx.get('connection');
7
+ if (connection === undefined)
8
+ return undefined;
9
+ const register = (route) => {
10
+ if (connection.fetch === undefined || typeof connection.fetch.register !== 'function')
11
+ throw new Error(REGISTER_REQUIRED);
12
+ return connection.fetch.register.call(connection.fetch, route);
13
+ };
14
+ return {
15
+ allowsRemoteAuthorities: connection.allowsRemoteAuthorities === true,
16
+ register,
17
+ tryRegister: (route) => {
18
+ try {
19
+ return ok(register(route));
20
+ }
21
+ catch (error) {
22
+ return err({ code: 'E-325', message: error instanceof Error ? error.message : String(error) });
23
+ }
24
+ },
25
+ };
26
+ }
27
+ //# sourceMappingURL=connection.js.map
@@ -20,6 +20,32 @@ export type { Agent, AgentOptions, PreStepDecision } from '@deepseek-ai/dsh-agen
20
20
  export type { SubagentStopReason } from '@deepseek-ai/dsh-subagent';
21
21
  export type { UserMessage } from '@deepseek-ai/dsh-llm';
22
22
  export type { PromptContext, PromptSection } from '@deepseek-ai/dsh-system-prompt';
23
+ export { commandsPort } from './commands.ts';
24
+ export type { CommandsPort } from './commands.ts';
25
+ export { profileContextPort } from './profileContext.ts';
26
+ export type { ProfileContextPort } from './profileContext.ts';
27
+ export { pluginManagerPort, pluginInventoryPort, configEditorPort } from './platformView.ts';
28
+ export type { PluginManagerPort, PluginInventoryPort, ConfigEditorPort } from './platformView.ts';
29
+ export { workingDirectoryPort } from './workingDirectory.ts';
30
+ export type { WorkingDirectoryPort } from './workingDirectory.ts';
31
+ export { skillsPort } from './skills.ts';
32
+ export type { SkillsPort } from './skills.ts';
33
+ export { sessionQueryPort } from './sessionQuery.ts';
34
+ export type { SessionQueryPort } from './sessionQuery.ts';
35
+ export { storageDomainPort } from './storageDomain.ts';
36
+ export type { StorageDomainPort } from './storageDomain.ts';
37
+ export { settingsPort } from './settings.ts';
38
+ export type { SettingsPort } from './settings.ts';
39
+ export { connectionPort } from './connection.ts';
40
+ export type { ConnectionPort, ConnectionRoute } from './connection.ts';
41
+ export { systemPromptPort } from './systemPrompt.ts';
42
+ export type { SystemPromptPort } from './systemPrompt.ts';
43
+ export { agentsPort } from './agents.ts';
44
+ export type { AgentIdentity, AgentsPort } from './agents.ts';
45
+ export { subagentsPort } from './subagents.ts';
46
+ export type { SubagentActivationPort, SubagentSendOptions, SubagentsPort } from './subagents.ts';
47
+ export { userQuestionsPort } from './userQuestions.ts';
48
+ export type { AskedQuestions, UserQuestion, UserQuestionOption, UserQuestionsPort } from './userQuestions.ts';
23
49
  export { presetsPort } from './presets.ts';
24
50
  export type { PresetDefinitionLike, PresetDocument, PresetsPort } from './presets.ts';
25
51
  export { projectionPort } from './projections.ts';
@@ -10,6 +10,19 @@ export { defineDomain, domainTable, DomainError } from '@deepseek-ai/dsh-storage
10
10
  export { escapeText } from '@deepseek-ai/dsh-skill';
11
11
  export { BlockAssembler, createToolResultMessage, createUserMessage } from '@deepseek-ai/dsh-llm';
12
12
  export { SessionId } from '@deepseek-ai/dsh-session';
13
+ export { commandsPort } from "./commands.js";
14
+ export { profileContextPort } from "./profileContext.js";
15
+ export { pluginManagerPort, pluginInventoryPort, configEditorPort } from "./platformView.js";
16
+ export { workingDirectoryPort } from "./workingDirectory.js";
17
+ export { skillsPort } from "./skills.js";
18
+ export { sessionQueryPort } from "./sessionQuery.js";
19
+ export { storageDomainPort } from "./storageDomain.js";
20
+ export { settingsPort } from "./settings.js";
21
+ export { connectionPort } from "./connection.js";
22
+ export { systemPromptPort } from "./systemPrompt.js";
23
+ export { agentsPort } from "./agents.js";
24
+ export { subagentsPort } from "./subagents.js";
25
+ export { userQuestionsPort } from "./userQuestions.js";
13
26
  export { presetsPort } from "./presets.js";
14
27
  export { projectionPort } from "./projections.js";
15
28
  export { EvolutionLlmError, llmPort, modelRoute } from "./llm.js";
@@ -5,7 +5,7 @@
5
5
  * the platform GenerateOptions cast and text assembly. The purpose declaration
6
6
  * merge below is the family's contribution to the 0.2.2 request map.
7
7
  */
8
- import type { StreamChunk, UserMessage } from '@deepseek-ai/dsh-llm';
8
+ import type { GenerateOptions, StreamChunk, UserMessage } from '@deepseek-ai/dsh-llm';
9
9
  import type { Context } from '@deepseek-ai/cordis';
10
10
  export type EvolutionLlmFailureKind = 'model-unavailable' | 'no-route' | 'timeout' | 'cancelled' | 'transport';
11
11
  /** Typed auxiliary-LLM failure; callers may map these without parsing messages. */
@@ -37,6 +37,8 @@ export interface EvolutionLlmRequest {
37
37
  export interface LlmPort {
38
38
  stream(request: EvolutionLlmRequest): AsyncIterable<StreamChunk>;
39
39
  completeText(request: EvolutionLlmRequest): Promise<string>;
40
+ /** Raw platform stream for features that own their full GenerateOptions (review aux path). */
41
+ streamRaw?(options: GenerateOptions): AsyncIterable<StreamChunk>;
40
42
  }
41
43
  /** Resolve the LLM port; undefined means the host has no llm service. */
42
44
  export declare function llmPort(ctx: Context): LlmPort | undefined;
@@ -33,6 +33,7 @@ export function llmPort(ctx) {
33
33
  throw new EvolutionLlmError('transport', 'llm service has no stream()');
34
34
  yield* llm.stream(options);
35
35
  },
36
+ ...(llm.stream === undefined ? {} : { streamRaw: (options) => llm.stream(options) }),
36
37
  async completeText(request) {
37
38
  let text = '';
38
39
  for await (const chunk of port.stream(request)) {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * The remaining read-only platform surfaces the doctor's platform view uses:
3
+ * plugin manager, plugin inventory and the config editor. Each is optional and
4
+ * each port preserves the "absent method" shape so the view reports missing
5
+ * capabilities instead of inventing empty data.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ export interface PluginManagerPort {
9
+ listBundles?(): Promise<unknown>;
10
+ listPlugins?(): Promise<unknown>;
11
+ }
12
+ export interface PluginInventoryPort {
13
+ list?(): Promise<unknown>;
14
+ }
15
+ export interface ConfigEditorPort {
16
+ configuration?(): Promise<unknown>;
17
+ }
18
+ export declare function pluginManagerPort(ctx: Context): PluginManagerPort | undefined;
19
+ export declare function pluginInventoryPort(ctx: Context): PluginInventoryPort | undefined;
20
+ export declare function configEditorPort(ctx: Context): ConfigEditorPort | undefined;
21
+ //# sourceMappingURL=platformView.d.ts.map
@@ -0,0 +1,29 @@
1
+ export function pluginManagerPort(ctx) {
2
+ // platform-declaration anchor: pluginManager is declared in core PLATFORM_SERVICE_PROBES.
3
+ const service = ctx.get('pluginManager');
4
+ if (service === undefined)
5
+ return undefined;
6
+ return {
7
+ ...(typeof service.listBundles === 'function' ? { listBundles: () => service.listBundles() } : {}),
8
+ ...(typeof service.listPlugins === 'function' ? { listPlugins: () => service.listPlugins() } : {}),
9
+ };
10
+ }
11
+ export function pluginInventoryPort(ctx) {
12
+ // platform-declaration anchor: pluginInventory is declared in core PLATFORM_SERVICE_PROBES.
13
+ const service = ctx.get('pluginInventory');
14
+ if (service === undefined)
15
+ return undefined;
16
+ return {
17
+ ...(typeof service.list === 'function' ? { list: () => service.list() } : {}),
18
+ };
19
+ }
20
+ export function configEditorPort(ctx) {
21
+ // platform-declaration anchor: configEditor is declared in core PLATFORM_SERVICE_PROBES.
22
+ const service = ctx.get('configEditor');
23
+ if (service === undefined)
24
+ return undefined;
25
+ return {
26
+ ...(typeof service.configuration === 'function' ? { configuration: () => service.configuration() } : {}),
27
+ };
28
+ }
29
+ //# sourceMappingURL=platformView.js.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The profile-context half of the family's host platform boundary.
3
+ *
4
+ * A bare library mount has no profile; a profile launcher publishes the
5
+ * directory, patch path and started bundles this port exposes.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ export interface ProfileContextPort {
9
+ readonly name: string;
10
+ readonly dir: string;
11
+ readonly patchPath?: string;
12
+ readonly startedBundles?: readonly string[];
13
+ }
14
+ /** Resolve the profile-context port; undefined means no profile is mounted. */
15
+ export declare function profileContextPort(ctx: Context): ProfileContextPort | undefined;
16
+ //# sourceMappingURL=profileContext.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Resolve the profile-context port; undefined means no profile is mounted. */
2
+ export function profileContextPort(ctx) {
3
+ // platform-declaration anchor: profileContext is declared in core PLATFORM_SERVICE_PROBES.
4
+ const service = ctx.get('profileContext');
5
+ if (service === undefined || typeof service.dir !== 'string' || service.dir === '')
6
+ return undefined;
7
+ return {
8
+ name: typeof service.name === 'string' ? service.name : '',
9
+ dir: service.dir,
10
+ ...(typeof service.patchPath === 'string' && service.patchPath !== '' ? { patchPath: service.patchPath } : {}),
11
+ ...(Array.isArray(service.startedBundles) ? { startedBundles: service.startedBundles } : {}),
12
+ };
13
+ }
14
+ //# sourceMappingURL=profileContext.js.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The session-query half of the family's host platform boundary.
3
+ *
4
+ * The doctor only asks for the corpus listing and bounds the call itself; the
5
+ * port keeps the platform receiver binding and the raw result shape out of the
6
+ * feature.
7
+ */
8
+ import type { Context } from '@deepseek-ai/cordis';
9
+ export interface SessionQueryPort {
10
+ listSessions(signal?: AbortSignal): Promise<unknown>;
11
+ }
12
+ /** Resolve the session-query port; undefined means the host has no such service. */
13
+ export declare function sessionQueryPort(ctx: Context): SessionQueryPort | undefined;
14
+ //# sourceMappingURL=sessionQuery.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Resolve the session-query port; undefined means the host has no such service. */
2
+ export function sessionQueryPort(ctx) {
3
+ // platform-declaration anchor: sessionQuery is declared in core PLATFORM_SERVICE_PROBES.
4
+ const service = ctx.get('sessionQuery');
5
+ if (service === undefined || typeof service.listSessions !== 'function')
6
+ return undefined;
7
+ return { listSessions: (signal) => service.listSessions(signal) };
8
+ }
9
+ //# sourceMappingURL=sessionQuery.js.map
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The settings half of the family's host platform boundary.
3
+ *
4
+ * The family only silences the platform's settings-file auto-reload for the
5
+ * lifetime of its fiber; reads stay in each feature's own config seam.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ export interface SettingsPort {
9
+ configure?(options: {
10
+ auto: boolean;
11
+ }, owner: unknown): () => void;
12
+ describe?(options?: {
13
+ redactSecrets?: boolean;
14
+ }): Array<{
15
+ ns: string;
16
+ value?: unknown;
17
+ user?: Record<string, unknown>;
18
+ }>;
19
+ }
20
+ /** Resolve the settings port; undefined means the host has no settings service. */
21
+ export declare function settingsPort(ctx: Context): SettingsPort | undefined;
22
+ //# sourceMappingURL=settings.d.ts.map
@@ -0,0 +1,14 @@
1
+ /** Resolve the settings port; undefined means the host has no settings service. */
2
+ export function settingsPort(ctx) {
3
+ // platform-declaration anchor: settings is declared in core PLATFORM_SERVICE_PROBES.
4
+ const service = ctx.get('settings');
5
+ if (service === undefined)
6
+ return undefined;
7
+ if (typeof service.configure !== 'function' && typeof service.describe !== 'function')
8
+ return undefined;
9
+ return {
10
+ ...(typeof service.configure === 'function' ? { configure: (options, owner) => service.configure(options, owner) } : {}),
11
+ ...(typeof service.describe === 'function' ? { describe: (options) => service.describe(options) } : {}),
12
+ };
13
+ }
14
+ //# sourceMappingURL=settings.js.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The skills-catalog half of the family's host platform boundary.
3
+ *
4
+ * Reads stay scope-aware: the caller passes the calling scope (or undefined for
5
+ * the explicit global layer), exactly as the platform's skill registry expects.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ import type { SkillSummary } from '@deepseek-ai/dsh-skill';
9
+ export interface SkillsPort {
10
+ list(options?: {
11
+ scope?: unknown;
12
+ }): Promise<readonly SkillSummary[]>;
13
+ }
14
+ /** Resolve the skills port; undefined means the host has no skills service. */
15
+ export declare function skillsPort(ctx: Context): SkillsPort | undefined;
16
+ //# sourceMappingURL=skills.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Resolve the skills port; undefined means the host has no skills service. */
2
+ export function skillsPort(ctx) {
3
+ // platform-declaration anchor: skills is declared in core PLATFORM_SERVICE_PROBES.
4
+ const service = ctx.get('skills');
5
+ if (service === undefined || typeof service.list !== 'function')
6
+ return undefined;
7
+ return { list: (options) => service.list(options) };
8
+ }
9
+ //# sourceMappingURL=skills.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The storage-domain half of the family's host platform boundary.
3
+ *
4
+ * The domain schema stays in evolution-state; this port only forwards its open
5
+ * call so the platform package imports no state types.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ export interface StorageDomainPort {
9
+ open<T = unknown>(spec: unknown): Promise<T>;
10
+ }
11
+ /** Resolve the storage-domain port; undefined means the host has no provider. */
12
+ export declare function storageDomainPort(ctx: Context): StorageDomainPort | undefined;
13
+ //# sourceMappingURL=storageDomain.d.ts.map
@@ -0,0 +1,9 @@
1
+ /** Resolve the storage-domain port; undefined means the host has no provider. */
2
+ export function storageDomainPort(ctx) {
3
+ // platform-declaration anchor: storageDomain is declared in core PLATFORM_SERVICE_PROBES.
4
+ const service = ctx.get('storageDomain');
5
+ if (service === undefined || typeof service.open !== 'function')
6
+ return undefined;
7
+ return { open: (spec) => service.open(spec) };
8
+ }
9
+ //# sourceMappingURL=storageDomain.js.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The subagents half of the family's host platform boundary.
3
+ *
4
+ * Platform versions differ in the activation-spec shape. This port keeps one
5
+ * family-facing entry (`start`) and one activation face; the platform-specific
6
+ * shape lives in `startActivationSpec` until the version adapter replaces the
7
+ * temporary dual-shape bridge.
8
+ */
9
+ import type { Context } from '@deepseek-ai/cordis';
10
+ export interface SubagentActivationPort {
11
+ readonly childId: string;
12
+ readonly result: Promise<unknown>;
13
+ dispose(): Promise<void>;
14
+ }
15
+ export interface SubagentSendOptions {
16
+ readonly signal?: AbortSignal;
17
+ }
18
+ export interface SubagentsPort {
19
+ getProvider(name: string): unknown;
20
+ start(spec: unknown): Promise<SubagentActivationPort>;
21
+ sendMessage?(sender: unknown, targetId: string, content: unknown, options?: SubagentSendOptions): Promise<unknown>;
22
+ }
23
+ /** Resolve the subagents port; undefined means the host has no subagents service. */
24
+ export declare function subagentsPort(ctx: Context): SubagentsPort | undefined;
25
+ //# sourceMappingURL=subagents.d.ts.map
@@ -0,0 +1,17 @@
1
+ /** Resolve the subagents port; undefined means the host has no subagents service. */
2
+ export function subagentsPort(ctx) {
3
+ // platform-declaration anchor: subagents is declared in core PLATFORM_SERVICE_PROBES.
4
+ const subagents = ctx.get('subagents');
5
+ if (subagents === undefined
6
+ || typeof subagents.getProvider !== 'function'
7
+ || typeof subagents.startActivation !== 'function')
8
+ return undefined;
9
+ return {
10
+ getProvider: (name) => subagents.getProvider(name),
11
+ start: (spec) => subagents.startActivation(spec),
12
+ ...(typeof subagents.sendMessage === 'function'
13
+ ? { sendMessage: (sender, targetId, content, options) => subagents.sendMessage(sender, targetId, content, options) }
14
+ : {}),
15
+ };
16
+ }
17
+ //# sourceMappingURL=subagents.js.map
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The system-prompt half of the family's host platform boundary.
3
+ *
4
+ * The family registers one optional guidance section and its live variable; a
5
+ * host without system-prompt keeps booting, so the port is optional.
6
+ */
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ import type { PromptContext, PromptSection } from '@deepseek-ai/dsh-system-prompt';
9
+ export interface SystemPromptPort {
10
+ section(section: PromptSection): () => void;
11
+ variable(name: string, provider: (context: unknown) => string | undefined): () => void;
12
+ context?(context: PromptContext): () => void;
13
+ }
14
+ /** Resolve the system-prompt port; undefined means the host has no such service. */
15
+ export declare function systemPromptPort(ctx: Context): SystemPromptPort | undefined;
16
+ //# sourceMappingURL=systemPrompt.d.ts.map