codeam-cli 2.61.80 → 2.61.81

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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@ All notable changes to `codeam-cli` are documented here.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.61.80] — 2026-08-03
8
+
9
+ ### Fixed
10
+
11
+ - **cli:** MCP tools/call watchdog — a hung MCP server no longer wedges the turn
12
+
7
13
  ## [2.61.79] — 2026-07-31
8
14
 
9
15
  ### Fixed
package/dist/index.js CHANGED
@@ -89,6 +89,165 @@ var require_src = __commonJS({
89
89
  }
90
90
  });
91
91
 
92
+ // src/integrations/convex-admin-mcp.ts
93
+ var convex_admin_mcp_exports = {};
94
+ __export(convex_admin_mcp_exports, {
95
+ callConvexTool: () => callConvexTool,
96
+ deploymentNameFromKey: () => deploymentNameFromKey,
97
+ runConvexAdminMcp: () => runConvexAdminMcp
98
+ });
99
+ function deploymentNameFromKey(key) {
100
+ const prefix = key.split("|")[0];
101
+ const segs = prefix.split(":");
102
+ if ((segs[0] === "dev" || segs[0] === "prod" || segs[0] === "preview") && segs[1]) {
103
+ return segs[1];
104
+ }
105
+ return null;
106
+ }
107
+ async function adminQuery(baseUrl, key, api, body, fetchImpl = fetch) {
108
+ const res = await fetchImpl(`${baseUrl}/api/${api}`, {
109
+ method: "POST",
110
+ headers: { Authorization: `Convex ${key}`, "Content-Type": "application/json" },
111
+ body: JSON.stringify(body)
112
+ });
113
+ const text = await res.text();
114
+ const ok = res.ok && !/"status"\s*:\s*"error"/.test(text);
115
+ return { ok, text };
116
+ }
117
+ async function callConvexTool(baseUrl, key, tool, args2, fetchImpl = fetch) {
118
+ switch (tool) {
119
+ case "tables":
120
+ return adminQuery(baseUrl, key, "query", {
121
+ path: "_system/frontend/getTableMapping",
122
+ args: {},
123
+ format: "json"
124
+ }, fetchImpl);
125
+ case "schema":
126
+ return adminQuery(baseUrl, key, "query", {
127
+ path: "_system/frontend/getSchemas",
128
+ args: {},
129
+ format: "json"
130
+ }, fetchImpl);
131
+ case "data":
132
+ return adminQuery(baseUrl, key, "query", {
133
+ path: "_system/cli/queryTable",
134
+ args: { tableName: String(args2.table ?? ""), order: "desc", limit: Number(args2.limit ?? 50) },
135
+ format: "json"
136
+ }, fetchImpl);
137
+ case "run_query":
138
+ return adminQuery(baseUrl, key, "query", {
139
+ path: String(args2.functionPath ?? ""),
140
+ args: args2.args ?? {},
141
+ format: "json"
142
+ }, fetchImpl);
143
+ case "run_mutation":
144
+ return adminQuery(baseUrl, key, "mutation", {
145
+ path: String(args2.functionPath ?? ""),
146
+ args: args2.args ?? {},
147
+ format: "json"
148
+ }, fetchImpl);
149
+ default:
150
+ return { ok: false, text: `Unknown tool: ${tool}` };
151
+ }
152
+ }
153
+ async function runConvexAdminMcp(client3, id) {
154
+ const token = await client3.getToken(id);
155
+ const key = token.accessToken;
156
+ const name = deploymentNameFromKey(key);
157
+ if (!name) {
158
+ process.stderr.write(
159
+ `[codeam mcp-run convex] could not derive a deployment from the deploy key (expected a dev/prod deploy key like dev:name|\u2026 \u2014 got prefix "${key.split(":")[0]}"). Generate a deploy key at Convex Dashboard \u2192 Project Settings \u2192 Deploy Keys.
160
+ `
161
+ );
162
+ process.exit(1);
163
+ }
164
+ const baseUrl = `https://${name}.convex.cloud`;
165
+ const { Server } = await import("@modelcontextprotocol/sdk/server/index.js");
166
+ const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
167
+ const { ListToolsRequestSchema, CallToolRequestSchema } = await import("@modelcontextprotocol/sdk/types.js");
168
+ const server = new Server(
169
+ { name: "convex", version: "1.0.0" },
170
+ { capabilities: { tools: {} } }
171
+ );
172
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
173
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
174
+ const tool = req.params.name;
175
+ const args2 = req.params.arguments ?? {};
176
+ try {
177
+ const { ok, text } = await callConvexTool(baseUrl, key, tool, args2);
178
+ return { content: [{ type: "text", text }], isError: !ok };
179
+ } catch (err) {
180
+ return {
181
+ content: [
182
+ {
183
+ type: "text",
184
+ text: `Convex admin API request failed: ${err instanceof Error ? err.message : String(err)}`
185
+ }
186
+ ],
187
+ isError: true
188
+ };
189
+ }
190
+ });
191
+ await server.connect(new StdioServerTransport());
192
+ }
193
+ var TOOLS;
194
+ var init_convex_admin_mcp = __esm({
195
+ "src/integrations/convex-admin-mcp.ts"() {
196
+ "use strict";
197
+ TOOLS = [
198
+ {
199
+ name: "tables",
200
+ description: "List the tables in the connected Convex deployment (name + id). Start here to discover the schema.",
201
+ inputSchema: { type: "object", properties: {}, additionalProperties: false }
202
+ },
203
+ {
204
+ name: "schema",
205
+ description: "Get the deployed schema (table definitions + validators) of the Convex deployment.",
206
+ inputSchema: { type: "object", properties: {}, additionalProperties: false }
207
+ },
208
+ {
209
+ name: "data",
210
+ description: "Read documents from a table (most-recent first). Provide the table name.",
211
+ inputSchema: {
212
+ type: "object",
213
+ properties: {
214
+ table: { type: "string", description: "The table name (from `tables`)." },
215
+ limit: { type: "number", description: "Max documents to return (default 50)." }
216
+ },
217
+ required: ["table"],
218
+ additionalProperties: false
219
+ }
220
+ },
221
+ {
222
+ name: "run_query",
223
+ description: 'Run a read-only Convex query function by its path (e.g. "messages:list") with JSON args.',
224
+ inputSchema: {
225
+ type: "object",
226
+ properties: {
227
+ functionPath: { type: "string", description: 'Function path, e.g. "messages:list".' },
228
+ args: { type: "object", description: "Arguments object for the function (default {})." }
229
+ },
230
+ required: ["functionPath"],
231
+ additionalProperties: false
232
+ }
233
+ },
234
+ {
235
+ name: "run_mutation",
236
+ description: "Run a Convex mutation function by its path with JSON args (writes data).",
237
+ inputSchema: {
238
+ type: "object",
239
+ properties: {
240
+ functionPath: { type: "string" },
241
+ args: { type: "object" }
242
+ },
243
+ required: ["functionPath"],
244
+ additionalProperties: false
245
+ }
246
+ }
247
+ ];
248
+ }
249
+ });
250
+
92
251
  // src/integrations/http-relay.ts
