@concord-ai/concord-mcp 0.6.0 → 0.7.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 (82) hide show
  1. package/README.md +37 -35
  2. package/dist/artifacts/work-state-view.d.ts +8 -0
  3. package/dist/artifacts/work-state-view.js +19 -0
  4. package/dist/artifacts/work-state-view.js.map +1 -1
  5. package/dist/cli/agent-identity.d.ts +21 -0
  6. package/dist/cli/agent-identity.js +86 -0
  7. package/dist/cli/agent-identity.js.map +1 -0
  8. package/dist/cli/commands/doctor.js +4 -0
  9. package/dist/cli/commands/doctor.js.map +1 -1
  10. package/dist/cli/commands/hook.d.ts +2 -6
  11. package/dist/cli/commands/hook.js +12 -17
  12. package/dist/cli/commands/hook.js.map +1 -1
  13. package/dist/cli/commands/inbox.d.ts +16 -0
  14. package/dist/cli/commands/inbox.js +172 -0
  15. package/dist/cli/commands/inbox.js.map +1 -0
  16. package/dist/cli/commands/setup.d.ts +17 -0
  17. package/dist/cli/commands/setup.js +85 -0
  18. package/dist/cli/commands/setup.js.map +1 -0
  19. package/dist/cli/index.js +4 -4
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/cli/workspace-options.d.ts +1 -7
  22. package/dist/db/index.d.ts +7 -1
  23. package/dist/db/index.js +4 -0
  24. package/dist/db/index.js.map +1 -1
  25. package/dist/db/repositories/agent-endpoints.d.ts +22 -0
  26. package/dist/db/repositories/agent-endpoints.js +87 -0
  27. package/dist/db/repositories/agent-endpoints.js.map +1 -0
  28. package/dist/db/repositories/agent-messages.d.ts +30 -0
  29. package/dist/db/repositories/agent-messages.js +181 -0
  30. package/dist/db/repositories/agent-messages.js.map +1 -0
  31. package/dist/db/rows.d.ts +51 -0
  32. package/dist/db/rows.js +104 -0
  33. package/dist/db/rows.js.map +1 -1
  34. package/dist/db/schema.js +64 -0
  35. package/dist/db/schema.js.map +1 -1
  36. package/dist/domain/delivery.d.ts +39 -0
  37. package/dist/domain/delivery.js +54 -0
  38. package/dist/domain/delivery.js.map +1 -0
  39. package/dist/domain/operations.d.ts +1 -1
  40. package/dist/domain/pull-inbox.d.ts +28 -0
  41. package/dist/domain/pull-inbox.js +59 -0
  42. package/dist/domain/pull-inbox.js.map +1 -0
  43. package/dist/domain/schemas.d.ts +58 -31
  44. package/dist/domain/schemas.js +21 -2
  45. package/dist/domain/schemas.js.map +1 -1
  46. package/dist/install/claude-hooks.js +2 -2
  47. package/dist/install/claude-hooks.js.map +1 -1
  48. package/dist/install/codex-config.d.ts +14 -0
  49. package/dist/install/codex-config.js +80 -0
  50. package/dist/install/codex-config.js.map +1 -1
  51. package/dist/install/instructions.d.ts +3 -3
  52. package/dist/install/instructions.js +8 -5
  53. package/dist/install/instructions.js.map +1 -1
  54. package/dist/install/mcp-config.d.ts +1 -1
  55. package/dist/install/mcp-config.js +12 -4
  56. package/dist/install/mcp-config.js.map +1 -1
  57. package/dist/server.d.ts +1 -1
  58. package/dist/server.js.map +1 -1
  59. package/dist/telemetry/identity.js +1 -1
  60. package/dist/telemetry/identity.js.map +1 -1
  61. package/dist/telemetry/transport.js +5 -5
  62. package/dist/telemetry/transport.js.map +1 -1
  63. package/dist/tools/agent-messages.d.ts +36 -0
  64. package/dist/tools/agent-messages.js +126 -0
  65. package/dist/tools/agent-messages.js.map +1 -0
  66. package/dist/tools/get-task-context.d.ts +2 -1
  67. package/dist/tools/get-task-context.js +1 -0
  68. package/dist/tools/get-task-context.js.map +1 -1
  69. package/dist/tools/workflow.d.ts +10 -1
  70. package/dist/tools/workflow.js +152 -27
  71. package/dist/tools/workflow.js.map +1 -1
  72. package/dist/version.d.ts +1 -1
  73. package/dist/version.js +1 -1
  74. package/dist/workspaces/manager.js +6 -0
  75. package/dist/workspaces/manager.js.map +1 -1
  76. package/package.json +19 -18
  77. package/dist/cli/commands/init.d.ts +0 -6
  78. package/dist/cli/commands/init.js +0 -33
  79. package/dist/cli/commands/init.js.map +0 -1
  80. package/dist/cli/commands/install.d.ts +0 -2
  81. package/dist/cli/commands/install.js +0 -44
  82. package/dist/cli/commands/install.js.map +0 -1
