@lmzhen/dsh-evolution-core 0.56.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 (84) 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-CtNbVHq3.js → composition-B_F4TYOD.js} +5 -5
  5. package/lib/{ensure-BLmEW0Ju.js → ensure-BpVDuDnA.js} +1 -1
  6. package/lib/http-routes.js +1 -1
  7. package/lib/index.js +11 -15
  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 -55
  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/env.d.ts +4 -4
  19. package/lib/types/env.js +4 -4
  20. package/lib/types/http-routes.js +1 -1
  21. package/lib/types/opt-in.d.ts +2 -3
  22. package/lib/types/opt-in.js +4 -5
  23. package/lib/types/params.js +1 -1
  24. package/lib/types/platform-line.generated.d.ts +4 -2
  25. package/lib/types/platform-line.generated.js +6 -2
  26. package/lib/types/platform-services.js +0 -1
  27. package/lib/types/policy.js +1 -1
  28. package/lib/types/restrictor.js +2 -2
  29. package/lib/types/result.d.ts +3 -31
  30. package/lib/types/result.js +6 -24
  31. package/lib/types/runtime/coherence.js +1 -1
  32. package/lib/types/runtime/llm.d.ts +1 -1
  33. package/lib/types/runtime/llm.js +1 -1
  34. package/lib/types/runtime/platform.d.ts +8 -60
  35. package/lib/types/runtime/platform.js +7 -63
  36. package/lib/types/runtime/plugin.js +1 -4
  37. package/lib/types/runtime/projections.d.ts +1 -1
  38. package/lib/types/scope.js +1 -1
  39. package/lib/types/session-projection.d.ts +1 -1
  40. package/lib/types/signals.d.ts +1 -1
  41. package/lib/types/subagent/run.d.ts +1 -1
  42. package/lib/types/subagent/types.d.ts +4 -4
  43. package/package.json +7 -32
  44. package/lib/connection-DAJy7Xjm.js +0 -28
  45. package/lib/platform/index.js +0 -5
  46. package/lib/platform-BA27gvSG.js +0 -252
  47. package/lib/presets-C8vuCuNA.js +0 -27
  48. package/lib/tools-BrUswg8v.js +0 -22
  49. package/lib/types/platform/agents.d.ts +0 -32
  50. package/lib/types/platform/agents.js +0 -26
  51. package/lib/types/platform/commands.d.ts +0 -14
  52. package/lib/types/platform/commands.js +0 -9
  53. package/lib/types/platform/connection.d.ts +0 -26
  54. package/lib/types/platform/connection.js +0 -27
  55. package/lib/types/platform/index.d.ts +0 -57
  56. package/lib/types/platform/index.js +0 -30
  57. package/lib/types/platform/llm.d.ts +0 -47
  58. package/lib/types/platform/llm.js +0 -76
  59. package/lib/types/platform/platformView.d.ts +0 -21
  60. package/lib/types/platform/platformView.js +0 -29
  61. package/lib/types/platform/presets.d.ts +0 -31
  62. package/lib/types/platform/presets.js +0 -31
  63. package/lib/types/platform/profileContext.d.ts +0 -16
  64. package/lib/types/platform/profileContext.js +0 -14
  65. package/lib/types/platform/projections.d.ts +0 -35
  66. package/lib/types/platform/projections.js +0 -34
  67. package/lib/types/platform/sessionQuery.d.ts +0 -14
  68. package/lib/types/platform/sessionQuery.js +0 -9
  69. package/lib/types/platform/settings.d.ts +0 -22
  70. package/lib/types/platform/settings.js +0 -14
  71. package/lib/types/platform/skills.d.ts +0 -16
  72. package/lib/types/platform/skills.js +0 -9
  73. package/lib/types/platform/storageDomain.d.ts +0 -13
  74. package/lib/types/platform/storageDomain.js +0 -9
  75. package/lib/types/platform/subagents.d.ts +0 -25
  76. package/lib/types/platform/subagents.js +0 -17
  77. package/lib/types/platform/systemPrompt.d.ts +0 -16
  78. package/lib/types/platform/systemPrompt.js +0 -13
  79. package/lib/types/platform/tools.d.ts +0 -27
  80. package/lib/types/platform/tools.js +0 -23
  81. package/lib/types/platform/userQuestions.d.ts +0 -33
  82. package/lib/types/platform/userQuestions.js +0 -9
  83. package/lib/types/platform/workingDirectory.d.ts +0 -14
  84. package/lib/types/platform/workingDirectory.js +0 -9
