@lmzhen/dsh-evolution-skill-discovery 0.30.42 → 0.31.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.
@@ -0,0 +1,38 @@
1
+ import type { DomainGenerationPort } from './domain-generation-service.ts';
2
+ import { type LlmStreamService } from './domain-generation-llm.ts';
3
+ import type { GenerationRequest } from './domain-generation-coordinator.ts';
4
+ import type { SkillIndexRow } from './identity.ts';
5
+ /** Inputs for the production generation port composition. */
6
+ export interface GenerationCompositionInput {
7
+ readonly mode: 'off' | 'shadow' | 'on';
8
+ readonly llm?: LlmStreamService | undefined;
9
+ readonly provider: string;
10
+ readonly model: string;
11
+ readonly maxTokens?: number | undefined;
12
+ readonly timeoutMs?: number | undefined;
13
+ readonly attempts?: number | undefined;
14
+ }
15
+ /**
16
+ * Resolve the production port; mode:on without an llm service fails loud.
17
+ * @param input - mode and concrete llm service.
18
+ * @returns port, or undefined for mode:off.
19
+ */
20
+ export declare function resolveGenerationPort(input: GenerationCompositionInput): DomainGenerationPort | undefined;
21
+ /** Inputs for a map-scope generation request built from one live view. */
22
+ export interface GenerationRequestInput {
23
+ readonly mapScope: string;
24
+ readonly sourceDigest: string;
25
+ readonly mapVersion: string;
26
+ readonly rows: readonly SkillIndexRow[];
27
+ readonly prompt: string;
28
+ readonly promptVersion: string;
29
+ readonly model: string;
30
+ readonly runId: string;
31
+ }
32
+ /**
33
+ * Build a global-map generation request from live rows.
34
+ * @param input - map scope, source identity, rows, and prompt.
35
+ * @returns request with real facts; never reads config arrays.
36
+ */
37
+ export declare function buildGenerationRequest(input: GenerationRequestInput): GenerationRequest;
38
+ //# sourceMappingURL=generation-composition.d.ts.map
@@ -0,0 +1,9 @@
1
+ import type { BootstrapSkillFact } from './domain-bootstrap.ts';
2
+ import type { SkillIndexRow } from './identity.ts';
3
+ /**
4
+ * Convert live model-invocable rows into the initial-map writer's real facts.
5
+ * @param rows - current view rows.
6
+ * @returns stable keys and three-field hashes, never synthetic values.
7
+ */
8
+ export declare function bootstrapFactsFromRows(rows: readonly SkillIndexRow[]): readonly BootstrapSkillFact[];
9
+ //# sourceMappingURL=generation-input.d.ts.map
@@ -1,44 +1,16 @@
1
- import type { SkillSummary } from '@deepseek-ai/dsh-skill';
2
- import { type SkillIndexRow, type SkillKey } from './identity.ts';
3
- /** Query for one catalog view. */
4
- export interface SkillIndexQuery {
5
- readonly cwd: string;
6
- readonly scopeKey?: string | undefined;
7
- readonly scope?: object | undefined;
8
- readonly signal?: AbortSignal | undefined;
9
- }
10
- /** Raw observation supplied by the platform `ctx.skills` adapter. */
11
- export interface SkillIndexSourceSnapshot {
12
- readonly skills: readonly SkillSummary[];
13
- readonly complete: boolean;
14
- }
15
- /** Read-only source the plugin adapter implements with `ctx.skills` + SkillLibrary. */
16
- export interface SkillIndexSource {
17
- snapshot(query: SkillIndexQuery): Promise<SkillIndexSourceSnapshot>;
18
- managedSkillKeys(): Promise<ReadonlySet<SkillKey>>;
19
- protectedSkillKeys?(): Promise<ReadonlySet<SkillKey>>;
20
- pinnedSkillKeys?(): Promise<ReadonlySet<SkillKey>>;
21
- }
22
- /** One normalized per-view read model. */
23
- export interface SkillIndexSnapshot {
24
- readonly viewKey: string;
25
- readonly catalogRevision: string;
26
- readonly viewCatalogDigest: string;
27
- readonly rows: readonly SkillIndexRow[];
28
- readonly complete: boolean;
29
- }
30
- /** Read-only view model; it does not cache or own a provider. */
31
- export declare class SkillIndex {
32
- private readonly source;
33
- constructor(source: SkillIndexSource);
34
- /**
35
- * Read one view from the source.
36
- * @param query - cwd/scope and cancellation for this observation.
37
- * @returns normalized rows and completeness; incomplete data is not hidden.
38
- */
39
- read(query: SkillIndexQuery): Promise<SkillIndexSnapshot>;
40
- }
41
1
  export * from './identity.ts';