@@ -0,0 +1,172 @@
1
+ import { randomBytes, randomUUID } from 'node:crypto';
2
+ import { existsSync, readFileSync } from 'node:fs';
3
+ import { databasePath, resolveRepoRoot } from '../../config/paths.js';
4
+ import { capabilityFor, encodeCapabilities } from '../../domain/delivery.js';
5
+ import { renderHookPayload, renderMonitorLines, } from '../../domain/pull-inbox.js';
6
+ import { resolveAgentId } from '../agent-identity.js';
7
+ import { openContext } from '../context.js';
8
+ /** How long a registered pull endpoint stays promptable between drains. */
9
+ const PULL_ENDPOINT_TTL_MS = 90_000;
10
+ /**
11
+ * Advertise that `agentId` can receive messages by draining them from inside
12
+ * its own session. Re-registering refreshes the lease, so a session that dies
13
+ * stops looking promptable instead of silently swallowing messages.
14
+ */
15
+ export function registerPullEndpoint(repos, agentId, provider, now = Date.now()) {
16
+ // The endpoint references an agent row. Hook execution order is not
17
+ // guaranteed, so do not assume the presence hook has already run — otherwise
18
+ // whether messaging works depends on which SessionStart hook fired first.
19
+ if (repos.agents.get(agentId) === undefined) {
20
+ repos.agents.upsert({
21
+ agentId,
22
+ kind: provider,
23
+ owner: null,
24
+ model: null,
25
+ pid: null,
26
+ cwd: process.cwd(),
27
+ worktree: null,
28
+ branch: null,
29
+ summary: null,
30
+ status: 'active',
31
+ });
32
+ }
33
+ const capability = capabilityFor(provider);
34
+ const existing = repos.agentEndpoints.getByAgent(agentId);
35
+ repos.agentEndpoints.upsert({
36
+ endpointId: existing?.endpointId ?? randomUUID(),
37
+ agentId,
38
+ provider,
39
+ transport: capability.transport,
40
+ capabilities: encodeCapabilities(capability),
41
+ address: `${capability.transport}:${agentId}`,
42
+ credentialHash: existing?.credentialHash ?? randomBytes(32).toString('hex'),
43
+ status: 'connected',
44
+ expiresAt: new Date(now + PULL_ENDPOINT_TTL_MS).toISOString(),
45
+ });
46
+ }
47
+ function toDeliverable(message) {
48
+ return {
49
+ messageId: message.messageId,
50
+ senderAgentId: message.senderAgentId,
51
+ taskId: message.taskId,
52
+ content: message.content,
53
+ };
54
+ }
55
+ /**
56
+ * Take every pending message for `agentId` and mark it delivered. Draining is
57
+ * what records delivery, so a message is only ever counted as delivered once
58
+ * the recipient has actually been handed it.
59
+ */
60
+ export function drainInbox(repos, agentId, provider) {
61
+ registerPullEndpoint(repos, agentId, provider);
62
+ const claimed = repos.agentMessages.claimPendingForRecipient(agentId, provider);
63
+ repos.agents.touch(agentId);
64
+ return claimed.map(toDeliverable);
65
+ }
66
+ /**
67
+ * Whether this repository already uses Concord.
68
+ *
69
+ * The relay plugin is installed once and then loads in every session, including
70
+ * repositories that have nothing to do with Concord. Opening a workspace
71
+ * creates it, so these commands must check first and stay quiet otherwise —
72
+ * merely having the plugin installed should never litter unrelated projects
73
+ * with `.concord/` state.
74
+ */
75
+ /**
76
+ * Read a hook payload piped on stdin. Only ever called behind `--from-hook`:
77
+ * a plugin monitor's stdin may stay open for the life of the session, and
78
+ * blocking on it there would silently wedge message delivery.
79
+ */
80
+ function readHookPayload() {
81
+ if (process.stdin.isTTY)
82
+ return undefined;
83
+ try {
84
+ return readFileSync(0, 'utf8');
85
+ }
86
+ catch {
87
+ return undefined;
88
+ }
89
+ }
90
+ function workspaceExists(cwd) {
91
+ try {
92
+ return existsSync(databasePath(resolveRepoRoot(cwd, process.env)));
93
+ }
94
+ catch {
95
+ return false;
96
+ }
97
+ }
98
+ export function registerInboxCommand(program) {
99
+ const inbox = program
100
+ .command('inbox')
101
+ .description('Receive live messages other agents addressed to this session');
102
+ inbox
103
+ .command('status')
104
+ .description('Exit 0 when this directory is a Concord workspace, 1 otherwise')
105
+ .action(() => {
106
+ // Lets the relay monitor bail out of a project that does not use Concord
107
+ // instead of polling for the life of the session.
108
+ if (!workspaceExists(process.cwd())) {
109
+ process.exitCode = 1;
110
+ return;
111
+ }
112
+ process.stdout.write('Concord workspace present.\n');
113
+ });
114
+ inbox
115
+ .command('register')
116
+ .description('Advertise this session as able to receive messages by draining them')
117
+ .option('--agent <id>', 'Agent id; defaults to CONCORD_AGENT_ID, then to the current session')
118
+ .option('--provider <name>', 'Client the agent runs in', 'claude-code')
119
+ .option('--from-hook', 'Read the session id from a hook payload on stdin (Codex)')
120
+ .action((options) => {
121
+ if (!workspaceExists(process.cwd()))
122
+ return;
123
+ const context = openContext(process.cwd());
124
+ const agentId = resolveAgentId(options.agent, process.env, {
125
+ kind: options.provider,
126
+ ...(options.fromHook === true ? { hookPayload: readHookPayload() ?? '' } : {}),
127
+ });
128
+ registerPullEndpoint(context.repos, agentId, options.provider);
129
+ // Name the id, not just the capability. Only this id has a delivery
130
+ // endpoint, so an agent that lets start_work mint a fresh one becomes
131
+ // unreachable while still looking registered.
132
+ process.stdout.write(`Concord: this session is agent \`${agentId}\` and can receive live messages from other ` +
133
+ `agents. Pass agent_id="${agentId}" to every Concord tool call; do not invent a ` +
134
+ 'different id.\n');
135
+ });
136
+ inbox
137
+ .command('drain')
138
+ .description('Print and acknowledge every message waiting for this agent')
139
+ .option('--agent <id>', 'Agent id; defaults to CONCORD_AGENT_ID, then to the current session')
140
+ .option('--provider <name>', 'Client the agent runs in', 'claude-code')
141
+ .option('--from-hook', 'Read the session id from a hook payload on stdin (Codex)')
142
+ .option('--format <format>', 'post-tool-use and stop emit hook JSON; monitor emits one line per message; json emits raw records', 'json')
143
+ .action((options) => {
144
+ if (!workspaceExists(process.cwd()))
145
+ return;
146
+ const context = openContext(process.cwd());
147
+ const agentId = resolveAgentId(options.agent, process.env, {
148
+ kind: options.provider,
149
+ ...(options.fromHook === true ? { hookPayload: readHookPayload() ?? '' } : {}),
150
+ });
151
+ const messages = drainInbox(context.repos, agentId, options.provider);
152
+ // Silence matters: a hook that prints on an empty inbox would inject
153
+ // noise into the session on every single tool call.
154
+ if (messages.length === 0)
155
+ return;
156
+ if (options.format === 'json') {
157
+ process.stdout.write(`${JSON.stringify(messages)}\n`);
158
+ return;
159
+ }
160
+ if (options.format === 'monitor') {
161
+ for (const line of renderMonitorLines(messages))
162
+ process.stdout.write(`${line}\n`);
163
+ return;
164
+ }
165
+ if (options.format === 'post-tool-use' || options.format === 'stop') {
166
+ process.stdout.write(renderHookPayload(options.format, messages));
167
+ return;
168
+ }
169
+ throw new Error(`Unknown --format: ${options.format}`);
170
+ });
171
+ }
172
+ //# sourceMappingURL=inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../../src/cli/commands/inbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAInD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,2EAA2E;AAC3E,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAmB,EACnB,OAAe,EACf,QAAgB,EAChB,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAEhB,oEAAoE;IACpE,6EAA6E;IAC7E,0EAA0E;IAC1E,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;QAC5C,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;YAClB,OAAO;YACP,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;YACX,GAAG,EAAE,IAAI;YACT,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;YAClB,QA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ACP,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Command } from '@commander-js/extra-typings';
2
+ export interface SetupOptions {
3
+ claudeHooks?: boolean;
4
+ mcp?: boolean;
5
+ env?: NodeJS.ProcessEnv;
6
+ }
7
+ export interface SetupResult {
8
+ repoRoot: string;
9
+ workspaceId: string;
10
+ concordPath: string;
11
+ written: string[];
12
+ }
13
+ /** Ensure Concord's generated workspace is ignored without changing other rules. */
14
+ export declare function ensureConcordIgnored(repoRoot: string): void;
15
+ /** Set up one repository completely: state, instructions, and client registration. */
16
+ export declare function runSetup(cwd: string, options?: SetupOptions): SetupResult;
17
+ export declare function registerSetupCommand(program: Command): void;
@@ -0,0 +1,85 @@
1
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { writeArtifacts } from '../../artifacts/index.js';
4
+ import { installClaudeHook } from '../../install/claude-hooks.js';
5
+ import { installCodexHooks, installCodexMcpConfig } from '../../install/codex-config.js';
6
+ import { installConcord } from '../../install/index.js';
7
+ import { McpConfigParseError, installMcpConfigs } from '../../install/mcp-config.js';
8
+ import { openContext } from '../context.js';
9
+ const CONCORD_GITIGNORE_ENTRY = '.concord/';
10
+ /** Ensure Concord's generated workspace is ignored without changing other rules. */
11
+ export function ensureConcordIgnored(repoRoot) {
12
+ const gitignorePath = join(repoRoot, '.gitignore');
13
+ const current = existsSync(gitignorePath) ? readFileSync(gitignorePath, 'utf8') : '';
14
+ const entries = current.split(/\r?\n/u).map((line) => line.trim());
15
+ if (entries.includes(CONCORD_GITIGNORE_ENTRY)) {
16
+ return;
17
+ }
18
+ const separator = current.length > 0 && !current.endsWith('\n') ? '\n' : '';
19
+ writeFileSync(gitignorePath, `${current}${separator}${CONCORD_GITIGNORE_ENTRY}\n`);
20
+ }
21
+ /** Set up one repository completely: state, instructions, and client registration. */
22
+ export function runSetup(cwd, options = {}) {
23
+ const env = options.env ?? process.env;
24
+ const ctx = openContext(cwd, env);
25
+ ensureConcordIgnored(ctx.repoRoot);
26
+ writeArtifacts(ctx.concordPath, ctx.repos);
27
+ const written = installConcord(ctx.repoRoot);
28
+ if (options.claudeHooks === true) {
29
+ written.push(installClaudeHook(ctx.repoRoot));
30
+ }
31
+ if (options.mcp !== false) {
32
+ written.push(...installMcpConfigs(ctx.repoRoot));
33
+ written.push(installCodexMcpConfig(env));
34
+ // Codex has no background-monitor equivalent, so hooks are the only way it
35
+ // can receive a message from another agent.
36
+ written.push(installCodexHooks(env));
37
+ }
38
+ return {
39
+ repoRoot: ctx.repoRoot,
40
+ workspaceId: ctx.workspaceId,
41
+ concordPath: ctx.concordPath,
42
+ // A file touched by two installers is still one file to the reader.
43
+ written: [...new Set(written)],
44
+ };
45
+ }
46
+ export function registerSetupCommand(program) {
47
+ program
48
+ .command('setup')
49
+ .description('Set up Concord state, instructions, and MCP clients for this repository')
50
+ .option('--claude-hooks', 'also install an opt-in Claude Code PreToolUse overlap hook into .claude/settings.json')
51
+ .option('--no-mcp', 'skip MCP client registration; write local state and instructions only')
52
+ .action((options) => {
53
+ try {
54
+ const setupOptions = { mcp: options.mcp };
55
+ if (options.claudeHooks === true) {
56
+ setupOptions.claudeHooks = true;
57
+ }
58
+ const result = runSetup(process.cwd(), setupOptions);
59
+ process.stdout.write(`Concord setup complete\n` +
60
+ ` repository: ${result.repoRoot}\n` +
61
+ ` workspace: ${result.workspaceId}\n` +
62
+ ` state: ${result.concordPath}\n` +
63
+ ` configured:\n`);
64
+ for (const path of result.written) {
65
+ process.stdout.write(` ${path}\n`);
66
+ }
67
+ if (options.claudeHooks === true) {
68
+ process.stdout.write('PreToolUse hook installed. Set CONCORD_TASK=<your task id> so it excludes your own claim.\n');
69
+ }
70
+ if (options.mcp) {
71
+ process.stdout.write('Restart your coding client so it reloads the project MCP server.\n' +
72
+ 'Codex: run /hooks once and trust the Concord hooks. Until you do, Codex skips ' +
73
+ 'them silently and cannot receive messages from other agents.\n');
74
+ }
75
+ }
76
+ catch (error) {
77
+ if (!(error instanceof McpConfigParseError)) {
78
+ throw error;
79
+ }
80
+ process.stderr.write(`${error.message}\n`);
81
+ process.exitCode = 1;
82
+ }
83
+ });
84
+ }
85
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/cli/commands/setup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,uBAAuB,GAAG,WAAW,CAAC;AAe5C,oFAAoF;AACpF,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACrF,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnE,IAAI,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAC9C,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,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AC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,KAAK,YAAY,mBAAmB,CAAC,EAAE,CAAC;gBAC5C,MAAM,KAAK,CAAC;YACd,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;YAC3C,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
package/dist/cli/index.js CHANGED
@@ -10,9 +10,9 @@ import { registerDoctorCommand } from './commands/doctor.js';
10
10
  import { registerExportCommand } from './commands/export.js';
