dsh-continual-evolve 0.15.4 → 0.15.5
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 +13 -9
- package/README.zh.md +13 -9
- package/client/client.js +181 -16
- package/lib/card-routes.d.ts +2 -0
- package/lib/card-routes.js +66 -1
- package/lib/index.d.ts +4 -2
- package/lib/index.js +7 -2
- package/lib/memory-snapshot.d.ts +52 -0
- package/lib/memory-snapshot.js +100 -4
- package/lib/skill-rules.d.ts +73 -0
- package/lib/skill-rules.js +158 -0
- package/lib/skill-tools.d.ts +9 -0
- package/lib/skill-tools.js +198 -0
- package/lib/store.d.ts +73 -5
- package/lib/store.js +504 -6
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +1 -1
package/lib/store.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MemoryProposal } from "./memory-rules.js";
|
|
2
|
+
import { type SkillProposal } from "./skill-rules.js";
|
|
2
3
|
import { type ProposalContext, type ProposalOutcome } from "./store-apply.js";
|
|
3
4
|
export type { MemoryProposal, ProposalContext, ProposalOutcome };
|
|
4
5
|
/** Thrown when the runtime lacks `node:sqlite` — the degrade signal. */
|
|
@@ -12,6 +13,36 @@ export declare const MD_IMPORT_STATE_KEY = "md-imported";
|
|
|
12
13
|
export declare const GLOBAL_WORKSPACE = "";
|
|
13
14
|
/** Preview size cap for the card's content endpoint (ZCode's viewer uses 5 MiB). */
|
|
14
15
|
export declare const MEMORY_FILE_PREVIEW_LIMIT: number;
|
|
16
|
+
/** One stored skill record (snake_case columns camelCased). Skills carry no type. */
|
|
17
|
+
export interface SkillRecord {
|
|
18
|
+
workspaceId: string;
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
body: string;
|
|
23
|
+
status: "active" | "quarantined" | "archived";
|
|
24
|
+
/** Origin session id, `null` for imports. */
|
|
25
|
+
sourceSession: string | null;
|
|
26
|
+
/** Trajectory seq range the skill came from ("820-831"), `null` when unknown. */
|
|
27
|
+
sourceSeqs: string | null;
|
|
28
|
+
/** The run that wrote it; `'explicit'` for tool writes. */
|
|
29
|
+
sourceRun: string | null;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
}
|
|
33
|
+
/** What a single skill proposal produced. */
|
|
34
|
+
export interface SkillProposalOutcome {
|
|
35
|
+
id: string;
|
|
36
|
+
action: SkillProposal["action"];
|
|
37
|
+
ok: boolean;
|
|
38
|
+
/** Blocking reason when `ok` is false. */
|
|
39
|
+
reason?: string;
|
|
40
|
+
}
|
|
41
|
+
/** A non-fatal file-projection problem the caller should surface. */
|
|
42
|
+
export interface SkillFileWarning {
|
|
43
|
+
id: string;
|
|
44
|
+
warning: string;
|
|
45
|
+
}
|
|
15
46
|
/** One stored memory record (snake_case columns camelCased). */
|
|
16
47
|
export interface MemoryRecord {
|
|
17
48
|
workspaceId: string;
|
|
@@ -67,6 +98,20 @@ export interface PatrolResult {
|
|
|
67
98
|
id: string;
|
|
68
99
|
reason: string;
|
|
69
100
|
}[];
|
|
101
|
+
/** Orphan skill FTS rows (no matching skill) removed. */
|
|
102
|
+
skillOrphanFtsRows: number;
|
|
103
|
+
/** Skills quarantined by the secret screen, with the redacted reasons. */
|
|
104
|
+
skillQuarantined: {
|
|
105
|
+
workspaceId: string;
|
|
106
|
+
id: string;
|
|
107
|
+
reason: string;
|
|
108
|
+
}[];
|
|
109
|
+
/** Managed SKILL.md files rewritten or created to match the store. */
|
|
110
|
+
skillFilesReconciled: number;
|
|
111
|
+
/** Orphan managed SKILL.md files (no active store row) removed. */
|
|
112
|
+
skillOrphanFilesRemoved: number;
|
|
113
|
+
/** Managed file operations that failed (retried by the next patrol). */
|
|
114
|
+
skillFileErrors: number;
|
|
70
115
|
}
|
|
71
116
|
/** The store surface every consumer (tool, extraction, card, injection) uses. */
|
|
72
117
|
export interface MemoryStore {
|
|
@@ -93,11 +138,11 @@ export interface MemoryStore {
|
|
|
93
138
|
listWorkspaces(): WorkspaceSummary[];
|
|
94
139
|
/**
|
|
95
140
|
* The partition with the most recent session activity: the newest ledger
|
|
96
|
-
* instant against the newest memory write, whichever is later.
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* fallback for a partition whose ledger rows were pruned.
|
|
100
|
-
* when the store holds neither.
|
|
141
|
+
* instant against the newest memory or skill write, whichever is later.
|
|
142
|
+
* The ledgers carry a row for every run — including skips and explicit
|
|
143
|
+
* writes — so they track "a session worked here", while the memory write
|
|
144
|
+
* is the durable fallback for a partition whose ledger rows were pruned.
|
|
145
|
+
* Undefined only when the store holds neither.
|
|
101
146
|
*/
|
|
102
147
|
mostRecentlyActiveWorkspace(): string | undefined;
|
|
103
148
|
/** Hygiene pass: orphan FTS cleanup + secret quarantine. */
|
|
@@ -105,6 +150,29 @@ export interface MemoryStore {
|
|
|
105
150
|
/** Ledger rows older than the cutoff, removed (the one unbounded table). */
|
|
106
151
|
pruneLedger(beforeIso: string): number;
|
|
107
152
|
close(): void;
|
|
153
|
+
/** One active skill row from a partition, undefined when absent. */
|
|
154
|
+
getSkill(workspaceId: string, id: string): SkillRecord | undefined;
|
|
155
|
+
/** Active skills of one partition, newest first. */
|
|
156
|
+
listSkills(workspaceId: string): SkillRecord[];
|
|
157
|
+
/** Every non-archived skill of one partition, newest first. */
|
|
158
|
+
listAllSkills(workspaceId: string): SkillRecord[];
|
|
159
|
+
/**
|
|
160
|
+
* Keyword search over skills, workspace-scoped: same AND-combined
|
|
161
|
+
* trigram/LIKE discipline as memory search.
|
|
162
|
+
*/
|
|
163
|
+
searchSkills(workspaceId: string, query: string, limit?: number): SkillRecord[];
|
|
164
|
+
/**
|
|
165
|
+
* The sole skill write gate: validate all proposals, apply atomically,
|
|
166
|
+
* ledger with before/after snapshots, then sync the materialized files.
|
|
167
|
+
* File sync never fails the batch — the database is the source of truth
|
|
168
|
+
* and patrol retries whatever the filesystem refused.
|
|
169
|
+
*/
|
|
170
|
+
applySkillProposals(ctx: ProposalContext, proposals: readonly SkillProposal[]): {
|
|
171
|
+
outcomes: SkillProposalOutcome[];
|
|
172
|
+
warnings: SkillFileWarning[];
|
|
173
|
+
};
|
|
174
|
+
/** Partitions holding active skills (the card's skill fence). */
|
|
175
|
+
listSkillWorkspaces(): WorkspaceSummary[];
|
|
108
176
|
}
|
|
109
177
|
/** Default database location: `$DSH_HOME/evolve/memory.db`, else `~/.dsh/…`. */
|
|
110
178
|
export declare function defaultStorePath(): string;
|