@monnet/mcp 0.2.4 → 0.4.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 (40) hide show
  1. package/README.md +20 -27
  2. package/dist/approval.d.ts +19 -11
  3. package/dist/approval.js +73 -52
  4. package/dist/approval.js.map +1 -1
  5. package/dist/client.js +1 -1
  6. package/dist/client.js.map +1 -1
  7. package/dist/index.js +10 -44
  8. package/dist/index.js.map +1 -1
  9. package/dist/instructions.d.ts +15 -0
  10. package/dist/instructions.js +31 -0
  11. package/dist/instructions.js.map +1 -0
  12. package/dist/registry.d.ts +95 -0
  13. package/dist/registry.js +50 -0
  14. package/dist/registry.js.map +1 -0
  15. package/dist/rendering/motion.d.ts +4 -12
  16. package/dist/rendering/motion.js +10 -26
  17. package/dist/rendering/motion.js.map +1 -1
  18. package/dist/test-env.d.ts +15 -0
  19. package/dist/test-env.js +17 -0
  20. package/dist/test-env.js.map +1 -0
  21. package/dist/tools/wiki/_common.d.ts +102 -0
  22. package/dist/tools/wiki/_common.js +132 -0
  23. package/dist/tools/wiki/_common.js.map +1 -0
  24. package/dist/tools/wiki/index.d.ts +21 -0
  25. package/dist/tools/wiki/index.js +48 -0
  26. package/dist/tools/wiki/index.js.map +1 -0
  27. package/dist/tools/wiki/read.d.ts +68 -0
  28. package/dist/tools/wiki/read.js +114 -0
  29. package/dist/tools/wiki/read.js.map +1 -0
  30. package/dist/tools/wiki/sources.d.ts +114 -0
  31. package/dist/tools/wiki/sources.js +288 -0
  32. package/dist/tools/wiki/sources.js.map +1 -0
  33. package/dist/tools/wiki/write.d.ts +174 -0
  34. package/dist/tools/wiki/write.js +280 -0
  35. package/dist/tools/wiki/write.js.map +1 -0
  36. package/package.json +3 -8
  37. package/LICENSE +0 -21
  38. package/dist/tools/get-workspace-memory.d.ts +0 -15
  39. package/dist/tools/get-workspace-memory.js +0 -35
  40. package/dist/tools/get-workspace-memory.js.map +0 -1
