@mneme-ai/mcp 1.17.6 → 1.18.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/README.md +64 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +76 -8
- package/dist/index.js.map +1 -1
- package/dist/mcp_primitives/completion.d.ts +19 -0
- package/dist/mcp_primitives/completion.d.ts.map +1 -0
- package/dist/mcp_primitives/completion.js +55 -0
- package/dist/mcp_primitives/completion.js.map +1 -0
- package/dist/mcp_primitives/prompts.d.ts +36 -0
- package/dist/mcp_primitives/prompts.d.ts.map +1 -0
- package/dist/mcp_primitives/prompts.js +140 -0
- package/dist/mcp_primitives/prompts.js.map +1 -0
- package/dist/mcp_primitives/resources.d.ts +30 -0
- package/dist/mcp_primitives/resources.d.ts.map +1 -0
- package/dist/mcp_primitives/resources.js +112 -0
- package/dist/mcp_primitives/resources.js.map +1 -0
- package/dist/tools/_aletheia.d.ts +82 -0
- package/dist/tools/_aletheia.d.ts.map +1 -0
- package/dist/tools/_aletheia.js +800 -0
- package/dist/tools/_aletheia.js.map +1 -0
- package/dist/tools/_confess.d.ts +67 -0
- package/dist/tools/_confess.d.ts.map +1 -0
- package/dist/tools/_confess.js +260 -0
- package/dist/tools/_confess.js.map +1 -0
- package/dist/tools/_confess.test.d.ts +6 -0
- package/dist/tools/_confess.test.d.ts.map +1 -0
- package/dist/tools/_confess.test.js +96 -0
- package/dist/tools/_confess.test.js.map +1 -0
- package/dist/tools/_contract.test.d.ts +19 -0
- package/dist/tools/_contract.test.d.ts.map +1 -0
- package/dist/tools/_contract.test.js +117 -0
- package/dist/tools/_contract.test.js.map +1 -0
- package/dist/tools/_court.d.ts +57 -0
- package/dist/tools/_court.d.ts.map +1 -0
- package/dist/tools/_court.js +261 -0
- package/dist/tools/_court.js.map +1 -0
- package/dist/tools/_court.test.d.ts +8 -0
- package/dist/tools/_court.test.d.ts.map +1 -0
- package/dist/tools/_court.test.js +111 -0
- package/dist/tools/_court.test.js.map +1 -0
- package/dist/tools/_genome_marketplace.d.ts +83 -0
- package/dist/tools/_genome_marketplace.d.ts.map +1 -0
- package/dist/tools/_genome_marketplace.js +410 -0
- package/dist/tools/_genome_marketplace.js.map +1 -0
- package/dist/tools/_genome_marketplace.test.d.ts +5 -0
- package/dist/tools/_genome_marketplace.test.d.ts.map +1 -0
- package/dist/tools/_genome_marketplace.test.js +157 -0
- package/dist/tools/_genome_marketplace.test.js.map +1 -0
- package/dist/tools/_mesh.d.ts +51 -0
- package/dist/tools/_mesh.d.ts.map +1 -0
- package/dist/tools/_mesh.js +182 -0
- package/dist/tools/_mesh.js.map +1 -0
- package/dist/tools/_registry.d.ts.map +1 -1
- package/dist/tools/_registry.js +17 -0
- package/dist/tools/_registry.js.map +1 -1
- package/dist/tools/_replay.d.ts +52 -0
- package/dist/tools/_replay.d.ts.map +1 -0
- package/dist/tools/_replay.js +253 -0
- package/dist/tools/_replay.js.map +1 -0
- package/dist/tools/_replay.test.d.ts +5 -0
- package/dist/tools/_replay.test.d.ts.map +1 -0
- package/dist/tools/_replay.test.js +90 -0
- package/dist/tools/_replay.test.js.map +1 -0
- package/dist/tools/_timetravel.d.ts +46 -0
- package/dist/tools/_timetravel.d.ts.map +1 -0
- package/dist/tools/_timetravel.js +243 -0
- package/dist/tools/_timetravel.js.map +1 -0
- package/dist/tools/_timetravel.test.d.ts +7 -0
- package/dist/tools/_timetravel.test.d.ts.map +1 -0
- package/dist/tools/_timetravel.test.js +31 -0
- package/dist/tools/_timetravel.test.js.map +1 -0
- package/dist/tools/_tool_meta.d.ts +30 -0
- package/dist/tools/_tool_meta.d.ts.map +1 -0
- package/dist/tools/_tool_meta.js +530 -0
- package/dist/tools/_tool_meta.js.map +1 -0
- package/dist/tools/_types.d.ts +46 -5
- package/dist/tools/_types.d.ts.map +1 -1
- package/dist/tools/_types.js.map +1 -1
- package/dist/tools/_verify_claims_tool.d.ts.map +1 -1
- package/dist/tools/_verify_claims_tool.js +23 -0
- package/dist/tools/_verify_claims_tool.js.map +1 -1
- package/dist/tools/audit.d.ts.map +1 -1
- package/dist/tools/audit.js +37 -0
- package/dist/tools/audit.js.map +1 -1
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +23 -0
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/quant.d.ts +10 -2
- package/dist/tools/quant.d.ts.map +1 -1
- package/dist/tools/quant.js +311 -18
- package/dist/tools/quant.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-travel MCP (v1.18.0 — black sheep #2)
|
|
3
|
+
*
|
|
4
|
+
* Snap the AI agent's view of the repo to a specific git ref. Every
|
|
5
|
+
* subsequent tool call (within the same MCP server process) operates
|
|
6
|
+
* AS IF today were that ref. State is per-server-process, so two AI
|
|
7
|
+
* sessions connecting to the same repo via separate MCP processes
|
|
8
|
+
* don't collide.
|
|
9
|
+
*
|
|
10
|
+
* • mneme.timetravel.activate(ref) — freeze the view at this ref
|
|
11
|
+
* • mneme.timetravel.status — query current state
|
|
12
|
+
* • mneme.timetravel.deactivate — return to live HEAD
|
|
13
|
+
*
|
|
14
|
+
* v1.18.0 ships the SCAFFOLDING — a per-process state holder + the
|
|
15
|
+
* three tools above. Existing tools that want to honor time-travel
|
|
16
|
+
* read `getTimeTravelState()` from this module and clamp their git
|
|
17
|
+
* commands to `--until <commitDate>` or `<ref>` accordingly. The
|
|
18
|
+
* gradual-rollout pattern: tools opt in over time without a big-bang
|
|
19
|
+
* refactor.
|
|
20
|
+
*
|
|
21
|
+
* Use cases:
|
|
22
|
+
* • Counterfactual analysis: "If I were on duty Sept 2024, what
|
|
23
|
+
* would I have seen?" — recreate incident-response state.
|
|
24
|
+
* • Hindsight-bias audit: "Did the AI's recommendation REALLY hold
|
|
25
|
+
* up at the time?" — replay decisions against frozen context.
|
|
26
|
+
* • Onboarding rehearsal: walk a new engineer through the repo at
|
|
27
|
+
* the moment they would have joined.
|
|
28
|
+
*/
|
|
29
|
+
import { spawnSync } from "node:child_process";
|
|
30
|
+
/** Per-process state. MCP server runs one process per AI client session,
|
|
31
|
+
* so this naturally scopes to that session. */
|
|
32
|
+
let state = {
|
|
33
|
+
active: false,
|
|
34
|
+
ref: null,
|
|
35
|
+
resolvedHash: null,
|
|
36
|
+
resolvedDate: null,
|
|
37
|
+
activatedAt: null,
|
|
38
|
+
};
|
|
39
|
+
/** Read current time-travel state — exported for tools that opt in. */
|
|
40
|
+
export function getTimeTravelState() {
|
|
41
|
+
return state;
|
|
42
|
+
}
|
|
43
|
+
/** Reset to live HEAD. Exported for tests. */
|
|
44
|
+
export function resetTimeTravel() {
|
|
45
|
+
state = { active: false, ref: null, resolvedHash: null, resolvedDate: null, activatedAt: null };
|
|
46
|
+
}
|
|
47
|
+
function resolveRef(repoRoot, ref) {
|
|
48
|
+
// Validate against shell metacharacters before spawning.
|
|
49
|
+
if (!/^[a-zA-Z0-9._\-/^~@]+$/.test(ref)) {
|
|
50
|
+
return { error: `invalid ref shape: ${ref}` };
|
|
51
|
+
}
|
|
52
|
+
const r = spawnSync("git", ["log", "-1", "--pretty=format:%H|%cI|%s", ref], {
|
|
53
|
+
cwd: repoRoot,
|
|
54
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
55
|
+
encoding: "utf8",
|
|
56
|
+
});
|
|
57
|
+
if (r.status !== 0) {
|
|
58
|
+
return { error: `git could not resolve '${ref}': ${(r.stderr ?? "").trim().slice(0, 200)}` };
|
|
59
|
+
}
|
|
60
|
+
const out = (r.stdout ?? "").trim();
|
|
61
|
+
if (!out)
|
|
62
|
+
return { error: `ref '${ref}' resolved to empty result` };
|
|
63
|
+
const [hash, date, ...rest] = out.split("|");
|
|
64
|
+
if (!hash || !date)
|
|
65
|
+
return { error: `unparseable git output for '${ref}'` };
|
|
66
|
+
return { hash, date, subject: rest.join("|") };
|
|
67
|
+
}
|
|
68
|
+
export const timeTravelActivateTool = {
|
|
69
|
+
name: "mneme.timetravel.activate",
|
|
70
|
+
category: "meta",
|
|
71
|
+
description: "Freeze the AI agent's view of the repo at a specific git ref (commit hash, " +
|
|
72
|
+
"tag, branch, or relative ref like 'HEAD~50'). Every subsequent Mneme tool " +
|
|
73
|
+
"call within this MCP session operates AS IF today were that ref. Use WHEN " +
|
|
74
|
+
"you want to (a) recreate an incident-response state at a past moment, " +
|
|
75
|
+
"(b) audit hindsight bias by replaying decisions against frozen context, " +
|
|
76
|
+
"or (c) walk through the repo as a new engineer would have seen it on day one.",
|
|
77
|
+
whenToUse: "You want every subsequent Mneme call to operate AS IF today were a specific past commit — counterfactual / hindsight analysis.",
|
|
78
|
+
triggers: [
|
|
79
|
+
"freeze view at this commit",
|
|
80
|
+
"time travel to ref",
|
|
81
|
+
"what would I see at HEAD~50",
|
|
82
|
+
],
|
|
83
|
+
inputSchema: {
|
|
84
|
+
type: "object",
|
|
85
|
+
properties: {
|
|
86
|
+
ref: {
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Git ref to freeze at — commit hash, tag, branch, or relative (e.g. 'HEAD~50', 'v1.5.0', 'a3f9b21').",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
required: ["ref"],
|
|
92
|
+
},
|
|
93
|
+
outputSchema: {
|
|
94
|
+
type: "object",
|
|
95
|
+
properties: {
|
|
96
|
+
active: { type: "boolean" },
|
|
97
|
+
ref: { type: "string" },
|
|
98
|
+
resolvedHash: { type: "string" },
|
|
99
|
+
resolvedDate: { type: "string" },
|
|
100
|
+
subject: { type: "string" },
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
examples: [
|
|
104
|
+
{
|
|
105
|
+
userQuery: "Show me what the repo looked like at v1.5.0",
|
|
106
|
+
args: { ref: "v1.5.0" },
|
|
107
|
+
expectedOutput: "{ active: true, ref: 'v1.5.0', resolvedHash, resolvedDate, subject }. Subsequent tool calls that opt-in operate against this frozen ref.",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
userQuery: "Recreate September 2024 — go back 200 commits",
|
|
111
|
+
args: { ref: "HEAD~200" },
|
|
112
|
+
expectedOutput: "Same shape — the resolvedDate tells you what calendar date HEAD~200 lands on.",
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
pitfalls: [
|
|
116
|
+
"v1.18.0 ships the scaffolding — most tools DON'T yet honor the frozen ref. They'll silently use HEAD until each tool opts in over the v1.18 → v1.19 window.",
|
|
117
|
+
"State is per-MCP-process — restarting the server resets to live HEAD. Don't depend on persistence across server restarts.",
|
|
118
|
+
"Refs that don't resolve (deleted branches, typos, hashes from another repo) return an error and DO NOT activate.",
|
|
119
|
+
],
|
|
120
|
+
composeWith: ["mneme.timetravel.status", "mneme.timetravel.deactivate"],
|
|
121
|
+
handler: async (rt, args) => {
|
|
122
|
+
const ref = String(args["ref"] ?? "").trim();
|
|
123
|
+
if (!ref) {
|
|
124
|
+
return {
|
|
125
|
+
data: { error: "missing required argument: ref" },
|
|
126
|
+
wisdom: "Pass a git ref — commit hash, tag, branch, or 'HEAD~N'.",
|
|
127
|
+
confidence: { level: "high" },
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
const resolved = resolveRef(rt.meta.rootPath, ref);
|
|
131
|
+
if ("error" in resolved) {
|
|
132
|
+
return {
|
|
133
|
+
data: { active: false, error: resolved.error },
|
|
134
|
+
wisdom: `Could not activate time-travel — ${resolved.error}`,
|
|
135
|
+
confidence: { level: "high" },
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
state = {
|
|
139
|
+
active: true,
|
|
140
|
+
ref,
|
|
141
|
+
resolvedHash: resolved.hash,
|
|
142
|
+
resolvedDate: resolved.date.slice(0, 10),
|
|
143
|
+
activatedAt: new Date().toISOString(),
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
data: {
|
|
147
|
+
active: true,
|
|
148
|
+
ref,
|
|
149
|
+
resolvedHash: resolved.hash,
|
|
150
|
+
resolvedDate: resolved.date.slice(0, 10),
|
|
151
|
+
subject: resolved.subject,
|
|
152
|
+
},
|
|
153
|
+
wisdom: `Time-travel active — view frozen at ${ref} (${resolved.hash.slice(0, 7)}, ${resolved.date.slice(0, 10)}). ` +
|
|
154
|
+
`Subsequent tool calls in this session that have opted in will operate as-of this ref. ` +
|
|
155
|
+
`Call mneme.timetravel.deactivate to return to live HEAD.`,
|
|
156
|
+
followUp: ["mneme.memory.ask", "mneme.timetravel.status", "mneme.timetravel.deactivate"],
|
|
157
|
+
confidence: { level: "high" },
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
export const timeTravelStatusTool = {
|
|
162
|
+
name: "mneme.timetravel.status",
|
|
163
|
+
category: "meta",
|
|
164
|
+
description: "Report whether time-travel is currently active in this MCP session and, if so, " +
|
|
165
|
+
"which ref + commit + date the view is frozen at. Use WHEN you want to verify " +
|
|
166
|
+
"the agent isn't accidentally querying historical state when it expects live HEAD.",
|
|
167
|
+
whenToUse: "You want to check whether the current MCP session has time-travel activated and what ref it's frozen at.",
|
|
168
|
+
triggers: ["am I time-traveling", "time travel status", "what ref am I on"],
|
|
169
|
+
inputSchema: { type: "object", properties: {} },
|
|
170
|
+
outputSchema: {
|
|
171
|
+
type: "object",
|
|
172
|
+
properties: {
|
|
173
|
+
active: { type: "boolean" },
|
|
174
|
+
ref: { type: "string" },
|
|
175
|
+
resolvedHash: { type: "string" },
|
|
176
|
+
resolvedDate: { type: "string" },
|
|
177
|
+
activatedAt: { type: "string" },
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
examples: [
|
|
181
|
+
{
|
|
182
|
+
userQuery: "Am I currently time-traveling?",
|
|
183
|
+
expectedOutput: "Returns { active: false } when not active, or the full state record when active.",
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
pitfalls: [
|
|
187
|
+
"State is per-MCP-process. If you restart the MCP server, this returns active=false even if a previous session activated time-travel.",
|
|
188
|
+
],
|
|
189
|
+
composeWith: ["mneme.timetravel.activate", "mneme.timetravel.deactivate"],
|
|
190
|
+
handler: async () => {
|
|
191
|
+
return {
|
|
192
|
+
data: state,
|
|
193
|
+
wisdom: state.active
|
|
194
|
+
? `Time-travel ACTIVE — frozen at ${state.ref} (${state.resolvedHash?.slice(0, 7)}, ${state.resolvedDate}).`
|
|
195
|
+
: "Time-travel INACTIVE — operating on live HEAD.",
|
|
196
|
+
confidence: { level: "high" },
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
export const timeTravelDeactivateTool = {
|
|
201
|
+
name: "mneme.timetravel.deactivate",
|
|
202
|
+
category: "meta",
|
|
203
|
+
description: "Return the AI agent's view to live HEAD — undoes a previous mneme.timetravel.activate. " +
|
|
204
|
+
"Idempotent (safe to call when not currently active). Use WHEN you've finished " +
|
|
205
|
+
"a counterfactual / hindsight session and want subsequent calls to see today's state.",
|
|
206
|
+
whenToUse: "You finished time-traveling and want subsequent tool calls to see live HEAD again.",
|
|
207
|
+
triggers: ["return to head", "stop time travel", "deactivate time travel"],
|
|
208
|
+
inputSchema: { type: "object", properties: {} },
|
|
209
|
+
outputSchema: {
|
|
210
|
+
type: "object",
|
|
211
|
+
properties: {
|
|
212
|
+
previouslyActive: { type: "boolean" },
|
|
213
|
+
previousRef: { type: "string" },
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
examples: [
|
|
217
|
+
{
|
|
218
|
+
userQuery: "Return to live HEAD",
|
|
219
|
+
expectedOutput: "{ previouslyActive: true|false, previousRef }. Idempotent — safe even when not active.",
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
pitfalls: [
|
|
223
|
+
"Doesn't unwind any side effects from time-traveled tools — only resets the time-travel marker.",
|
|
224
|
+
],
|
|
225
|
+
composeWith: ["mneme.timetravel.activate", "mneme.timetravel.status"],
|
|
226
|
+
handler: async () => {
|
|
227
|
+
const prev = { previouslyActive: state.active, previousRef: state.ref };
|
|
228
|
+
resetTimeTravel();
|
|
229
|
+
return {
|
|
230
|
+
data: prev,
|
|
231
|
+
wisdom: prev.previouslyActive
|
|
232
|
+
? `Returned to live HEAD (was at ${prev.previousRef}).`
|
|
233
|
+
: "Was already on live HEAD — no change.",
|
|
234
|
+
confidence: { level: "high" },
|
|
235
|
+
};
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
export const timeTravelTools = [
|
|
239
|
+
timeTravelActivateTool,
|
|
240
|
+
timeTravelStatusTool,
|
|
241
|
+
timeTravelDeactivateTool,
|
|
242
|
+
];
|
|
243
|
+
//# sourceMappingURL=_timetravel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_timetravel.js","sourceRoot":"","sources":["../../src/tools/_timetravel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAW/C;gDACgD;AAChD,IAAI,KAAK,GAAoB;IAC3B,MAAM,EAAE,KAAK;IACb,GAAG,EAAE,IAAI;IACT,YAAY,EAAE,IAAI;IAClB,YAAY,EAAE,IAAI;IAClB,WAAW,EAAE,IAAI;CAClB,CAAC;AAEF,uEAAuE;AACvE,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8CAA8C;AAC9C,MAAM,UAAU,eAAe;IAC7B,KAAK,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;AAClG,CAAC;AAQD,SAAS,UAAU,CAAC,QAAgB,EAAE,GAAW;IAC/C,yDAAyD;IACzD,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACxC,OAAO,EAAE,KAAK,EAAE,sBAAsB,GAAG,EAAE,EAAE,CAAC;IAChD,CAAC;IACD,MAAM,CAAC,GAAG,SAAS,CAAC,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,yFAAyF;QACzF,gFAAgF;QAChF,sFAAsF;IACxF,SAAS,EAAE,oFAAoF;IAC/F,QAAQ,EAAE,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,wBAAwB,CAAC;IAC1E,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/C,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,gBAAgB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;YACrC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAChC;KACF;IACD,QAAQ,EAAE;QACR;YACE,SAAS,EAAE,qBAAqB;YAChC,cAAc,EAAE,wFAAwF;SACzG;KACF;IACD,QAAQ,EAAE;QACR,gGAAgG;KACjG;IACD,WAAW,EAAE,CAAC,2BAA2B,EAAE,yBAAyB,CAAC;IACrE,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,MAAM,IAAI,GAAG,EAAE,gBAAgB,EAAE,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;QACxE,eAAe,EAAE,CAAC;QAClB,OAAO;YACL,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI,CAAC,gBAAgB;gBAC3B,CAAC,CAAC,iCAAiC,IAAI,CAAC,WAAW,IAAI;gBACvD,CAAC,CAAC,uCAAuC;YAC3C,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE;SAC9B,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,sBAAsB;IACtB,oBAAoB;IACpB,wBAAwB;CACzB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-travel — tests for the per-process state machine. We don't test
|
|
3
|
+
* git resolution here (that's a runtime concern); we test that the
|
|
4
|
+
* state holder transitions correctly and stays per-process.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=_timetravel.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_timetravel.test.d.ts","sourceRoot":"","sources":["../../src/tools/_timetravel.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Time-travel — tests for the per-process state machine. We don't test
|
|
3
|
+
* git resolution here (that's a runtime concern); we test that the
|
|
4
|
+
* state holder transitions correctly and stays per-process.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, it, beforeEach } from "vitest";
|
|
7
|
+
import { getTimeTravelState, resetTimeTravel } from "./_timetravel.js";
|
|
8
|
+
describe("Time-travel state machine", () => {
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
resetTimeTravel();
|
|
11
|
+
});
|
|
12
|
+
it("starts inactive on a fresh process", () => {
|
|
13
|
+
const s = getTimeTravelState();
|
|
14
|
+
expect(s.active).toBe(false);
|
|
15
|
+
expect(s.ref).toBeNull();
|
|
16
|
+
expect(s.resolvedHash).toBeNull();
|
|
17
|
+
});
|
|
18
|
+
it("resetTimeTravel returns state to inactive", () => {
|
|
19
|
+
// Manually flip to active by simulating what activate would do —
|
|
20
|
+
// we can't call the tool handler without a runtime, but we can
|
|
21
|
+
// verify resetTimeTravel always returns to the inactive shape.
|
|
22
|
+
resetTimeTravel();
|
|
23
|
+
const s = getTimeTravelState();
|
|
24
|
+
expect(s.active).toBe(false);
|
|
25
|
+
expect(s.ref).toBeNull();
|
|
26
|
+
expect(s.resolvedHash).toBeNull();
|
|
27
|
+
expect(s.resolvedDate).toBeNull();
|
|
28
|
+
expect(s.activatedAt).toBeNull();
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=_timetravel.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_timetravel.test.js","sourceRoot":"","sources":["../../src/tools/_timet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
|
1
|
+
/**
|
|
2
|
+
* Foundation tools (v1.18.0) — Tool Contract Schema introspection +
|
|
3
|
+
* discovery aids:
|
|
4
|
+
*
|
|
5
|
+
* • mneme.tool.contract(name) — return the full 6-field contract for one tool
|
|
6
|
+
* (WHEN, INPUT, OUTPUT, EXAMPLES, PITFALLS, COMPOSE_WITH, JARGON).
|
|
7
|
+
* • mneme.tool.lint — scan every registered tool, score the
|
|
8
|
+
* contract quality, return a prioritized punch-list of weak/missing fields.
|
|
9
|
+
* • mneme.help(query) — sub-50ms top-5 tool matcher for free-text
|
|
10
|
+
* queries. Lighter-weight than understand_intent (no execution plan,
|
|
11
|
+
* no arg extraction — just "which tools are about this?").
|
|
12
|
+
* • mneme.whats_new(lastSeenHash?) — diff vs the catalog hash an agent
|
|
13
|
+
* remembered from a previous session. Returns adds / removes /
|
|
14
|
+
* description-changes so the agent can update its mental model
|
|
15
|
+
* without re-reading the entire catalog.
|
|
16
|
+
*
|
|
17
|
+
* All four are pure (no repo state, no LLM, no embedder) — safe to call
|
|
18
|
+
* from any agent at any time. They form the discovery surface that lets
|
|
19
|
+
* AI agents stay in sync with Mneme as it evolves.
|
|
20
|
+
*/
|
|
21
|
+
import type { MnemeTool } from "./_types.js";
|
|
22
|
+
/** SHA-256 of the JSON-stringified catalog snapshot. Stable across runs. */
|
|
23
|
+
export declare function computeCatalogHash(): string;
|
|
24
|
+
export declare const toolContractTool: MnemeTool;
|
|
25
|
+
export declare const toolLintTool: MnemeTool;
|
|
26
|
+
export declare const helpTool: MnemeTool;
|
|
27
|
+
export declare const whatsNewTool: MnemeTool;
|
|
28
|
+
/** All four Foundation v1.18.0 tools — registered in the registry as a group. */
|
|
29
|
+
export declare const toolMetaTools: MnemeTool[];
|
|
30
|
+
//# sourceMappingURL=_tool_meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_tool_meta.d.ts","sourceRoot":"","sources":["../../src/tools/_tool_meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,aAAa,CAAC;AAoC1D,4EAA4E;AAC5E,wBAAgB,kBAAkB,IAAI,MAAM,CAG3C;AAID,eAAO,MAAM,gBAAgB,EAAE,SAsG9B,CAAC;AAiEF,eAAO,MAAM,YAAY,EAAE,SA8F1B,CAAC;AA0CF,eAAO,MAAM,QAAQ,EAAE,SAoFtB,CAAC;AAIF,eAAO,MAAM,YAAY,EAAE,SAqG1B,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,aAAa,EAAE,SAAS,EAA6D,CAAC"}
|