@lmzhen/dsh-evolution-core 0.57.0 → 0.58.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 (78) hide show
  1. package/README.md +3 -1
  2. package/lib/authority-plugin.js +1 -1
  3. package/lib/composition/index.js +2 -2
  4. package/lib/{composition-B-gKqiBY.js → composition-B_F4TYOD.js} +1 -1
  5. package/lib/{ensure-BLmEW0Ju.js → ensure-BpVDuDnA.js} +1 -1
  6. package/lib/http-routes.js +1 -1
  7. package/lib/index.js +9 -7
  8. package/lib/{mutation-authority-DQfpXs1O.js → mutation-authority-Du-ON0NY.js} +1 -1
  9. package/lib/policy.js +1 -1
  10. package/lib/restrictor.js +1 -2
  11. package/lib/result.js +2 -33
  12. package/lib/runtime/plugin.js +1 -54
  13. package/lib/skills.js +1 -1
  14. package/lib/subagent/index.js +1 -1
  15. package/lib/types/authority.d.ts +1 -1
  16. package/lib/types/authority.js +1 -1
  17. package/lib/types/composition/ensure.js +1 -1
  18. package/lib/types/http-routes.js +1 -1
  19. package/lib/types/opt-in.js +2 -2
  20. package/lib/types/params.js +1 -1
  21. package/lib/types/platform-line.generated.d.ts +4 -2
  22. package/lib/types/platform-line.generated.js +6 -2
  23. package/lib/types/policy.js +1 -1
  24. package/lib/types/restrictor.js +2 -2
  25. package/lib/types/result.d.ts +3 -31
  26. package/lib/types/result.js +6 -24
  27. package/lib/types/runtime/coherence.js +1 -1
  28. package/lib/types/runtime/llm.d.ts +1 -1
  29. package/lib/types/runtime/llm.js +1 -1
  30. package/lib/types/runtime/platform.d.ts +8 -58
  31. package/lib/types/runtime/platform.js +7 -61
  32. package/lib/types/runtime/plugin.js +1 -4
  33. package/lib/types/runtime/projections.d.ts +1 -1
  34. package/lib/types/scope.js +1 -1
  35. package/lib/types/session-projection.d.ts +1 -1
  36. package/lib/types/signals.d.ts +1 -1
  37. package/lib/types/subagent/run.d.ts +1 -1
  38. package/lib/types/subagent/types.d.ts +4 -4
  39. package/package.json +7 -32
  40. package/lib/connection-DAJy7Xjm.js +0 -28
  41. package/lib/platform/index.js +0 -5
  42. package/lib/platform-UL-djjz9.js +0 -244
  43. package/lib/presets-C8vuCuNA.js +0 -27
  44. package/lib/tools-BrUswg8v.js +0 -22
  45. package/lib/types/platform/agents.d.ts +0 -32
  46. package/lib/types/platform/agents.js +0 -26
  47. package/lib/types/platform/commands.d.ts +0 -14
  48. package/lib/types/platform/commands.js +0 -9
  49. package/lib/types/platform/connection.d.ts +0 -26
  50. package/lib/types/platform/connection.js +0 -27
  51. package/lib/types/platform/index.d.ts +0 -55
  52. package/lib/types/platform/index.js +0 -29
  53. package/lib/types/platform/llm.d.ts +0 -47
  54. package/lib/types/platform/llm.js +0 -76
  55. package/lib/types/platform/platformView.d.ts +0 -21
  56. package/lib/types/platform/platformView.js +0 -29
  57. package/lib/types/platform/presets.d.ts +0 -31
  58. package/lib/types/platform/presets.js +0 -31
  59. package/lib/types/platform/profileContext.d.ts +0 -16
  60. package/lib/types/platform/profileContext.js +0 -14
  61. package/lib/types/platform/projections.d.ts +0 -35
  62. package/lib/types/platform/projections.js +0 -34
  63. package/lib/types/platform/settings.d.ts +0 -22
  64. package/lib/types/platform/settings.js +0 -14
  65. package/lib/types/platform/skills.d.ts +0 -16
  66. package/lib/types/platform/skills.js +0 -9
  67. package/lib/types/platform/storageDomain.d.ts +0 -13
  68. package/lib/types/platform/storageDomain.js +0 -9
  69. package/lib/types/platform/subagents.d.ts +0 -25
  70. package/lib/types/platform/subagents.js +0 -17
  71. package/lib/types/platform/systemPrompt.d.ts +0 -16
  72. package/lib/types/platform/systemPrompt.js +0 -13
  73. package/lib/types/platform/tools.d.ts +0 -27
  74. package/lib/types/platform/tools.js +0 -23
  75. package/lib/types/platform/userQuestions.d.ts +0 -33
  76. package/lib/types/platform/userQuestions.js +0 -9
  77. package/lib/types/platform/workingDirectory.d.ts +0 -14
  78. package/lib/types/platform/workingDirectory.js +0 -9
