@lmzhen/dsh-evolution-core 0.37.1 → 0.38.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 (47) hide show
  1. package/README.md +3 -1
  2. package/lib/composition/index.js +2 -2
  3. package/lib/{composition-DckDtQTR.js → composition-dy0gJWDd.js} +1 -1
  4. package/lib/{ensure-CLF9YeBD.js → ensure-B4fjEI0w.js} +3 -10
  5. package/lib/index.js +28 -1296
  6. package/lib/platform/index.js +4 -0
  7. package/lib/platform-Be-_wSVz.js +113 -0
  8. package/lib/presets-C8vuCuNA.js +27 -0
  9. package/lib/restrictor.js +7 -7
  10. package/lib/runtime/plugin.js +197 -0
  11. package/lib/session-projection-CXUNPkq9.js +1250 -0
  12. package/lib/subagent/index.js +1 -1
  13. package/lib/tools-DzcNFex2.js +20 -0
  14. package/lib/types/composition/ensure.js +3 -13
  15. package/lib/types/opt-in.d.ts +1 -1
  16. package/lib/types/opt-in.js +1 -1
  17. package/lib/types/platform/index.d.ts +21 -0
  18. package/lib/types/platform/index.js +12 -0
  19. package/lib/types/platform/llm.d.ts +46 -0
  20. package/lib/types/platform/llm.js +75 -0
  21. package/lib/types/platform/presets.d.ts +31 -0
  22. package/lib/types/platform/presets.js +31 -0
  23. package/lib/types/platform/projections.d.ts +30 -0
  24. package/lib/types/platform/projections.js +31 -0
  25. package/lib/types/platform/tools.d.ts +23 -0
  26. package/lib/types/platform/tools.js +21 -0
  27. package/lib/types/platform-line.generated.d.ts +6 -6
  28. package/lib/types/platform-line.generated.js +6 -6
  29. package/lib/types/platform-services.d.ts +1 -1
  30. package/lib/types/platform-services.js +4 -1
  31. package/lib/types/restrictor.js +7 -9
  32. package/lib/types/runtime/llm.d.ts +34 -0
  33. package/lib/types/runtime/llm.js +71 -0
  34. package/lib/types/runtime/platform.d.ts +35 -0
  35. package/lib/types/runtime/platform.js +38 -0
  36. package/lib/types/runtime/plugin.d.ts +10 -0
  37. package/lib/types/runtime/plugin.js +11 -0
  38. package/lib/types/runtime/projections.d.ts +29 -0
  39. package/lib/types/runtime/projections.js +62 -0
  40. package/lib/types/scope.d.ts +1 -1
  41. package/lib/types/session-projection.d.ts +26 -53
  42. package/lib/types/session-projection.js +22 -58
  43. package/lib/types/skill-reads.js +3 -3
  44. package/lib/types/subagent/types.d.ts +1 -1
  45. package/lib/types/tool-dispatch.d.ts +2 -2
  46. package/lib/types/tool-dispatch.js +3 -3
  47. package/package.json +30 -16
