@lmzhen/dsh-evolution-merge 0.28.0 → 0.29.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,55 @@
1
+ import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
2
+ import type { MergeCandidate } from '../contracts.ts';
3
+ import type { SkillCard } from '../skill-card.ts';
4
+ export type EngineScreenResult = {
5
+ readonly ok: true;
6
+ readonly report: Record<string, unknown>;
7
+ } | {
8
+ readonly ok: false;
9
+ readonly error: {
10
+ readonly code: string;
11
+ readonly stage?: string;
12
+ readonly detail?: string;
13
+ };
14
+ };
15
+ export interface EngineScreenPort {
16
+ screen(input: {
17
+ readonly corpusDir: string;
18
+ readonly outDir: string;
19
+ readonly cfg?: Record<string, unknown>;
20
+ readonly signal?: AbortSignal;
21
+ readonly onProgress?: (p: {
22
+ stage: string;
23
+ done?: number;
24
+ total?: number;
25
+ }) => void;
26
+ readonly runner?: (prompt: string, cfg?: Record<string, unknown>) => Promise<string>;
27
+ }): Promise<EngineScreenResult>;
28
+ }
29
+ export interface CandidateSelection {
30
+ readonly candidates: readonly MergeCandidate[];
31
+ readonly skipped: readonly {
32
+ readonly pairKey: string;
33
+ readonly a: string;
34
+ readonly b: string;
35
+ readonly reason?: string;
36
+ }[];
37
+ readonly reportOnly: number;
38
+ readonly candidatePairs?: number;
39
+ }
40
+ export type ScreeningCandidates = readonly MergeCandidate[] & {
41
+ readonly candidatePairs?: number;
42
+ };
43
+ export interface EngineScreeningDeps {
44
+ readonly io: EvolutionIoLike;
45
+ readonly home: string;
46
+ readonly engine: EngineScreenPort;
47
+ readonly select: (report: Record<string, unknown>) => CandidateSelection;
48
+ readonly cfg?: Record<string, unknown>;
49
+ readonly runner?: (prompt: string, cfg?: Record<string, unknown>) => Promise<string>;
50
+ readonly onSelection?: (selection: CandidateSelection, runId: string) => Promise<void>;
51
+ }
52
+ /** Write the exact card bodies as a support-free corpus snapshot and return its root. */
53
+ export declare function snapshotCards(io: EvolutionIoLike, home: string, runId: string, cards: readonly SkillCard[]): Promise<string>;
54
+ export declare function createEngineScreening(deps: EngineScreeningDeps): (cards: readonly SkillCard[], runId: string, signal: AbortSignal) => Promise<readonly MergeCandidate[]>;
55
+ //# sourceMappingURL=engine-screen.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * DeepSeek judge runner over the platform llm service. The engine calls
3
+ * runner(prompt, cfg) and expects raw model text; the platform owns provider
4
+ * selection, usage accounting and transport.
5
+ */
6
+ export interface ModelRoute {
7
+ readonly provider: string;
8
+ readonly model: string;
9
+ }
10
+ export interface LlmChunkLike {
11
+ readonly type: string;
12
+ readonly text?: string;
13
+ readonly reason?: {
14
+ readonly kind?: string;
15
+ readonly failure?: {
16
+ readonly message?: string;
17
+ };
18
+ };
19
+ }
20
+ export interface LlmServiceLike {
21
+ stream?(options: Record<string, unknown>): AsyncIterable<LlmChunkLike>;
22
+ prepareCall?(config: Record<string, unknown>, signal?: AbortSignal): Promise<{
23
+ readonly config: Record<string, unknown>;
24
+ stream(input: Record<string, unknown>): AsyncIterable<LlmChunkLike>;
25
+ }>;
26
+ }
27
+ export declare function createEngineRunner(llm: LlmServiceLike, route: () => ModelRoute): (prompt: string) => Promise<string>;
28
+ //# sourceMappingURL=model-runner.d.ts.map
@@ -7,12 +7,15 @@ import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
7
7
  import { type RuleFinding } from './rules.ts';
