@chatroomcp/chatroom 0.1.7 → 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.
- package/dist/app/application.d.ts +1 -0
- package/dist/app/application.js +4 -0
- package/dist/app/event-bus.d.ts +4 -0
- package/dist/auth/ingress-policy.d.ts +2 -0
- package/dist/auth/ingress-policy.js +7 -1
- package/dist/infrastructure/database/app-database.js +7 -0
- package/dist/infrastructure/http/http-server.js +5 -1
- package/dist/mcp/server/plugin-mcp-registrar.d.ts +6 -1
- package/dist/mcp/server/plugin-mcp-registrar.js +4 -4
- package/dist/mcp/server/request-context.d.ts +3 -0
- package/dist/mcp/server/request-context.js +8 -0
- package/dist/mcp/server/tool-support.d.ts +1 -1
- package/dist/mcp/server/tool-support.js +3 -1
- package/dist/native/macos/ChatRoomComputerHelper.app/Contents/Info.plist +14 -0
- package/dist/native/macos/ChatRoomComputerHelper.app/Contents/MacOS/chatroom-computer-helper +0 -0
- package/dist/native/macos/ChatRoomComputerHelper.app/Contents/_CodeSignature/CodeResources +115 -0
- package/dist/native/windows/chatroom-computer-helper.exe +0 -0
- package/dist/plugins/computer/audit.d.ts +34 -0
- package/dist/plugins/computer/audit.js +42 -0
- package/dist/plugins/computer/computer-native-backend.d.ts +11 -0
- package/dist/plugins/computer/computer-native-backend.js +58 -0
- package/dist/plugins/computer/computer-native-host.d.ts +26 -0
- package/dist/plugins/computer/computer-native-host.js +245 -0
- package/dist/plugins/computer/computer-protocol.d.ts +21 -0
- package/dist/plugins/computer/computer-protocol.js +72 -0
- package/dist/plugins/computer/computer-schemas.d.ts +317 -0
- package/dist/plugins/computer/computer-schemas.js +152 -0
- package/dist/plugins/computer/computer-service.d.ts +27 -0
- package/dist/plugins/computer/computer-service.js +108 -0
- package/dist/plugins/computer/computer-settings-repository.d.ts +8 -0
- package/dist/plugins/computer/computer-settings-repository.js +41 -0
- package/dist/plugins/computer/mcp.d.ts +3 -0
- package/dist/plugins/computer/mcp.js +126 -0
- package/dist/plugins/computer/plugin.d.ts +4 -0
- package/dist/plugins/computer/plugin.js +29 -0
- package/dist/plugins/computer/types.d.ts +174 -0
- package/dist/plugins/computer/types.js +1 -0
- package/dist/plugins/web/api-types.d.ts +15 -1
- package/dist/plugins/web/http/api-router.js +2 -0
- package/dist/plugins/web/http/computer-api-router.d.ts +5 -0
- package/dist/plugins/web/http/computer-api-router.js +68 -0
- package/dist/plugins/web/plugin.js +3 -1
- package/dist/plugins/web/runtime.d.ts +3 -1
- package/dist/plugins/web/runtime.js +3 -1
- package/dist/web/assets/index-BXlxEk8f.css +1 -0
- package/dist/web/assets/index-DUM6zVHS.js +26 -0
- package/dist/web/index.html +2 -2
- package/package.json +6 -3
- package/dist/web/assets/index-B7jL3mhD.css +0 -1
- package/dist/web/assets/index-L4-YdZVN.js +0 -26
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import type { Operation as DomainOperation } from "../../core/operations/types.js";
|
|
2
2
|
import type { GitInfo } from "../workspace/domain/git.js";
|
|
3
3
|
import type { ProcessSnapshot } from "../process/types.js";
|
|
4
|
+
import type { ComputerDisplay, ComputerPermission, ComputerSnapshot, ComputerStatus } from "../computer/types.js";
|
|
4
5
|
import type { Workspace } from "../workspace/domain/workspace.js";
|
|
5
6
|
import type { WorktreeApplyPreview, WorktreeFileDiff } from "../workspace/domain/review.js";
|
|
6
|
-
export type { ProcessSnapshot, WorktreeApplyPreview, WorktreeFileDiff };
|
|
7
|
+
export type { ComputerDisplay, ComputerPermission, ComputerStatus, ProcessSnapshot, WorktreeApplyPreview, WorktreeFileDiff, };
|
|
8
|
+
export interface ComputerPreviewView {
|
|
9
|
+
snapshotId: string;
|
|
10
|
+
revision: number;
|
|
11
|
+
display: ComputerDisplay | null;
|
|
12
|
+
activeApp: string | null;
|
|
13
|
+
activeWindow: string | null;
|
|
14
|
+
cursor: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
} | null;
|
|
18
|
+
elementCount: number;
|
|
19
|
+
screenshot: ComputerSnapshot["screenshot"] | null;
|
|
20
|
+
}
|
|
7
21
|
export type Operation = DomainOperation;
|
|
8
22
|
export interface WorkspaceView extends Workspace {
|
|
9
23
|
git?: GitInfo | null;
|
|
@@ -5,6 +5,7 @@ import { asyncRoute, parseCookie, requireString, } from "../../../presentation/h
|
|
|
5
5
|
import { createProcessApiRouter } from "./process-api-router.js";
|
|
6
6
|
import { createWorkspaceApiRouter } from "./workspace-api-router.js";
|
|
7
7
|
import { createCloudApiRouter } from "./cloud-api-router.js";
|
|
8
|
+
import { createComputerApiRouter } from "./computer-api-router.js";
|
|
8
9
|
const SESSION_COOKIE = "chatroom_session";
|
|
9
10
|
export function createApiRouter(application, eventBus, auth, passkeys, ingress, cloud, runtimeStatus) {
|
|
10
11
|
const router = Router();
|
|
@@ -97,6 +98,7 @@ export function createApiRouter(application, eventBus, auth, passkeys, ingress,
|
|
|
97
98
|
});
|
|
98
99
|
router.use(createWorkspaceApiRouter(application));
|
|
99
100
|
router.use(createProcessApiRouter(application));
|
|
101
|
+
router.use(createComputerApiRouter(application.computer, application.operations, ingress));
|
|
100
102
|
router.use(createCloudApiRouter(cloud, application.operations));
|
|
101
103
|
router.get("/events", (req, res) => {
|
|
102
104
|
res.status(200);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Router } from "express";
|
|
2
|
+
import type { ComputerService } from "../../computer/computer-service.js";
|
|
3
|
+
import type { OperationLog } from "../../../operations/operation-log.js";
|
|
4
|
+
import type { IngressPolicy } from "../../../auth/ingress-policy.js";
|
|
5
|
+
export declare function createComputerApiRouter(computer: ComputerService, operations: OperationLog, ingress: IngressPolicy): Router;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Router } from "express";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { asyncRoute } from "../../../presentation/http/http-utils.js";
|
|
4
|
+
import { ChatRoomError } from "../../../core/errors/chatroom-error.js";
|
|
5
|
+
const settingsPatchSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
enabled: z.boolean().optional(),
|
|
8
|
+
remoteAccess: z.boolean().optional(),
|
|
9
|
+
})
|
|
10
|
+
.strict();
|
|
11
|
+
export function createComputerApiRouter(computer, operations, ingress) {
|
|
12
|
+
const router = Router();
|
|
13
|
+
router.get("/computer/status", asyncRoute(async (_req, res) => res.json(await computer.status())));
|
|
14
|
+
router.post("/computer/permissions/accessibility/request", asyncRoute(async (req, res) => {
|
|
15
|
+
assertLocalPermissionRequest(req);
|
|
16
|
+
res.json(await computer.requestPermission("accessibility"));
|
|
17
|
+
}));
|
|
18
|
+
router.post("/computer/permissions/screen-recording/request", asyncRoute(async (req, res) => {
|
|
19
|
+
assertLocalPermissionRequest(req);
|
|
20
|
+
res.json(await computer.requestPermission("screenRecording"));
|
|
21
|
+
}));
|
|
22
|
+
function assertLocalPermissionRequest(req) {
|
|
23
|
+
if (ingress.isExternalWeb(req))
|
|
24
|
+
throw new ChatRoomError("FORBIDDEN", "Computer permissions can be requested only from the local WebUI");
|
|
25
|
+
}
|
|
26
|
+
router.patch("/computer/settings", asyncRoute(async (req, res) => {
|
|
27
|
+
const parsed = settingsPatchSchema.parse(req.body);
|
|
28
|
+
const patch = {
|
|
29
|
+
...(parsed.enabled === undefined ? {} : { enabled: parsed.enabled }),
|
|
30
|
+
...(parsed.remoteAccess === undefined
|
|
31
|
+
? {}
|
|
32
|
+
: { remoteAccess: parsed.remoteAccess }),
|
|
33
|
+
};
|
|
34
|
+
res.json(await operations.run({
|
|
35
|
+
pluginId: "computer",
|
|
36
|
+
source: "gui",
|
|
37
|
+
action: "settings.set",
|
|
38
|
+
input: patch,
|
|
39
|
+
}, async () => computer.setSettings(patch)));
|
|
40
|
+
}));
|
|
41
|
+
router.get("/computer/preview", (req, res) => {
|
|
42
|
+
const scope = ingress.isExternalWeb(req) ? "remote" : "local";
|
|
43
|
+
res.json(presentPreview(computer.latestSnapshot(scope)));
|
|
44
|
+
});
|
|
45
|
+
router.post("/computer/snapshot", asyncRoute(async (req, res) => {
|
|
46
|
+
const scope = ingress.isExternalWeb(req) ? "remote" : "local";
|
|
47
|
+
const value = await computer.snapshot(scope, {
|
|
48
|
+
includeScreenshot: true,
|
|
49
|
+
includeElements: true,
|
|
50
|
+
});
|
|
51
|
+
res.json(presentPreview(value));
|
|
52
|
+
}));
|
|
53
|
+
return router;
|
|
54
|
+
}
|
|
55
|
+
function presentPreview(value) {
|
|
56
|
+
if (!value)
|
|
57
|
+
return null;
|
|
58
|
+
return {
|
|
59
|
+
snapshotId: value.snapshotId,
|
|
60
|
+
revision: value.revision,
|
|
61
|
+
display: value.display,
|
|
62
|
+
activeApp: value.activeApp,
|
|
63
|
+
activeWindow: value.activeWindow,
|
|
64
|
+
cursor: value.cursor,
|
|
65
|
+
elementCount: value.elements.length,
|
|
66
|
+
screenshot: value.screenshot ?? null,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createServiceToken } from "../types.js";
|
|
2
2
|
import { WorkspaceService } from "../workspace/plugin.js";
|
|
3
3
|
import { ProcessService } from "../process/plugin.js";
|
|
4
|
+
import { ComputerServiceToken } from "../computer/plugin.js";
|
|
4
5
|
import { WebRuntime } from "./runtime.js";
|
|
5
6
|
export const WebServiceToken = createServiceToken("web");
|
|
6
7
|
export function createWebPlugin() {
|
|
@@ -9,8 +10,9 @@ export function createWebPlugin() {
|
|
|
9
10
|
activate(context) {
|
|
10
11
|
const workspace = context.services.require(WorkspaceService);
|
|
11
12
|
const processes = context.services.require(ProcessService);
|
|
13
|
+
const computer = context.services.require(ComputerServiceToken);
|
|
12
14
|
context.services.provide(WebServiceToken, {
|
|
13
|
-
application: new WebRuntime(workspace.workspaces, context.operations, processes, workspace.git),
|
|
15
|
+
application: new WebRuntime(workspace.workspaces, context.operations, processes, workspace.git, computer),
|
|
14
16
|
});
|
|
15
17
|
},
|
|
16
18
|
};
|
|
@@ -2,12 +2,14 @@ import type { OperationLog } from "../../operations/operation-log.js";
|
|
|
2
2
|
import type { WorkspaceService } from "../workspace/workspace-service.js";
|
|
3
3
|
import type { ProcessSupervisor } from "../process/process-supervisor.js";
|
|
4
4
|
import type { GitService } from "../workspace/git/git-service.js";
|
|
5
|
+
import type { ComputerService } from "../computer/computer-service.js";
|
|
5
6
|
export declare class WebRuntime {
|
|
6
7
|
readonly workspaces: WorkspaceService;
|
|
7
8
|
readonly operations: OperationLog;
|
|
8
9
|
readonly processes: ProcessSupervisor;
|
|
9
10
|
readonly git: GitService;
|
|
10
|
-
|
|
11
|
+
readonly computer: ComputerService;
|
|
12
|
+
constructor(workspaces: WorkspaceService, operations: OperationLog, processes: ProcessSupervisor, git: GitService, computer: ComputerService);
|
|
11
13
|
previewWorktreeApply(workspaceId: string): Promise<import("./api-types.js").WorktreeApplyPreview>;
|
|
12
14
|
previewWorktreeFileDiff(workspaceId: string, filePath: string): Promise<import("./api-types.js").WorktreeFileDiff>;
|
|
13
15
|
applyWorktree(workspaceId: string, paths?: string[]): Promise<{
|
|
@@ -3,11 +3,13 @@ export class WebRuntime {
|
|
|
3
3
|
operations;
|
|
4
4
|
processes;
|
|
5
5
|
git;
|
|
6
|
-
|
|
6
|
+
computer;
|
|
7
|
+
constructor(workspaces, operations, processes, git, computer) {
|
|
7
8
|
this.workspaces = workspaces;
|
|
8
9
|
this.operations = operations;
|
|
9
10
|
this.processes = processes;
|
|
10
11
|
this.git = git;
|
|
12
|
+
this.computer = computer;
|
|
11
13
|
}
|
|
12
14
|
previewWorktreeApply(workspaceId) {
|
|
13
15
|
return this.workspaces.previewWorktreeApply(workspaceId);
|