@concord-ai/concord-mcp 0.12.0 → 0.14.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 (114) hide show
  1. package/README.md +22 -1
  2. package/dist/cli/commands/cloud-inbox.d.ts +1 -1
  3. package/dist/cli/commands/cloud-inbox.js +3 -3
  4. package/dist/cli/commands/cloud-inbox.js.map +1 -1
  5. package/dist/cli/commands/cloud.d.ts +4 -0
  6. package/dist/cli/commands/cloud.js +62 -16
  7. package/dist/cli/commands/cloud.js.map +1 -1
  8. package/dist/cli/commands/doctor.js +2 -2
  9. package/dist/cli/commands/doctor.js.map +1 -1
  10. package/dist/cli/commands/inbox.d.ts +12 -0
  11. package/dist/cli/commands/inbox.js +32 -5
  12. package/dist/cli/commands/inbox.js.map +1 -1
  13. package/dist/cli/commands/setup.d.ts +25 -0
  14. package/dist/cli/commands/setup.js +74 -7
  15. package/dist/cli/commands/setup.js.map +1 -1
  16. package/dist/cli/context.d.ts +7 -1
  17. package/dist/cli/context.js +7 -4
  18. package/dist/cli/context.js.map +1 -1
  19. package/dist/cloud/proxy.d.ts +2 -2
  20. package/dist/cloud/proxy.js +5 -4
  21. package/dist/cloud/proxy.js.map +1 -1
  22. package/dist/cloud/settings.d.ts +8 -3
  23. package/dist/cloud/settings.js +14 -3
  24. package/dist/cloud/settings.js.map +1 -1
  25. package/dist/cloud/target.d.ts +24 -0
  26. package/dist/cloud/target.js +33 -0
  27. package/dist/cloud/target.js.map +1 -0
  28. package/dist/config/user-config.d.ts +17 -0
  29. package/dist/config/user-config.js +65 -0
  30. package/dist/config/user-config.js.map +1 -0
  31. package/dist/db/connection.js +17 -3
  32. package/dist/db/connection.js.map +1 -1
  33. package/dist/db/index.d.ts +8 -4
  34. package/dist/db/index.js +16 -12
  35. package/dist/db/index.js.map +1 -1
  36. package/dist/db/project-scope-migration.d.ts +14 -0
  37. package/dist/db/project-scope-migration.js +168 -0
  38. package/dist/db/project-scope-migration.js.map +1 -0
  39. package/dist/db/repositories/agent-messages.d.ts +4 -1
  40. package/dist/db/repositories/agent-messages.js +9 -5
  41. package/dist/db/repositories/agent-messages.js.map +1 -1
  42. package/dist/db/repositories/events.d.ts +1 -1
  43. package/dist/db/repositories/events.js +9 -7
  44. package/dist/db/repositories/events.js.map +1 -1
  45. package/dist/db/repositories/handoffs.d.ts +1 -1
  46. package/dist/db/repositories/handoffs.js +17 -13
  47. package/dist/db/repositories/handoffs.js.map +1 -1
  48. package/dist/db/repositories/ownership-events.d.ts +1 -1
  49. package/dist/db/repositories/ownership-events.js +7 -5
  50. package/dist/db/repositories/ownership-events.js.map +1 -1
  51. package/dist/db/repositories/reviews.d.ts +1 -1
  52. package/dist/db/repositories/reviews.js +12 -9
  53. package/dist/db/repositories/reviews.js.map +1 -1
  54. package/dist/db/repositories/task-updates.d.ts +1 -1
  55. package/dist/db/repositories/task-updates.js +7 -5
  56. package/dist/db/repositories/task-updates.js.map +1 -1
  57. package/dist/db/repositories/tasks.d.ts +2 -1
  58. package/dist/db/repositories/tasks.js +26 -15
  59. package/dist/db/repositories/tasks.js.map +1 -1
  60. package/dist/db/rows.d.ts +2 -0
  61. package/dist/db/rows.js +2 -0
  62. package/dist/db/rows.js.map +1 -1
  63. package/dist/db/schema.js +3 -0
  64. package/dist/db/schema.js.map +1 -1
  65. package/dist/domain/harness-config.d.ts +1 -1
  66. package/dist/domain/harness-config.js +18 -1
  67. package/dist/domain/harness-config.js.map +1 -1
  68. package/dist/domain/identity.js +1 -0
  69. package/dist/domain/identity.js.map +1 -1
  70. package/dist/index.js +20 -1
  71. package/dist/index.js.map +1 -1
  72. package/dist/install/adapters/index.d.ts +5 -0
  73. package/dist/install/adapters/index.js +51 -2
  74. package/dist/install/adapters/index.js.map +1 -1
  75. package/dist/install/block.d.ts +2 -0
  76. package/dist/install/block.js +11 -0
  77. package/dist/install/block.js.map +1 -1
  78. package/dist/install/claude-plugin.d.ts +2 -0
  79. package/dist/install/claude-plugin.js +5 -2
  80. package/dist/install/claude-plugin.js.map +1 -1
  81. package/dist/install/codex-config.d.ts +2 -0
  82. package/dist/install/codex-config.js +5 -2
  83. package/dist/install/codex-config.js.map +1 -1
  84. package/dist/install/global-mode.d.ts +15 -0
  85. package/dist/install/global-mode.js +139 -0
  86. package/dist/install/global-mode.js.map +1 -0
  87. package/dist/install/goose-config.d.ts +4 -0
  88. package/dist/install/goose-config.js +90 -0
  89. package/dist/install/goose-config.js.map +1 -0
  90. package/dist/install/instructions.d.ts +4 -0
  91. package/dist/install/instructions.js +21 -0
  92. package/dist/install/instructions.js.map +1 -1
  93. package/dist/install/mcp-config.d.ts +13 -4
  94. package/dist/install/mcp-config.js +56 -16
  95. package/dist/install/mcp-config.js.map +1 -1
  96. package/dist/server.d.ts +1 -1
  97. package/dist/tools/agent-messages.d.ts +1 -1
  98. package/dist/tools/agent-messages.js +8 -3
  99. package/dist/tools/agent-messages.js.map +1 -1
  100. package/dist/version.d.ts +1 -1
  101. package/dist/version.js +1 -1
  102. package/dist/workspaces/client-roots.d.ts +32 -0
  103. package/dist/workspaces/client-roots.js +39 -0
  104. package/dist/workspaces/client-roots.js.map +1 -0
  105. package/dist/workspaces/manager.d.ts +13 -1
  106. package/dist/workspaces/manager.js +35 -4
  107. package/dist/workspaces/manager.js.map +1 -1
  108. package/dist/workspaces/store.d.ts +44 -0
  109. package/dist/workspaces/store.js +84 -0
  110. package/dist/workspaces/store.js.map +1 -0
  111. package/package.json +3 -1
  112. package/plugin/cursor/concord-relay/cursor-hook.mjs +33 -8
  113. package/plugin/gemini/concord-relay/hooks/session-register.mjs +3 -2
  114. package/plugin/spawn-command.mjs +74 -0
