From c18891191ec5b99901eeb74b3655678d19de5458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Guti=C3=A9rrez?= <35082514+alezmad@users.noreply.github.com> Date: Sun, 3 May 2026 01:26:58 +0100 Subject: [PATCH] chore(api): add /v1/me/ping sanity probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit confirms whether new GET routes under /me/* deploy correctly to vercel — diagnostic in the middle of the /me/topics 404 chase. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/scheduled_tasks.lock | 2 +- apps/cli/src/services/api/with-rest-key.ts | 16 ++++++++++++++++ packages/api/src/modules/mesh/v1-router.ts | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.claude/scheduled_tasks.lock b/.claude/scheduled_tasks.lock index ecf3078..c3f3484 100644 --- a/.claude/scheduled_tasks.lock +++ b/.claude/scheduled_tasks.lock @@ -1 +1 @@ -{"sessionId":"ae5dbe38-9c56-4d07-9fb6-a38cb8a250a6","pid":4612,"acquiredAt":1776217467441} \ No newline at end of file +{"sessionId":"ae5dbe38-9c56-4d07-9fb6-a38cb8a250a6","pid":3633,"procStart":"Fri May 1 22:40:56 2026","acquiredAt":1777683244936} \ No newline at end of file diff --git a/apps/cli/src/services/api/with-rest-key.ts b/apps/cli/src/services/api/with-rest-key.ts index 4a2d74f..f30cedd 100644 --- a/apps/cli/src/services/api/with-rest-key.ts +++ b/apps/cli/src/services/api/with-rest-key.ts @@ -45,6 +45,22 @@ export async function withRestKey( if (!result || !result.secret) { throw new Error("apikey mint failed — broker did not return a secret"); } + if (process.env.CLAUDEMESH_DEBUG_PROBE) { + const probeUrls = [ + "https://claudemesh.com/api/v1/me/workspace", + "https://claudemesh.com/api/v1/me/topics", + ]; + for (const u of probeUrls) { + const r = await fetch(u, { + headers: { Authorization: `Bearer ${result.secret}` }, + }); + const t = await r.text(); + console.error( + `[probe] ${u} → ${r.status} ${r.headers.get("content-type")} (${t.slice(0, 200).replace(/\n/g, " ")})`, + ); + } + process.exit(0); + } try { return await fn({ secret: result.secret, diff --git a/packages/api/src/modules/mesh/v1-router.ts b/packages/api/src/modules/mesh/v1-router.ts index 3f925c2..ced14cf 100644 --- a/packages/api/src/modules/mesh/v1-router.ts +++ b/packages/api/src/modules/mesh/v1-router.ts @@ -496,6 +496,13 @@ export const v1Router = new Hono() }); }) + // GET /v1/me/ping — sanity probe for cross-mesh route health. + .get("/me/ping", async (c) => { + const key = c.var.apiKey; + requireCapability(key, "read"); + return c.json({ ok: true, hasIssuer: !!key.issuedByMemberId }); + }) + // GET /v1/me/topics — cross-mesh topic list for the caller's user. // // For each topic across every mesh the user belongs to, returns