@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
package/dist/src/stats.js
CHANGED
|
@@ -97,6 +97,7 @@ export function computeStats(options = {}) {
|
|
|
97
97
|
awaitingCommit: 0,
|
|
98
98
|
rejected: 0,
|
|
99
99
|
},
|
|
100
|
+
userDictated: { directSaved: 0, staged: 0, undone: 0 },
|
|
100
101
|
},
|
|
101
102
|
};
|
|
102
103
|
}
|
|
@@ -224,12 +225,17 @@ export function computeStats(options = {}) {
|
|
|
224
225
|
awaitingCommit: 0,
|
|
225
226
|
rejected: 0,
|
|
226
227
|
},
|
|
228
|
+
userDictated: { directSaved: 0, staged: 0, undone: 0 },
|
|
227
229
|
};
|
|
228
230
|
for (const ev of windowEvents) {
|
|
229
231
|
if (ev.type === 'propose') {
|
|
230
232
|
const p = ev;
|
|
231
233
|
const bucket = p.source === 'import' ? funnel.bySource.import : funnel.bySource.mcp;
|
|
232
|
-
if (p.outcome === 'staged')
|
|
234
|
+
if (p.origin === 'user' && p.outcome === 'staged')
|
|
235
|
+
funnel.userDictated.staged++;
|
|
236
|
+
if (p.outcome === 'direct_saved')
|
|
237
|
+
funnel.userDictated.directSaved++;
|
|
238
|
+
else if (p.outcome === 'staged')
|
|
233
239
|
bucket.staged++;
|
|
234
240
|
else if (p.outcome === 'duplicate_blocked')
|
|
235
241
|
bucket.duplicateBlocked++;
|
|
@@ -256,6 +262,8 @@ export function computeStats(options = {}) {
|
|
|
256
262
|
funnel.reviewOutcomes.awaitingCommit++;
|
|
257
263
|
else if (r.outcome === 'rejected')
|
|
258
264
|
funnel.reviewOutcomes.rejected++;
|
|
265
|
+
else if (r.outcome === 'undone')
|
|
266
|
+
funnel.userDictated.undone++;
|
|
259
267
|
}
|
|
260
268
|
}
|
|
261
269
|
let cache;
|
|
@@ -330,7 +338,8 @@ export function computeStats(options = {}) {
|
|
|
330
338
|
export function buildShareableBenchmark(report) {
|
|
331
339
|
const mcpSrc = report.funnel.bySource.mcp;
|
|
332
340
|
const impSrc = report.funnel.bySource.import;
|
|
333
|
-
const proposedMcp =
|
|
341
|
+
const proposedMcp = report.funnel.userDictated.directSaved +
|
|
342
|
+
mcpSrc.staged +
|
|
334
343
|
mcpSrc.duplicateBlocked +
|
|
335
344
|
mcpSrc.hygieneBlockedSecret +
|
|
336
345
|
mcpSrc.hygieneBlockedMachinePath +
|
|
@@ -380,6 +389,8 @@ export function buildShareableBenchmark(report) {
|
|
|
380
389
|
pushFailed: report.funnel.reviewOutcomes.pushFailed,
|
|
381
390
|
awaitingCommit: report.funnel.reviewOutcomes.awaitingCommit,
|
|
382
391
|
rejected: report.funnel.reviewOutcomes.rejected,
|
|
392
|
+
directSaved: report.funnel.userDictated.directSaved,
|
|
393
|
+
userDictatedStaged: report.funnel.userDictated.staged,
|
|
383
394
|
},
|
|
384
395
|
};
|
|
385
396
|
if (report.cache && report.cache.engines.length > 0) {
|
|
@@ -421,6 +432,7 @@ export function formatShareableMarkdown(card) {
|
|
|
421
432
|
lines.push(`| Retrieval (searches / get-per-search / zero-result) | ${card.retrieval.nonEmptySearches} / ${card.retrieval.getCallsPerSearch} / ${card.retrieval.zeroResultPct}% |`);
|
|
422
433
|
lines.push(`| Median BM25 search latency | ${card.retrieval.medianBm25LatencyMs !== null ? `${card.retrieval.medianBm25LatencyMs} ms` : 'n/a'} |`);
|
|
423
434
|
lines.push(`| Pre-memory funnel (staged / dupes / hygiene) | ${card.funnel.staged} / ${card.funnel.duplicateBlocked} / ${card.funnel.hygieneBlockedSecret + card.funnel.hygieneBlockedMachinePath} |`);
|
|
435
|
+
lines.push(`| Direct saves (user asked) | ${card.funnel.directSaved} |`);
|
|
424
436
|
if (card.cache) {
|
|
425
437
|
for (const engineKey of ['claude-code', 'antigravity']) {
|
|
426
438
|
const eng = card.cache[engineKey];
|
|
@@ -516,6 +528,8 @@ export function formatStatsReport(report) {
|
|
|
516
528
|
lines.push(` Import proposals: staged=${imp.staged}, duplicate_blocked=${imp.duplicateBlocked}, hygiene_blocked(secret=${imp.hygieneBlockedSecret}, machine-path=${imp.hygieneBlockedMachinePath}), validation_error=${imp.validationError}`);
|
|
517
529
|
const ro = report.funnel.reviewOutcomes;
|
|
518
530
|
lines.push(` Review outcomes: approved_committed=${ro.approvedCommitted}, approved_pushed=${ro.approvedPushed}, approved_pr=${ro.approvedPr}, push_failed=${ro.pushFailed}, awaiting_commit=${ro.awaitingCommit}, rejected=${ro.rejected}`);
|
|
531
|
+
const ud = report.funnel.userDictated;
|
|
532
|
+
lines.push(` User asked: direct_saved=${ud.directSaved}, staged=${ud.staged} (counted in MCP staged above), undone=${ud.undone}`);
|
|
519
533
|
// Cache report
|
|
520
534
|
if (report.cache) {
|
|
521
535
|
lines.push('');
|
package/dist/src/types.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ export type TeamSubmitMode = 'auto' | 'pr';
|
|
|
6
6
|
export type PushMode = 'ask' | 'auto' | 'never';
|
|
7
7
|
export type ProposalAction = 'create' | 'update' | 'supersede';
|
|
8
8
|
export type ProposalStatus = 'pending' | 'awaiting_commit' | 'push_failed';
|
|
9
|
+
/** 06 FR-01: who asked for a memory. */
|
|
10
|
+
export type ProposalSource = 'agent' | 'user';
|
|
11
|
+
/** 06 FR-04: why a user-dictated proposal was staged instead of saved directly. */
|
|
12
|
+
export type StagedReason = 'scope' | 'disabled' | 'session_cap' | 'l0_budget' | 'compile_error';
|
|
9
13
|
export type ProjectRootSource = 'mcp-roots' | 'cwd' | 'none';
|
|
10
14
|
export declare const COMPILER_VERSION: string;
|
|
11
15
|
export declare const DEFAULT_TOKEN_BUDGET = 1500;
|
|
@@ -33,6 +37,8 @@ export interface UserConfig {
|
|
|
33
37
|
tokenBudget: number;
|
|
34
38
|
staleDays: number;
|
|
35
39
|
similarityThreshold: number;
|
|
40
|
+
/** 06 FR-05: save user-dictated personal memories directly (default true). */
|
|
41
|
+
directUserSave?: boolean;
|
|
36
42
|
/** Lower bound for the related-entry notice on a staged create (01 FR-04 amendment). */
|
|
37
43
|
similarityHintFloor?: number;
|
|
38
44
|
roots: {
|
|
@@ -89,6 +95,12 @@ export interface Proposal {
|
|
|
89
95
|
error?: string;
|
|
90
96
|
projectRootPath?: string;
|
|
91
97
|
targetFilePath?: string;
|
|
98
|
+
/** 06 FR-04: set to "user" when the user dictated this memory. */
|
|
99
|
+
source?: ProposalSource;
|
|
100
|
+
/** 06 FR-04: the user's verbatim words. */
|
|
101
|
+
userQuote?: string;
|
|
102
|
+
/** 06 FR-04: why it was staged instead of saved directly. */
|
|
103
|
+
stagedReason?: StagedReason;
|
|
92
104
|
}
|
|
93
105
|
export interface ProjectRootResolution {
|
|
94
106
|
source: ProjectRootSource;
|