@@ -0,0 +1,35 @@
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.
5
+ */
6
+ import { Service } from '@deepseek-ai/cordis';
7
+ import type { Context } from '@deepseek-ai/cordis';
8
+ import type { LlmPort } from '../platform/llm.ts';
9
+ import type { PresetsPort } from '../platform/presets.ts';
10
+ import type { ProjectionPort } from '../platform/projections.ts';
11
+ import type { ToolsPort } from '../platform/tools.ts';
12
+ /** One capability row for doctor/status consumers. */
13
+ export interface PlatformCapability {
14
+ readonly name: 'projections' | 'llm' | 'tools' | 'presets';
15
+ readonly available: boolean;
16
+ readonly reason?: string;
17
+ }
18
+ /** Resolved host ports and their availability. */
19
+ export interface HostPlatformPorts {
20
+ readonly projections: ProjectionPort | undefined;
21
+ readonly llm: LlmPort | undefined;
22
+ readonly tools: ToolsPort | undefined;
23
+ readonly presets: PresetsPort | undefined;
24
+ }
25
+ /** Domain service owning the host port table. */
26
+ export declare class EvolutionPlatform extends Service {
27
+ static inject: never[];
28
+ readonly ports: HostPlatformPorts;
29
+ constructor(ctx: Context);
30
+ /** True when the two services the runtime cannot work without are present. */
31
+ ready(): boolean;
32
+ /** One row per optional host service; absent services stay visible, not silent. */
33
+ capabilities(): readonly PlatformCapability[];
34
+ }
35
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1,38 @@
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.
5
+ */
6
+ import { Service } from '@deepseek-ai/cordis';
7
+ import { presetsPort } from "../platform/presets.js";
8
+ import { projectionPort } from "../platform/projections.js";
9
+ import { toolsPort } from "../platform/tools.js";
10
+ import { llmPort } from "../platform/llm.js";
11
+ /** Domain service owning the host port table. */
12
+ export class EvolutionPlatform extends Service {
13
+ static inject = [];
14
+ ports;
15
+ constructor(ctx) {
16
+ super(ctx, 'evolutionPlatform');
17
+ this.ports = {
18
+ projections: projectionPort(ctx),
19
+ llm: llmPort(ctx),
20
+ tools: toolsPort(ctx),
21
+ presets: presetsPort(ctx),
22
+ };
23
+ }
24
+ /** True when the two services the runtime cannot work without are present. */
25
+ ready() {
26
+ return this.ports.projections !== undefined && this.ports.llm !== undefined;
27
+ }
28
+ /** One row per optional host service; absent services stay visible, not silent. */
29
+ capabilities() {
30
+ return [
31
+ { name: 'projections', available: this.ports.projections !== undefined, ...(this.ports.projections === undefined ? { reason: 'sessionProjections unavailable' } : {}) },
32
+ { name: 'llm', available: this.ports.llm !== undefined, ...(this.ports.llm === undefined ? { reason: 'llm unavailable' } : {}) },
33
+ { name: 'tools', available: this.ports.tools !== undefined, ...(this.ports.tools === undefined ? { reason: 'tools unavailable' } : {}) },
34
+ { name: 'presets', available: this.ports.presets !== undefined, ...(this.ports.presets === undefined ? { reason: 'agentPresets unavailable' } : {}) },
35
+ ];
36
+ }
37
+ }
38
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Runtime composition entry: mount the family's domain services once per
3
+ * composition scope. Projection consumers read the service; they never
4
+ * register units themselves.
5
+ */
6
+ import type { Context } from '@deepseek-ai/cordis';
7
+ export declare const name = "evolution-core-runtime";
8
+ /** @param ctx - the composition context that owns the runtime services. */
9
+ export declare function apply(ctx: Context): void;
10
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { EvolutionLlm } from "./llm.js";
2
+ import { EvolutionPlatform } from "./platform.js";
3
+ import { EvolutionProjections } from "./projections.js";
4
+ export const name = 'evolution-core-runtime';
5
+ /** @param ctx - the composition context that owns the runtime services. */
6
+ export function apply(ctx) {
7
+ ctx.plugin(EvolutionPlatform);
8
+ ctx.plugin(EvolutionProjections);
9
+ ctx.plugin(EvolutionLlm);
10
+ }
11
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The family's projection runtime: register the five host-only units once and
3
+ * expose typed reads to the pure readers. Missing registry or a registration
4
+ * failure degrades to undefined (the existing fail-open posture), never throws
5
+ * into the host.
6
+ */
7
+ import { Service } from '@deepseek-ai/cordis';
8
+ import type { Context } from '@deepseek-ai/cordis';
9
+ import { type Session } from '../platform/index.ts';
10
+ import { type EvolutionActivityState, type EvolutionEvidenceState, type EvolutionProjectionHistoryState, type EvolutionReadsState, type EvolutionSignalsState } from '../session-projection.ts';
11
+ /** Domain service owning the family's projection registrations. */
12
+ export declare class EvolutionProjections extends Service {
13
+ static inject: never[];
14
+ private handles;
15
+ private degradedReason;
16
+ constructor(ctx: Context);
17
+ protected [Service.init](): Promise<void>;
18
+ /** Whether the five units are registered and readable. */
19
+ status(): 'ready' | 'degraded';
20
+ /** Why the service is degraded; undefined while ready. */
21
+ reason(): string | undefined;
22
+ activity(session: Session): EvolutionActivityState | undefined;
23
+ evidence(session: Session): EvolutionEvidenceState | undefined;
24
+ reads(session: Session): EvolutionReadsState | undefined;
25
+ history(session: Session): EvolutionProjectionHistoryState | undefined;
26
+ signals(session: Session): EvolutionSignalsState | undefined;
27
+ private markDegraded;
28
+ }
29
+ //# sourceMappingURL=projections.d.ts.map
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The family's projection runtime: register the five host-only units once and
3
+ * expose typed reads to the pure readers. Missing registry or a registration
4
+ * failure degrades to undefined (the existing fail-open posture), never throws
5
+ * into the host.
6
+ */
7
+ import { Service } from '@deepseek-ai/cordis';
8
+ import { projectionPort } from "../platform/index.js";
9
+ import { evolutionActivityProjection, evolutionEvidenceProjection, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionSignalsProjection, } from "../session-projection.js";
10
+ /** Domain service owning the family's projection registrations. */
11
+ export class EvolutionProjections extends Service {
12
+ static inject = [];
13
+ handles;
14
+ degradedReason;
15
+ constructor(ctx) {
16
+ super(ctx, 'evolutionProjections');
17
+ }
18
+ async [Service.init]() {
19
+ const platform = this.ctx.get('evolutionPlatform');
20
+ const port = platform?.ports?.projections ?? projectionPort(this.ctx);
21
+ if (port === undefined) {
22
+ this.markDegraded('sessionProjections service unavailable');
23
+ return;
24
+ }
25
+ const partial = {};
26
+ try {
27
+ partial.activity = await port.register(evolutionActivityProjection);
28
+ partial.evidence = await port.register(evolutionEvidenceProjection);
29
+ partial.reads = await port.register(evolutionReadsProjection);
30
+ partial.history = await port.register(evolutionProjectionHistoryProjection);
31
+ partial.signals = await port.register(evolutionSignalsProjection);
32
+ this.handles = partial;
33
+ }
34
+ catch (error) {
35
+ for (const handle of Object.values(partial).reverse()) {
36
+ try {
37
+ await handle.dispose();
38
+ }
39
+ catch { /* best-effort rollback; keep the original failure */ }
40
+ }
41
+ this.markDegraded('projection registration failed: ' + (error instanceof Error ? error.message : String(error)));
42
+ }
43
+ }
44
+ /** Whether the five units are registered and readable. */
45
+ status() {
46
+ return this.handles === undefined ? 'degraded' : 'ready';
47
+ }
48
+ /** Why the service is degraded; undefined while ready. */
49
+ reason() {
50
+ return this.handles === undefined ? this.degradedReason : undefined;
51
+ }
52
+ activity(session) { return this.handles?.activity.stateOf(session); }
53
+ evidence(session) { return this.handles?.evidence.stateOf(session); }
54
+ reads(session) { return this.handles?.reads.stateOf(session); }
55
+ history(session) { return this.handles?.history.stateOf(session); }
56
+ signals(session) { return this.handles?.signals.stateOf(session); }
57
+ markDegraded(reason) {
58
+ this.degradedReason = reason;
59
+ this.ctx.logger.warn('evolution-core-runtime: %s; projection reads degrade to undefined', reason);
60
+ }
61
+ }
62
+ //# sourceMappingURL=projections.js.map
@@ -4,7 +4,7 @@
4
4
  * The platform's registry reads are scope-sensitive: `skills.list(options)`
