@concord-ai/concord-mcp 0.11.0 → 0.12.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 (75) hide show
  1. package/dist/cli/commands/adapters.js +12 -1
  2. package/dist/cli/commands/adapters.js.map +1 -1
  3. package/dist/cli/commands/cloud-codex.d.ts +14 -0
  4. package/dist/cli/commands/cloud-codex.js +148 -0
  5. package/dist/cli/commands/cloud-codex.js.map +1 -0
  6. package/dist/cli/commands/cloud-hooks.d.ts +11 -0
  7. package/dist/cli/commands/cloud-hooks.js +121 -0
  8. package/dist/cli/commands/cloud-hooks.js.map +1 -0
  9. package/dist/cli/commands/cloud-inbox.d.ts +49 -0
  10. package/dist/cli/commands/cloud-inbox.js +167 -0
  11. package/dist/cli/commands/cloud-inbox.js.map +1 -0
  12. package/dist/cli/commands/cloud-views.d.ts +11 -0
  13. package/dist/cli/commands/cloud-views.js +92 -0
  14. package/dist/cli/commands/cloud-views.js.map +1 -0
  15. package/dist/cli/commands/cloud.d.ts +41 -0
  16. package/dist/cli/commands/cloud.js +226 -0
  17. package/dist/cli/commands/cloud.js.map +1 -0
  18. package/dist/cli/commands/export.js +7 -0
  19. package/dist/cli/commands/export.js.map +1 -1
  20. package/dist/cli/commands/hook.js +39 -19
  21. package/dist/cli/commands/hook.js.map +1 -1
  22. package/dist/cli/commands/inbox.js +129 -57
  23. package/dist/cli/commands/inbox.js.map +1 -1
  24. package/dist/cli/commands/session-start-message.d.ts +8 -0
  25. package/dist/cli/commands/session-start-message.js +21 -0
  26. package/dist/cli/commands/session-start-message.js.map +1 -0
  27. package/dist/cli/commands/status.js +4 -2
  28. package/dist/cli/commands/status.js.map +1 -1
  29. package/dist/cli/commands/tasks.js +4 -2
  30. package/dist/cli/commands/tasks.js.map +1 -1
  31. package/dist/cli/commands/who.js +4 -2
  32. package/dist/cli/commands/who.js.map +1 -1
  33. package/dist/cli/index.js +16 -1
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/cloud/browser-login.d.ts +27 -0
  36. package/dist/cloud/browser-login.js +115 -0
  37. package/dist/cloud/browser-login.js.map +1 -0
  38. package/dist/cloud/client.d.ts +68 -0
  39. package/dist/cloud/client.js +114 -0
  40. package/dist/cloud/client.js.map +1 -0
  41. package/dist/cloud/http-transport.d.ts +18 -0
  42. package/dist/cloud/http-transport.js +40 -0
  43. package/dist/cloud/http-transport.js.map +1 -0
  44. package/dist/cloud/proxy.d.ts +56 -0
  45. package/dist/cloud/proxy.js +162 -0
  46. package/dist/cloud/proxy.js.map +1 -0
  47. package/dist/cloud/runtime.d.ts +152 -0
  48. package/dist/cloud/runtime.js +332 -0
  49. package/dist/cloud/runtime.js.map +1 -0
  50. package/dist/cloud/settings.d.ts +62 -0
  51. package/dist/cloud/settings.js +162 -0
  52. package/dist/cloud/settings.js.map +1 -0
  53. package/dist/cloud/tokens.d.ts +20 -0
  54. package/dist/cloud/tokens.js +87 -0
  55. package/dist/cloud/tokens.js.map +1 -0
  56. package/dist/config/paths.d.ts +13 -0
  57. package/dist/config/paths.js +40 -0
  58. package/dist/config/paths.js.map +1 -1
  59. package/dist/domain/project-key.d.ts +23 -0
  60. package/dist/domain/project-key.js +109 -0
  61. package/dist/domain/project-key.js.map +1 -0
  62. package/dist/domain/pull-inbox.d.ts +12 -0
  63. package/dist/domain/pull-inbox.js +14 -1
  64. package/dist/domain/pull-inbox.js.map +1 -1
  65. package/dist/domain/schemas.d.ts +1 -1
  66. package/dist/index.js +11 -2
  67. package/dist/index.js.map +1 -1
  68. package/dist/install/adapters/index.js +6 -13
  69. package/dist/install/adapters/index.js.map +1 -1
  70. package/dist/server.d.ts +1 -1
  71. package/dist/version.d.ts +1 -1
  72. package/dist/version.js +1 -1
  73. package/package.json +1 -1
  74. package/plugin/concord-relay/scripts/watch-inbox.sh +11 -0
  75. package/plugin/cursor/concord-relay/cursor-hook.mjs +16 -1