@@ -1,64 +1,12 @@
1
1
  /**
2
- * The family's host capability service: one place that resolves the platform
3
- * ports and reports which halves are available. Feature code reads ports from
4
- * this service; the port modules remain the only @deepseek-ai/dsh-* importers.
2
+ * Compatibility re-export of the adapter service.
5
3
  *
6
- * The table is resolved on every read. A missing optional service is not a
7
- * permanent capability loss: it may mount after this service initializes, and
8
- * the next read must see it.
4
+ * The concrete `EvolutionPlatform` service lives in
5
+ * `@lmzhen/dsh-evolution-adapter`; core runtime still mounts it while P0
6
+ * keeps the existing composition order.
7
+ *
8
+ * @module @lmzhen/dsh-evolution-core/runtime/platform
9
9
  */
10
- import { Service } from '@deepseek-ai/cordis';
11
- import type { Context } from '@deepseek-ai/cordis';
12
- import type { AgentIdentity, AgentsPort } from '../platform/agents.ts';
13
- import type { CommandsPort } from '../platform/commands.ts';
14
- import type { ProfileContextPort } from '../platform/profileContext.ts';
15
- import type { PluginManagerPort, PluginInventoryPort, ConfigEditorPort } from '../platform/platformView.ts';
16
- import type { WorkingDirectoryPort } from '../platform/workingDirectory.ts';
17
- import type { SkillsPort } from '../platform/skills.ts';
18
- import type { SessionQueryPort } from '../platform/sessionQuery.ts';
19
- import type { SettingsPort } from '../platform/settings.ts';
20
- import type { StorageDomainPort } from '../platform/storageDomain.ts';
21
- import type { ConnectionPort } from '../platform/connection.ts';
22
- import type { SystemPromptPort } from '../platform/systemPrompt.ts';
23
- import type { SubagentsPort } from '../platform/subagents.ts';
24
- import type { UserQuestionsPort } from '../platform/userQuestions.ts';
25
- import type { LlmPort } from '../platform/llm.ts';
26
- import type { PresetsPort } from '../platform/presets.ts';
27
- import type { ProjectionPort } from '../platform/projections.ts';
28
- import type { ToolsPort } from '../platform/tools.ts';
29
- /** Resolved host ports and their availability. */
30
- export interface HostPlatformPorts {
31
- readonly agents: AgentsPort | undefined;
32
- readonly connection: ConnectionPort | undefined;
33
- readonly settings: SettingsPort | undefined;
34
- readonly storageDomain: StorageDomainPort | undefined;
35
- readonly workingDirectory: WorkingDirectoryPort | undefined;
36
- readonly pluginManager: PluginManagerPort | undefined;
37
- readonly pluginInventory: PluginInventoryPort | undefined;
38
- readonly configEditor: ConfigEditorPort | undefined;
39
- readonly profileContext: ProfileContextPort | undefined;
40
- readonly skills: SkillsPort | undefined;
41
- readonly sessionQuery: SessionQueryPort | undefined;
42
- readonly commands: CommandsPort | undefined;
43
- readonly systemPrompt: SystemPromptPort | undefined;
44
- readonly subagents: SubagentsPort | undefined;
45
- readonly userQuestions: UserQuestionsPort | undefined;
46
- readonly projections: ProjectionPort | undefined;
47
- readonly llm: LlmPort | undefined;
48
- readonly tools: ToolsPort | undefined;
49
- readonly presets: PresetsPort | undefined;
50
- }
51
- /** Domain service owning the host port table. */
52
- export declare class EvolutionPlatform extends Service {
53
- static inject: never[];
54
- constructor(ctx: Context);
55
- /**
56
- * Resolve the host ports now. Consumers read this one table; they never fall
57
- * back to a direct platform import (the second resolution D7 removed).
58
- * Deliberately uncached: `ctx.get` is the capability lifecycle.
59
- */
60
- get ports(): HostPlatformPorts;
61
- /** Whether an exact live root agent is available for this id. */
62
- isRootAgent(agent: AgentIdentity): boolean;
63
- }
10
+ export { EvolutionPlatform } from '@lmzhen/dsh-evolution-adapter/service';
11
+ export type { HostPlatformPorts } from '@lmzhen/dsh-evolution-adapter/service';
64
12
  //# sourceMappingURL=platform.d.ts.map