@@ -0,0 +1,84 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { createHash } from 'node:crypto';
3
+ import { existsSync } from 'node:fs';
4
+ import { join } from 'node:path';
5
+ import { concordDir, databasePath } from '../config/paths.js';
6
+ import { globalDatabasePath, readUserConfig, userConcordDir } from '../config/user-config.js';
7
+ import { LOCAL_PROJECT } from '../db/index.js';
8
+ import { normalizeProjectKey } from '../domain/project-key.js';
9
+ /**
10
+ * The project for work outside any repository, named as Concord Cloud names
11
+ * it (`GENERAL_WORKSPACE`), so instructions mean the same thing against both.
12
+ */
13
+ export const GENERAL_PROJECT = 'general';
14
+ /** The repository's `origin` URL as git reports it, if it has one. */
15
+ export function gitOriginRemote(repoRoot) {
16
+ const result = spawnSync('git', ['-C', repoRoot, 'remote', 'get-url', 'origin'], {
17
+ encoding: 'utf8',
18
+ });
19
+ const url = result.status === 0 ? result.stdout.trim() : '';
20
+ return url === '' ? undefined : url;
21
+ }
22
+ /** The repository's own `.concord/` store, created on first use. */
23
+ export function localStore(repoRoot) {
24
+ return {
25
+ kind: 'local',
26
+ databasePath: databasePath(repoRoot),
27
+ concordPath: concordDir(repoRoot),
28
+ project: LOCAL_PROJECT,
29
+ };
30
+ }
31
+ /**
32
+ * A workspace's project in the machine-wide store. A repository is named by
33
+ * its git remote, as Concord Cloud names it, so every clone shares one project;
34
+ * one with no remote by its path. Anything outside a repository is `general`.
35
+ */
36
+ export function globalProjectKey(repoRoot, originRemote) {
37
+ if (!isRepository(repoRoot))
38
+ return GENERAL_PROJECT;
39
+ return repositoryProjectKey(repoRoot, originRemote) ?? repoRoot;
40
+ }
41
+ /** Whether a workspace root is a git repository (or a linked worktree of one). */
42
+ export function isRepository(root) {
43
+ return existsSync(join(root, '.git'));
44
+ }
45
+ /**
46
+ * A repository's project as Concord Cloud names it — its normalised `origin`,
47
+ * which every clone shares — or undefined when it has none. Shared by the
48
+ * machine-wide store and the cloud default, so the two never name it apart.
49
+ */
50
+ export function repositoryProjectKey(repoRoot, originRemote) {
51
+ const remote = originRemote(repoRoot);
52
+ return (remote === undefined ? null : normalizeProjectKey(remote)) ?? undefined;
53
+ }
54
+ /** Characters of the project key kept in its directory name, well under any name limit. */
55
+ const READABLE_NAME_LENGTH = 64;
56
+ /** A readable directory name for a project's artifacts, unique by its hash. */
57
+ export function artifactDirName(project) {
58
+ const readable = project
59
+ .replace(/[^a-z0-9._-]+/giu, '-')
60
+ .slice(-READABLE_NAME_LENGTH)
61
+ .replace(/^-+|-+$/gu, '');
62
+ const hash = createHash('sha256').update(project).digest('hex').slice(0, 8);
63
+ return `${readable === '' ? 'project' : readable}-${hash}`;
64
+ }
65
+ /**
66
+ * Choose the store for a workspace root. A repository that was set up keeps
67
+ * everything in its own `.concord/`, messages and roster included. Otherwise,
68
+ * when the user turned on global mode, the workspace is a project in the
69
+ * machine-wide store, so nothing is written into the repository. Without global
70
+ * mode the repository's own store is created, as it always has been.
71
+ */
72
+ export function resolveStore(repoRoot, env, originRemote = gitOriginRemote) {
73
+ if (existsSync(databasePath(repoRoot)) || readUserConfig(env).globalMode !== true) {
74
+ return localStore(repoRoot);
75
+ }
76
+ const project = globalProjectKey(repoRoot, originRemote);
77
+ return {
78
+ kind: 'global',
79
+ databasePath: globalDatabasePath(env),
80
+ concordPath: join(userConcordDir(env), 'projects', artifactDirName(project)),
81
+ project,
82
+ };
83
+ }
84
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/workspaces/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;;;GAGG;AACH,MAAM,CAAC,MAAM,e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
2
  "name": "@concord-ai/concord-mcp",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "Cross-harness communication and shared work-state for coding agents through MCP.",
