@concord-ai/concord-mcp 0.5.0 → 0.6.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 (117) hide show
  1. package/README.md +139 -52
  2. package/dist/artifacts/handoff-md.js +5 -1
  3. package/dist/artifacts/handoff-md.js.map +1 -1
  4. package/dist/artifacts/work-state-json.js +4 -0
  5. package/dist/artifacts/work-state-json.js.map +1 -1
  6. package/dist/artifacts/work-state-view.d.ts +4 -0
  7. package/dist/artifacts/work-state-view.js +7 -2
  8. package/dist/artifacts/work-state-view.js.map +1 -1
  9. package/dist/cli/commands/check.js +2 -1
  10. package/dist/cli/commands/check.js.map +1 -1
  11. package/dist/cli/commands/doctor.js +35 -4
  12. package/dist/cli/commands/doctor.js.map +1 -1
  13. package/dist/cli/commands/hook.d.ts +3 -3
  14. package/dist/cli/commands/hook.js +4 -4
  15. package/dist/cli/commands/hook.js.map +1 -1
  16. package/dist/cli/commands/install.js +25 -5
  17. package/dist/cli/commands/install.js.map +1 -1
  18. package/dist/cli/commands/status.js +5 -1
  19. package/dist/cli/commands/status.js.map +1 -1
  20. package/dist/cli/commands/tasks.js +8 -4
  21. package/dist/cli/commands/tasks.js.map +1 -1
  22. package/dist/cli/commands/who.js +7 -2
  23. package/dist/cli/commands/who.js.map +1 -1
  24. package/dist/cli/context.d.ts +3 -2
  25. package/dist/cli/context.js +5 -4
  26. package/dist/cli/context.js.map +1 -1
  27. package/dist/cli/dashboard/app.js +2 -2
  28. package/dist/cli/dashboard/app.js.map +1 -1
  29. package/dist/cli/index.js +16 -3
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/cli/workspace-options.d.ts +21 -0
  32. package/dist/cli/workspace-options.js +36 -0
  33. package/dist/cli/workspace-options.js.map +1 -0
  34. package/dist/config/paths.d.ts +17 -3
  35. package/dist/config/paths.js +80 -10
  36. package/dist/config/paths.js.map +1 -1
  37. package/dist/db/index.d.ts +4 -1
  38. package/dist/db/index.js +2 -0
  39. package/dist/db/index.js.map +1 -1
  40. package/dist/db/repositories/handoffs.d.ts +9 -1
  41. package/dist/db/repositories/handoffs.js +38 -3
  42. package/dist/db/repositories/handoffs.js.map +1 -1
  43. package/dist/db/repositories/ownership-events.d.ts +19 -0
  44. package/dist/db/repositories/ownership-events.js +43 -0
  45. package/dist/db/repositories/ownership-events.js.map +1 -0
  46. package/dist/db/repositories/tasks.d.ts +12 -0
  47. package/dist/db/repositories/tasks.js +33 -5
  48. package/dist/db/repositories/tasks.js.map +1 -1
  49. package/dist/db/rows.d.ts +33 -3
  50. package/dist/db/rows.js +87 -2
  51. package/dist/db/rows.js.map +1 -1
  52. package/dist/db/schema.js +36 -0
  53. package/dist/db/schema.js.map +1 -1
  54. package/dist/domain/adoption.d.ts +3 -3
  55. package/dist/domain/adoption.js +2 -2
  56. package/dist/domain/adoption.js.map +1 -1
  57. package/dist/domain/operations.d.ts +42 -0
  58. package/dist/domain/operations.js +2 -0
  59. package/dist/domain/operations.js.map +1 -0
  60. package/dist/domain/presence.js +1 -1
  61. package/dist/domain/presence.js.map +1 -1
  62. package/dist/domain/schemas.d.ts +34 -250
  63. package/dist/domain/schemas.js +108 -97
  64. package/dist/domain/schemas.js.map +1 -1
  65. package/dist/index.js +10 -8
  66. package/dist/index.js.map +1 -1
  67. package/dist/install/codex-config.d.ts +21 -0
  68. package/dist/install/codex-config.js +68 -0
  69. package/dist/install/codex-config.js.map +1 -0
  70. package/dist/install/instructions.d.ts +6 -2
  71. package/dist/install/instructions.js +27 -34
  72. package/dist/install/instructions.js.map +1 -1
  73. package/dist/install/mcp-config.d.ts +24 -0
  74. package/dist/install/mcp-config.js +60 -0
  75. package/dist/install/mcp-config.js.map +1 -0
  76. package/dist/server.d.ts +6 -3
  77. package/dist/server.js +12 -15
  78. package/dist/server.js.map +1 -1
  79. package/dist/tools/claim-work.d.ts +1 -19
  80. package/dist/tools/claim-work.js +8 -63
  81. package/dist/tools/claim-work.js.map +1 -1
  82. package/dist/tools/get-task-context.d.ts +4 -4
  83. package/dist/tools/get-task-context.js +3 -51
  84. package/dist/tools/get-task-context.js.map +1 -1
  85. package/dist/tools/get-work-state.d.ts +5 -6
  86. package/dist/tools/get-work-state.js +18 -36
  87. package/dist/tools/get-work-state.js.map +1 -1
  88. package/dist/tools/handoff-lifecycle.d.ts +10 -0
  89. package/dist/tools/handoff-lifecycle.js +151 -0
  90. package/dist/tools/handoff-lifecycle.js.map +1 -0
  91. package/dist/tools/handoff.d.ts +5 -9
  92. package/dist/tools/handoff.js +56 -93
  93. package/dist/tools/handoff.js.map +1 -1
  94. package/dist/tools/register-agent.d.ts +1 -4
  95. package/dist/tools/register-agent.js +0 -52
  96. package/dist/tools/register-agent.js.map +1 -1
  97. package/dist/tools/review-ready.d.ts +2 -4
  98. package/dist/tools/review-ready.js +36 -45
  99. package/dist/tools/review-ready.js.map +1 -1
  100. package/dist/tools/task-lifecycle.d.ts +12 -0
  101. package/dist/tools/task-lifecycle.js +200 -0
  102. package/dist/tools/task-lifecycle.js.map +1 -0
  103. package/dist/tools/update-task.d.ts +1 -4
  104. package/dist/tools/update-task.js +14 -29
  105. package/dist/tools/update-task.js.map +1 -1
  106. package/dist/tools/workflow.d.ts +38 -0
  107. package/dist/tools/workflow.js +444 -0
  108. package/dist/tools/workflow.js.map +1 -0
  109. package/dist/tools/workspace-routing.d.ts +8 -0
  110. package/dist/tools/workspace-routing.js +15 -0
  111. package/dist/tools/workspace-routing.js.map +1 -0
  112. package/dist/version.d.ts +1 -1
  113. package/dist/version.js +1 -1
  114. package/dist/workspaces/manager.d.ts +43 -0
  115. package/dist/workspaces/manager.js +118 -0
  116. package/dist/workspaces/manager.js.map +1 -0
  117. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1,23 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