@@ -1,13 +1,10 @@
1
1
  import { warnIfFamilyMixed } from "./coherence.js";
2
2
  import { EvolutionLlm } from "./llm.js";
3
- import { EvolutionPlatform } from "./platform.js";
4
3
  import { EvolutionProjections } from "./projections.js";
5
4
  export const name = 'evolution-core-runtime';
6
5
  /** @param ctx - the composition context that owns the runtime services. */
7
6
  export async function apply(ctx) {
8
- // Ports resolve from the platform service now, so the platform must be mounted
9
- // before the consumers initialize; sequential plugin mounts make that order real.
10
- await ctx.plugin(EvolutionPlatform);
7
+ // The adapter row owns `evolutionPlatform` and mounts before this row.
11
8
  await ctx.plugin(EvolutionProjections);
12
9
  await ctx.plugin(EvolutionLlm);
13
10
  warnIfFamilyMixed(ctx);
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { Service } from '@deepseek-ai/cordis';
8
8
  import type { Context } from '@deepseek-ai/cordis';
9
- import { type Session } from '../platform/index.ts';
9
+ import type { Session } from '@lmzhen/dsh-evolution-platform-contract';
10
10
  import { type EvolutionActivityState, type EvolutionEvidenceState, type EvolutionProjectionHistoryState, type EvolutionReadsState, type EvolutionSignalsState } from '../session-projection.ts';
11
11
  /** Domain service owning the family's projection registrations. */
12
12
  export declare class EvolutionProjections extends Service {
@@ -1,4 +1,4 @@
1
- import { scopeOf } from "./platform/index.js";
1
+ import { scopeOf } from '@lmzhen/dsh-evolution-adapter/values';
2
2
  export function callingScope(ctx, held) {
3
3
  if (held !== undefined)
4
4
  return held;
@@ -1,5 +1,5 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { EvolutionProjectionDefinition, Session } from './platform/index.ts';
2
+ import type { EvolutionProjectionDefinition, Session } from '@lmzhen/dsh-evolution-platform-contract';
3
3
  import { type EvidenceIndex } from './evidence.ts';
4
4
  import { type TurnFoldState, type TurnSignals } from './signals.ts';
5
5
  /** Time of the newest event folded for one session; 0 for a log with no event. */
@@ -5,7 +5,7 @@
5
5
  * is spent. `turn/end` calls `observeEvent`; the returned review kind is
6
6
  * accumulated until a configured interval fires.
7
7
  */
8
- import type { SessionEvent } from './platform/index.ts';
8
+ import type { SessionEvent } from '@lmzhen/dsh-evolution-platform-contract';
9
9
  export type ReviewKind = 'memory' | 'skill' | 'combined';
10
10
  export interface SignalConfig {
11
11
  memoryInterval: number;
@@ -4,7 +4,7 @@
4
4
  * handle owns the continuation lifecycle and the end-event wait.
5
5
  */
6
6
  import type { Context } from '@deepseek-ai/cordis';
7
- import type { Agent, ContentBlock, SessionId, SubagentStopReason } from '../platform/index.ts';
7
+ import type { Agent, ContentBlock, SessionId, SubagentStopReason } from '@lmzhen/dsh-evolution-platform-contract';
8
8
  export interface ActivationResultLike {
9
9
  readonly output?: unknown;
10
10
  readonly structured?: unknown;
@@ -1,7 +1,7 @@
1
- import type { Agent, AgentIdentity, AgentOptions } from '../platform/index.ts';
2
- import type { SessionId } from '../platform/index.ts';
3
- import type { SubagentStopReason } from '../platform/index.ts';
4
- import type { ObjectJsonSchema } from '../platform/index.ts';
1
+ import type { Agent, AgentIdentity, AgentOptions } from '@lmzhen/dsh-evolution-platform-contract';
2
+ import type { SessionId } from '@lmzhen/dsh-evolution-platform-contract';
3
+ import type { SubagentStopReason } from '@lmzhen/dsh-evolution-platform-contract';
4
+ import type { ObjectJsonSchema } from '@lmzhen/dsh-evolution-platform-contract';
5
5
  export type ChannelCode = 'E-323' | 'E-324';
6
6
  export type ChannelKind = 'reviewer' | 'maintainer' | 'governance';
7
7
  export interface PresetStatus {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-core",
3
3
  "description": "Shared stores, prompts, signals and lifecycle logic for the dsh-evolution plugin family (community build)",
4
- "version": "0.57.0",
4
+ "version": "0.58.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -34,10 +34,6 @@
34
34
  "types": "./lib/types/runtime/plugin.d.ts",
35
35
  "default": "./lib/runtime/plugin.js"
36
36
  },
37
- "./platform": {
38
- "types": "./lib/types/platform/index.d.ts",
39
- "default": "./lib/platform/index.js"
40
- },
41
37
  "./restrictor": {
42
38
  "types": "./lib/types/restrictor.d.ts",
43
39
  "default": "./lib/restrictor.js"
@@ -98,43 +94,22 @@
98
94
  ],
99
95
  "license": "MIT",
100
96
  "dependencies": {
101
- "@deepseek-ai/dsh-atomic-write": "^0.2.2-rc.5",
102
97
  "js-yaml": "^4.1.0",
103
98
  "yaml": "^2.4.2",
104
99
  "zod": "^4.4.3",
105
- "@deepseek-ai/schemastery": "^3.18.5"
100
+ "@deepseek-ai/schemastery": "^3.18.5",
101
+ "@lmzhen/dsh-evolution-adapter": "0.58.0",
102
+ "@lmzhen/dsh-evolution-platform-contract": "0.58.0"
106
103
  },
107
104
  "peerDependencies": {
108
- "@deepseek-ai/cordis": "^4.0.5",
109
- "@deepseek-ai/dsh-scope": "^0.2.2-rc.5",
110
- "@deepseek-ai/dsh-session": "^0.2.2-rc.5",
111
- "@deepseek-ai/dsh-skill": "^0.2.2-rc.5",
112
- "@deepseek-ai/dsh-session-projection": "^0.2.2-rc.5",
113
- "@deepseek-ai/dsh-agent": "^0.2.2-rc.5",
114
- "@deepseek-ai/dsh-subagent": "^0.2.2-rc.5",
115
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.5",
116
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.5",
117
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.5",
118
- "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.5",
119
- "@deepseek-ai/dsh-storage-domain": "^0.2.2-rc.5"
105
+ "@deepseek-ai/cordis": "^4.0.5"
120
106
  },
121
107
  "devDependencies": {
122
108
  "@deepseek-ai/cordis": "^4.0.5",
123
- "@deepseek-ai/dsh-scope": "^0.2.2-rc.5",
124
- "@deepseek-ai/dsh-session": "^0.2.2-rc.5",
125
- "@deepseek-ai/dsh-skill": "^0.2.2-rc.5",
126
- "@deepseek-ai/dsh-session-projection": "^0.2.2-rc.5",
127
- "@deepseek-ai/dsh-agent": "^0.2.2-rc.5",
128
- "@deepseek-ai/dsh-subagent": "^0.2.2-rc.5",
129
- "@deepseek-ai/dsh-tools": "^0.2.2-rc.5",
130
109
  "@types/js-yaml": "^4.0.9",
131
- "js-yaml": "^4.1.0",
132
- "@deepseek-ai/dsh-commands": "^0.2.2-rc.5",
133
- "@deepseek-ai/dsh-llm": "^0.2.2-rc.5",
134
- "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.5",
135
- "@deepseek-ai/dsh-storage-domain": "^0.2.2-rc.5"
110
+ "js-yaml": "^4.1.0"
136
111
  },
137
112
  "engines": {
138
- "dsh": ">=0.2.2-rc.5 <0.2.3-0"
113
+ "dsh": "0.2.2-rc.5"
139
114
  }
140
115
  }
@@ -1,28 +0,0 @@
1
- import { err, ok } from "./result.js";
2
- //#region lib/types/platform/connection.js
3
- const REGISTER_REQUIRED = "connection.fetch.register() is required to register family host routes (platform >= 0.2.2-rc.1); no fallback admission path exists";
4
- /** Resolve the connection port; undefined means the host has no connection service. */
5
- function connectionPort(ctx) {
6
- const connection = ctx.get("connection");
7
- if (connection === void 0) return void 0;
8
- const register = (route) => {
9
- if (connection.fetch === void 0 || typeof connection.fetch.register !== "function") throw new Error(REGISTER_REQUIRED);
10
- return connection.fetch.register.call(connection.fetch, route);
11
- };
12
- return {
13
- allowsRemoteAuthorities: connection.allowsRemoteAuthorities === true,
14
- register,
15
- tryRegister: (route) => {
16
- try {
17
- return ok(register(route));
18
- } catch (error) {
19
- return err({
20
- code: "E-325",
21
- message: error instanceof Error ? error.message : String(error)
22
- });
23
- }
24
- }
25
- };
26
- }
27
- //#endregion
28
- export { connectionPort as t };
@@ -1,5 +0,0 @@
1
- import { t as connectionPort } from "../connection-DAJy7Xjm.js";
2
- import { C as configEditorPort, D as commandsPort, E as profileContextPort, S as workingDirectoryPort, T as pluginManagerPort, _ as agentsPort, a as createUserMessage, b as storageDomainPort, c as domainTable, d as EvolutionLlmError, f as llmPort, g as subagentsPort, h as userQuestionsPort, i as createToolResultMessage, l as escapeText, m as projectionPort, n as DomainError, o as defineDomain, p as modelRoute, r as SessionId, s as defineTool, t as BlockAssembler, u as scopeOf, v as systemPromptPort, w as pluginInventoryPort, x as skillsPort, y as settingsPort } from "../platform-UL-djjz9.js";
3
- import { t as presetsPort } from "../presets-C8vuCuNA.js";
4
- import { n as toolsPort, t as registerEvolutionTool } from "../tools-BrUswg8v.js";
5
- export { BlockAssembler, DomainError, EvolutionLlmError, SessionId, agentsPort, commandsPort, configEditorPort, connectionPort, createToolResultMessage, createUserMessage, defineDomain, defineTool, domainTable, escapeText, llmPort, modelRoute, pluginInventoryPort, pluginManagerPort, presetsPort, profileContextPort, projectionPort, registerEvolutionTool, scopeOf, settingsPort, skillsPort, storageDomainPort, subagentsPort, systemPromptPort, toolsPort, userQuestionsPort, workingDirectoryPort };
@@ -1,244 +0,0 @@
1
- import { defineTool } from "@deepseek-ai/dsh-tools";
2
- import { scopeOf } from "@deepseek-ai/dsh-scope";
3
- import { DomainError, defineDomain, domainTable } from "@deepseek-ai/dsh-storage-domain";
4
- import { escapeText } from "@deepseek-ai/dsh-skill";
5
- import { BlockAssembler, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
6
- import { SessionId } from "@deepseek-ai/dsh-session";
7
- //#region lib/types/platform/commands.js
8
- /** Resolve the commands port; undefined means the host has no commands service. */
9
- function commandsPort(ctx) {
10
- const service = ctx.get("commands");
11
- if (service === void 0 || typeof service.register !== "function") return void 0;
12
- return { register: (definition) => service.register(definition) };
13
- }
14
- //#endregion
15
- //#region lib/types/platform/profileContext.js
16
- /** Resolve the profile-context port; undefined means no profile is mounted. */
17
- function profileContextPort(ctx) {
18
- const service = ctx.get("profileContext");
19
- if (service === void 0 || typeof service.dir !== "string" || service.dir === "") return void 0;
20
- return {
21
- name: typeof service.name === "string" ? service.name : "",
22
- dir: service.dir,
23
- ...typeof service.patchPath === "string" && service.patchPath !== "" ? { patchPath: service.patchPath } : {},
24
- ...Array.isArray(service.startedBundles) ? { startedBundles: service.startedBundles } : {}
25
- };
26
- }
27
- //#endregion
28
- //#region lib/types/platform/platformView.js
29
- function pluginManagerPort(ctx) {
30
- const service = ctx.get("pluginManager");
31
- if (service === void 0) return void 0;
32
- return {
33
- ...typeof service.listBundles === "function" ? { listBundles: () => service.listBundles() } : {},
34
- ...typeof service.listPlugins === "function" ? { listPlugins: () => service.listPlugins() } : {}
35
- };
36
- }
37
- function pluginInventoryPort(ctx) {
38
- const service = ctx.get("pluginInventory");
39
- if (service === void 0) return void 0;
40
- return { ...typeof service.list === "function" ? { list: () => service.list() } : {} };
41
- }
42
- function configEditorPort(ctx) {
43
- const service = ctx.get("configEditor");
44
- if (service === void 0) return void 0;
45
- return { ...typeof service.configuration === "function" ? { configuration: () => service.configuration() } : {} };
46
- }
47
- //#endregion
48
- //#region lib/types/platform/workingDirectory.js
49
- /** Resolve the working-directory port; undefined means the host has no such service. */
50
- function workingDirectoryPort(ctx) {
51
- const service = ctx.get("workingDirectory");
52
- if (service === void 0 || typeof service.ensure !== "function") return void 0;
53
- return { ensure: (agent, signal) => service.ensure(agent, signal) };
54
- }
55
- //#endregion
56
- //#region lib/types/platform/skills.js
57
- /** Resolve the skills port; undefined means the host has no skills service. */
58
- function skillsPort(ctx) {
59
- const service = ctx.get("skills");
60
- if (service === void 0 || typeof service.list !== "function") return void 0;
61
- return { list: (options) => service.list(options) };
62
- }
63
- //#endregion
64
- //#region lib/types/platform/storageDomain.js
65
- /** Resolve the storage-domain port; undefined means the host has no provider. */
66
- function storageDomainPort(ctx) {
67
- const service = ctx.get("storageDomain");
68
- if (service === void 0 || typeof service.open !== "function") return void 0;
69
- return { open: (spec) => service.open(spec) };
70
- }
71
- //#endregion
72
- //#region lib/types/platform/settings.js
73
- /** Resolve the settings port; undefined means the host has no settings service. */
74
- function settingsPort(ctx) {
75
- const service = ctx.get("settings");
76
- if (service === void 0) return void 0;
77
- if (typeof service.configure !== "function" && typeof service.describe !== "function") return void 0;
78
- return {
79
- ...typeof service.configure === "function" ? { configure: (options, owner) => service.configure(options, owner) } : {},
80
- ...typeof service.describe === "function" ? { describe: (options) => service.describe(options) } : {}
81
- };
82
- }
83
- //#endregion
84
- //#region lib/types/platform/systemPrompt.js
85
- /** Resolve the system-prompt port; undefined means the host has no such service. */
86
- function systemPromptPort(ctx) {
87
- const service = ctx.get("systemPrompt");
88
- if (service === void 0 || typeof service.section !== "function" || typeof service.variable !== "function") return void 0;
89
- return {
90
- section: (section) => service.section(section),
91
- variable: (name, provider) => service.variable(name, provider),
92
- ...typeof service.context === "function" ? { context: (context) => service.context(context) } : {}
93
- };
94
- }
95
- //#endregion
96
- //#region lib/types/platform/agents.js
97
- const asIdentity = (value) => {
98
- if (value === null || typeof value !== "object") return void 0;
99
- return typeof value.id === "string" ? value : void 0;
100
- };
101
- /** Resolve the agents port; undefined means the host has no agents service. */
102
- function agentsPort(ctx) {
103
- const agents = ctx.get("agents");
104
- if (agents === void 0) return void 0;
105
- if (typeof agents.get !== "function" && typeof agents.list !== "function") return void 0;
106
- const get = typeof agents.get === "function" ? agents.get.bind(agents) : void 0;
107
- const list = typeof agents.list === "function" ? agents.list.bind(agents) : void 0;
108
- return {
109
- get: (id) => get === void 0 ? void 0 : asIdentity(get(id)),
110
- list: () => list === void 0 ? [] : list().map(asIdentity).filter((agent) => agent !== void 0),
111
- isRoot: (agent) => {
112
- const live = get === void 0 ? void 0 : asIdentity(get(agent.id));
113
- return live !== void 0 && live === agent && live.session?.header?.origin !== "subagent";
114
- }
115
- };
116
- }
117
- //#endregion
118
- //#region lib/types/platform/subagents.js
119
- /** Resolve the subagents port; undefined means the host has no subagents service. */
120
- function subagentsPort(ctx) {
121
- const subagents = ctx.get("subagents");
122
- if (subagents === void 0 || typeof subagents.getProvider !== "function" || typeof subagents.startActivation !== "function") return void 0;
123
- return {
124
- getProvider: (name) => subagents.getProvider(name),
125
- start: (spec) => subagents.startActivation(spec),
126
- ...typeof subagents.sendMessage === "function" ? { sendMessage: (sender, targetId, content, options) => subagents.sendMessage(sender, targetId, content, options) } : {}
127
- };
128
- }
129
- //#endregion
130
- //#region lib/types/platform/userQuestions.js
131
- /** Resolve the user-questions port; undefined means the host has no such service. */
132
- function userQuestionsPort(ctx) {
133
- const service = ctx.get("userQuestions");
134
- if (service === void 0 || typeof service.ask !== "function") return void 0;
135
- return { ask: (request) => service.ask(request) };
136
- }
137
- //#endregion
138
- //#region lib/types/platform/projections.js
139
- const isHandle = (value) => value !== null && typeof value === "object" && typeof value.stateOf === "function" && typeof value.dispose === "function";
140
- /** Resolve the projection port; undefined means the host has no projection registry. */
141
- function projectionPort(ctx) {
142
- const registry = ctx.get("sessionProjections");
143
- if (registry === void 0) return void 0;
144
- let shape = "unrecognised";
145
- let reason = "sessionProjections.register has not answered yet";
146
- return {
147
- get shape() {
148
- return shape;
149
- },
150
- get reason() {
151
- return shape === "unrecognised" ? reason : void 0;
152
- },
153
- async register(definition) {
154
- const resolved = await registry.register(definition);
155
- if (isHandle(resolved)) {
156
- shape = "handle";
157
- reason = void 0;
158
- return {
159
- stateOf: (session) => resolved.stateOf(session),
160
- dispose: () => resolved.dispose()
161
- };
162
- }
163
- shape = "unrecognised";
164
- reason = "sessionProjections.register returned " + (resolved === null ? "null" : typeof resolved) + " without a projection handle";
165
- return {
166
- stateOf: () => void 0,
167
- dispose: async () => {}
168
- };
169
- }
170
- };
171
- }
172
- //#endregion
173
- //#region lib/types/platform/llm.js
174
- /** Typed auxiliary-LLM failure; callers may map these without parsing messages. */
175
- var EvolutionLlmError = class extends Error {
176
- kind;
177
- constructor(kind, message, cause) {
178
- super(message);
179
- this.name = "EvolutionLlmError";
180
- this.kind = kind;
181
- if (cause !== void 0) this.cause = cause;
182
- }
183
- };
184
- function toOptions(request) {
185
- return {
186
- provider: request.provider,
187
- model: request.model,
188
- messages: request.messages,
189
- ...request.maxTokens === void 0 ? {} : { maxTokens: request.maxTokens },
190
- ...request.temperature === void 0 ? {} : { temperature: request.temperature },
191
- ...request.signal === void 0 ? {} : { signal: request.signal },
192
- purpose: request.purpose
193
- };
194
- }
195
- /** Resolve the LLM port; undefined means the host has no llm service. */
196
- function llmPort(ctx) {
197
- const llm = ctx.get("llm");
198
- if (llm === void 0) return void 0;
199
- const port = {
200
- async *stream(request) {
201
- const options = toOptions(request);
202
- if (llm.stream === void 0) throw new EvolutionLlmError("transport", "llm service has no stream()");
203
- yield* llm.stream(options);
204
- },
205
- ...llm.stream === void 0 ? {} : { streamRaw: (options) => llm.stream(options) },
206
- async completeText(request) {
207
- let text = "";
208
- for await (const chunk of port.stream(request)) {
209
- const frame = chunk;
210
- if (frame.type === "text-delta" || frame.type === "text") text += typeof frame.text === "string" ? frame.text : "";
211
- if (frame.type === "finish" && frame.reason?.kind === "error") {
212
- const failure = frame.reason.failure;
213
- const message = failure?.message;
214
- throw new EvolutionLlmError(failure?.code === "CONTENT_REFUSED" ? "content-refused" : "transport", "model call failed: " + (typeof message === "string" ? message : "unknown"));
215
- }
216
- }
217
- return text;
218
- }
219
- };
220
- return port;
221
- }
222
- /** Resolve the model route: agent-owned selection first, deployment default second. */
223
- function modelRoute(ctx, agent, session) {
224
- const owned = agent?.model?.current?.();
225
- if (owned !== void 0) return {
226
- provider: owned.provider,
227
- model: owned.model
228
- };
229
- if (session !== void 0) {
230
- const value = ctx.get("sessionProjections")?.snapshot?.(session, ["modelSelection"])?.values?.modelSelection;
231
- const chosen = value?.next ?? value?.lastUsed;
232
- if (chosen !== void 0 && chosen !== null) return {
233
- provider: chosen.provider,
234
- model: chosen.model
235
- };
236
- }
237
- const fallback = ctx.get("agentDefaultModel")?.currentSelection?.();
238
- return fallback === void 0 ? void 0 : {
239
- provider: fallback.provider,
240
- model: fallback.model
241
- };
242
- }
243
- //#endregion
244
- export { configEditorPort as C, commandsPort as D, profileContextPort as E, workingDirectoryPort as S, pluginManagerPort as T, agentsPort as _, createUserMessage as a, storageDomainPort as b, domainTable as c, EvolutionLlmError as d, llmPort as f, subagentsPort as g, userQuestionsPort as h, createToolResultMessage as i, escapeText as l, projectionPort as m, DomainError as n, defineDomain as o, modelRoute as p, SessionId as r, defineTool as s, BlockAssembler as t, scopeOf as u, systemPromptPort as v, pluginInventoryPort as w, skillsPort as x, settingsPort as y };
@@ -1,27 +0,0 @@
1
- //#region lib/types/platform/presets.js
2
- /** Resolve the preset registry facade; undefined when the host has no agentPresets service. */
3
- function presetsPort(ctx) {
4
- const registry = ctx.get("agentPresets");
5
- if (registry === void 0) return void 0;
6
- return {
7
- readDocument: (id) => {
8
- if (registry.readDocument === void 0) throw new Error("agentPresets service has no readDocument()");
9
- return registry.readDocument(id);
10
- },
11
- register: (definition) => {
12
- if (registry.register === void 0) throw new Error("agentPresets service has no register()");
13
- return registry.register(definition);
14
- },
15
- resolve: (id) => {
16
- if (registry.resolve === void 0) throw new Error("agentPresets service has no resolve()");
17
- return registry.resolve(id);
18
- },
19
- mount: (target, id) => {
20
- if (registry.mount === void 0) throw new Error("agentPresets service has no mount()");
21
- return registry.mount(target, id);
22
- },
23
- composedPreset: (target) => registry.composedPreset?.(target)
24
- };
25
- }
26
- //#endregion
27
- export { presetsPort as t };
@@ -1,22 +0,0 @@
1
- //#region lib/types/platform/tools.js
2
- /**
3
- * Resolve the tools port from a context; undefined means the host has no tools service.
4
- * platform-declaration anchor: tools is declared in core PLATFORM_SERVICE_PROBES.
5
- */
6
- function toolsPort(ctx) {
7
- const tools = ctx.get("tools");
8
- if (tools === void 0) return void 0;
9
- return {
10
- register: (definition) => tools.register(definition),
11
- guard: (guard) => tools.guard(guard),
12
- restrict: (filter) => tools.restrict(filter),
13
- get: (name, scope) => tools.get(name, scope),
14
- ...typeof tools.execute === "function" ? { execute: (input) => tools.execute(input) } : {}
15
- };
16
- }
17
- /** Register one family tool through the port; a missing service yields a no-op disposer. */
18
- function registerEvolutionTool(ctx, definition) {
19
- return toolsPort(ctx)?.register(definition) ?? (() => {});
20
- }
21
- //#endregion
22
- export { toolsPort as n, registerEvolutionTool as t };
@@ -1,32 +0,0 @@
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
@@ -1,26 +0,0 @@
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
@@ -1,14 +0,0 @@
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
@@ -1,9 +0,0 @@
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
@@ -1,26 +0,0 @@
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
@@ -1,27 +0,0 @@
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