11
11
  import { registerHandoffCommand } from './commands/handoff.js';
12
12
  import { registerHookCommand } from './commands/hook.js';
13
- import { registerInit } from './commands/init.js';
14
- import { registerInstallCommand } from './commands/install.js';
13
+ import { registerInboxCommand } from './commands/inbox.js';
15
14
  import { registerReviewPacketCommand } from './commands/review-packet.js';
15
+ import { registerSetupCommand } from './commands/setup.js';
16
16
  import { registerStatus } from './commands/status.js';
17
17
  import { registerTasks } from './commands/tasks.js';
18
18
  import { registerWatchCommand } from './commands/watch.js';
@@ -47,8 +47,7 @@ program.hook('postAction', (_command, actionCommand) => {
47
47
  activeCommand = undefined;
48
48
  }
49
49
  });
50
- registerInit(program);
51
- registerInstallCommand(program);
50
+ registerSetupCommand(program);
52
51
  registerStatus(program);
53
52
  registerWhoCommand(program);
54
53
  registerTasks(program);
@@ -56,6 +55,7 @@ registerCheckCommand(program);
56
55
  registerDashboardCommand(program);
57
56
  registerWatchCommand(program);
58
57
  registerHookCommand(program);
58
+ registerInboxCommand(program);
59
59
  registerHandoffCommand(program);
