test+docs: add inspectorTabs test; document mid-session auth modules

- Add a dedicated `inspectorTabs.test.ts` (was relying only on incidental
  coverage from App.test.tsx) — covers the tab-id constants and both branches
  of the `isInspectorTabId` type guard; 100% per-file.
- AGENTS.md: extend the `core/auth/` structure-tree entry to describe the new
  mid-session recovery modules (challenge parsing, scope union, shared OAuth UX
  copy, force-reauthorization) and the node loopback callback flow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DZyeWManYTvcXxjcrhxSQc
This commit is contained in:
cliffhall 2026-07-03 13:20:29 -04:00
commit 143e0d3f71
2 changed files with 44 additions and 2 deletions

View file

@ -22,9 +22,13 @@ inspector/
│ ├── tui/ # TUI client (Ink + React, tsup bundle) │ ├── tui/ # TUI client (Ink + React, tsup bundle)
│ ├── launcher/ # Shared launcher (relative imports into sibling build/ outputs) │ ├── launcher/ # Shared launcher (relative imports into sibling build/ outputs)
├── core/ # Shared core code (no package.json — consumed via the `@inspector/core` vite alias) ├── core/ # Shared core code (no package.json — consumed via the `@inspector/core` vite alias)
│ ├── auth/ # OAuth: state machine, providers, discovery, storage │ ├── auth/ # OAuth: state machine, providers, discovery, storage;
│ │ # mid-session recovery (challenge.ts WWW-Authenticate
│ │ # parsing, scopes.ts SEP-2350 scope union, oauthUx.ts
│ │ # shared copy, mcpAuth.ts force-reauthorization)
│ │ ├── browser/ # Browser-side OAuth (sessionStorage, BrowserNavigation) │ │ ├── browser/ # Browser-side OAuth (sessionStorage, BrowserNavigation)
│ │ ├── node/ # Node-side OAuth (NodeOAuthStorage, OAuthCallbackServer) │ │ ├── node/ # Node-side OAuth (NodeOAuthStorage, OAuthCallbackServer,
│ │ │ # runner-interactive-oauth loopback callback flow)
│ │ └── remote/ # Remote OAuth storage (delegates to the remote server) │ │ └── remote/ # Remote OAuth storage (delegates to the remote server)
│ ├── json/ # JSON utilities and parameter/argument conversion │ ├── json/ # JSON utilities and parameter/argument conversion
│ ├── logging/ # Silent pino logger singleton │ ├── logging/ # Silent pino logger singleton

View file

@ -0,0 +1,38 @@
import { describe, it, expect } from "vitest";
import {
INSPECTOR_SERVERS_TAB,
INSPECTOR_TAB_IDS,
isInspectorTabId,
} from "./inspectorTabs";
describe("inspectorTabs", () => {
it("names the Servers tab, which is not a liftable inspector tab", () => {
expect(INSPECTOR_SERVERS_TAB).toBe("Servers");
expect(INSPECTOR_TAB_IDS).not.toContain(INSPECTOR_SERVERS_TAB);
});
it("enumerates the liftable inspector tabs", () => {
expect(INSPECTOR_TAB_IDS).toEqual([
"Apps",
"Tools",
"Prompts",
"Resources",
"Tasks",
"Logs",
"History",
"Network",
]);
});
it("isInspectorTabId returns true for every enumerated tab", () => {
for (const tab of INSPECTOR_TAB_IDS) {
expect(isInspectorTabId(tab)).toBe(true);
}
});
it("isInspectorTabId returns false for non-inspector tab values", () => {
expect(isInspectorTabId(INSPECTOR_SERVERS_TAB)).toBe(false);
expect(isInspectorTabId("")).toBe(false);
expect(isInspectorTabId("Bogus")).toBe(false);
});
});