@polycode-projects/the-mechanical-code-talker 2.9.6 → 2.10.1

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.
@@ -290,6 +290,13 @@ export const TOOL_DEFINITIONS = Object.freeze([
290
290
  inputSchema: symbolArg("The symbol a lean tmct_context bundle was built for."),
291
291
  example: { symbol: "django/utils/text.py" },
292
292
  },
293
+ {
294
+ name: "tmct_export",
295
+ tier: "cold",
296
+ summary: "Every stored memory fact as JSONL (subject/predicate/object/provenance) — the shape `tmct extract` emits, for backup or audit.",
297
+ inputSchema: { type: "object", required: [], properties: {} },
298
+ example: {},
299
+ },
293
300
  ]);
294
301
 
295
302
  export const HOT_TOOLS = TOOL_DEFINITIONS.filter((t) => t.tier === "hot");
@@ -28,6 +28,7 @@ import { tmct_callers } from "./tmct-callers.mjs";
28
28
  import { tmct_callees } from "./tmct-callees.mjs";
29
29
  import { tmct_calls } from "./tmct-calls.mjs";
30
30
  import { tmct_cochanges } from "./tmct-cochanges.mjs";
31
+ import { tmct_export } from "./tmct-export.mjs";
31
32
 
32
33
  export const HANDLERS = Object.freeze({
33
34
  tmct_context,
@@ -53,4 +54,5 @@ export const HANDLERS = Object.freeze({
53
54
  tmct_callees,
54
55
  tmct_calls,
55
56
  tmct_cochanges,
57
+ tmct_export,
56
58
  });
@@ -0,0 +1,26 @@
1
+ // tmct_export — the memory store's every Fact as JSONL, one
2
+ // {subject, predicate, object, provenance} object per line, in the same shape
3
+ // `tmct extract` and `tmct memory --export` emit. A triple-store dump for
4
+ // backup or audit; provenance rides on every line, so a re-import keeps it.
5
+ //
6
+ // Reads the conversational-memory store (not the code-map graph), so it owns
7
+ // its own load and answers with or without a code graph present.
8
+
9
+ import { serializeFactsJsonl } from "../../adapters/memory/export-jsonl.mjs";
10
+ import { dirname } from "node:path";
11
+ import { loadMemory, openConfiguredMemoryBackend } from "../../adapters/memory/core.mjs";
12
+
13
+ export async function tmct_export(_args, { config }) {
14
+ const { dir, close } = await openConfiguredMemoryBackend(dirname(dirname(config.graphFile)));
15
+ try {
16
+ const jsonl = serializeFactsJsonl(await loadMemory(dir));
17
+ return jsonl || "(the memory store holds no facts to export)";
18
+ } finally {
19
+ await close();
20
+ }
21
+ }
22
+
23
+ // The memory store is this tool's only source — it answers with or without a
24
+ // code-map graph, so the shared code-graph load (which refuses an empty graph)
25
+ // must not gate it.
26
+ tmct_export.ownsGraphLoad = true;