@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.
Files changed (107) hide show
  1. package/README.md +1 -1
  2. package/dist/app/application.d.ts +0 -1
  3. package/dist/app/application.js +2 -0
  4. package/dist/app/event-bus.d.ts +0 -2
  5. package/dist/app/event-bus.js +0 -1
  6. package/dist/app/external-access-registry.d.ts +0 -1
  7. package/dist/app/external-access-registry.js +0 -1
  8. package/dist/app/lifecycle.d.ts +0 -1
  9. package/dist/auth/auth-service.js +0 -4
  10. package/dist/auth/ingress-policy.d.ts +0 -1
  11. package/dist/auth/ingress-policy.js +0 -1
  12. package/dist/cli/run-cli.js +0 -1
  13. package/dist/config/types.d.ts +0 -1
  14. package/dist/core/auth/repository.d.ts +0 -23
  15. package/dist/core/auth/repository.js +0 -6
  16. package/dist/core/errors/chatroom-error.d.ts +0 -15
  17. package/dist/core/errors/chatroom-error.js +0 -15
  18. package/dist/core/operations/bounded-value.d.ts +0 -1
  19. package/dist/core/operations/bounded-value.js +26 -10
  20. package/dist/core/operations/redactor.js +0 -1
  21. package/dist/core/operations/repository.d.ts +0 -1
  22. package/dist/core/operations/types.d.ts +0 -4
  23. package/dist/core/operations/types.js +0 -2
  24. package/dist/infrastructure/database/app-database.js +4 -97
  25. package/dist/infrastructure/database/migrations.d.ts +2 -0
  26. package/dist/infrastructure/database/migrations.js +44 -0
  27. package/dist/infrastructure/database/operation-repository.js +3 -9
  28. package/dist/infrastructure/database/schema.d.ts +2 -0
  29. package/dist/infrastructure/database/schema.js +85 -0
  30. package/dist/infrastructure/http/http-server.js +0 -1
  31. package/dist/mcp/server/create-mcp-server.js +3 -3
  32. package/dist/mcp/server/plugin-mcp-registrar.d.ts +0 -2
  33. package/dist/mcp/server/plugin-mcp-registrar.js +0 -4
  34. package/dist/mcp/server/tool-support.d.ts +0 -61
  35. package/dist/mcp/server/tool-support.js +0 -54
  36. package/dist/native/linux/chatroom-computer-helper +0 -0
  37. package/dist/native/macos/ChatRoomComputerHelper.app/Contents/Info.plist +1 -1
  38. package/dist/native/macos/ChatRoomComputerHelper.app/Contents/MacOS/chatroom-computer-helper +0 -0
  39. package/dist/native/windows/chatroom-computer-helper.exe +0 -0
  40. package/dist/operations/operation-log.d.ts +0 -3
  41. package/dist/operations/operation-log.js +0 -15
  42. package/dist/plugins/cloud/api-client.js +1 -0
  43. package/dist/plugins/cloud/controller.d.ts +2 -0
  44. package/dist/plugins/cloud/controller.js +28 -5
  45. package/dist/plugins/cloud/tunnel-client.js +0 -4
  46. package/dist/plugins/git/git-service.d.ts +33 -0
  47. package/dist/plugins/git/git-service.js +414 -0
  48. package/dist/plugins/git/plugin.d.ts +4 -0
  49. package/dist/plugins/git/plugin.js +12 -0
  50. package/dist/plugins/git/types.d.ts +32 -0
  51. package/dist/plugins/process/backend.d.ts +0 -1
  52. package/dist/plugins/process/head-tail-buffer.d.ts +0 -1
  53. package/dist/plugins/process/infrastructure/pipe-process-backend.js +0 -1
  54. package/dist/plugins/process/infrastructure/pty-process-backend.js +1 -4
  55. package/dist/plugins/process/process-supervisor.js +10 -23
  56. package/dist/plugins/process/types.d.ts +0 -5
  57. package/dist/plugins/types.d.ts +0 -1
  58. package/dist/plugins/web/api-types.d.ts +3 -7
  59. package/dist/plugins/web/http/api-router.d.ts +0 -1
  60. package/dist/plugins/web/http/api-router.js +2 -4
  61. package/dist/plugins/web/http/git-api-router.d.ts +3 -0
  62. package/dist/plugins/web/http/git-api-router.js +98 -0
  63. package/dist/plugins/web/http/workspace-api-router.js +15 -37
  64. package/dist/plugins/web/plugin.js +4 -6
  65. package/dist/plugins/web/runtime.d.ts +5 -27
  66. package/dist/plugins/web/runtime.js +3 -42
  67. package/dist/plugins/workspace/mcp.js +17 -135
  68. package/dist/plugins/workspace/metadata.d.ts +4 -0
  69. package/dist/plugins/workspace/metadata.js +105 -0
  70. package/dist/plugins/workspace/plugin.d.ts +2 -8
  71. package/dist/plugins/workspace/plugin.js +8 -20
  72. package/dist/plugins/workspace/types.d.ts +18 -0
  73. package/dist/plugins/workspace/{infrastructure/workspace-fs.d.ts → workspace-fs.d.ts} +2 -15
  74. package/dist/plugins/workspace/workspace-fs.js +111 -0
  75. package/dist/plugins/workspace/workspace-service.d.ts +7 -42
  76. package/dist/plugins/workspace/workspace-service.js +61 -315
  77. package/dist/presentation/http/http-utils.d.ts +0 -1
  78. package/dist/presentation/http/oauth-router.d.ts +0 -1
  79. package/dist/presentation/http/oauth-router.js +0 -1
  80. package/dist/web/assets/{index-B4vO7wVS.css → index-DFKEvyzR.css} +1 -1
  81. package/dist/web/assets/index-vzPPspuL.js +26 -0
  82. package/dist/web/index.html +2 -2
  83. package/package.json +4 -3
  84. package/dist/plugins/workspace/domain/filesystem.d.ts +0 -25
  85. package/dist/plugins/workspace/domain/git.d.ts +0 -7
  86. package/dist/plugins/workspace/domain/repository.d.ts +0 -16
  87. package/dist/plugins/workspace/domain/repository.js +0 -1
  88. package/dist/plugins/workspace/domain/review.d.ts +0 -28
  89. package/dist/plugins/workspace/domain/review.js +0 -1
  90. package/dist/plugins/workspace/domain/workspace.d.ts +0 -23
  91. package/dist/plugins/workspace/domain/workspace.js +0 -1
  92. package/dist/plugins/workspace/git/git-command-runner.d.ts +0 -6
  93. package/dist/plugins/workspace/git/git-command-runner.js +0 -15
  94. package/dist/plugins/workspace/git/git-service.d.ts +0 -14
  95. package/dist/plugins/workspace/git/git-service.js +0 -107
  96. package/dist/plugins/workspace/git/git-snapshot-service.d.ts +0 -33
  97. package/dist/plugins/workspace/git/git-snapshot-service.js +0 -352
  98. package/dist/plugins/workspace/infrastructure/workspace-fs.js +0 -340
  99. package/dist/plugins/workspace/infrastructure/workspace-repository.d.ts +0 -12
  100. package/dist/plugins/workspace/infrastructure/workspace-repository.js +0 -51
  101. package/dist/plugins/workspace/workspace-helpers.d.ts +0 -9
  102. package/dist/plugins/workspace/workspace-helpers.js +0 -67
  103. package/dist/plugins/workspace/worktree-review-service.d.ts +0 -16
  104. package/dist/plugins/workspace/worktree-review-service.js +0 -51
  105. package/dist/web/assets/index-BU7LCgKB.js +0 -26
  106. /package/dist/plugins/{workspace/domain/filesystem.js → git/types.js} +0 -0
  107. /package/dist/plugins/workspace/{domain/git.js → types.js} +0 -0
