@lmzhen/dsh-evolution-skill-discovery 0.32.2 → 0.32.4
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.
- package/README.md +1 -1
- package/lib/main-entry.js +219 -609
- package/lib/types/description-refresh.d.ts +22 -1
- package/lib/types/domain-bootstrap.d.ts +1 -1
- package/lib/types/domain-map.d.ts +5 -0
- package/lib/types/domain-policy.d.ts +1 -1
- package/lib/types/domain-projection.d.ts +1 -9
- package/lib/types/generation-composition.d.ts +1 -1
- package/lib/types/index.d.ts +1 -4
- package/lib/types/main-entry.d.ts +1 -4
- package/lib/types/projection-adapter.d.ts +2 -2
- package/lib/types/projection-journal.d.ts +2 -0
- package/lib/types/projection-runtime.d.ts +19 -1
- package/lib/types/search.d.ts +6 -0
- package/lib/types/view-snapshot-store.d.ts +2 -0
- package/lib/types/view-state.d.ts +2 -4
- package/package.json +5 -7
- package/lib/types/assignment-queue.d.ts +0 -26
- package/lib/types/assignment-sidecar.d.ts +0 -33
- package/lib/types/assignment.d.ts +0 -131
- package/lib/types/worker.d.ts +0 -14
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DomainMapStore } from './domain-map.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Mark aged fresh descriptions stale so the refresh pass has a producer.
|
|
4
|
+
* @param store - domain map store.
|
|
5
|
+
* @param maxAgeHours - age threshold; undefined disables the producer.
|
|
6
|
+
* @param now - clock for deterministic tests.
|
|
7
|
+
* @returns number of domains marked stale.
|
|
8
|
+
*/
|
|
9
|
+
export declare function markStaleDescriptions(store: DomainMapStore, maxAgeHours: number | undefined, now?: number): Promise<number>;
|
|
10
|
+
/**
|
|
11
|
+
* Mark aged descriptions stale AND refresh every stale description in ONE
|
|
12
|
+
* read/commit. Session start used to call the two producers back to back, so a
|
|
13
|
+
* single start bumped mapVersion twice (P2-14).
|
|
14
|
+
* @param store - domain map store.
|
|
15
|
+
* @param maxAgeHours - age threshold; undefined disables the producer.
|
|
16
|
+
* @param now - clock for deterministic tests.
|
|
17
|
+
* @returns counts of marked and refreshed domains.
|
|
18
|
+
*/
|
|
19
|
+
export declare function refreshAgedDescriptions(store: DomainMapStore, maxAgeHours: number | undefined, now?: number): Promise<{
|
|
20
|
+
marked: number;
|
|
21
|
+
refreshed: number;
|
|
22
|
+
}>;
|
|
2
23
|
/**
|
|
3
24
|
* Re-render stale domain descriptions from their definition fields.
|
|
4
25
|
* @param store - domain map store.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DomainMapSnapshot, type DomainMapStore } from './domain-map.ts';
|
|
2
2
|
import type { DomainGenerationProposal, GenerationSkillFact } from './domain-generation.ts';
|
|
3
3
|
import type { SkillKey } from './identity.ts';
|
|
4
4
|
/** Real fact used by the production initial-map writer. */
|
|
@@ -13,12 +13,17 @@ export interface DomainNode {
|
|
|
13
13
|
readonly version: number;
|
|
14
14
|
readonly createdAt: number;
|
|
15
15
|
readonly updatedAt: number;
|
|
16
|
+
/** When the description last changed; absent on maps written before this field. */
|
|
17
|
+
readonly descriptionUpdatedAt?: number | undefined;
|
|
16
18
|
readonly descriptionHash: string;
|
|
17
19
|
readonly descriptionVersion: number;
|
|
18
20
|
readonly descriptionStatus: 'fresh' | 'stale' | 'failed';
|
|
19
21
|
readonly provenance: Readonly<Record<string, string>>;
|
|
20
22
|
readonly quality: Readonly<Record<string, number>>;
|
|
21
23
|
}
|
|
24
|
+
/** The next CAS version. ONE implementation: non-numeric versions get a suffix,
|
|
25
|
+
* never NaN, and every writer advances the same way. */
|
|
26
|
+
export declare function nextMapVersion(version: string): string;
|
|
22
27
|
/** One skill-domain edge; skillKey is the global identity, not a display name. */
|
|
23
28
|
export interface SkillDomainEdge {
|
|
24
29
|
readonly skillKey: SkillKey;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** One policy layer; only these fields are user-editable. */
|
|
2
|
-
export type DomainPolicyMode = 'off' | '
|
|
2
|
+
export type DomainPolicyMode = 'off' | 'on';
|
|
3
3
|
export interface DomainPolicyLayer {
|
|
4
4
|
readonly mode?: DomainPolicyMode | undefined;
|
|
5
5
|
readonly pinDomains?: readonly string[] | undefined;
|
|
@@ -9,7 +9,7 @@ export interface DomainProjectionInput {
|
|
|
9
9
|
readonly complete: boolean;
|
|
10
10
|
readonly mapStale?: boolean | undefined;
|
|
11
11
|
readonly searchAvailable?: boolean | undefined;
|
|
12
|
-
readonly mode?: 'off' | '
|
|
12
|
+
readonly mode?: 'off' | 'on' | undefined;
|
|
13
13
|
readonly snapshot: DomainMapSnapshot;
|
|
14
14
|
readonly policy: EffectiveDomainPolicy;
|
|
15
15
|
readonly viewKey: string;
|
|
@@ -25,14 +25,6 @@ export interface DomainProjectionInput {
|
|
|
25
25
|
readonly now?: number | undefined;
|
|
26
26
|
readonly staleAfterHours?: number | undefined;
|
|
27
27
|
readonly descriptionStaleAfterHours?: number | undefined;
|
|
28
|
-
readonly maxVisibleDepth?: number | undefined;
|
|
29
28
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Build L1 cards and the hidden set for one view, then delegate the pure
|
|
32
|
-
* catalog rewrite. Structural staleness fails open; description staleness does not.
|
|
33
|
-
* @param input - rows, domain facts, policy, and identity inputs.
|
|
34
|
-
* @returns projection result with cards and hidden names.
|
|
35
|
-
*/
|
|
36
|
-
export declare function hiddenRecoverable(hiddenNames: readonly string[], searchResultNames: ReadonlySet<string>): boolean;
|
|
37
29
|
export declare function buildDomainProjection(input: DomainProjectionInput): ProjectionResult;
|
|
38
30
|
//# sourceMappingURL=domain-projection.d.ts.map
|
|
@@ -4,7 +4,7 @@ import type { GenerationRequest } from './domain-generation-coordinator.ts';
|
|
|
4
4
|
import type { SkillIndexRow } from './identity.ts';
|
|
5
5
|
/** Inputs for the production generation port composition. */
|
|
6
6
|
export interface GenerationCompositionInput {
|
|
7
|
-
readonly mode: 'off' | '
|
|
7
|
+
readonly mode: 'off' | 'on';
|
|
8
8
|
readonly llm?: LlmStreamService | undefined;
|
|
9
9
|
readonly provider: string;
|
|
10
10
|
readonly model: string;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -18,16 +18,13 @@ export * from './domain-map-store.ts';
|
|
|
18
18
|
export * from './domain-policy.ts';
|
|
19
19
|
export * from './domain-generation.ts';
|
|
20
20
|
export * from './domain-description.ts';
|
|
21
|
+
export * from './description-refresh.ts';
|
|
21
22
|
export * from './domain-quality.ts';
|
|
22
23
|
export * from './domain-projection.ts';
|
|
23
24
|
export * from './tool.ts';
|
|
24
|
-
export * from './assignment.ts';
|
|
25
25
|
export * from './security.ts';
|
|
26
|
-
export * from './assignment-sidecar.ts';
|
|
27
26
|
export * from './awareness.ts';
|
|
28
|
-
export * from './worker.ts';
|
|
29
27
|
export * from './domain-bootstrap.ts';
|
|
30
28
|
export * from './domain-generation-service.ts';
|
|
31
|
-
export * from './assignment-queue.ts';
|
|
32
29
|
export * from './domain-generation-prompt.ts';
|
|
33
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -5,14 +5,11 @@ import type { DomainPolicyLayer } from './domain-policy.ts';
|
|
|
5
5
|
/** Main production config. */
|
|
6
6
|
export interface Config {
|
|
7
7
|
readonly featureEpoch: string;
|
|
8
|
-
readonly mode?: 'off' | '
|
|
8
|
+
readonly mode?: 'off' | 'on' | undefined;
|
|
9
9
|
readonly searchEnabled?: boolean | undefined;
|
|
10
10
|
readonly domainMapPath?: string | undefined;
|
|
11
11
|
readonly projectionJournalPath?: string | undefined;
|
|
12
12
|
readonly viewSnapshotPath?: string | undefined;
|
|
13
|
-
readonly assignmentQueuePath?: string | undefined;
|
|
14
|
-
readonly createClassificationEnabled?: boolean | undefined;
|
|
15
|
-
readonly provisionalThreshold?: number | undefined;
|
|
16
13
|
readonly mapReferenceCwd?: string | undefined;
|
|
17
14
|
readonly mapReferenceScope?: string | undefined;
|
|
18
15
|
readonly generationProvider?: string | undefined;
|
|
@@ -37,7 +37,7 @@ export declare function restoreCapturedProjection(decision: PreStepDecision, cap
|
|
|
37
37
|
* @param result - projection result.
|
|
38
38
|
* @returns decision with replacement catalog plus optional context.
|
|
39
39
|
*/
|
|
40
|
-
export declare function applyReplacementDecision(decision: PreStepDecision, sourceEntries: readonly CatalogEntry[], result: ProjectionResult): PreStepDecision;
|
|
40
|
+
export declare function applyReplacementDecision(decision: PreStepDecision, sourceEntries: readonly CatalogEntry[], result: ProjectionResult, seen?: ReadonlySet<string> | undefined): PreStepDecision;
|
|
41
41
|
/**
|
|
42
42
|
* Append a full replacement catalog without a current catalog message.
|
|
43
43
|
* @param decision - current pre-step decision.
|
|
@@ -56,5 +56,5 @@ export declare function renderProjectionContext(result: ProjectionResult): UserM
|
|
|
56
56
|
* @param result - complete projection.
|
|
57
57
|
* @returns new decision; unchanged when no catalog exists.
|
|
58
58
|
*/
|
|
59
|
-
export declare function applyProjectedDecision(decision: PreStepDecision, capture: CatalogCapture, result: ProjectionResult): PreStepDecision;
|
|
59
|
+
export declare function applyProjectedDecision(decision: PreStepDecision, capture: CatalogCapture, result: ProjectionResult, seen?: ReadonlySet<string> | undefined): PreStepDecision;
|
|
60
60
|
//# sourceMappingURL=projection-adapter.d.ts.map
|
|
@@ -30,5 +30,7 @@ export declare class ProjectionJournal {
|
|
|
30
30
|
latest(sessionId: string, viewKey: string, codecVersion: string): Promise<ProjectionJournalRecord | undefined>;
|
|
31
31
|
/** Delete one record after a successful restore. */
|
|
32
32
|
remove(sessionId: string, viewKey: string, projectionDigest: string, codecVersion: string): Promise<void>;
|
|
33
|
+
/** Delete every record for one session/view after a successful restore. */
|
|
34
|
+
removeView(sessionId: string, viewKey: string, _codecVersion: string): Promise<void>;
|
|
33
35
|
}
|
|
34
36
|
//# sourceMappingURL=projection-journal.d.ts.map
|
|
@@ -8,6 +8,18 @@ import { type ViewState } from './view-state.ts';
|
|
|
8
8
|
export interface WorkingDirectoryPort {
|
|
9
9
|
ensure(agent: Agent, signal?: AbortSignal | undefined): Promise<string>;
|
|
10
10
|
}
|
|
11
|
+
/** Bounded catalog/projection history from the evolution-core projection unit. */
|
|
12
|
+
export interface ProjectionHistoryView {
|
|
13
|
+
readonly catalogs: readonly {
|
|
14
|
+
readonly text: string;
|
|
15
|
+
readonly entries: readonly {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly description: string;
|
|
18
|
+
}[];
|
|
19
|
+
readonly update: boolean;
|
|
20
|
+
}[];
|
|
21
|
+
readonly digests: readonly string[];
|
|
22
|
+
}
|
|
11
23
|
/** Inputs for the per-view projection runtime. */
|
|
12
24
|
export interface ProjectionRuntimePorts {
|
|
13
25
|
readonly skillIndexSource: SkillIndexSource;
|
|
@@ -16,11 +28,14 @@ export interface ProjectionRuntimePorts {
|
|
|
16
28
|
readonly policyFor?: ((cwd: string) => Promise<DomainPolicyStore>) | undefined;
|
|
17
29
|
readonly journal: ProjectionJournal;
|
|
18
30
|
readonly workingDirectory: WorkingDirectoryPort;
|
|
31
|
+
readonly history?: ((agent: Agent) => ProjectionHistoryView | undefined) | undefined;
|
|
32
|
+
/** Degraded-path warning sink; absence is silent for tests that do not care. */
|
|
33
|
+
readonly warn?: ((message: string) => void) | undefined;
|
|
19
34
|
readonly featureEpoch: string;
|
|
20
35
|
readonly codecVersion: string;
|
|
21
36
|
readonly adapterVersion: string;
|
|
22
37
|
readonly projectionSchemaVersion: string;
|
|
23
|
-
readonly mode: 'off' | '
|
|
38
|
+
readonly mode: 'off' | 'on';
|
|
24
39
|
readonly maxCards?: number | undefined;
|
|
25
40
|
readonly tokenBudget?: number | undefined;
|
|
26
41
|
readonly searchAvailable?: (() => boolean) | undefined;
|
|
@@ -41,9 +56,12 @@ export declare class ProjectionRuntime {
|
|
|
41
56
|
private readonly states;
|
|
42
57
|
private last;
|
|
43
58
|
private readonly lastByAgent;
|
|
59
|
+
private warnedMissingHistory;
|
|
44
60
|
constructor(ports: ProjectionRuntimePorts);
|
|
45
61
|
/** @returns last action for one agent, or the latest process-wide action. */
|
|
46
62
|
report(agent?: Agent | undefined): ProjectionReport;
|
|
63
|
+
private hasStructuralLog;
|
|
64
|
+
private warnMissingHistory;
|
|
47
65
|
private mark;
|
|
48
66
|
/** @returns current state for diagnostics, if this process has seen the view. */
|
|
49
67
|
stateFor(viewKey: string, mapVersion: string, policyDigest: string): ViewState | undefined;
|
package/lib/types/search.d.ts
CHANGED
|
@@ -65,6 +65,12 @@ export interface SearchIndexCacheKey {
|
|
|
65
65
|
/** Per-view cache keyed by searchIndexKey; never shares one engine across views. */
|
|
66
66
|
export declare class SkillSearchCache {
|
|
67
67
|
private readonly entries;
|
|
68
|
+
private readonly maxEntries;
|
|
69
|
+
constructor(options?: {
|
|
70
|
+
readonly maxEntries?: number | undefined;
|
|
71
|
+
});
|
|
72
|
+
/** @returns the current number of cached view indices (bounded by maxEntries). */
|
|
73
|
+
get size(): number;
|
|
68
74
|
/**
|
|
69
75
|
* Get or build one view index. A failed rebuild retains the previous engine
|
|
70
76
|
* and marks it stale; no previous engine means undefined.
|
|
@@ -14,12 +14,14 @@ export interface ViewSnapshot {
|
|
|
14
14
|
export declare class ViewSnapshotStore {
|
|
15
15
|
private readonly io;
|
|
16
16
|
private readonly path;
|
|
17
|
+
private serial;
|
|
17
18
|
constructor(io: EvolutionIoLike, path: string);
|
|
18
19
|
private read;
|
|
19
20
|
/** Persist one session snapshot; first writer wins unless overwrite is explicit. */
|
|
20
21
|
put(snapshot: ViewSnapshot, options?: {
|
|
21
22
|
readonly overwrite?: boolean | undefined;
|
|
22
23
|
}): Promise<void>;
|
|
24
|
+
private decode;
|
|
23
25
|
/** @returns frozen snapshot for one session, if recorded. */
|
|
24
26
|
get(sessionId: string): Promise<ViewSnapshot | undefined>;
|
|
25
27
|
/**
|
|
@@ -18,7 +18,7 @@ export interface ViewState {
|
|
|
18
18
|
/** Inputs used to derive one view state. */
|
|
19
19
|
export interface ViewStateInput {
|
|
20
20
|
readonly viewKey: string;
|
|
21
|
-
readonly mode: 'off' | '
|
|
21
|
+
readonly mode: 'off' | 'on';
|
|
22
22
|
readonly map: MapState;
|
|
23
23
|
readonly search: SearchState;
|
|
24
24
|
readonly policy: PolicyState;
|
|
@@ -31,11 +31,9 @@ export interface ViewStateInput {
|
|
|
31
31
|
/**
|
|
32
32
|
* Derive one view's state without consulting another view.
|
|
33
33
|
* @param input - per-view health and identity.
|
|
34
|
-
* @returns state with reasons;
|
|
34
|
+
* @returns state with reasons; card rendering is gated by canProject.
|
|
35
35
|
*/
|
|
36
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
37
|
/** @returns true when this view may render cards, even if hiding is blocked. */
|
|
40
38
|
export declare function canProject(state: ViewState): boolean;
|
|
41
39
|
/** Bounded view-state cache keyed by view identity and codec version. */
|
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.32.
|
|
4
|
+
"version": "0.32.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,9 +32,8 @@
|
|
|
32
32
|
"@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
|
|
33
33
|
"@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
|
|
34
34
|
"@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.2",
|
|
35
|
-
"@lmzhen/dsh-evolution-
|
|
36
|
-
"@lmzhen/dsh-evolution-
|
|
37
|
-
"@lmzhen/dsh-evolution-io": "^0.32.2"
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.32.4",
|
|
36
|
+
"@lmzhen/dsh-evolution-io": "^0.32.4"
|
|
38
37
|
},
|
|
39
38
|
"devDependencies": {
|
|
40
39
|
"@deepseek-ai/dsh-skill": "^0.2.1-rc.2",
|
|
@@ -44,9 +43,8 @@
|
|
|
44
43
|
"@deepseek-ai/dsh-agent-loop-testkit": "^0.2.1-rc.2",
|
|
45
44
|
"@deepseek-ai/dsh-system-prompt": "^0.2.1-rc.2",
|
|
46
45
|
"@deepseek-ai/dsh-tools": "^0.2.1-rc.2",
|
|
47
|
-
"@lmzhen/dsh-evolution-
|
|
48
|
-
"@lmzhen/dsh-evolution-
|
|
49
|
-
"@lmzhen/dsh-evolution-io": "^0.32.2"
|
|
46
|
+
"@lmzhen/dsh-evolution-core": "^0.32.4",
|
|
47
|
+
"@lmzhen/dsh-evolution-io": "^0.32.4"
|
|
50
48
|
},
|
|
51
49
|
"dependencies": {
|
|
52
50
|
"@deepseek-ai/dsh-llm": "^0.2.1-rc.2",
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
|
|
2
|
-
import type { EvolutionStateStore } from '@lmzhen/dsh-evolution-contract';
|
|
3
|
-
import type { AssignmentQueue, AssignmentQueueEntry, AssignmentSubmission } from './assignment.ts';
|
|
4
|
-
/** Durable assignment queue; process-local cache over one JSON file. */
|
|
5
|
-
export declare class JsonAssignmentQueue implements AssignmentQueue {
|
|
6
|
-
private readonly entries;
|
|
7
|
-
private loadPromise;
|
|
8
|
-
private readonly io;
|
|
9
|
-
private readonly path;
|
|
10
|
-
private readonly store;
|
|
11
|
-
constructor(io: EvolutionIoLike, path: string, store?: EvolutionStateStore);
|
|
12
|
-
load(): Promise<void>;
|
|
13
|
-
private persist;
|
|
14
|
-
enqueue(input: {
|
|
15
|
-
key: string;
|
|
16
|
-
submission: AssignmentSubmission;
|
|
17
|
-
proposalDigest: string;
|
|
18
|
-
createdAt: number;
|
|
19
|
-
}): Promise<{
|
|
20
|
-
entry: AssignmentQueueEntry;
|
|
21
|
-
duplicate: boolean;
|
|
22
|
-
}>;
|
|
23
|
-
update(key: string, status: AssignmentQueueEntry['status'], pendingReason?: AssignmentQueueEntry['pendingReason']): Promise<void>;
|
|
24
|
-
list(): readonly AssignmentQueueEntry[];
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=assignment-queue.d.ts.map
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Context as CordisContext } from '@deepseek-ai/cordis';
|
|
2
|
-
import type { Context as HostContext } from '@deepseek-ai/cordis/src/context.ts';
|
|
3
|
-
type Context = CordisContext & HostContext;
|
|
4
|
-
import type { DomainAssignmentService } from './assignment.ts';
|
|
5
|
-
declare module '@deepseek-ai/cordis' {
|
|
6
|
-
interface Events {
|
|
7
|
-
'evolution/approval-decided'(payload: {
|
|
8
|
-
readonly record: {
|
|
9
|
-
readonly kind: string;
|
|
10
|
-
readonly args: unknown;
|
|
11
|
-
};
|
|
12
|
-
readonly action: 'approve' | 'reject';
|
|
13
|
-
readonly ok: boolean;
|
|
14
|
-
}): void;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/** Options for the create sidecar; it never writes skill content. */
|
|
18
|
-
export interface AssignmentSidecarOptions {
|
|
19
|
-
readonly provider?: string | undefined;
|
|
20
|
-
readonly source?: string | undefined;
|
|
21
|
-
readonly onSubmitted?: (() => void) | undefined;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Observe successful create calls and submit their optional domain proposal.
|
|
25
|
-
* Direct creates submit immediately; staged creates submit only after approval.
|
|
26
|
-
* @param ctx - plugin context with tools and approval events.
|
|
27
|
-
* @param service - the one assignment service.
|
|
28
|
-
* @param options - provider/source identity for skillKey.
|
|
29
|
-
* @returns disposer for both listeners.
|
|
30
|
-
*/
|
|
31
|
-
export declare function installAssignmentSidecar(ctx: Context, service: DomainAssignmentService, options?: AssignmentSidecarOptions): () => void;
|
|
32
|
-
export {};
|
|
33
|
-
//# sourceMappingURL=assignment-sidecar.d.ts.map
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { DomainMapStore, DomainNode } from './domain-map.ts';
|
|
2
|
-
import type { SkillKey } from './identity.ts';
|
|
3
|
-
/** Closed technical pending set; semantic uncertainty is not pending. */
|
|
4
|
-
export type AssignmentPendingReason = 'invalid-id' | 'unknown-domain' | 'map-version-stale' | 'new-domain-conflict' | 'schema-invalid' | 'queue-unavailable';
|
|
5
|
-
/** LLM proposal accepted by skill_manage create; code validates/mints. */
|
|
6
|
-
export interface AssignmentProposal {
|
|
7
|
-
readonly mode: 'existing' | 'new';
|
|
8
|
-
readonly id?: string | undefined;
|
|
9
|
-
readonly proposed?: {
|
|
10
|
-
readonly title: string;
|
|
11
|
-
readonly purpose: string;
|
|
12
|
-
readonly inScope: readonly string[];
|
|
13
|
-
readonly outOfScope: readonly string[];
|
|
14
|
-
readonly triggers: readonly string[];
|
|
15
|
-
readonly evidenceSkillKeys: readonly string[];
|
|
16
|
-
} | undefined;
|
|
17
|
-
readonly secondaryDomainIds?: readonly string[] | undefined;
|
|
18
|
-
readonly confidence: number;
|
|
19
|
-
readonly reason: string;
|
|
20
|
-
readonly needsReview?: boolean | undefined;
|
|
21
|
-
readonly mapVersion: string;
|
|
22
|
-
}
|
|
23
|
-
/** One create-side queue submission. */
|
|
24
|
-
export interface AssignmentSubmission {
|
|
25
|
-
readonly skillKey: SkillKey;
|
|
26
|
-
readonly threeFieldHash: string;
|
|
27
|
-
readonly modelInvocable: boolean;
|
|
28
|
-
readonly whenToUse?: string | undefined;
|
|
29
|
-
readonly proposal?: AssignmentProposal | undefined;
|
|
30
|
-
readonly now?: number | undefined;
|
|
31
|
-
}
|
|
32
|
-
/** Queue entry; key is the idempotency key. */
|
|
33
|
-
export interface AssignmentQueueEntry {
|
|
34
|
-
readonly key: string;
|
|
35
|
-
readonly submission: AssignmentSubmission;
|
|
36
|
-
readonly proposalDigest: string;
|
|
37
|
-
readonly createdAt: number;
|
|
38
|
-
status: 'queued' | 'pending' | 'applied' | 'provisional';
|
|
39
|
-
pendingReason?: AssignmentPendingReason | undefined;
|
|
40
|
-
}
|
|
41
|
-
/** Queue abstraction used by the one assignment service. */
|
|
42
|
-
export interface AssignmentQueue {
|
|
43
|
-
enqueue(entry: {
|
|
44
|
-
readonly key: string;
|
|
45
|
-
readonly submission: AssignmentSubmission;
|
|
46
|
-
readonly proposalDigest: string;
|
|
47
|
-
readonly createdAt: number;
|
|
48
|
-
}): Promise<{
|
|
49
|
-
entry: AssignmentQueueEntry;
|
|
50
|
-
duplicate: boolean;
|
|
51
|
-
}>;
|
|
52
|
-
update(key: string, status: AssignmentQueueEntry['status'], pendingReason?: AssignmentPendingReason): Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
/** In-memory idempotent queue; production adapter can persist by key. */
|
|
55
|
-
export declare class MemoryAssignmentQueue implements AssignmentQueue {
|
|
56
|
-
private readonly entries;
|
|
57
|
-
enqueue(input: {
|
|
58
|
-
key: string;
|
|
59
|
-
submission: AssignmentSubmission;
|
|
60
|
-
proposalDigest: string;
|
|
61
|
-
createdAt: number;
|
|
62
|
-
}): Promise<{
|
|
63
|
-
entry: AssignmentQueueEntry;
|
|
64
|
-
duplicate: boolean;
|
|
65
|
-
}>;
|
|
66
|
-
update(key: string, status: AssignmentQueueEntry['status'], pendingReason?: AssignmentPendingReason): Promise<void>;
|
|
67
|
-
list(): readonly AssignmentQueueEntry[];
|
|
68
|
-
}
|
|
69
|
-
/** Staged create: no queue entry until approval. */
|
|
70
|
-
export interface StagedAssignment {
|
|
71
|
-
readonly id: string;
|
|
72
|
-
readonly submission: AssignmentSubmission;
|
|
73
|
-
}
|
|
74
|
-
/** Result of submit/process; create failure never appears here. */
|
|
75
|
-
export type AssignmentResult = {
|
|
76
|
-
readonly kind: 'unclassified';
|
|
77
|
-
readonly reason: 'feature-off' | 'no-proposal' | 'not-model-invocable';
|
|
78
|
-
} | {
|
|
79
|
-
readonly kind: 'queued';
|
|
80
|
-
readonly entry: AssignmentQueueEntry;
|
|
81
|
-
readonly duplicate: boolean;
|
|
82
|
-
} | {
|
|
83
|
-
readonly kind: 'applied' | 'provisional';
|
|
84
|
-
readonly entry: AssignmentQueueEntry;
|
|
85
|
-
readonly mapVersion: string;
|
|
86
|
-
} | {
|
|
87
|
-
readonly kind: 'pending';
|
|
88
|
-
readonly entry: AssignmentQueueEntry;
|
|
89
|
-
readonly reason: AssignmentPendingReason;
|
|
90
|
-
};
|
|
91
|
-
/** @returns idempotency key for one proposal observation. */
|
|
92
|
-
export declare function assignmentKey(input: {
|
|
93
|
-
skillKey: SkillKey;
|
|
94
|
-
threeFieldHash: string;
|
|
95
|
-
proposalDigest: string;
|
|
96
|
-
mapVersion: string;
|
|
97
|
-
}): string;
|
|
98
|
-
/** @returns stable proposal digest; undefined proposal is digest of null. */
|
|
99
|
-
export declare function proposalDigest(proposal: AssignmentProposal | undefined): string;
|
|
100
|
-
/** @returns a closed-set pending reason or undefined when the proposal can enqueue. */
|
|
101
|
-
export declare function validateProposal(proposal: AssignmentProposal): AssignmentPendingReason | undefined;
|
|
102
|
-
/** @returns true only when whenToUse is covered by in/out/triggers; names alone do not count. */
|
|
103
|
-
export declare function coveredByDomain(whenToUse: string, domain: Pick<DomainNode, 'inScope' | 'outOfScope' | 'triggers'>): boolean;
|
|
104
|
-
/** One assignment sidecar service; the only map write path for create. */
|
|
105
|
-
export declare class DomainAssignmentService {
|
|
106
|
-
private readonly queue;
|
|
107
|
-
private readonly store;
|
|
108
|
-
private readonly options;
|
|
109
|
-
constructor(queue: AssignmentQueue, store: DomainMapStore, options: {
|
|
110
|
-
readonly createClassificationEnabled: boolean;
|
|
111
|
-
readonly createCardsAvailable?: boolean;
|
|
112
|
-
readonly provisionalThreshold?: number;
|
|
113
|
-
readonly now?: () => number;
|
|
114
|
-
});
|
|
115
|
-
/** Stage a create proposal without queueing it. */
|
|
116
|
-
stage(submission: AssignmentSubmission): StagedAssignment;
|
|
117
|
-
/** Approve a staged create; only this call enqueues. */
|
|
118
|
-
approve(staged: StagedAssignment): Promise<AssignmentResult>;
|
|
119
|
-
/**
|
|
120
|
-
* Submit a create proposal after SkillLibrary.create succeeded.
|
|
121
|
-
* @param submission - skill identity, three-field hash, permission, proposal.
|
|
122
|
-
* @returns queue/pending/unclassified; never rolls back create.
|
|
123
|
-
*/
|
|
124
|
-
submit(submission: AssignmentSubmission): Promise<AssignmentResult>;
|
|
125
|
-
/** Process one queued entry with the current map; CAS failure becomes pending. */
|
|
126
|
-
process(entry: AssignmentQueueEntry): Promise<AssignmentResult>;
|
|
127
|
-
/** Manually confirm one provisional domain; no semantic reclassification. */
|
|
128
|
-
confirm(domainId: string): Promise<boolean>;
|
|
129
|
-
private now;
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=assignment.d.ts.map
|
package/lib/types/worker.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { AssignmentQueueEntry, DomainAssignmentService } from './assignment.ts';
|
|
2
|
-
/** Queue view needed by the worker. */
|
|
3
|
-
export interface AssignmentQueueReader {
|
|
4
|
-
list(): readonly AssignmentQueueEntry[];
|
|
5
|
-
}
|
|
6
|
-
/** Drivable worker; the composition may call drain on a schedule. */
|
|
7
|
-
export declare class AssignmentWorker {
|
|
8
|
-
private readonly service;
|
|
9
|
-
private readonly queue;
|
|
10
|
-
constructor(service: DomainAssignmentService, queue: AssignmentQueueReader);
|
|
11
|
-
/** Process queued entries once; returns processed count. */
|
|
12
|
-
drain(limit?: number): Promise<number>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=worker.d.ts.map
|