@concord-ai/concord-mcp 0.15.0 → 0.16.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 (103) hide show
  1. package/README.md +1 -1
  2. package/dist/artifacts/work-state-view.d.ts +2 -0
  3. package/dist/artifacts/work-state-view.js +5 -1
  4. package/dist/artifacts/work-state-view.js.map +1 -1
  5. package/dist/cli/agent-identity.d.ts +8 -0
  6. package/dist/cli/agent-identity.js +15 -0
  7. package/dist/cli/agent-identity.js.map +1 -1
  8. package/dist/cli/commands/adapters.js +23 -1
  9. package/dist/cli/commands/adapters.js.map +1 -1
  10. package/dist/cli/commands/copilot-adapter.js +2 -0
  11. package/dist/cli/commands/copilot-adapter.js.map +1 -1
  12. package/dist/cli/commands/copilot-hooks.d.ts +9 -1
  13. package/dist/cli/commands/copilot-hooks.js +37 -6
  14. package/dist/cli/commands/copilot-hooks.js.map +1 -1
  15. package/dist/cli/commands/hook.js +15 -2
  16. package/dist/cli/commands/hook.js.map +1 -1
  17. package/dist/cli/commands/inbox-observe.d.ts +56 -0
  18. package/dist/cli/commands/inbox-observe.js +234 -0
  19. package/dist/cli/commands/inbox-observe.js.map +1 -0
  20. package/dist/cli/commands/inbox.d.ts +8 -5
  21. package/dist/cli/commands/inbox.js +83 -12
  22. package/dist/cli/commands/inbox.js.map +1 -1
  23. package/dist/cli/commands/messages.d.ts +18 -0
  24. package/dist/cli/commands/messages.js +59 -0
  25. package/dist/cli/commands/messages.js.map +1 -0
  26. package/dist/cli/index.js +2 -0
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/db/connection.js +6 -0
  29. package/dist/db/connection.js.map +1 -1
  30. package/dist/db/index.d.ts +1 -1
  31. package/dist/db/index.js.map +1 -1
  32. package/dist/db/message-rows.d.ts +70 -0
  33. package/dist/db/message-rows.js +115 -0
  34. package/dist/db/message-rows.js.map +1 -0
  35. package/dist/db/messaging-v2-migration.d.ts +13 -0
  36. package/dist/db/messaging-v2-migration.js +98 -0
  37. package/dist/db/messaging-v2-migration.js.map +1 -0
  38. package/dist/db/repositories/agent-endpoints.d.ts +5 -0
  39. package/dist/db/repositories/agent-endpoints.js +11 -0
  40. package/dist/db/repositories/agent-endpoints.js.map +1 -1
  41. package/dist/db/repositories/agent-messages.d.ts +61 -5
  42. package/dist/db/repositories/agent-messages.js +217 -18
  43. package/dist/db/repositories/agent-messages.js.map +1 -1
  44. package/dist/db/rows.d.ts +4 -38
  45. package/dist/db/rows.js +3 -72
  46. package/dist/db/rows.js.map +1 -1
  47. package/dist/db/schema.js +34 -0
  48. package/dist/db/schema.js.map +1 -1
  49. package/dist/domain/delivery.d.ts +6 -0
  50. package/dist/domain/delivery.js +12 -1
  51. package/dist/domain/delivery.js.map +1 -1
  52. package/dist/domain/identity.d.ts +6 -0
  53. package/dist/domain/identity.js +18 -0
  54. package/dist/domain/identity.js.map +1 -1
  55. package/dist/domain/pull-inbox.d.ts +5 -0
  56. package/dist/domain/pull-inbox.js +11 -1
  57. package/dist/domain/pull-inbox.js.map +1 -1
  58. package/dist/domain/receipts.d.ts +62 -0
  59. package/dist/domain/receipts.js +169 -0
  60. package/dist/domain/receipts.js.map +1 -0
  61. package/dist/domain/schemas.d.ts +2 -2
  62. package/dist/domain/schemas.js +7 -1
  63. package/dist/domain/schemas.js.map +1 -1
  64. package/dist/install/instructions.d.ts +1 -1
  65. package/dist/relay/adapters.d.ts +3 -1
  66. package/dist/relay/adapters.js +10 -2
  67. package/dist/relay/adapters.js.map +1 -1
  68. package/dist/relay/codex-client.d.ts +4 -0
  69. package/dist/relay/codex-client.js +13 -12
  70. package/dist/relay/codex-client.js.map +1 -1
  71. package/dist/relay/codex-notifications.d.ts +20 -0
  72. package/dist/relay/codex-notifications.js +55 -0
  73. package/dist/relay/codex-notifications.js.map +1 -0
  74. package/dist/relay/codex-read-tracker.d.ts +21 -0
  75. package/dist/relay/codex-read-tracker.js +106 -0
  76. package/dist/relay/codex-read-tracker.js.map +1 -0
  77. package/dist/relay/protocol.d.ts +1 -0
  78. package/dist/relay/protocol.js +2 -0
  79. package/dist/relay/protocol.js.map +1 -1
  80. package/dist/relay/server.d.ts +2 -0
  81. package/dist/relay/server.js +1 -0
  82. package/dist/relay/server.js.map +1 -1
  83. package/dist/relay/socket-dispatcher.js +1 -0
  84. package/dist/relay/socket-dispatcher.js.map +1 -1
  85. package/dist/server.d.ts +1 -1
  86. package/dist/tools/agent-messages.d.ts +4 -0
  87. package/dist/tools/agent-messages.js +48 -17
  88. package/dist/tools/agent-messages.js.map +1 -1
  89. package/dist/tools/inspect-messages.d.ts +57 -0
  90. package/dist/tools/inspect-messages.js +76 -0
  91. package/dist/tools/inspect-messages.js.map +1 -0
  92. package/dist/tools/inspect-work.d.ts +24 -0
  93. package/dist/tools/inspect-work.js +40 -0
  94. package/dist/tools/inspect-work.js.map +1 -0
  95. package/dist/tools/workflow.d.ts +3 -20
  96. package/dist/tools/workflow.js +18 -35
  97. package/dist/tools/workflow.js.map +1 -1
  98. package/dist/version.d.ts +1 -1
  99. package/dist/version.js +1 -1
  100. package/package.json +1 -1
  101. package/plugin/concord-relay/hooks/hooks.json +47 -2
  102. package/plugin/concord-relay/scripts/watch-inbox.sh +29 -1
  103. package/plugin/cursor/concord-relay/cursor-hook.mjs +20 -3