@@ -1,12 +0,0 @@
1
- import type { WorkspaceRecord, WorkspaceStateRepository } from "../domain/repository.js";
2
- import type { WorkspaceMode } from "../domain/workspace.js";
3
- import type { AppDatabase } from "../../../infrastructure/database/app-database.js";
4
- export declare class WorkspaceRepository implements WorkspaceStateRepository {
5
- private readonly database;
6
- constructor(database: AppDatabase);
7
- upsert(workspace: WorkspaceRecord): void;
8
- get(workspaceId: string): WorkspaceRecord | null;
9
- findByRoot(root: string, mode: WorkspaceMode): WorkspaceRecord | null;
10
- list(): WorkspaceRecord[];
11
- remove(workspaceId: string): void;
12
- }
@@ -1,51 +0,0 @@
1
- export class WorkspaceRepository {
2
- database;
3
- constructor(database) {
4
- this.database = database;
5
- }
6
- upsert(workspace) {
7
- this.database.raw
8
- .prepare(`
9
- INSERT INTO workspaces(id,root,source_root,mode,created_at,last_used_at)
10
- VALUES(?,?,?,?,?,?)
11
- ON CONFLICT(id) DO UPDATE SET
12
- root=excluded.root,
13
- source_root=excluded.source_root,
14
- mode=excluded.mode,
15
- last_used_at=excluded.last_used_at
16
- `)
17
- .run(workspace.id, workspace.root, workspace.sourceRoot, workspace.mode, workspace.createdAt, workspace.lastUsedAt);
18
- }
19
- get(workspaceId) {
20
- const row = this.database.raw
21
- .prepare("SELECT * FROM workspaces WHERE id=?")
22
- .get(workspaceId);
23
- return row ? fromRow(row) : null;
24
- }
25
- findByRoot(root, mode) {
26
- const row = this.database.raw
27
- .prepare("SELECT * FROM workspaces WHERE root=? AND mode=?")
28
- .get(root, mode);
29
- return row ? fromRow(row) : null;
30
- }
31
- list() {
32
- return this.database.raw
33
- .prepare("SELECT * FROM workspaces ORDER BY last_used_at DESC")
34
- .all().map(fromRow);
35
- }
36
- remove(workspaceId) {
37
- this.database.raw
38
- .prepare("DELETE FROM workspaces WHERE id=?")
39
- .run(workspaceId);
40
- }
41
- }
42
- function fromRow(row) {
43
- return {
44
- id: row.id,
45
- root: row.root,
46
- sourceRoot: row.source_root,
47
- mode: row.mode,
48
- createdAt: row.created_at,
49
- lastUsedAt: row.last_used_at,
50
- };
51
- }
@@ -1,9 +0,0 @@
1
- import type { WorkspaceFs } from "./infrastructure/workspace-fs.js";
2
- import type { WorkspaceRecord } from "./domain/repository.js";
3
- import type { Workspace } from "./domain/workspace.js";
4
- export declare function discoverInstructions(fs: WorkspaceFs): Promise<string[]>;
5
- export declare function discoverSkills(fs: WorkspaceFs): Promise<string[]>;
6
- export declare function expandHome(input: string): string;
7
- export declare function inside(root: string, candidate: string): boolean;
8
- export declare function exists(target: string): Promise<boolean>;
9
- export declare function toRecord(workspace: Workspace): WorkspaceRecord;
@@ -1,67 +0,0 @@
1
- import { access } from "node:fs/promises";
2
- import os from "node:os";
3
- import path from "node:path";
4
- import { ChatRoomError } from "../../core/errors/chatroom-error.js";
5
- export async function discoverInstructions(fs) {
6
- try {
7
- const file = await fs.read("AGENTS.md", { maxBytes: 64 * 1024 });
8
- return [`AGENTS.md\n${file.content}`];
9
- }
10
- catch (error) {
11
- if (error instanceof ChatRoomError && error.code === "NOT_FOUND")
12
- return [];
13
- throw error;
14
- }
15
- }
16
- export async function discoverSkills(fs) {
17
- const output = [];
18
- for (const root of [".agents/skills", ".chatroom/skills"]) {
19
- try {
20
- const entries = await fs.list(root, {
21
- recursive: true,
22
- maxEntries: 2000,
23
- });
24
- for (const entry of entries)
25
- if (entry.type === "file" && entry.path.endsWith("/SKILL.md"))
26
- output.push(entry.path);
27
- }
28
- catch (error) {
29
- if (!(error instanceof ChatRoomError) || error.code !== "NOT_FOUND")
30
- throw error;
31
- }
32
- }
33
- return [...new Set(output)].sort();
34
- }
35
- export function expandHome(input) {
36
- if (input === "~")
37
- return os.homedir();
38
- if (input.startsWith("~/") || input.startsWith("~\\"))
39
- return path.join(os.homedir(), input.slice(2));
40
- return path.resolve(input);
41
- }
42
- export function inside(root, candidate) {
43
- const relative = path.relative(root, candidate);
44
- return (relative === "" ||
45
- (!relative.startsWith(`..${path.sep}`) &&
46
- relative !== ".." &&
47
- !path.isAbsolute(relative)));
48
- }
49
- export async function exists(target) {
50
- try {
51
- await access(target);
52
- return true;
53
- }
54
- catch {
55
- return false;
56
- }
57
- }
58
- export function toRecord(workspace) {
59
- return {
60
- id: workspace.id,
61
- root: workspace.root,
62
- sourceRoot: workspace.sourceRoot,
63
- mode: workspace.mode,
64
- createdAt: workspace.createdAt,
65
- lastUsedAt: workspace.lastUsedAt,
66
- };
67
- }
@@ -1,16 +0,0 @@
1
- import type { WorktreeApplyPreview } from "./domain/review.js";
2
- import type { Workspace } from "./domain/workspace.js";
3
- import type { GitService } from "./git/git-service.js";
4
- import type { GitSnapshotService } from "./git/git-snapshot-service.js";
5
- export declare class WorktreeReviewService {
6
- private readonly git;
7
- private readonly snapshots;
8
- constructor(git: GitService, snapshots: GitSnapshotService);
9
- preview(workspace: Workspace): Promise<WorktreeApplyPreview>;
10
- fileDiff(workspace: Workspace, filePath: string): Promise<import("./domain/review.js").WorktreeFileDiff>;
11
- apply(workspace: Workspace, paths?: string[]): Promise<{
12
- bytes: number;
13
- paths: string[];
14
- conflicts: string[];
15
- }>;
16
- }
@@ -1,51 +0,0 @@
1
- import { ChatRoomError } from "../../core/errors/chatroom-error.js";
2
- export class WorktreeReviewService {
3
- git;
4
- snapshots;
5
- constructor(git, snapshots) {
6
- this.git = git;
7
- this.snapshots = snapshots;
8
- }
9
- async preview(workspace) {
10
- requireWorktree(workspace);
11
- const [state, worktreeInfo, sourceInfo] = await Promise.all([
12
- this.snapshots.applyState(workspace.root, workspace.sourceRoot),
13
- this.git.info(workspace.root),
14
- this.git.info(workspace.sourceRoot),
15
- ]);
16
- const pendingFiles = state.files.filter((file) => !file.applied).length;
17
- const conflictFiles = state.files.filter((file) => !file.applied && file.conflict).length;
18
- const mergeableFiles = pendingFiles - conflictFiles;
19
- let reason = null;
20
- if (!state.files.length || pendingFiles === 0)
21
- reason = "no-changes";
22
- else if (!worktreeInfo.head ||
23
- !sourceInfo.head ||
24
- worktreeInfo.head !== sourceInfo.head)
25
- reason = "head-mismatch";
26
- else if (mergeableFiles === 0 && conflictFiles > 0)
27
- reason = "merge-conflicts";
28
- return {
29
- files: state.files,
30
- totalFiles: state.files.length,
31
- pendingFiles,
32
- appliedFiles: state.files.length - pendingFiles,
33
- mergeableFiles,
34
- conflictFiles,
35
- canApply: reason === null && mergeableFiles > 0,
36
- reason,
37
- };
38
- }
39
- fileDiff(workspace, filePath) {
40
- requireWorktree(workspace);
41
- return this.snapshots.fileDiff(workspace.root, filePath);
42
- }
43
- apply(workspace, paths) {
44
- requireWorktree(workspace);
45
- return this.snapshots.apply(workspace.root, workspace.sourceRoot, paths);
46
- }
47
- }
48
- function requireWorktree(workspace) {
49
- if (workspace.mode !== "worktree")
50
- throw new ChatRoomError("INVALID_INPUT", "Workspace is not a managed worktree");
51
- }