60
60
  registerReviewPacketCommand(program);
61
61
  registerExportCommand(program);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CA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,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAClC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAChC,2BAA2B,CAAC,OAAO,CAAC,CAAC;AACrC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAE/B,IAAI,CAAC;IACH,MAAM,uBAAuB,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;AAC7B,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QAChC,SAAS,EAAE,eAAe,CACxB,aAAa,CAAC,IAAI,EAClB,OAAO,EACP,WAAW,CAAC,GAAG,EAAE,GAAG,aAAa,CAAC,SAAS,CAC5C,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,CAAC;AACd,CAAC;QAAS,CAAC;IACT,MAAM,SAAS,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC"}
@@ -3,13 +3,7 @@ import type { WorkspaceIdentity } from '../workspaces/manager.js';
3
3
  declare const cliWorkspaceOptionsSchema: z.ZodObject<{
4
4
  repo: z.ZodOptional<z.ZodString>;
5
5
  workspace: z.ZodOptional<z.ZodString>;
6
- }, "strip", z.ZodTypeAny, {
7
- workspace?: string | undefined;
8
- repo?: string | undefined;
9
- }, {
10
- workspace?: string | undefined;
11
- repo?: string | undefined;
12
- }>;
6
+ }, z.core.$strip>;
13
7
  export type CliWorkspaceOptions = z.infer<typeof cliWorkspaceOptionsSchema>;
