@gamaze/hicortex 0.27.4 → 0.28.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/assets/dashboard.html +361 -100
- package/dist/backfill-privacy.d.ts +68 -45
- package/dist/backfill-privacy.js +236 -145
- package/dist/calibration.d.ts +67 -68
- package/dist/calibration.js +75 -78
- package/dist/capture-health.d.ts +2 -2
- package/dist/capture-health.js +2 -2
- package/dist/classification.d.ts +141 -12
- package/dist/classification.js +214 -27
- package/dist/classify-domains.d.ts +1 -1
- package/dist/classify-domains.js +2 -2
- package/dist/cli-args.d.ts +5 -3
- package/dist/cli-args.js +7 -3
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +64 -16
- package/dist/cluster.d.ts +12 -9
- package/dist/cluster.js +9 -6
- package/dist/consolidate.d.ts +93 -43
- package/dist/consolidate.js +255 -119
- package/dist/dashboard.d.ts +48 -5
- package/dist/dashboard.js +55 -3
- package/dist/db.js +27 -6
- package/dist/dedup.d.ts +2 -3
- package/dist/dedup.js +2 -3
- package/dist/distill-queue.d.ts +36 -4
- package/dist/distill-queue.js +80 -18
- package/dist/distiller.d.ts +1 -1
- package/dist/distiller.js +13 -12
- package/dist/domain-classify.d.ts +8 -9
- package/dist/domain-classify.js +6 -7
- package/dist/graph.d.ts +15 -5
- package/dist/graph.js +46 -13
- package/dist/hermes-transcript-reader.d.ts +1 -1
- package/dist/hermes-transcript-reader.js +1 -1
- package/dist/init.d.ts +2 -2
- package/dist/init.js +3 -3
- package/dist/llm.d.ts +1 -1
- package/dist/llm.js +5 -5
- package/dist/mcp-server.js +323 -59
- package/dist/memory-instructions.d.ts +2 -2
- package/dist/memory-instructions.js +2 -2
- package/dist/nightly.d.ts +1 -1
- package/dist/nightly.js +64 -5
- package/dist/nofit.d.ts +2 -2
- package/dist/nofit.js +2 -2
- package/dist/observed-agents.d.ts +54 -0
- package/dist/observed-agents.js +78 -0
- package/dist/project-canonicalize.d.ts +6 -5
- package/dist/project-canonicalize.js +6 -5
- package/dist/prompts.d.ts +29 -8
- package/dist/prompts.js +39 -16
- package/dist/quality-scoreboard.d.ts +1 -1
- package/dist/recall-hook-cli.d.ts +1 -1
- package/dist/recall-hook-cli.js +2 -2
- package/dist/recall-index.d.ts +28 -14
- package/dist/recall-index.js +22 -10
- package/dist/recall-precision.d.ts +3 -3
- package/dist/recall-precision.js +5 -4
- package/dist/reconcile-projects.d.ts +2 -2
- package/dist/reconcile-projects.js +2 -2
- package/dist/reconsolidation.d.ts +9 -2
- package/dist/reconsolidation.js +48 -31
- package/dist/relink.d.ts +2 -2
- package/dist/relink.js +4 -4
- package/dist/rescore-importance.d.ts +2 -2
- package/dist/rescore-importance.js +22 -3
- package/dist/retrieval.d.ts +14 -0
- package/dist/retrieval.js +11 -11
- package/dist/schema-prototypes.d.ts +1 -1
- package/dist/schema-prototypes.js +1 -1
- package/dist/seed-lesson.js +4 -2
- package/dist/spaces-api.d.ts +104 -0
- package/dist/spaces-api.js +193 -0
- package/dist/spaces-cli.d.ts +90 -0
- package/dist/spaces-cli.js +245 -0
- package/dist/spaces.d.ts +187 -0
- package/dist/spaces.js +360 -0
- package/dist/storage.d.ts +47 -10
- package/dist/storage.js +74 -17
- package/dist/sweep-volatile.d.ts +2 -2
- package/dist/sweep-volatile.js +2 -2
- package/dist/telemetry-cli.d.ts +1 -1
- package/dist/telemetry-cli.js +1 -1
- package/dist/type-classify.d.ts +1 -1
- package/dist/type-classify.js +1 -1
- package/dist/type-labels.d.ts +1 -1
- package/dist/type-labels.js +1 -1
- package/dist/types.d.ts +43 -20
- package/dist/wrapper-prompt.d.ts +2 -2
- package/dist/wrapper-prompt.js +2 -2
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/spaces.js
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spaces (#642) — the confidential circle (#332) generalized to N private
|
|
4
|
+
* pools, on the groups model (owner ruling 2026-11-22): a workspace (agent)
|
|
5
|
+
* joins zero or more spaces; a memory ROW belongs to exactly ONE space,
|
|
6
|
+
* carried by the widened `memories.privacy` vocabulary
|
|
7
|
+
* ('standard' | <configured space id> — see MemoryPrivacy in types.ts; no
|
|
8
|
+
* migration, values are data).
|
|
9
|
+
*
|
|
10
|
+
* The model in one paragraph: an operator configures a `spaces` map (space id
|
|
11
|
+
* → { members, paths, optional per-space llm, optional privacyLine }). Space
|
|
12
|
+
* ids run through the SAME allowlist as agent ids (isValidAgentId — one
|
|
13
|
+
* namespace, the identityAgents precedent). The legacy confidential keys
|
|
14
|
+
* (`confidentialAgents` + `confidentialPaths`) MATERIALIZE a pre-configured
|
|
15
|
+
* space named `confidential` when no explicit `spaces.confidential` entry
|
|
16
|
+
* exists — an existing confidential-only install is the N=1 case of the same
|
|
17
|
+
* machinery, byte-for-byte. 'standard' (and NULL) is the FIXED shared pool —
|
|
18
|
+
* never a space id, never configurable. The marker key (#614) stays
|
|
19
|
+
* confidential-only (owner ruling: no keys in the MVP; the reserved
|
|
20
|
+
* 'confidential' id is always known so the marker arm can stamp it even on
|
|
21
|
+
* installs where no confidential space materialized). Assignment = a name in
|
|
22
|
+
* a list; the shared bearer token is the trust boundary (self-asserted names
|
|
23
|
+
* accepted for MVP, #631 accepted risk; keys are v2).
|
|
24
|
+
*
|
|
25
|
+
* This module is the pure resolution core (no HTTP, no fs — the
|
|
26
|
+
* identity-store.ts / marker-key-api.ts layout; the ONE db-taking function
|
|
27
|
+
* is unknownStoredSpaceIds, the AC-7 boot-report helper, which takes a handle
|
|
28
|
+
* like the storage fns): resolveSpaces parses config ONCE at the boot seam in
|
|
29
|
+
* mcp-server.ts (restart to apply, like the confidential roster), and the
|
|
30
|
+
* small predicates below are the shared vocabulary every later stage (read
|
|
31
|
+
* gates, consolidation, dashboard, CLI) consumes. Intake precedence lives in
|
|
32
|
+
* classification.ts deriveIntakeSpace (#642 AC-4: per-space paths first,
|
|
33
|
+
* then member lists, then the confidential marker arm — the more specific
|
|
34
|
+
* birthplace wins).
|
|
35
|
+
*
|
|
36
|
+
* Zero-change default (AC-1): an install that configures nothing resolves to
|
|
37
|
+
* an empty result with NO warnings — stamps, gates, prompts, and boot output
|
|
38
|
+
* are byte-identical to the #332 release.
|
|
39
|
+
*/
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.resolveSpaces = resolveSpaces;
|
|
42
|
+
exports.knownSpaceIds = knownSpaceIds;
|
|
43
|
+
exports.spaceOf = spaceOf;
|
|
44
|
+
exports.spacesForMember = spacesForMember;
|
|
45
|
+
exports.resolveVisibleSet = resolveVisibleSet;
|
|
46
|
+
exports.isVisiblePrivacy = isVisiblePrivacy;
|
|
47
|
+
exports.unknownStoredSpaceIds = unknownStoredSpaceIds;
|
|
48
|
+
const identity_store_js_1 = require("./identity-store.js");
|
|
49
|
+
const classification_js_1 = require("./classification.js");
|
|
50
|
+
const prompts_js_1 = require("./prompts.js");
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Boot resolution
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
/**
|
|
55
|
+
* Resolve the `spaces` config map (plus the legacy confidential
|
|
56
|
+
* materialization, AC-2) into the ordered SpaceDef list. Pure — parse once at
|
|
57
|
+
* boot (mcp-server.ts, the confidential seam); restart to apply.
|
|
58
|
+
*
|
|
59
|
+
* Entry fields (all optional): `members?: string[]` (sanitized like ?agent=,
|
|
60
|
+
* invalid entries dropped and named, deduped), `paths?: string[]` (compiled
|
|
61
|
+
* with compilePathPattern, dropped entries named, deduped on raw),
|
|
62
|
+
* `llmBaseUrl`/`llmApiKey`/`llmModel`/`llmProvider?: string` (baseUrl+apiKey
|
|
63
|
+
* required as a PAIR — a half-pair drops the llm field with a warning while
|
|
64
|
+
* the space survives), `privacyLine?: string` (trimmed non-empty, else the
|
|
65
|
+
* field drops with a warning and the pool default applies).
|
|
66
|
+
*
|
|
67
|
+
* Drop/warning discipline (the resolveIdentityAgents pattern): an invalid id
|
|
68
|
+
* key or a non-object entry drops the WHOLE space, named in `dropped`; a
|
|
69
|
+
* wrong-typed or half-configured FIELD drops just the field, named in
|
|
70
|
+
* `warnings` — a typo must surface at boot, never silently match nothing.
|
|
71
|
+
* `dropped` also carries invalid member entries and non-compiling path
|
|
72
|
+
* patterns by raw value. The legacy resolvers' own dropped arrays are NOT
|
|
73
|
+
* re-reported here — mcp-server.ts already prints them at its confidential
|
|
74
|
+
* seam (one boot warning per problem, never two).
|
|
75
|
+
*
|
|
76
|
+
* `spaces` preserves CONFIG KEY ORDER — deriveIntakeSpace's
|
|
77
|
+
* first-matching-space precedence depends on it. The legacy-materialized
|
|
78
|
+
* `confidential` space appends LAST (explicit spaces outrank it in the
|
|
79
|
+
* paths/members arms; on a pure-legacy install there is nothing to outrank).
|
|
80
|
+
*
|
|
81
|
+
* 'standard' is a RESERVED non-id (the fixed shared pool): an explicit entry
|
|
82
|
+
* under it drops with the rule named. 'confidential' IS a valid space id —
|
|
83
|
+
* an explicit entry wins entirely over the legacy keys, with ONE conflict
|
|
84
|
+
* warning ("explicit wins; legacy ignored"); an explicit-but-DROPPED entry
|
|
85
|
+
* (broken shape) falls back to legacy materialization so a typo can never
|
|
86
|
+
* silently disable the circle (the drop is already named in `dropped`).
|
|
87
|
+
*
|
|
88
|
+
* Zero-config (no `spaces` key, no active legacy keys): empty everything —
|
|
89
|
+
* the AC-1 byte-identical boot.
|
|
90
|
+
*/
|
|
91
|
+
function resolveSpaces(config) {
|
|
92
|
+
const spaces = [];
|
|
93
|
+
const byId = new Map();
|
|
94
|
+
const dropped = [];
|
|
95
|
+
const warnings = [];
|
|
96
|
+
const rawMap = config?.spaces;
|
|
97
|
+
const hasMap = rawMap !== null && rawMap !== undefined && typeof rawMap === "object" && !Array.isArray(rawMap);
|
|
98
|
+
if (config?.spaces !== undefined && !hasMap) {
|
|
99
|
+
warnings.push("config `spaces` must be a map of space id → entry object — ignoring the value");
|
|
100
|
+
}
|
|
101
|
+
if (hasMap) {
|
|
102
|
+
for (const [key, entry] of Object.entries(rawMap)) {
|
|
103
|
+
// One id namespace with agent ids (isValidAgentId); 'standard' is the
|
|
104
|
+
// fixed shared pool, never a space id.
|
|
105
|
+
if (!(0, identity_store_js_1.isValidAgentId)(key)) {
|
|
106
|
+
dropped.push(key);
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (key === "standard") {
|
|
110
|
+
dropped.push(key);
|
|
111
|
+
warnings.push("'standard' is the fixed shared pool, never a space id — drop the spaces.standard entry");
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
115
|
+
dropped.push(key);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
const e = entry;
|
|
119
|
+
// members — sanitize each entry like ?agent=; invalid entries are
|
|
120
|
+
// dropped and named by raw value; duplicates collapse.
|
|
121
|
+
const members = [];
|
|
122
|
+
if (e.members !== undefined) {
|
|
123
|
+
if (Array.isArray(e.members)) {
|
|
124
|
+
for (const m of e.members) {
|
|
125
|
+
if (typeof m !== "string") {
|
|
126
|
+
dropped.push(String(m));
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
const id = (0, identity_store_js_1.sanitizeAgentId)(m);
|
|
130
|
+
if (id && !members.includes(id))
|
|
131
|
+
members.push(id);
|
|
132
|
+
else if (!id)
|
|
133
|
+
dropped.push(m);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
warnings.push(`spaces.${key}: members must be an array of agent ids — ignoring the field`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
// paths — the SAME three pattern forms as confidentialPaths
|
|
141
|
+
// (compilePathPattern), deduped on the raw entry.
|
|
142
|
+
const paths = [];
|
|
143
|
+
if (e.paths !== undefined) {
|
|
144
|
+
if (Array.isArray(e.paths)) {
|
|
145
|
+
for (const p of e.paths) {
|
|
146
|
+
if (typeof p !== "string") {
|
|
147
|
+
dropped.push(String(p));
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const compiled = (0, classification_js_1.compilePathPattern)(p);
|
|
151
|
+
if (!compiled)
|
|
152
|
+
dropped.push(p);
|
|
153
|
+
else if (!paths.some((x) => x.raw === compiled.raw))
|
|
154
|
+
paths.push(compiled);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
warnings.push(`spaces.${key}: paths must be an array of path patterns — ignoring the field`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// llm — baseUrl+apiKey required as a pair (the
|
|
162
|
+
// resolveConfidentialLlmConfig contract): only one set drops the llm
|
|
163
|
+
// FIELD with a warning; the space survives without it (it inherits the
|
|
164
|
+
// confidential endpoint at consolidation, or holds).
|
|
165
|
+
const str = (v) => typeof v === "string" && v ? v : undefined;
|
|
166
|
+
const baseUrl = str(e.llmBaseUrl);
|
|
167
|
+
const apiKey = str(e.llmApiKey);
|
|
168
|
+
let llm = null;
|
|
169
|
+
if (baseUrl && apiKey) {
|
|
170
|
+
llm = { baseUrl, apiKey, model: str(e.llmModel), provider: str(e.llmProvider) };
|
|
171
|
+
}
|
|
172
|
+
else if (baseUrl || apiKey) {
|
|
173
|
+
warnings.push(`spaces.${key}: llmBaseUrl + llmApiKey are required as a pair — the space's llm config is ignored (it inherits the llmConfidential* endpoint, or holds)`);
|
|
174
|
+
}
|
|
175
|
+
// privacyLine — explicit trimmed non-empty wins; a blank/non-string
|
|
176
|
+
// field drops with a warning and the pool default applies below.
|
|
177
|
+
let privacyLine;
|
|
178
|
+
if (e.privacyLine !== undefined) {
|
|
179
|
+
if (typeof e.privacyLine === "string" && e.privacyLine.trim()) {
|
|
180
|
+
privacyLine = e.privacyLine.trim();
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
warnings.push(`spaces.${key}: privacyLine must be a non-blank string — ignoring the field (the pool default applies)`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
const def = {
|
|
187
|
+
id: key,
|
|
188
|
+
members,
|
|
189
|
+
paths,
|
|
190
|
+
llm,
|
|
191
|
+
// The confidential seeding lives HERE in resolution — never as an
|
|
192
|
+
// `if (id === 'confidential')` in prompt-building code (#602: the
|
|
193
|
+
// confidential pool's prompt stays byte-identical).
|
|
194
|
+
privacyLine: privacyLine ??
|
|
195
|
+
(key === "confidential"
|
|
196
|
+
? prompts_js_1.REFLECTION_PRIVACY_LINE_CONFIDENTIAL
|
|
197
|
+
: prompts_js_1.REFLECTION_PRIVACY_LINE_SPACE),
|
|
198
|
+
};
|
|
199
|
+
spaces.push(def);
|
|
200
|
+
byId.set(key, def);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// LEGACY MATERIALIZATION (AC-2): no RESOLVED explicit confidential space →
|
|
204
|
+
// the legacy keys seed one when they are ACTIVE (a roster or patterns —
|
|
205
|
+
// the marker key alone does not materialize; it is a birthplace ARM, not a
|
|
206
|
+
// space definition). An explicit-but-dropped entry also lands here (a
|
|
207
|
+
// broken spaces.confidential must not silently disable the circle — the
|
|
208
|
+
// drop is already named above).
|
|
209
|
+
if (!byId.has("confidential")) {
|
|
210
|
+
const roster = (0, classification_js_1.resolveConfidentialAgents)(config).roster;
|
|
211
|
+
const patterns = (0, classification_js_1.resolveConfidentialPaths)(config).patterns;
|
|
212
|
+
if (roster.length > 0 || patterns.length > 0) {
|
|
213
|
+
const llmConfig = (0, classification_js_1.resolveConfidentialLlmConfig)(config);
|
|
214
|
+
const def = {
|
|
215
|
+
id: "confidential",
|
|
216
|
+
members: roster,
|
|
217
|
+
paths: patterns,
|
|
218
|
+
llm: llmConfig
|
|
219
|
+
? {
|
|
220
|
+
baseUrl: llmConfig.baseUrl,
|
|
221
|
+
apiKey: llmConfig.apiKey,
|
|
222
|
+
model: llmConfig.model,
|
|
223
|
+
provider: llmConfig.provider,
|
|
224
|
+
}
|
|
225
|
+
: null,
|
|
226
|
+
privacyLine: prompts_js_1.REFLECTION_PRIVACY_LINE_CONFIDENTIAL,
|
|
227
|
+
};
|
|
228
|
+
spaces.push(def);
|
|
229
|
+
byId.set("confidential", def);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
else if ((0, classification_js_1.resolveConfidentialAgents)(config).roster.length > 0 ||
|
|
233
|
+
(0, classification_js_1.resolveConfidentialPaths)(config).patterns.length > 0) {
|
|
234
|
+
// Both an explicit spaces.confidential AND active legacy keys: ONE
|
|
235
|
+
// warning, the explicit entry wins ENTIRELY (no merge — members, paths,
|
|
236
|
+
// and llm come from the entry alone).
|
|
237
|
+
warnings.push("explicit spaces.confidential wins; legacy confidentialAgents/confidentialPaths ignored for it — " +
|
|
238
|
+
"move the circle's members/paths into spaces.confidential and delete the legacy keys");
|
|
239
|
+
}
|
|
240
|
+
return { spaces, byId, dropped, warnings };
|
|
241
|
+
}
|
|
242
|
+
// ---------------------------------------------------------------------------
|
|
243
|
+
// Predicates — the shared vocabulary of the later #642 stages
|
|
244
|
+
// ---------------------------------------------------------------------------
|
|
245
|
+
/**
|
|
246
|
+
* Every id a delivery may legally stamp: the CONFIGURED ids plus the reserved
|
|
247
|
+
* 'confidential' ALWAYS — the marker arm stamps 'confidential' even on
|
|
248
|
+
* marker-key-only installs where no confidential space materialized, so the
|
|
249
|
+
* write boundary's known set must include it unconditionally. Callers:
|
|
250
|
+
* normalizeStoredPrivacy's known argument at the enqueue site (AC-7) and the
|
|
251
|
+
* read gate's visible-set resolution.
|
|
252
|
+
*/
|
|
253
|
+
function knownSpaceIds(res) {
|
|
254
|
+
const ids = new Set(res.byId.keys());
|
|
255
|
+
ids.add("confidential");
|
|
256
|
+
return ids;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* The `privacy`/`spaceOf` column normalizer every predicate will use:
|
|
260
|
+
* NULL/undefined/''/'standard' → 'standard' (the fixed shared pool — NULL-safe
|
|
261
|
+
* predicates everywhere already treat pre-v27 NULLs as shared); anything else
|
|
262
|
+
* passes through as-is (lowercase-trust: the column is server-written, and
|
|
263
|
+
* server-written space ids are validated ids by construction). This is a READ
|
|
264
|
+
* predicate, not a write gate — writes go through normalizeStoredPrivacy,
|
|
265
|
+
* which REFUSES unknown ids (#642 AC-7).
|
|
266
|
+
*/
|
|
267
|
+
function spaceOf(privacy) {
|
|
268
|
+
if (privacy === null || privacy === undefined || privacy === "" || privacy === "standard") {
|
|
269
|
+
return "standard";
|
|
270
|
+
}
|
|
271
|
+
return privacy;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* The read-side membership resolution: the ids of every space whose members
|
|
275
|
+
* list contains the sanitized `agent`. Null/blank/unknown agent → EMPTY set
|
|
276
|
+
* (fail-closed — an unknown id can never widen visibility, exactly like
|
|
277
|
+
* isCircleMember). Note the read side matches BARE ids only: sanitizeAgentId
|
|
278
|
+
* collapses separators, so a harness-qualified `hermes/nova` reads as
|
|
279
|
+
* `hermes-nova` and matches nothing (plugins send their resolved profile
|
|
280
|
+
* name, not their capture-side qualified stamp).
|
|
281
|
+
*/
|
|
282
|
+
function spacesForMember(agent, spaces) {
|
|
283
|
+
const id = agent ? (0, identity_store_js_1.sanitizeAgentId)(agent) : null;
|
|
284
|
+
if (!id)
|
|
285
|
+
return new Set();
|
|
286
|
+
const out = new Set();
|
|
287
|
+
for (const s of spaces) {
|
|
288
|
+
if (s.members.includes(id))
|
|
289
|
+
out.add(s.id);
|
|
290
|
+
}
|
|
291
|
+
return out;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Compose ONE visible-space set from the two option forms every read gate
|
|
295
|
+
* accepts (#642 AC-5): the legacy boolean (`includeConfidential` — TRUE adds
|
|
296
|
+
* the reserved 'confidential' id, the exact pre-#642 member behavior) and the
|
|
297
|
+
* generalized `visibleSpaces` (the requester's resolved membership set).
|
|
298
|
+
* Union: `(includeConfidential ? {'confidential'} : ∅) ∪ (visibleSpaces ?? ∅)`.
|
|
299
|
+
*
|
|
300
|
+
* A caller that passes NEITHER gets the EMPTY set = shared-only — the
|
|
301
|
+
* fail-closed default every un-gated surface (MCP tools, internal passes that
|
|
302
|
+
* want the whole store must say so explicitly) already had as boolean-false.
|
|
303
|
+
* Byte-identical to the old predicate on standard/confidential data for every
|
|
304
|
+
* boolean-only call: false → ∅ (confidential hidden), true → {'confidential'}
|
|
305
|
+
* (confidential visible).
|
|
306
|
+
*/
|
|
307
|
+
function resolveVisibleSet(includeConfidential, visibleSpaces) {
|
|
308
|
+
const out = new Set();
|
|
309
|
+
if (includeConfidential === true)
|
|
310
|
+
out.add("confidential");
|
|
311
|
+
if (visibleSpaces)
|
|
312
|
+
for (const id of visibleSpaces)
|
|
313
|
+
out.add(id);
|
|
314
|
+
return out;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* THE visibility predicate — one rule every read gate consults (#642 AC-5):
|
|
318
|
+
* shared rows ('standard', i.e. spaceOf of NULL/''/'standard') are visible to
|
|
319
|
+
* EVERYONE; every other row is visible iff its space id is in the viewer's
|
|
320
|
+
* set. A stored id outside {'standard'} ∪ visible is INVISIBLE to that viewer
|
|
321
|
+
* — which makes an unknown or retired space id (no configured space claims
|
|
322
|
+
* it, so no membership list can ever contain it) invisible to EVERY
|
|
323
|
+
* requester, the AC-7 fail-closed direction: unknown ids are never
|
|
324
|
+
* normalized to shared, they are dropped from view until configured or
|
|
325
|
+
* re-stamped.
|
|
326
|
+
*/
|
|
327
|
+
function isVisiblePrivacy(privacy, visible) {
|
|
328
|
+
const space = spaceOf(privacy);
|
|
329
|
+
return space === "standard" || visible.has(space);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* #642 AC-7: stored space ids NO configured space claims — the boot-warning
|
|
333
|
+
* input. Scans `memories.privacy` AND `distill_queue.privacy` (both carry
|
|
334
|
+
* stamps; a retired space can sit queued as well as stored) for DISTINCT
|
|
335
|
+
* values outside the fixed vocabulary ('standard' — NULL never reaches here —
|
|
336
|
+
* and 'confidential', which is RESERVED: always known, never unknown, even on
|
|
337
|
+
* installs where no confidential space materialized) and drops every id the
|
|
338
|
+
* `known` set (knownSpaceIds at the calling seam) contains. Sorted for a
|
|
339
|
+
* deterministic one-line-per-boot warning; empty = nothing to report.
|
|
340
|
+
*
|
|
341
|
+
* Such rows are stored-but-invisible: no members list can contain an
|
|
342
|
+
* unconfigured id, so isVisiblePrivacy excludes them for EVERY requester —
|
|
343
|
+
* the fail-closed direction (never normalized to shared). The operator
|
|
344
|
+
* resolves them by configuring the space or re-stamping (backfill).
|
|
345
|
+
*/
|
|
346
|
+
function unknownStoredSpaceIds(db, known) {
|
|
347
|
+
const ids = new Set();
|
|
348
|
+
// Literal table names (no interpolation of caller input into SQL).
|
|
349
|
+
for (const table of ["memories", "distill_queue"]) {
|
|
350
|
+
const rows = db
|
|
351
|
+
.prepare(`SELECT DISTINCT privacy FROM ${table} ` +
|
|
352
|
+
`WHERE privacy IS NOT NULL AND privacy NOT IN ('standard', 'confidential')`)
|
|
353
|
+
.all();
|
|
354
|
+
for (const r of rows) {
|
|
355
|
+
if (r.privacy !== null && !known.has(r.privacy))
|
|
356
|
+
ids.add(r.privacy);
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return [...ids].sort();
|
|
360
|
+
}
|
package/dist/storage.d.ts
CHANGED
|
@@ -9,14 +9,33 @@ import type { Memory, MemoryLink, InsertMemoryOptions, MemoryPrivacy } from "./t
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function embedToBlob(embedding: Float32Array): Buffer;
|
|
11
11
|
/**
|
|
12
|
-
* Normalize any wire/unknown privacy value into the
|
|
12
|
+
* Normalize any wire/unknown privacy value into the classification
|
|
13
13
|
* vocabulary — the insert-boundary guard that keeps legacy values ('WORK',
|
|
14
14
|
* 'PERSONAL', blank, NULL, wrong type) out of the column after migration
|
|
15
15
|
* v27 normalized history. 'confidential' passes through (it is only ever
|
|
16
|
-
* server-derived by the time it reaches storage); everything
|
|
17
|
-
* 'standard' (the fail-closed default class).
|
|
16
|
+
* server-derived by the time it reaches storage); everything legacy-shaped
|
|
17
|
+
* becomes 'standard' (the fail-closed default class).
|
|
18
|
+
*
|
|
19
|
+
* #642 AC-7 REVERSES the unknown direction: the column may now carry any
|
|
20
|
+
* CONFIGURED space id, and an unknown id must fail CLOSED — a valid-shaped
|
|
21
|
+
* space id that no configured space claims THROWS (write refused), never
|
|
22
|
+
* silently lands 'standard' (the old fail-open direction was a leak vector
|
|
23
|
+
* the moment the vocabulary opened). Semantics, in order:
|
|
24
|
+
* - 'confidential' / 'standard' → themselves (the fixed ids, always legal);
|
|
25
|
+
* - null/undefined/non-string/blank → 'standard' (the v27 contract);
|
|
26
|
+
* - a legacy-vocabulary-looking value WITHOUT space-id shape (uppercase
|
|
27
|
+
* like 'WORK'/'PERSONAL', punctuation, whitespace — shape =
|
|
28
|
+
* isValidAgentId, the one id namespace) → 'standard' (pinned by
|
|
29
|
+
* tests/privacy-migration.test.ts);
|
|
30
|
+
* - a VALID-SHAPED id in `known` → itself (the stamp survives the boundary);
|
|
31
|
+
* - a valid-shaped id NOT in `known` → THROW.
|
|
32
|
+
*
|
|
33
|
+
* `known` (optional): the boot-resolved known space ids — pass
|
|
34
|
+
* knownSpaceIds({byId}) from the calling seam. Default when omitted: no
|
|
35
|
+
* configured ids pass (only the fixed 'standard'/'confidential'), so every
|
|
36
|
+
* caller that can carry space stamps MUST thread the set explicitly.
|
|
18
37
|
*/
|
|
19
|
-
export declare function normalizeStoredPrivacy(v: unknown): MemoryPrivacy;
|
|
38
|
+
export declare function normalizeStoredPrivacy(v: unknown, known?: ReadonlySet<string>): MemoryPrivacy;
|
|
20
39
|
/**
|
|
21
40
|
* #421 machine × harness identity: optional capture-machine provenance on
|
|
22
41
|
* /ingest + /distill. A string, trimmed, capped at 128 chars; anything else
|
|
@@ -217,9 +236,9 @@ export declare const FTS_MATCH_MAX_TOKENS = 24;
|
|
|
217
236
|
* FTS5 MATCH-safety quoting (#329 item 1). The raw prompt is NOT valid FTS5
|
|
218
237
|
* query syntax: ordinary prompt punctuation (?, -, (, :, URLs, apostrophes, a
|
|
219
238
|
* leading AND/OR) crashes the FTS5 parser, and retrieval.retrieve's catch then
|
|
220
|
-
* silently drops the ENTIRE FTS candidate list — the perf sweep measured
|
|
221
|
-
* realistic prompts affected, and it is why relevance eval #3 saw
|
|
222
|
-
*
|
|
239
|
+
* silently drops the ENTIRE FTS candidate list — the perf sweep measured
|
|
240
|
+
* most realistic prompts affected, and it is why relevance eval #3 saw zero
|
|
241
|
+
* FTS rows across its candidates. Fix: tokenize on whitespace, strip embedded double
|
|
223
242
|
* quotes (a raw `"` would terminate our own quoting), and wrap each token in
|
|
224
243
|
* double quotes — a quoted token is a phrase of LITERAL strings, immune to
|
|
225
244
|
* FTS5 query syntax (`"what" "is" "the" "deployment" "status"`). Punctuation
|
|
@@ -304,12 +323,30 @@ export declare function getMemoriesSince(db: Database.Database, sinceIso: string
|
|
|
304
323
|
* reflection stamps them confidential at birth), and the SAME membership gate
|
|
305
324
|
* applies — `includeConfidential` defaults to FALSE (fail-closed: the
|
|
306
325
|
* agent-facing consumers — /learnings, the MCP lessons tools — serve standard
|
|
307
|
-
* lessons only unless the requester is a circle member).
|
|
308
|
-
*
|
|
309
|
-
*
|
|
326
|
+
* lessons only unless the requester is a circle member).
|
|
327
|
+
*
|
|
328
|
+
* #642 AC-5: `visibleSpaces` is the generalized form (the requester's resolved
|
|
329
|
+
* space set; unioned with the boolean by resolveVisibleSet). The SQL fragment
|
|
330
|
+
* admits NULL (the pre-v27 population reads standard) + 'standard' + one
|
|
331
|
+
* PARAMETERIZED arm per visible space id — never inlined. An empty visible
|
|
332
|
+
* set is the two-clause form (shared only); a stored id outside the visible
|
|
333
|
+
* set — including unknown/retired space ids (AC-7) — is hard-omitted.
|
|
334
|
+
* Byte-identical rows for the boolean-only calls on standard/confidential
|
|
335
|
+
* data (false → NULL/standard; true → NULL/standard/confidential).
|
|
336
|
+
*
|
|
337
|
+
* #642 follow-up (validator round 1): `allSpaces: true` is the EXPLICIT
|
|
338
|
+
* whole-store form for the server-internal consumers (nightly telemetry, the
|
|
339
|
+
* seed check, the recall-precision standing basis) — it skips the privacy
|
|
340
|
+
* predicate entirely, exactly as those passes did before #642. The boolean
|
|
341
|
+
* alone (`includeConfidential: true`) now means literally shared +
|
|
342
|
+
* confidential, so an internal pass that wants EVERY pool must say so with
|
|
343
|
+
* `allSpaces` — the "internal whole-store reads say so explicitly" rule. It
|
|
344
|
+
* is never a request-facing surface: no REST/MCP handler passes it.
|
|
310
345
|
*/
|
|
311
346
|
export declare function getLessons(db: Database.Database, days?: number, project?: string | null, opts?: {
|
|
312
347
|
includeConfidential?: boolean;
|
|
348
|
+
visibleSpaces?: Set<string>;
|
|
349
|
+
allSpaces?: boolean;
|
|
313
350
|
}): Memory[];
|
|
314
351
|
/**
|
|
315
352
|
* Get memories older than cutoff with zero access (prune candidates).
|
package/dist/storage.js
CHANGED
|
@@ -74,6 +74,8 @@ exports.getAllLinkCounts = getAllLinkCounts;
|
|
|
74
74
|
exports.getUnscoredMemories = getUnscoredMemories;
|
|
75
75
|
const node_crypto_1 = require("node:crypto");
|
|
76
76
|
const schema_prototypes_js_1 = require("./schema-prototypes.js");
|
|
77
|
+
const identity_store_js_1 = require("./identity-store.js");
|
|
78
|
+
const spaces_js_1 = require("./spaces.js");
|
|
77
79
|
const CALIBRATION = __importStar(require("./calibration.js"));
|
|
78
80
|
// ---------------------------------------------------------------------------
|
|
79
81
|
// Helpers
|
|
@@ -91,15 +93,46 @@ function rowToMemory(row) {
|
|
|
91
93
|
return row;
|
|
92
94
|
}
|
|
93
95
|
/**
|
|
94
|
-
* Normalize any wire/unknown privacy value into the
|
|
96
|
+
* Normalize any wire/unknown privacy value into the classification
|
|
95
97
|
* vocabulary — the insert-boundary guard that keeps legacy values ('WORK',
|
|
96
98
|
* 'PERSONAL', blank, NULL, wrong type) out of the column after migration
|
|
97
99
|
* v27 normalized history. 'confidential' passes through (it is only ever
|
|
98
|
-
* server-derived by the time it reaches storage); everything
|
|
99
|
-
* 'standard' (the fail-closed default class).
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
* server-derived by the time it reaches storage); everything legacy-shaped
|
|
101
|
+
* becomes 'standard' (the fail-closed default class).
|
|
102
|
+
*
|
|
103
|
+
* #642 AC-7 REVERSES the unknown direction: the column may now carry any
|
|
104
|
+
* CONFIGURED space id, and an unknown id must fail CLOSED — a valid-shaped
|
|
105
|
+
* space id that no configured space claims THROWS (write refused), never
|
|
106
|
+
* silently lands 'standard' (the old fail-open direction was a leak vector
|
|
107
|
+
* the moment the vocabulary opened). Semantics, in order:
|
|
108
|
+
* - 'confidential' / 'standard' → themselves (the fixed ids, always legal);
|
|
109
|
+
* - null/undefined/non-string/blank → 'standard' (the v27 contract);
|
|
110
|
+
* - a legacy-vocabulary-looking value WITHOUT space-id shape (uppercase
|
|
111
|
+
* like 'WORK'/'PERSONAL', punctuation, whitespace — shape =
|
|
112
|
+
* isValidAgentId, the one id namespace) → 'standard' (pinned by
|
|
113
|
+
* tests/privacy-migration.test.ts);
|
|
114
|
+
* - a VALID-SHAPED id in `known` → itself (the stamp survives the boundary);
|
|
115
|
+
* - a valid-shaped id NOT in `known` → THROW.
|
|
116
|
+
*
|
|
117
|
+
* `known` (optional): the boot-resolved known space ids — pass
|
|
118
|
+
* knownSpaceIds({byId}) from the calling seam. Default when omitted: no
|
|
119
|
+
* configured ids pass (only the fixed 'standard'/'confidential'), so every
|
|
120
|
+
* caller that can carry space stamps MUST thread the set explicitly.
|
|
121
|
+
*/
|
|
122
|
+
function normalizeStoredPrivacy(v, known) {
|
|
123
|
+
if (v === "confidential")
|
|
124
|
+
return "confidential";
|
|
125
|
+
if (v === "standard")
|
|
126
|
+
return "standard";
|
|
127
|
+
if (typeof v !== "string" || v.length === 0)
|
|
128
|
+
return "standard";
|
|
129
|
+
if (!(0, identity_store_js_1.isValidAgentId)(v))
|
|
130
|
+
return "standard";
|
|
131
|
+
if (known?.has(v))
|
|
132
|
+
return v;
|
|
133
|
+
throw new Error(`Refusing to store unknown space id '${v}' in the privacy column — no configured space ` +
|
|
134
|
+
`claims it (#642 AC-7: unknown ids fail closed, never silently 'standard'). Check the ` +
|
|
135
|
+
`spaces config or the stamping caller.`);
|
|
103
136
|
}
|
|
104
137
|
// ---------------------------------------------------------------------------
|
|
105
138
|
// Single memory CRUD
|
|
@@ -517,9 +550,9 @@ exports.FTS_MATCH_MAX_TOKENS = 24;
|
|
|
517
550
|
* FTS5 MATCH-safety quoting (#329 item 1). The raw prompt is NOT valid FTS5
|
|
518
551
|
* query syntax: ordinary prompt punctuation (?, -, (, :, URLs, apostrophes, a
|
|
519
552
|
* leading AND/OR) crashes the FTS5 parser, and retrieval.retrieve's catch then
|
|
520
|
-
* silently drops the ENTIRE FTS candidate list — the perf sweep measured
|
|
521
|
-
* realistic prompts affected, and it is why relevance eval #3 saw
|
|
522
|
-
*
|
|
553
|
+
* silently drops the ENTIRE FTS candidate list — the perf sweep measured
|
|
554
|
+
* most realistic prompts affected, and it is why relevance eval #3 saw zero
|
|
555
|
+
* FTS rows across its candidates. Fix: tokenize on whitespace, strip embedded double
|
|
523
556
|
* quotes (a raw `"` would terminate our own quoting), and wrap each token in
|
|
524
557
|
* double quotes — a quoted token is a phrase of LITERAL strings, immune to
|
|
525
558
|
* FTS5 query syntax (`"what" "is" "the" "deployment" "status"`). Punctuation
|
|
@@ -720,30 +753,54 @@ function getMemoriesSince(db, sinceIso) {
|
|
|
720
753
|
* reflection stamps them confidential at birth), and the SAME membership gate
|
|
721
754
|
* applies — `includeConfidential` defaults to FALSE (fail-closed: the
|
|
722
755
|
* agent-facing consumers — /learnings, the MCP lessons tools — serve standard
|
|
723
|
-
* lessons only unless the requester is a circle member).
|
|
724
|
-
*
|
|
725
|
-
*
|
|
756
|
+
* lessons only unless the requester is a circle member).
|
|
757
|
+
*
|
|
758
|
+
* #642 AC-5: `visibleSpaces` is the generalized form (the requester's resolved
|
|
759
|
+
* space set; unioned with the boolean by resolveVisibleSet). The SQL fragment
|
|
760
|
+
* admits NULL (the pre-v27 population reads standard) + 'standard' + one
|
|
761
|
+
* PARAMETERIZED arm per visible space id — never inlined. An empty visible
|
|
762
|
+
* set is the two-clause form (shared only); a stored id outside the visible
|
|
763
|
+
* set — including unknown/retired space ids (AC-7) — is hard-omitted.
|
|
764
|
+
* Byte-identical rows for the boolean-only calls on standard/confidential
|
|
765
|
+
* data (false → NULL/standard; true → NULL/standard/confidential).
|
|
766
|
+
*
|
|
767
|
+
* #642 follow-up (validator round 1): `allSpaces: true` is the EXPLICIT
|
|
768
|
+
* whole-store form for the server-internal consumers (nightly telemetry, the
|
|
769
|
+
* seed check, the recall-precision standing basis) — it skips the privacy
|
|
770
|
+
* predicate entirely, exactly as those passes did before #642. The boolean
|
|
771
|
+
* alone (`includeConfidential: true`) now means literally shared +
|
|
772
|
+
* confidential, so an internal pass that wants EVERY pool must say so with
|
|
773
|
+
* `allSpaces` — the "internal whole-store reads say so explicitly" rule. It
|
|
774
|
+
* is never a request-facing surface: no REST/MCP handler passes it.
|
|
726
775
|
*/
|
|
727
776
|
function getLessons(db, days = 7, project, opts) {
|
|
728
777
|
const cutoff = new Date(Date.now() - days * 24 * 60 * 60 * 1000).toISOString();
|
|
729
778
|
// The hard-omit predicate — NULL-safe by construction (NULL privacy, the
|
|
730
|
-
// pre-v27 population, reads standard).
|
|
731
|
-
|
|
779
|
+
// pre-v27 population, reads standard). Every visible space id adds one `?`
|
|
780
|
+
// arm; the ids ride the statement as parameters (spaces.ts validates ids at
|
|
781
|
+
// the write boundary, but the parameterized form is the rule regardless).
|
|
782
|
+
// `allSpaces` (server-internal whole-store passes) skips the predicate.
|
|
783
|
+
const visibleSpaces = (0, spaces_js_1.resolveVisibleSet)(opts?.includeConfidential, opts?.visibleSpaces);
|
|
784
|
+
const spaceParams = [...visibleSpaces];
|
|
785
|
+
const spaceArms = spaceParams.map(() => "privacy = ?").join(" OR ");
|
|
786
|
+
const classPredicate = opts?.allSpaces === true
|
|
732
787
|
? ""
|
|
733
|
-
: " AND (privacy IS NULL OR privacy
|
|
788
|
+
: " AND (privacy IS NULL OR privacy = 'standard'" +
|
|
789
|
+
(spaceArms ? ` OR ${spaceArms}` : "") +
|
|
790
|
+
")";
|
|
734
791
|
if (project) {
|
|
735
792
|
const rows = db
|
|
736
793
|
.prepare(`SELECT * FROM memories
|
|
737
794
|
WHERE memory_type = 'learnings' AND created_at > ? AND project = ?${classPredicate}
|
|
738
795
|
ORDER BY created_at DESC`)
|
|
739
|
-
.all(cutoff, project);
|
|
796
|
+
.all(cutoff, project, ...spaceParams);
|
|
740
797
|
return rows.map(rowToMemory);
|
|
741
798
|
}
|
|
742
799
|
const rows = db
|
|
743
800
|
.prepare(`SELECT * FROM memories
|
|
744
801
|
WHERE memory_type = 'learnings' AND created_at > ?${classPredicate}
|
|
745
802
|
ORDER BY created_at DESC`)
|
|
746
|
-
.all(cutoff);
|
|
803
|
+
.all(cutoff, ...spaceParams);
|
|
747
804
|
return rows.map(rowToMemory);
|
|
748
805
|
}
|
|
749
806
|
/**
|
package/dist/sweep-volatile.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `hicortex sweep-volatile` (#489, deliverable iii —
|
|
2
|
+
* `hicortex sweep-volatile` (#489, deliverable iii — decision 3).
|
|
3
3
|
*
|
|
4
4
|
* The ONE-SHOT store sweep: the live corpus already holds the GH-status /
|
|
5
|
-
* version-bump rows gold set A adjudicated
|
|
5
|
+
* version-bump rows gold set A adjudicated as unhealthy to keep.
|
|
6
6
|
* This command reuses the SAME deterministic gate the distill path applies
|
|
7
7
|
* (distiller.ts isVolatileStatusEntry — one gate, one meaning) over the stored
|
|
8
8
|
* corpus. Mirrors `dedup`:
|
package/dist/sweep-volatile.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* `hicortex sweep-volatile` (#489, deliverable iii —
|
|
3
|
+
* `hicortex sweep-volatile` (#489, deliverable iii — decision 3).
|
|
4
4
|
*
|
|
5
5
|
* The ONE-SHOT store sweep: the live corpus already holds the GH-status /
|
|
6
|
-
* version-bump rows gold set A adjudicated
|
|
6
|
+
* version-bump rows gold set A adjudicated as unhealthy to keep.
|
|
7
7
|
* This command reuses the SAME deterministic gate the distill path applies
|
|
8
8
|
* (distiller.ts isVolatileStatusEntry — one gate, one meaning) over the stored
|
|
9
9
|
* corpus. Mirrors `dedup`:
|
package/dist/telemetry-cli.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `hicortex telemetry` — transparency surface for anonymous usage telemetry.
|
|
3
3
|
*
|
|
4
|
-
* Read-only BY DESIGN
|
|
4
|
+
* Read-only BY DESIGN. It shows the exact payload
|
|
5
5
|
* and both documented ways to switch telemetry off, but it does not flip the
|
|
6
6
|
* switch itself: the `telemetry` key is deliberately NOT scaffolded into
|
|
7
7
|
* config.json, and opting out is a deliberate edit the operator makes. Turning
|
package/dist/telemetry-cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* `hicortex telemetry` — transparency surface for anonymous usage telemetry.
|
|
4
4
|
*
|
|
5
|
-
* Read-only BY DESIGN
|
|
5
|
+
* Read-only BY DESIGN. It shows the exact payload
|
|
6
6
|
* and both documented ways to switch telemetry off, but it does not flip the
|
|
7
7
|
* switch itself: the `telemetry` key is deliberately NOT scaffolded into
|
|
8
8
|
* config.json, and opting out is a deliberate edit the operator makes. Turning
|
package/dist/type-classify.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ---------------
|
|
7
7
|
* Before #216 the distiller NEVER set memory_type — every distilled memory
|
|
8
8
|
* defaulted to "experience" (storage.ts insertMemory `?? "experience"`), so
|
|
9
|
-
* the corpus was
|
|
9
|
+
* the corpus was almost entirely experiences. The distiller now classifies each entry at
|
|
10
10
|
* extract time via the [E]/[K]/[D] tag (distiller.ts), but the EXISTING corpus
|
|
11
11
|
* needs a one-shot backfill. This command is that backfill — modelled on
|
|
12
12
|
* `classify-domains` (resumable cursor, batched, infra-error-safe).
|
package/dist/type-classify.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* ---------------
|
|
8
8
|
* Before #216 the distiller NEVER set memory_type — every distilled memory
|
|
9
9
|
* defaulted to "experience" (storage.ts insertMemory `?? "experience"`), so
|
|
10
|
-
* the corpus was
|
|
10
|
+
* the corpus was almost entirely experiences. The distiller now classifies each entry at
|
|
11
11
|
* extract time via the [E]/[K]/[D] tag (distiller.ts), but the EXISTING corpus
|
|
12
12
|
* needs a one-shot backfill. This command is that backfill — modelled on
|
|
13
13
|
* `classify-domains` (resumable cursor, batched, infra-error-safe).
|
package/dist/type-labels.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* the old keys so a briefly-stale reader (e.g. a snapshot taken mid-migrate)
|
|
15
15
|
* renders correctly.
|
|
16
16
|
*
|
|
17
|
-
* Mapping (
|
|
17
|
+
* Mapping (the identity-reframe decision):
|
|
18
18
|
* fact → knowledge
|
|
19
19
|
* episode → experience
|
|
20
20
|
* decision → decisions
|