From 26e247e6f1a04844ccbe5718886059a431ff89d0 Mon Sep 17 00:00:00 2001 From: sreedharsreeram <141047751+sreedharsreeram@users.noreply.github.com> Date: Sun, 25 Oct 2026 00:03:38 +0000 Subject: [PATCH] Use /session for status account info, fall back to /v3/session on older servers (#117) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What The Supermemory API now serves the session endpoint unversioned at `/session` and keeps `/v3/session` as a deprecated alias (supermemoryai/mono#3626). `status` now looks up account info via `/session` first and falls back to `/v3/session` when the server predates it. - `src/cli.ts`: `getAccountInfo` tries `/session`, then `/v3/session`. ## Compatibility - Older plugin builds keep working: the API still serves `/v3/session`. - This build works against older self-hosted servers: `/session` 404s there, `fetchJson` returns null, and `/v3/session` is used. One extra request on old servers only. Note: the repo's v5 migration chose explicit `apiVersion` selection "without failed-request fallback". This PR uses a fallback for this one read-only call; happy to switch it to the `apiVersion` gate if preferred. ## Verification - `bun run typecheck`, `bun test` (33/33). - `bun src/cli.ts status` against a local API on the new path and against a shim that 404s `/session`: account details resolve in both; the shim log shows `404 GET /session` then `GET /v3/session`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- src/cli.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index d63c00d..ad23160 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -573,7 +573,8 @@ async function fetchJson(apiUrl: string, path: string): Promise } async function getAccountInfo(apiUrl: string): Promise<{ email?: string; name?: string; userId?: string; orgName?: string }> { - const data = await fetchJson(apiUrl, "/v3/session"); + // /session is the unversioned path; older API servers only serve /v3/session. + const data = (await fetchJson(apiUrl, "/session")) ?? (await fetchJson(apiUrl, "/v3/session")); if (!data || typeof data !== "object") return {}; const session = data as {