3
  import { writeArtifacts } from './artifacts/index.js';
4
- import { concordDir, databasePath, resolveRepoRoot } from './config/paths.js';
5
- import { openRepositories } from './db/index.js';
4
+ import { resolveRepoRoot } from './config/paths.js';
6
5
  import { createServer } from './server.js';
7
6
  import { createTelemetryClient } from './telemetry/client.js';
8
7
  import { TelemetryTransport } from './telemetry/transport.js';
8
+ import { WorkspaceManager } from './workspaces/manager.js';
9
9
  async function main() {
10
10
  const repoRoot = resolveRepoRoot(process.cwd(), process.env);
11
- const repos = openRepositories(databasePath(repoRoot));
12
- const artifactsDir = concordDir(repoRoot);
13
- const server = createServer(repos, {
14
- onToolWrite: () => {
15
- writeArtifacts(artifactsDir, repos);
11
+ const workspaceManager = WorkspaceManager.fromEnvironment(repoRoot, process.env);
12
+ const server = createServer(workspaceManager.current().repos, {
13
+ workspaceManager,
14
+ onToolWrite: (workspace) => {
15
+ if (workspace !== undefined) {
16
+ writeArtifacts(workspace.concordPath, workspace.repos);
17
+ }
16
18
  },
17
19
  });
18
20
  const telemetry = createTelemetryClient({
19
21
  surface: 'mcp',
20
- workspaceRoot: () => repoRoot,
22
+ workspaceRoot: () => workspaceManager.current().repoRoot,
21
23
  });
22
24
  const stdio = new StdioServerTransport();
23
25
  const transport = telemetry === undefined ? stdio : new TelemetryTransport(stdio, telemetry);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9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B,KAAK,SAAS,EAAE,KAAK,EAAE,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gCAAgC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACxE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ /** The TOML table Codex reads Concord's server definition from. */
2
+ export declare const CODEX_SECTION_HEADER = "[mcp_servers.concord]";
3
+ /**
4
+ * Absolute path to Codex's user-global config. Unlike everything else `install`
5
+ * writes this lives outside the repo, so `CODEX_HOME` is honored — both because
6
+ * Codex itself respects it and because it lets tests target a temp directory.
7
+ */
8
+ export declare function codexConfigFile(env?: NodeJS.ProcessEnv): string;
9
+ /**
10
+ * Idempotently add Concord's `[mcp_servers.concord]` table to a Codex TOML
11
+ * config. This splices the table by line range rather than parsing and
12
+ * re-serializing, so unrelated tables — and the comments and formatting around
13
+ * them, which a round-trip through a parser would discard — survive verbatim.
14
+ */
15
+ export declare function upsertCodexMcpServer(existing: string | undefined): string;
16
+ /**
17
+ * Register Concord in Codex's user-global `config.toml` (created if absent),
18
+ * preserving the rest of the file. Returns the absolute path written, since it
19
+ * lies outside the repo and callers surface that to the user.
20
+ */
21
+ export declare function installCodexMcpConfig(env?: NodeJS.ProcessEnv): string;
@@ -0,0 +1,68 @@
1
+ import { mkdirSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { homedir } from 'node:os';
3
+ import { dirname, join } from 'node:path';
4
+ import { CONCORD_SERVER_COMMAND } from './mcp-config.js';
5
+ /** The TOML table Codex reads Concord's server definition from. */
6
+ export const CODEX_SECTION_HEADER = '[mcp_servers.concord]';
7
+ /** Matches any TOML table header, which terminates the preceding table. */
8
+ const TABLE_HEADER = /^\s*\[/u;
9
+ /**
10
+ * Absolute path to Codex's user-global config. Unlike everything else `install`
11
+ * writes this lives outside the repo, so `CODEX_HOME` is honored — both because
12
+ * Codex itself respects it and because it lets tests target a temp directory.
13
+ */
14
+ export function codexConfigFile(env = process.env) {
15
+ const home = env['CODEX_HOME'];
16
+ const base = home !== undefined && home.trim() !== '' ? home : join(homedir(), '.codex');
17
+ return join(base, 'config.toml');
18
+ }
19
+ /** Normalize preceding content so exactly one blank line precedes our table. */
20
+ function withTrailingBlankLine(lines) {
21
+ if (lines.length === 0) {
22
+ return '';
23
+ }
24
+ return `${lines.join('\n').replace(/\n*$/u, '')}\n\n`;
25
+ }
26
+ /**
27
+ * Idempotently add Concord's `[mcp_servers.concord]` table to a Codex TOML
28
+ * config. This splices the table by line range rather than parsing and
29
+ * re-serializing, so unrelated tables — and the comments and formatting around
30
+ * them, which a round-trip through a parser would discard — survive verbatim.
31
+ */
32
+ export function upsertCodexMcpServer(existing) {
33
+ const section = `${CODEX_SECTION_HEADER}\ncommand = "${CONCORD_SERVER_COMMAND}"\n`;
34
+ const source = existing ?? '';
35
+ if (source.trim() === '') {
36
+ return section;
37
+ }
38
+ const lines = source.split('\n');
39
+ const found = lines.findIndex((line) => line.trim() === CODEX_SECTION_HEADER);
40
+ const start = found === -1 ? lines.length : found;
41
+ // Our table runs until the next table header; a nested `[mcp_servers.concord.env]`
42
+ // is such a header, so any subtable the user added is preserved as trailing content.
43
+ let end = lines.length;
44
+ if (found !== -1) {
45
+ for (let index = found + 1; index < lines.length; index += 1) {
46
+ if (TABLE_HEADER.test(lines[index] ?? '')) {
47
+ end = index;
48
+ break;
49
+ }
50
+ }
51
+ }
52
+ const head = withTrailingBlankLine(lines.slice(0, start));
53
+ const tail = lines.slice(end).join('\n');
54
+ return tail === '' ? `${head}${section}` : `${head}${section}\n${tail}`;
55
+ }
56
+ /**
57
+ * Register Concord in Codex's user-global `config.toml` (created if absent),
58
+ * preserving the rest of the file. Returns the absolute path written, since it
59
+ * lies outside the repo and callers surface that to the user.
60
+ */
61
+ export function installCodexMcpConfig(env = process.env) {
62
+ const fullPath = codexConfigFile(env);
63
+ const existing = existsSync(fullPath) ? readFileSync(fullPath, 'utf8') : undefined;
64
+ mkdirSync(dirname(fullPath), { recursive: true });
65
+ writeFileSync(fullPath, upsertCodexMcpServer(existing));
66
+ return fullPath;
67
+ }
68
+ //# sourceMappingURL=codex-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-config.js","sourceRoot":"","sources":["../../src/install/codex-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,mEAAmE;AACnE,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAE5D,2EAA2E;AAC3E,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAyB,OAAO,CAAC,GAAG;IAClE,MAAM,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IACzF,OAAO,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AACnC,CAAC;AAED,gFAAgF;AAChF,SAAS,qBAAqB,CAAC,KAAwB;IACrD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,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1D,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,OAAO,KAAK,IAAI,EAAE,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAyB,OAAO,CAAC,GAAG;IACxE,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACnF,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,4 +1,8 @@
1
- /** The canonical instruction block written into each client's config. */
2
- export declare const CONCORD_INSTRUCTIONS = "## Concord \u2014 shared work-state for coding agents\n\nThis project uses Concord MCP. Use its tools so your work is visible before PRs:\n\n- **At session start, call `register_agent`** with your kind (e.g. claude-code),\n a one-line summary of what you are working on, and your status. Reuse the\n returned `agent_id` on every later Concord call so your presence stays\n attributed to one instance, and call `register_agent` again when your focus\n changes. Then call `get_work_state` to see who else is active before you\n start \u2014 it shows the agent roster, active claims, overlaps, and stale claims.\n- **Keep each claim small.** Break work into the smallest independently\n handoff-able unit and `claim_work` each piece separately, rather than\n claiming one broad task. Concord flags claims that look too broad.\n- **Before editing code**, call `claim_work` with the task id, title, your\n `agent_id`, and the files/modules you expect to touch. Concord warns about\n overlaps with other active work.\n- **While working**, call `update_task` (with your `agent_id`) for durable\n intent, progress, assumptions, decisions, questions, answers, blockers, and\n findings. When resuming or coordinating on a task, call `get_task_context`\n first.\n- **Before finishing or when blocked**, call `handoff` with what changed, tests\n run, assumptions, decisions, and guardrails you checked. **Before a PR**, set\n `ready_for_review` (with open questions and provenance) to also produce a\n review packet.\n\nConcord regenerates human-readable `HANDOFF.md` and `REVIEW_PACKET.md` in\n`.concord/` so humans can review your work.\n\nEnforcement note: on clients with hooks/command registration this can be\nenforced; elsewhere it is instruction-based and may be skipped. `concord doctor`\nshows per-task adoption either way. For edit-time enforcement, wire a PreToolUse\n(or git pre-commit) hook to `concord check <files> --task <your-task-id>`; it\nexits non-zero when your edits collide with another agent's active claim. On\nClaude Code, `concord install --claude-hooks` installs this automatically \u2014 set\n`CONCORD_TASK=<your task id>` so the hook excludes your own claim. It also\ninstalls a SessionStart hook that auto-registers your presence and tells you the\n`agent_id` to reuse, so you are visible in the roster even before your first\ntool call.";
1
+ /** Version of the generated agent workflow contract. */
2
+ export declare const CONCORD_INSTRUCTION_VERSION = "1";
3
+ /** Concise MCP-native guidance, versioned with the running server. */
4
+ export declare const CONCORD_SERVER_INSTRUCTIONS = "Concord coordinates coding agents through five workflow tools.\n- Call start_work before editing. It registers your agent, claims or accepts the task, and reports overlaps.\n- Use inspect_work to read workspace or task context and update_work for durable progress, decisions, questions, blockers, and findings.\n- Use transfer_work for assignment, acceptance, decline, release, reassignment, evidence-bearing handoff offers, and reopening.\n- Call finish_work before finishing, review, or closure with changed files, tests, assumptions, decisions, risks, and provenance.\nKeep claims small and resolve reported overlaps before editing.";
5
+ /** Canonical fallback block written into supported client instruction files. */
6
+ export declare const CONCORD_INSTRUCTIONS = "## Concord \u2014 shared work-state for coding agents\n\n<!-- concord:workflow-version=1 -->\n\nThis project uses Concord MCP. Keep coordination to the five workflow tools:\n\n- **Before editing**, call `start_work` with the task, your agent kind/id, and\n expected files or modules. It registers presence, accepts assigned work when\n appropriate, claims the scope, and returns overlap warnings.\n- Use `inspect_work` to read the workspace or one task. Use `update_work` for\n durable progress, decisions, assumptions, questions, blockers, and findings.\n- Use `transfer_work` for assignment, acceptance, decline, release,\n reassignment, evidence-bearing handoff offers, and reopening.\n- **Before finishing**, call `finish_work` once with the outcome, changed\n files, tests, assumptions, decisions, risks, guardrails, and provenance. It\n records evidence and can mark work review-ready or terminal.\n\nKeep each claim small and resolve reported overlaps before editing. Concord\nregenerates human-readable review artifacts in `.concord/`.\n\nEnforcement remains client-dependent. `concord doctor` reports setup and\nworkflow adoption; optional hooks can block exact-file collisions.";
3
7
  /** MDC frontmatter used when creating a fresh Cursor rules file. */
4
8
  export declare const CURSOR_MDC_HEADER = "---\ndescription: Concord shared work-state tools for coding agents\nalwaysApply: true\n---\n";
@@ -1,42 +1,35 @@
1
- /** The canonical instruction block written into each client's config. */
1
+ /** Version of the generated agent workflow contract. */
2
+ export const CONCORD_INSTRUCTION_VERSION = '1';
3
+ /** Concise MCP-native guidance, versioned with the running server. */
4
+ export const CONCORD_SERVER_INSTRUCTIONS = `Concord coordinates coding agents through five workflow tools.
5
+ - Call start_work before editing. It registers your agent, claims or accepts the task, and reports overlaps.
6
+ - Use inspect_work to read workspace or task context and update_work for durable progress, decisions, questions, blockers, and findings.
7
+ - Use transfer_work for assignment, acceptance, decline, release, reassignment, evidence-bearing handoff offers, and reopening.
8
+ - Call finish_work before finishing, review, or closure with changed files, tests, assumptions, decisions, risks, and provenance.
9
+ Keep claims small and resolve reported overlaps before editing.`;
10
+ /** Canonical fallback block written into supported client instruction files. */
2
11
  export const CONCORD_INSTRUCTIONS = `## Concord — shared work-state for coding agents
3
12
 
4
- This project uses Concord MCP. Use its tools so your work is visible before PRs:
13
+ <!-- concord:workflow-version=${CONCORD_INSTRUCTION_VERSION} -->
5
14
 
6
- - **At session start, call \`register_agent\`** with your kind (e.g. claude-code),
7
- a one-line summary of what you are working on, and your status. Reuse the
8
- returned \`agent_id\` on every later Concord call so your presence stays
9
- attributed to one instance, and call \`register_agent\` again when your focus
10
- changes. Then call \`get_work_state\` to see who else is active before you
11
- start — it shows the agent roster, active claims, overlaps, and stale claims.
12
- - **Keep each claim small.** Break work into the smallest independently
13
- handoff-able unit and \`claim_work\` each piece separately, rather than
14
- claiming one broad task. Concord flags claims that look too broad.
15
- - **Before editing code**, call \`claim_work\` with the task id, title, your
16
- \`agent_id\`, and the files/modules you expect to touch. Concord warns about
17
- overlaps with other active work.
18
- - **While working**, call \`update_task\` (with your \`agent_id\`) for durable
19
- intent, progress, assumptions, decisions, questions, answers, blockers, and
20
- findings. When resuming or coordinating on a task, call \`get_task_context\`
21
- first.
22
- - **Before finishing or when blocked**, call \`handoff\` with what changed, tests
23
- run, assumptions, decisions, and guardrails you checked. **Before a PR**, set
24
- \`ready_for_review\` (with open questions and provenance) to also produce a
25
- review packet.
15
+ This project uses Concord MCP. Keep coordination to the five workflow tools:
26
16
 
27
- Concord regenerates human-readable \`HANDOFF.md\` and \`REVIEW_PACKET.md\` in
28
- \`.concord/\` so humans can review your work.
17
+ - **Before editing**, call \`start_work\` with the task, your agent kind/id, and
18
+ expected files or modules. It registers presence, accepts assigned work when
19
+ appropriate, claims the scope, and returns overlap warnings.
20
+ - Use \`inspect_work\` to read the workspace or one task. Use \`update_work\` for
21
+ durable progress, decisions, assumptions, questions, blockers, and findings.
22
+ - Use \`transfer_work\` for assignment, acceptance, decline, release,
23
+ reassignment, evidence-bearing handoff offers, and reopening.
24
+ - **Before finishing**, call \`finish_work\` once with the outcome, changed
25
+ files, tests, assumptions, decisions, risks, guardrails, and provenance. It
26
+ records evidence and can mark work review-ready or terminal.
29
27
 
30
- Enforcement note: on clients with hooks/command registration this can be
31
- enforced; elsewhere it is instruction-based and may be skipped. \`concord doctor\`
32
- shows per-task adoption either way. For edit-time enforcement, wire a PreToolUse
33
- (or git pre-commit) hook to \`concord check <files> --task <your-task-id>\`; it
34
- exits non-zero when your edits collide with another agent's active claim. On
35
- Claude Code, \`concord install --claude-hooks\` installs this automatically — set
36
- \`CONCORD_TASK=<your task id>\` so the hook excludes your own claim. It also
37
- installs a SessionStart hook that auto-registers your presence and tells you the
38
- \`agent_id\` to reuse, so you are visible in the roster even before your first
39
- tool call.`;
28
+ Keep each claim small and resolve reported overlaps before editing. Concord
29
+ regenerates human-readable review artifacts in \`.concord/\`.
30
+
31
+ Enforcement remains client-dependent. \`concord doctor\` reports setup and
32
+ workflow adoption; optional hooks can block exact-file collisions.`;
40
33
  /** MDC frontmatter used when creating a fresh Cursor rules file. */
41
34
  export const CURSOR_MDC_HEADER = `---
42
35
  description: Concord shared work-state tools for coding agents
@@ -1 +1 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/install/instructions.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAqCzB,CAAC;AAEZ,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;CAIhC,CAAC"}
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/install/instructions.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C,sEAAsE;AACtE,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;gEAKqB,CAAC;AAEjE,gFAAgF;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;gCAEJ,2BAA2B;;;;;;;;;;;;;;;;;;;mEAmBQ,CAAC;AAEpE,oEAAoE;AACpE,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;CAIhC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /** The key Concord registers itself under in an `mcpServers` map. */
2
+ export declare const CONCORD_SERVER_KEY = "concord";
3
+ /** The binary clients spawn to run the stdio MCP server. */
4
+ export declare const CONCORD_SERVER_COMMAND = "concord-mcp";
5
+ /**
6
+ * Thrown when an existing config file cannot be parsed. The caller reports this
7
+ * and leaves the file untouched rather than overwriting hand-written config.
8
+ */
9
+ export declare class McpConfigParseError extends Error {
10
+ readonly relPath: string;
11
+ constructor(relPath: string);
12
+ }
13
+ /**
14
+ * Idempotently add Concord's server entry to an `mcpServers` config string.
15
+ * Every other server and every unrelated top-level key is preserved, and
16
+ * passing the previous output back in is a no-op.
17
+ */
18
+ export declare function upsertMcpServer(existing: string | undefined): string;
19
+ /**
20
+ * Register Concord in every JSON-shaped client config under `repoRoot`
21
+ * (Claude Code's `.mcp.json` and Cursor's `.cursor/mcp.json`), creating each
22
+ * file if absent. Returns the relative paths written.
23
+ */
24
+ export declare function installMcpConfigs(repoRoot: string): string[];
@@ -0,0 +1,60 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { z } from 'zod';
4
+ /** The key Concord registers itself under in an `mcpServers` map. */
5
+ export const CONCORD_SERVER_KEY = 'concord';
6
+ /** The binary clients spawn to run the stdio MCP server. */
7
+ export const CONCORD_SERVER_COMMAND = 'concord-mcp';
8
+ /** Repo-relative config paths that share the `mcpServers` JSON shape. */
9
+ const JSON_TARGETS = ['.mcp.json', join('.cursor', 'mcp.json')];
10
+ const mcpConfigSchema = z.object({ mcpServers: z.record(z.unknown()).optional() }).passthrough();
11
+ /**
12
+ * Thrown when an existing config file cannot be parsed. The caller reports this
13
+ * and leaves the file untouched rather than overwriting hand-written config.
14
+ */
15
+ export class McpConfigParseError extends Error {
16
+ relPath;
17
+ constructor(relPath) {
18
+ super(`${relPath} is not valid JSON — fix or remove it, then re-run.`);
19
+ this.relPath = relPath;
20
+ this.name = 'McpConfigParseError';
21
+ }
22
+ }
23
+ /**
24
+ * Idempotently add Concord's server entry to an `mcpServers` config string.
25
+ * Every other server and every unrelated top-level key is preserved, and
26
+ * passing the previous output back in is a no-op.
27
+ */
28
+ export function upsertMcpServer(existing) {
29
+ const source = existing === undefined || existing.trim() === '' ? {} : JSON.parse(existing);
30
+ const config = mcpConfigSchema.parse(source);
31
+ const servers = config.mcpServers ?? {};
32
+ const next = {
33
+ ...config,
34
+ mcpServers: { ...servers, [CONCORD_SERVER_KEY]: { command: CONCORD_SERVER_COMMAND } },
35
+ };
36
+ return `${JSON.stringify(next, null, 2)}\n`;
37
+ }
38
+ function writeMcpConfig(repoRoot, relPath) {
39
+ const fullPath = join(repoRoot, relPath);
40
+ const existing = existsSync(fullPath) ? readFileSync(fullPath, 'utf8') : undefined;
41
+ let updated;
42
+ try {
43
+ updated = upsertMcpServer(existing);
44
+ }
45
+ catch {
46
+ throw new McpConfigParseError(relPath);
47
+ }
48
+ mkdirSync(dirname(fullPath), { recursive: true });
49
+ writeFileSync(fullPath, updated);
50
+ return relPath;
51
+ }
52
+ /**
53
+ * Register Concord in every JSON-shaped client config under `repoRoot`
54
+ * (Claude Code's `.mcp.json` and Cursor's `.cursor/mcp.json`), creating each
55
+ * file if absent. Returns the relative paths written.
56
+ */
57
+ export function installMcpConfigs(repoRoot) {
58
+ return JSON_TARGETS.map((relPath) => writeMcpConfig(repoRoot, relPath));
59
+ }
60
+ //# sourceMappingURL=mcp-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-config.js","sourceRoot":"","sources":["../../src/install/mcp-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qEAAqE;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC;AAC5C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEpD,yEAAyE;AACzE,MAAM,YAAY,GAAsB,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnF,MAAM,eA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AAS,CAAC;IAEnF,IAAI,OAAe,CAAC;IACpB,IAAI,CAAC;QACH,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IACtC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1E,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,13 +1,16 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { Repositories } from './db/index.js';
3
+ import { type WorkspaceContext, type WorkspaceManager } from './workspaces/manager.js';
3
4
  /** Concord's advertised MCP server version. */
4
- export declare const SERVER_VERSION = "0.5.0";
5
+ export declare const SERVER_VERSION = "0.6.0";
5
6
  export interface ServerOptions {
6
7
  /** Called after any tool writes to the database (used to regenerate artifacts). */
7
- onToolWrite?: () => void;
8
+ onToolWrite?: (workspace: WorkspaceContext | undefined) => void;
9
+ /** Enables automatic root resolution and optional per-operation workspace selection. */
10
+ workspaceManager?: WorkspaceManager;
8
11
  }
9
12
  /**
10
- * Build the Concord MCP server and register the v0 tools against the given
13
+ * Build the Concord MCP server and register the workflow tools against the given
11
14
  * repositories. Transport wiring lives in the entry points.
12
15
  */
13
16
  export declare function createServer(repos: Repositories, options?: ServerOptions): McpServer;
package/dist/server.js CHANGED
@@ -1,31 +1,28 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { registerClaimWork } from './tools/claim-work.js';
3
- import { registerGetTaskContext } from './tools/get-task-context.js';
4
- import { registerWorkState } from './tools/get-work-state.js';
5
- import { registerHandoff } from './tools/handoff.js';
6
- import { registerRegisterAgent } from './tools/register-agent.js';
7
- import { registerUpdateTask } from './tools/update-task.js';
2
+ import { CONCORD_SERVER_INSTRUCTIONS } from './install/instructions.js';
3
+ import { registerWorkStateResource } from './tools/get-work-state.js';
4
+ import { registerWorkflowTools } from './tools/workflow.js';
8
5
  import { VERSION } from './version.js';
6
+ import { routedRepositories, } from './workspaces/manager.js';
9
7
  /** Concord's advertised MCP server version. */
10
8
  export const SERVER_VERSION = VERSION;
11
9
  /**
12
- * Build the Concord MCP server and register the v0 tools against the given
10
+ * Build the Concord MCP server and register the workflow tools against the given
13
11
  * repositories. Transport wiring lives in the entry points.
14
12
  */
15
13
  export function createServer(repos, options = {}) {
16
- const server = new McpServer({ name: 'concord-mcp', version: SERVER_VERSION });
14
+ const server = new McpServer({ name: 'concord-mcp', version: SERVER_VERSION }, { instructions: CONCORD_SERVER_INSTRUCTIONS });
15
+ const manager = options.workspaceManager;
16
+ const selectedRepos = manager === undefined ? repos : routedRepositories(manager);
17
+ const selectWorkspace = manager === undefined ? undefined : (workspaceId) => manager.select(workspaceId);
17
18
  // Register the read surface first so we get the change-notifier, then run it
18
19
  // (plus the caller's hook) after every write.
19
- const notifyWorkStateChanged = registerWorkState(server, repos);
20
+ const notifyWorkStateChanged = registerWorkStateResource(server, selectedRepos, selectWorkspace);
20
21
  const onWrite = () => {
21
- options.onToolWrite?.();
22
+ options.onToolWrite?.(manager?.current());
22
23
  notifyWorkStateChanged();
23
24
  };
24
- registerGetTaskContext(server, repos);
25
- registerRegisterAgent(server, repos, onWrite);
26
- registerClaimWork(server, repos, onWrite);
27
- registerUpdateTask(server, repos, onWrite);
28
- registerHandoff(server, repos, onWrite);
25
+ registerWorkflowTools(server, selectedRepos, onWrite, selectWorkspace);
29
26
  return server;
30
27
  }
31
28
  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B,OAAO,CAAC,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;QAC1C,sBAAsB,EAAE,CAAC;IAC3B,CAAC,CAAC;IACF,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,7 +1,6 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
1
  import type { Repositories, TaskRecord } from '../db/index.js';
2
+ import type { ClaimWorkInput } from '../domain/operations.js';
3
3
  import { type OverlapWarning } from '../domain/overlap.js';
4
- import { type ClaimWorkInput } from '../domain/schemas.js';
5
4
  export interface ClaimWorkResult {
6
5
  task: TaskRecord;
7
6
  alreadyClaimed: boolean;
@@ -34,20 +33,3 @@ export interface ClaimWorkResult {
34
33
  * merged scope, and the additions are reported back.
35
34
  */
36
35
  export declare function handleClaimWork(repos: Repositories, input: ClaimWorkInput): ClaimWorkResult;
37
- export declare function formatClaimWorkText(result: ClaimWorkResult): string;
38
- /** The `claim_work` MCP structured output. All keys are snake_case, including
39
- * overlap entries, so the payload is internally consistent. */
40
- export declare function toClaimWorkStructured(result: ClaimWorkResult): {
41
- task_id: string;
42
- parent_task_id: string | null;
43
- already_claimed: boolean;
44
- overlaps: {
45
- task_id: string;
46
- title: string;
47
- reasons: string[];
48
- }[];
49
- checked_against: number;
50
- breadth_reasons: string[];
51
- scope_added: string[];
52
- };
53
- export declare function registerClaimWork(server: McpServer, repos: Repositories, onWrite?: () => void): void;
@@ -1,6 +1,5 @@
1
1
  import { assessClaimBreadth } from '../domain/decomposition.js';
2
2
  import { detectOverlaps } from '../domain/overlap.js';
3
- import { claimWorkInputShape } from '../domain/schemas.js';
4
3
  /** Union of two label lists, de-duplicated, existing entries first. */
5
4
  function mergeUnique(existing, incoming) {
6
5
  return [...new Set([...existing, ...incoming])];
@@ -23,6 +22,14 @@ export function handleClaimWork(repos, input) {
23
22
  const inputDomains = input.domains ?? [];
24
23
  const inputRiskTags = input.risk_tags ?? [];
25
24
  const existing = repos.tasks.get(input.task_id);
25
+ if (input.agent_id !== undefined && repos.agents.get(input.agent_id) === undefined) {
26
+ throw new Error(`Agent ${input.agent_id} is not registered. Call start_work first.`);
27
+ }
28
+ if (existing?.agentId !== null &&
29
+ existing?.agentId !== undefined &&
30
+ input.agent_id !== existing.agentId) {
31
+ throw new Error(`Task ${input.task_id} is owned by ${existing.agentId}; use transfer_work to offer or reassign it.`);
32
+ }
26
33
  // Parent is set at first claim and preserved thereafter (identity is idempotent).
27
34
  const parentTaskId = existing ? existing.parentTaskId : (input.parent_task_id ?? null);
28
35
  // Effective scope: the merged surface for an existing claim, else the input.
@@ -84,66 +91,4 @@ export function handleClaimWork(repos, input) {
84
91
  scopeAdded,
85
92
  };
86
93
  }
87
- export function formatClaimWorkText(result) {
88
- const verb = result.alreadyClaimed ? 'Already claimed' : 'Claimed';
89
- const lines = [`${verb} ${result.task.taskId} (${result.task.title}).`];
90
- if (result.alreadyClaimed && result.scopeAdded.length > 0) {
91
- lines.push(`Extended claim scope (added ${result.scopeAdded.join(', ')}).`);
92
- }
93
- if (result.overlaps.length === 0) {
94
- if (result.checkedAgainst === 0) {
95
- lines.push('No other active claims to check against yet. Overlaps are only checked at ' +
96
- 'claim time, so a later overlapping claim will not appear here — run ' +
97
- '`concord status` to re-check as others claim work.');
98
- }
99
- else {
100
- lines.push(`No overlaps with the ${String(result.checkedAgainst)} other active task(s) at claim time. ` +
101
- 'This is a point-in-time check — run `concord status` to re-check as new work is claimed.');
102
- }
103
- }
104
- else {
105
- lines.push(`Potential overlaps (${String(result.overlaps.length)} of ${String(result.checkedAgainst)} active task(s)):`);
106
- for (const overlap of result.overlaps) {
107
- lines.push(` - ${overlap.taskId} (${overlap.title}): ${overlap.reasons.join('; ')}`);
108
- }
109
- }
110
- if (result.breadthReasons.length > 0) {
111
- lines.push(`Heads-up: this claim looks broad (${result.breadthReasons.join('; ')}). ` +
112
- 'Consider splitting it into smaller, independently-handoffable tasks and claiming each separately.');
113
- }
114
- return lines.join('\n');
115
- }
116
- /** The `claim_work` MCP structured output. All keys are snake_case, including
117
- * overlap entries, so the payload is internally consistent. */
118
- export function toClaimWorkStructured(result) {
119
- return {
120
- task_id: result.task.taskId,
121
- parent_task_id: result.task.parentTaskId,
122
- already_claimed: result.alreadyClaimed,
123
- overlaps: result.overlaps.map((overlap) => ({
124
- task_id: overlap.taskId,
125
- title: overlap.title,
126
- reasons: overlap.reasons,
127
- })),
128
- checked_against: result.checkedAgainst,
129
- breadth_reasons: result.breadthReasons,
130
- scope_added: result.scopeAdded,
131
- };
132
- }
133
- export function registerClaimWork(server, repos, onWrite) {
134
- server.registerTool('claim_work', {
135
- title: 'Claim work',
136
- description: 'Record that an agent is starting a task and flag overlaps with other active tasks. ' +
137
- 'Call this before editing code. Overlap detection is point-in-time (only against tasks ' +
138
- 'already active at claim time); run `concord status` to re-check as others claim.',
139
- inputSchema: claimWorkInputShape,
140
- }, (args) => {
141
- const result = handleClaimWork(repos, args);
142
- onWrite?.();
143
- return {
144
- content: [{ type: 'text', text: formatClaimWorkText(result) }],
145
- structuredContent: toClaimWorkStructured(result),
146
- };
147
- });
148
- }
149
94
  //# sourceMappingURL=claim-work.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"claim-work.js","sourceRoot":"","sources":["../../src/tools/claim-work.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,cAAc,EAAuB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AA2BhF,uEAAuE;AACvE,SAAS,WAAW,CAAC,QAA2B,EAAE,QAA2B;IAC3E,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,QAAQ,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,+DAA+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KAAK,CAAC,QAAQ,IAAI,IAAI;YAChC,GAAG,KAAK;YACR,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI;YAC1B,YAAY;YACZ,OAAO,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;SAChC,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,QAAQ,CAAC;IACnE,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;QAClB,MAAM,EAAE,KAAK,CAAC,OAAO;QACrB,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI;KAC7E,CAAC,CAAC;IAEH,8EAA8E;IAC9E,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACjC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,IAAI;QACJ,cAAc,EAAE,QAAQ,KAAK,SAAS;QACtC,QAAQ;QACR,cAAc,EAAE,YAAY,CAAC,MAAM;QACnC,cAAc,EAAE,kBAAkB,CAAC,KAAK,CAAC;QACzC,UAAU;KACX,CAAC;AACJ,CAAC"}
@@ -1,13 +1,13 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import type { HandoffRecord, Repositories, ReviewRecord, TaskRecord, TaskUpdateRecord } from '../db/index.js';
1
+ import type { HandoffRecord, OwnershipEventRecord, Repositories, ReviewRecord, TaskRecord, TaskUpdateRecord } from '../db/index.js';
2
+ import type { GetTaskContextInput } from '../domain/operations.js';
3
3
  import { type OverlapWarning } from '../domain/overlap.js';
4
- import { type GetTaskContextInput } from '../domain/schemas.js';
5
4
  export interface TaskContextResult {
6
5
  task: TaskRecord;
7
6
  updates: TaskUpdateRecord[];
8
7
  latestHandoff: HandoffRecord | undefined;
9
8
  latestReview: ReviewRecord | undefined;
10
9
  overlaps: OverlapWarning[];
10
+ pendingHandoff: HandoffRecord | undefined;
11
+ ownershipHistory: OwnershipEventRecord[];
11
12
  }
12
13
  export declare function handleGetTaskContext(repos: Repositories, input: GetTaskContextInput): TaskContextResult;
13
- export declare function registerGetTaskContext(server: McpServer, repos: Repositories): void;