5
5
  * documents its `scope` as "the calling agent; OMITTED READS THE GLOBAL LAYER
6
6
  * ALONE", and `tools.get(name, scope?)` resolves visibility the same way
7
- * (packages/skill/skill/src/index.ts:113-120, packages/core/tools/src/index.ts:1194).
7
+ * (packages/skill/skill/src/index.ts:113-120, packages/core/tools/src/index.ts:239).
8
8
  * A preset-mounted family row therefore lives in its PRESET'S STANDING SCOPE,
9
9
  * so a scope-less read cannot see it — the asymmetry between "evolution mounted
10
10
  * onto the original preset" and "the evolution variant preset".
@@ -1,6 +1,5 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
- import type { Session } from '@deepseek-ai/dsh-session';
3
- import type { ProjectionDefinition } from '@deepseek-ai/dsh-session-projection';
2
+ import type { EvolutionProjectionDefinition, Session } from './platform/index.ts';
4
3
  import { type EvidenceIndex } from './evidence.ts';
5
4
  import { type TurnFoldState, type TurnSignals } from './signals.ts';
6
5
  /** Time of the newest event folded for one session; 0 for a log with no event. */
@@ -28,18 +27,10 @@ export interface EvolutionEvidenceState {
28
27
  /** Boundary seqs, ascending. Every other seq at or below `through` carries content. */
29
28
  readonly bookkeeping: readonly number[];
30
29
  }
31
- declare module '@deepseek-ai/dsh-session-projection/types' {
32
- interface SessionProjectionStateMap {
33
- /** The curator's idleness gate input: the newest event time of one session. */
34
- evolutionActivity: EvolutionActivityState;
35
- /** The plan path's evidence-class input: the boundary seqs of one session. */
36
- evolutionEvidence: EvolutionEvidenceState;
37
- }
38
- }
39
30
  /** The `evolutionActivity` unit (host-only: no client view is registered for it). */
40
- export declare const evolutionActivityProjection: ProjectionDefinition<'evolutionActivity'>;
31
+ export declare const evolutionActivityProjection: EvolutionProjectionDefinition<'evolutionActivity', EvolutionActivityState>;
41
32
  /** The `evolutionEvidence` unit (host-only: no client view is registered for it). */