5
5
  "mcpName": "io.github.Get-Concord-AI/concord-mcp",
6
6
  "keywords": [
@@ -60,6 +60,7 @@
60
60
  "better-sqlite3": "^13.0.2",
61
61
  "commander": "^15.0.0",
62
62
  "ink": "7.1.1",
63
+ "js-yaml": "^4.1.0",
63
64
  "react": "19.3.0",
64
65
  "react-devtools-core": "8.0.0",
65
66
  "zod": "^4.4.3"
@@ -67,6 +68,7 @@
67
68
  "devDependencies": {
68
69
  "@eslint/js": "^10.0.1",
69
70
  "@types/better-sqlite3": "^9.6.0",
71
+ "@types/js-yaml": "^4.0.9",
70
72
  "@types/node": "^26.1.2",
71
73
  "@types/react": "19.3.0",
72
74
  "@vitest/coverage-v8": "^5.0.1",
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { spawnSync } from 'node:child_process';
4
3
  import { createHash } from 'node:crypto';
5
4
  import { existsSync, readFileSync } from 'node:fs';
6
5
  import { join } from 'node:path';
7
6
 
7
+ import { spawnCommandSync } from '../../spawn-command.mjs';
8
+
8
9
  function readPayload() {
9
10
  const input = readFileSync(0, 'utf8').trim();
10
11
  return input === '' ? {} : JSON.parse(input);
@@ -37,7 +38,7 @@ function concordExecutable() {
37
38
  }
38
39
 
39
40
  function runConcord(root, args, output = false) {
40
- const result = spawnSync(concordExecutable(), args, {
41
+ const result = spawnCommandSync(concordExecutable(), args, {
41
42
  cwd: root,
42
43
  env: process.env,
43
44
  encoding: 'utf8',
@@ -62,6 +63,35 @@ function inboxStatus(root) {
62
63
  }
63
64
  }
64
65
 
66
+ /**
67
+ * The workspace id and, for a repository in the machine-wide store, the
68
+ * instructions it has no rule file for. Undefined from a CLI too old to say.
69
+ */
70
+ function workspaceStatus(root) {
71
+ try {
72
+ return JSON.parse(runConcord(root, ['inbox', 'status', '--json'], true));
73
+ } catch {
74
+ return undefined;
75
+ }
76
+ }
77
+
78
+ function sessionContext(agentId, status) {
79
+ // A user-level Cursor server may run far from this folder; the id routes it.
80
+ const workspace =
81
+ typeof status?.workspace_id === 'string'
82
+ ? ` Pass workspace_id "${status.workspace_id}" to Concord tools so they act on this ` +
83
+ `folder.`
84
+ : '';
85
+ const instructions = typeof status?.instructions === 'string' ? `\n\n${status.instructions}` : '';
86
+ return (
87
+ `Concord: this Cursor session is agent ${agentId}.${workspace} To receive peer messages ` +
88
+ `while idle, start exactly one Cursor background Shell task with: ` +
89
+ `concord inbox watch --provider cursor --once. Leave it active when the turn ends so ` +
90
+ `Cursor's background-task completion resumes you. When it completes, answer the emitted ` +
91
+ `peer message, then immediately start a fresh monitor.${instructions}`
92
+ );
93
+ }
94
+
65
95
  function register(root, agentId) {
66
96
  runConcord(root, ['inbox', 'register', '--agent', agentId, '--provider', 'cursor']);
67
97
  }
@@ -99,12 +129,7 @@ async function main() {
99
129
  register(root, agentId);
100
130
  writeResult({
101
131
  env: { CONCORD_AGENT_ID: agentId },
102
- additional_context:
103
- `Concord: this Cursor session is agent ${agentId}. To receive peer messages while ` +
104
- `idle, start exactly one Cursor background Shell task with: ` +
105
- `concord inbox watch --provider cursor --once. Leave it active when the turn ends so ` +
106
- `Cursor's background-task completion resumes you. When it completes, answer the emitted ` +
107
- `peer message, then immediately start a fresh monitor.`,
132
+ additional_context: sessionContext(agentId, workspaceStatus(root)),
108
133
  });
109
134
  return;
110
135
  }
@@ -2,7 +2,8 @@
2
2
 
3
3
  import { createHash } from 'node:crypto';
4
4
  import { readFileSync } from 'node:fs';
5
- import { spawnSync } from 'node:child_process';
5
+
6
+ import { spawnCommandSync } from '../../../spawn-command.mjs';
6
7
 
7
8
  function concordExecutable() {
8
9
  return process.env.CONCORD_EXECUTABLE?.trim() || 'concord';
@@ -23,7 +24,7 @@ function agentIdForSession(sessionId) {
23
24
  }
24
25
 
25
26
  function runConcord(args, options = {}) {
26
- return spawnSync(concordExecutable(), args, {
27
+ return spawnCommandSync(concordExecutable(), args, {
27
28
  cwd: options.cwd ?? process.cwd(),
28
29
  env: process.env,
29
30
  encoding: 'utf8',
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Hooks import this file from the packaged plugin tree. Each relay directory
3
+ * is linked on its own, and Node resolves those imports from this real path.
4
+ */
5
+ import { spawnSync } from 'node:child_process';
6
+ import { existsSync } from 'node:fs';
7
+ import { delimiter, extname, isAbsolute, join } from 'node:path';
8
+
9
+ const BATCH_EXTENSION = /\.(?:cmd|bat)$/iu;
10
+
11
+ export function quoteCmdArgument(value) {
12
+ if (value.length === 0) return '""';
13
+ const escaped = value.replaceAll('%', '%%cd:~,%').replaceAll('"', '""');
14
+ if (value !== escaped || /[\s"&|<>^]/u.test(value)) return `"${escaped}"`;
15
+ return value;
16
+ }
17
+
18
+ export function batchCommandLine(file, args) {
19
+ const inner = [quoteCmdArgument(file), ...args.map((arg) => quoteCmdArgument(arg))].join(' ');
20
+ return `"${inner}"`;
21
+ }
22
+
23
+ function envValue(env, name) {
24
+ const wanted = name.toLowerCase();
25
+ for (const key of Object.keys(env)) {
26
+ if (key.toLowerCase() !== wanted) continue;
27
+ const value = env[key]?.trim();
28
+ if (value !== undefined && value !== '') return value;
29
+ }
30
+ return undefined;
31
+ }
32
+
33
+ function commandInterpreter(env) {
34
+ const comSpec = envValue(env, 'ComSpec');
35
+ if (comSpec !== undefined) return comSpec;
36
+ const root = envValue(env, 'SystemRoot') ?? 'C:\\Windows';
37
+ return join(root, 'System32', 'cmd.exe');
38
+ }
39
+
40
+ function resolveWindowsCommand(file, env) {
41
+ if (extname(file) !== '' || isAbsolute(file) || file.includes('/') || file.includes('\\')) {
42
+ return file;
43
+ }
44
+ const path = envValue(env, 'PATH');
45
+ if (path === undefined) return file;
46
+ for (const directory of path.split(delimiter)) {
47
+ for (const extension of ['.exe', '.cmd', '.bat']) {
48
+ const candidate = join(directory, `${file}${extension}`);
49
+ if (existsSync(candidate)) return candidate;
50
+ }
51
+ }
52
+ return file;
53
+ }
54
+
55
+ function batchTarget(file, args, env) {
56
+ return {
57
+ command: commandInterpreter(env),
58
+ args: ['/d', '/v:off', '/s', '/c', batchCommandLine(file, args)],
59
+ };
60
+ }
61
+
62
+ export function spawnCommandSync(file, args, options) {
63
+ const env = options.env ?? process.env;
64
+ const resolved = process.platform === 'win32' ? resolveWindowsCommand(file, env) : file;
65
+ if (process.platform !== 'win32' || !BATCH_EXTENSION.test(resolved)) {
66
+ return spawnSync(resolved, [...args], { ...options, shell: false });
67
+ }
68
+ const target = batchTarget(resolved, args, env);
69
+ return spawnSync(target.command, [...target.args], {
70
+ ...options,
71
+ shell: false,
72
+ windowsVerbatimArguments: true,
73
+ });
74
+ }