@@ -1,67 +1,11 @@
1
1
  /**
2
- * The family's host capability service: one place that resolves the platform
3
- * ports and reports which halves are available. Feature code reads ports from
4
- * this service; the port modules remain the only @deepseek-ai/dsh-* importers.
2
+ * Compatibility re-export of the adapter service.
5
3
  *
6
- * The table is resolved on every read. A missing optional service is not a
7
- * permanent capability loss: it may mount after this service initializes, and
8
- * the next read must see it.
4
+ * The concrete `EvolutionPlatform` service lives in
5
+ * `@lmzhen/dsh-evolution-adapter`; core runtime still mounts it while P0
6
+ * keeps the existing composition order.
7
+ *
8
+ * @module @lmzhen/dsh-evolution-core/runtime/platform
9
9
  */
10
- import { Service } from '@deepseek-ai/cordis';
11
- import { agentsPort } from "../platform/agents.js";
12
- import { commandsPort } from "../platform/commands.js";
13
- import { settingsPort } from "../platform/settings.js";
14
- import { profileContextPort } from "../platform/profileContext.js";
15
- import { pluginManagerPort, pluginInventoryPort, configEditorPort } from "../platform/platformView.js";
16
- import { workingDirectoryPort } from "../platform/workingDirectory.js";
17
- import { skillsPort } from "../platform/skills.js";
18
- import { sessionQueryPort } from "../platform/sessionQuery.js";
19
- import { storageDomainPort } from "../platform/storageDomain.js";
20
- import { connectionPort } from "../platform/connection.js";
21
- import { systemPromptPort } from "../platform/systemPrompt.js";
22
- import { subagentsPort } from "../platform/subagents.js";
23
- import { userQuestionsPort } from "../platform/userQuestions.js";
24
- import { presetsPort } from "../platform/presets.js";
25
- import { projectionPort } from "../platform/projections.js";
26
- import { toolsPort } from "../platform/tools.js";
27
- import { llmPort } from "../platform/llm.js";
28
- /** Domain service owning the host port table. */
29
- export class EvolutionPlatform extends Service {
30
- static inject = [];
31
- constructor(ctx) {
32
- super(ctx, 'evolutionPlatform');
33
- }
34
- /**
35
- * Resolve the host ports now. Consumers read this one table; they never fall
36
- * back to a direct platform import (the second resolution D7 removed).
37
- * Deliberately uncached: `ctx.get` is the capability lifecycle.
38
- */
39
- get ports() {
40
- return {
41
- agents: agentsPort(this.ctx),
42
- connection: connectionPort(this.ctx),
43
- settings: settingsPort(this.ctx),
44
- storageDomain: storageDomainPort(this.ctx),
45
- workingDirectory: workingDirectoryPort(this.ctx),
46
- pluginManager: pluginManagerPort(this.ctx),
47
- pluginInventory: pluginInventoryPort(this.ctx),
48
- configEditor: configEditorPort(this.ctx),
49
- profileContext: profileContextPort(this.ctx),
50
- skills: skillsPort(this.ctx),
51
- sessionQuery: sessionQueryPort(this.ctx),
52
- commands: commandsPort(this.ctx),
53
- systemPrompt: systemPromptPort(this.ctx),
54
- subagents: subagentsPort(this.ctx),
55
- userQuestions: userQuestionsPort(this.ctx),
56
- projections: projectionPort(this.ctx),
57
- llm: llmPort(this.ctx),
58
- tools: toolsPort(this.ctx),
59
- presets: presetsPort(this.ctx),
60
- };
61
- }
62
- /** Whether an exact live root agent is available for this id. */
63
- isRootAgent(agent) {
64
- return this.ports.agents?.isRoot(agent) === true;
65
- }
66
- }
10
+ export { EvolutionPlatform } from '@lmzhen/dsh-evolution-adapter/service';
67
11
  //# sourceMappingURL=platform.js.map