42
- export declare const evolutionEvidenceProjection: ProjectionDefinition<'evolutionEvidence'>;
33
+ export declare const evolutionEvidenceProjection: EvolutionProjectionDefinition<'evolutionEvidence', EvolutionEvidenceState>;
43
34
  /**
44
35
  * Whether one session object can be projected at all.
45
36
  *
@@ -102,41 +93,24 @@ export interface EvolutionProjectionHistoryState {
102
93
  readonly catalogs: readonly EvolutionCatalogFrame[];
103
94
  readonly digests: readonly string[];
104
95
  }
105
- declare module '@deepseek-ai/dsh-session-projection/types' {
106
- interface SessionProjectionStateMap {
107
- /** The skill names one session read, for the read-before-write gate and the review plan path. */
108
- evolutionReads: EvolutionReadsState;
109
- /** Catalog/projection frames and digests, newest last; bounded so the state cannot grow with the session. */
110
- evolutionProjectionHistory: EvolutionProjectionHistoryState;
111
- /** The open turn's window signals, for the review cadence. */
112
- evolutionSignals: EvolutionSignalsState;
113
- }
114
- }
115
96
  /** The `evolutionProjectionHistory` unit (host-only). */
116
- export declare const evolutionProjectionHistoryProjection: ProjectionDefinition<'evolutionProjectionHistory'>;
97
+ export declare const evolutionProjectionHistoryProjection: EvolutionProjectionDefinition<'evolutionProjectionHistory', EvolutionProjectionHistoryState>;
117
98
  /** The `evolutionReads` unit (host-only: no client view is registered for it). */
118
- export declare const evolutionReadsProjection: ProjectionDefinition<'evolutionReads'>;
99
+ export declare const evolutionReadsProjection: EvolutionProjectionDefinition<'evolutionReads', EvolutionReadsState>;
119
100
  /** The `evolutionSignals` unit (host-only: no client view is registered for it). */
120
- export declare const evolutionSignalsProjection: ProjectionDefinition<'evolutionSignals'>;
121
- /**
122
- * Register the family's units on the calling context's fiber.
123
- *
124
- * Called by the READERS (not by a plugin's mount) and idempotent by the registry's own reference
125
- * count: the first read of a foldable session installs the definitions, later reads count as
126
- * co-owners, and the keys survive until the last registrant unloads
127
- * (`session-projection/src/index.ts:273-292`). Registering at the read is what keeps a session
128
- * view the registry cannot fold (`isProjectableSession`) from ever reaching its drive — the
129
- * registry folds the in-memory log on first touch, so a unit that appears mid-session is still
130
- * correct (`:602-630`).
131
- *
132
- * Idempotent by design, so a plugin mounting later does not need its own call.
133
- * @param ctx - the mounting plugin's context.
134
- */
135
- export declare function installEvolutionProjections(ctx: Context): void;
101
+ export declare const evolutionSignalsProjection: EvolutionProjectionDefinition<'evolutionSignals', EvolutionSignalsState>;
102
+ /** The read face the runtime service provides to the family's pure readers. */
103
+ export interface EvolutionProjectionReader {
104
+ activity(session: Session): EvolutionActivityState | undefined;
105
+ evidence(session: Session): EvolutionEvidenceState | undefined;
106
+ reads(session: Session): EvolutionReadsState | undefined;
107
+ history(session: Session): EvolutionProjectionHistoryState | undefined;
108
+ signals(session: Session): EvolutionSignalsState | undefined;
109
+ }
136
110
  /**
137
- * Time of one session's newest event, or `undefined` when the unit is not installed.
111
+ * Time of one session's newest event, or undefined when the unit is not available.
138
112
  *
139
- * The curator's idleness gate reads this instead of folding the session log; `undefined` is a
113
+ * The curator's idleness gate reads this instead of folding the session log; undefined is a
140
114
  * measurement that did not happen, which the gate answers with the deployment's fail-open policy.
141
115
  * @param ctx - a context of the runtime (the service is read from the global store).
142
116
  * @param session - the session to ask about.
@@ -144,22 +118,21 @@ export declare function installEvolutionProjections(ctx: Context): void;
144
118
  */
145
119
  export declare function sessionLastEventTime(ctx: Context, session: Session): number | undefined;
146
120
  /**
147
- * The skill names one session read through a non-failed dispatch, or `undefined` when the session
148
- * cannot be projected (a structural view, or a host without the registry).
121
+ * The skill names one session read through a non-failed dispatch, or undefined when the session
122
+ * cannot be projected (a structural view, or a host without the runtime service).
149
123
  *
150
- * `undefined` is NOT an empty set: the tool path's read-before-write gate keeps its previous
151
- * behavior rather than refusing every write in a composition whose session object is a bare stub
152
- * (`skill-reads.ts` documents that three-state posture).
124
+ * undefined is NOT an empty set: the tool path's read-before-write gate keeps its previous
125
+ * behavior rather than refusing every write in a composition whose session object is a bare stub.
153
126
  * @param ctx - a context of the runtime.
154
127
  * @param session - the session whose reads are wanted.
155
128
  * @returns the names read, or undefined when the log cannot be folded.
156
129
  */
