crbro-memory 1.6.0 → 1.7.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.
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ // ─── CRBRO Shared Memory: rebuilding a neuron from the logs ──────
3
+ //
4
+ // Everything hard about sharing memory lives in this file, and it is one pure
5
+ // function. Given whatever the neuron looks like locally plus every note
6
+ // anyone has written, produce the neuron. No disk, no network, no git.
7
+ //
8
+ // Three properties make the merge automatic, and every rule below is chosen to
9
+ // preserve them:
10
+ // - order does not matter,
11
+ // - applying the same note twice changes nothing,
12
+ // - applying half the notes now and the rest later ends up the same.
13
+ // Anything that needed a clock, a "latest wins", or a tie-break on wall time
14
+ // would break them, which is why none of that is here.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.applyOps = applyOps;
17
+ const fs_js_1 = require("../utils/fs.js");
18
+ const ops_js_1 = require("./ops.js");
19
+ /**
20
+ * How far along a fact's life it is. Merging takes the maximum, so a fact
21
+ * someone retracted can never come back to life because a stale log still
22
+ * calls it active. Truth about what is no longer true only moves one way.
23
+ */
24
+ const RANK = { active: 0, superseded: 1, retracted: 2 };
25
+ const BY_RANK = ['active', 'superseded', 'retracted'];
26
+ function rankOf(s) {
27
+ return RANK[s || 'active'] ?? 0;
28
+ }
29
+ /** The earlier of two ISO dates. Empty strings lose. */
30
+ function earliest(a, b) {
31
+ if (!a)
32
+ return b;
33
+ if (!b)
34
+ return a;
35
+ return a < b ? a : b;
36
+ }
37
+ function applyOps(base, ops, fallback) {
38
+ const report = {
39
+ facts_added: 0,
40
+ facts_retracted: 0,
41
+ facts_superseded: 0,
42
+ decisions_added: 0,
43
+ patterns_added: 0,
44
+ tags_added: 0,
45
+ authors: [],
46
+ divergence: [],
47
+ };
48
+ const neuronOp = ops.find(o => o.op === 'neuron');
49
+ const id = base?.id || neuronOp?.nid || fallback?.id || '';
50
+ // Start from what we already have. If we have nothing, the announcement
51
+ // gives us a name; if we do have it, ours stands and any disagreement is
52
+ // reported rather than resolved. Overwriting someone's local name because a
53
+ // teammate spelled it differently is not a merge, it is a stomp.
54
+ const neuron = base
55
+ ? { ...base, facts: [...base.facts], decisions: [...base.decisions], patterns: [...base.patterns], preferences: [...base.preferences], tags: [...base.tags], connections: [...base.connections] }
56
+ : {
57
+ id,
58
+ name: neuronOp && neuronOp.op === 'neuron' ? neuronOp.name : id,
59
+ domain: neuronOp && neuronOp.op === 'neuron' ? neuronOp.domain : 'general',
60
+ type: (neuronOp && neuronOp.op === 'neuron' ? neuronOp.ntype : 'project'),
61
+ created: (0, fs_js_1.now)(),
62
+ last_accessed: (0, fs_js_1.now)(),
63
+ access_count: 0,
64
+ heat: 0.5,
65
+ summary: '',
66
+ facts: [],
67
+ decisions: [],
68
+ patterns: [],
69
+ preferences: [],
70
+ connections: [],
71
+ tags: [],
72
+ };
73
+ if (base && neuronOp && neuronOp.op === 'neuron') {
74
+ if (neuronOp.name && base.name && (0, ops_js_1.normalizeText)(neuronOp.name) !== (0, ops_js_1.normalizeText)(base.name)) {
75
+ report.divergence.push({ field: 'name', mine: base.name, theirs: neuronOp.name, from: neuronOp.by });
76
+ }
77
+ if (neuronOp.domain && base.domain && neuronOp.domain !== base.domain && base.domain !== 'general') {
78
+ report.divergence.push({ field: 'domain', mine: base.domain, theirs: neuronOp.domain, from: neuronOp.by });
79
+ }
80
+ }
81
+ // ─── Facts: union by id, then the furthest-along status ───────
82
+ const byFid = new Map();
83
+ for (const f of neuron.facts) {
84
+ byFid.set(f.id || '', f);
85
+ }
86
+ // Facts stored before ids existed: index them by their text so an incoming
87
+ // note about the same sentence lands on the same fact instead of duplicating.
88
+ const byText = new Map();
89
+ for (const f of neuron.facts) {
90
+ byText.set((0, ops_js_1.normalizeText)(f.text), f);
91
+ }
92
+ const statusOps = [];
93
+ for (const op of ops) {
94
+ if (op.op === 'fact') {
95
+ const fo = op;
96
+ const existing = byFid.get(fo.fid) || byText.get((0, ops_js_1.normalizeText)(fo.text));
97
+ if (existing) {
98
+ // Same fact from two people. Keep the earliest date so provenance
99
+ // reflects who knew it first, and the higher confidence.
100
+ existing.id = existing.id || fo.fid;
101
+ existing.added = earliest(existing.added, fo.at);
102
+ existing.confidence = Math.max(existing.confidence ?? 1, fo.conf ?? 1);
103
+ continue;
104
+ }
105
+ const fact = {
106
+ text: fo.text,
107
+ confidence: fo.conf ?? 1,
108
+ added: fo.at,
109
+ source: `team:${fo.by}`,
110
+ id: fo.fid,
111
+ status: 'active',
112
+ };
113
+ neuron.facts.push(fact);
114
+ byFid.set(fo.fid, fact);
115
+ byText.set((0, ops_js_1.normalizeText)(fo.text), fact);
116
+ report.facts_added++;
117
+ }
118
+ else if (op.op === 'status') {
119
+ statusOps.push(op);
120
+ }
121
+ }
122
+ // Status is applied after every fact exists, so a note retracting a fact
123
+ // works no matter which log it arrived in or in what order.
124
+ for (const so of statusOps) {
125
+ const target = byFid.get(so.fid);
126
+ if (!target)
127
+ continue;
128
+ const antes = rankOf(target.status);
129
+ const despues = Math.max(antes, rankOf(so.to));
130
+ if (despues === antes)
131
+ continue;
132
+ target.status = BY_RANK[despues];
133
+ target.revised = so.at;
134
+ if (so.why)
135
+ target.revision_note = so.why;
136
+ if (target.status === 'retracted')
137
+ report.facts_retracted++;
138
+ else
139
+ report.facts_superseded++;
140
+ }
141
+ // ─── Decisions: union by (id, author) ────────────────────────
142
+ // Two people can reach the same decision for different reasons, and both
143
+ // reasons are worth keeping. Keying on the pair means neither is lost.
144
+ const seenDecision = new Set();
145
+ for (const d of neuron.decisions) {
146
+ seenDecision.add(`${d.id || (0, ops_js_1.normalizeText)(d.text)}|${d.by || ''}`);
147
+ }
148
+ for (const op of ops) {
149
+ if (op.op !== 'decision')
150
+ continue;
151
+ const dop = op;
152
+ const key = `${dop.did}|${dop.by}`;
153
+ if (seenDecision.has(key))
154
+ continue;
155
+ seenDecision.add(key);
156
+ neuron.decisions.push({
157
+ text: dop.text,
158
+ date: dop.at,
159
+ rationale: dop.why || '',
160
+ id: dop.did,
161
+ by: dop.by,
162
+ });
163
+ report.decisions_added++;
164
+ }
165
+ // ─── Patterns and tags: plain set union ──────────────────────
166
+ for (const op of ops) {
167
+ if (op.op === 'pattern') {
168
+ if (!neuron.patterns.some(p => (0, ops_js_1.normalizeText)(p) === (0, ops_js_1.normalizeText)(op.text))) {
169
+ neuron.patterns.push(op.text);
170
+ report.patterns_added++;
171
+ }
172
+ }
173
+ else if (op.op === 'tag') {
174
+ if (!neuron.tags.some(t => (0, ops_js_1.normalizeText)(t) === (0, ops_js_1.normalizeText)(op.text))) {
175
+ neuron.tags.push(op.text);
176
+ report.tags_added++;
177
+ }
178
+ }
179
+ }
180
+ // Deterministic order, so two machines holding the same knowledge produce
181
+ // byte-identical files. Without this, every sync would look like a change.
182
+ neuron.facts.sort((a, b) => {
183
+ const d = String(a.added || '').localeCompare(String(b.added || ''));
184
+ return d !== 0 ? d : String(a.id || '').localeCompare(String(b.id || ''));
185
+ });
186
+ neuron.decisions.sort((a, b) => String(a.date || '').localeCompare(String(b.date || '')));
187
+ neuron.patterns.sort();
188
+ neuron.tags.sort();
189
+ report.authors = [...new Set(ops.map(o => o.by).filter(Boolean))].sort();
190
+ return { neuron, report };
191
+ }
192
+ //# sourceMappingURL=materialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"materialize.js","sourceRoot":"","sources":["../../src/sync/materialize.ts"],"names":[],"mappings":";AAAA,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,uEAAuE;AACvE,EAAE;AACF,+EAA+E;AAC/E,iBAAiB;AACjB,6BAA6B;AAC7B,oDAAoD;AACpD,uEAAuE;AACvE,6EAA6E;AAC7E,uDAAuD;;AA6CvD,4BAiKC;AA5MD,0CAAqC;AAGrC,qCAAyC;AAqBzC;;;;GAIG;AACH,MAAM,IAAI,GAA+B,EAAE,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE,CAA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AAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACzB,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QACrE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC5E,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1F,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACvB,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAEnB,MAAM,CAAC,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAEzE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,76 @@
1
+ /** Bumped only if the shape changes in a way older clients cannot read. */
2
+ export declare const OPS_VERSION = 1;
3
+ export type OpKind = 'neuron' | 'fact' | 'status' | 'decision' | 'pattern' | 'tag';
4
+ interface OpBase {
5
+ v: number;
6
+ op: OpKind;
7
+ /** Neuron this applies to. */
8
+ nid: string;
9
+ /** Who wrote it. Not a security claim — anyone with push access can write any name. */
10
+ by: string;
11
+ /** ISO timestamp. Used for display and for keeping the earliest date, never to decide a winner. */
12
+ at: string;
13
+ }
14
+ /** Announces a neuron. Its name/type/domain are only used if the receiver has no such neuron. */
15
+ export interface NeuronOp extends OpBase {
16
+ op: 'neuron';
17
+ name: string;
18
+ ntype: string;
19
+ domain: string;
20
+ }
21
+ export interface FactOp extends OpBase {
22
+ op: 'fact';
23
+ fid: string;
24
+ text: string;
25
+ conf: number;
26
+ src?: string;
27
+ }
28
+ /**
29
+ * A fact stopped being current. Only ever moves forward:
30
+ * active → superseded → retracted, never back.
31
+ */
32
+ export interface StatusOp extends OpBase {
33
+ op: 'status';
34
+ fid: string;
35
+ to: 'superseded' | 'retracted';
36
+ why?: string;
37
+ }
38
+ export interface DecisionOp extends OpBase {
39
+ op: 'decision';
40
+ did: string;
41
+ text: string;
42
+ why?: string;
43
+ }
44
+ export interface PatternOp extends OpBase {
45
+ op: 'pattern';
46
+ text: string;
47
+ }
48
+ export interface TagOp extends OpBase {
49
+ op: 'tag';
50
+ text: string;
51
+ }
52
+ export type Op = NeuronOp | FactOp | StatusOp | DecisionOp | PatternOp | TagOp;
53
+ /**
54
+ * Same wording, same id, on every machine.
55
+ *
56
+ * Normalising first matters: one person's copy of a sentence may differ from
57
+ * another's by a stray double space or a different Unicode composition, and
58
+ * without this they would become two facts saying the same thing.
59
+ */
60
+ export declare function normalizeText(text: string): string;
61
+ export declare function entryId(text: string): string;
62
+ /** Serialise one operation as a single line. */
63
+ export declare function encodeOp(op: Op): string;
64
+ /**
65
+ * Parse a log. Unreadable lines are skipped rather than thrown, because a log
66
+ * can be cut in half by a process dying mid-append or by a merge landing while
67
+ * we read. One bad line must never cost the other nine hundred.
68
+ */
69
+ export declare function decodeOps(content: string): {
70
+ ops: Op[];
71
+ skipped: number;
72
+ };
73
+ /** Where a person's log for a neuron lives inside the space. */
74
+ export declare function opsRelPath(neuronId: string, author: string, device: string): string;
75
+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M,WAAW,SAAU,SAAQ,MAAM;IACvC,EAAE,EAAE,SAAS,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,KAAM,SAAQ,MAAM;IACnC,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,EAAE,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,KAAK,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,gDAAgD;AAChD,wBAAgB,QAAQ,CAAC,EAAE,EAAE,EAAE,GAAG,MAAM,CAEvC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAyBzE;AAED,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnF"}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ // ─── CRBRO Shared Memory: the operation log ──────────────────────
3
+ //
4
+ // Two people cannot share a neuron by copying the file back and forth: the
5
+ // last save wins and the other person's work vanishes. So nobody ever shares
6
+ // the neuron. Each person appends notes to their own log — "I added this
7
+ // fact", "I retracted that one" — and every machine rebuilds the neuron from
8
+ // all the logs it has.
9
+ //
10
+ // Nobody writes to anybody else's file, so there is nothing to collide. That
11
+ // is the whole trick, and it is what makes the merge automatic: no conflict
12
+ // can arise if no two writers touch the same bytes.
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.OPS_VERSION = void 0;
15
+ exports.normalizeText = normalizeText;
16
+ exports.entryId = entryId;
17
+ exports.encodeOp = encodeOp;
18
+ exports.decodeOps = decodeOps;
19
+ exports.opsRelPath = opsRelPath;
20
+ const hash_js_1 = require("../utils/hash.js");
21
+ /** Bumped only if the shape changes in a way older clients cannot read. */
22
+ exports.OPS_VERSION = 1;
23
+ /**
24
+ * Same wording, same id, on every machine.
25
+ *
26
+ * Normalising first matters: one person's copy of a sentence may differ from
27
+ * another's by a stray double space or a different Unicode composition, and
28
+ * without this they would become two facts saying the same thing.
29
+ */
30
+ function normalizeText(text) {
31
+ return (text || '').normalize('NFC').replace(/\s+/g, ' ').trim();
32
+ }
33
+ function entryId(text) {
34
+ return (0, hash_js_1.contentHash)(normalizeText(text));
35
+ }
36
+ /** Serialise one operation as a single line. */
37
+ function encodeOp(op) {
38
+ return JSON.stringify(op);
39
+ }
40
+ /**
41
+ * Parse a log. Unreadable lines are skipped rather than thrown, because a log
42
+ * can be cut in half by a process dying mid-append or by a merge landing while
43
+ * we read. One bad line must never cost the other nine hundred.
44
+ */
45
+ function decodeOps(content) {
46
+ const ops = [];
47
+ let skipped = 0;
48
+ for (const line of (content || '').split('\n')) {
49
+ const t = line.trim();
50
+ if (!t)
51
+ continue;
52
+ try {
53
+ const parsed = JSON.parse(t);
54
+ if (!parsed || typeof parsed !== 'object' || !parsed.op || !parsed.nid) {
55
+ skipped++;
56
+ continue;
57
+ }
58
+ if (parsed.v > exports.OPS_VERSION) {
59
+ // Written by a newer CRBRO. Skipping is safer than half-understanding it.
60
+ skipped++;
61
+ continue;
62
+ }
63
+ ops.push(parsed);
64
+ }
65
+ catch {
66
+ skipped++;
67
+ }
68
+ }
69
+ return { ops, skipped };
70
+ }
71
+ /** Where a person's log for a neuron lives inside the space. */
72
+ function opsRelPath(neuronId, author, device) {
73
+ return `neurons/${neuronId}/ops/${author}.${device}.jsonl`;
74
+ }
75
+ //# sourceMappingURL=ops.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ops.js","sourceRoot":"","sources":["../../src/sync/ops.ts"],"names":[],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C,GAAG,EAAE,CAAC;gBACvE,OAAO,EAAE,CAAC;gBACV,SAAS;YACX,CAAC;YACD,IAAI,MAAM,CAAC,CAAC,GAAG,mBAAW,EAAE,CAAC;gBAC3B,0EAA0E;gBAC1E,OAAO,EAAE,CAAC;gBACV,SAAS;YACX,CAAC;YACD,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACnB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC;AAED,gEAAgE;AAChE,SAAgB,UAAU,CAAC,QAAgB,EAAE,MAAc,EAAE,MAAc;IACzE,OAAO,WAAW,QAAQ,QAAQ,MAAM,IAAI,MAAM,QAAQ,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { type MergeReport } from './materialize.js';
2
+ import { type Op } from './ops.js';
3
+ import { type GitResult } from './git.js';
4
+ import type { Brain } from '../engine/brain.js';
5
+ import type { Cortex } from '../engine/cortex.js';
6
+ export interface Identity {
7
+ author: string;
8
+ device: string;
9
+ }
10
+ export interface SpaceConfig {
11
+ v: number;
12
+ name: string;
13
+ created_by: string;
14
+ created: string;
15
+ branch: string;
16
+ }
17
+ export interface ShareReport {
18
+ dry_run: boolean;
19
+ neuron_id: string;
20
+ space: string;
21
+ ops_to_emit: number;
22
+ blocked: Array<{
23
+ where: string;
24
+ kind: string;
25
+ }>;
26
+ skipped_preferences: number;
27
+ confirm_token?: string;
28
+ }
29
+ export interface SyncReport {
30
+ space: string;
31
+ state: 'ok' | 'offline' | 'no_git' | 'auth' | 'conflict' | 'not_joined';
32
+ neurons_touched: string[];
33
+ merged: MergeReport[];
34
+ pushed: boolean;
35
+ message: string;
36
+ }
37
+ /**
38
+ * Who this machine is. Not a security claim — anyone with push access to the
39
+ * repository can write any name — just a label so a fact says where it came
40
+ * from. Never leaves the machine except inside the notes it signs.
41
+ */
42
+ export declare function getIdentity(brain: Brain, author?: string): Promise<Identity>;
43
+ export declare function spaceDir(brain: Brain, name: string): string;
44
+ export declare function readSpace(brain: Brain, name: string): Promise<SpaceConfig | null>;
45
+ export declare function listSpaces(brain: Brain): Promise<string[]>;
46
+ export declare function createSpace(brain: Brain, name: string, remote: string, author: string, branch?: string): Promise<{
47
+ ok: boolean;
48
+ message: string;
49
+ detail?: string;
50
+ }>;
51
+ export declare function joinSpace(brain: Brain, name: string, remote: string, author: string, branch?: string): Promise<{
52
+ ok: boolean;
53
+ message: string;
54
+ detail?: string;
55
+ }>;
56
+ /**
57
+ * Look at what would be sent. Credentials block the share outright rather than
58
+ * being redacted: silently sending someone a mangled version of a fact is
59
+ * worse than refusing and saying where the problem is.
60
+ */
61
+ export declare function prepareShare(brain: Brain, cortex: Cortex, neuronRef: string, spaceName: string): Promise<ShareReport | {
62
+ error: string;
63
+ }>;
64
+ export declare function commitShare(brain: Brain, cortex: Cortex, neuronRef: string, spaceName: string, token: string): Promise<{
65
+ ok: boolean;
66
+ message: string;
67
+ ops?: number;
68
+ }>;
69
+ interface SharedMap {
70
+ [neuronId: string]: string;
71
+ }
72
+ export declare function sharedMap(brain: Brain): Promise<SharedMap>;
73
+ export declare function markShared(brain: Brain, neuronId: string, space: string): Promise<void>;
74
+ /** Append one note for a neuron that is already shared. Silent if it is not. */
75
+ export declare function emitOps(brain: Brain, neuronId: string, make: (id: Identity) => Op[]): Promise<void>;
76
+ export declare function syncSpaceNow(brain: Brain, cortex: Cortex, spaceName: string, timeoutMs?: number): Promise<SyncReport>;
77
+ /** Sync every space. Used at boot and at consolidation, with a short budget. */
78
+ export declare function syncAll(brain: Brain, cortex: Cortex, timeoutMs?: number): Promise<SyncReport[]>;
79
+ /**
80
+ * Wire a Cortex so writes to shared neurons reach the team log.
81
+ *
82
+ * Exported as one function on purpose. The indexer had exactly this shape and
83
+ * was wired only inside the MCP server, so the miner — which builds its own
84
+ * Cortex — silently never indexed anything. One entry point means the next
85
+ * caller cannot forget.
86
+ */
87
+ export declare function attachSync(brain: Brain, cortex: Cortex): void;
88
+ export type { GitResult };
89
+ //# sourceMappingURL=space.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/sync/space.ts"],"names":[],"mappings":"AAaA,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAyD,KAAK,EAAE,EAAE,MAAM,UAAU,CAAC;AAE1F,OAAO,EAAuD,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AAC/F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGlD,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,CAAC,EAAE,MAAM,CAAC;IACV,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAChD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;IACxE,eAAe,EAAE,MAA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