@@ -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.56.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 workingDirectoryPort, D as profileContextPort, E as pluginManagerPort, O as commandsPort, S as skillsPort, T as pluginInventoryPort, _ 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 configEditorPort, x as sessionQueryPort, y as settingsPort } from "../platform-BA27gvSG.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, sessionQueryPort, settingsPort, skillsPort, storageDomainPort, subagentsPort, systemPromptPort, toolsPort, userQuestionsPort, workingDirectoryPort };
@@ -1,252 +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/sessionQuery.js
65
- /** Resolve the session-query port; undefined means the host has no such service. */
66
- function sessionQueryPort(ctx) {
67
- const service = ctx.get("sessionQuery");
68
- if (service === void 0 || typeof service.listSessions !== "function") return void 0;
69
- return { listSessions: (signal) => service.listSessions(signal) };
70
- }
71
- //#endregion
72
- //#region lib/types/platform/storageDomain.js
73
- /** Resolve the storage-domain port; undefined means the host has no provider. */
74
- function storageDomainPort(ctx) {
75
- const service = ctx.get("storageDomain");
76
- if (service === void 0 || typeof service.open !== "function") return void 0;
77
- return { open: (spec) => service.open(spec) };
78
- }
79
- //#endregion
80
- //#region lib/types/platform/settings.js
81
- /** Resolve the settings port; undefined means the host has no settings service. */
82
- function settingsPort(ctx) {
83
- const service = ctx.get("settings");
84
- if (service === void 0) return void 0;
85
- if (typeof service.configure !== "function" && typeof service.describe !== "function") return void 0;
86
- return {
87
- ...typeof service.configure === "function" ? { configure: (options, owner) => service.configure(options, owner) } : {},
88
- ...typeof service.describe === "function" ? { describe: (options) => service.describe(options) } : {}
89
- };
90
- }
91
- //#endregion
92
- //#region lib/types/platform/systemPrompt.js
93
- /** Resolve the system-prompt port; undefined means the host has no such service. */
94
- function systemPromptPort(ctx) {
95
- const service = ctx.get("systemPrompt");
96
- if (service === void 0 || typeof service.section !== "function" || typeof service.variable !== "function") return void 0;
97
- return {
98
- section: (section) => service.section(section),
99
- variable: (name, provider) => service.variable(name, provider),
100
- ...typeof service.context === "function" ? { context: (context) => service.context(context) } : {}
101
- };
102
- }
103
- //#endregion
104
- //#region lib/types/platform/agents.js
105
- const asIdentity = (value) => {
106
- if (value === null || typeof value !== "object") return void 0;
107
- return typeof value.id === "string" ? value : void 0;
108
- };
109
- /** Resolve the agents port; undefined means the host has no agents service. */
110
- function agentsPort(ctx) {
111
- const agents = ctx.get("agents");
112
- if (agents === void 0) return void 0;
113
- if (typeof agents.get !== "function" && typeof agents.list !== "function") return void 0;
114
- const get = typeof agents.get === "function" ? agents.get.bind(agents) : void 0;
115
- const list = typeof agents.list === "function" ? agents.list.bind(agents) : void 0;
116
- return {
117
- get: (id) => get === void 0 ? void 0 : asIdentity(get(id)),
118
- list: () => list === void 0 ? [] : list().map(asIdentity).filter((agent) => agent !== void 0),
119
- isRoot: (agent) => {
120
- const live = get === void 0 ? void 0 : asIdentity(get(agent.id));
121
- return live !== void 0 && live === agent && live.session?.header?.origin !== "subagent";
122
- }
123
- };
124
- }
125
- //#endregion
126
- //#region lib/types/platform/subagents.js
127
- /** Resolve the subagents port; undefined means the host has no subagents service. */
128
- function subagentsPort(ctx) {
129
- const subagents = ctx.get("subagents");
130
- if (subagents === void 0 || typeof subagents.getProvider !== "function" || typeof subagents.startActivation !== "function") return void 0;
131
- return {
132
- getProvider: (name) => subagents.getProvider(name),
133
- start: (spec) => subagents.startActivation(spec),
134
- ...typeof subagents.sendMessage === "function" ? { sendMessage: (sender, targetId, content, options) => subagents.sendMessage(sender, targetId, content, options) } : {}
135
- };
136
- }
137
- //#endregion
138
- //#region lib/types/platform/userQuestions.js
139
- /** Resolve the user-questions port; undefined means the host has no such service. */
140
- function userQuestionsPort(ctx) {
141
- const service = ctx.get("userQuestions");
142
- if (service === void 0 || typeof service.ask !== "function") return void 0;
143
- return { ask: (request) => service.ask(request) };
144
- }
145
- //#endregion
146
- //#region lib/types/platform/projections.js
147
- const isHandle = (value) => value !== null && typeof value === "object" && typeof value.stateOf === "function" && typeof value.dispose === "function";
148
- /** Resolve the projection port; undefined means the host has no projection registry. */
149
- function projectionPort(ctx) {
150
- const registry = ctx.get("sessionProjections");
151
- if (registry === void 0) return void 0;
152
- let shape = "unrecognised";
153
- let reason = "sessionProjections.register has not answered yet";
154
- return {
155
- get shape() {
156
- return shape;
157
- },
158
- get reason() {
159
- return shape === "unrecognised" ? reason : void 0;
160
- },
161
- async register(definition) {
162
- const resolved = await registry.register(definition);
163
- if (isHandle(resolved)) {
164
- shape = "handle";
165
- reason = void 0;
166
- return {
167
- stateOf: (session) => resolved.stateOf(session),
168
- dispose: () => resolved.dispose()
169
- };
170
- }
171
- shape = "unrecognised";
172
- reason = "sessionProjections.register returned " + (resolved === null ? "null" : typeof resolved) + " without a projection handle";
173
- return {
174
- stateOf: () => void 0,
175
- dispose: async () => {}
176
- };
177
- }
178
- };
179
- }
180
- //#endregion
181
- //#region lib/types/platform/llm.js
182
- /** Typed auxiliary-LLM failure; callers may map these without parsing messages. */
183
- var EvolutionLlmError = class extends Error {
184
- kind;
185
- constructor(kind, message, cause) {
186
- super(message);
187
- this.name = "EvolutionLlmError";
188
- this.kind = kind;
189
- if (cause !== void 0) this.cause = cause;
190
- }
191
- };
192
- function toOptions(request) {
193
- return {
194
- provider: request.provider,
195
- model: request.model,
196
- messages: request.messages,
197
- ...request.maxTokens === void 0 ? {} : { maxTokens: request.maxTokens },
198
- ...request.temperature === void 0 ? {} : { temperature: request.temperature },
199
- ...request.signal === void 0 ? {} : { signal: request.signal },
200
- purpose: request.purpose
201
- };
202
- }
203
- /** Resolve the LLM port; undefined means the host has no llm service. */
204
- function llmPort(ctx) {
205
- const llm = ctx.get("llm");
206
- if (llm === void 0) return void 0;
207
- const port = {
208
- async *stream(request) {
209
- const options = toOptions(request);
210
- if (llm.stream === void 0) throw new EvolutionLlmError("transport", "llm service has no stream()");
211
- yield* llm.stream(options);
212
- },
213
- ...llm.stream === void 0 ? {} : { streamRaw: (options) => llm.stream(options) },
214
- async completeText(request) {
215
- let text = "";
216
- for await (const chunk of port.stream(request)) {
217
- const frame = chunk;
218
- if (frame.type === "text-delta" || frame.type === "text") text += typeof frame.text === "string" ? frame.text : "";
219
- if (frame.type === "finish" && frame.reason?.kind === "error") {
220
- const failure = frame.reason.failure;
221
- const message = failure?.message;
222
- throw new EvolutionLlmError(failure?.code === "CONTENT_REFUSED" ? "content-refused" : "transport", "model call failed: " + (typeof message === "string" ? message : "unknown"));
223
- }
224
- }
225
- return text;
226
- }
227
- };
228
- return port;
229
- }
230
- /** Resolve the model route: agent-owned selection first, deployment default second. */
231
- function modelRoute(ctx, agent, session) {
232
- const owned = agent?.model?.current?.();
233
- if (owned !== void 0) return {
234
- provider: owned.provider,
235
- model: owned.model
236
- };
237
- if (session !== void 0) {
238
- const value = ctx.get("sessionProjections")?.snapshot?.(session, ["modelSelection"])?.values?.modelSelection;
239
- const chosen = value?.next ?? value?.lastUsed;
240
- if (chosen !== void 0 && chosen !== null) return {
241
- provider: chosen.provider,
242
- model: chosen.model
243
- };
244
- }
245
- const fallback = ctx.get("agentDefaultModel")?.currentSelection?.();
246
- return fallback === void 0 ? void 0 : {
247
- provider: fallback.provider,
248
- model: fallback.model
249
- };
250
- }
251
- //#endregion
252
- export { workingDirectoryPort as C, profileContextPort as D, pluginManagerPort as E, commandsPort as O, skillsPort as S, pluginInventoryPort 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, configEditorPort as w, sessionQueryPort 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 };