@fabersep/memory 0.3.0 → 0.5.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/CHANGELOG.md +18 -0
- package/README.md +67 -89
- package/dist/src/cli.js +106 -3
- 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 +2 -0
- package/dist/src/index.js +2 -0
- package/dist/src/init.d.ts +1 -1
- package/dist/src/init.js +1 -1
- package/dist/src/mcp.d.ts +45 -2
- package/dist/src/mcp.js +281 -142
- 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.d.ts +4 -0
- package/dist/src/web-assets.js +1390 -0
- package/dist/src/web.d.ts +41 -0
- package/dist/src/web.js +997 -0
- package/package.json +1 -1
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { getHomeDir, getStateDir } from './config.js';
|
|
4
|
+
import { compileGlobalL0 } from './compiler.js';
|
|
5
|
+
import { ensureGitIdentity, gitCommitFiles, gitSync, readHeadFile } from './git.js';
|
|
6
|
+
import { appendMetric } from './metrics.js';
|
|
7
|
+
import { isReadOnlyRoot, READ_ONLY_MESSAGE } from './personal-remote.js';
|
|
8
|
+
import { applyProposalFilesToDir } from './proposals.js';
|
|
9
|
+
// Feature 06: user-dictated memory saved directly to the personal root.
|
|
10
|
+
/** 06 FR-06: direct saves allowed per MCP server process; later ones are staged. */
|
|
11
|
+
export const DIRECT_SAVE_SESSION_CAP = 5;
|
|
12
|
+
/** 06 FR-01: longest accepted `user_quote`. */
|
|
13
|
+
export const MAX_USER_QUOTE_CHARS = 1000;
|
|
14
|
+
export const DIRECT_SAVE_RECENT_DAYS = 7;
|
|
15
|
+
export function getDirectSaveLogPath(homeDir = getHomeDir()) {
|
|
16
|
+
return path.join(getStateDir(homeDir), 'direct-saves.jsonl');
|
|
17
|
+
}
|
|
18
|
+
export function isDirectUserSaveOn(config) {
|
|
19
|
+
return config.directUserSave !== false;
|
|
20
|
+
}
|
|
21
|
+
function appendRecord(record, homeDir) {
|
|
22
|
+
fs.mkdirSync(getStateDir(homeDir), { recursive: true });
|
|
23
|
+
fs.appendFileSync(getDirectSaveLogPath(homeDir), `${JSON.stringify(record)}\n`, 'utf8');
|
|
24
|
+
}
|
|
25
|
+
export function readDirectSaveRecords(homeDir = getHomeDir()) {
|
|
26
|
+
let raw = '';
|
|
27
|
+
try {
|
|
28
|
+
raw = fs.readFileSync(getDirectSaveLogPath(homeDir), 'utf8');
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
const out = [];
|
|
34
|
+
for (const line of raw.split('\n')) {
|
|
35
|
+
if (!line.trim())
|
|
36
|
+
continue;
|
|
37
|
+
try {
|
|
38
|
+
const rec = JSON.parse(line);
|
|
39
|
+
if ((rec.type === 'save' || rec.type === 'undo') && rec.entryId && rec.commit)
|
|
40
|
+
out.push(rec);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Skip a malformed line.
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
48
|
+
/** Latest direct save per entry id that has not been undone. */
|
|
49
|
+
export function getActiveDirectSaves(homeDir = getHomeDir()) {
|
|
50
|
+
const active = new Map();
|
|
51
|
+
for (const rec of readDirectSaveRecords(homeDir)) {
|
|
52
|
+
if (rec.type === 'save')
|
|
53
|
+
active.set(rec.entryId, rec);
|
|
54
|
+
else if (active.get(rec.entryId)?.commit === rec.commit)
|
|
55
|
+
active.delete(rec.entryId);
|
|
56
|
+
}
|
|
57
|
+
return active;
|
|
58
|
+
}
|
|
59
|
+
export function countRecentDirectSaves(homeDir = getHomeDir(), days = DIRECT_SAVE_RECENT_DAYS, now = Date.now()) {
|
|
60
|
+
const since = now - days * 24 * 60 * 60 * 1000;
|
|
61
|
+
return readDirectSaveRecords(homeDir).filter((r) => r.type === 'save' && Date.parse(r.ts) >= since).length;
|
|
62
|
+
}
|
|
63
|
+
function headSha(repoDir) {
|
|
64
|
+
return gitSync(['-C', repoDir, 'rev-parse', 'HEAD']).stdout.trim();
|
|
65
|
+
}
|
|
66
|
+
/** Undo the last commit and restore the touched files, leaving other working-tree edits alone. */
|
|
67
|
+
function rollbackLastCommit(repoDir, touched, priorHead) {
|
|
68
|
+
if (priorHead) {
|
|
69
|
+
gitSync(['-C', repoDir, 'reset', '--mixed', '--quiet', priorHead]);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
gitSync(['-C', repoDir, 'update-ref', '-d', 'HEAD']);
|
|
73
|
+
gitSync(['-C', repoDir, 'rm', '-r', '--cached', '--quiet', '--', ...touched]);
|
|
74
|
+
}
|
|
75
|
+
for (const rel of touched) {
|
|
76
|
+
if (priorHead && readHeadFile(repoDir, rel) !== null) {
|
|
77
|
+
gitSync(['-C', repoDir, 'checkout', 'HEAD', '--', rel]);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
fs.rmSync(path.join(repoDir, rel), { force: true });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 06 FR-02: write the entry, make one commit, recompile L0 once. On a failed recompile the
|
|
86
|
+
* commit is undone and the caller stages the proposal instead. Pull and push are the caller's.
|
|
87
|
+
*/
|
|
88
|
+
export function directSavePersonal(config, proposal, homeDir = getHomeDir()) {
|
|
89
|
+
const root = config.roots.personal;
|
|
90
|
+
if (!root)
|
|
91
|
+
return { ok: false, stagedReason: 'compile_error', errors: ['Personal memory root is not configured.'] };
|
|
92
|
+
const priorHead = headSha(root.path);
|
|
93
|
+
const touched = applyProposalFilesToDir(root.path, '', proposal);
|
|
94
|
+
const subject = `memory(${proposal.action}): ${proposal.entryId} [user]`;
|
|
95
|
+
const quote = (proposal.userQuote || '').replace(/\s+/g, ' ').trim();
|
|
96
|
+
try {
|
|
97
|
+
gitCommitFiles(root.path, touched, `${subject}\n\nUser asked: "${quote}"`);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
// Nothing was committed: put the touched files back as they were.
|
|
101
|
+
if (headSha(root.path) === priorHead) {
|
|
102
|
+
for (const rel of touched) {
|
|
103
|
+
gitSync(['-C', root.path, 'reset', '--quiet', '--', rel]);
|
|
104
|
+
if (priorHead && readHeadFile(root.path, rel) !== null) {
|
|
105
|
+
gitSync(['-C', root.path, 'checkout', 'HEAD', '--', rel]);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
fs.rmSync(path.join(root.path, rel), { force: true });
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
throw err;
|
|
113
|
+
}
|
|
114
|
+
const commit = headSha(root.path);
|
|
115
|
+
const comp = compileGlobalL0(config, { homeDir, trigger: 'approve' });
|
|
116
|
+
if (!comp.ok) {
|
|
117
|
+
rollbackLastCommit(root.path, touched, priorHead);
|
|
118
|
+
const budget = comp.errors.some((e) => e.includes('exceeds token budget'));
|
|
119
|
+
return { ok: false, stagedReason: budget ? 'l0_budget' : 'compile_error', errors: comp.errors };
|
|
120
|
+
}
|
|
121
|
+
appendRecord({
|
|
122
|
+
type: 'save',
|
|
123
|
+
ts: new Date().toISOString(),
|
|
124
|
+
entryId: proposal.entryId,
|
|
125
|
+
commit,
|
|
126
|
+
action: proposal.action,
|
|
127
|
+
summary: proposal.summary,
|
|
128
|
+
quote,
|
|
129
|
+
}, homeDir);
|
|
130
|
+
return { ok: true, commit, estimatedTokens: comp.estimatedTokens, budget: comp.budget };
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* After a push that rebased the direct-save commit onto origin (03 FR-04), point the log at
|
|
134
|
+
* the rebased commit and recompile L0 (remote entries may have come in underneath).
|
|
135
|
+
* Returns the new full SHA, or null when the commit did not move.
|
|
136
|
+
*/
|
|
137
|
+
export function followRebasedDirectSave(config, commit, homeDir = getHomeDir()) {
|
|
138
|
+
const root = config.roots.personal;
|
|
139
|
+
if (!root)
|
|
140
|
+
return null;
|
|
141
|
+
const head = headSha(root.path);
|
|
142
|
+
if (!head || head === commit)
|
|
143
|
+
return null;
|
|
144
|
+
const message = gitSync(['-C', root.path, 'log', '-1', '--format=%B', commit]);
|
|
145
|
+
if (!message.ok)
|
|
146
|
+
return null;
|
|
147
|
+
const candidates = gitSync(['-C', root.path, 'log', '-n', '50', '--format=%H', 'HEAD']);
|
|
148
|
+
if (!candidates.ok)
|
|
149
|
+
return null;
|
|
150
|
+
let moved = null;
|
|
151
|
+
for (const sha of candidates.stdout.split('\n').map((l) => l.trim()).filter(Boolean)) {
|
|
152
|
+
if (sha === commit)
|
|
153
|
+
return null; // still in history: it was not rewritten
|
|
154
|
+
const body = gitSync(['-C', root.path, 'log', '-1', '--format=%B', sha]);
|
|
155
|
+
if (body.ok && body.stdout === message.stdout) {
|
|
156
|
+
moved = sha;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
if (!moved)
|
|
161
|
+
return null;
|
|
162
|
+
const logPath = getDirectSaveLogPath(homeDir);
|
|
163
|
+
try {
|
|
164
|
+
const raw = fs.readFileSync(logPath, 'utf8');
|
|
165
|
+
fs.writeFileSync(logPath, raw.split(`"commit":"${commit}"`).join(`"commit":"${moved}"`), 'utf8');
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
// The log is advisory; undo then explains that it cannot find the commit.
|
|
169
|
+
}
|
|
170
|
+
compileGlobalL0(config, { homeDir, trigger: 'approve' });
|
|
171
|
+
return moved;
|
|
172
|
+
}
|
|
173
|
+
/** 06 FR-06: revert the latest direct-save commit of an entry in one commit and recompile L0. */
|
|
174
|
+
export function undoDirectSave(config, entryId, homeDir = getHomeDir()) {
|
|
175
|
+
const root = config.roots.personal;
|
|
176
|
+
if (!root)
|
|
177
|
+
return { ok: false, messages: [], errors: ['Personal memory root is not configured.'] };
|
|
178
|
+
if (isReadOnlyRoot(root))
|
|
179
|
+
return { ok: false, messages: [], errors: [READ_ONLY_MESSAGE] };
|
|
180
|
+
const rec = getActiveDirectSaves(homeDir).get(entryId);
|
|
181
|
+
if (!rec) {
|
|
182
|
+
return {
|
|
183
|
+
ok: false,
|
|
184
|
+
messages: [],
|
|
185
|
+
errors: [`No direct save of "${entryId}" to undo. To remove another entry, use the web UI (faber-memory web).`],
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
const files = gitSync(['-C', root.path, 'show', '--name-only', '--format=', rec.commit]);
|
|
189
|
+
if (!files.ok) {
|
|
190
|
+
return { ok: false, messages: [], errors: [`Commit ${rec.commit.slice(0, 7)} is not in the personal root.`] };
|
|
191
|
+
}
|
|
192
|
+
for (const rel of files.stdout.split('\n').map((s) => s.trim()).filter(Boolean)) {
|
|
193
|
+
const last = gitSync(['-C', root.path, 'log', '-1', '--format=%H', '--', rel]).stdout.trim();
|
|
194
|
+
if (last && last !== rec.commit) {
|
|
195
|
+
return {
|
|
196
|
+
ok: false,
|
|
197
|
+
messages: [],
|
|
198
|
+
errors: [`${rel} changed in a later commit (${last.slice(0, 7)}); undo it by hand or edit the entry instead.`],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
ensureGitIdentity(root.path);
|
|
203
|
+
const priorHead = headSha(root.path);
|
|
204
|
+
const revert = gitSync(['-C', root.path, 'revert', '--no-edit', rec.commit]);
|
|
205
|
+
if (!revert.ok) {
|
|
206
|
+
gitSync(['-C', root.path, 'revert', '--abort']);
|
|
207
|
+
return { ok: false, messages: [], errors: [`git revert failed: ${revert.stderr.trim()}`] };
|
|
208
|
+
}
|
|
209
|
+
const revertCommit = headSha(root.path);
|
|
210
|
+
const comp = compileGlobalL0(config, { homeDir, trigger: 'approve' });
|
|
211
|
+
if (!comp.ok) {
|
|
212
|
+
// Keep HEAD and the compiled L0 in step: drop the revert commit again.
|
|
213
|
+
const reverted = gitSync(['-C', root.path, 'show', '--name-only', '--format=', revertCommit]);
|
|
214
|
+
rollbackLastCommit(root.path, reverted.stdout.split('\n').map((l) => l.trim()).filter(Boolean), priorHead);
|
|
215
|
+
return {
|
|
216
|
+
ok: false,
|
|
217
|
+
messages: [],
|
|
218
|
+
errors: [`Undo stopped: the startup index would not compile without this save. Nothing was changed.`, ...comp.errors],
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
appendRecord({ type: 'undo', ts: new Date().toISOString(), entryId, commit: rec.commit, revertCommit }, homeDir);
|
|
222
|
+
appendMetric({ type: 'review_outcome', ts: new Date().toISOString(), scope: 'personal', outcome: 'undone' }, homeDir);
|
|
223
|
+
const messages = [`Undid the direct save of ${entryId} (revert commit ${revertCommit.slice(0, 7)}).`];
|
|
224
|
+
messages.push(`Recompiled L0 (${comp.estimatedTokens}/${comp.budget} tokens); it applies to new sessions.`);
|
|
225
|
+
return { ok: true, messages, errors: [], revertCommit };
|
|
226
|
+
}
|
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: {
|
|
@@ -90,6 +97,15 @@ export declare const MCP_TOOLS: readonly [{
|
|
|
90
97
|
readonly reason: {
|
|
91
98
|
readonly type: "string";
|
|
92
99
|
};
|
|
100
|
+
readonly source: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
readonly enum: readonly ["agent", "user"];
|
|
103
|
+
readonly default: "agent";
|
|
104
|
+
};
|
|
105
|
+
readonly user_quote: {
|
|
106
|
+
readonly type: "string";
|
|
107
|
+
readonly description: "The user's exact words asking for this memory (required when source is \"user\").";
|
|
108
|
+
};
|
|
93
109
|
};
|
|
94
110
|
readonly required: readonly ["action", "scope", "summary", "type", "body"];
|
|
95
111
|
};
|
|
@@ -105,6 +121,9 @@ export declare class FaberMemoryMcpServer {
|
|
|
105
121
|
private startupWarnings;
|
|
106
122
|
private unpushedReminderShown;
|
|
107
123
|
private startupPullPromise;
|
|
124
|
+
private directSaveCount;
|
|
125
|
+
/** Keeps stdio responses in request order while a direct save awaits pull/push. */
|
|
126
|
+
private queue;
|
|
108
127
|
constructor(options?: {
|
|
109
128
|
homeDir?: string;
|
|
110
129
|
cwd?: string;
|
|
@@ -158,7 +177,7 @@ export declare class FaberMemoryMcpServer {
|
|
|
158
177
|
};
|
|
159
178
|
}, {
|
|
160
179
|
readonly name: "memory_propose";
|
|
161
|
-
readonly description:
|
|
180
|
+
readonly description: string;
|
|
162
181
|
readonly inputSchema: {
|
|
163
182
|
readonly type: "object";
|
|
164
183
|
readonly properties: {
|
|
@@ -202,6 +221,15 @@ export declare class FaberMemoryMcpServer {
|
|
|
202
221
|
readonly reason: {
|
|
203
222
|
readonly type: "string";
|
|
204
223
|
};
|
|
224
|
+
readonly source: {
|
|
225
|
+
readonly type: "string";
|
|
226
|
+
readonly enum: readonly ["agent", "user"];
|
|
227
|
+
readonly default: "agent";
|
|
228
|
+
};
|
|
229
|
+
readonly user_quote: {
|
|
230
|
+
readonly type: "string";
|
|
231
|
+
readonly description: "The user's exact words asking for this memory (required when source is \"user\").";
|
|
232
|
+
};
|
|
205
233
|
};
|
|
206
234
|
readonly required: readonly ["action", "scope", "summary", "type", "body"];
|
|
207
235
|
};
|
|
@@ -213,6 +241,21 @@ export declare class FaberMemoryMcpServer {
|
|
|
213
241
|
}[];
|
|
214
242
|
isError?: boolean;
|
|
215
243
|
};
|
|
244
|
+
/**
|
|
245
|
+
* 06 FR-01..FR-08 (and 01 FR-05): validate, then stage in pre-memory, or, for a
|
|
246
|
+
* user-dictated personal memory, save it directly. Pull and push are done by
|
|
247
|
+
* `handleToolCallAsync`; this synchronous path keeps a direct save local.
|
|
248
|
+
*/
|
|
249
|
+
private handlePropose;
|
|
250
|
+
/** 06 FR-02/FR-05/FR-06: why a user-dictated call must be staged, or undefined when it can be saved directly. */
|
|
251
|
+
private directSaveBlocker;
|
|
252
|
+
/**
|
|
253
|
+
* Like `handleToolCall`, but a user-dictated personal save pulls before it commits
|
|
254
|
+
* (03 FR-04) and pushes per `pushMode` after (03 FR-02, 06 FR-02).
|
|
255
|
+
*/
|
|
256
|
+
handleToolCallAsync(name: string, args?: Record<string, unknown>): Promise<ToolResponse>;
|
|
257
|
+
/** JSON-RPC entry for stdio: like `handleJsonRpc`, with `tools/call` via `handleToolCallAsync`. */
|
|
258
|
+
handleJsonRpcAsync(req: JsonRpcRequest): Promise<Record<string, unknown> | null>;
|
|
216
259
|
handleJsonRpc(req: JsonRpcRequest): Record<string, unknown> | null;
|
|
217
260
|
serveStdio(): void;
|
|
218
261
|
}
|