@chatroomcp/chatroom 0.1.4 → 0.1.6
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/dist/cli/index.js +0 -0
- package/dist/mcp/server/plugin-mcp-registrar.d.ts +26 -0
- package/dist/mcp/server/plugin-mcp-registrar.js +63 -0
- package/dist/mcp/server/tool-support.d.ts +1 -1
- package/dist/operations/operation-log.d.ts +4 -0
- package/dist/operations/operation-log.js +10 -0
- package/dist/plugins/cloud/api-client.d.ts +0 -6
- package/dist/plugins/cloud/api-client.js +0 -11
- package/dist/plugins/cloud/controller.d.ts +0 -1
- package/dist/plugins/cloud/controller.js +0 -12
- package/dist/plugins/cloud/tunnel-client.js +12 -5
- package/dist/plugins/plugin-manager.js +6 -2
- package/dist/plugins/process/mcp.d.ts +2 -3
- package/dist/plugins/process/mcp.js +25 -36
- package/dist/plugins/process/plugin.js +3 -6
- package/dist/plugins/process/process-supervisor.d.ts +1 -0
- package/dist/plugins/process/process-supervisor.js +21 -16
- package/dist/plugins/types.d.ts +2 -2
- package/dist/plugins/web/http/cloud-api-router.js +0 -12
- package/dist/plugins/workspace/mcp.d.ts +2 -3
- package/dist/plugins/workspace/mcp.js +38 -67
- package/dist/plugins/workspace/plugin.js +3 -6
- package/dist/web/assets/index-B7jL3mhD.css +1 -0
- package/dist/web/assets/index-L4-YdZVN.js +26 -0
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
- package/dist/web/assets/index-Cgwn3ot-.css +0 -1
- package/dist/web/assets/index-ClD90giy.js +0 -26
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { changeSetSchema, closedRead, destructiveLocalMutation, fileInfoSchema, fileReadOutputSchema, fileWriteOutputSchema, localMutation, localWrite,
|
|
3
|
-
export function registerWorkspaceTools(
|
|
4
|
-
|
|
2
|
+
import { changeSetSchema, closedRead, destructiveLocalMutation, fileInfoSchema, fileReadOutputSchema, fileWriteOutputSchema, localMutation, localWrite, searchMatchSchema, workspaceOutputSchema, } from "../../mcp/server/tool-support.js";
|
|
3
|
+
export function registerWorkspaceTools(mcp, workspaces) {
|
|
4
|
+
mcp.registerTool("open_workspace", {
|
|
5
5
|
title: "Open workspace",
|
|
6
6
|
description: "Open or reuse an approved checkout, or create a new isolated managed Git worktree from the source checkout HEAD.",
|
|
7
7
|
inputSchema: z.object({
|
|
@@ -10,11 +10,12 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
10
10
|
}),
|
|
11
11
|
outputSchema: workspaceOutputSchema,
|
|
12
12
|
annotations: localMutation,
|
|
13
|
-
|
|
13
|
+
action: "open",
|
|
14
|
+
}, (input) => workspaces.open({
|
|
14
15
|
path: input.path,
|
|
15
16
|
...(input.mode ? { mode: input.mode } : {}),
|
|
16
|
-
}))
|
|
17
|
-
|
|
17
|
+
}));
|
|
18
|
+
mcp.registerTool("remove_workspace", {
|
|
18
19
|
title: "Remove workspace",
|
|
19
20
|
description: "Unregister a checkout workspace or remove a managed worktree. Dirty worktrees require force=true.",
|
|
20
21
|
inputSchema: z.object({
|
|
@@ -27,17 +28,12 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
27
28
|
mode: z.enum(["checkout", "worktree"]),
|
|
28
29
|
}),
|
|
29
30
|
annotations: destructiveLocalMutation,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
source: "mcp",
|
|
34
|
-
action: "remove",
|
|
35
|
-
workspaceId: input.workspaceId,
|
|
36
|
-
input,
|
|
37
|
-
}, () => workspaces.remove(input.workspaceId, input.force ?? false));
|
|
31
|
+
action: "remove",
|
|
32
|
+
}, async (input) => {
|
|
33
|
+
const removed = await workspaces.remove(input.workspaceId, input.force ?? false);
|
|
38
34
|
return { removed: true, workspaceId: removed.id, mode: removed.mode };
|
|
39
|
-
})
|
|
40
|
-
|
|
35
|
+
});
|
|
36
|
+
mcp.registerTool("fs_read", {
|
|
41
37
|
title: "Read file",
|
|
42
38
|
description: "Read a workspace-relative file through the ChatRoom filesystem boundary.",
|
|
43
39
|
inputSchema: z.object({
|
|
@@ -52,17 +48,12 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
52
48
|
}),
|
|
53
49
|
outputSchema: fileReadOutputSchema,
|
|
54
50
|
annotations: closedRead,
|
|
55
|
-
|
|
51
|
+
action: "fs.read",
|
|
52
|
+
}, async (input) => {
|
|
56
53
|
const fs = await workspaces.fs(input.workspaceId);
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
action: "fs.read",
|
|
61
|
-
workspaceId: input.workspaceId,
|
|
62
|
-
input,
|
|
63
|
-
}, () => fs.read(input.path, input.maxBytes === undefined ? {} : { maxBytes: input.maxBytes }));
|
|
64
|
-
}));
|
|
65
|
-
server.registerTool("fs_write", {
|
|
54
|
+
return fs.read(input.path, input.maxBytes === undefined ? {} : { maxBytes: input.maxBytes });
|
|
55
|
+
});
|
|
56
|
+
mcp.registerTool("fs_write", {
|
|
66
57
|
title: "Write file",
|
|
67
58
|
description: "Atomically write a workspace-relative file.",
|
|
68
59
|
inputSchema: z.object({
|
|
@@ -72,17 +63,12 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
72
63
|
}),
|
|
73
64
|
outputSchema: fileWriteOutputSchema,
|
|
74
65
|
annotations: localWrite,
|
|
75
|
-
|
|
66
|
+
action: "fs.write",
|
|
67
|
+
}, async (input) => {
|
|
76
68
|
const fs = await workspaces.fs(input.workspaceId);
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
action: "fs.write",
|
|
81
|
-
workspaceId: input.workspaceId,
|
|
82
|
-
input,
|
|
83
|
-
}, () => fs.write(input.path, input.content));
|
|
84
|
-
}));
|
|
85
|
-
server.registerTool("fs_list", {
|
|
69
|
+
return fs.write(input.path, input.content);
|
|
70
|
+
});
|
|
71
|
+
mcp.registerTool("fs_list", {
|
|
86
72
|
title: "List files",
|
|
87
73
|
description: "List files under a workspace-relative directory.",
|
|
88
74
|
inputSchema: z.object({
|
|
@@ -92,19 +78,14 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
92
78
|
}),
|
|
93
79
|
outputSchema: z.object({ files: z.array(fileInfoSchema) }),
|
|
94
80
|
annotations: closedRead,
|
|
95
|
-
|
|
81
|
+
action: "fs.list",
|
|
82
|
+
}, async (input) => {
|
|
96
83
|
const fs = await workspaces.fs(input.workspaceId);
|
|
97
84
|
return {
|
|
98
|
-
files: await
|
|
99
|
-
pluginId: "workspace",
|
|
100
|
-
source: "mcp",
|
|
101
|
-
action: "fs.list",
|
|
102
|
-
workspaceId: input.workspaceId,
|
|
103
|
-
input,
|
|
104
|
-
}, () => fs.list(input.path, { recursive: input.recursive })),
|
|
85
|
+
files: await fs.list(input.path, { recursive: input.recursive }),
|
|
105
86
|
};
|
|
106
|
-
})
|
|
107
|
-
|
|
87
|
+
});
|
|
88
|
+
mcp.registerTool("fs_search", {
|
|
108
89
|
title: "Search files",
|
|
109
90
|
description: "Search text under a workspace.",
|
|
110
91
|
inputSchema: z.object({
|
|
@@ -115,22 +96,17 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
115
96
|
}),
|
|
116
97
|
outputSchema: z.object({ matches: z.array(searchMatchSchema) }),
|
|
117
98
|
annotations: closedRead,
|
|
118
|
-
|
|
99
|
+
action: "fs.search",
|
|
100
|
+
}, async (input) => {
|
|
119
101
|
const fs = await workspaces.fs(input.workspaceId);
|
|
120
102
|
return {
|
|
121
|
-
matches: await
|
|
122
|
-
pluginId: "workspace",
|
|
123
|
-
source: "mcp",
|
|
124
|
-
action: "fs.search",
|
|
125
|
-
workspaceId: input.workspaceId,
|
|
126
|
-
input,
|
|
127
|
-
}, () => fs.search(input.query, {
|
|
103
|
+
matches: await fs.search(input.query, {
|
|
128
104
|
path: input.path,
|
|
129
105
|
maxResults: input.maxResults,
|
|
130
|
-
})
|
|
106
|
+
}),
|
|
131
107
|
};
|
|
132
|
-
})
|
|
133
|
-
|
|
108
|
+
});
|
|
109
|
+
mcp.registerTool("fs_patch", {
|
|
134
110
|
title: "Transactional patch",
|
|
135
111
|
description: "Validate all replacements before committing a multi-file text patch.",
|
|
136
112
|
inputSchema: z.object({
|
|
@@ -148,21 +124,16 @@ export function registerWorkspaceTools(server, workspaces, operations) {
|
|
|
148
124
|
}),
|
|
149
125
|
outputSchema: changeSetSchema,
|
|
150
126
|
annotations: destructiveLocalMutation,
|
|
151
|
-
|
|
127
|
+
action: "fs.patch",
|
|
128
|
+
}, async (input) => {
|
|
152
129
|
const fs = await workspaces.fs(input.workspaceId);
|
|
153
|
-
return
|
|
154
|
-
pluginId: "workspace",
|
|
155
|
-
source: "mcp",
|
|
156
|
-
action: "fs.patch",
|
|
157
|
-
workspaceId: input.workspaceId,
|
|
158
|
-
input,
|
|
159
|
-
}, () => fs.patch(input.replacements.map((item) => ({
|
|
130
|
+
return fs.patch(input.replacements.map((item) => ({
|
|
160
131
|
path: item.path,
|
|
161
132
|
oldText: item.oldText,
|
|
162
133
|
newText: item.newText,
|
|
163
134
|
...(item.occurrence === undefined
|
|
164
135
|
? {}
|
|
165
136
|
: { occurrence: item.occurrence }),
|
|
166
|
-
})))
|
|
167
|
-
})
|
|
137
|
+
})));
|
|
138
|
+
});
|
|
168
139
|
}
|
|
@@ -10,7 +10,6 @@ import { WorktreeReviewService } from "./worktree-review-service.js";
|
|
|
10
10
|
export const WorkspaceService = createServiceToken("workspace");
|
|
11
11
|
export function createWorkspacePlugin() {
|
|
12
12
|
let value = null;
|
|
13
|
-
let operations = null;
|
|
14
13
|
return {
|
|
15
14
|
id: "workspace",
|
|
16
15
|
async activate(context) {
|
|
@@ -21,17 +20,15 @@ export function createWorkspacePlugin() {
|
|
|
21
20
|
const workspaces = await WorkspaceRuntime.create(new WorkspaceRepository(context.database), git, review, context.config.allowedRoots, context.config.dataDir);
|
|
22
21
|
await workspaces.discoverGitWorkspaces();
|
|
23
22
|
value = { workspaces, git };
|
|
24
|
-
operations = context.operations;
|
|
25
23
|
context.services.provide(WorkspaceService, value);
|
|
26
24
|
},
|
|
27
|
-
registerMcp(
|
|
28
|
-
if (!value
|
|
25
|
+
registerMcp(mcp) {
|
|
26
|
+
if (!value)
|
|
29
27
|
throw new Error("Workspace plugin is not active");
|
|
30
|
-
registerWorkspaceTools(
|
|
28
|
+
registerWorkspaceTools(mcp, value.workspaces);
|
|
31
29
|
},
|
|
32
30
|
deactivate() {
|
|
33
31
|
value = null;
|
|
34
|
-
operations = null;
|
|
35
32
|
},
|
|
36
33
|
};
|
|
37
34
|
}
|