@chenhw7/dsh-memory 0.5.1 → 0.8.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.
- package/README.i18n.yaml +2 -0
- package/README.md +24 -15
- package/{README.zh-CN.md → README.zh.md} +22 -14
- package/cordis.patch.yml +10 -4
- package/lib/benchmark/index.d.ts +24 -7
- package/lib/benchmark/index.d.ts.map +1 -1
- package/lib/benchmark/index.js +55 -7
- package/lib/benchmark/index.js.map +1 -1
- package/lib/client/index.js +47 -31
- package/lib/context/conflict.d.ts +23 -10
- package/lib/context/conflict.d.ts.map +1 -1
- package/lib/context/conflict.js +59 -20
- package/lib/context/conflict.js.map +1 -1
- package/lib/context/index.d.ts +2 -6
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +29 -25
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +17 -5
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +27 -9
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +23 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -1
- package/lib/notes/cleanup.d.ts +48 -0
- package/lib/notes/cleanup.d.ts.map +1 -0
- package/lib/notes/cleanup.js +98 -0
- package/lib/notes/cleanup.js.map +1 -0
- package/lib/notes/index.d.ts +23 -23
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +38 -131
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/render.d.ts +13 -13
- package/lib/notes/render.d.ts.map +1 -1
- package/lib/notes/render.js +13 -13
- package/lib/notes/render.js.map +1 -1
- package/lib/notes/scope.d.ts +11 -10
- package/lib/notes/scope.d.ts.map +1 -1
- package/lib/notes/scope.js +11 -10
- package/lib/notes/scope.js.map +1 -1
- package/lib/notes/settings.d.ts +9 -20
- package/lib/notes/settings.d.ts.map +1 -1
- package/lib/notes/settings.js +9 -27
- package/lib/notes/settings.js.map +1 -1
- package/lib/remote/index.d.ts +67 -6
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +94 -9
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +8 -1
- package/lib/remote/typert.remote-client.js +6 -0
- package/lib/remote/types.d.ts +1 -1
- package/lib/remote/types.d.ts.map +1 -1
- package/lib/review/accumulator.d.ts +5 -5
- package/lib/review/accumulator.d.ts.map +1 -1
- package/lib/review/accumulator.js +3 -3
- package/lib/review/accumulator.js.map +1 -1
- package/lib/review/dedup.d.ts +23 -15
- package/lib/review/dedup.d.ts.map +1 -1
- package/lib/review/dedup.js +34 -83
- package/lib/review/dedup.js.map +1 -1
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +5 -2
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +28 -21
- package/lib/review/index.js.map +1 -1
- package/lib/scanner.d.ts +2 -0
- package/lib/scanner.d.ts.map +1 -1
- package/lib/scanner.js +22 -0
- package/lib/scanner.js.map +1 -1
- package/lib/store/bm25.d.ts +75 -1
- package/lib/store/bm25.d.ts.map +1 -1
- package/lib/store/bm25.js +162 -17
- package/lib/store/bm25.js.map +1 -1
- package/lib/store/cross-process.d.ts +155 -0
- package/lib/store/cross-process.d.ts.map +1 -0
- package/lib/store/cross-process.js +254 -0
- package/lib/store/cross-process.js.map +1 -0
- package/lib/store/index.d.ts +89 -7
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +466 -89
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts +17 -5
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +237 -24
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +31 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +40 -31
- package/lib/notes/writer.d.ts +0 -65
- package/lib/notes/writer.d.ts.map +0 -1
- package/lib/notes/writer.js +0 -131
- package/lib/notes/writer.js.map +0 -1
package/lib/types.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type MemoryCategory = 'failure' | 'correction' | 'insight' | 'preference'
|
|
|
17
17
|
/** Who triggered a write to the memory store (recorded in the audit trail). */
|
|
18
18
|
export type AuditSource = 'tool' | 'review' | 'flush' | 'ui' | 'janitor';
|
|
19
19
|
/** The operation kind recorded in one audit entry. */
|
|
20
|
-
export type AuditOp = 'add' | 'update' | 'remove';
|
|
20
|
+
export type AuditOp = 'add' | 'update' | 'remove' | 'readRaw';
|
|
21
21
|
/** One durable memory entry. */
|
|
22
22
|
export interface MemoryEntry {
|
|
23
23
|
/** Stable identity of this entry. */
|
|
@@ -52,6 +52,21 @@ export interface MemoryEntry {
|
|
|
52
52
|
* being recalled again clears the stamp. Absent on healthy entries.
|
|
53
53
|
*/
|
|
54
54
|
readonly staleSince?: number | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* How many times this entry has been surfaced to the model through a recall
|
|
57
|
+
* path (search hit, memory_get, memory_list page). Incremented by the store
|
|
58
|
+
* on every recall stamp; absent (treated as 0) on entries never recalled.
|
|
59
|
+
* The mechanical use-signal behind ranking and eviction — it needs no model
|
|
60
|
+
* cooperation and retroactively reads as 0 for pre-existing entries.
|
|
61
|
+
*/
|
|
62
|
+
readonly accessCount?: number | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Model-supplied importance (1–5) from the `memory_add` `importance`
|
|
65
|
+
* parameter; absent when the caller did not assess one. Search ranking and
|
|
66
|
+
* the janitor's decay order weigh it, but it never overrides a recall: an
|
|
67
|
+
* entry the model keeps surfacing survives through `accessCount` instead.
|
|
68
|
+
*/
|
|
69
|
+
readonly importance?: number | undefined;
|
|
55
70
|
}
|
|
56
71
|
/** Input for creating a new memory entry. */
|
|
57
72
|
export interface AddMemoryInput {
|
|
@@ -72,6 +87,12 @@ export interface AddMemoryInput {
|
|
|
72
87
|
readonly source?: AuditSource | undefined;
|
|
73
88
|
/** Session id for the audit trail; omitted by tool writes that lack a session handle. */
|
|
74
89
|
readonly sessionId?: string | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Model-supplied importance (1–5); optional. Clamped into range on write.
|
|
92
|
+
* Absent means "not assessed", not "unimportant" — ranking treats absent
|
|
93
|
+
* and mid-range alike rather than penalizing unassessed entries.
|
|
94
|
+
*/
|
|
95
|
+
readonly importance?: number | undefined;
|
|
75
96
|
}
|
|
76
97
|
/** Input for updating an existing memory entry. */
|
|
77
98
|
export interface UpdateMemoryInput {
|
|
@@ -81,6 +102,8 @@ export interface UpdateMemoryInput {
|
|
|
81
102
|
readonly category?: MemoryCategory | undefined;
|
|
82
103
|
/** New summary; optional. Pass empty string to clear. */
|
|
83
104
|
readonly summary?: string | undefined;
|
|
105
|
+
/** New model-assessed importance (1–5, clamped); omitted keeps the stored value. */
|
|
106
|
+
readonly importance?: number | undefined;
|
|
84
107
|
/** Provenance tag for the audit trail; defaults to `'tool'` when omitted. */
|
|
85
108
|
readonly source?: AuditSource | undefined;
|
|
86
109
|
/** Session id for the audit trail; omitted by tool writes that lack a session handle. */
|
|
@@ -94,7 +117,7 @@ export interface MemorySearchQuery {
|
|
|
94
117
|
readonly category?: MemoryCategory;
|
|
95
118
|
/** Restrict `project`-scoped entries to this project name. */
|
|
96
119
|
readonly projectName?: string;
|
|
97
|
-
/**
|
|
120
|
+
/** Relevance-ranked keyword search over entry content: case-insensitive whole-token matching, not substrings. */
|
|
98
121
|
readonly query?: string;
|
|
99
122
|
/** Maximum results to return. */
|
|
100
123
|
readonly limit?: number;
|
|
@@ -233,6 +256,12 @@ export interface MemoryHealth {
|
|
|
233
256
|
readonly lastActivityTs?: number | undefined;
|
|
234
257
|
/** Timestamp of the most recent extraction-sourced audit record, or undefined. */
|
|
235
258
|
readonly lastExtractionTs?: number | undefined;
|
|
259
|
+
/**
|
|
260
|
+
* Per-site counts of failures swallowed by best-effort background paths
|
|
261
|
+
* (audit append, flush, janitor, curator, judge, ...); absent when none have
|
|
262
|
+
* occurred. In-process only — counts reset when the host restarts.
|
|
263
|
+
*/
|
|
264
|
+
readonly backgroundFailures?: Readonly<Record<string, number>> | undefined;
|
|
236
265
|
}
|
|
237
266
|
declare module '@deepseek-ai/dsh-session/types' {
|
|
238
267
|
interface SessionEventMap {
|
package/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yFAAyF;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACjE,kGAAkG;AAClG,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;AAE/C,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AAEvD,iEAAiE;AACjE,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,YAAY,GACZ,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,WAAW,CAAA;AAEf,+EAA+E;AAC/E,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAA;AAExE,sDAAsD;AACtD,MAAM,MAAM,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,yFAAyF;AACzF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACjE,kGAAkG;AAClG,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;AAE/C,2CAA2C;AAC3C,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AAEvD,iEAAiE;AACjE,MAAM,MAAM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;IAC9C;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,SAAS,CAAA;CAC3E;AAED,OAAO,QAAQ,gCAAgC,CAAC;IAC9C,UAAU,eAAe;QACvB;;;;WAIG;QACH,cAAc,EAAE;YACd,iCAAiC;YACjC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;YACrB,oCAAoC;YACpC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;YAC3B,sCAAsC;YACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;YACxB,+CAA+C;YAC/C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;YAC7B,uCAAuC;YACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;SACnC,CAAA;QACD;;WAEG;QACH,gBAAgB,EAAE;YAChB,mCAAmC;YACnC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;YACrB,uBAAuB;YACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;YACxB,sCAAsC;YACtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAA;SACnC,CAAA;QACD;;WAEG;QACH,gBAAgB,EAAE;YAChB,mCAAmC;YACnC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;SACtB,CAAA;KACF;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chenhw7/dsh-memory",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Cairn — long-term memory for the DeepSeek Harness: persistent cross-session memory (store, tools, auto-extraction, context injection) as one installable profile bundle",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://chenhw7.github.io/dsh-memory/",
|
|
@@ -90,59 +90,68 @@
|
|
|
90
90
|
"inject": [
|
|
91
91
|
"@deepseek-ai/dsh-api-remotes",
|
|
92
92
|
"@deepseek-ai/dsh-client-locale",
|
|
93
|
-
"@deepseek-ai/dsh-client-
|
|
93
|
+
"@deepseek-ai/dsh-client-store",
|
|
94
94
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
95
95
|
"@deepseek-ai/dsh-client-ui-settings-plugins"
|
|
96
96
|
]
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
"scripts": {
|
|
100
|
-
"build": "tsc -p tsconfig.json && node scripts/fix-imports.cjs && node scripts/build-client.cjs",
|
|
100
|
+
"build": "tsc -p tsconfig.json && tsc -p tsconfig.client.json && node scripts/fix-imports.cjs && node scripts/build-client.cjs",
|
|
101
101
|
"prepare": "echo skip",
|
|
102
102
|
"prepublishOnly": "npm run build && npm run test",
|
|
103
103
|
"test": "vitest run"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@deepseek-ai/dsh-storage-domain": "^0.1.
|
|
107
|
-
"@deepseek-ai/dsh-storage-json": "^0.1.
|
|
106
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.2-alpha.2",
|
|
107
|
+
"@deepseek-ai/dsh-storage-json": "^0.1.2-alpha.2",
|
|
108
108
|
"zod": "^4.4.3"
|
|
109
109
|
},
|
|
110
110
|
"peerDependencies": {
|
|
111
111
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
112
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
113
|
-
"@deepseek-ai/dsh-brand": "^0.1.
|
|
114
|
-
"@deepseek-ai/dsh-compaction": "^0.1.
|
|
115
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
116
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
117
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
118
|
-
"@deepseek-ai/dsh-session-projection": "^0.1.
|
|
119
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
120
|
-
"@deepseek-ai/dsh-system-prompt": "^0.1.
|
|
121
|
-
"@deepseek-ai/dsh-tools": "^0.1.
|
|
122
|
-
"@deepseek-ai/dsh-typert-protocol": "^0.1.
|
|
112
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.2",
|
|
113
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.2",
|
|
114
|
+
"@deepseek-ai/dsh-compaction": "^0.1.2-alpha.2",
|
|
115
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
|
|
116
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.2",
|
|
117
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.2",
|
|
118
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.2",
|
|
119
|
+
"@deepseek-ai/dsh-settings": "^0.1.2-alpha.2",
|
|
120
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.2",
|
|
121
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.2",
|
|
122
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.2-alpha.2",
|
|
123
123
|
"@deepseek-ai/schemastery": "^3.18.1"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
127
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
128
|
-
"@deepseek-ai/dsh-
|
|
129
|
-
"@deepseek-ai/dsh-
|
|
130
|
-
"@deepseek-ai/dsh-
|
|
131
|
-
"@deepseek-ai/dsh-
|
|
132
|
-
"@deepseek-ai/dsh-
|
|
133
|
-
"@deepseek-ai/dsh-
|
|
134
|
-
"@deepseek-ai/dsh-
|
|
135
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
136
|
-
"@deepseek-ai/dsh-
|
|
137
|
-
"@deepseek-ai/dsh-
|
|
138
|
-
"@deepseek-ai/dsh-
|
|
139
|
-
"@deepseek-ai/dsh-
|
|
140
|
-
"@deepseek-ai/dsh-
|
|
141
|
-
"@deepseek-ai/dsh-
|
|
127
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.2",
|
|
128
|
+
"@deepseek-ai/dsh-api-remotes": "^0.1.2-alpha.2",
|
|
129
|
+
"@deepseek-ai/dsh-brand": "^0.1.2-alpha.2",
|
|
130
|
+
"@deepseek-ai/dsh-client-connection": "^0.1.2-alpha.2",
|
|
131
|
+
"@deepseek-ai/dsh-client-locale": "^0.1.2-alpha.2",
|
|
132
|
+
"@deepseek-ai/dsh-client-store": "^0.1.2-alpha.2",
|
|
133
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.2-alpha.2",
|
|
134
|
+
"@deepseek-ai/dsh-client-ui-renderer": "^0.1.2-alpha.2",
|
|
135
|
+
"@deepseek-ai/dsh-client-ui-settings": "^0.1.2-alpha.2",
|
|
136
|
+
"@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.2-alpha.2",
|
|
137
|
+
"@deepseek-ai/dsh-client-ui-slots": "^0.1.2-alpha.2",
|
|
138
|
+
"@deepseek-ai/dsh-compaction": "^0.1.2-alpha.2",
|
|
139
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.2",
|
|
140
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.2",
|
|
141
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.2",
|
|
142
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.2-alpha.2",
|
|
143
|
+
"@deepseek-ai/dsh-settings": "^0.1.2-alpha.2",
|
|
144
|
+
"@deepseek-ai/dsh-storage": "^0.1.2-alpha.2",
|
|
145
|
+
"@deepseek-ai/dsh-storage-domain": "^0.1.2-alpha.2",
|
|
146
|
+
"@deepseek-ai/dsh-storage-json": "^0.1.2-alpha.2",
|
|
147
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.2",
|
|
148
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.2",
|
|
149
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.2-alpha.2",
|
|
142
150
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
143
151
|
"@testing-library/dom": "^10.4.1",
|
|
144
152
|
"@testing-library/react": "^16.3.2",
|
|
145
153
|
"@types/node": "^22.20.0",
|
|
154
|
+
"@types/react": "^18.3.31",
|
|
146
155
|
"jsdom": "^30.0.1",
|
|
147
156
|
"react": "^18.3.1",
|
|
148
157
|
"react-dom": "^18.3.1",
|
package/lib/notes/writer.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filesystem writes for project notes: atomic file replacement and the
|
|
3
|
-
* AGENTS.md pointer-block maintenance. The exporter is the single writer of
|
|
4
|
-
* the managed regions, so no locking is needed; atomic rename keeps readers
|
|
5
|
-
* (and concurrent sessions rendering the same truth) from ever seeing a torn
|
|
6
|
-
* file.
|
|
7
|
-
*
|
|
8
|
-
* Drift guard (P0-5): before overwriting a managed notes file the writer
|
|
9
|
-
* re-reads the current on-disk content and compares it to the last content
|
|
10
|
-
* this process wrote. When the file has been externally modified (hand edit,
|
|
11
|
-
* merge conflict resolution, another tool), the write is refused and the
|
|
12
|
-
* externally modified file is preserved as `<file>.bak.<ts>` so the user can
|
|
13
|
-
* reconcile manually. The marker-based AGENTS.md pointer block is exempt:
|
|
14
|
-
* it is already drift-safe (content outside the markers is never touched).
|
|
15
|
-
*
|
|
16
|
-
* @module @chenhw7/dsh-memory/notes/writer
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Write a file atomically: write to a sibling temp file, then rename.
|
|
20
|
-
* Parent directories are created on demand.
|
|
21
|
-
* @param filePath - the target file path.
|
|
22
|
-
* @param content - the full file content.
|
|
23
|
-
*/
|
|
24
|
-
export declare function writeFileAtomic(filePath: string, content: string): Promise<void>;
|
|
25
|
-
/** Thrown by {@link writeNotesFile} when the target file has drifted from the last write. */
|
|
26
|
-
export declare class DriftError extends Error {
|
|
27
|
-
/** Absolute path of the backup copy holding the externally modified content. */
|
|
28
|
-
readonly backupPath: string;
|
|
29
|
-
constructor(filePath: string, backupPath: string);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Write a managed notes file atomically with drift guard. Re-reads the
|
|
33
|
-
* current on-disk content before writing; when the file differs from both
|
|
34
|
-
* the previous content this process wrote (`previousContent`) AND the new
|
|
35
|
-
* content (i.e. someone/something else modified the file), the write is
|
|
36
|
-
* refused: the drifted file is copied to `<filePath>.bak.<ts>` and a
|
|
37
|
-
* {@link DriftError} is thrown so the caller can decide what to do.
|
|
38
|
-
*
|
|
39
|
-
* The first write (file absent) is always allowed. A write that is a no-op
|
|
40
|
-
* (new content equals what's on disk) is skipped silently.
|
|
41
|
-
*
|
|
42
|
-
* @param filePath - absolute path of the target file.
|
|
43
|
-
* @param content - the full file content to write.
|
|
44
|
-
* @param previousContent - the content this process last wrote to the file,
|
|
45
|
-
* or `undefined` when this is the first write in this process lifetime.
|
|
46
|
-
* @throws {DriftError} when the on-disk content matches neither
|
|
47
|
-
* `previousContent` nor `content`.
|
|
48
|
-
*/
|
|
49
|
-
export declare function writeNotesFile(filePath: string, content: string, previousContent: string | undefined): Promise<void>;
|
|
50
|
-
/** Marker opening the managed pointer block in AGENTS.md. */
|
|
51
|
-
export declare const AGENTS_POINTER_BEGIN = "<!-- dsh-memory:begin -->";
|
|
52
|
-
/** Marker closing the managed pointer block in AGENTS.md. */
|
|
53
|
-
export declare const AGENTS_POINTER_END = "<!-- dsh-memory:end -->";
|
|
54
|
-
/** The managed pointer block text for a given notes directory (repo-relative). */
|
|
55
|
-
export declare function agentsPointerBlock(notesDir: string): string;
|
|
56
|
-
/**
|
|
57
|
-
* Ensure the AGENTS.md pointer block exists. Creates a pointer-only AGENTS.md
|
|
58
|
-
* when absent; replaces an existing managed block in place (idempotent:
|
|
59
|
-
* rewrites only when the block text actually changed); appends the block when
|
|
60
|
-
* the file exists without one. Everything outside the markers is untouched.
|
|
61
|
-
* @param agentsPath - absolute path of the repository's AGENTS.md.
|
|
62
|
-
* @param notesDir - repo-relative notes directory named in the pointer.
|
|
63
|
-
*/
|
|
64
|
-
export declare function ensureAgentsPointer(agentsPath: string, notesDir: string): Promise<void>;
|
|
65
|
-
//# sourceMappingURL=writer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtF;AAED,6FAA6F;AAC7F,qBAAa,UAAW,SAAQ,KAAK;IACnC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAE3B,YAAY,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAI/C;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,4BAA4B,CAAA;AAE3D,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB7F"}
|
package/lib/notes/writer.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Filesystem writes for project notes: atomic file replacement and the
|
|
3
|
-
* AGENTS.md pointer-block maintenance. The exporter is the single writer of
|
|
4
|
-
* the managed regions, so no locking is needed; atomic rename keeps readers
|
|
5
|
-
* (and concurrent sessions rendering the same truth) from ever seeing a torn
|
|
6
|
-
* file.
|
|
7
|
-
*
|
|
8
|
-
* Drift guard (P0-5): before overwriting a managed notes file the writer
|
|
9
|
-
* re-reads the current on-disk content and compares it to the last content
|
|
10
|
-
* this process wrote. When the file has been externally modified (hand edit,
|
|
11
|
-
* merge conflict resolution, another tool), the write is refused and the
|
|
12
|
-
* externally modified file is preserved as `<file>.bak.<ts>` so the user can
|
|
13
|
-
* reconcile manually. The marker-based AGENTS.md pointer block is exempt:
|
|
14
|
-
* it is already drift-safe (content outside the markers is never touched).
|
|
15
|
-
*
|
|
16
|
-
* @module @chenhw7/dsh-memory/notes/writer
|
|
17
|
-
*/
|
|
18
|
-
import { copyFile, mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
|
19
|
-
import path from 'node:path';
|
|
20
|
-
/**
|
|
21
|
-
* Write a file atomically: write to a sibling temp file, then rename.
|
|
22
|
-
* Parent directories are created on demand.
|
|
23
|
-
* @param filePath - the target file path.
|
|
24
|
-
* @param content - the full file content.
|
|
25
|
-
*/
|
|
26
|
-
export async function writeFileAtomic(filePath, content) {
|
|
27
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
28
|
-
const tmp = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
29
|
-
try {
|
|
30
|
-
await writeFile(tmp, content, 'utf8');
|
|
31
|
-
await rename(tmp, filePath);
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
await unlink(tmp).catch(() => { });
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
/** Thrown by {@link writeNotesFile} when the target file has drifted from the last write. */
|
|
39
|
-
export class DriftError extends Error {
|
|
40
|
-
/** Absolute path of the backup copy holding the externally modified content. */
|
|
41
|
-
backupPath;
|
|
42
|
-
constructor(filePath, backupPath) {
|
|
43
|
-
super(`notes file drifted: external modification detected at ${filePath}; backup saved to ${backupPath}`);
|
|
44
|
-
this.name = 'DriftError';
|
|
45
|
-
this.backupPath = backupPath;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Write a managed notes file atomically with drift guard. Re-reads the
|
|
50
|
-
* current on-disk content before writing; when the file differs from both
|
|
51
|
-
* the previous content this process wrote (`previousContent`) AND the new
|
|
52
|
-
* content (i.e. someone/something else modified the file), the write is
|
|
53
|
-
* refused: the drifted file is copied to `<filePath>.bak.<ts>` and a
|
|
54
|
-
* {@link DriftError} is thrown so the caller can decide what to do.
|
|
55
|
-
*
|
|
56
|
-
* The first write (file absent) is always allowed. A write that is a no-op
|
|
57
|
-
* (new content equals what's on disk) is skipped silently.
|
|
58
|
-
*
|
|
59
|
-
* @param filePath - absolute path of the target file.
|
|
60
|
-
* @param content - the full file content to write.
|
|
61
|
-
* @param previousContent - the content this process last wrote to the file,
|
|
62
|
-
* or `undefined` when this is the first write in this process lifetime.
|
|
63
|
-
* @throws {DriftError} when the on-disk content matches neither
|
|
64
|
-
* `previousContent` nor `content`.
|
|
65
|
-
*/
|
|
66
|
-
export async function writeNotesFile(filePath, content, previousContent) {
|
|
67
|
-
let onDisk;
|
|
68
|
-
try {
|
|
69
|
-
onDisk = await readFile(filePath, 'utf8');
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
if (error.code !== 'ENOENT')
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
if (onDisk !== undefined) {
|
|
76
|
-
// No-op: content already on disk matches what we want to write.
|
|
77
|
-
if (onDisk === content)
|
|
78
|
-
return;
|
|
79
|
-
// Drift: the on-disk content does not match our last write — someone
|
|
80
|
-
// else (hand edit, merge tool, another process) modified the file.
|
|
81
|
-
const drifted = previousContent === undefined || onDisk !== previousContent;
|
|
82
|
-
if (drifted) {
|
|
83
|
-
const backupPath = `${filePath}.bak.${Date.now()}`;
|
|
84
|
-
await copyFile(filePath, backupPath);
|
|
85
|
-
throw new DriftError(filePath, backupPath);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
await writeFileAtomic(filePath, content);
|
|
89
|
-
}
|
|
90
|
-
/** Marker opening the managed pointer block in AGENTS.md. */
|
|
91
|
-
export const AGENTS_POINTER_BEGIN = '<!-- dsh-memory:begin -->';
|
|
92
|
-
/** Marker closing the managed pointer block in AGENTS.md. */
|
|
93
|
-
export const AGENTS_POINTER_END = '<!-- dsh-memory:end -->';
|
|
94
|
-
/** The managed pointer block text for a given notes directory (repo-relative). */
|
|
95
|
-
export function agentsPointerBlock(notesDir) {
|
|
96
|
-
return `${AGENTS_POINTER_BEGIN}\n> Agent-maintained project notes live in \`${notesDir}/\` (auto-generated by dsh-memory — do not edit those files by hand).\n${AGENTS_POINTER_END}`;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Ensure the AGENTS.md pointer block exists. Creates a pointer-only AGENTS.md
|
|
100
|
-
* when absent; replaces an existing managed block in place (idempotent:
|
|
101
|
-
* rewrites only when the block text actually changed); appends the block when
|
|
102
|
-
* the file exists without one. Everything outside the markers is untouched.
|
|
103
|
-
* @param agentsPath - absolute path of the repository's AGENTS.md.
|
|
104
|
-
* @param notesDir - repo-relative notes directory named in the pointer.
|
|
105
|
-
*/
|
|
106
|
-
export async function ensureAgentsPointer(agentsPath, notesDir) {
|
|
107
|
-
const block = agentsPointerBlock(notesDir);
|
|
108
|
-
let existing;
|
|
109
|
-
try {
|
|
110
|
-
existing = await readFile(agentsPath, 'utf8');
|
|
111
|
-
}
|
|
112
|
-
catch (error) {
|
|
113
|
-
if (error.code !== 'ENOENT')
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
if (existing === undefined) {
|
|
117
|
-
await writeFileAtomic(agentsPath, `${block}\n`);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const beginIdx = existing.indexOf(AGENTS_POINTER_BEGIN);
|
|
121
|
-
const endIdx = existing.indexOf(AGENTS_POINTER_END);
|
|
122
|
-
if (beginIdx >= 0 && endIdx > beginIdx) {
|
|
123
|
-
const next = existing.slice(0, beginIdx) + block + existing.slice(endIdx + AGENTS_POINTER_END.length);
|
|
124
|
-
if (next !== existing)
|
|
125
|
-
await writeFileAtomic(agentsPath, next);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
const separator = existing.endsWith('\n') ? '\n' : '\n\n';
|
|
129
|
-
await writeFileAtomic(agentsPath, existing + separator + block + '\n');
|
|
130
|
-
}
|
|
131
|
-
//# sourceMappingURL=writer.js.map
|
package/lib/notes/writer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACvF,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,OAAe;IACrE,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAA;IAC1D,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACjC,MAAM,KAAK,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