@chatroomcp/chatroom 0.2.1 → 0.2.2
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 +1 -1
- package/dist/app/application.d.ts +0 -1
- package/dist/app/application.js +2 -0
- package/dist/app/event-bus.d.ts +0 -2
- package/dist/app/event-bus.js +0 -1
- package/dist/app/external-access-registry.d.ts +0 -1
- package/dist/app/external-access-registry.js +0 -1
- package/dist/app/lifecycle.d.ts +0 -1
- package/dist/auth/auth-service.js +0 -4
- package/dist/auth/ingress-policy.d.ts +0 -1
- package/dist/auth/ingress-policy.js +0 -1
- package/dist/cli/run-cli.js +0 -1
- package/dist/config/types.d.ts +0 -1
- package/dist/core/auth/repository.d.ts +0 -23
- package/dist/core/auth/repository.js +0 -6
- package/dist/core/errors/chatroom-error.d.ts +0 -15
- package/dist/core/errors/chatroom-error.js +0 -15
- package/dist/core/operations/bounded-value.d.ts +0 -1
- package/dist/core/operations/bounded-value.js +26 -10
- package/dist/core/operations/redactor.js +0 -1
- package/dist/core/operations/repository.d.ts +0 -1
- package/dist/core/operations/types.d.ts +0 -4
- package/dist/core/operations/types.js +0 -2
- package/dist/infrastructure/database/app-database.js +4 -97
- package/dist/infrastructure/database/migrations.d.ts +2 -0
- package/dist/infrastructure/database/migrations.js +44 -0
- package/dist/infrastructure/database/operation-repository.js +3 -9
- package/dist/infrastructure/database/schema.d.ts +2 -0
- package/dist/infrastructure/database/schema.js +85 -0
- package/dist/infrastructure/http/http-server.js +0 -1
- package/dist/mcp/server/create-mcp-server.js +3 -3
- package/dist/mcp/server/plugin-mcp-registrar.d.ts +0 -2
- package/dist/mcp/server/plugin-mcp-registrar.js +0 -4
- package/dist/mcp/server/tool-support.d.ts +0 -61
- package/dist/mcp/server/tool-support.js +0 -54
- package/dist/native/linux/chatroom-computer-helper +0 -0
- package/dist/native/macos/ChatRoomComputerHelper.app/Contents/Info.plist +1 -1
- package/dist/native/macos/ChatRoomComputerHelper.app/Contents/MacOS/chatroom-computer-helper +0 -0
- package/dist/native/windows/chatroom-computer-helper.exe +0 -0
- package/dist/operations/operation-log.d.ts +0 -3
- package/dist/operations/operation-log.js +0 -15
- package/dist/plugins/cloud/api-client.js +1 -0
- package/dist/plugins/cloud/controller.d.ts +2 -0
- package/dist/plugins/cloud/controller.js +28 -5
- package/dist/plugins/cloud/tunnel-client.js +0 -4
- package/dist/plugins/git/git-service.d.ts +33 -0
- package/dist/plugins/git/git-service.js +414 -0
- package/dist/plugins/git/plugin.d.ts +4 -0
- package/dist/plugins/git/plugin.js +12 -0
- package/dist/plugins/git/types.d.ts +32 -0
- package/dist/plugins/process/backend.d.ts +0 -1
- package/dist/plugins/process/head-tail-buffer.d.ts +0 -1
- package/dist/plugins/process/infrastructure/pipe-process-backend.js +0 -1
- package/dist/plugins/process/infrastructure/pty-process-backend.js +1 -4
- package/dist/plugins/process/process-supervisor.js +10 -23
- package/dist/plugins/process/types.d.ts +0 -5
- package/dist/plugins/types.d.ts +0 -1
- package/dist/plugins/web/api-types.d.ts +3 -7
- package/dist/plugins/web/http/api-router.d.ts +0 -1
- package/dist/plugins/web/http/api-router.js +2 -4
- package/dist/plugins/web/http/git-api-router.d.ts +3 -0
- package/dist/plugins/web/http/git-api-router.js +98 -0
- package/dist/plugins/web/http/workspace-api-router.js +15 -37
- package/dist/plugins/web/plugin.js +4 -6
- package/dist/plugins/web/runtime.d.ts +5 -27
- package/dist/plugins/web/runtime.js +3 -42
- package/dist/plugins/workspace/mcp.js +17 -135
- package/dist/plugins/workspace/metadata.d.ts +4 -0
- package/dist/plugins/workspace/metadata.js +105 -0
- package/dist/plugins/workspace/plugin.d.ts +2 -8
- package/dist/plugins/workspace/plugin.js +8 -20
- package/dist/plugins/workspace/types.d.ts +18 -0
- package/dist/plugins/workspace/{infrastructure/workspace-fs.d.ts → workspace-fs.d.ts} +2 -15
- package/dist/plugins/workspace/workspace-fs.js +111 -0
- package/dist/plugins/workspace/workspace-service.d.ts +7 -42
- package/dist/plugins/workspace/workspace-service.js +61 -315
- package/dist/presentation/http/http-utils.d.ts +0 -1
- package/dist/presentation/http/oauth-router.d.ts +0 -1
- package/dist/presentation/http/oauth-router.js +0 -1
- package/dist/web/assets/{index-B4vO7wVS.css → index-DFKEvyzR.css} +1 -1
- package/dist/web/assets/index-vzPPspuL.js +26 -0
- package/dist/web/index.html +2 -2
- package/package.json +4 -3
- package/dist/plugins/workspace/domain/filesystem.d.ts +0 -25
- package/dist/plugins/workspace/domain/git.d.ts +0 -7
- package/dist/plugins/workspace/domain/repository.d.ts +0 -16
- package/dist/plugins/workspace/domain/repository.js +0 -1
- package/dist/plugins/workspace/domain/review.d.ts +0 -28
- package/dist/plugins/workspace/domain/review.js +0 -1
- package/dist/plugins/workspace/domain/workspace.d.ts +0 -23
- package/dist/plugins/workspace/domain/workspace.js +0 -1
- package/dist/plugins/workspace/git/git-command-runner.d.ts +0 -6
- package/dist/plugins/workspace/git/git-command-runner.js +0 -15
- package/dist/plugins/workspace/git/git-service.d.ts +0 -14
- package/dist/plugins/workspace/git/git-service.js +0 -107
- package/dist/plugins/workspace/git/git-snapshot-service.d.ts +0 -33
- package/dist/plugins/workspace/git/git-snapshot-service.js +0 -352
- package/dist/plugins/workspace/infrastructure/workspace-fs.js +0 -340
- package/dist/plugins/workspace/infrastructure/workspace-repository.d.ts +0 -12
- package/dist/plugins/workspace/infrastructure/workspace-repository.js +0 -51
- package/dist/plugins/workspace/workspace-helpers.d.ts +0 -9
- package/dist/plugins/workspace/workspace-helpers.js +0 -67
- package/dist/plugins/workspace/worktree-review-service.d.ts +0 -16
- package/dist/plugins/workspace/worktree-review-service.js +0 -51
- package/dist/web/assets/index-BU7LCgKB.js +0 -26
- /package/dist/plugins/{workspace/domain/filesystem.js → git/types.js} +0 -0
- /package/dist/plugins/workspace/{domain/git.js → types.js} +0 -0
package/dist/web/index.html
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
href="/assets/chatroom-B5p-5n3y.svg"
|
|
11
11
|
/>
|
|
12
12
|
<title>ChatRoom Runtime</title>
|
|
13
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/assets/index-vzPPspuL.js"></script>
|
|
14
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DFKEvyzR.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatroomcp/chatroom",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Local MCP runtime for ChatGPT with workspace, process, Cloud, and WebUI controls.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"chatroom": "dist/cli/index.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"clean": "node -
|
|
10
|
+
"clean": "node scripts/clean-dist.mjs",
|
|
11
11
|
"format": "prettier --write \"src/**/*.{ts,vue,css,html}\" \"test/**/*.ts\" \"scripts/**/*.mjs\" \"*.{json,ts}\"",
|
|
12
12
|
"format:check": "prettier --check \"src/**/*.{ts,vue,css,html}\" \"test/**/*.ts\" \"scripts/**/*.mjs\" \"*.{json,ts}\"",
|
|
13
13
|
"dev": "tsx watch src/cli/index.ts serve",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"prepack": "npm run check",
|
|
26
26
|
"build:native:macos": "node scripts/build-native-macos.mjs",
|
|
27
27
|
"build:native:windows": "node scripts/build-native-windows.mjs",
|
|
28
|
-
"build:native:linux": "node scripts/build-native-linux.mjs"
|
|
28
|
+
"build:native:linux": "node scripts/build-native-linux.mjs",
|
|
29
|
+
"clean:all": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@modelcontextprotocol/node": "^2.0.0",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** Workspace filesystem value types. */
|
|
2
|
-
export interface FileInfo {
|
|
3
|
-
path: string;
|
|
4
|
-
type: "file" | "directory" | "symlink";
|
|
5
|
-
size: number;
|
|
6
|
-
modifiedAt: string;
|
|
7
|
-
}
|
|
8
|
-
export interface SearchMatch {
|
|
9
|
-
path: string;
|
|
10
|
-
line: number;
|
|
11
|
-
column: number;
|
|
12
|
-
preview: string;
|
|
13
|
-
}
|
|
14
|
-
export interface PatchReplacement {
|
|
15
|
-
path: string;
|
|
16
|
-
oldText: string;
|
|
17
|
-
newText: string;
|
|
18
|
-
occurrence?: number | "all";
|
|
19
|
-
}
|
|
20
|
-
export interface ChangeSet {
|
|
21
|
-
files: string[];
|
|
22
|
-
replacements: number;
|
|
23
|
-
bytesBefore: number;
|
|
24
|
-
bytesAfter: number;
|
|
25
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { WorkspaceMode } from "./workspace.js";
|
|
2
|
-
export interface WorkspaceRecord {
|
|
3
|
-
id: string;
|
|
4
|
-
root: string;
|
|
5
|
-
sourceRoot: string;
|
|
6
|
-
mode: WorkspaceMode;
|
|
7
|
-
createdAt: string;
|
|
8
|
-
lastUsedAt: string;
|
|
9
|
-
}
|
|
10
|
-
export interface WorkspaceStateRepository {
|
|
11
|
-
upsert(workspace: WorkspaceRecord): void;
|
|
12
|
-
get(workspaceId: string): WorkspaceRecord | null;
|
|
13
|
-
findByRoot(root: string, mode: WorkspaceMode): WorkspaceRecord | null;
|
|
14
|
-
list(): WorkspaceRecord[];
|
|
15
|
-
remove(workspaceId: string): void;
|
|
16
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
type WorktreeFileStatus = "added" | "modified" | "deleted" | "type-changed";
|
|
2
|
-
export interface WorktreeReviewFile {
|
|
3
|
-
path: string;
|
|
4
|
-
status: WorktreeFileStatus;
|
|
5
|
-
additions: number | null;
|
|
6
|
-
deletions: number | null;
|
|
7
|
-
binary: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface WorktreeApplyPreview {
|
|
10
|
-
files: Array<WorktreeReviewFile & {
|
|
11
|
-
applied: boolean;
|
|
12
|
-
conflict: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
totalFiles: number;
|
|
15
|
-
pendingFiles: number;
|
|
16
|
-
appliedFiles: number;
|
|
17
|
-
mergeableFiles: number;
|
|
18
|
-
conflictFiles: number;
|
|
19
|
-
canApply: boolean;
|
|
20
|
-
reason: "no-changes" | "merge-conflicts" | "head-mismatch" | null;
|
|
21
|
-
}
|
|
22
|
-
export interface WorktreeFileDiff {
|
|
23
|
-
path: string;
|
|
24
|
-
diff: string;
|
|
25
|
-
bytes: number;
|
|
26
|
-
truncated: boolean;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Domain model for a persistent ChatRoom workspace.
|
|
3
|
-
* Workspace identity is persistent and independent from transport connection lifetime.
|
|
4
|
-
*/
|
|
5
|
-
/** `checkout` uses sourceRoot directly; `worktree` uses a managed detached Git worktree. */
|
|
6
|
-
export type WorkspaceMode = "checkout" | "worktree";
|
|
7
|
-
interface WorkspaceCapabilities {
|
|
8
|
-
filesystem: "read-write";
|
|
9
|
-
git: boolean;
|
|
10
|
-
skills: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface Workspace {
|
|
13
|
-
id: string;
|
|
14
|
-
root: string;
|
|
15
|
-
sourceRoot: string;
|
|
16
|
-
mode: WorkspaceMode;
|
|
17
|
-
createdAt: string;
|
|
18
|
-
lastUsedAt: string;
|
|
19
|
-
instructions: string[];
|
|
20
|
-
skills: string[];
|
|
21
|
-
capabilities: WorkspaceCapabilities;
|
|
22
|
-
}
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CommandRunner } from "../../../core/runtime/command-runner.js";
|
|
2
|
-
export declare class GitCommandRunner {
|
|
3
|
-
private readonly commands;
|
|
4
|
-
constructor(commands: CommandRunner);
|
|
5
|
-
run(cwd: string, args: string[], env?: Record<string, string>): Promise<import("../../../core/runtime/command-runner.js").CommandResult>;
|
|
6
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export class GitCommandRunner {
|
|
2
|
-
commands;
|
|
3
|
-
constructor(commands) {
|
|
4
|
-
this.commands = commands;
|
|
5
|
-
}
|
|
6
|
-
run(cwd, args, env) {
|
|
7
|
-
return this.commands.run({
|
|
8
|
-
cwd,
|
|
9
|
-
command: "git",
|
|
10
|
-
args,
|
|
11
|
-
timeoutMs: 120_000,
|
|
12
|
-
env: { LC_ALL: "C", LANG: "C", ...(env ?? {}) },
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { GitInfo } from "../domain/git.js";
|
|
2
|
-
import type { GitCommandRunner } from "./git-command-runner.js";
|
|
3
|
-
export declare class GitService {
|
|
4
|
-
private readonly runner;
|
|
5
|
-
constructor(runner: GitCommandRunner);
|
|
6
|
-
info(cwd: string): Promise<GitInfo>;
|
|
7
|
-
head(cwd: string): Promise<string | null>;
|
|
8
|
-
branch(cwd: string): Promise<string | null>;
|
|
9
|
-
status(cwd: string): Promise<string>;
|
|
10
|
-
diff(cwd: string): Promise<string>;
|
|
11
|
-
createWorktree(sourceRoot: string, target: string): Promise<void>;
|
|
12
|
-
removeWorktree(sourceRoot: string, target: string, force?: boolean): Promise<void>;
|
|
13
|
-
pruneWorktrees(sourceRoot: string): Promise<void>;
|
|
14
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { ChatRoomError } from "../../../core/errors/chatroom-error.js";
|
|
3
|
-
export class GitService {
|
|
4
|
-
runner;
|
|
5
|
-
constructor(runner) {
|
|
6
|
-
this.runner = runner;
|
|
7
|
-
}
|
|
8
|
-
async info(cwd) {
|
|
9
|
-
try {
|
|
10
|
-
const root = (await this.runner.run(cwd, ["rev-parse", "--show-toplevel"])).stdout.trim();
|
|
11
|
-
const [head, branch, status] = await Promise.all([
|
|
12
|
-
this.head(cwd),
|
|
13
|
-
this.branch(cwd),
|
|
14
|
-
this.runner.run(cwd, ["status", "--porcelain"]),
|
|
15
|
-
]);
|
|
16
|
-
return {
|
|
17
|
-
isRepository: true,
|
|
18
|
-
branch,
|
|
19
|
-
head,
|
|
20
|
-
dirty: status.stdout.trim().length > 0,
|
|
21
|
-
root: path.resolve(root),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
if (isNotRepositoryError(error))
|
|
26
|
-
return {
|
|
27
|
-
isRepository: false,
|
|
28
|
-
branch: null,
|
|
29
|
-
head: null,
|
|
30
|
-
dirty: false,
|
|
31
|
-
root: null,
|
|
32
|
-
};
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async head(cwd) {
|
|
37
|
-
try {
|
|
38
|
-
return ((await this.runner.run(cwd, ["rev-parse", "--verify", "HEAD"])).stdout.trim() || null);
|
|
39
|
-
}
|
|
40
|
-
catch (error) {
|
|
41
|
-
if (isMissingHeadError(error))
|
|
42
|
-
return null;
|
|
43
|
-
throw error;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
async branch(cwd) {
|
|
47
|
-
const value = (await this.runner.run(cwd, ["branch", "--show-current"])).stdout.trim();
|
|
48
|
-
return value || null;
|
|
49
|
-
}
|
|
50
|
-
async status(cwd) {
|
|
51
|
-
return (await this.runner.run(cwd, ["status", "--short", "--branch"]))
|
|
52
|
-
.stdout;
|
|
53
|
-
}
|
|
54
|
-
async diff(cwd) {
|
|
55
|
-
const [unstaged, staged] = await Promise.all([
|
|
56
|
-
this.runner.run(cwd, ["diff", "--no-ext-diff", "--unified=3"]),
|
|
57
|
-
this.runner.run(cwd, [
|
|
58
|
-
"diff",
|
|
59
|
-
"--cached",
|
|
60
|
-
"--no-ext-diff",
|
|
61
|
-
"--unified=3",
|
|
62
|
-
]),
|
|
63
|
-
]);
|
|
64
|
-
return [unstaged.stdout, staged.stdout].filter(Boolean).join("\n");
|
|
65
|
-
}
|
|
66
|
-
async createWorktree(sourceRoot, target) {
|
|
67
|
-
const info = await this.info(sourceRoot);
|
|
68
|
-
if (!info.isRepository)
|
|
69
|
-
throw new ChatRoomError("INVALID_INPUT", "Worktree mode requires a Git repository");
|
|
70
|
-
if (!info.head)
|
|
71
|
-
throw new ChatRoomError("CONFLICT", "Worktree mode requires at least one Git commit; repository HEAD does not exist");
|
|
72
|
-
await this.runner.run(sourceRoot, [
|
|
73
|
-
"worktree",
|
|
74
|
-
"add",
|
|
75
|
-
"--detach",
|
|
76
|
-
target,
|
|
77
|
-
"HEAD",
|
|
78
|
-
]);
|
|
79
|
-
}
|
|
80
|
-
async removeWorktree(sourceRoot, target, force = false) {
|
|
81
|
-
await this.runner.run(sourceRoot, [
|
|
82
|
-
"worktree",
|
|
83
|
-
"remove",
|
|
84
|
-
...(force ? ["--force"] : []),
|
|
85
|
-
target,
|
|
86
|
-
]);
|
|
87
|
-
}
|
|
88
|
-
async pruneWorktrees(sourceRoot) {
|
|
89
|
-
await this.runner.run(sourceRoot, ["worktree", "prune"]);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function gitErrorText(error) {
|
|
93
|
-
if (!(error instanceof ChatRoomError))
|
|
94
|
-
return "";
|
|
95
|
-
const details = error.details;
|
|
96
|
-
return `${String(details?.stdout ?? "")}\n${String(details?.stderr ?? "")}`.toLowerCase();
|
|
97
|
-
}
|
|
98
|
-
function isNotRepositoryError(error) {
|
|
99
|
-
return gitErrorText(error).includes("not a git repository");
|
|
100
|
-
}
|
|
101
|
-
function isMissingHeadError(error) {
|
|
102
|
-
const text = gitErrorText(error);
|
|
103
|
-
return (text.includes("needed a single revision") ||
|
|
104
|
-
text.includes("unknown revision") ||
|
|
105
|
-
text.includes("bad revision") ||
|
|
106
|
-
text.includes("ambiguous argument 'head'"));
|
|
107
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { WorktreeFileDiff, WorktreeReviewFile } from "../domain/review.js";
|
|
2
|
-
import type { GitCommandRunner } from "./git-command-runner.js";
|
|
3
|
-
import type { GitService } from "./git-service.js";
|
|
4
|
-
interface WorktreeMergeFile extends WorktreeReviewFile {
|
|
5
|
-
applied: boolean;
|
|
6
|
-
conflict: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare class GitSnapshotService {
|
|
9
|
-
private readonly runner;
|
|
10
|
-
private readonly git;
|
|
11
|
-
constructor(runner: GitCommandRunner, git: GitService);
|
|
12
|
-
fileDiff(cwd: string, filePath: string, maxPreviewBytes?: number): Promise<WorktreeFileDiff>;
|
|
13
|
-
apply(worktreeRoot: string, sourceRoot: string, requestedPaths?: string[]): Promise<{
|
|
14
|
-
bytes: number;
|
|
15
|
-
paths: string[];
|
|
16
|
-
conflicts: string[];
|
|
17
|
-
}>;
|
|
18
|
-
applyState(worktreeRoot: string, sourceRoot: string): Promise<{
|
|
19
|
-
files: WorktreeMergeFile[];
|
|
20
|
-
}>;
|
|
21
|
-
private analyze;
|
|
22
|
-
private mergeTrees;
|
|
23
|
-
private snapshot;
|
|
24
|
-
private treeForPaths;
|
|
25
|
-
private baseTree;
|
|
26
|
-
private writeTree;
|
|
27
|
-
private stageAll;
|
|
28
|
-
private stateFromIndex;
|
|
29
|
-
private writeHeadPatch;
|
|
30
|
-
private writeTreePatch;
|
|
31
|
-
private withIndex;
|
|
32
|
-
}
|
|
33
|
-
export {};
|