@@ -0,0 +1,280 @@
1
+ import { z } from "zod";
2
+ import { apiFetch, resolveWorkspaceId } from "../../client.js";
3
+ import { PAGE_ID_PROPERTY, WORKSPACE_SLUG_PROPERTY, lastChildId, lookUpFolder, normaliseFolderPath, wikiBase, } from "./_common.js";
4
+ // `MAX_NAME_LENGTH` in backend/adapters/inbound/schemas/wiki/wiki_schemas.py
5
+ // is the source of truth. Nothing on this side can import it, so it is
6
+ // restated — too generous here and an over-long title passes zod only to come
7
+ // back as a raw validation blob the model has to interpret.
8
+ const MAX_NAME_LENGTH = 120;
9
+ const FOLDER_PATH_PROPERTY = {
10
+ type: "string",
11
+ description: "Path of an existing folder, as shown by get_wiki_tree (e.g. 'Product/Design'). Omit to place this at the wiki root — which is the right default: open a folder only once a subject carries several pages.",
12
+ };
13
+ /* ------------------------------------------------------------ create page */
14
+ const CreatePageArgs = z.object({
15
+ workspace_slug: z.string().min(1),
16
+ title: z.string().min(1).max(MAX_NAME_LENGTH),
17
+ body: z.string().max(500_000).default(""),
18
+ folder_path: z.string().optional(),
19
+ });
20
+ export async function handleCreateWikiPage(args) {
21
+ const { workspace_slug, title, body, folder_path } = CreatePageArgs.parse(args);
22
+ const base = await wikiBase(workspace_slug);
23
+ const folder = await lookUpFolder(workspace_slug, folder_path);
24
+ if ("error" in folder)
25
+ return folder.error;
26
+ const folderId = folder.id;
27
+ const page = await apiFetch(`${base}/pages`, {
28
+ method: "POST",
29
+ body: JSON.stringify({ title, body, folder_id: folderId }),
30
+ });
31
+ // The id is handed back on purpose: nothing can link to this page until
32
+ // another page carries it, and reconstructing it from the title is the
33
+ // mistake the backend's link check exists to catch.
34
+ return `Created "${page.title}" (id: ${page.id}). Link to it as [${page.title}](?page=${page.id}).`;
35
+ }
36
+ export const CREATE_WIKI_PAGE_TOOL_DEFINITION = {
37
+ name: "create_wiki_page",
38
+ description: "Create a page in the company brain. Call get_wiki_tree first: most material belongs on a page that already exists, and a brain with one page per source is a filing cabinet, not a brain. " +
39
+ "Links in the body are verified against the workspace before the page is written — a link that resolves to nothing rejects the whole call, naming the target.",
40
+ inputSchema: {
41
+ type: "object",
42
+ properties: {
43
+ workspace_slug: WORKSPACE_SLUG_PROPERTY,
44
+ title: { type: "string", description: "The page's title, which is also its name in the tree." },
45
+ body: { type: "string", description: "Markdown. Follow the templates in get_wiki_schema — and skip a section rather than filling it with nothing." },
46
+ folder_path: FOLDER_PATH_PROPERTY,
47
+ },
48
+ required: ["workspace_slug", "title"],
49
+ },
50
+ };
51
+ /* -------------------------------------------------------------- edit page */
52
+ const EditPageArgs = z
53
+ .object({
54
+ workspace_slug: z.string().min(1),
55
+ page_id: z.string().min(1),
56
+ title: z.string().min(1).max(MAX_NAME_LENGTH).optional(),
57
+ // `.min(1)`: an empty match string is not a no-op. `"Hello".split("")`
58
+ // is five pieces, so `replace_all` would interleave new_string between
59
+ // every character and write the wreckage — with a version cut over it.
60
+ old_string: z.string().min(1).optional(),
61
+ new_string: z.string().optional(),
62
+ replace_all: z.boolean().default(false),
63
+ })
64
+ .refine((a) => a.title !== undefined || a.old_string !== undefined, {
65
+ message: "Give a title, or old_string with new_string.",
66
+ });
67
+ export async function handleEditWikiPage(args) {
68
+ const parsed = EditPageArgs.parse(args);
69
+ const { workspace_slug, page_id, title, old_string, new_string, replace_all } = parsed;
70
+ const base = await wikiBase(workspace_slug);
71
+ const updates = {};
72
+ if (title !== undefined)
73
+ updates.title = title;
74
+ if (old_string !== undefined) {
75
+ if (new_string === undefined)
76
+ return "Error: old_string needs new_string. To delete text, pass an empty new_string.";
77
+ // Read-modify-write, client side. The route takes a whole body because
78
+ // that is what a REST caller sends; old_string/new_string is the shape an
79
+ // LLM edits in, and is the same one Monnet's own edit_wiki_page offers.
80
+ const wsId = await resolveWorkspaceId(workspace_slug);
81
+ const { motion } = await apiFetch(`/workspaces/${wsId}/motions/${encodeURIComponent(page_id)}/detail`);
82
+ const current = motion.body || "";
83
+ const occurrences = current.split(old_string).length - 1;
84
+ if (occurrences === 0) {
85
+ return "Error: old_string not found in this page. Read it first with read_wiki_page — whitespace and line breaks have to match exactly.";
86
+ }
87
+ if (occurrences > 1 && !replace_all) {
88
+ return `Error: old_string appears ${occurrences} times. Include more surrounding text to make it unique, or pass replace_all.`;
89
+ }
90
+ // Never `String.replace`. Even with a plain-string search value it runs
91
+ // the `$` substitution rules on the REPLACEMENT: `$&` re-inserts the
92
+ // matched text (so the edit silently does not happen) and `$$` collapses
93
+ // to `$`. A page holding LaTeX, a price, or a shell snippet would come
94
+ // back altered, with no error — and differently depending on
95
+ // `replace_all`, since that branch already used split/join.
96
+ const pieces = current.split(old_string);
97
+ updates.body = replace_all
98
+ ? pieces.join(new_string)
99
+ : pieces[0] + new_string + pieces.slice(1).join(old_string);
100
+ }
101
+ await apiFetch(`${base}/pages/${encodeURIComponent(page_id)}`, {
102
+ method: "PATCH",
103
+ body: JSON.stringify(updates),
104
+ });
105
+ return `Updated ${Object.keys(updates).join(" and ")} on page ${page_id}.`;
106
+ }
107
+ export const EDIT_WIKI_PAGE_TOOL_DEFINITION = {
108
+ name: "edit_wiki_page",
109
+ description: "Change a company-brain page: rename it, and/or replace an exact string in its body. Read the page first — the match is literal, whitespace included. " +
110
+ "When new material contradicts what a page says, correct the page at the source; never leave the stale fact and append a correction beside it. " +
111
+ "Links in the result are verified before the write lands, so a bad id rejects the call instead of leaving a dead link nobody sees.",
112
+ inputSchema: {
113
+ type: "object",
114
+ properties: {
115
+ workspace_slug: WORKSPACE_SLUG_PROPERTY,
116
+ page_id: PAGE_ID_PROPERTY,
117
+ title: { type: "string", description: "A new title. Renaming is safe — links point at the id, not the name." },
118
+ old_string: { type: "string", description: "The exact text to replace, copied from read_wiki_page." },
119
+ new_string: { type: "string", description: "What replaces it. Empty string deletes the matched text." },
120
+ replace_all: { type: "boolean", description: "Replace every occurrence instead of failing when old_string is ambiguous." },
121
+ },
122
+ required: ["workspace_slug", "page_id"],
123
+ },
124
+ };
125
+ /* ------------------------------------------------------------ delete page */
126
+ const DeletePageArgs = z.object({
127
+ workspace_slug: z.string().min(1),
128
+ page_id: z.string().min(1),
129
+ });
130
+ export async function handleDeleteWikiPage(args) {
131
+ const { workspace_slug, page_id } = DeletePageArgs.parse(args);
132
+ await apiFetch(`${await wikiBase(workspace_slug)}/pages/${encodeURIComponent(page_id)}`, {
133
+ method: "DELETE",
134
+ });
135
+ return `Deleted page ${page_id}. Any page still linking to it now has a dead link — search_wiki for its id and fix them.`;
136
+ }
137
+ export const DELETE_WIKI_PAGE_TOOL_DEFINITION = {
138
+ name: "delete_wiki_page",
139
+ description: "Delete a company-brain page, with its comments and its version history. Not reversible, and links pointing at it break. " +
140
+ "The user is asked to confirm before it happens, so do not ask them yourself first. " +
141
+ "Prefer editing a page that is wrong, or merging it into the one it duplicates — deleting is for a page that should never have existed.",
142
+ inputSchema: {
143
+ type: "object",
144
+ properties: { workspace_slug: WORKSPACE_SLUG_PROPERTY, page_id: PAGE_ID_PROPERTY },
145
+ required: ["workspace_slug", "page_id"],
146
+ },
147
+ };
148
+ /* ---------------------------------------------------------------- folders */
149
+ const CreateFolderArgs = z.object({
150
+ workspace_slug: z.string().min(1),
151
+ name: z.string().min(1).max(MAX_NAME_LENGTH),
152
+ parent_path: z.string().optional(),
153
+ });
154
+ export async function handleCreateWikiFolder(args) {
155
+ const { workspace_slug, name, parent_path } = CreateFolderArgs.parse(args);
156
+ const base = await wikiBase(workspace_slug);
157
+ const parent = await lookUpFolder(workspace_slug, parent_path);
158
+ if ("error" in parent)
159
+ return parent.error;
160
+ const folder = await apiFetch(`${base}/folders`, {
161
+ method: "POST",
162
+ body: JSON.stringify({ name, parent_id: parent.id }),
163
+ });
164
+ return `Created folder "${folder.name}" (id: ${folder.id}).`;
165
+ }
166
+ export const CREATE_WIKI_FOLDER_TOOL_DEFINITION = {
167
+ name: "create_wiki_folder",
168
+ description: "Create a folder in the company brain. Only once a subject already carries several pages that want holding together — a brain the size of a team's is a handful of folders and a couple of dozen pages, " +
169
+ "and a taxonomy built ahead of the pages mirrors the sources instead of compressing them.",
170
+ inputSchema: {
171
+ type: "object",
172
+ properties: {
173
+ workspace_slug: WORKSPACE_SLUG_PROPERTY,
174
+ name: { type: "string", description: "The folder's name." },
175
+ parent_path: { ...FOLDER_PATH_PROPERTY, description: "Path of the folder to nest this one in. Omit for the root." },
176
+ },
177
+ required: ["workspace_slug", "name"],
178
+ },
179
+ };
180
+ const RenameFolderArgs = z.object({
181
+ workspace_slug: z.string().min(1),
182
+ folder_path: z.string().min(1),
183
+ name: z.string().min(1).max(MAX_NAME_LENGTH),
184
+ });
185
+ export async function handleRenameWikiFolder(args) {
186
+ const { workspace_slug, folder_path, name } = RenameFolderArgs.parse(args);
187
+ const folder = await lookUpFolder(workspace_slug, folder_path);
188
+ if ("error" in folder)
189
+ return folder.error;
190
+ if (!folder.id)
191
+ return "Error: give the path of the folder to act on.";
192
+ const folderId = folder.id;
193
+ await apiFetch(`${await wikiBase(workspace_slug)}/folders/${folderId}`, {
194
+ method: "PATCH",
195
+ body: JSON.stringify({ name }),
196
+ });
197
+ return `Renamed "${folder_path}" to "${name}".`;
198
+ }
199
+ export const RENAME_WIKI_FOLDER_TOOL_DEFINITION = {
200
+ name: "rename_wiki_folder",
201
+ description: "Rename a company-brain folder. Safe — nothing links to a folder by name, and the pages inside keep their ids.",
202
+ inputSchema: {
203
+ type: "object",
204
+ properties: {
205
+ workspace_slug: WORKSPACE_SLUG_PROPERTY,
206
+ folder_path: { ...FOLDER_PATH_PROPERTY, description: "Path of the folder to rename, as shown by get_wiki_tree." },
207
+ name: { type: "string", description: "Its new name." },
208
+ },
209
+ required: ["workspace_slug", "folder_path", "name"],
210
+ },
211
+ };
212
+ const DeleteFolderArgs = z.object({
213
+ workspace_slug: z.string().min(1),
214
+ folder_path: z.string().min(1),
215
+ });
216
+ export async function handleDeleteWikiFolder(args) {
217
+ const { workspace_slug, folder_path } = DeleteFolderArgs.parse(args);
218
+ const folder = await lookUpFolder(workspace_slug, folder_path);
219
+ if ("error" in folder)
220
+ return folder.error;
221
+ if (!folder.id)
222
+ return "Error: give the path of the folder to act on.";
223
+ const folderId = folder.id;
224
+ await apiFetch(`${await wikiBase(workspace_slug)}/folders/${folderId}`, { method: "DELETE" });
225
+ return `Deleted folder "${folder_path}". The pages it held were moved up rather than deleted with it.`;
226
+ }
227
+ export const DELETE_WIKI_FOLDER_TOOL_DEFINITION = {
228
+ name: "delete_wiki_folder",
229
+ description: "Delete a company-brain folder. Its pages are re-parented, not deleted — deleting a folder never throws away a document. The user is asked to confirm before it happens.",
230
+ inputSchema: {
231
+ type: "object",
232
+ properties: {
233
+ workspace_slug: WORKSPACE_SLUG_PROPERTY,
234
+ folder_path: { ...FOLDER_PATH_PROPERTY, description: "Path of the folder to delete." },
235
+ },
236
+ required: ["workspace_slug", "folder_path"],
237
+ },
238
+ };
239
+ /* ------------------------------------------------------------------- move */
240
+ const MoveArgs = z.object({
241
+ workspace_slug: z.string().min(1),
242
+ node_id: z.string().min(1),
243
+ node_type: z.enum(["page", "folder"]),
244
+ destination_folder_path: z.string().optional(),
245
+ });
246
+ export async function handleMoveWikiNode(args) {
247
+ const { workspace_slug, node_id, node_type, destination_folder_path } = MoveArgs.parse(args);
248
+ const destination = normaliseFolderPath(destination_folder_path);
249
+ const folder = await lookUpFolder(workspace_slug, destination);
250
+ if ("error" in folder)
251
+ return folder.error;
252
+ const { tree, id: parentId } = folder;
253
+ await apiFetch(`${await wikiBase(workspace_slug)}/nodes/${encodeURIComponent(node_id)}/move`, {
254
+ method: "PATCH",
255
+ // `after_id` is not optional in practice: omitting it means "first" to
256
+ // the server's placement, so every agent move would take the top slot of
257
+ // the destination and push down an order the team set by hand.
258
+ body: JSON.stringify({
259
+ node_type,
260
+ parent_id: parentId,
261
+ after_id: lastChildId(tree, parentId, node_id),
262
+ }),
263
+ });
264
+ return `Moved ${node_type} ${node_id} to ${destination || "the wiki root"}.`;
265
+ }
266
+ export const MOVE_WIKI_NODE_TOOL_DEFINITION = {
267
+ name: "move_wiki_node",
268
+ description: "Move a page or a folder into another folder, or to the wiki root. Links survive a move — they point at the id, not the path — so reorganising is safe.",
269
+ inputSchema: {
270
+ type: "object",
271
+ properties: {
272
+ workspace_slug: WORKSPACE_SLUG_PROPERTY,
273
+ node_id: { type: "string", description: "Id of the page or folder to move, from get_wiki_tree." },
274
+ node_type: { type: "string", enum: ["page", "folder"], description: "Which of the two it is." },
275
+ destination_folder_path: { ...FOLDER_PATH_PROPERTY, description: "Path of the destination folder. Omit to move it to the root." },
276
+ },
277
+ required: ["workspace_slug", "node_id", "node_type"],
278
+ },
279
+ };
280
+ //# sourceMappingURL=write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../../src/tools/wiki/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,QAAQ,GACT,MAAM,cAAc,CAAC;AAEtB,6EAA6E;AAC7E,uEAAuE;AACvE,8EAA8E;AAC9E,4DAA4D;AAC5D,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,MAAM,oBAAoB,GAAG;IAC3B,IAAI,EAAE,QAAiB;IACvB,WAAW,EACT,2MAA2M;CAC9M,CAAC;AAEF,8EAA8E;AAE9E,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC;IAC7C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACzC,WAAW,E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
2
  "name": "@monnet/mcp",