2
+ export * from './skill-index.ts';
3
+ export * from './view-state.ts';
4
+ export * from './domain-policy-store.ts';
5
+ export * from './catalog-codec.ts';
6
+ export * from './projection-journal.ts';
7
+ export * from './projection-adapter.ts';
8
+ export * from './projection-runtime.ts';
9
+ export * from './view-snapshot-store.ts';
10
+ export * from './domain-generation-coordinator.ts';
11
+ export * from './domain-generation-llm.ts';
12
+ export * from './generation-input.ts';
13
+ export * from './generation-composition.ts';
42
14
  export * from './domain-map.ts';
43
15
  export * from './projection.ts';
44
16
  export * from './adapter.ts';
@@ -70,5 +42,4 @@ export * from './domain-bootstrap.ts';
70
42
  export * from './domain-generation-service.ts';
71
43
  export * from './assignment-queue.ts';
72
44
  export * from './domain-generation-prompt.ts';
73
- export * from './shadow-evidence.ts';
74
45
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,36 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { DomainPolicyLayer } from './domain-policy.ts';
3
+ /** Main production config. */
4
+ export interface Config {
5
+ readonly featureEpoch: string;
6
+ readonly mode?: 'off' | 'shadow' | 'on' | undefined;
7
+ readonly searchEnabled?: boolean | undefined;
8
+ readonly domainMapPath?: string | undefined;
9
+ readonly projectionJournalPath?: string | undefined;
10
+ readonly viewSnapshotPath?: string | undefined;
11
+ readonly assignmentQueuePath?: string | undefined;
12
+ readonly createClassificationEnabled?: boolean | undefined;
13
+ readonly provisionalThreshold?: number | undefined;
14
+ readonly mapReferenceCwd?: string | undefined;
15
+ readonly mapReferenceScope?: string | undefined;
16
+ readonly generationProvider?: string | undefined;
17
+ readonly generationModel?: string | undefined;
18
+ readonly generationTimeoutMs?: number | undefined;
19
+ readonly generationMaxTokens?: number | undefined;
20
+ readonly generationAttempts?: number | undefined;
21
+ readonly maxCards?: number | undefined;
22
+ readonly tokenBudget?: number | undefined;
23
+ readonly pinDomains?: readonly string[] | undefined;
24
+ readonly disableDomains?: readonly string[] | undefined;
25
+ readonly staleAfterHours?: number | undefined;
26
+ readonly descriptionStaleAfterHours?: number | undefined;
27
+ readonly workspacePolicy?: DomainPolicyLayer | undefined;
28
+ readonly scopePolicy?: DomainPolicyLayer | undefined;
29
+ readonly workspacePolicyPath?: string | undefined;
30
+ readonly scopePolicyPath?: string | undefined;
31
+ }
32
+ export declare const name = "evolution-skill-discovery";
33
+ export declare const inject: string[];
34
+ /** Apply the full production discovery composition. */
35
+ export declare function apply(ctx: Context, config: Config): void;
36
+ //# sourceMappingURL=main-entry.d.ts.map
@@ -13,15 +13,9 @@ export interface Config {
13
13
  readonly staleAfterHours?: number;
14
14
  readonly mapStale?: boolean;
15
15
  readonly searchAvailable?: boolean;
16
- readonly shadowEvidencePath?: string | undefined;
17
16
  readonly domainMinDomains?: number;
18
17
  readonly domainMaxDomains?: number;
19
18
  readonly provisionalThreshold?: number;
20
- readonly shadowEvidence?: {
21
- readonly samples: number;
22
- readonly hiddenRecoverableRate: number;
23
- readonly silentMisses: number;
24
- };
25
19
  readonly maxCards?: number;
26
20
  readonly createClassificationEnabled?: boolean;
27
21
  readonly bootstrapDomains?: DomainGenerationProposal;
@@ -0,0 +1,60 @@
1
+ import type { PreStepDecision } from '@deepseek-ai/dsh-agent';
2
+ import type { ContextFormed, UserMessage } from '@deepseek-ai/dsh-llm';
3
+ import type { ProjectionResult } from './projection.ts';
4
+ import { type CatalogCapture } from './catalog-codec.ts';
5
+ declare module '@deepseek-ai/dsh-llm' {
6
+ interface MessageSourceMap {
7
+ 'evolution-skill-projection': {
8
+ readonly kind: 'evolution-skill-projection';
9
+ readonly entries: readonly CatalogEntry[];
10
+ readonly hiddenNames: readonly string[];
11
+ readonly digest: string;
12
+ } & ContextFormed;
13
+ }
14
+ }
15
+ import type { CatalogEntry } from './projection.ts';
16
+ /** @returns the first platform catalog message in the current decision. */
17
+ export declare function findCatalogMessage(decision: PreStepDecision): UserMessage | undefined;
18
+ /**
19
+ * Replace the current catalog message with projected entries, preserving its framing.
20
+ * @param decision - current pre-step decision.
21
+ * @param capture - platform catalog captured from the same decision.
22
+ * @param entries - projected entries.
23
+ * @returns a new decision; unchanged when no catalog message exists.
24
+ */
25
+ export declare function applyCapturedProjection(decision: PreStepDecision, capture: CatalogCapture, entries: readonly CatalogEntry[]): PreStepDecision;
26
+ /**
27
+ * Restore the exact captured platform catalog in the current decision.
28
+ * @param decision - current pre-step decision.
29
+ * @param capture - durable platform catalog capture.
30
+ * @returns a new decision; unchanged when no catalog message exists.
31
+ */
32
+ export declare function restoreCapturedProjection(decision: PreStepDecision, capture: CatalogCapture): PreStepDecision;
33
+ /**
34
+ * Append a replacement catalog when the current decision has no catalog message.
35
+ * @param decision - current pre-step decision.
36
+ * @param sourceEntries - full platform entries for the stable digest.
37
+ * @param result - projection result.
38
+ * @returns decision with replacement catalog plus optional context.
39
+ */
40
+ export declare function applyReplacementDecision(decision: PreStepDecision, sourceEntries: readonly CatalogEntry[], result: ProjectionResult): PreStepDecision;
41
+ /**
42
+ * Append a full replacement catalog without a current catalog message.
43
+ * @param decision - current pre-step decision.
44
+ * @param capture - durable platform capture.
45
+ * @returns decision with a full replacement catalog.
46
+ */
47
+ export declare function applyRestoreUpdate(decision: PreStepDecision, capture: CatalogCapture): PreStepDecision;
48
+ /** @returns captured current catalog or undefined when the shape is unknown. */
49
+ export declare function captureDecisionCatalog(decision: PreStepDecision): CatalogCapture | undefined;
50
+ /** @returns a model-visible projection context message, or undefined when empty. */
51
+ export declare function renderProjectionContext(result: ProjectionResult): UserMessage | undefined;
52
+ /**
53
+ * Apply the complete projection: replace the current catalog and append one context message.
54
+ * @param decision - current pre-step decision.
55
+ * @param capture - platform catalog captured from the same decision.
56
+ * @param result - complete projection.
57
+ * @returns new decision; unchanged when no catalog exists.
58
+ */
59
+ export declare function applyProjectedDecision(decision: PreStepDecision, capture: CatalogCapture, result: ProjectionResult): PreStepDecision;
60
+ //# sourceMappingURL=projection-adapter.d.ts.map
@@ -0,0 +1,32 @@
1
+ import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
2
+ import type { CatalogCapture } from './catalog-codec.ts';
3
+ /** Durable record of one projection so it can be restored after restart. */
4
+ export interface ProjectionJournalRecord {
5
+ readonly sessionId: string;
6
+ readonly viewKey: string;
7
+ readonly projectionDigest: string;
8
+ readonly codecVersion: string;
9
+ readonly mapVersion: string;
10
+ readonly policyDigest: string;
11
+ readonly base: CatalogCapture;
12
+ readonly createdAt: number;
13
+ }
14
+ /** Durable projection journal; no base means restore must fail closed. */
15
+ export declare class ProjectionJournal {
16
+ private readonly io;
17
+ private readonly path;
18
+ private readonly maxRecords;
19
+ constructor(io: EvolutionIoLike, path: string, options?: {
20
+ readonly maxRecords?: number | undefined;
21
+ });
22
+ private read;
23
+ /** Persist one projection record; later records with the same key win. */
24
+ put(record: ProjectionJournalRecord): Promise<void>;
25
+ /** @returns the exact projection record for one view/digest/codec, if present. */
26
+ get(sessionId: string, viewKey: string, projectionDigest: string, codecVersion: string): Promise<ProjectionJournalRecord | undefined>;
27
+ /** @returns newest record for a view, used when leaving ready without a known digest. */
28
+ latest(sessionId: string, viewKey: string, codecVersion: string): Promise<ProjectionJournalRecord | undefined>;
29
+ /** Delete one record after a successful restore. */
30
+ remove(sessionId: string, viewKey: string, projectionDigest: string, codecVersion: string): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=projection-journal.d.ts.map
@@ -0,0 +1,63 @@
1
+ import type { Agent, PreStepDecision } from '@deepseek-ai/dsh-agent';
2
+ import type { DomainMapStore } from './domain-map.ts';
3
+ import type { DomainPolicyStore } from './domain-policy-store.ts';
4
+ import { type SkillIndexSource } from './skill-index.ts';
5
+ import { ProjectionJournal } from './projection-journal.ts';
6
+ import { type ViewState } from './view-state.ts';
7
+ /** Working-directory port; supplied by the platform composition. */
8
+ export interface WorkingDirectoryPort {
9
+ ensure(agent: Agent, signal?: AbortSignal | undefined): Promise<string>;
10
+ }
11
+ /** Inputs for the per-view projection runtime. */
12
+ export interface ProjectionRuntimePorts {
13
+ readonly skillIndexSource: SkillIndexSource;
14
+ readonly map: DomainMapStore;
15
+ readonly policy: DomainPolicyStore;
16
+ readonly policyFor?: ((cwd: string) => Promise<DomainPolicyStore>) | undefined;
17
+ readonly journal: ProjectionJournal;
18
+ readonly workingDirectory: WorkingDirectoryPort;
19
+ readonly featureEpoch: string;
20
+ readonly codecVersion: string;
21
+ readonly adapterVersion: string;
22
+ readonly projectionSchemaVersion: string;
23
+ readonly mode: 'off' | 'shadow' | 'on';
24
+ readonly maxCards?: number | undefined;
25
+ readonly tokenBudget?: number | undefined;
26
+ readonly searchAvailable?: (() => boolean) | undefined;
27
+ readonly staleAfterHours?: number | undefined;
28
+ readonly descriptionStaleAfterHours?: number | undefined;
29
+ readonly isFrozen?: ((agent: Agent) => boolean | Promise<boolean>) | undefined;
30
+ }
31
+ /** Last projection action, for diagnostics and current-request assertions. */
32
+ export interface ProjectionReport {
33
+ readonly action: 'none' | 'applied' | 'restored' | 'blocked';
34
+ readonly digest: string;
35
+ readonly content?: string | undefined;
36
+ readonly at: number;
37
+ }
38
+ /** Per-view projection runtime; no global readiness and no history edits. */
39
+ export declare class ProjectionRuntime {
40
+ private readonly ports;
41
+ private readonly states;
42
+ private last;
43
+ private readonly lastByAgent;
44
+ constructor(ports: ProjectionRuntimePorts);
45
+ /** @returns last action for one agent, or the latest process-wide action. */
46
+ report(agent?: Agent | undefined): ProjectionReport;
47
+ private mark;
48
+ /** @returns current state for diagnostics, if this process has seen the view. */
49
+ stateFor(viewKey: string, mapVersion: string, policyDigest: string): ViewState | undefined;
50
+ private restore;
51
+ private readState;
52
+ /** @returns current per-view state without projecting; used by diagnostic commands. */
53
+ inspect(agent: Agent, signal?: AbortSignal | undefined): Promise<ViewState>;
54
+ /**
55
+ * Project or restore one current pre-step decision.
56
+ * @param agent - session owner; identity comes from workingDirectory.
57
+ * @param decision - current waterfall decision.
58
+ * @param signal - request cancellation.
59
+ * @returns projected, restored, or unchanged decision.
60
+ */
61
+ project(agent: Agent, decision: PreStepDecision, signal?: AbortSignal | undefined): Promise<PreStepDecision>;
62
+ }
63
+ //# sourceMappingURL=projection-runtime.d.ts.map
@@ -16,6 +16,7 @@ export interface DomainCard {
16
16
  readonly managedCount: number;
17
17
  readonly externalCount: number;
18
18
  readonly pendingCount: number;
19
+ readonly unclassifiedCount?: number | undefined;
19
20
  readonly state: 'active' | 'provisional';
20
21
  readonly asOf: string;
21
22
  readonly mapVersion: string;
@@ -42,8 +43,6 @@ export interface ProjectionResult {
42
43
  readonly catalogEntries: readonly CatalogEntry[];
43
44
  readonly context: string;
44
45
  readonly hiddenNames: readonly string[];
45
- readonly shadowHiddenNames?: readonly string[];
46
- readonly shadowRecoveredNames?: readonly string[];
47
46
  readonly scope: string;
48
47
  readonly digest: string;
49
48
  readonly complete: boolean;
@@ -0,0 +1,19 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ /** Search-only composition config. Domain/projection config is intentionally absent. */
3
+ export interface Config {
4
+ /** Stable feature epoch used by later projection phases; required for config compatibility. */
5
+ readonly featureEpoch: string;
6
+ /** Register the model-visible skill_search tool. Defaults to true. */
7
+ readonly searchEnabled?: boolean | undefined;
8
+ /** Legacy discovery mode; search-only accepts only off and warns otherwise. */
9
+ readonly mode?: 'off' | 'shadow' | 'on' | 'auto' | undefined;
10
+ }
11
+ export declare const name = "evolution-skill-discovery";
12
+ export declare const inject: string[];
13
+ /**
14
+ * Compose the search-only discovery surface.
15
+ * @param ctx - plugin context with skills, workingDirectory, and tools.
16
+ * @param config - search-only configuration.
17
+ */
18
+ export declare function apply(ctx: Context, config: Config): void;
19
+ //# sourceMappingURL=search-entry.d.ts.map
@@ -0,0 +1,41 @@
1
+ import type { SkillSummary } from '@deepseek-ai/dsh-skill';
2
+ import { type SkillIndexRow, type SkillKey } from './identity.ts';
3
+ /** Query for one catalog view. */
4
+ export interface SkillIndexQuery {
5
+ readonly cwd: string;
6
+ readonly scopeKey?: string | undefined;
7
+ readonly scope?: object | undefined;
8
+ readonly signal?: AbortSignal | undefined;
9
+ }
10
+ /** Raw observation supplied by the platform `ctx.skills` adapter. */
11
+ export interface SkillIndexSourceSnapshot {
12
+ readonly skills: readonly SkillSummary[];
13
+ readonly complete: boolean;
14
+ }
15
+ /** Read-only source the plugin adapter implements with `ctx.skills` + SkillLibrary. */
16
+ export interface SkillIndexSource {
17
+ snapshot(query: SkillIndexQuery): Promise<SkillIndexSourceSnapshot>;
18
+ managedSkillKeys(): Promise<ReadonlySet<SkillKey>>;
19
+ protectedSkillKeys?(): Promise<ReadonlySet<SkillKey>>;
20
+ pinnedSkillKeys?(): Promise<ReadonlySet<SkillKey>>;
21
+ }
22
+ /** One normalized per-view read model. */
23
+ export interface SkillIndexSnapshot {
24
+ readonly viewKey: string;
25
+ readonly catalogRevision: string;
26
+ readonly viewCatalogDigest: string;
27
+ readonly rows: readonly SkillIndexRow[];
28
+ readonly complete: boolean;
29
+ }
30
+ /** Read-only view model; it does not cache or own a provider. */
31
+ export declare class SkillIndex {
32
+ private readonly source;
33
+ constructor(source: SkillIndexSource);
34
+ /**
35
+ * Read one view from the source.
36
+ * @param query - cwd/scope and cancellation for this observation.
37
+ * @returns normalized rows and completeness; incomplete data is not hidden.
38
+ */
39
+ read(query: SkillIndexQuery): Promise<SkillIndexSnapshot>;
40
+ }
41
+ //# sourceMappingURL=skill-index.d.ts.map
@@ -5,14 +5,14 @@ import type { SkillSearch, SkillSearchQuery, SkillSearchResponse } from './searc
5
5
  export interface SkillSearchProvider {
6
6
  search(query: SkillSearchQuery, options?: {
7
7
  readonly allowedSkillKeys?: ReadonlySet<string> | undefined;
8
- }, agent?: Agent | undefined): Promise<SkillSearchResponse>;
8
+ }, agent?: Agent | undefined, signal?: AbortSignal | undefined): Promise<SkillSearchResponse>;
9
9
  /** Optional current-view policy filter; called per tool call. */
10
- allowedSkillKeys?(agent: Agent | undefined): ReadonlySet<string> | Promise<ReadonlySet<string>> | undefined;
10
+ allowedSkillKeys?(agent: Agent | undefined, signal?: AbortSignal | undefined): ReadonlySet<string> | undefined | Promise<ReadonlySet<string> | undefined>;
11
11
  }
12
12
  /** Static model-facing description; no dynamic domain list/tree. */
13
13
  export declare const SKILL_SEARCH_DESCRIPTION = "Search skill summaries by name, description, or whenToUse when coverage is uncertain. Results are summaries, not bodies; a matching name can be loaded directly. Empty results are inconclusive; the full catalog remains available.";
14
14
  /** @returns response or a degraded hint; never silent empty on failure. */
15
- export declare function searchWithDegraded(provider: SkillSearchProvider | undefined, query: SkillSearchQuery, allowedSkillKeys?: ReadonlySet<string> | undefined, agent?: Agent | undefined): Promise<SkillSearchResponse>;
15
+ export declare function searchWithDegraded(provider: SkillSearchProvider | undefined, query: SkillSearchQuery, allowedSkillKeys?: ReadonlySet<string> | undefined, agent?: Agent | undefined, signal?: AbortSignal | undefined): Promise<SkillSearchResponse>;
16
16
  /**
17
17
  * Register skill_search on the optional tools service. The description/schema are static; the
18
18
  * provider is the only dynamic dependency.
@@ -0,0 +1,30 @@
1
+ import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
2
+ /** Frozen view identity captured when a session is created. */
3
+ export interface ViewSnapshot {
4
+ readonly sessionId: string;
5
+ readonly viewKey: string;
6
+ readonly cwd: string;
7
+ readonly viewCatalogDigest: string;
8
+ readonly mapVersion: string;
9
+ readonly configDigest: string;
10
+ readonly featureEpoch: string;
11
+ readonly createdAt: number;
12
+ }
13
+ /** Durable per-session view snapshot; old epochs stay frozen. */
14
+ export declare class ViewSnapshotStore {
15
+ private readonly io;
16
+ private readonly path;
17
+ constructor(io: EvolutionIoLike, path: string);
18
+ private read;
19
+ /** Persist one session snapshot; first writer wins unless overwrite is explicit. */
20
+ put(snapshot: ViewSnapshot, options?: {
21
+ readonly overwrite?: boolean | undefined;
22
+ }): Promise<void>;
23
+ /** @returns frozen snapshot for one session, if recorded. */
24
+ get(sessionId: string): Promise<ViewSnapshot | undefined>;
25
+ /**
26
+ * @returns true for legacy sessions without a snapshot and for older feature epochs.
27
+ */
28
+ isFrozen(sessionId: string, currentFeatureEpoch: string): Promise<boolean>;
29
+ }
30
+ //# sourceMappingURL=view-snapshot-store.d.ts.map
@@ -0,0 +1,59 @@
1
+ /** Per-view projection state; one instance per (workspace, scope, revision). */
2
+ export type ProjectionPhase = 'off' | 'unavailable' | 'bootstrapping' | 'ready' | 'degraded';
3
+ export type MapState = 'empty' | 'ready' | 'stale' | 'corrupt';
4
+ export type SearchState = 'ready' | 'degraded';
5
+ export type PolicyState = 'ready' | 'degraded';
6
+ /** Observable state for one view; never a global readiness flag. */
7
+ export interface ViewState {
8
+ readonly viewKey: string;
9
+ readonly phase: ProjectionPhase;
10
+ readonly map: MapState;
11
+ readonly search: SearchState;
12
+ readonly policy: PolicyState;
13
+ readonly reasons: readonly string[];
14
+ readonly mapVersion: string;
15
+ readonly policyDigest: string;
16
+ readonly viewCatalogDigest: string;
17
+ }
18
+ /** Inputs used to derive one view state. */
19
+ export interface ViewStateInput {
20
+ readonly viewKey: string;
21
+ readonly mode: 'off' | 'shadow' | 'on';
22
+ readonly map: MapState;
23
+ readonly search: SearchState;
24
+ readonly policy: PolicyState;
25
+ readonly catalogComplete: boolean;
26
+ readonly mapVersion: string;
27
+ readonly policyDigest: string;
28
+ readonly viewCatalogDigest: string;
29
+ readonly reasons?: readonly string[];
30
+ }
31
+ /**
32
+ * Derive one view's state without consulting another view.
33
+ * @param input - per-view health and identity.
34
+ * @returns state with reasons; hidden safety is evaluated by canHide.
35
+ */
36
+ export declare function deriveViewState(input: ViewStateInput): ViewState;
37
+ /** @returns true only when this view may hide catalog entries. */
38
+ export declare function canHide(state: ViewState): boolean;
39
+ /** @returns true when this view may render cards, even if hiding is blocked. */
40
+ export declare function canProject(state: ViewState): boolean;
41
+ /** Bounded view-state cache keyed by view identity and codec version. */
42
+ export declare class ViewStateRegistry {
43
+ private readonly entries;
44
+ private readonly limit;
45
+ private readonly ttlMs;
46
+ private readonly now;
47
+ constructor(options?: {
48
+ readonly limit?: number | undefined;
49
+ readonly ttlMs?: number | undefined;
50
+ readonly now?: (() => number) | undefined;
51
+ });
52
+ /** @returns cache key including all identity components that can change a view. */
53
+ key(state: Pick<ViewState, 'viewKey' | 'mapVersion' | 'policyDigest'>, codecVersion: string): string;
54
+ set(state: ViewState, codecVersion: string): void;
55
+ get(viewKey: string, mapVersion: string, policyDigest: string, codecVersion: string): ViewState | undefined;
56
+ deleteView(viewKey: string): void;
57
+ prune(): void;
58
+ }
59
+ //# sourceMappingURL=view-state.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-skill-discovery",
3
3
  "description": "Read model and view identity for evolution skill discovery (community build)",
4
- "version": "0.30.42",
4
+ "version": "0.31.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -11,10 +11,18 @@
11
11
  "directory": "packages/evolution-skill-discovery"
12
12
  },
13
13
  "type": "module",
14
- "main": "lib/index.js",
15
- "types": "lib/types/index.d.ts",
14
+ "main": "lib/main-entry.js",
15
+ "types": "lib/types/main-entry.d.ts",
16
16
  "exports": {
17
17
  ".": {
18
+ "types": "./lib/types/main-entry.d.ts",
19
+ "default": "./lib/main-entry.js"
20
+ },
21
+ "./search": {
22
+ "types": "./lib/types/search-entry.d.ts",
23
+ "default": "./lib/search-entry.js"
24
+ },
25
+ "./domain": {
18
26
  "types": "./lib/types/index.d.ts",
19
27
  "default": "./lib/index.js"
20
28
  },
@@ -33,8 +41,8 @@
33
41
  "@deepseek-ai/dsh-session": "^0.2.1-rc.2",
34
42
  "@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
35
43
  "@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.2",
36
- "@lmzhen/dsh-evolution-core": "^0.30.42",
37
- "@lmzhen/dsh-evolution-io": "^0.30.42"
44
+ "@lmzhen/dsh-evolution-core": "^0.31.0",
45
+ "@lmzhen/dsh-evolution-io": "^0.31.0"
38
46
  },
39
47
  "devDependencies": {
40
48
  "@deepseek-ai/dsh-skill": "^0.2.1-rc.2",
@@ -47,13 +55,12 @@
47
55
  "@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
48
56
  "@deepseek-ai/dsh-skill-filesystem": "^0.2.1-rc.2",
49
57
  "@deepseek-ai/dsh-tool-skill": "^0.2.1-rc.2",
50
- "@lmzhen/dsh-evolution-core": "^0.30.42",
51
- "@lmzhen/dsh-evolution-io": "^0.30.42"
58
+ "@lmzhen/dsh-evolution-core": "^0.31.0",
59
+ "@lmzhen/dsh-evolution-io": "^0.31.0"
52
60
  },
53
61
  "dependencies": {
54
62
  "@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
55
- "minisearch": "^7.2.0",
56
- "@deepseek-ai/dsh-tools": "^0.2.1-rc.2"
63
+ "minisearch": "^7.2.0"
57
64
  },
58
65
  "engines": {
59
66
  "dsh": ">=0.2.1-rc.2 <0.2.2-0"
@@ -1,22 +0,0 @@
1
- import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
2
- import type { ProjectionResult } from './projection.ts';
3
- /** Durable shadow-run evidence; every complete shadow projection is one sample. */
4
- export declare class ShadowEvidenceStore {
5
- private readonly io;
6
- private readonly path;
7
- private samples;
8
- private recovered;
9
- private hidden;
10
- private silentMisses;
11
- private loaded;
12
- constructor(io: EvolutionIoLike, path: string);
13
- load(): Promise<void>;
14
- record(result: ProjectionResult): Promise<void>;
15
- evidence(): {
16
- samples: number;
17
- hiddenRecoverableRate: number;
18
- silentMisses: number;
19
- };
20
- canPromote(): boolean;
21
- }
22
- //# sourceMappingURL=shadow-evidence.d.ts.map