14
8
  export declare function parseCliWorkspaceOptions(input: unknown): CliWorkspaceOptions;
15
9
  /**
@@ -1,4 +1,6 @@
1
1
  import { type ConcordDatabase } from './connection.js';
2
+ import { type AgentEndpointRepository } from './repositories/agent-endpoints.js';
3
+ import { type AgentMessageRepository } from './repositories/agent-messages.js';
2
4
  import { type AgentRepository } from './repositories/agents.js';
3
5
  import { type EventRepository } from './repositories/events.js';
4
6
  import { type HandoffRepository } from './repositories/handoffs.js';
@@ -15,7 +17,9 @@ export type { NewTaskUpdate, TaskUpdateRepository } from './repositories/task-up
15
17
  export type { NewEvent, EventRepository } from './repositories/events.js';
16
18
  export type { NewOwnershipEvent, OwnershipEventRepository, } from './repositories/ownership-events.js';
17
19
  export type { NewAgent, AgentRepository } from './repositories/agents.js';
18
- export type { TaskRecord, TaskStatus, HandoffRecord, ReviewRecord, ProvenanceEntry, EventRecord, EventStatus, ToolName, TaskUpdateKind, TaskUpdateRecord, AgentRecord, AgentStatus, OwnershipEventRecord, HandoffDeliveryStatus, } from './rows.js';
20
+ export type { NewAgentEndpoint, AgentEndpointRepository } from './repositories/agent-endpoints.js';
21
+ export type { NewAgentMessage, AgentMessageRepository } from './repositories/agent-messages.js';
22
+ export type { TaskRecord, TaskStatus, HandoffRecord, ReviewRecord, ProvenanceEntry, EventRecord, EventStatus, ToolName, TaskUpdateKind, TaskUpdateRecord, AgentRecord, AgentStatus, OwnershipEventRecord, HandoffDeliveryStatus, AgentEndpointRecord, AgentEndpointStatus, AgentMessageRecord, AgentMessageStatus, AgentMessageErrorCode, AgentMessageEventRecord, } from './rows.js';
19
23
  /** The full set of Concord repositories bound to one database. */