3
- "version": "0.2.4",
4
- "mcpName": "ai.monnet/mcp",
3
+ "version": "0.4.0",
5
4
  "description": "Model Context Protocol server for Monnet — exposes motions, plans, and approvals to MCP-compatible clients like Claude Desktop and Cursor.",
6
- "license": "MIT",
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/GregoireCasoetto/monnet-mcp.git"
10
- },
11
5
  "type": "module",
12
6
  "bin": {
13
7
  "monnet-mcp": "dist/index.js"
@@ -20,7 +14,8 @@
20
14
  "build": "tsc -p .",
21
15
  "dev": "tsc -p . --watch",
22
16
  "start": "node dist/index.js",
23
- "prepublishOnly": "npm run build"
17
+ "prepublishOnly": "npm run build",
18
+ "test": "tsc -p tsconfig.test.json && node --test dist-test/**/*.test.js"
24
19
  },
25
20
  "dependencies": {
26
21
  "@modelcontextprotocol/sdk": "^1.13.0",
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Grégoire Casoetto
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,15 +0,0 @@
1
- export declare function handleGetWorkspaceMemory(args: unknown): Promise<string>;
2
- export declare const GET_WORKSPACE_MEMORY_TOOL_DEFINITION: {
3
- name: string;
4
- description: string;
5
- inputSchema: {
6
- type: "object";
7
- properties: {
8
- workspace_slug: {
9
- type: string;
10
- description: string;
11
- };
12
- };
13
- required: string[];
14
- };
15
- };
@@ -1,35 +0,0 @@
1
- import { z } from "zod";
2
- import { apiFetch } from "../client.js";
3
- const GetWorkspaceMemoryArgs = z.object({
4
- workspace_slug: z.string().min(1),
5
- });
6
- export async function handleGetWorkspaceMemory(args) {
7
- const { workspace_slug } = GetWorkspaceMemoryArgs.parse(args);
8
- const ws = await apiFetch(`/workspaces/by-slug/${encodeURIComponent(workspace_slug)}`);
9
- if (!ws.memory_content || !ws.memory_content.trim()) {
10
- return `No MEMORY.md has been synthesized yet for **${ws.name}** (slug: \`${ws.slug}\`). It is generated automatically as motions close.`;
11
- }
12
- return [
13
- `## MEMORY.md — ${ws.name} (slug: \`${ws.slug}\`)`,
14
- "",
15
- ws.memory_content.trim(),
16
- ].join("\n");
17
- }
18
- export const GET_WORKSPACE_MEMORY_TOOL_DEFINITION = {
19
- name: "get_workspace_memory",
20
- description: "Read a Monnet workspace's MEMORY.md — a concise, auto-synthesized digest of the workspace's " +
21
- "priorities, product decisions, recurring patterns, open threads, and team context, distilled from " +
22
- "closed motions. Use it to ground yourself in what the team already cares about and has decided, " +
23
- "without re-reading every motion.",
24
- inputSchema: {
25
- type: "object",
26
- properties: {
27
- workspace_slug: {
28
- type: "string",
29
- description: "The workspace slug (e.g. 'monnet-team-410b'). Call list_workspaces first if you don't know it.",
30
- },
31
- },
32
- required: ["workspace_slug"],
33
- },
34
- };
35
- //# sourceMappingURL=get-workspace-memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-workspace-memory.js","sourceRoot":"","sources":["../../src/tools/get-workspace-memory.ts"],"names":[],"mappings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