ctxpipe 0.1.0-alpha.0 → 0.2.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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -0
  3. package/bin/ctxpipe.js +6 -42
  4. package/dist/auth.d.ts +52 -0
  5. package/dist/auth.js +416 -0
  6. package/dist/auth.js.map +1 -0
  7. package/dist/cli.d.ts +1 -0
  8. package/dist/cli.js +12 -0
  9. package/dist/cli.js.map +1 -0
  10. package/dist/commands.d.ts +56 -0
  11. package/dist/commands.js +264 -0
  12. package/dist/commands.js.map +1 -0
  13. package/dist/constants.d.ts +8 -0
  14. package/dist/constants.js +19 -0
  15. package/dist/constants.js.map +1 -0
  16. package/dist/fs-operations.d.ts +16 -0
  17. package/dist/fs-operations.js +62 -0
  18. package/dist/fs-operations.js.map +1 -0
  19. package/dist/mcp/json.d.ts +3 -0
  20. package/dist/mcp/json.js +15 -0
  21. package/dist/mcp/json.js.map +1 -0
  22. package/dist/mcp/mcp-operations.d.ts +103 -0
  23. package/dist/mcp/mcp-operations.js +464 -0
  24. package/dist/mcp/mcp-operations.js.map +1 -0
  25. package/dist/mcp/paths.d.ts +7 -0
  26. package/dist/mcp/paths.js +17 -0
  27. package/dist/mcp/paths.js.map +1 -0
  28. package/dist/memory/agentmemory-client.d.ts +24 -0
  29. package/dist/memory/agentmemory-client.js +47 -0
  30. package/dist/memory/agentmemory-client.js.map +1 -0
  31. package/dist/memory/hydration.d.ts +141 -0
  32. package/dist/memory/hydration.js +390 -0
  33. package/dist/memory/hydration.js.map +1 -0
  34. package/dist/memory/index.d.ts +4 -0
  35. package/dist/memory/index.js +5 -0
  36. package/dist/memory/index.js.map +1 -0
  37. package/dist/memory/markdown.d.ts +29 -0
  38. package/dist/memory/markdown.js +193 -0
  39. package/dist/memory/markdown.js.map +1 -0
  40. package/dist/memory/mcp-server.d.ts +48 -0
  41. package/dist/memory/mcp-server.js +322 -0
  42. package/dist/memory/mcp-server.js.map +1 -0
  43. package/dist/memory/paths.d.ts +12 -0
  44. package/dist/memory/paths.js +71 -0
  45. package/dist/memory/paths.js.map +1 -0
  46. package/dist/memory/policy.d.ts +16 -0
  47. package/dist/memory/policy.js +81 -0
  48. package/dist/memory/policy.js.map +1 -0
  49. package/dist/memory/run-hook.d.ts +13 -0
  50. package/dist/memory/run-hook.js +44 -0
  51. package/dist/memory/run-hook.js.map +1 -0
  52. package/dist/memory/run-init.d.ts +11 -0
  53. package/dist/memory/run-init.js +92 -0
  54. package/dist/memory/run-init.js.map +1 -0
  55. package/dist/memory/run-mcp.d.ts +3 -0
  56. package/dist/memory/run-mcp.js +7 -0
  57. package/dist/memory/run-mcp.js.map +1 -0
  58. package/dist/memory/run-meta.d.ts +11 -0
  59. package/dist/memory/run-meta.js +124 -0
  60. package/dist/memory/run-meta.js.map +1 -0
  61. package/dist/memory/supervisor.d.ts +49 -0
  62. package/dist/memory/supervisor.js +217 -0
  63. package/dist/memory/supervisor.js.map +1 -0
  64. package/dist/program.d.ts +1 -0
  65. package/dist/program.js +209 -0
  66. package/dist/program.js.map +1 -0
  67. package/dist/prompts.d.ts +42 -0
  68. package/dist/prompts.js +336 -0
  69. package/dist/prompts.js.map +1 -0
  70. package/dist/system.d.ts +3 -0
  71. package/dist/system.js +27 -0
  72. package/dist/system.js.map +1 -0
  73. package/dist/ui.d.ts +20 -0
  74. package/dist/ui.js +115 -0
  75. package/dist/ui.js.map +1 -0
  76. package/dist/version.d.ts +1 -0
  77. package/dist/version.js +4 -0
  78. package/dist/version.js.map +1 -0
  79. package/package.json +26 -4