157
130
  export declare function sessionReadNames(ctx: Context, session: Session): ReadonlySet<string> | undefined;
158
131
  /**
159
- * The open turn's window signals, or `undefined` when the session cannot be projected.
132
+ * The open turn's window signals, or undefined when the session cannot be projected.
160
133
  *
161
- * The window is the events since the newest `turn/start`, folded by the same `foldTurnEvent`
162
- * `observeEvent` uses; `undefined` means the caller has no measurement (a structural view), not
134
+ * The window is the events since the newest turn/start, folded by the same foldTurnEvent
135
+ * observeEvent uses; undefined means the caller has no measurement (a structural view), not
163
136
  * that the turn was empty.
164
137
  * @param ctx - a context of the runtime.
165
138
  * @param session - the session whose open turn is being judged.
@@ -167,10 +140,10 @@ export declare function sessionReadNames(ctx: Context, session: Session): Readon
167
140
  */
168
141
  export declare function sessionTurnSignals(ctx: Context, session: Session): TurnSignals | undefined;
169
142
  /**
170
- * The evidence index of one session, or `undefined` when the log cannot be classified.
143
+ * The evidence index of one session, or undefined when the log cannot be classified.
171
144
  *
172
- * `undefined` covers both the missing unit and a log whose frames carry no seq: the plan path's
173
- * `EVIDENCE_CLASS` row is report-only and must stay silent rather than report every op.
145
+ * undefined covers both the missing unit and a log whose frames carry no seq: the plan path's
146
+ * EVIDENCE_CLASS row is report-only and must stay silent rather than report every op.
174
147
  * @param ctx - a context of the runtime.
175
148
  * @param session - the session the review plan is authored against.
176
149
  * @returns an index answering "does this seq carry content?".
@@ -4,11 +4,10 @@
4
4
  * 0.2.x deprecates the synchronous log reads (`Session.snapshotEvents` — "existing logic may
5
5
  * remain unmigrated for now, but new calls are prohibited",
6
6
  * `core/session/src/index.ts:639-658`) and drives DOMAIN-OWNED units instead: a registered unit
7
- * folds every committed event once, the registry owns the subscription and the per-session
8
- * watermark, and a reader asks for the current state
9
- * (`session/session-projection/src/index.ts` — `register`/`stateOf`). Each unit here carries
10
- * exactly what one pure family reader derives from a log, so that reader keeps its pure form and
11
- * gains a projection-backed one beside it.
7
+ * folds every committed event once, the runtime service owns the handle and the registry, and a
8
+ * reader asks that service for the current state. Each unit here carries exactly what one pure
9
+ * family reader derives from a log, so that reader keeps its pure form and gains a
10
+ * projection-backed one beside it.
12
11
  *
13
12
  * State stays bounded. The evidence unit keeps the SPARSE boundary seqs and answers the dense
14
13
  * question by complement: a content-seq set grows with every session event, while a turn/step
@@ -223,43 +222,13 @@ export const evolutionSignalsProjection = {
223
222
  return { through: seq, lastEventTime: time, turnStartSeq, turn };
224
223
  },
225
224
  };
226
- /**
227
- * Register the family's units on the calling context's fiber.
228
- *
229
- * Called by the READERS (not by a plugin's mount) and idempotent by the registry's own reference
230
- * count: the first read of a foldable session installs the definitions, later reads count as
231
- * co-owners, and the keys survive until the last registrant unloads
232
- * (`session-projection/src/index.ts:273-292`). Registering at the read is what keeps a session
233
- * view the registry cannot fold (`isProjectableSession`) from ever reaching its drive — the
234
- * registry folds the in-memory log on first touch, so a unit that appears mid-session is still
235
- * correct (`:602-630`).
236
- *
237
- * Idempotent by design, so a plugin mounting later does not need its own call.
238
- * @param ctx - the mounting plugin's context.
239
- */
240
- export function installEvolutionProjections(ctx) {
241
- const register = (registry) => {
242
- registry.register(evolutionActivityProjection);
243
- registry.register(evolutionEvidenceProjection);
244
- registry.register(evolutionReadsProjection);
245
- registry.register(evolutionProjectionHistoryProjection);
246
- registry.register(evolutionSignalsProjection);
247
- };
248
- // Already-mounted registry first: a reader that runs in the same tick as its own mount
249
- // (a unit spec, an assembly-time probe) must see its units registered, and the injected
250
- // callback of a not-yet-available service is not guaranteed to have run by then.
251
- // platform-declaration anchor: the platform’s `sessionProjections` service (optional; undefined ⇒ no measurement)
252
- const mounted = ctx.get('sessionProjections');
253
- if (mounted !== undefined) {
254
- register(mounted);
255
- return;
256
- }
257
- ctx.inject(['sessionProjections'], (injected) => { register(injected.sessionProjections); });
225
+ function projectionService(ctx) {
226
+ return ctx.get('evolutionProjections');
258
227
  }
259
228
  /**
260
- * Time of one session's newest event, or `undefined` when the unit is not installed.
229
+ * Time of one session's newest event, or undefined when the unit is not available.
261
230
  *
262
- * The curator's idleness gate reads this instead of folding the session log; `undefined` is a
231
+ * The curator's idleness gate reads this instead of folding the session log; undefined is a
263
232
  * measurement that did not happen, which the gate answers with the deployment's fail-open policy.
264
233
  * @param ctx - a context of the runtime (the service is read from the global store).
265
234
  * @param session - the session to ask about.
@@ -268,19 +237,17 @@ export function installEvolutionProjections(ctx) {
268
237
  export function sessionLastEventTime(ctx, session) {
269
238
  if (!isProjectableSession(session))
270
239
  return undefined;
271
- installEvolutionProjections(ctx);
272
- const state = ctx.get('sessionProjections')?.stateOf(session, 'evolutionActivity');
240
+ const state = projectionService(ctx)?.activity(session);
273
241
  if (state === undefined || state.lastEventTime === 0)
274
242
  return undefined;
275
243
  return state.lastEventTime;
276
244
  }
277
245
  /**
278
- * The skill names one session read through a non-failed dispatch, or `undefined` when the session
279
- * cannot be projected (a structural view, or a host without the registry).
246
+ * The skill names one session read through a non-failed dispatch, or undefined when the session
247
+ * cannot be projected (a structural view, or a host without the runtime service).
280
248
  *
281
- * `undefined` is NOT an empty set: the tool path's read-before-write gate keeps its previous
282
- * behavior rather than refusing every write in a composition whose session object is a bare stub
283
- * (`skill-reads.ts` documents that three-state posture).
249
+ * undefined is NOT an empty set: the tool path's read-before-write gate keeps its previous
250
+ * behavior rather than refusing every write in a composition whose session object is a bare stub.
284
251
  * @param ctx - a context of the runtime.
285
252
  * @param session - the session whose reads are wanted.
286
253
  * @returns the names read, or undefined when the log cannot be folded.
@@ -288,8 +255,7 @@ export function sessionLastEventTime(ctx, session) {
288
255
  export function sessionReadNames(ctx, session) {
289
256
  if (!isProjectableSession(session))
290
257
  return undefined;
291
- installEvolutionProjections(ctx);
292
- const state = ctx.get('sessionProjections')?.stateOf(session, 'evolutionReads');
258
+ const state = projectionService(ctx)?.reads(session);
293
259
  if (state === undefined)
294
260
  return undefined;
295
261
  const names = new Set();
@@ -300,10 +266,10 @@ export function sessionReadNames(ctx, session) {
300
266
  return names;
301
267
  }
302
268
  /**
303
- * The open turn's window signals, or `undefined` when the session cannot be projected.
269
+ * The open turn's window signals, or undefined when the session cannot be projected.
304
270
  *
305
- * The window is the events since the newest `turn/start`, folded by the same `foldTurnEvent`
306
- * `observeEvent` uses; `undefined` means the caller has no measurement (a structural view), not
271
+ * The window is the events since the newest turn/start, folded by the same foldTurnEvent
272
+ * observeEvent uses; undefined means the caller has no measurement (a structural view), not
307
273
  * that the turn was empty.
308
274
  * @param ctx - a context of the runtime.
309
275
  * @param session - the session whose open turn is being judged.
@@ -312,18 +278,17 @@ export function sessionReadNames(ctx, session) {
312
278
  export function sessionTurnSignals(ctx, session) {
313
279
  if (!isProjectableSession(session))
314
280
  return undefined;
315
- installEvolutionProjections(ctx);
316
- const state = ctx.get('sessionProjections')?.stateOf(session, 'evolutionSignals');
281
+ const state = projectionService(ctx)?.signals(session);
317
282
  if (state === undefined)
318
283
  return undefined;
319
284
  const { substantive, toolCalls, userChars, assistantChars, memorySignal, skillSignal } = state.turn;
320
285
  return { substantive, toolCalls, userChars, assistantChars, memorySignal, skillSignal };
321
286
  }
322
287
  /**
323
- * The evidence index of one session, or `undefined` when the log cannot be classified.
288
+ * The evidence index of one session, or undefined when the log cannot be classified.
324
289
  *
325
- * `undefined` covers both the missing unit and a log whose frames carry no seq: the plan path's
326
- * `EVIDENCE_CLASS` row is report-only and must stay silent rather than report every op.
290
+ * undefined covers both the missing unit and a log whose frames carry no seq: the plan path's
291
+ * EVIDENCE_CLASS row is report-only and must stay silent rather than report every op.
327
292
  * @param ctx - a context of the runtime.
328
293
  * @param session - the session the review plan is authored against.
329
294
  * @returns an index answering "does this seq carry content?".
@@ -331,8 +296,7 @@ export function sessionTurnSignals(ctx, session) {
331
296
  export function sessionEvidenceIndex(ctx, session) {
332
297
  if (!isProjectableSession(session))
333
298
  return undefined;
334
- installEvolutionProjections(ctx);
335
- const state = ctx.get('sessionProjections')?.stateOf(session, 'evolutionEvidence');
299
+ const state = projectionService(ctx)?.evidence(session);
336
300
  if (state === undefined || state.sequenced === 0)
337
301
  return undefined;
338
302
  const { through, bookkeeping } = state;
@@ -1,5 +1,5 @@
1
1
  import { collectReadSkillNames, collectReadSupportFiles, DEFAULT_SUPPORT_READ_TOOL_NAMES, supportFileReadFromPath } from "./tool-dispatch.js";
2
- import { installEvolutionProjections, isProjectableSession, sessionReadNames } from "./session-projection.js";
2
+ import { isProjectableSession, sessionReadNames } from "./session-projection.js";
3
3
  /**
4
4
  * The skill names ONE session read, or `undefined` when its log is not readable.
5
5
  *
@@ -41,8 +41,8 @@ export function sessionReadSupportFiles(ctx, session, options) {
41
41
  if (session === undefined)
42
42
  return undefined;
43
43
  if (isProjectableSession(session)) {
44
- installEvolutionProjections(ctx);
45
- const state = ctx.get('sessionProjections')?.stateOf(session, 'evolutionReads');
44
+ const projections = ctx.get('evolutionProjections');
45
+ const state = projections?.reads(session);
46
46
  if (state !== undefined) {
47
47
  const toolNames = options.toolNames ?? DEFAULT_SUPPORT_READ_TOOL_NAMES;
48
48
  const reads = new Map();
@@ -1,7 +1,7 @@
1
1
  import type { Agent, AgentOptions } from '@deepseek-ai/dsh-agent';
2
2
  import type { SessionId } from '@deepseek-ai/dsh-session';
3
3
  import type { SubagentStopReason } from '@deepseek-ai/dsh-subagent';
4
- import type { ObjectJsonSchema } from '@deepseek-ai/dsh-tools';
4
+ import type { ObjectJsonSchema } from '../platform/index.ts';
5
5
  export type ChannelCode = 'E-323' | 'E-324';
6
6
  export type ChannelKind = 'reviewer' | 'maintainer';
7
7
  export interface PresetStatus {
@@ -6,9 +6,9 @@
6
6
  * mounted tool runtime's mode:
7
7
  *
8
8
  * - native mode: \`tool/call\` (with \`callId\`) settled by \`tool/result\`, the
9
- * write sites being core/agent-loop/src/tool-calls.ts:264 and :282.
9
+ * write sites being core/tools/src/batch.ts:247 and :256.
10
10
  * - PTC mode: \`tool/ptc-dispatch-start\` and \`tool/ptc-dispatch\` (with
11
- * \`subCallId\`), the write sites being core/tools/src/ptc.ts:534 and :509.
11
+ * \`subCallId\`), the write sites being core/tool-executor-ptc/src/ptc.ts:577 and :550.
12
12
  *
13
13
  * A consumer that matches a vocabulary directly therefore goes blind in the
14
14
  * other mode while still appearing to work — the defect this module exists to
@@ -6,9 +6,9 @@
6
6
  * mounted tool runtime's mode:
7
7
  *
8
8
  * - native mode: \`tool/call\` (with \`callId\`) settled by \`tool/result\`, the
9
- * write sites being core/agent-loop/src/tool-calls.ts:264 and :282.
9
+ * write sites being core/tools/src/batch.ts:247 and :256.
10
10
  * - PTC mode: \`tool/ptc-dispatch-start\` and \`tool/ptc-dispatch\` (with
11
- * \`subCallId\`), the write sites being core/tools/src/ptc.ts:534 and :509.
11
+ * \`subCallId\`), the write sites being core/tool-executor-ptc/src/ptc.ts:577 and :550.
12
12
  *
13
13
  * A consumer that matches a vocabulary directly therefore goes blind in the
14
14
  * other mode while still appearing to work — the defect this module exists to
@@ -359,7 +359,7 @@ const PROGRAM_TOOL_NAMES = new Set(['run_code']);
359
359
  * (default `read`). A differently named tool is configured, not guessed. */
360
360
  export const DEFAULT_SUPPORT_READ_TOOL_NAMES = ['read'];
361
361
  /** Dispatch arguments: a JSON string in native mode and an already-parsed
362
- * object in PTC mode (core/tools/src/types.ts:11-23) — parsed defensively so no
362
+ * object in PTC mode (core/tool-executor-ptc/src/types.ts:11-23) — parsed defensively so no
363
363
  * consumer has to trust one modality's encoding. */
364
364
  function parsedArguments(signal) {
365
365
  let parsed = signal.arguments;
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.37.1",
4
+ "version": "0.38.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -30,6 +30,14 @@
30
30
  "types": "./lib/types/http-routes.d.ts",
31
31
  "default": "./lib/http-routes.js"
32
32
  },
33
+ "./runtime": {
34
+ "types": "./lib/types/runtime/plugin.d.ts",
35
+ "default": "./lib/runtime/plugin.js"
36
+ },
37
+ "./platform": {
38
+ "types": "./lib/types/platform/index.d.ts",
39
+ "default": "./lib/platform/index.js"
40
+ },
33
41
  "./restrictor": {
34
42
  "types": "./lib/types/restrictor.d.ts",
35
43
  "default": "./lib/restrictor.js"
@@ -49,29 +57,35 @@
49
57
  "yaml": "^2.4.2",
50
58
  "zod": "^4.4.3",
51
59
  "js-yaml": "^4.1.0",
52
- "@lmzhen/dsh-evolution-contract": "^0.37.1"
60
+ "@lmzhen/dsh-evolution-contract": "^0.38.0"
53
61
  },
54
62
  "peerDependencies": {
55
63
  "@deepseek-ai/cordis": "^4.0.5",
56
- "@deepseek-ai/dsh-scope": "^0.2.1-rc.2",
57
- "@deepseek-ai/dsh-session": "^0.2.1-rc.2",
58
- "@deepseek-ai/dsh-session-projection": "^0.2.1-rc.2",
59
- "@deepseek-ai/dsh-agent": "^0.2.1-rc.2",
60
- "@deepseek-ai/dsh-subagent": "^0.2.1-rc.2",
61
- "@deepseek-ai/dsh-tools": "^0.2.1-rc.2"
64
+ "@deepseek-ai/dsh-scope": "^0.2.2-rc.0",
65
+ "@deepseek-ai/dsh-session": "^0.2.2-rc.0",
66
+ "@deepseek-ai/dsh-session-projection": "^0.2.2-rc.0",
67
+ "@deepseek-ai/dsh-agent": "^0.2.2-rc.0",
68
+ "@deepseek-ai/dsh-subagent": "^0.2.2-rc.0",
69
+ "@deepseek-ai/dsh-tools": "^0.2.2-rc.0",
70
+ "@deepseek-ai/dsh-commands": "^0.2.2-rc.0",
71
+ "@deepseek-ai/dsh-llm": "^0.2.2-rc.0",
72
+ "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.0"
62
73
  },
63
74
  "devDependencies": {
64
75
  "@deepseek-ai/cordis": "^4.0.5",
65
- "@deepseek-ai/dsh-scope": "^0.2.1-rc.2",
66
- "@deepseek-ai/dsh-session": "^0.2.1-rc.2",
67
- "@deepseek-ai/dsh-session-projection": "^0.2.1-rc.2",
68
- "@deepseek-ai/dsh-agent": "^0.2.1-rc.2",
69
- "@deepseek-ai/dsh-subagent": "^0.2.1-rc.2",
70
- "@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
76
+ "@deepseek-ai/dsh-scope": "^0.2.2-rc.0",
77
+ "@deepseek-ai/dsh-session": "^0.2.2-rc.0",
78
+ "@deepseek-ai/dsh-session-projection": "^0.2.2-rc.0",
79
+ "@deepseek-ai/dsh-agent": "^0.2.2-rc.0",
80
+ "@deepseek-ai/dsh-subagent": "^0.2.2-rc.0",
81
+ "@deepseek-ai/dsh-tools": "^0.2.2-rc.0",
71
82
  "@types/js-yaml": "^4.0.9",
72
- "js-yaml": "^4.1.0"
83
+ "js-yaml": "^4.1.0",
84
+ "@deepseek-ai/dsh-commands": "^0.2.2-rc.0",
85
+ "@deepseek-ai/dsh-llm": "^0.2.2-rc.0",
86
+ "@deepseek-ai/dsh-system-prompt": "^0.2.2-rc.0"
73
87
  },
74
88
  "engines": {
75
- "dsh": ">=0.2.1-rc.2 <0.2.2-0"
89
+ "dsh": ">=0.2.2-rc.0 <0.2.3-0"
76
90
  }
77
91
  }