@fabersep/memory 0.4.0 → 0.5.1
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/CHANGELOG.md +14 -0
- package/README.md +62 -110
- package/dist/src/cli.js +41 -1
- package/dist/src/config.js +1 -0
- package/dist/src/direct-save.d.ts +53 -0
- package/dist/src/direct-save.js +226 -0
- package/dist/src/doctor.js +4 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/init.d.ts +1 -1
- package/dist/src/init.js +1 -1
- package/dist/src/mcp.d.ts +47 -2
- package/dist/src/mcp.js +294 -143
- package/dist/src/metrics.d.ts +4 -2
- package/dist/src/proposals.d.ts +10 -3
- package/dist/src/proposals.js +14 -2
- package/dist/src/stats.d.ts +8 -0
- package/dist/src/stats.js +16 -2
- package/dist/src/types.d.ts +12 -0
- package/dist/src/web-assets.js +33 -0
- package/dist/src/web.js +39 -1
- package/package.json +1 -1
package/dist/src/doctor.js
CHANGED
|
@@ -8,6 +8,7 @@ import { BLOCK_END, BLOCK_START, getEngineSpecs, getUserHome } from './init.js';
|
|
|
8
8
|
import { readMetrics } from './metrics.js';
|
|
9
9
|
import { getAheadInfo, getUnpushedReminder, readPersonalRemoteState } from './personal-remote.js';
|
|
10
10
|
import { listAllProposals } from './proposals.js';
|
|
11
|
+
import { countRecentDirectSaves, DIRECT_SAVE_RECENT_DAYS, isDirectUserSaveOn } from './direct-save.js';
|
|
11
12
|
import { L0_CHURN_WARN_THRESHOLD } from './stats.js';
|
|
12
13
|
import { loadScopeFromHead, PROJECT_MEMORY_REL_DIR, resolveProjectRoot } from './store.js';
|
|
13
14
|
import { c, hr } from './ui.js';
|
|
@@ -412,6 +413,9 @@ export function runDoctor(options = {}) {
|
|
|
412
413
|
queueStatus = 'WARN';
|
|
413
414
|
queueDetails.push(`${awaitingCommitCount} project proposal(s) awaiting git commit.`);
|
|
414
415
|
}
|
|
416
|
+
// 06 FR-06: direct saves are information, never a failure.
|
|
417
|
+
const recentDirect = countRecentDirectSaves(homeDir);
|
|
418
|
+
queueDetails.push(`Direct save is ${config && !isDirectUserSaveOn(config) ? 'off' : 'on'}; ${recentDirect} memor${recentDirect === 1 ? 'y' : 'ies'} added directly on the user's word in the last ${DIRECT_SAVE_RECENT_DAYS} days.`);
|
|
415
419
|
if (queueStatus === 'WARN') {
|
|
416
420
|
queueHint = 'Run "faber-memory status" and "faber-memory review" to resolve queued proposals.';
|
|
417
421
|
}
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
package/dist/src/init.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UserConfig } from './types.js';
|
|
2
2
|
export declare const BLOCK_START = "<!-- faber-memory:start -->";
|
|
3
3
|
export declare const BLOCK_END = "<!-- faber-memory:end -->";
|
|
4
|
-
export declare const TOOL_GUIDANCE_LINE = "Use the faber-memory MCP tools: memory_search and memory_get for the details behind these lines; when you learn a durable rule, decision, lesson or preference, call memory_propose (the user approves it later; never edit memory files directly).";
|
|
4
|
+
export declare const TOOL_GUIDANCE_LINE = "Use the faber-memory MCP tools: memory_search and memory_get for the details behind these lines; when you learn a durable rule, decision, lesson or preference, call memory_propose (the user approves it later; never edit memory files directly). When the user explicitly asks you to remember something, call memory_propose with source \"user\" and their exact words in user_quote; it is saved at once.";
|
|
5
5
|
export declare const PROJECT_HINT_LINE = "Project memory: run npx @fabersep/memory init";
|
|
6
6
|
export type EngineName = 'claude-code' | 'claude-desktop' | 'antigravity' | 'cursor' | 'codex';
|
|
7
7
|
export interface EngineSpec {
|
package/dist/src/init.js
CHANGED
|
@@ -6,7 +6,7 @@ import { compileGlobalL0 } from './compiler.js';
|
|
|
6
6
|
import { c, hr, shouldUseColor } from './ui.js';
|
|
7
7
|
export const BLOCK_START = '<!-- faber-memory:start -->';
|
|
8
8
|
export const BLOCK_END = '<!-- faber-memory:end -->';
|
|
9
|
-
export const TOOL_GUIDANCE_LINE = 'Use the faber-memory MCP tools: memory_search and memory_get for the details behind these lines; when you learn a durable rule, decision, lesson or preference, call memory_propose (the user approves it later; never edit memory files directly).';
|
|
9
|
+
export const TOOL_GUIDANCE_LINE = 'Use the faber-memory MCP tools: memory_search and memory_get for the details behind these lines; when you learn a durable rule, decision, lesson or preference, call memory_propose (the user approves it later; never edit memory files directly). When the user explicitly asks you to remember something, call memory_propose with source "user" and their exact words in user_quote; it is saved at once.';
|
|
10
10
|
export const PROJECT_HINT_LINE = 'Project memory: run npx @fabersep/memory init';
|
|
11
11
|
export function getEngineSpecs() {
|
|
12
12
|
return {
|
package/dist/src/mcp.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
type ToolResponse = {
|
|
2
|
+
content: {
|
|
3
|
+
type: 'text';
|
|
4
|
+
text: string;
|
|
5
|
+
}[];
|
|
6
|
+
isError?: boolean;
|
|
7
|
+
};
|
|
1
8
|
interface JsonRpcRequest {
|
|
2
9
|
jsonrpc: '2.0';
|
|
3
10
|
id?: string | number | null;
|
|
@@ -46,7 +53,7 @@ export declare const MCP_TOOLS: readonly [{
|
|
|
46
53
|
};
|
|
47
54
|
}, {
|
|
48
55
|
readonly name: "memory_propose";
|
|
49
|
-
readonly description:
|
|
56
|
+
readonly description: string;
|
|
50
57
|
readonly inputSchema: {
|
|
51
58
|
readonly type: "object";
|
|
52
59
|
readonly properties: {
|
|
@@ -83,6 +90,7 @@ export declare const MCP_TOOLS: readonly [{
|
|
|
83
90
|
readonly l0: {
|
|
84
91
|
readonly type: "string";
|
|
85
92
|
readonly enum: readonly ["none", "line", "body"];
|
|
93
|
+
readonly description: "\"line\": listed in the startup index every session (rules and preferences that must always hold). \"none\": found only by search (details looked up when needed).";
|
|
86
94
|
};
|
|
87
95
|
readonly force_new: {
|
|
88
96
|
readonly type: "boolean";
|
|
@@ -90,6 +98,15 @@ export declare const MCP_TOOLS: readonly [{
|
|
|
90
98
|
readonly reason: {
|
|
91
99
|
readonly type: "string";
|
|
92
100
|
};
|
|
101
|
+
readonly source: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly enum: readonly ["agent", "user"];
|
|
104
|
+
readonly default: "agent";
|
|
105
|
+
};
|
|
106
|
+
readonly user_quote: {
|
|
107
|
+
readonly type: "string";
|
|
108
|
+
readonly description: "The user's exact words asking for this memory (required when source is \"user\").";
|
|
109
|
+
};
|
|
93
110
|
};
|
|
94
111
|
readonly required: readonly ["action", "scope", "summary", "type", "body"];
|
|
95
112
|
};
|
|
@@ -105,6 +122,9 @@ export declare class FaberMemoryMcpServer {
|
|
|
105
122
|
private startupWarnings;
|
|
106
123
|
private unpushedReminderShown;
|
|
107
124
|
private startupPullPromise;
|
|
125
|
+
private directSaveCount;
|
|
126
|
+
/** Keeps stdio responses in request order while a direct save awaits pull/push. */
|
|
127
|
+
private queue;
|
|
108
128
|
constructor(options?: {
|
|
109
129
|
homeDir?: string;
|
|
110
130
|
cwd?: string;
|
|
@@ -158,7 +178,7 @@ export declare class FaberMemoryMcpServer {
|
|
|
158
178
|
};
|
|
159
179
|
}, {
|
|
160
180
|
readonly name: "memory_propose";
|
|
161
|
-
readonly description:
|
|
181
|
+
readonly description: string;
|
|
162
182
|
readonly inputSchema: {
|
|
163
183
|
readonly type: "object";
|
|
164
184
|
readonly properties: {
|
|
@@ -195,6 +215,7 @@ export declare class FaberMemoryMcpServer {
|
|
|
195
215
|
readonly l0: {
|
|
196
216
|
readonly type: "string";
|
|
197
217
|
readonly enum: readonly ["none", "line", "body"];
|
|
218
|
+
readonly description: "\"line\": listed in the startup index every session (rules and preferences that must always hold). \"none\": found only by search (details looked up when needed).";
|
|
198
219
|
};
|
|
199
220
|
readonly force_new: {
|
|
200
221
|
readonly type: "boolean";
|
|
@@ -202,6 +223,15 @@ export declare class FaberMemoryMcpServer {
|
|
|
202
223
|
readonly reason: {
|
|
203
224
|
readonly type: "string";
|
|
204
225
|
};
|
|
226
|
+
readonly source: {
|
|
227
|
+
readonly type: "string";
|
|
228
|
+
readonly enum: readonly ["agent", "user"];
|
|
229
|
+
readonly default: "agent";
|
|
230
|
+
};
|
|
231
|
+
readonly user_quote: {
|
|
232
|
+
readonly type: "string";
|
|
233
|
+
readonly description: "The user's exact words asking for this memory (required when source is \"user\").";
|
|
234
|
+
};
|
|
205
235
|
};
|
|
206
236
|
readonly required: readonly ["action", "scope", "summary", "type", "body"];
|
|
207
237
|
};
|
|
@@ -213,6 +243,21 @@ export declare class FaberMemoryMcpServer {
|
|
|
213
243
|
}[];
|
|
214
244
|
isError?: boolean;
|
|
215
245
|
};
|
|
246
|
+
/**
|
|
247
|
+
* 06 FR-01..FR-08 (and 01 FR-05): validate, then stage in pre-memory, or, for a
|
|
248
|
+
* user-dictated personal memory, save it directly. Pull and push are done by
|
|
249
|
+
* `handleToolCallAsync`; this synchronous path keeps a direct save local.
|
|
250
|
+
*/
|
|
251
|
+
private handlePropose;
|
|
252
|
+
/** 06 FR-02/FR-05/FR-06: why a user-dictated call must be staged, or undefined when it can be saved directly. */
|
|
253
|
+
private directSaveBlocker;
|
|
254
|
+
/**
|
|
255
|
+
* Like `handleToolCall`, but a user-dictated personal save pulls before it commits
|
|
256
|
+
* (03 FR-04) and pushes per `pushMode` after (03 FR-02, 06 FR-02).
|
|
257
|
+
*/
|
|
258
|
+
handleToolCallAsync(name: string, args?: Record<string, unknown>): Promise<ToolResponse>;
|
|
259
|
+
/** JSON-RPC entry for stdio: like `handleJsonRpc`, with `tools/call` via `handleToolCallAsync`. */
|
|
260
|
+
handleJsonRpcAsync(req: JsonRpcRequest): Promise<Record<string, unknown> | null>;
|
|
216
261
|
handleJsonRpc(req: JsonRpcRequest): Record<string, unknown> | null;
|
|
217
262
|
serveStdio(): void;
|
|
218
263
|
}
|