@seanhogg/builderforce-memory 2026.10.46 → 2026.10.48
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 +21 -0
- package/dist/knowledge/extractFile.d.ts.map +1 -1
- package/dist/knowledge/extractFile.js +3 -0
- package/dist/knowledge/extractFile.js.map +1 -1
- package/dist/knowledge/pack/crc32.d.ts +6 -2
- package/dist/knowledge/pack/crc32.d.ts.map +1 -1
- package/dist/knowledge/pack/crc32.js +7 -3
- package/dist/knowledge/pack/crc32.js.map +1 -1
- package/dist/knowledge/pack/decode.d.ts +7 -3
- package/dist/knowledge/pack/decode.d.ts.map +1 -1
- package/dist/knowledge/pack/decode.js +21 -13
- package/dist/knowledge/pack/decode.js.map +1 -1
- package/dist/knowledge/pack/deflate.d.ts +1 -0
- package/dist/knowledge/pack/deflate.d.ts.map +1 -1
- package/dist/knowledge/pack/deflate.js +17 -0
- package/dist/knowledge/pack/deflate.js.map +1 -1
- package/dist/knowledge/pack/encode.d.ts +9 -0
- package/dist/knowledge/pack/encode.d.ts.map +1 -1
- package/dist/knowledge/pack/encode.js +7 -0
- package/dist/knowledge/pack/encode.js.map +1 -1
- package/dist/knowledge/pack/extrDiff.d.ts +4 -1
- package/dist/knowledge/pack/extrDiff.d.ts.map +1 -1
- package/dist/knowledge/pack/extrDiff.js +0 -0
- package/dist/knowledge/pack/extrDiff.js.map +1 -1
- package/dist/knowledge/pack/frame.d.ts +20 -1
- package/dist/knowledge/pack/frame.d.ts.map +1 -1
- package/dist/knowledge/pack/frame.js +50 -16
- package/dist/knowledge/pack/frame.js.map +1 -1
- package/dist/knowledge/pack/hex.d.ts +7 -0
- package/dist/knowledge/pack/hex.d.ts.map +1 -0
- package/dist/knowledge/pack/hex.js +17 -0
- package/dist/knowledge/pack/hex.js.map +1 -0
- package/dist/knowledge/pack/index.d.ts +1 -1
- package/dist/knowledge/pack/index.d.ts.map +1 -1
- package/dist/knowledge/pack/index.js +1 -1
- package/dist/knowledge/pack/index.js.map +1 -1
- package/dist/knowledge/pack/manifest.d.ts +17 -0
- package/dist/knowledge/pack/manifest.d.ts.map +1 -1
- package/dist/knowledge/pack/manifest.js +37 -8
- package/dist/knowledge/pack/manifest.js.map +1 -1
- package/dist/knowledge/pack/sections/columns.d.ts +2 -2
- package/dist/knowledge/pack/sections/extr.js +8 -8
- package/dist/knowledge/pack/sections/extr.js.map +1 -1
- package/dist/knowledge/pack/sections/extrLists.d.ts +4 -4
- package/dist/knowledge/pack/sections/extrLists.d.ts.map +1 -1
- package/dist/knowledge/pack/sections/extrLists.js +14 -8
- package/dist/knowledge/pack/sections/extrLists.js.map +1 -1
- package/dist/knowledge/pack/sections/facts.d.ts.map +1 -1
- package/dist/knowledge/pack/sections/facts.js +11 -6
- package/dist/knowledge/pack/sections/facts.js.map +1 -1
- package/dist/knowledge/pack/sections/rows.d.ts.map +1 -1
- package/dist/knowledge/pack/sections/rows.js +20 -19
- package/dist/knowledge/pack/sections/rows.js.map +1 -1
- package/dist/knowledge/pack/strings.d.ts +5 -1
- package/dist/knowledge/pack/strings.d.ts.map +1 -1
- package/dist/knowledge/pack/strings.js +16 -14
- package/dist/knowledge/pack/strings.js.map +1 -1
- package/dist/knowledge/pack/types.d.ts +13 -3
- package/dist/knowledge/pack/types.d.ts.map +1 -1
- package/dist/knowledge/pack/types.js +2 -1
- package/dist/knowledge/pack/types.js.map +1 -1
- package/dist/knowledge/pack/varint.d.ts +9 -2
- package/dist/knowledge/pack/varint.d.ts.map +1 -1
- package/dist/knowledge/pack/varint.js +8 -4
- package/dist/knowledge/pack/varint.js.map +1 -1
- package/dist/knowledge/reviewModel.d.ts +6 -0
- package/dist/knowledge/reviewModel.d.ts.map +1 -1
- package/dist/knowledge/reviewPrefetch.d.ts +2 -0
- package/dist/knowledge/reviewPrefetch.d.ts.map +1 -1
- package/dist/knowledge/reviewPrefetch.js +11 -1
- package/dist/knowledge/reviewPrefetch.js.map +1 -1
- package/package.json +4 -3
- package/src/contract/dist.contract.test.ts +44 -0
- package/src/contract/exports.contract.test.ts +90 -0
- package/src/contract/exports.snapshot.json +608 -0
- package/src/contract/pack.contract.test.ts +31 -0
- package/src/contract/regression.pack.test.ts +94 -0
- package/src/contract/regression.review.test.ts +236 -0
- package/src/contract/regression.store.test.ts +84 -0
- package/src/contract/types.contract.test.ts +183 -0
- package/src/knowledge/extractFile.ts +2 -0
- package/src/knowledge/pack/crc32.ts +7 -3
- package/src/knowledge/pack/decode.ts +22 -14
- package/src/knowledge/pack/deflate.ts +19 -1
- package/src/knowledge/pack/encode.ts +8 -0
- package/src/knowledge/pack/extrDiff.ts +0 -0
- package/src/knowledge/pack/frame.ts +52 -14
- package/src/knowledge/pack/hex.ts +17 -0
- package/src/knowledge/pack/index.ts +1 -1
- package/src/knowledge/pack/manifest.ts +35 -5
- package/src/knowledge/pack/pack.guards.test.ts +35 -3
- package/src/knowledge/pack/pack.roundtrip.test.ts +1 -1
- package/src/knowledge/pack/sections/columns.ts +2 -2
- package/src/knowledge/pack/sections/extr.ts +9 -9
- package/src/knowledge/pack/sections/extrLists.ts +13 -9
- package/src/knowledge/pack/sections/facts.ts +8 -5
- package/src/knowledge/pack/sections/rows.ts +17 -17
- package/src/knowledge/pack/strings.ts +15 -12
- package/src/knowledge/pack/types.ts +13 -4
- package/src/knowledge/pack/varint.ts +10 -3
- package/src/knowledge/reviewModel.ts +6 -0
- package/src/knowledge/reviewPrefetch.ts +10 -1
- package/src/knowledge/testkit.test-util.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seanhogg/builderforce-memory",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.48",
|
|
4
4
|
"description": "BuilderForce Agent Memory — runtime layer. SSM execution, Transformer orchestration, online distillation, enterprise RAG (ingestion pipelines, vector-store adapters, tenant/ACL-scoped hybrid retrieval), multi-agent graph orchestration, LLM telemetry and cost accounting, persistent agent memory, and token-saving agent-run memory (code maps, a prompt-cache-safe working memory, chunked transcript windowing) for BuilderForce.ai agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
},
|
|
118
118
|
"homepage": "https://github.com/SeanHogg/builderforce-memory/tree/main/packages/memory#readme",
|
|
119
119
|
"peerDependencies": {
|
|
120
|
-
"@seanhogg/builderforce-memory-engine": "^2026.10.
|
|
120
|
+
"@seanhogg/builderforce-memory-engine": "^2026.10.48"
|
|
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
123
|
"@jest/globals": "^29.7.0",
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
"ts-jest": "^29.2.0",
|
|
132
132
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
133
133
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
134
|
-
"@seanhogg/builderforce-memory-engine": "2026.10.
|
|
134
|
+
"@seanhogg/builderforce-memory-engine": "2026.10.48"
|
|
135
135
|
},
|
|
136
136
|
"jest": {
|
|
137
137
|
"preset": "ts-jest/presets/default-esm",
|
|
@@ -190,6 +190,7 @@
|
|
|
190
190
|
"build": "tsc",
|
|
191
191
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
192
192
|
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
|
|
193
|
+
"check:contract-types": "tsc -p tsconfig.contract.json",
|
|
193
194
|
"lint": "eslint src/ tests/"
|
|
194
195
|
}
|
|
195
196
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/contract/dist.contract.test.ts — every `exports` entry of package.json points at files the build produced.
|
|
3
|
+
*
|
|
4
|
+
* The `./knowledge/pack` export once shipped pointing at nothing until a consumer ran. CI builds before it
|
|
5
|
+
* runs the tests, so `dist/` exists there. Locally, without a build, the test says so and does nothing —
|
|
6
|
+
* unless `CI` is set, where a missing `dist/` is a failure (the build step did not run).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
10
|
+
import { join } from 'node:path';
|
|
11
|
+
|
|
12
|
+
const PACKAGE_DIR = process.cwd();
|
|
13
|
+
const pkg = JSON.parse(readFileSync(join(PACKAGE_DIR, 'package.json'), 'utf8')) as {
|
|
14
|
+
main?: string; module?: string; types?: string; exports: Record<string, { types?: string; import?: string }>;
|
|
15
|
+
};
|
|
16
|
+
const distBuilt = existsSync(join(PACKAGE_DIR, 'dist'));
|
|
17
|
+
const exists = (rel: string | undefined) => !!rel && existsSync(join(PACKAGE_DIR, rel));
|
|
18
|
+
|
|
19
|
+
describe('dist contract: package.json exports resolve in dist/', () => {
|
|
20
|
+
if (!distBuilt && !process.env.CI) {
|
|
21
|
+
it('is skipped: dist/ is not built (run `npm run build` first)', () => {
|
|
22
|
+
console.warn('dist.contract: dist/ is missing, so export paths were not checked.');
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
it('dist/ exists', () => {
|
|
28
|
+
expect(distBuilt).toBe(true);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('main, module and types resolve', () => {
|
|
32
|
+
const missing = [pkg.main, pkg.module, pkg.types].filter((p) => p && !exists(p));
|
|
33
|
+
expect(missing).toEqual([]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('every exports entry has its `import` and `types` file', () => {
|
|
37
|
+
const missing: string[] = [];
|
|
38
|
+
for (const [subpath, entry] of Object.entries(pkg.exports)) {
|
|
39
|
+
if (!exists(entry.import)) missing.push(`${subpath}: import ${entry.import} is not in dist/`);
|
|
40
|
+
if (!exists(entry.types)) missing.push(`${subpath}: types ${entry.types} is not in dist/`);
|
|
41
|
+
}
|
|
42
|
+
expect(missing).toEqual([]);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/contract/exports.contract.test.ts — the PUBLIC SURFACE contract.
|
|
3
|
+
*
|
|
4
|
+
* For every subpath of package.json `exports`, the exact sorted list of runtime names the entry exports is
|
|
5
|
+
* checked in beside this file (`exports.snapshot.json`). Consumers (agent-tools, the VS Code host, the API)
|
|
6
|
+
* import these names, so:
|
|
7
|
+
*
|
|
8
|
+
* - a REMOVED or RENAMED name is a breaking change: this test fails and says so. It needs a CHANGELOG
|
|
9
|
+
* "Breaking" note and the consumers bumped in the same release.
|
|
10
|
+
* - an ADDED name fails too, until the snapshot is updated deliberately (so no export slips out unnoticed).
|
|
11
|
+
* - a subpath added to / dropped from `exports` fails the same way.
|
|
12
|
+
*
|
|
13
|
+
* Update the snapshot on purpose with `UPDATE_EXPORTS_SNAPSHOT=1 npm test -- src/contract/exports`. A missing
|
|
14
|
+
* snapshot is written on the first LOCAL run (commit it); under CI (`CI` set) a missing snapshot is a failure.
|
|
15
|
+
* Types are not runtime names: their contract is `types.contract.test.ts`.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
|
|
21
|
+
interface ExportEntry { types?: string; import?: string }
|
|
22
|
+
|
|
23
|
+
const PACKAGE_DIR = process.cwd();
|
|
24
|
+
const SNAPSHOT_PATH = join(PACKAGE_DIR, 'src', 'contract', 'exports.snapshot.json');
|
|
25
|
+
|
|
26
|
+
const pkg = JSON.parse(readFileSync(join(PACKAGE_DIR, 'package.json'), 'utf8')) as { exports: Record<string, ExportEntry> };
|
|
27
|
+
|
|
28
|
+
/** `./dist/knowledge/pack/index.js` → `../knowledge/pack/index` (this file lives in src/contract). */
|
|
29
|
+
const sourceEntryOf = (entry: ExportEntry): string => `../${entry.import!.replace(/^\.\/dist\//, '').replace(/\.js$/, '')}`;
|
|
30
|
+
|
|
31
|
+
async function currentSurface(): Promise<Record<string, string[]>> {
|
|
32
|
+
const out: Record<string, string[]> = {};
|
|
33
|
+
for (const subpath of Object.keys(pkg.exports).sort()) {
|
|
34
|
+
const ns = await import(sourceEntryOf(pkg.exports[subpath]!)) as Record<string, unknown>;
|
|
35
|
+
out[subpath] = Object.keys(ns).sort();
|
|
36
|
+
}
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const diff = (before: readonly string[], after: readonly string[]) => ({
|
|
41
|
+
removed: before.filter((n) => !after.includes(n)),
|
|
42
|
+
added: after.filter((n) => !before.includes(n)),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('public surface contract: package.json exports', () => {
|
|
46
|
+
it('every export has an import and a types path', () => {
|
|
47
|
+
for (const [subpath, entry] of Object.entries(pkg.exports)) {
|
|
48
|
+
expect({ subpath, import: typeof entry.import }).toEqual({ subpath, import: 'string' });
|
|
49
|
+
expect({ subpath, types: typeof entry.types }).toEqual({ subpath, types: 'string' });
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('exports exactly the runtime names of the checked-in snapshot', async () => {
|
|
54
|
+
const current = await currentSurface();
|
|
55
|
+
const update = !!process.env.UPDATE_EXPORTS_SNAPSHOT;
|
|
56
|
+
if (update || (!existsSync(SNAPSHOT_PATH) && !process.env.CI)) {
|
|
57
|
+
writeFileSync(SNAPSHOT_PATH, `${JSON.stringify(current, null, 2)}\n`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (!existsSync(SNAPSHOT_PATH)) {
|
|
61
|
+
throw new Error('src/contract/exports.snapshot.json is missing: run the contract tests locally once and commit the file it writes.');
|
|
62
|
+
}
|
|
63
|
+
const snapshot = JSON.parse(readFileSync(SNAPSHOT_PATH, 'utf8')) as Record<string, string[]>;
|
|
64
|
+
|
|
65
|
+
const breaking: string[] = [];
|
|
66
|
+
const changed: string[] = [];
|
|
67
|
+
for (const subpath of Object.keys(snapshot)) {
|
|
68
|
+
if (!(subpath in current)) { breaking.push(`${subpath}: the whole subpath was removed from package.json exports`); continue; }
|
|
69
|
+
const { removed, added } = diff(snapshot[subpath]!, current[subpath]!);
|
|
70
|
+
if (removed.length) breaking.push(`${subpath}: removed or renamed ${removed.join(', ')}`);
|
|
71
|
+
if (added.length) changed.push(`${subpath}: added ${added.join(', ')}`);
|
|
72
|
+
}
|
|
73
|
+
for (const subpath of Object.keys(current)) if (!(subpath in snapshot)) changed.push(`${subpath}: new subpath`);
|
|
74
|
+
|
|
75
|
+
if (breaking.length) {
|
|
76
|
+
throw new Error(
|
|
77
|
+
`BREAKING CHANGE to the public surface — consumers import these names.\n ${breaking.join('\n ')}\n`
|
|
78
|
+
+ 'This needs a CHANGELOG "Breaking" note and the consumers updated in the same release. If it is intended, '
|
|
79
|
+
+ 'update the snapshot with UPDATE_EXPORTS_SNAPSHOT=1.',
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
if (changed.length) {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`The public surface grew:\n ${changed.join('\n ')}\n`
|
|
85
|
+
+ 'If that is intended, update src/contract/exports.snapshot.json with UPDATE_EXPORTS_SNAPSHOT=1 and note it in the CHANGELOG.',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
expect(current).toEqual(snapshot);
|
|
89
|
+
});
|
|
90
|
+
});
|