8
8
  import { type CommitPort, type CommitStagedResult } from './commit-execute.ts';
9
9
  import type { StagedTree } from './rules.ts';
10
- import type { SkillCard } from './screening.ts';
10
+ import type { SkillCard } from './skill-card.ts';
11
11
  export interface RunAuthoringOptions {
12
12
  readonly io: EvolutionIoLike;
13
13
  readonly home: string;
14
14
  readonly runId: string;
15
+ readonly stageKey?: string;
16
+ readonly reuseStaging?: boolean;
15
17
  readonly target: string;
18
+ readonly mode?: 'merge-into-existing' | 'create-umbrella' | 'keep';
16
19
  readonly cards: readonly SkillCard[];
17
20
  readonly author: (staging: {
18
21
  readonly home: string;
@@ -25,7 +28,9 @@ export interface RunAuthoringOptions {
25
28
  export type AuthoringResult = {
26
29
  readonly ok: true;
27
30
  readonly tree: StagedTree;
28
- readonly commit: CommitStagedResult;
31
+ readonly commit: Extract<CommitStagedResult, {
32
+ readonly ok: true;
33
+ }>;
29
34
  } | {
30
35
  readonly ok: false;
31
36
  readonly message: string;
@@ -4,7 +4,7 @@
4
4
  * outside this adapter: the caller owns staging -> commitStagedRun.
5
5
  */
6
6
  import type { MergeDecision, MergeRow } from './contracts.ts';
7
- import type { SkillCard } from './screening.ts';
7
+ import type { SkillCard } from './skill-card.ts';
8
8
  import type { ScanRound1Outcome } from './scan-run.ts';
9
9
  export interface ChannelTurnLike {
10
10
  readonly text: string;
@@ -45,6 +45,7 @@ export interface ChannelRound1Options {
45
45
  readonly allow: readonly string[];
46
46
  readonly cwd?: string;
47
47
  readonly timeoutMs: number;
48
+ readonly onChildOpened?: (childId: string) => void;
48
49
  }
49
50
  export interface ChannelRound1Result {
50
51
  readonly outcome: ScanRound1Outcome;
@@ -9,6 +9,8 @@ import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
9
9
  export interface CommitAssemblyPort {
10
10
  /** Current SKILL.md body, or null when the skill is not live. */
11
11
  readSkill(name: string): Promise<string | null>;
12
+ /** Whether the name is already occupied by an archived (tombstoned) skill. */
13
+ isArchived?(name: string): Promise<boolean>;
12
14
  }
13
15
  export interface CommitAssemblyOptions {
14
16
  readonly origin: WriteOrigin;
@@ -1,6 +1,7 @@
1
1
  import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
2
2
  export interface CommitReceipt {
3
3
  readonly runId: string;
4
+ readonly parentRunId?: string;
4
5
  readonly unitId: string;
5
6
  readonly target: string;
6
7
  readonly create: boolean;
@@ -9,6 +10,8 @@ export interface CommitReceipt {
9
10
  readonly at: number;
10
11
  }
11
12
  export declare function commitReceiptPath(home: string, runId: string): string;
13
+ export declare function durableReceiptDir(home: string, parentRunId: string): string;
14
+ export declare function durableReceiptPath(home: string, parentRunId: string, stageKey: string): string;
12
15
  export declare function writeCommitReceipt(io: EvolutionIoLike, home: string, receipt: CommitReceipt): Promise<string>;
13
- export declare function readCommitReceipt(io: EvolutionIoLike, home: string, runId: string): Promise<CommitReceipt | null>;
16
+ export declare function readCommitReceipt(io: EvolutionIoLike, home: string, runId: string, target?: string): Promise<CommitReceipt | null>;
14
17
  //# sourceMappingURL=commit-receipt.d.ts.map
@@ -41,7 +41,7 @@ export interface MergeCandidate {
41
41
  readonly arms?: readonly string[];
42
42
  readonly reason?: string;
43
43
  readonly gate?: MergeGateFact;
44
- readonly source?: 'lexical' | 'proposed';
44
+ readonly source?: 'lexical' | 'proposed' | 'engine';
45
45
  }
46
46
  export interface MergeDecision {
47
47
  readonly shouldMerge: boolean;
@@ -50,6 +50,8 @@ export interface MergeDecision {
50
50
  readonly sources: readonly string[];
51
51
  readonly rationale: string;
52
52
  readonly confidence?: number;
53
+ readonly aSummary?: string;
54
+ readonly bSummary?: string;
53
55
  }
54
56
  export interface MergeUsage {
55
57
  readonly inputTokens?: number;
@@ -123,6 +125,8 @@ export interface MergeRow {
123
125
  readonly unitId?: string;
124
126
  readonly origin?: 'agent' | 'human';
125
127
  readonly attempts?: number;
128
+ readonly stagingRef?: string;
129
+ readonly stagingExpiresAt?: number;
126
130
  readonly createdAt: string;
127
131
  readonly updatedAt: string;
128
132
  }
@@ -132,5 +136,6 @@ export interface MergeState {
132
136
  }
133
137
  export declare function emptyMergeState(): MergeState;
134
138
  /** One record can be retried only when the failure says so and names a stage. */
135
- export declare function canRetry(record: Pick<MergeRow, 'state' | 'failure'>): boolean;
139
+ export declare const MERGE_MAX_ATTEMPTS = 3;
140
+ export declare function canRetry(record: Pick<MergeRow, 'state' | 'failure' | 'attempts'>): boolean;
136
141
  //# sourceMappingURL=contracts.d.ts.map
@@ -18,6 +18,8 @@ export type MergeEvent = {
18
18
  readonly type: 'round1-merge';
19
19
  readonly approval: 'on' | 'off';
20
20
  readonly decision?: MergeDecision;
21
+ readonly stagingRef?: string;
22
+ readonly stagingExpiresAt?: number;
21
23
  readonly at: string;
22
24
  } | {
23
25
  readonly type: 'round1-fail';
@@ -44,6 +46,12 @@ export type MergeEvent = {
44
46
  } | {
45
47
  readonly type: 'source-gone';
46
48
  readonly at: string;
49
+ } | {
50
+ readonly type: 'gate-keep';
51
+ readonly a: string;
52
+ readonly b: string;
53
+ readonly reason?: string;
54
+ readonly at: string;
47
55
  };
48
56
  export type TransitionResult = {
49
57
  readonly ok: true;
@@ -6,5 +6,5 @@ export interface MergeDoctorRow {
6
6
  readonly status: 'ok' | 'warn' | 'unknown';
7
7
  readonly detail: string;
8
8
  }
9
- export declare function mergeDoctor(io: EvolutionIoLike, home: string): Promise<readonly MergeDoctorRow[]>;
9
+ export declare function mergeDoctor(io: EvolutionIoLike, home: string, configuredRoot?: string): Promise<readonly MergeDoctorRow[]>;
10
10
  //# sourceMappingURL=doctor.d.ts.map
@@ -6,11 +6,13 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
6
6
  mergeSkippedTtlDays: z<number, number, "volatile-defined">;
7
7
  mergeRunTimeoutMinutes: z<number, number, "volatile-defined">;
8
8
  mergePairTimeoutMinutes: z<number, number, "defined">;
9
+ mergeModelsRoot: z<string, string, "defined">;
9
10
  }>>, Schemastery.ObjectT<NoInfer<{
10
11
  mergeApproval: z<boolean, boolean, "volatile-defined">;
11
12
  mergeSkippedTtlDays: z<number, number, "volatile-defined">;
12
13
  mergeRunTimeoutMinutes: z<number, number, "volatile-defined">;
13
14
  mergePairTimeoutMinutes: z<number, number, "defined">;
15
+ mergeModelsRoot: z<string, string, "defined">;
14
16
  }>>, "plain">;
15
17
  export interface MergePresentationScope {
16
18
  effect(run: () => () => void, label?: string): unknown;
@@ -20,6 +22,7 @@ export interface MergePresentationScope {
20
22
  }, owner?: unknown) => unknown;
21
23
  };
22
24
  }
25
+ export declare function engineConfigFromEnv(configuredRoot?: string): Record<string, unknown> | undefined;
23
26
  export interface MergePresentationContext {
24
27
  inject(names: string[], run: (scope: MergePresentationScope) => void): void;
25
28
  readonly fiber?: unknown;
@@ -27,6 +30,7 @@ export interface MergePresentationContext {
27
30
  /** Suppress the platform auto form; the registry renders the merge card instead. */
28
31
  export declare function configureMergePresentation(ctx: MergePresentationContext): void;
29
32
  export * from './contracts.ts';
33
+ export * from './skill-card.ts';
30
34
  export * from './state.ts';
31
35
  export * from './coordinator.ts';
32
36
  export * from './report.ts';
@@ -42,8 +46,9 @@ export * from './commit-receipt.ts';
42
46
  export * from './commit-execute.ts';
43
47
  export * from './undo-merge.ts';
44
48
  export * from './adapters/library.ts';
45
- export * from './adapters/model.ts';
49
+ export * from './adapters/model-runner.ts';
46
50
  export * from './adapters/channel.ts';
51
+ export * from './adapters/engine-screen.ts';
47
52
  export * from './adapters/undo.ts';
48
53
  export * from './run-shell.ts';
49
54
  export * from './scan-run.ts';
@@ -53,12 +58,6 @@ export * from './round2-outcome.ts';
53
58
  export * from './approve-command.ts';
54
59
  export * from './pair-command.ts';
55
60
  export * from './resume-command.ts';
56
- export * from './screening.ts';
57
- export * from './propose.ts';
58
- export * from './ladder.ts';
59
- export * from './gate-cache.ts';
60
- export * from './gate-filter.ts';
61
- export * from './screening-port.ts';
62
61
  export * from './decision.ts';
63
62
  export * from './prompts.ts';
64
63
  export * from './channel-port.ts';
@@ -32,5 +32,8 @@ export interface MergeCommandDefinitionLike {
32
32
  readonly handler: (invocation: CommandInvocationLike) => Promise<CommandResultLike>;
33
33
  }
34
34
  export declare function createReadOnlyMergeService(io: EvolutionIoLike, home: string): MergeCommandService;
35
+ export declare function runMergeCommand(service: MergeCommandService, rawInput: string, invocation?: {
36
+ readonly agent?: unknown;
37
+ }): Promise<MergeCommandResult>;
35
38
  export declare function createMergeCommand(service: MergeCommandService): MergeCommandDefinitionLike;
36
39
  //# sourceMappingURL=merge-command.d.ts.map
@@ -16,6 +16,7 @@ export interface MergeRouteSource {
16
16
  run(id: string): Promise<RunRecord | undefined>;
17
17
  runs(cursor?: string, limit?: number): Promise<readonly RunRecord[]>;
18
18
  commands(): readonly string[];
19
+ approval?(): boolean;
19
20
  }
20
21
  export declare function makeMergeRoutes(deps: {
21
22
  getSource: () => MergeRouteSource | undefined;
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
6
6
  import type { MergeDecision, MergeRow } from './contracts.ts';
7
- import type { SkillCard } from './screening.ts';
7
+ import type { SkillCard } from './skill-card.ts';
8
8
  import type { ConversationChannelLike } from './channel-port.ts';
9
9
  import { type CommitPort } from './commit-execute.ts';
10
10
  import type { StageToolContext } from './stage-tool.ts';
@@ -7,6 +7,7 @@ export interface MergeParams {
7
7
  readonly mergeSkippedTtlDays: number;
8
8
  readonly mergeRunTimeoutMinutes: number;
9
9
  readonly mergePairTimeoutMinutes: number;
10
+ readonly mergeModelsRoot: string;
10
11
  }
11
12
  export declare const MERGE_PARAM_DEFAULTS: MergeParams;
12
13
  export declare function resolveMergeParams(input?: unknown): MergeParams;
@@ -1,13 +1,15 @@
1
1
  /**
2
- * Round-1/round-2 prompt builders. Pure strings; the channel adapter owns transport.
3
- * Round 1 may only decide; round 2 may only write the staged tree through merge_stage.
2
+ * Round-1/round-2 prompt builders. B draft body, with only the file-tool ->
3
+ * merge_stage substitution and the fresh-mode bridge sentence.
4
4
  */
5
5
  import type { MergeDecision, MergeRow } from './contracts.ts';
6
- import type { SkillCard } from './screening.ts';
7
- export declare const MERGE_PROMPT_VERSION = "merge-pair/v1";
6
+ import type { SkillCard } from './skill-card.ts';
7
+ export declare const MERGE_PROMPT_VERSION = "merge-b/v1";
8
+ export declare const STANDBY_PROMPT = "You are a merge worker. Wait for instructions.";
8
9
  export declare function buildRound1Prompt(candidate: {
9
10
  readonly a: string;
10
11
  readonly b: string;
11
12
  }, cards: readonly SkillCard[]): string;
12
- export declare function buildRound2Prompt(row: MergeRow, decision: MergeDecision): string;
13
+ export declare function buildRound2Prompt(row: MergeRow, decision: MergeDecision, mode?: 'continue' | 'fresh'): string;
14
+ export declare function buildStandbyPrompt(): string;
13
15
  //# sourceMappingURL=prompts.d.ts.map
@@ -15,6 +15,19 @@ export interface MergeRowView {
15
15
  readonly stage: string | null;
16
16
  readonly label: string;
17
17
  readonly updatedAt: string;
18
+ readonly createdAt: string;
19
+ readonly target?: string;
20
+ readonly confidence?: number;
21
+ readonly failure?: {
22
+ readonly stage: string;
23
+ readonly code: string;
24
+ readonly message: string;
25
+ readonly retryable: boolean;
26
+ };
27
+ readonly attempts?: number;
28
+ readonly origin?: 'agent' | 'human';
29
+ readonly stagingExpiresAt?: number;
30
+ readonly actions: readonly string[];
18
31
  }
19
32
  export declare function toRowView(row: MergeRow): MergeRowView;
20
33
  export interface MergeView {
@@ -25,8 +38,10 @@ export interface MergeView {
25
38
  readonly count: number;
26
39
  }[];
27
40
  readonly commands: readonly string[];
41
+ readonly latestRun?: MergeRunFact;
42
+ readonly approval?: boolean;
28
43
  }
29
- export declare function buildMergeView(rows: readonly MergeRow[], commands: readonly string[]): MergeView;
44
+ export declare function buildMergeView(rows: readonly MergeRow[], commands: readonly string[], latestRun?: MergeRunFact, approval?: boolean): MergeView;
30
45
  export interface QueuePage {
31
46
  readonly queue: MergeQueue;
32
47
  readonly items: readonly MergeRowView[];
@@ -6,7 +6,7 @@
6
6
  import { type EvolutionIoLike, type SkillLibrary } from '@lmzhen/dsh-evolution-core';
7
7
  import { type MergeCandidate } from './contracts.ts';
8
8
  import type { MergeParams } from './params.ts';
9
- import type { SkillCard } from './screening.ts';
9
+ import type { SkillCard } from './skill-card.ts';
10
10
  import type { MergeRegistryPort } from './run-shell.ts';
11
11
  import type { MergeCommandService } from './merge-command.ts';
12
12
  import type { StageToolContext } from './stage-tool.ts';
@@ -29,9 +29,8 @@ export interface MergeRuntimeDeps {
29
29
  readonly cwd?: string;
30
30
  readonly timeoutMinutes: number;
31
31
  readonly cards: (signal: AbortSignal) => Promise<readonly SkillCard[]>;
32
- readonly screening: (cards: readonly SkillCard[], signal: AbortSignal) => Promise<readonly MergeCandidate[]>;
33
- /** Run-scoped screening (lexical/C3/gate with a runId-seeded audit); preferred when present. */
34
- readonly screeningForRun?: (cards: readonly SkillCard[], runId: string, signal: AbortSignal) => Promise<readonly MergeCandidate[]>;
32
+ /** Run-scoped engine screening. */
33
+ readonly screeningForRun: (cards: readonly SkillCard[], runId: string, signal: AbortSignal) => Promise<readonly MergeCandidate[]>;
35
34
  readonly stage?: MergeStageBindingPort;
36
35
  }
37
36
  export declare function createMergeRuntime(deps: MergeRuntimeDeps): MergeCommandService;
@@ -6,7 +6,7 @@
6
6
  * approve run must open a new child (not handled by this factory).
7
7
  */
8
8
  import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
9
- import type { SkillCard } from './screening.ts';
9
+ import type { SkillCard } from './skill-card.ts';
10
10
  import { type ConversationChannelLike } from './channel-port.ts';
11
11
  import type { CommitPort } from './commit-execute.ts';
12
12
  import type { StageToolContext } from './stage-tool.ts';
@@ -9,6 +9,8 @@ export interface ScanRound1Outcome {
9
9
  readonly kind: 'keep' | 'merge' | 'failed';
10
10
  readonly decision?: MergeDecision;
11
11
  readonly failure?: MergeFailure;
12
+ readonly stagingRef?: string;
13
+ readonly stagingExpiresAt?: number;
12
14
  }
13
15
  export interface ScanRound2Outcome {
14
16
  readonly kind: 'merged' | 'failed';
@@ -0,0 +1,12 @@
1
+ export interface SkillCard {
2
+ readonly name: string;
3
+ readonly description: string;
4
+ readonly body: string;
5
+ readonly files?: readonly {
6
+ readonly path: string;
7
+ readonly content: string;
8
+ }[];
9
+ readonly protectedBy?: string | null;
10
+ readonly protectionUnknown?: boolean;
11
+ }
12
+ //# sourceMappingURL=skill-card.d.ts.map
@@ -1,5 +1,6 @@
1
1
  import { type EvolutionIoLike, type Probe } from '@lmzhen/dsh-evolution-core';
2
2
  export declare const STAGING_SCHEMA_VERSION = 1;
3
+ export declare function stageKeyOf(runId: string, pairKey: string): string;
3
4
  export declare function stagingRoot(home: string, runId: string): string;
4
5
  export interface StagingSource {
5
6
  readonly name: string;
@@ -13,6 +14,7 @@ export interface StagingManifest {
13
14
  readonly schemaVersion: typeof STAGING_SCHEMA_VERSION;
14
15
  readonly runId: string;
15
16
  readonly target: string;
17
+ readonly mode?: 'merge-into-existing' | 'create-umbrella' | 'keep';
16
18
  readonly sources: readonly string[];
17
19
  readonly promptVersion: string;
18
20
  readonly createdAt: number;
@@ -21,6 +23,7 @@ export interface StagingManifest {
21
23
  export interface CreateStagingInput {
22
24
  readonly runId: string;
23
25
  readonly target: string;
26
+ readonly mode?: 'merge-into-existing' | 'create-umbrella' | 'keep';
24
27
  readonly sources: readonly StagingSource[];
25
28
  readonly promptVersion: string;
26
29
  readonly ttlDays: number;
@@ -40,4 +43,7 @@ export interface StagedView {
40
43
  readonly manifest: StagingManifest;
41
44
  }
42
45
  export declare function readStaging(io: EvolutionIoLike, home: string, runId: string): Promise<Probe<StagedView>>;
46
+ export declare function ensureStaging(io: EvolutionIoLike, home: string, input: CreateStagingInput): Promise<CreateStagingResult>;
47
+ export declare function setStagingTarget(io: EvolutionIoLike, home: string, stageKey: string, target: string, mode?: 'merge-into-existing' | 'create-umbrella' | 'keep'): Promise<boolean>;
48
+ export declare function dropStaging(io: EvolutionIoLike, home: string, stageKey: string): Promise<void>;
43
49
  //# sourceMappingURL=staging.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-merge",
3
3
  "description": "Skill auto-merge domain: screening, two-round authoring, queues and commit orchestration (community build)",
4
- "version": "0.28.0",
4
+ "version": "0.29.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,15 +27,12 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.5",
30
- "@lmzhen/dsh-evolution-core": "^0.28.0"
30
+ "@lmzhen/dsh-evolution-core": "^0.29.0",
31
+ "@lmzhen/dsh-evolution-merge-engine": "^0.29.0"
31
32
  },
32
33
  "peerDependencies": {
33
34
  "@deepseek-ai/cordis": "^4.0.5"
34
35
  },
35
- "devDependencies": {
36
- "@deepseek-ai/cordis": "^4.0.5",
37
- "@lmzhen/dsh-evolution-core": "^0.28.0"
38
- },
39
36
  "engines": {
40
37
  "dsh": ">=0.2.1-rc.1 <0.2.2-0"
41
38
  }
@@ -1,31 +0,0 @@
1
- /**
2
- * Structural ModelPort adapter over the platform llm service. The platform exposes either
3
- * `stream()` (the current shape) or the older prepareCall()/stream pair; both return raw text
4
- * because the gate and proposer own JSON extraction.
5
- */
6
- import type { ModelPort } from '../propose.ts';
7
- export interface ModelRoute {
8
- readonly provider: string;
9
- readonly model: string;
10
- }
11
- export interface LlmChunkLike {
12
- readonly type: string;
13
- readonly text?: string;
14
- readonly usage?: unknown;
15
- readonly reason?: {
16
- readonly kind?: string;
17
- readonly failure?: {
18
- readonly message?: string;
19
- };
20
- };
21
- }
22
- export interface LlmCallLike {
23
- readonly config: Record<string, unknown>;
24
- stream(input: Record<string, unknown>): AsyncIterable<LlmChunkLike>;
25
- }
26
- export interface LlmServiceLike {
27
- prepareCall?(config: Record<string, unknown>, signal?: AbortSignal): Promise<LlmCallLike>;
28
- stream?(options: Record<string, unknown>): AsyncIterable<LlmChunkLike>;
29
- }
30
- export declare function createModelPort(llm: LlmServiceLike, route: () => ModelRoute): ModelPort;
31
- //# sourceMappingURL=model.d.ts.map
@@ -1,31 +0,0 @@
1
- /**
2
- * Gate filter: turn lexical/proposed candidates into the candidates scan may process.
3
- * L0 keeps are dropped unless the deterministic 10% audit re-runs L2 and overrides.
4
- */
5
- import type { MergeCandidate } from './contracts.ts';
6
- import { type GateCache, type GateFacts, type GateModelPort, type GateVerdict } from './ladder.ts';
7
- export interface GateFilterOptions {
8
- readonly facts: readonly GateFacts[];
9
- readonly model: GateModelPort;
10
- readonly modelName: string;
11
- readonly signal: AbortSignal;
12
- readonly runSeed: string;
13
- readonly cache?: GateCache;
14
- readonly auditRate?: number;
15
- }
16
- export interface GateDecision {
17
- readonly candidate: MergeCandidate;
18
- readonly verdicts: readonly GateVerdict[];
19
- readonly auditOverride: boolean;
20
- }
21
- export interface GateFilterResult {
22
- readonly kept: readonly GateDecision[];
23
- readonly dropped: readonly GateDecision[];
24
- readonly errors: readonly {
25
- readonly candidate: MergeCandidate;
26
- readonly message: string;
27
- }[];
28
- readonly calls: number;
29
- }
30
- export declare function filterCandidates(candidates: readonly MergeCandidate[], options: GateFilterOptions): Promise<GateFilterResult>;
31
- //# sourceMappingURL=gate-filter.d.ts.map
@@ -1,26 +0,0 @@
1
- /**
2
- * C3 semantic proposer: one library-level model call (sharded when the library is large)
3
- * that proposes candidate pairs. It never judges merge quality; L0–L2 does that.
4
- */
5
- import type { MergeCandidate } from './contracts.ts';
6
- import type { SkillCard } from './screening.ts';
7
- export interface ModelPort {
8
- callJson(request: {
9
- readonly system: string;
10
- readonly user: string;
11
- readonly maxTokens: number;
12
- readonly signal: AbortSignal;
13
- }): Promise<unknown>;
14
- }
15
- export interface ProposeOptions {
16
- readonly shardSize?: number;
17
- readonly maxPairs?: number;
18
- readonly signal: AbortSignal;
19
- }
20
- export interface ProposeResult {
21
- readonly candidates: readonly MergeCandidate[];
22
- readonly shards: number;
23
- readonly degraded: readonly string[];
24
- }
25
- export declare function proposePairs(cards: readonly SkillCard[], port: ModelPort, options: ProposeOptions): Promise<ProposeResult>;
26
- //# sourceMappingURL=propose.d.ts.map
@@ -1,47 +0,0 @@
1
- /**
2
- * The real screening port: lexical floor + optional C3 proposal + optional L0–L2 gate.
3
- * Each stage is independently testable; this file only composes their frozen contracts.
4
- */
5
- import { type MergeCandidate } from './contracts.ts';
6
- import { type SkillCard, type ScreeningOptions } from './screening.ts';
7
- import { type ModelPort } from './propose.ts';
8
- import type { GateCache, GateModelPort } from './ladder.ts';
9
- export interface ScreeningForRunOptions extends Omit<BuildScreeningOptions, 'signal'> {
10
- readonly runSeed: string;
11
- }
12
- export interface BuildScreeningOptions {
13
- readonly cards: readonly SkillCard[];
14
- readonly signal: AbortSignal;
15
- readonly lexical?: ScreeningOptions;
16
- readonly propose?: {
17
- readonly model: ModelPort;
18
- readonly shardSize?: number;
19
- readonly maxPairs?: number;
20
- };
21
- readonly gate?: {
22
- readonly model: GateModelPort;
23
- readonly modelName: string;
24
- readonly runSeed: string;
25
- readonly cache?: GateCache;
26
- readonly auditRate?: number;
27
- };
28
- }
29
- export interface ScreeningPortStats {
30
- readonly lexical: number;
31
- readonly proposed: number;
32
- readonly candidates: number;
33
- readonly kept: number;
34
- readonly dropped: number;
35
- readonly gateCalls: number;
36
- readonly gateErrors: number;
37
- readonly shards: number;
38
- }
39
- export interface ScreeningPortResult {
40
- readonly candidates: readonly MergeCandidate[];
41
- readonly stats: ScreeningPortStats;
42
- readonly degraded: readonly string[];
43
- }
44
- export declare function buildScreeningCandidates(options: BuildScreeningOptions): Promise<ScreeningPortResult>;
45
- /** Build the run-scoped screening function; the run id seeds the 10% audit. */
46
- export declare function createScreeningForRun(options: ScreeningForRunOptions): (signal: AbortSignal) => Promise<readonly MergeCandidate[]>;
47
- //# sourceMappingURL=screening-port.d.ts.map
@@ -1,30 +0,0 @@
1
- import type { MergeCandidate } from './contracts.ts';
2
- export interface SkillCard {
3
- readonly name: string;
4
- readonly description: string;
5
- readonly body: string;
6
- }
7
- export interface ScreeningOptions {
8
- /** Body Jaccard at/above this is a candidate on its own. */
9
- readonly bodyGate?: number;
10
- /** Description Jaccard at/above this is a candidate when the body also clears minAffinity. */
11
- readonly summaryGate?: number;
12
- /** Minimum body affinity for a summary-led candidate. */
13
- readonly minAffinity?: number;
14
- /** Upper bound after sorting by score; absent = no cap. */
15
- readonly maxCandidates?: number;
16
- }
17
- export interface ScreeningStats {
18
- readonly skills: number;
19
- readonly filtered: number;
20
- readonly candidates: number;
21
- }
22
- export interface ScreeningResult {
23
- readonly candidates: readonly MergeCandidate[];
24
- readonly stats: ScreeningStats;
25
- }
26
- /** Shannon entropy over characters; a cheap prefilter signal, not a name-quality judge. */
27
- export declare function nameEntropy(name: string): number;
28
- export declare function prefilter(cards: readonly SkillCard[]): readonly SkillCard[];
29
- export declare function lexicalCandidates(cards: readonly SkillCard[], options?: ScreeningOptions): ScreeningResult;
30
- //# sourceMappingURL=screening.d.ts.map