20
24
  export interface Repositories {
21
25
  db: ConcordDatabase;
@@ -25,6 +29,8 @@ export interface Repositories {
25
29
  taskUpdates: TaskUpdateRepository;
26
30
  events: EventRepository;
27
31
  agents: AgentRepository;
32
+ agentEndpoints: AgentEndpointRepository;
33
+ agentMessages: AgentMessageRepository;
28
34
  ownershipEvents: OwnershipEventRepository;
29
35
  }
30
36
  /** Bind all repositories to an already-open database. */
package/dist/db/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { openDatabase } from './connection.js';
2
+ import { createAgentEndpointRepository, } from './repositories/agent-endpoints.js';
3
+ import { createAgentMessageRepository, } from './repositories/agent-messages.js';
2
4
  import { createAgentRepository } from './repositories/agents.js';
3
5
  import { createEventRepository } from './repositories/events.js';
4
6
  import { createHandoffRepository } from './repositories/handoffs.js';
@@ -17,6 +19,8 @@ export function createRepositories(db) {
17
19
  taskUpdates: createTaskUpdateRepository(db),
18
20
  events: createEventRepository(db),
19
21
  agents: createAgentRepository(db),
22
+ agentEndpoints: createAgentEndpointRepository(db),
23
+ agentMessages: createAgentMessageRepository(db),
20
24
  ownershipEvents: createOwnershipEventRepository(db),
21
25
  };
22
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAwB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAwB,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAwB,MAAM,0BAA0B,CAAC;AACvF,OAAO,EAAE,uBAAuB,EAA0B,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EACL,8BAA8B,GAE/B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAyB,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EACL,0BAA0B,GAE3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAuB,MAAM,yBAAyB,CAAC;AAGpF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAwC/C,yDAAyD;AACzD,MAAM,UAAU,kBAAkB,CAAC,EAAmB;IACpD,OAAO;QACL,EAAE;QACF,KAAK,EAAE,oBAAoB,CAAC,EAAE,CAAC;QAC/B,QAAQ,EAAE,uBAAuB,CAAC,EAAE,CAAC;QACrC,OAAO,EAAE,sBAAsB,CAAC,EAAE,CAAC;QACnC,WAAW,EAAE,0BAA0B,CAAC,EAAE,CAAC;QAC3C,MAAM,EAAE,qBA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jC,MAAM,EAAE,qBAAqB,CAAC,EAAE,CAAC;QACjC,cAAc,EAAE,6BAA6B,CAAC,EAAE,CAAC;QACjD,aAAa,EAAE,4BAA4B,CAAC,EAAE,CAAC;QAC/C,eAAe,EAAE,8BAA8B,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,OAAO,kBAAkB,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { ConcordDatabase } from '../connection.js';
2
+ import { type AgentEndpointRecord, type AgentEndpointStatus } from '../rows.js';
3
+ export interface NewAgentEndpoint {
4
+ endpointId: string;
5
+ agentId: string;
6
+ provider: string;
7
+ transport: string;
8
+ capabilities: readonly string[];
9
+ address: string;
10
+ credentialHash: string;
11
+ status?: AgentEndpointStatus;
12
+ expiresAt?: string | null;
13
+ }
14
+ export interface AgentEndpointRepository {
15
+ upsert(endpoint: NewAgentEndpoint): AgentEndpointRecord;
16
+ get(endpointId: string): AgentEndpointRecord | undefined;
17
+ getByAgent(agentId: string): AgentEndpointRecord | undefined;
18
+ list(): AgentEndpointRecord[];
19
+ heartbeat(endpointId: string, expiresAt?: string | null): AgentEndpointRecord | undefined;
20
+ disconnect(endpointId: string): AgentEndpointRecord | undefined;
21
+ }
22
+ export declare function createAgentEndpointRepository(db: ConcordDatabase): AgentEndpointRepository;
@@ -0,0 +1,87 @@
1
+ import { z } from 'zod';
2
+ import { parseAgentEndpointRow, serializeStringArray, } from '../rows.js';
3
+ const rawListSchema = z.array(z.unknown());
4
+ export function createAgentEndpointRepository(db) {
5
+ const upsertStmt = db.prepare(`
6
+ INSERT INTO agent_endpoints (
7
+ endpoint_id, agent_id, provider, transport, capabilities, address,
8
+ credential_hash, status, last_seen, expires_at, created_at, updated_at
9
+ ) VALUES (
10
+ @endpoint_id, @agent_id, @provider, @transport, @capabilities, @address,
11
+ @credential_hash, @status, @now, @expires_at, @now, @now
12
+ )
13
+ ON CONFLICT(agent_id) DO UPDATE SET
14
+ endpoint_id = excluded.endpoint_id,
15
+ provider = excluded.provider,
16
+ transport = excluded.transport,
17
+ capabilities = excluded.capabilities,
18
+ address = excluded.address,
19
+ credential_hash = excluded.credential_hash,
20
+ status = excluded.status,
21
+ last_seen = excluded.last_seen,
22
+ expires_at = excluded.expires_at,
23
+ updated_at = excluded.updated_at
24
+ `);
25
+ const getStmt = db.prepare('SELECT * FROM agent_endpoints WHERE endpoint_id = ?');
26
+ const getByAgentStmt = db.prepare('SELECT * FROM agent_endpoints WHERE agent_id = ?');
27
+ const listStmt = db.prepare('SELECT * FROM agent_endpoints ORDER BY created_at, endpoint_id');
28
+ const heartbeatStmt = db.prepare(`
29
+ UPDATE agent_endpoints
30
+ SET status = 'connected', last_seen = @now, expires_at = @expires_at, updated_at = @now
31
+ WHERE endpoint_id = @endpoint_id
32
+ `);
33
+ const disconnectStmt = db.prepare(`
34
+ UPDATE agent_endpoints
35
+ SET status = 'disconnected', updated_at = @now
36
+ WHERE endpoint_id = @endpoint_id
37
+ `);
38
+ function get(endpointId) {
39
+ const raw = getStmt.get(endpointId);
40
+ return raw === undefined ? undefined : parseAgentEndpointRow(raw);
41
+ }
42
+ function getByAgent(agentId) {
43
+ const raw = getByAgentStmt.get(agentId);
44
+ return raw === undefined ? undefined : parseAgentEndpointRow(raw);
45
+ }
46
+ return {
47
+ upsert(endpoint) {
48
+ const now = new Date().toISOString();
49
+ upsertStmt.run({
50
+ endpoint_id: endpoint.endpointId,
51
+ agent_id: endpoint.agentId,
52
+ provider: endpoint.provider,
53
+ transport: endpoint.transport,
54
+ capabilities: serializeStringArray(endpoint.capabilities),
55
+ address: endpoint.address,
56
+ credential_hash: endpoint.credentialHash,
57
+ status: endpoint.status ?? 'connected',
58
+ expires_at: endpoint.expiresAt ?? null,
59
+ now,
60
+ });
61
+ const stored = getByAgent(endpoint.agentId);
62
+ if (stored === undefined) {
63
+ throw new Error(`Agent endpoint ${endpoint.endpointId} could not be read back`);
64
+ }
65
+ return stored;
66
+ },
67
+ get,
68
+ getByAgent,
69
+ list() {
70
+ const raw = listStmt.all();
71
+ return rawListSchema.parse(raw).map(parseAgentEndpointRow);
72
+ },
73
+ heartbeat(endpointId, expiresAt = null) {
74
+ heartbeatStmt.run({
75
+ endpoint_id: endpointId,
76
+ expires_at: expiresAt,
77
+ now: new Date().toISOString(),
78
+ });
79
+ return get(endpointId);
80
+ },
81
+ disconnect(endpointId) {
82
+ disconnectStmt.run({ endpoint_id: endpointId, now: new Date().toISOString() });
83
+ return get(endpointId);
84
+ },
85
+ };
86
+ }
87
+ //# sourceMappingURL=agent-endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-endpoints.js","sourceRoot":"","sources":["../../../src/db/repositories/agent-endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GAGrB,MAAM,YAAY,CAAC;AAuBpB,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAE3C,MAAM,UAAU,6BAA6B,CAAC,EAAmB;IAC/D,MAAM,UAAU,GAAG,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;;;;;;;;GAmB7B,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,EAAE,CAAC,OAAO,CAAC,qDAAqD,CAAC,CAAC;IAClF,MAAM,cAAc,GAAG,EAAE,CAAC,OAAO,CAAC,kDAAkD,CAAC,CAAC;IACtF,MAAM,QAAQ,GAAG,EAAE,CAAC,OAAO,CAAC,gEAAgE,CAAC,CAAC;IAC9F,MAAM,aAAa,GAAG,EAAE,CAAC,OAAO,CAAC;;;;GAIhC,CAAC,CAAC;IACH,MAAM,cAAc,GAAG,EAAE,CAAC,OAAO,CAAC;;;;GAIjC,CAAC,CAAC;I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QACH,UAAU;QACV,IAAI;YACF,MAAM,GAAG,GAAY,QAAQ,CAAC,GAAG,EAAE,CAAC;YACpC,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QAC7D,CAAC;QACD,SAAS,CAAC,UAAU,EAAE,SAAS,GAAG,IAAI;YACpC,aAAa,CAAC,GAAG,CAAC;gBAChB,WAAW,EAAE,UAAU;gBACvB,UAAU,EAAE,SAAS;gBACrB,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aAC9B,CAAC,CAAC;YACH,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC;QACzB,CAAC;QACD,UAAU,CAAC,UAAU;YACnB,cAAc,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;YAC/E,OAAO,GAAG,CAAC,UAAU,CAAC,CAAC;QACzB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { ConcordDatabase } from '../connection.js';
2
+ import { type AgentMessageErrorCode, type AgentMessageEvent, type AgentMessageEventRecord, type AgentMessageRecord } from '../rows.js';
3
+ export interface NewAgentMessage {
4
+ messageId: string;
5
+ taskId: string | null;
6
+ senderAgentId: string;
7
+ recipientAgentId: string;
8
+ replyToMessageId: string | null;
9
+ content: string;
10
+ idempotencyKey: string;
11
+ }
12
+ export interface AgentMessageRepository {
13
+ create(message: NewAgentMessage): AgentMessageRecord;
14
+ get(messageId: string): AgentMessageRecord | undefined;
15
+ getByIdempotency(senderAgentId: string, idempotencyKey: string): AgentMessageRecord | undefined;
16
+ listByAgent(agentId: string): AgentMessageRecord[];
17
+ /**
18
+ * Atomically take every pending message for `agentId`, marking each
19
+ * delivered and returning only the ones this call actually claimed.
20
+ */
21
+ claimPendingForRecipient(agentId: string, provider: string): AgentMessageRecord[];
22
+ listByTask(taskId: string): AgentMessageRecord[];
23
+ listThread(messageId: string): AgentMessageRecord[];
24
+ markDelivered(messageId: string, provider: string, receipt: string | null): AgentMessageRecord;
25
+ markFailed(messageId: string, code: AgentMessageErrorCode, detail: string | null): AgentMessageRecord;
26
+ markReplied(messageId: string): AgentMessageRecord;
27
+ recordEvent(messageId: string, event: AgentMessageEvent, detail?: string | null): void;
28
+ listEvents(messageId: string): AgentMessageEventRecord[];
29
+ }
30
+ export declare function createAgentMessageRepository(db: ConcordDatabase): AgentMessageRepository;