@@ -8,6 +8,8 @@ import { CodexDaemonClient } from '../../relay/codex-client.js';
8
8
  import { startAgentRelay } from '../../relay/server.js';
9
9
  import { installGlobalAdapters, renderAdapterReport, statusGlobalAdapters, uninstallGlobalAdapters, } from '../../install/adapters/index.js';
10
10
  import { openContext } from '../context.js';
11
+ import { hostCodexInCloud } from './cloud-codex.js';
12
+ import { cloudAccess } from './cloud-inbox.js';
11
13
  async function hostCodex(agentId, threadId) {
12
14
  const context = openContext(process.cwd());
13
15
  ensureAgentRegistered(context.repos, { agentId, kind: 'codex' }, context.repoRoot);
@@ -152,6 +154,15 @@ export function registerAdaptersCommand(program) {
152
154
  .command('host-codex', { hidden: true })
153
155
  .requiredOption('--agent <id>')
154
156
  .requiredOption('--thread <id>')
155
- .action(async (options) => hostCodex(options.agent, options.thread));
157
+ .action(async (options) => {
158
+ const access = cloudAccess(process.cwd());
159
+ if (access.kind === 'unusable')
160
+ throw new Error(`Concord Cloud: ${access.reason}`);
161
+ if (access.kind === 'cloud') {
162
+ await hostCodexInCloud(access.runtime, options.agent, options.thread);
163
+ return;
164
+ }
165
+ await hostCodex(options.agent, options.thread);
166
+ });
156
167
  }
157
168
  //# sourceMappingURL=adapters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapters.js","sourceRoot":"","sources":["../../../src/cli/commands/adapters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,qBAAqB,EACrB,mBAA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,YAAY,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SACvC,cAAc,CAAC,cAAc,CAAC;SAC9B,cAAc,CAAC,eAAe,CAAC;SAC/B,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,IAAI,MAAM,CAAC,IAAI,KAAK,UAAU;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACnF,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,MAAM,gBAAgB,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YACtE,OAAO;QACT,CAAC;QACD,MAAM,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { type CloudRuntime } from '../../cloud/runtime.js';
2
+ import { type DeliverableMessage } from '../../domain/pull-inbox.js';
3
+ import type { AgentSessionAdapter } from '../../relay/server.js';
4
+ /**
5
+ * Hands drained messages to the session, one at a time and never two at once.
6
+ * A handoff has no time limit: a wedged session stalls the host, which then
7
+ * drains nothing more and lets its receiver lease lapse, so later messages
8
+ * wait for the session's hooks instead. Stopping the host ends a handoff in
9
+ * progress and hands over nothing more. Every message not handed over — or
10
+ * whose handoff ended unconfirmed — is reported as not delivered.
11
+ */
12
+ export declare function deliverToSession(runtime: CloudRuntime, agentKey: string, adapter: AgentSessionAdapter, messages: readonly DeliverableMessage[], stop?: AbortSignal): Promise<void>;
13
+ /** Hosts one Codex thread's live receiver against the cloud, until stopped. */
14
+ export declare function hostCodexInCloud(runtime: CloudRuntime, agentKey: string, threadId: string): Promise<void>;
@@ -0,0 +1,148 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { z } from 'zod';
5
+ import { before, CloudApiError, agentCachePath, readAgentState, reportDeliveryFailure, } from '../../cloud/runtime.js';
6
+ import { renderInboxBody } from '../../domain/pull-inbox.js';
7
+ import { CodexAppServerAdapter } from '../../relay/adapters.js';
8
+ import { CodexDaemonClient } from '../../relay/codex-client.js';
9
+ import { RELAY_PROTOCOL_VERSION } from '../../relay/protocol.js';
10
+ import { watchCloud } from './cloud-inbox.js';
11
+ /**
12
+ * Codex, live, in a repository linked to Concord Cloud. The cloud cannot dial
13
+ * this machine, so the local host that already steers Codex through its
14
+ * app-server pulls instead: it holds the session's receiver and long-polls the
15
+ * cloud, and hands each message to Codex as it arrives — steering a turn under
16
+ * way, or starting one when Codex is idle — as the local relay does.
17
+ */
18
+ /** How often saved failure reports are tried again while the host runs. */
19
+ const REPORT_RETRY_MS = 60_000;
20
+ const undeliveredSchema = z.object({ messageId: z.string(), detail: z.string() });
21
+ /** One file per report not yet made, so hosts never rewrite each other's. */
22
+ function unreportedDir(runtime, agentKey) {
23
+ return agentCachePath(runtime.repoRoot, agentKey).replace(/\.json$/, '.unreported');
24
+ }
25
+ function savedReports(dir) {
26
+ if (!existsSync(dir))
27
+ return [];
28
+ return readdirSync(dir).flatMap((name) => {
29
+ try {
30
+ const raw = JSON.parse(readFileSync(join(dir, name), 'utf8'));
31
+ const parsed = undeliveredSchema.safeParse(raw);
32
+ return parsed.success ? [{ ...parsed.data, file: join(dir, name) }] : [];
33
+ }
34
+ catch {
35
+ return [];
36
+ }
37
+ });
38
+ }
39
+ /**
40
+ * Tells the cloud these messages were not delivered, so their senders do not
41
+ * take silence for delivery. The batch was drained, so a report that cannot be
42
+ * made now is saved and made on a later round, with any saved before.
43
+ */
44
+ async function reportUndelivered(runtime, agentKey, failures) {
45
+ const state = readAgentState(runtime, agentKey);
46
+ if (state === undefined)
47
+ return;
48
+ const dir = unreportedDir(runtime, agentKey);
49
+ const pending = [
50
+ ...savedReports(dir),
51
+ ...failures.map((failure) => ({ ...failure, file: undefined })),
52
+ ];
53
+ for (const failure of pending) {
54
+ let keep = false;
55
+ try {
56
+ await reportDeliveryFailure(runtime, state, failure.messageId, failure.detail);
57
+ }
58
+ catch (error) {
59
+ // Refused for good (the message moved on): nothing a retry would change.
60
+ keep = !(error instanceof CloudApiError && error.status < 500 && error.status !== 429);
61
+ }
62
+ if (keep && failure.file === undefined) {
63
+ mkdirSync(dir, { recursive: true });
64
+ const file = join(dir, `${createHash('sha256').update(failure.messageId).digest('hex').slice(0, 16)}.json`);
65
+ writeFileSync(file, JSON.stringify({ messageId: failure.messageId, detail: failure.detail }));
66
+ }
67
+ else if (!keep && failure.file !== undefined) {
68
+ rmSync(failure.file, { force: true });
69
+ }
70
+ }
71
+ }
72
+ /**
73
+ * Hands drained messages to the session, one at a time and never two at once.
74
+ * A handoff has no time limit: a wedged session stalls the host, which then
75
+ * drains nothing more and lets its receiver lease lapse, so later messages
76
+ * wait for the session's hooks instead. Stopping the host ends a handoff in
77
+ * progress and hands over nothing more. Every message not handed over — or
78
+ * whose handoff ended unconfirmed — is reported as not delivered.
79
+ */
80
+ export async function deliverToSession(runtime, agentKey, adapter, messages, stop) {
81
+ const failures = [];
82
+ const stopped = () => stop?.aborted === true;
83
+ for (const message of messages) {
84
+ if (stopped()) {
85
+ failures.push({
86
+ messageId: message.messageId,
87
+ detail: 'The Codex host stopped before handing it over.',
88
+ });
89
+ continue;
90
+ }
91
+ const delivery = {
92
+ version: RELAY_PROTOCOL_VERSION,
93
+ type: 'deliver',
94
+ messageId: message.messageId,
95
+ senderAgentId: message.senderAgentId,
96
+ recipientAgentId: agentKey,
97
+ // Framed as every other channel frames it, so the session knows who
98
+ // wrote and which id to answer.
99
+ content: renderInboxBody([message]),
100
+ };
101
+ const handoff = adapter.isBusy() ? adapter.steer(delivery) : adapter.inject(delivery);
102
+ try {
103
+ await (stop === undefined ? handoff : before(handoff, stop));
104
+ }
105
+ catch (error) {
106
+ const detail = stopped()
107
+ ? 'The Codex host stopped before Codex confirmed it; it may not have arrived.'
108
+ : error instanceof Error
109
+ ? error.message
110
+ : String(error);
111
+ process.stderr.write(`Concord: could not hand ${message.messageId} to Codex: ${detail}\n`);
112
+ failures.push({ messageId: message.messageId, detail });
113
+ }
114
+ }
115
+ await reportUndelivered(runtime, agentKey, failures);
116
+ }
117
+ /** Hosts one Codex thread's live receiver against the cloud, until stopped. */
118
+ export async function hostCodexInCloud(runtime, agentKey, threadId) {
119
+ const client = new CodexDaemonClient();
120
+ await client.connect();
121
+ await client.resumeThread(threadId);
122
+ const adapter = new CodexAppServerAdapter(client, threadId, () => client.currentTurnId());
123
+ // Reports saved while the cloud was unreachable are made now and every
124
+ // minute, not only when the next message happens to arrive.
125
+ // One pass at a time: a slow cloud must not stack passes sending the same reports.
126
+ let flushing = false;
127
+ const flush = () => {
128
+ if (flushing)
129
+ return;
130
+ flushing = true;
131
+ void reportUndelivered(runtime, agentKey, [])
132
+ .catch(() => undefined)
133
+ .finally(() => {
134
+ flushing = false;
135
+ });
136
+ };
137
+ flush();
138
+ const retrying = setInterval(flush, REPORT_RETRY_MS);
139
+ retrying.unref();
140
+ try {
141
+ await watchCloud(runtime, agentKey, 'codex', false, (messages, stop) => deliverToSession(runtime, agentKey, adapter, messages, stop));
142
+ }
143
+ finally {
144
+ clearInterval(retrying);
145
+ client.close();
146
+ }
147
+ }
148
+ //# sourceMappingURL=cloud-codex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-codex.js","sourceRoot":"","sources":["../../../src/cli/commands/cloud-codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE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I,qBAAqB,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1F,uEAAuE;IACvE,4DAA4D;IAC5D,mFAAmF;IACnF,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,IAAI,QAAQ;YAAE,OAAO;QACrB,QAAQ,GAAG,IAAI,CAAC;QAChB,KAAK,iBAAiB,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC;aAC1C,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC;aACtB,OAAO,CAAC,GAAG,EAAE;YACZ,QAAQ,GAAG,KAAK,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC;IACF,KAAK,EAAE,CAAC;IACR,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,QAAQ,CAAC,KAAK,EAAE,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,UAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CACrE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAC7D,CAAC;IACJ,CAAC;YAAS,CAAC;QACT,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxB,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type CloudRuntime } from '../../cloud/runtime.js';
2
+ import type { HookDecision, SessionStartResult } from './hook.js';
3
+ /**
4
+ * The local guard's rule, over the cloud's claims: another task holding the
5
+ * file blocks the edit when `CONCORD_TASK` names the caller's own task, and
6
+ * warns otherwise. Claims held by this session's own agent are never a
7
+ * conflict — the cloud says who holds each one, which the local check cannot.
8
+ */
9
+ export declare function decideCloudPreToolUse(runtime: CloudRuntime, rawJson: string, selfTaskId: string | undefined, selfAgentKey: string | undefined): Promise<HookDecision>;
10
+ /** Session start in a linked repository: registered in the cloud, and told who else is there. */
11
+ export declare function handleCloudSessionStart(runtime: CloudRuntime, rawJson: string, env?: NodeJS.ProcessEnv): Promise<SessionStartResult>;
@@ -0,0 +1,121 @@
1
+ import { isAbsolute } from 'node:path';
2
+ import { z } from 'zod';
3
+ import { repoRelative } from '../../cloud/proxy.js';
4
+ import { listClaims, listCloudAgents, } from '../../cloud/runtime.js';
5
+ import { UNRESOLVED_IDENTITY_MESSAGE } from '../../domain/identity.js';
6
+ import { deriveLiveness } from '../../domain/presence.js';
7
+ import { sessionStartIdentity } from '../agent-identity.js';
8
+ import { registerInCloud } from './cloud-inbox.js';
9
+ import { sessionStartMessage } from './session-start-message.js';
10
+ /**
11
+ * The Claude Code hooks in a repository linked to Concord Cloud: the edit
12
+ * guard asks the cloud who holds a file, and session start registers there and
13
+ * names everyone in the organization, on any machine.
14
+ *
15
+ * Neither records telemetry: these are not local operations.
16
+ */
17
+ const preToolUsePayloadSchema = z
18
+ .object({
19
+ tool_input: z.object({ file_path: z.string().optional() }).loose().optional(),
20
+ })
21
+ .loose();
22
+ /**
23
+ * The guard runs before every edit, and Cloud Run may be starting from zero:
24
+ * past this, the edit goes ahead with a warning rather than stalling.
25
+ */
26
+ const GUARD_TIMEOUT_MS = 3_000;
27
+ const NOT_APPLICABLE = {
28
+ block: false,
29
+ message: '',
30
+ result: 'not_applicable',
31
+ conflictingTaskCount: 0,
32
+ };
33
+ /**
34
+ * The local guard's rule, over the cloud's claims: another task holding the
35
+ * file blocks the edit when `CONCORD_TASK` names the caller's own task, and
36
+ * warns otherwise. Claims held by this session's own agent are never a
37
+ * conflict — the cloud says who holds each one, which the local check cannot.
38
+ */
39
+ export async function decideCloudPreToolUse(runtime, rawJson, selfTaskId, selfAgentKey) {
40
+ let parsed;
41
+ try {
42
+ parsed = JSON.parse(rawJson);
43
+ }
44
+ catch {
45
+ return NOT_APPLICABLE;
46
+ }
47
+ const filePath = preToolUsePayloadSchema.parse(parsed).tool_input?.file_path;
48
+ if (filePath === undefined || filePath === '')
49
+ return NOT_APPLICABLE;
50
+ const file = repoRelative(runtime, filePath);
51
+ // Outside this repository: nothing the project's claims could cover.
52
+ if (isAbsolute(file))
53
+ return NOT_APPLICABLE;
54
+ let claims;
55
+ try {
56
+ claims = await listClaims(runtime, [file], AbortSignal.timeout(GUARD_TIMEOUT_MS));
57
+ }
58
+ catch (error) {
59
+ const detail = error instanceof Error ? error.message : String(error);
60
+ return {
61
+ block: false,
62
+ message: `Concord: could not check ${file} against Concord Cloud (${detail}); editing anyway.`,
63
+ result: 'not_applicable',
64
+ conflictingTaskCount: 0,
65
+ };
66
+ }
67
+ const others = claims.filter((claim) => claim.taskKey !== selfTaskId &&
68
+ (selfAgentKey === undefined || claim.agentKey !== selfAgentKey));
69
+ if (others.length === 0) {
70
+ return { block: false, message: '', result: 'clear', conflictingTaskCount: 0 };
71
+ }
72
+ const tasks = [...new Map(others.map((claim) => [claim.taskKey, claim])).values()];
73
+ const detail = tasks
74
+ .map((claim) => `${claim.taskKey} (${claim.title}, ${claim.agentKey ?? 'unassigned'})`)
75
+ .join(', ');
76
+ if (selfTaskId === undefined) {
77
+ return {
78
+ block: false,
79
+ message: `Concord: ${file} is also claimed by ${detail}. Set CONCORD_TASK=<your task id> to block colliding edits.`,
80
+ result: 'warned',
81
+ conflictingTaskCount: tasks.length,
82
+ };
83
+ }
84
+ return {
85
+ block: true,
86
+ message: `Concord: ${file} is claimed by another active task (${detail}). Coordinate or update your claim before editing.`,
87
+ result: 'blocked',
88
+ conflictingTaskCount: tasks.length,
89
+ };
90
+ }
91
+ const sessionStartPayloadSchema = z
92
+ .object({ session_id: z.string().optional(), cwd: z.string().optional() })
93
+ .loose();
94
+ /** Session start in a linked repository: registered in the cloud, and told who else is there. */
95
+ export async function handleCloudSessionStart(runtime, rawJson, env = process.env) {
96
+ let parsed;
97
+ try {
98
+ parsed = JSON.parse(rawJson);
99
+ }
100
+ catch {
101
+ parsed = {};
102
+ }
103
+ const payload = sessionStartPayloadSchema.parse(parsed);
104
+ const identity = sessionStartIdentity(payload.session_id, env);
105
+ if (identity === undefined) {
106
+ return { agentId: undefined, message: `Concord: ${UNRESOLVED_IDENTITY_MESSAGE}` };
107
+ }
108
+ await registerInCloud(runtime, identity.agentId, identity.kind, payload.cwd ?? process.cwd());
109
+ const now = Date.now();
110
+ const others = (await listCloudAgents(runtime))
111
+ .filter((agent) => agent.agentKey !== identity.agentId)
112
+ .map((agent) => ({
113
+ agentId: agent.agentKey,
114
+ liveness: deriveLiveness(agent.lastSeenAt, now),
115
+ status: agent.status,
116
+ summary: agent.summary,
117
+ }))
118
+ .filter((peer) => peer.liveness !== 'archived');
119
+ return { agentId: identity.agentId, message: sessionStartMessage(identity.agentId, others) };
120
+ }
121
+ //# sourceMappingURL=cloud-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-hooks.js","sourceRoot":"","sources":["../../../src/cli/commands/cloud-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,UAAU,EACV,eAAe,GAGhB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE;;;;;;GAMG;AAEH,MAAM,uBAAuB,GAAG,CAAC;KAC9B,MAAM,CAAC;I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;SAC5C,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,OAAO,CAAC;SACtD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACf,OAAO,EAAE,KAAK,CAAC,QAAQ;QACvB,QAAQ,EAAE,cAAc,CAAC,KAAK,CAAC,UAAU,EAAE,GAAG,CAAC;QAC/C,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;KACvB,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,UAAU,CAAC,CAAC;IAClD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,EAAE,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { type CloudAgentRef, type CloudRuntime } from '../../cloud/runtime.js';
2
+ import type { DeliverableMessage } from '../../domain/pull-inbox.js';
3
+ /**
4
+ * The inbox commands, in a repository linked to Concord Cloud: the same output,
5
+ * from the cloud instead of `.concord/concord.db`.
6
+ *
7
+ * None of this records telemetry: these are not local operations, and the
8
+ * cloud records its own usage.
9
+ */
10
+ /** Whether this directory's repository is linked to Concord Cloud. */
11
+ export declare function cloudLinked(cwd: string, env?: NodeJS.ProcessEnv): boolean;
12
+ /** Where a command's work lives: locally, in the cloud, or in a link this machine cannot use. */
13
+ export type CloudAccess = {
14
+ readonly kind: 'local';
15
+ } | {
16
+ readonly kind: 'cloud';
17
+ readonly runtime: CloudRuntime;
18
+ } | {
19
+ readonly kind: 'unusable';
20
+ readonly reason: string;
21
+ };
22
+ /**
23
+ * A hook runs inside the harness's own time limit (Cursor allows 15 s, Grok
24
+ * 5 s), so all its requests, retries included, are over within this.
25
+ */
26
+ export declare const HOOK_TIMEOUT_MS = 4000;
27
+ export declare function cloudAccess(cwd: string, options?: {
28
+ readonly timeoutMs?: number;
29
+ }, env?: NodeJS.ProcessEnv): CloudAccess;
30
+ /** Whether a running `inbox watch` on this machine holds the agent's receiver. */
31
+ export declare function watching(runtime: CloudRuntime, agentKey: string): boolean;
32
+ /**
33
+ * Registers the session (from the cached ids when known) and advertises its
34
+ * endpoint. A fresh registration advertises before its ids are kept, so one
35
+ * that could not be advertised is registered again next time.
36
+ */
37
+ export declare function registerInCloud(runtime: CloudRuntime, agentKey: string, provider: string, cwd: string, asMonitor?: boolean): Promise<CloudAgentRef>;
38
+ /** Takes every message waiting for the session, as a hook does after a tool call. */
39
+ export declare function drainFromCloud(runtime: CloudRuntime, agentKey: string, provider: string): Promise<DeliverableMessage[]>;
40
+ /**
41
+ * The session's live receiver: long-polls the cloud, so a message arrives
42
+ * within moments rather than on the next two-second poll. Each round renews
43
+ * the receiver lease and waits on one drain. Stops on SIGINT, SIGTERM or
44
+ * SIGHUP, after the first batch with `once`, or on a failure retrying cannot
45
+ * fix (a lapsed login); releases the lease either way.
46
+ */
47
+ export declare function watchCloud(runtime: CloudRuntime, agentKey: string, provider: string, once: boolean,
48
+ /** Awaited before the next round, so a slow handoff never overlaps the next batch. */
49
+ emit: (messages: readonly DeliverableMessage[], stop: AbortSignal) => Promise<void> | void): Promise<void>;
@@ -0,0 +1,167 @@
1
+ import { setTimeout as delay } from 'node:timers/promises';
2
+ import { cloudSessionFor } from '../../cloud/proxy.js';
3
+ import { asCloudAgent, CloudApiError, connectPullEndpoint, drainCloud, MAX_WAIT_SECONDS, readAgentState, releaseReceiver, renewReceiver, takeDrainKey, toDeliverables, updateAgentState, } from '../../cloud/runtime.js';
4
+ import { readLink } from '../../cloud/settings.js';
5
+ import { resolveCheckoutRoot, resolveRepoRoot } from '../../config/paths.js';
6
+ import { capabilityFor, encodeCapabilities, monitorCapabilityFor } from '../../domain/delivery.js';
7
+ /**
8
+ * The inbox commands, in a repository linked to Concord Cloud: the same output,
9
+ * from the cloud instead of `.concord/concord.db`.
10
+ *
11
+ * None of this records telemetry: these are not local operations, and the
12
+ * cloud records its own usage.
13
+ */
14
+ /** Whether this directory's repository is linked to Concord Cloud. */
15
+ export function cloudLinked(cwd, env = process.env) {
16
+ try {
17
+ return readLink(resolveRepoRoot(cwd, env)) !== undefined;
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
23
+ /**
24
+ * A hook runs inside the harness's own time limit (Cursor allows 15 s, Grok
25
+ * 5 s), so all its requests, retries included, are over within this.
26
+ */
27
+ export const HOOK_TIMEOUT_MS = 4_000;
28
+ export function cloudAccess(cwd, options = {}, env = process.env) {
29
+ if (!cloudLinked(cwd, env))
30
+ return { kind: 'local' };
31
+ try {
32
+ // The checkout this command runs in, which in a linked worktree is not the
33
+ // primary one holding the link: paths are made relative to it.
34
+ const session = cloudSessionFor(resolveRepoRoot(cwd, env), env, undefined, resolveCheckoutRoot(cwd, env));
35
+ if (session === undefined)
36
+ return { kind: 'local' };
37
+ const deadline = options.timeoutMs === undefined ? {} : { deadline: Date.now() + options.timeoutMs };
38
+ return { kind: 'cloud', runtime: { ...session, fetch, ...deadline } };
39
+ }
40
+ catch (error) {
41
+ // Linked, but not logged in, or logged in elsewhere: say so, never fall
42
+ // back to a local inbox no other agent would see.
43
+ return { kind: 'unusable', reason: error instanceof Error ? error.message : String(error) };
44
+ }
45
+ }
46
+ /** How long the receiver lease lasts; renewed well within it each round. */
47
+ const RECEIVER_TTL_SECONDS = 90;
48
+ /** Pause after a failed round, so an outage is not met with a request storm. */
49
+ const RETRY_DELAY_MS = 5_000;
50
+ /** Whether a running `inbox watch` on this machine holds the agent's receiver. */
51
+ export function watching(runtime, agentKey) {
52
+ return (readAgentState(runtime, agentKey)?.watchingUntil ?? 0) > Date.now();
53
+ }
54
+ /**
55
+ * Advertises the session as able to drain its messages. A running monitor's
56
+ * idle reach is kept: advertising less would make the agent look unreachable
57
+ * while it waits, and re-registering clears the cloud's receiver lease, so the
58
+ * lease is taken again on the monitor's behalf.
59
+ */
60
+ async function advertise(runtime, agent, agentKey, provider, asMonitor) {
61
+ const monitor = asMonitor || watching(runtime, agentKey);
62
+ const capability = monitor ? monitorCapabilityFor(provider) : capabilityFor(provider);
63
+ await connectPullEndpoint(runtime, agent, agentKey, provider, encodeCapabilities(capability));
64
+ if (monitor && !asMonitor)
65
+ await renewReceiver(runtime, agent, RECEIVER_TTL_SECONDS);
66
+ }
67
+ /**
68
+ * Registers the session (from the cached ids when known) and advertises its
69
+ * endpoint. A fresh registration advertises before its ids are kept, so one
70
+ * that could not be advertised is registered again next time.
71
+ */
72
+ export function registerInCloud(runtime, agentKey, provider, cwd, asMonitor = false) {
73
+ let advertised = false;
74
+ const advertiseOnce = async (agent) => {
75
+ await advertise(runtime, agent, agentKey, provider, asMonitor);
76
+ advertised = true;
77
+ };
78
+ return asCloudAgent(runtime, { agentKey, kind: provider, cwd }, async (agent) => {
79
+ if (!advertised)
80
+ await advertiseOnce(agent);
81
+ return agent;
82
+ }, advertiseOnce);
83
+ }
84
+ /** A failure worth repeating: the network, a timeout, or the cloud briefly unwell. */
85
+ function transient(error) {
86
+ if (error instanceof CloudApiError)
87
+ return error.status === 429 || error.status >= 500;
88
+ return error instanceof TypeError || error.name === 'TimeoutError';
89
+ }
90
+ /**
91
+ * Drains once, under a key held until the answer arrives: a drain whose answer
92
+ * was lost — to the network, a timeout, or the process ending — is retried
93
+ * with its key, now or by a later drain, and the cloud replays its batch.
94
+ */
95
+ async function drainOnce(runtime, agent, agentKey, waitSeconds, signal) {
96
+ const ticket = takeDrainKey(runtime, agentKey);
97
+ let messages;
98
+ try {
99
+ // A replayed key answers at once, so it never waits.
100
+ messages = await drainCloud(runtime, agent, ticket.key, ticket.replay ? 0 : waitSeconds, signal);
101
+ }
102
+ catch (error) {
103
+ if (signal?.aborted === true || !(error instanceof Error) || !transient(error))
104
+ throw error;
105
+ messages = await drainCloud(runtime, agent, ticket.key, 0, signal);
106
+ }
107
+ ticket.finish();
108
+ return toDeliverables(messages);
109
+ }
110
+ /** Takes every message waiting for the session, as a hook does after a tool call. */
111
+ export function drainFromCloud(runtime, agentKey, provider) {
112
+ return asCloudAgent(runtime, { agentKey, kind: provider }, (agent) => drainOnce(runtime, agent, agentKey, 0),
113
+ // Registered here because session start could not: advertise it too, as
114
+ // every local drain does.
115
+ (agent) => advertise(runtime, agent, agentKey, provider, false));
116
+ }
117
+ /**
118
+ * The session's live receiver: long-polls the cloud, so a message arrives
119
+ * within moments rather than on the next two-second poll. Each round renews
120
+ * the receiver lease and waits on one drain. Stops on SIGINT, SIGTERM or
121
+ * SIGHUP, after the first batch with `once`, or on a failure retrying cannot
122
+ * fix (a lapsed login); releases the lease either way.
123
+ */
124
+ export async function watchCloud(runtime, agentKey, provider, once,
125
+ /** Awaited before the next round, so a slow handoff never overlaps the next batch. */
126
+ emit) {
127
+ const stop = new AbortController();
128
+ const stopped = () => stop.signal.aborted;
129
+ const stopWatching = () => {
130
+ stop.abort();
131
+ };
132
+ const signals = ['SIGINT', 'SIGTERM', 'SIGHUP'];
133
+ for (const name of signals)
134
+ process.once(name, stopWatching);
135
+ let agent;
136
+ try {
137
+ while (!stopped()) {
138
+ try {
139
+ agent ??= await registerInCloud(runtime, agentKey, provider, process.cwd(), true);
140
+ await renewReceiver(runtime, agent, RECEIVER_TTL_SECONDS);
141
+ updateAgentState(runtime, agentKey, {
142
+ watchingUntil: Date.now() + RECEIVER_TTL_SECONDS * 1000,
143
+ });
144
+ const messages = await drainOnce(runtime, agent, agentKey, MAX_WAIT_SECONDS, stop.signal);
145
+ if (messages.length > 0)
146
+ await emit(messages, stop.signal);
147
+ if (once && messages.length > 0)
148
+ return;
149
+ }
150
+ catch (error) {
151
+ if (stopped())
152
+ return;
153
+ if (!(error instanceof Error) || !transient(error))
154
+ throw error;
155
+ await delay(RETRY_DELAY_MS, undefined, { signal: stop.signal }).catch(() => undefined);
156
+ }
157
+ }
158
+ }
159
+ finally {
160
+ for (const name of signals)
161
+ process.off(name, stopWatching);
162
+ updateAgentState(runtime, agentKey, { watchingUntil: undefined });
163
+ if (agent !== undefined)
164
+ await releaseReceiver(runtime, agent).catch(() => undefined);
165
+ }
166
+ }
167
+ //# sourceMappingURL=cloud-inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cloud-inbox.js","sourceRoot":"","sources":["../../../src/cli/commands/cloud-inbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,EACZ,cAAc,EACd,gBAAgB,GAGjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGnG;;;;;;GAMG;AAEH,sEAAsE;AACtE,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,MAAyB,OAAO,CAAC,GAAG;IAC3E,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAQD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAErC,MAAM,UAAU,WAAW,CACzB,GAAW,EACX,UAA2C,EAAE,EAC7C,MAAyB,OAAO,CAAC,GAAG;IAEpC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC;QAAE,OAAO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AE,MAAM,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC3D,IAAI,IAAI,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;oBAAE,OAAO;YAC1C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,OAAO,EAAE;oBAAE,OAAO;gBACtB,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;oBAAE,MAAM,KAAK,CAAC;gBAChE,MAAM,KAAK,CAAC,cAAc,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YACzF,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,MAAM,IAAI,IAAI,OAAO;YAAE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC5D,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC,CAAC;QAClE,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACxF,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { type CloudRuntime } from '../../cloud/runtime.js';
2
+ /** Everyone in the organization, on any machine, liveliest first. */
3
+ export declare function runCloudWho(runtime: CloudRuntime, now?: number): Promise<string>;
4
+ /** The project's tasks, in the local `tasks` table's layout, holders by key. */
5
+ export declare function runCloudTasks(runtime: CloudRuntime): Promise<string>;
6
+ /** The workspace as agents see it: the cloud's own `inspect_work` overview. */
7
+ export declare function runCloudStatus(runtime: CloudRuntime): Promise<string>;
8
+ /** Why `export` does nothing here: its artifacts are written from the local database. */
9
+ export declare const CLOUD_EXPORT_MESSAGE: string;
10
+ /** Runs `view` against the cloud for a linked repository; undefined when it is local. */
11
+ export declare function inCloud(cwd: string, view: (runtime: CloudRuntime) => Promise<string>): Promise<string | undefined>;