@@ -11,6 +11,29 @@ set -uo pipefail
11
11
  CONCORD_BIN="${CONCORD_BIN:-concord}"
12
12
  CONCORD_INBOX_POLL_SECONDS="${CONCORD_INBOX_POLL_SECONDS:-2}"
13
13
 
14
+ # A monitor orphaned by a crashed or killed harness would keep draining
15
+ # messages into a pipe nobody reads, marking them delivered to a dead session.
16
+ # The harness is whatever started this script. Claude Code starts monitors
17
+ # through a shell wrapper (`zsh -c … eval`), which can outlive a crashed
18
+ # harness, so look through any shell parents to the process that launched
19
+ # them. Once that process is gone, stop. A harness that is itself pid 1 (a
20
+ # container) keeps working.
21
+ harness_pid() {
22
+ local pid="${PPID}" comm
23
+ for _ in 1 2 3; do
24
+ comm="$(ps -o comm= -p "${pid}" 2>/dev/null | sed 's#.*/##; s#^-##')"
25
+ case "${comm}" in
26
+ sh | bash | zsh | dash | fish) pid="$(ps -o ppid= -p "${pid}" 2>/dev/null | tr -d ' ')" ;;
27
+ *) break ;;
28
+ esac
29
+ done
30
+ printf '%s' "${pid}"
31
+ }
32
+ HARNESS_PID="$(harness_pid)"
33
+ harness_alive() {
34
+ [ -z "${HARNESS_PID}" ] || [ "${HARNESS_PID}" = "0" ] || kill -0 "${HARNESS_PID}" 2>/dev/null
35
+ }
36
+
14
37
  # Identity needs no configuration: Claude Code exports CLAUDE_CODE_SESSION_ID
15
38
  # into this process, and `concord inbox drain` derives the agent id from it.
16
39
  # CONCORD_AGENT_ID overrides it when a human wants to name the agents.
@@ -27,7 +50,7 @@ fi
27
50
  # not a new process every couple of seconds. Restarted after any failure it
28
51
  # cannot ride out itself (a lapsed login, say), slowly.
29
52
  if "${CONCORD_BIN}" inbox status --cloud >/dev/null 2>&1; then
30
- while true; do
53
+ while harness_alive; do
31
54
  "${CONCORD_BIN}" inbox watch --provider claude-code --format monitor 2>/dev/null || true
32
55
  sleep 30
33
56
  done
@@ -36,6 +59,11 @@ fi
36
59
  while true; do
37
60
  # Never let a transient failure (a locked database, a mid-write config) kill
38
61
  # the monitor: a dead monitor silently stops delivering messages.
62
+ # A drained message counts as delivered, never read: Claude Code may hold the
63
+ # notification while the agent is blocked on its user. Read is recorded by
64
+ # this plugin's hooks once the message id shows up in the session's prompt
65
+ # or transcript.
66
+ harness_alive || exit 0
39
67
  "${CONCORD_BIN}" inbox drain --format monitor 2>/dev/null || true
40
68
  sleep "${CONCORD_INBOX_POLL_SECONDS}"
41
69
  done
@@ -37,14 +37,18 @@ function concordExecutable() {
37
37
  return process.env.CONCORD_EXECUTABLE?.trim() || 'concord';
38
38
  }
39
39
 
40
- function runConcord(root, args, output = false) {
40
+ function runConcord(root, args, output = false, input = undefined) {
41
41
  const result = spawnCommandSync(concordExecutable(), args, {
42
42
  cwd: root,
43
43
  env: process.env,
44
44
  encoding: 'utf8',
45
45
  timeout: 12_000,
46
46
  windowsHide: true,
47
- stdio: output ? ['ignore', 'pipe', 'pipe'] : 'ignore',
47
+ ...(input === undefined ? {} : { input }),
48
+ stdio: [
49
+ input === undefined ? 'ignore' : 'pipe',
50
+ ...(output ? ['pipe', 'pipe'] : ['ignore', 'ignore']),
51
+ ],
48
52
  });
49
53
  if (result.error) throw result.error;
50
54
  if (result.status !== 0) {
@@ -141,10 +145,23 @@ async function main() {
141
145
 
142
146
  if (mode === 'stop') {
143
147
  register(root, agentId);
148
+ // The payload goes along so the drain can record which session took the
149
+ // messages and read evidence from the session transcript.
144
150
  const output = runConcord(
145
151
  root,
146
- ['inbox', 'drain', '--agent', agentId, '--provider', 'cursor', '--format', 'json'],
152
+ [
153
+ 'inbox',
154
+ 'drain',
155
+ '--agent',
156
+ agentId,
157
+ '--provider',
158
+ 'cursor',
159
+ '--payload-stdin',
160
+ '--format',
161
+ 'json',
162
+ ],
147
163
  true,
164
+ JSON.stringify(payload),
148
165
  );
149
166
  const parsed = JSON.parse(output || '[]');
150
167
  if (!Array.isArray(parsed) || parsed.length === 0) {