93
252
  var http_relay_exports = {};
94
253
  __export(http_relay_exports, {
@@ -1521,15 +1680,19 @@ var INTEGRATION_REGISTRY = {
1521
1680
  name: "Convex",
1522
1681
  icon: "convex",
1523
1682
  category: "database",
1524
- // LIVE — api_key rail (the user pastes a Convex DEPLOY KEY).
1525
- // ⚠️ Convex's OAuth application token was tried first and DOES NOT WORK with
1526
- // the MCP: it's a narrow Management-API credential — verified live it fails
1527
- // `convex mcp start` as BOTH CONVEX_DEPLOY_KEY and CONVEX_OVERRIDE_ACCESS_TOKEN,
1528
- // and can't even enumerate the team's deployments ("requires a Personal
1529
- // Access Token"). The Convex MCP's DOCUMENTED headless credential is a
1530
- // DEPLOY KEY (CONVEX_DEPLOY_KEY=dev:…|… / prod:… / project:…), so the user
1531
- // pastes one (Convex Dashboard Project Settings Deploy Keys), exactly
1532
- // like Azure DevOps / Datadog / Trello. No OAuth app, no GSM secret.
1683
+ // LIVE — api_key rail (the user pastes a Convex DEPLOY KEY) + a BUILT-IN MCP.
1684
+ // ⚠️ Convex's OWN `convex mcp start` server CANNOT work headlessly: it
1685
+ // categorically requires an INTERACTIVE `npx convex dev`/`login`
1686
+ // personal-access-token and REJECTS every headless credential OAuth token,
1687
+ // dev/prod deploy key, self-hosted admin key, with every flag
1688
+ // (--deployment/--prod/--project-dir) all return "Not Authorized: Run
1689
+ // `npx convex dev` to login" (verified LIVE, exhaustively, 2026-08-03; it
1690
+ // also HANGS on the failed auth = the mareado/no-Stop wedge). BUT the
1691
+ // deployment's own HTTP admin API accepts the deploy key directly
1692
+ // (`Authorization: Convex <deployKey>` → 200; verified). So we serve Convex's
1693
+ // tools ourselves via a BUILT-IN MCP (delivery.builtin) against that admin
1694
+ // API — see apps/cli/src/integrations/convex-admin-mcp.ts. The user still
1695
+ // pastes a deploy key (Dashboard → Project Settings → Deploy Keys).
1533
1696
  enabled: true,
1534
1697
  auth: {
1535
1698
  kind: "api_key",
@@ -1545,15 +1708,14 @@ var INTEGRATION_REGISTRY = {
1545
1708
  },
1546
1709
  delivery: {
1547
1710
  mcp: {
1548
- // Convex's OFFICIAL MCP server ships inside the `convex` npm package
1549
- // (`convex mcp start`). The pasted deploy key is fed via CONVEX_DEPLOY_KEY
1550
- // (env only, never argv)its documented non-interactive credential.
1551
- // Version PINNED; bump only after re-verifying headless.
1552
- command: "npx",
1553
- args: ["-y", "convex@1.42.3", "mcp", "start"],
1554
- envMapping: {
1555
- CONVEX_DEPLOY_KEY: "accessToken"
1556
- }
1711
+ // BUILT-IN MCP: the CLI serves Convex's tools itself against the
1712
+ // deployment admin REST API with the brokered deploy key (Convex's own
1713
+ // `convex mcp start` rejects all headless creds see the note above).
1714
+ // No spawned child, no npx. command/args/envMapping are empty.
1715
+ builtin: "convex-admin",
1716
+ command: "",
1717
+ args: [],
1718
+ envMapping: {}
1557
1719
  }
1558
1720
  }
1559
1721
  },
@@ -7364,7 +7526,7 @@ function readAnonId() {
7364
7526
  }
7365
7527
  function superProperties() {
7366
7528
  return {
7367
- cliVersion: true ? "2.61.80" : "0.0.0-dev",
7529
+ cliVersion: true ? "2.61.81" : "0.0.0-dev",
7368
7530
  nodeVersion: process.version,
7369
7531
  platform: process.platform,
7370
7532
  arch: process.arch,
@@ -7545,7 +7707,7 @@ var os4 = __toESM(require("os"));
7545
7707
  // package.json
7546
7708
  var package_default = {
7547
7709
  name: "codeam-cli",
7548
- version: "2.61.80",
7710
+ version: "2.61.81",
7549
7711
  description: "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device \u2014 async. The terminal companion for CodeAgent Mobile.",
7550
7712
  type: "commonjs",
7551
7713
  main: "dist/index.js",
@@ -8777,7 +8939,7 @@ var CommandRelayService = class _CommandRelayService {
8777
8939
  // fresh + clear the "CLI update available" banner after a self-update
8778
8940
  // (a codespace that reinstalls @latest reconnects via heartbeat, not
8779
8941
  // pair/reconnect). Older backends ignore the extra field.
8780
- ..."2.61.80" ? { ideVersion: "2.61.80" } : {}
8942
+ ..."2.61.81" ? { ideVersion: "2.61.81" } : {}
8781
8943
  }).then(() => log.trace("relay", `heartbeat ok online=${online}`)).catch((err) => log.trace("relay", `heartbeat failed online=${online}`, err));
8782
8944
  }
8783
8945
  /**
@@ -19891,7 +20053,7 @@ async function autoUpgradeBeforeCriticalCommand() {
19891
20053
  if (process.env.NODE_ENV === "test") return;
19892
20054
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
19893
20055
  if (process.env.CI) return;
19894
- const current = true ? "2.61.80" : null;
20056
+ const current = true ? "2.61.81" : null;
19895
20057
  if (!current) return;
19896
20058
  const cache = readCache();
19897
20059
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -19908,7 +20070,7 @@ function checkForUpdates() {
19908
20070
  if (process.env.CODEAM_DISABLE_UPDATE_CHECK === "1") return;
19909
20071
  if (process.env.CI) return;
19910
20072
  if (!process.stdout.isTTY) return;
19911
- const current = true ? "2.61.80" : null;
20073
+ const current = true ? "2.61.81" : null;
19912
20074
  if (!current) return;
19913
20075
  const cache = readCache();
19914
20076
  const fresh = cache && Date.now() - cache.fetchedAt < TTL_MS;
@@ -19928,7 +20090,7 @@ var SELF_UPDATE_INTERVAL_MS = 60 * 60 * 1e3;
19928
20090
  var SELF_UPDATE_VIEW_TIMEOUT_MS = 3e4;
19929
20091
  var SELF_UPDATE_INSTALL_TIMEOUT_MS = 18e4;
19930
20092
  function currentCliVersion() {
19931
- return true ? "2.61.80" : null;
20093
+ return true ? "2.61.81" : null;
19932
20094
  }
19933
20095
  function runCmd(cmd, args2, timeoutMs) {
19934
20096
  return new Promise((resolve9) => {
@@ -40626,7 +40788,7 @@ function checkChokidar() {
40626
40788
  }
40627
40789
  async function doctor(args2 = []) {
40628
40790
  const json = args2.includes("--json");
40629
- const cliVersion = true ? "2.61.80" : "0.0.0-dev";
40791
+ const cliVersion = true ? "2.61.81" : "0.0.0-dev";
40630
40792
  const apiBase2 = resolveApiBaseUrl();
40631
40793
  const diagnosticId = (0, import_node_crypto13.randomUUID)();
40632
40794
  log.info("doctor", `run id=${diagnosticId} cli=${cliVersion}`);
@@ -41167,6 +41329,17 @@ async function mcpRun(args2) {
41167
41329
  `);
41168
41330
  process.exit(1);
41169
41331
  }
41332
+ if (delivery.builtin === "convex-admin") {
41333
+ const client4 = new IntegrationTokenClient({
41334
+ sessionId,
41335
+ pluginId,
41336
+ pluginAuthToken,
41337
+ pollSecret: process.env.CODEAM_MCP_POLL_SECRET
41338
+ });
41339
+ const { runConvexAdminMcp: runConvexAdminMcp2 } = await Promise.resolve().then(() => (init_convex_admin_mcp(), convex_admin_mcp_exports));
41340
+ await runConvexAdminMcp2(client4, id);
41341
+ return;
41342
+ }
41170
41343
  if (delivery.httpUrl) {
41171
41344
  const httpClient = new IntegrationTokenClient({
41172
41345
  sessionId,
@@ -41205,7 +41378,7 @@ async function mcpRun(args2) {
41205
41378
  // src/commands/version.ts
41206
41379
  var import_picocolors15 = __toESM(require("picocolors"));
41207
41380
  function version2() {
41208
- const v = true ? "2.61.80" : "unknown";
41381
+ const v = true ? "2.61.81" : "unknown";
41209
41382
  console.log(`${import_picocolors15.default.bold("codeam-cli")} ${import_picocolors15.default.cyan(v)}`);
41210
41383
  }
41211
41384
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeam-cli",
3
- "version": "2.61.80",
3
+ "version": "2.61.81",
4
4
  "description": "Workflow-continuity bridge for AI coding agents. Wrap Claude Code or Codex in a PTY and supervise, approve, and redirect the session from any device — async. The terminal companion for CodeAgent Mobile.",
5
5
  "type": "commonjs",
6
6
  "main": "dist/index.js",