@@ -0,0 +1,141 @@
1
+ import { type RepoFingerprint } from "./paths.js";
2
+ import { type MemoryRecord } from "./markdown.js";
3
+ export declare const DEFAULT_DELTA_FILE_THRESHOLD = 50;
4
+ export declare const DEFAULT_DELTA_RATIO_THRESHOLD = 0.1;
5
+ export type ManifestFileEntry = {
6
+ hash: string;
7
+ mtimeMs: number;
8
+ size: number;
9
+ memoryIds: string[];
10
+ };
11
+ export type HydrationManifest = {
12
+ schemaVersion: number;
13
+ memoryRoot: string;
14
+ repoId: string;
15
+ agentmemoryVersion: string | null;
16
+ lastHydratedAt: string | null;
17
+ gitHead: string | null;
18
+ files: Record<string, ManifestFileEntry>;
19
+ };
20
+ export type DeltaClassification = {
21
+ kind: "noop";
22
+ reason: "manifest-matches-tree";
23
+ } | {
24
+ kind: "small";
25
+ changedFiles: string[];
26
+ deletedFiles: string[];
27
+ deletedMemoryIds: string[];
28
+ } | {
29
+ kind: "large";
30
+ changedFiles: string[];
31
+ deletedFiles: string[];
32
+ deletedMemoryIds: string[];
33
+ reason: "missing-manifest" | "above-threshold" | "schema-mismatch";
34
+ } | {
35
+ kind: "refuse";
36
+ reason: "duplicate-id" | "merge-conflict" | "parse-error";
37
+ details: Array<{
38
+ file: string;
39
+ id?: string;
40
+ message?: string;
41
+ }>;
42
+ };
43
+ export type ImportPayload = {
44
+ strategy: "merge" | "replace";
45
+ exportData: {
46
+ version: string;
47
+ exportedAt: string;
48
+ sessions: never[];
49
+ observations: Record<string, never>;
50
+ summaries: never[];
51
+ memories: Array<{
52
+ id: string;
53
+ createdAt: string;
54
+ updatedAt: string;
55
+ type: string;
56
+ title: string;
57
+ content: string;
58
+ concepts: string[];
59
+ files: string[];
60
+ sessionIds: never[];
61
+ strength: number;
62
+ version: number;
63
+ isLatest: boolean;
64
+ }>;
65
+ };
66
+ deletedIds: string[];
67
+ };
68
+ export type ScanResult = {
69
+ records: MemoryRecord[];
70
+ recordsByPath: Map<string, MemoryRecord>;
71
+ fileEntries: Record<string, ManifestFileEntry>;
72
+ conflicts: Array<{
73
+ id: string;
74
+ files: string[];
75
+ }>;
76
+ parseErrors: Array<{
77
+ file: string;
78
+ message: string;
79
+ }>;
80
+ mergeConflicts: string[];
81
+ };
82
+ /** List every Markdown file under memoryRoot and parse them. */
83
+ export declare function scanMemoryTree(memoryRoot: string): ScanResult;
84
+ export declare function classifyDelta(args: {
85
+ manifest: HydrationManifest | null;
86
+ scan: ScanResult;
87
+ /** When set, override the heuristic to force a particular outcome. */
88
+ fileThreshold?: number;
89
+ ratioThreshold?: number;
90
+ }): DeltaClassification;
91
+ export declare function buildImportPayload(args: {
92
+ strategy: "merge" | "replace";
93
+ records: MemoryRecord[];
94
+ deletedIds?: string[];
95
+ agentmemoryVersion: string;
96
+ now?: Date;
97
+ }): ImportPayload;
98
+ export declare function agentMemoryId(id: string): string;
99
+ export declare function readManifest(fingerprint: RepoFingerprint): HydrationManifest | null;
100
+ export declare function writeManifest(fingerprint: RepoFingerprint, manifest: HydrationManifest): void;
101
+ export declare function buildManifestFromScan(args: {
102
+ scan: ScanResult;
103
+ memoryRoot: string;
104
+ fingerprint: RepoFingerprint;
105
+ agentmemoryVersion: string;
106
+ gitHead?: string | null;
107
+ now?: Date;
108
+ }): HydrationManifest;
109
+ export declare function computeManifestStats(fingerprint: RepoFingerprint): {
110
+ exists: boolean;
111
+ fileCount: number;
112
+ memoryCount: number;
113
+ lastHydratedAt: string | null;
114
+ };
115
+ /** Acquire an exclusive lock file. Caller MUST call release(). */
116
+ export declare function acquireHydrationLock(fingerprint: RepoFingerprint, timeoutMs?: number): Promise<{
117
+ release: () => void;
118
+ }>;
119
+ export type CanonicalSaveInput = {
120
+ id: string;
121
+ type: string;
122
+ title: string;
123
+ body: string;
124
+ concepts?: string[];
125
+ files?: string[];
126
+ };
127
+ /** Write a memory record into .ai/memory/<type>/<id>.md (idempotent). */
128
+ export declare function writeCanonicalRecord(args: {
129
+ cwd: string;
130
+ input: CanonicalSaveInput;
131
+ now?: Date;
132
+ }): {
133
+ path: string;
134
+ record: MemoryRecord;
135
+ wasUpdate: boolean;
136
+ };
137
+ /** BM25-lite ranking for direct Markdown fallback when AgentMemory is down. */
138
+ export declare function searchCanonical(records: MemoryRecord[], query: string, limit?: number): Array<{
139
+ record: MemoryRecord;
140
+ score: number;
141
+ }>;
@@ -0,0 +1,390 @@
1
+ import { createHash } from "node:crypto";
2
+ import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync, openSync, closeSync } from "node:fs";
3
+ import { dirname, join, relative, sep } from "node:path";
4
+ import { ensureRepoStateDir, hydrationLockFile, hydrationManifestFile, resolveMemoryRoot, } from "./paths.js";
5
+ import { MarkdownParseError, parseRecord, serializeRecord, } from "./markdown.js";
6
+ export const DEFAULT_DELTA_FILE_THRESHOLD = 50;
7
+ export const DEFAULT_DELTA_RATIO_THRESHOLD = 0.1;
8
+ /**
9
+ * Minimum absolute delta below which we always prefer merge over replace, even
10
+ * for tiny corpora. Without this floor, a 2-file repo where the user edits 1
11
+ * file (50%) would always trigger `replace`, which makes interactive use feel
12
+ * sluggish. See acceptance test "classifies a single edit as a small merge
13
+ * import".
14
+ */
15
+ const DELTA_FLOOR = 10;
16
+ const MANIFEST_SCHEMA_VERSION = 1;
17
+ /** List every Markdown file under memoryRoot and parse them. */
18
+ export function scanMemoryTree(memoryRoot) {
19
+ const records = [];
20
+ const recordsByPath = new Map();
21
+ const fileEntries = {};
22
+ const idCounts = new Map();
23
+ const parseErrors = [];
24
+ const mergeConflicts = [];
25
+ if (!existsSync(memoryRoot)) {
26
+ return {
27
+ records,
28
+ recordsByPath,
29
+ fileEntries,
30
+ conflicts: [],
31
+ parseErrors,
32
+ mergeConflicts,
33
+ };
34
+ }
35
+ for (const file of walkMarkdown(memoryRoot)) {
36
+ const relPath = relative(memoryRoot, file).split(sep).join("/");
37
+ let raw;
38
+ try {
39
+ raw = readFileSync(file, "utf8");
40
+ }
41
+ catch (err) {
42
+ parseErrors.push({
43
+ file: relPath,
44
+ message: err instanceof Error ? err.message : String(err),
45
+ });
46
+ continue;
47
+ }
48
+ // Files without frontmatter are documentation (e.g. README.md, indexes)
49
+ // — silently ignore. Only frontmatter that exists but is malformed is an
50
+ // error worth surfacing.
51
+ if (!/^---\s*\n/.test(raw))
52
+ continue;
53
+ let record;
54
+ try {
55
+ record = parseRecord(raw, relPath);
56
+ }
57
+ catch (err) {
58
+ if (err instanceof MarkdownParseError && /merge conflict/.test(err.message)) {
59
+ mergeConflicts.push(relPath);
60
+ continue;
61
+ }
62
+ parseErrors.push({
63
+ file: relPath,
64
+ message: err instanceof Error ? err.message : String(err),
65
+ });
66
+ continue;
67
+ }
68
+ records.push(record);
69
+ recordsByPath.set(relPath, record);
70
+ const existingFiles = idCounts.get(record.id) ?? [];
71
+ existingFiles.push(relPath);
72
+ idCounts.set(record.id, existingFiles);
73
+ const stat = statSync(file);
74
+ fileEntries[relPath] = {
75
+ hash: hashContent(raw),
76
+ mtimeMs: stat.mtimeMs,
77
+ size: stat.size,
78
+ memoryIds: [record.id],
79
+ };
80
+ }
81
+ const conflicts = [];
82
+ for (const [id, files] of idCounts) {
83
+ if (files.length > 1) {
84
+ conflicts.push({ id, files: files.slice().sort() });
85
+ }
86
+ }
87
+ return {
88
+ records,
89
+ recordsByPath,
90
+ fileEntries,
91
+ conflicts,
92
+ parseErrors,
93
+ mergeConflicts,
94
+ };
95
+ }
96
+ function* walkMarkdown(dir) {
97
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
98
+ const full = join(dir, entry.name);
99
+ if (entry.isDirectory()) {
100
+ yield* walkMarkdown(full);
101
+ continue;
102
+ }
103
+ if (!entry.isFile())
104
+ continue;
105
+ if (!entry.name.endsWith(".md"))
106
+ continue;
107
+ yield full;
108
+ }
109
+ }
110
+ function hashContent(value) {
111
+ return `sha256:${createHash("sha256").update(value, "utf8").digest("hex")}`;
112
+ }
113
+ export function classifyDelta(args) {
114
+ const { manifest, scan } = args;
115
+ const fileThreshold = args.fileThreshold ?? DEFAULT_DELTA_FILE_THRESHOLD;
116
+ const ratioThreshold = args.ratioThreshold ?? DEFAULT_DELTA_RATIO_THRESHOLD;
117
+ if (scan.mergeConflicts.length > 0) {
118
+ return {
119
+ kind: "refuse",
120
+ reason: "merge-conflict",
121
+ details: scan.mergeConflicts.map((file) => ({ file })),
122
+ };
123
+ }
124
+ if (scan.conflicts.length > 0) {
125
+ return {
126
+ kind: "refuse",
127
+ reason: "duplicate-id",
128
+ details: scan.conflicts.flatMap((c) => c.files.map((file) => ({ file, id: c.id }))),
129
+ };
130
+ }
131
+ if (scan.parseErrors.length > 0) {
132
+ return {
133
+ kind: "refuse",
134
+ reason: "parse-error",
135
+ details: scan.parseErrors,
136
+ };
137
+ }
138
+ if (!manifest || manifest.schemaVersion !== MANIFEST_SCHEMA_VERSION) {
139
+ return {
140
+ kind: "large",
141
+ changedFiles: Object.keys(scan.fileEntries).sort(),
142
+ deletedFiles: [],
143
+ deletedMemoryIds: [],
144
+ reason: !manifest ? "missing-manifest" : "schema-mismatch",
145
+ };
146
+ }
147
+ const oldPaths = new Set(Object.keys(manifest.files));
148
+ const newPaths = new Set(Object.keys(scan.fileEntries));
149
+ const changed = [];
150
+ const deleted = [];
151
+ const deletedIds = [];
152
+ for (const path of newPaths) {
153
+ const old = manifest.files[path];
154
+ const cur = scan.fileEntries[path];
155
+ if (!cur)
156
+ continue;
157
+ if (!old) {
158
+ changed.push(path);
159
+ continue;
160
+ }
161
+ if (old.hash !== cur.hash || old.size !== cur.size) {
162
+ changed.push(path);
163
+ }
164
+ }
165
+ for (const path of oldPaths) {
166
+ if (!newPaths.has(path)) {
167
+ deleted.push(path);
168
+ const entry = manifest.files[path];
169
+ if (entry)
170
+ deletedIds.push(...entry.memoryIds);
171
+ }
172
+ }
173
+ if (changed.length === 0 && deleted.length === 0) {
174
+ return { kind: "noop", reason: "manifest-matches-tree" };
175
+ }
176
+ const deltaCount = changed.length + deleted.length;
177
+ const corpus = Math.max(oldPaths.size, newPaths.size, 1);
178
+ const ratioBound = Math.max(DELTA_FLOOR, Math.floor(ratioThreshold * corpus));
179
+ const smallLimit = Math.min(fileThreshold, ratioBound);
180
+ if (deltaCount > smallLimit) {
181
+ return {
182
+ kind: "large",
183
+ changedFiles: Array.from(newPaths).sort(),
184
+ deletedFiles: deleted.sort(),
185
+ deletedMemoryIds: deletedIds,
186
+ reason: "above-threshold",
187
+ };
188
+ }
189
+ return {
190
+ kind: "small",
191
+ changedFiles: changed.sort(),
192
+ deletedFiles: deleted.sort(),
193
+ deletedMemoryIds: deletedIds,
194
+ };
195
+ }
196
+ export function buildImportPayload(args) {
197
+ const now = (args.now ?? new Date()).toISOString();
198
+ return {
199
+ strategy: args.strategy,
200
+ deletedIds: args.deletedIds ?? [],
201
+ exportData: {
202
+ version: args.agentmemoryVersion,
203
+ exportedAt: now,
204
+ sessions: [],
205
+ observations: {},
206
+ summaries: [],
207
+ memories: args.records.map((record) => ({
208
+ id: agentMemoryId(record.id),
209
+ createdAt: record.createdAt,
210
+ updatedAt: record.updatedAt,
211
+ type: record.type,
212
+ title: record.title,
213
+ content: record.body,
214
+ concepts: record.concepts,
215
+ files: record.files,
216
+ sessionIds: [],
217
+ strength: 7,
218
+ version: 1,
219
+ isLatest: true,
220
+ })),
221
+ },
222
+ };
223
+ }
224
+ export function agentMemoryId(id) {
225
+ return id.startsWith("ctxpipe_") ? id : `ctxpipe_${id}`;
226
+ }
227
+ export function readManifest(fingerprint) {
228
+ const file = hydrationManifestFile(fingerprint);
229
+ if (!existsSync(file))
230
+ return null;
231
+ try {
232
+ const raw = readFileSync(file, "utf8").trim();
233
+ if (!raw)
234
+ return null;
235
+ const parsed = JSON.parse(raw);
236
+ if (parsed.schemaVersion !== MANIFEST_SCHEMA_VERSION)
237
+ return parsed;
238
+ return parsed;
239
+ }
240
+ catch {
241
+ return null;
242
+ }
243
+ }
244
+ export function writeManifest(fingerprint, manifest) {
245
+ ensureRepoStateDir(fingerprint);
246
+ const file = hydrationManifestFile(fingerprint);
247
+ mkdirSync(dirname(file), { recursive: true });
248
+ writeFileSync(file, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
249
+ }
250
+ export function buildManifestFromScan(args) {
251
+ return {
252
+ schemaVersion: MANIFEST_SCHEMA_VERSION,
253
+ memoryRoot: args.memoryRoot,
254
+ repoId: args.fingerprint,
255
+ agentmemoryVersion: args.agentmemoryVersion,
256
+ lastHydratedAt: (args.now ?? new Date()).toISOString(),
257
+ gitHead: args.gitHead ?? null,
258
+ files: args.scan.fileEntries,
259
+ };
260
+ }
261
+ export function computeManifestStats(fingerprint) {
262
+ const manifest = readManifest(fingerprint);
263
+ if (!manifest) {
264
+ return { exists: false, fileCount: 0, memoryCount: 0, lastHydratedAt: null };
265
+ }
266
+ const memoryCount = Object.values(manifest.files).reduce((count, entry) => count + entry.memoryIds.length, 0);
267
+ return {
268
+ exists: true,
269
+ fileCount: Object.keys(manifest.files).length,
270
+ memoryCount,
271
+ lastHydratedAt: manifest.lastHydratedAt,
272
+ };
273
+ }
274
+ /** Acquire an exclusive lock file. Caller MUST call release(). */
275
+ export async function acquireHydrationLock(fingerprint, timeoutMs = 15_000) {
276
+ ensureRepoStateDir(fingerprint);
277
+ const file = hydrationLockFile(fingerprint);
278
+ const deadline = Date.now() + timeoutMs;
279
+ while (Date.now() < deadline) {
280
+ try {
281
+ const fd = openSync(file, "wx");
282
+ return {
283
+ release: () => {
284
+ try {
285
+ closeSync(fd);
286
+ }
287
+ catch {
288
+ // ignored
289
+ }
290
+ try {
291
+ writeFileSync(file, "");
292
+ }
293
+ catch {
294
+ // ignored
295
+ }
296
+ try {
297
+ // best-effort unlink — keeps state dir tidy
298
+ require("node:fs").unlinkSync(file);
299
+ }
300
+ catch {
301
+ // ignored
302
+ }
303
+ },
304
+ };
305
+ }
306
+ catch (err) {
307
+ if (err instanceof Error &&
308
+ "code" in err &&
309
+ err.code === "EEXIST") {
310
+ await new Promise((r) => setTimeout(r, 25));
311
+ continue;
312
+ }
313
+ throw err;
314
+ }
315
+ }
316
+ throw new Error(`Could not acquire hydration lock within ${timeoutMs}ms (held by another ctxpipe process)`);
317
+ }
318
+ /** Write a memory record into .ai/memory/<type>/<id>.md (idempotent). */
319
+ export function writeCanonicalRecord(args) {
320
+ const memoryRoot = resolveMemoryRoot(args.cwd);
321
+ if (!existsSync(memoryRoot))
322
+ mkdirSync(memoryRoot, { recursive: true });
323
+ const typeDir = join(memoryRoot, slugify(args.input.type));
324
+ if (!existsSync(typeDir))
325
+ mkdirSync(typeDir, { recursive: true });
326
+ const file = join(typeDir, `${slugify(args.input.id)}.md`);
327
+ const now = (args.now ?? new Date()).toISOString();
328
+ const wasUpdate = existsSync(file);
329
+ let createdAt = now;
330
+ if (wasUpdate) {
331
+ try {
332
+ const prior = parseRecord(readFileSync(file, "utf8"), file);
333
+ createdAt = prior.createdAt;
334
+ }
335
+ catch {
336
+ // ignore malformed prior record; we overwrite
337
+ }
338
+ }
339
+ const record = {
340
+ id: args.input.id,
341
+ type: args.input.type,
342
+ title: args.input.title,
343
+ body: args.input.body,
344
+ concepts: args.input.concepts ?? [],
345
+ files: args.input.files ?? [],
346
+ createdAt,
347
+ updatedAt: now,
348
+ extra: {},
349
+ };
350
+ writeFileSync(file, serializeRecord(record), "utf8");
351
+ return { path: file, record, wasUpdate };
352
+ }
353
+ function slugify(value) {
354
+ return value
355
+ .toLowerCase()
356
+ .replace(/[^a-z0-9._-]+/g, "-")
357
+ .replace(/^-+|-+$/g, "")
358
+ .slice(0, 80);
359
+ }
360
+ /** BM25-lite ranking for direct Markdown fallback when AgentMemory is down. */
361
+ export function searchCanonical(records, query, limit = 10) {
362
+ const tokens = tokenize(query);
363
+ if (tokens.length === 0)
364
+ return [];
365
+ const scored = [];
366
+ for (const record of records) {
367
+ const haystack = `${record.title}\n${record.body}\n${record.concepts.join(" ")}`.toLowerCase();
368
+ let score = 0;
369
+ for (const token of tokens) {
370
+ if (token.length === 0)
371
+ continue;
372
+ let idx = haystack.indexOf(token);
373
+ while (idx !== -1) {
374
+ score += 1;
375
+ idx = haystack.indexOf(token, idx + 1);
376
+ }
377
+ }
378
+ if (score > 0)
379
+ scored.push({ record, score });
380
+ }
381
+ scored.sort((a, b) => b.score - a.score);
382
+ return scored.slice(0, limit);
383
+ }
384
+ function tokenize(value) {
385
+ return value
386
+ .toLowerCase()
387
+ .split(/[^a-z0-9]+/)
388
+ .filter((token) => token.length > 1);
389
+ }
390
+ //# sourceMappingURL=hydration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hydration.js","sourceRoot":"","sources":["../../src/memory/hydration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,GAElB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,eAAe,GAEhB,MAAM,eAAe,CAAA;AAEtB,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,CAAA;AAC9C,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAA;AAChD;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,uBAAuB,GAAG,CAAC,CAAA;AA2EjC,gEAAgE;AAChE,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC/C,MAAM,OAAO,GAAmB,EAAE,CAAA;IAClC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAwB,CAAA;IACrD,MAAM,WAAW,GAAsC,EAAE,CAAA;IACzD,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAoB,CAAA;IAC5C,MAAM,WAAW,GAA6C,EAAE,CAAA;IAChE,MAAM,cAAc,GAAa,EAAE,CAAA;IAEnC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,OAAO;YACP,aAAa;YACb,WAAW;YACX,SAAS,EAAE,EAAE;YACb,WAAW;YACX,cAAc;SACf,CAAA;I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AI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA;IAC/C,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAA;IACxC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK;SACT,WAAW,EAAE;SACb,KAAK,CAAC,YAAY,CAAC;SACnB,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;AACxC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { runMemoryMcp } from "./run-mcp.js";
2
+ export { runMemoryInit } from "./run-init.js";
3
+ export { runMemoryStatus, runMemoryDoctor, runMemoryStop } from "./run-meta.js";
4
+ export { runMemoryHook } from "./run-hook.js";
@@ -0,0 +1,5 @@
1
+ export { runMemoryMcp } from "./run-mcp.js";
2
+ export { runMemoryInit } from "./run-init.js";
3
+ export { runMemoryStatus, runMemoryDoctor, runMemoryStop } from "./run-meta.js";
4
+ export { runMemoryHook } from "./run-hook.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Tiny YAML-frontmatter parser/serializer for ctxpipe memory records.
3
+ *
4
+ * We deliberately avoid pulling in a full YAML dependency: the canonical
5
+ * memory record only uses a small, well-defined subset of YAML keys (`id`,
6
+ * `type`, `concepts`, `files`, plus ISO 8601 timestamps and a couple of
7
+ * optional bookkeeping fields). The parser refuses any frontmatter shape
8
+ * outside that subset so we never silently lose data.
9
+ */
10
+ export type MemoryRecordType = "architecture" | "decision" | "pattern" | "lesson" | "session" | "fact" | "note";
11
+ export type MemoryRecord = {
12
+ id: string;
13
+ type: MemoryRecordType | string;
14
+ title: string;
15
+ body: string;
16
+ concepts: string[];
17
+ files: string[];
18
+ createdAt: string;
19
+ updatedAt: string;
20
+ /** Other frontmatter keys we preserve on round-trip but don't interpret. */
21
+ extra: Record<string, string | string[]>;
22
+ };
23
+ export declare class MarkdownParseError extends Error {
24
+ readonly file?: string | undefined;
25
+ constructor(message: string, file?: string | undefined);
26
+ }
27
+ /** Read a Markdown record from a string. */
28
+ export declare function parseRecord(source: string, file?: string): MemoryRecord;
29
+ export declare function serializeRecord(record: MemoryRecord): string;