@ait-co/devtools 0.1.57 → 0.1.58

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/dist/mcp/cli.js CHANGED
@@ -1094,7 +1094,7 @@ function toLegacyEnv(env) {
1094
1094
  * that distinguishes the env-2 external-PWA relay (`relay-mobile`) from the
1095
1095
  * intoss-private dogfood relay (`relay-dev`); both are `kind: 'relay'`.
1096
1096
  *
1097
- * Pure — used at every output boundary (envelope `meta.env`, `get_diagnostics`,
1097
+ * Pure — used at every output boundary (envelope `meta.env`, `get_debug_status`,
1098
1098
  * `measure_safe_area` provenance) so the surface never sniffs a URL again.
1099
1099
  *
1100
1100
  * Written switch-style so a missing arm is a TS compile error (never falls
@@ -2189,7 +2189,7 @@ function killAndWait(pid, graceMs = 2e3) {
2189
2189
  /**
2190
2190
  * Reads the current lock file without acquiring it. Returns the parsed
2191
2191
  * `LockData` when the file exists and is valid, otherwise `null`. Used by
2192
- * `get_diagnostics` to surface the `serverLockHolder` field without
2192
+ * `get_debug_status` to surface the `serverLockHolder` field without
2193
2193
  * interfering with the running lock owner.
2194
2194
  */
2195
2195
  function readServerLock() {
@@ -2583,7 +2583,7 @@ const DEBUG_TOOL_DEFINITIONS = [
2583
2583
  },
2584
2584
  {
2585
2585
  name: "start_debug",
2586
- description: "Switches the active debug environment in-place (issue #348) — no Claude Code restart and no MCP re-handshake. One daemon holds both a local (env 1, mock SDK in a Chromium) and a relay (env 3/4, real-device Toss WebView over the Chii relay + cloudflared tunnel) connection at once; this tool flips which one every other tool reads from, lazily booting the requested family's infra on first use and keeping the inactive one warm so an existing attach survives the switch. After switching it emits notifications/tools/list_changed — call tools/list again to see the updated tool surface for the new environment.\n\nmodes:\n local-browser — env 1: desktop Chromium with the MOCK SDK and a local CDP attach. Side-effect tools (call_sdk/evaluate) run unguarded against the mock; nothing touches a real device or real users. No prerequisites — the default, always-available environment for state/contract and visual-layout work.\n relay-sandbox — env 2: a real-device PWA (real WebKit engine, MOCK SDK) over an external Chii relay that the unplugin already started with tunnel:{cdp:true}. CDP covers real-device WebKit DOM, console, exceptions, and safe-area observation; call_sdk still hits the mock (SDK fidelity needs relay-staging). liveIntent off — dev-intent, LIVE guard inactive, side-effect tools run unguarded against the mock. Prerequisites: AIT_RELAY_BASE_URL env var set + unplugin running with tunnel:{cdp:true} so the relay tunnel is already up.\n relay-staging — env 3: a real-device Toss WebView dogfood build with the REAL SDK over the intoss-private relay. The first environment where call_sdk exercises the genuine native bridge. Side-effect tools run unguarded (dogfood, not released to real users). Prerequisite: a deployed dogfood candidate bundle + the device cold-loaded via the intoss-private deep-link/QR relay injection.\n relay-live — env 4: the REVIEW-PASSED, released production runtime with the REAL SDK over the intoss relay — real end users are on the other side. Read-only debugging is the intent: the LIVE guard is armed, so call_sdk/evaluate require confirm:true per call, and ENTERING relay-live ALSO requires confirm:true on this call. Use it only to observe a shipped regression; verify fixes in relay-staging first.\n\nSwitching back to local-browser automatically disarms the LIVE guard.\n\nFor a relay mode (relay-sandbox/relay-staging/relay-live), also pass projectRoot — the absolute mini-app project root — so the daemon can read the relay auth secret from <projectRoot>/.ait_relay (read-only; the daemon never mints it). Omit it for local-browser.",
2586
+ description: "Switches the active debug environment in-place (issue #348) — no Claude Code restart and no MCP re-handshake. One daemon holds both a local (env 1, mock SDK in a Chromium) and a relay (env 3/4, real-device Toss WebView over the Chii relay + cloudflared tunnel) connection at once; this tool flips which one every other tool reads from, lazily booting the requested family's infra on first use and keeping the inactive one warm so an existing attach survives the switch. After switching it emits notifications/tools/list_changed — call tools/list again to see the updated tool surface for the new environment.\n\nmodes:\n local-browser — env 1: desktop Chromium with the MOCK SDK and a local CDP attach. Side-effect tools (call_sdk/evaluate) run unguarded against the mock; nothing touches a real device or real users. No prerequisites — the default, always-available environment for state/contract and visual-layout work.\n relay-sandbox — env 2: a real-device PWA (real WebKit engine, MOCK SDK) over an external Chii relay. CDP covers real-device WebKit DOM, console, exceptions, and safe-area observation; call_sdk still hits the mock (SDK fidelity needs relay-staging). liveIntent off — dev-intent, LIVE guard inactive, side-effect tools run unguarded against the mock. Only the dual-connection daemon can enter relay-sandbox in-place; a single-connection session rejects it with \"동적 전환할 수 없습니다 … relay-sandbox 모드로 재시작하세요\" — follow that hint and restart the MCP server in relay-sandbox mode rather than retrying. Prerequisites: both AIT_RELAY_BASE_URL (the relay base the unplugin emits when started with tunnel:{cdp:true}, used for the CDP attach) and AIT_TUNNEL_BASE_URL (the dev-server tunnel host, required by build_attach_url to render the launcher QR) must be set before the MCP server starts — the unplugin does not auto-forward either; set them explicitly. Both carry relay/tunnel hosts (secret-class) — keep them out of logs.\n relay-staging — env 3: a real-device Toss WebView dogfood build with the REAL SDK over the intoss-private relay. The first environment where call_sdk exercises the genuine native bridge. Side-effect tools run unguarded (dogfood, not released to real users). Prerequisite: a dogfood candidate bundle built with `RELEASE_CHANNEL=dogfood ait build`, then uploaded with `ait deploy` (add `--scheme-only` to print the resulting intoss-private://…?_deploymentId=… deep-link); open that deep-link/QR on the device to cold-load the bundle with the relay injected. Unlike env 2, env 3 is NOT a dev-server tunnel — it is a deployed bundle reached via the intoss-private scheme, so `pnpm dev` plays no part here.\n relay-live — env 4: the REVIEW-PASSED, released production runtime with the REAL SDK over the intoss relay — real end users are on the other side. Read-only debugging is the intent: the LIVE guard is armed, so call_sdk/evaluate require confirm:true per call, and ENTERING relay-live ALSO requires confirm:true on this call. Use it only to observe a shipped regression; verify fixes in relay-staging first.\n\nSwitching back to local-browser automatically disarms the LIVE guard.\n\nFor a relay mode (relay-sandbox/relay-staging/relay-live), also pass projectRoot — the absolute mini-app project root — so the daemon can read the relay auth secret from <projectRoot>/.ait_relay (read-only; the daemon never mints it). Omit it for local-browser.",
2587
2587
  inputSchema: {
2588
2588
  type: "object",
2589
2589
  properties: {
@@ -2611,8 +2611,8 @@ const DEBUG_TOOL_DEFINITIONS = [
2611
2611
  availableIn: "both"
2612
2612
  },
2613
2613
  {
2614
- name: "get_diagnostics",
2615
- description: "Returns a single-call server status snapshot so the agent can diagnose \"why is this not working?\" without calling multiple tools. Fields: mcpVersion (MCP SDK version), devtoolsVersion (@ait-co/devtools package version), tunnel (up/wssUrl/pid/startedAt), pages (list_pages result + lastSeenAt stats), lastAttachAt, lastDetachAt, recentErrors (last N server-side errors, PII/secret redacted), environment (kind: mock|relay-dev|relay-live|relay-mobile, env: mock|relay backward-compat, reason, liveGuardActive: true when relay-live LIVE guard is active), serverLockHolder (pid + startedAt from the lock file, or null), nextRecommendedAction ({tool, reason} or null — the single next tool to call; in local-target mode tunnel.up=false is normal so \"restart\" is never recommended). All fields are nullable — missing data is null, not an error. debug-mode only — dev-mode (--mode=dev) does not support relay diagnostics. Tier C (both mock and relay). Call this first when debugging session state.",
2614
+ name: "get_debug_status",
2615
+ description: "Reports the current debug session state — which environment/mode is active, whether a page is attached, and a full diagnostic snapshot in one call. Use this any time to answer \"what mode am I in right now?\" or \"why is this not working?\" without chaining tools. Fields: mcpVersion (MCP SDK version), devtoolsVersion (@ait-co/devtools package version), tunnel (up/wssUrl/pid/startedAt), pages (list_pages result + lastSeenAt stats), lastAttachAt, lastDetachAt, recentErrors (last N server-side errors, PII/secret redacted), environment (kind: mock|relay-dev|relay-live|relay-mobile, env: mock|relay backward-compat, reason, liveGuardActive: true when relay-live LIVE guard is active), serverLockHolder (pid + startedAt from the lock file, or null), nextRecommendedAction ({tool, reason} or null — the single next tool to call; in local-target mode tunnel.up=false is normal so \"restart\" is never recommended). All fields are nullable — missing data is null, not an error. debug-mode only — dev-mode (--mode=dev) does not support relay diagnostics. Tier C (both mock and relay).",
2616
2616
  inputSchema: {
2617
2617
  type: "object",
2618
2618
  properties: { recent_errors_limit: {
@@ -2674,7 +2674,7 @@ function filterToolsByEnvironment(tools, env) {
2674
2674
  */
2675
2675
  const BOOTSTRAP_TOOL_NAMES = new Set([
2676
2676
  "build_attach_url",
2677
- "get_diagnostics",
2677
+ "get_debug_status",
2678
2678
  "list_pages",
2679
2679
  "start_debug"
2680
2680
  ]);
@@ -3432,7 +3432,7 @@ async function readMcpSdkVersion() {
3432
3432
  * some test environments that skip the build step).
3433
3433
  */
3434
3434
  function readDevtoolsVersion() {
3435
- return "0.1.57";
3435
+ return "0.1.58";
3436
3436
  }
3437
3437
  /**
3438
3438
  * Derives the next recommended action from a completed diagnostics snapshot.
@@ -3472,7 +3472,7 @@ function computeNextRecommendedAction(tunnel, pages, env) {
3472
3472
  return null;
3473
3473
  }
3474
3474
  /**
3475
- * Builds the `get_diagnostics` response. Pure — does not throw; missing data
3475
+ * Builds the `get_debug_status` response. Pure — does not throw; missing data
3476
3476
  * fields are `null`. Async because `readMcpSdkVersion` needs `import()`.
3477
3477
  *
3478
3478
  * SECRET-HANDLING:
@@ -3920,7 +3920,7 @@ function createDebugServer(deps) {
3920
3920
  const collector = collectorDep ?? new InMemoryDiagnosticsCollector();
3921
3921
  const server = new Server({
3922
3922
  name: "ait-debug",
3923
- version: "0.1.57"
3923
+ version: "0.1.58"
3924
3924
  }, { capabilities: { tools: { listChanged: true } } });
3925
3925
  server.setRequestHandler(ListToolsRequestSchema, () => {
3926
3926
  const conn = router.active;
@@ -3976,7 +3976,7 @@ function createDebugServer(deps) {
3976
3976
  } catch (err) {
3977
3977
  return errorResult(err, name);
3978
3978
  }
3979
- if (name === "get_diagnostics") try {
3979
+ if (name === "get_debug_status") try {
3980
3980
  const rawLimit = request.params.arguments?.recent_errors_limit;
3981
3981
  const recentErrorsLimit = typeof rawLimit === "number" && rawLimit > 0 ? rawLimit : 10;
3982
3982
  return envelopeResult$1(await getDiagnostics({
@@ -5390,13 +5390,13 @@ var HttpAitSource = class {
5390
5390
  * backward-compatible alias of `AIT.getMockState`.
5391
5391
  *
5392
5392
  * Issue #305 (M2-1) — dev/debug tool-surface unification:
5393
- * dev-mode now also exposes `list_pages`, `get_diagnostics`, `measure_safe_area`,
5393
+ * dev-mode now also exposes `list_pages`, `get_debug_status`, `measure_safe_area`,
5394
5394
  * and `call_sdk` so the docs/qa/scenarios.md acceptance sequence
5395
5395
  * `list_pages → measure_safe_area → call_sdk` works in dev mode without
5396
5396
  * "Unknown tool" failures.
5397
5397
  *
5398
5398
  * - `list_pages` — shim: returns the Vite dev URL as a single-entry array.
5399
- * - `get_diagnostics` — dumps dev-mode server state (endpoint URL, last fetch
5399
+ * - `get_debug_status` — dumps dev-mode server state (endpoint URL, last fetch
5400
5400
  * error, reachability, mode/environment metadata).
5401
5401
  * - `measure_safe_area`— reads safeAreaInsets from the mock state snapshot
5402
5402
  * (source: 'mock-vite').
@@ -5489,8 +5489,8 @@ const DEV_TOOL_DEFINITIONS = [
5489
5489
  availableIn: "both"
5490
5490
  },
5491
5491
  {
5492
- name: "get_diagnostics",
5493
- description: "dev-mode: returns server diagnostics — Vite endpoint URL, last fetch timestamp/error, mock state endpoint reachability, mode (\"dev\"), and environment metadata. Call this when the dev server connection is suspect. In debug mode this returns tunnel/relay/attach status instead.",
5492
+ name: "get_debug_status",
5493
+ description: "dev-mode: reports the current dev session state — Vite endpoint URL, last fetch timestamp/error, mock state endpoint reachability, mode (\"dev\"), and environment metadata — in one call. Use this any time to confirm what the dev server is doing or when its connection is suspect. In debug mode this returns tunnel/relay/attach status instead.",
5494
5494
  inputSchema: {
5495
5495
  type: "object",
5496
5496
  properties: { recent_errors_limit: {
@@ -5666,7 +5666,7 @@ function buildDevListPagesResult(devtoolsUrl) {
5666
5666
  };
5667
5667
  }
5668
5668
  /**
5669
- * Builds the `get_diagnostics` dev-mode response.
5669
+ * Builds the `get_debug_status` dev-mode response.
5670
5670
  * Probes the mock state endpoint reachability and returns server metadata.
5671
5671
  */
5672
5672
  async function buildDevDiagnostics(devtoolsUrl, stateEndpoint, fetchImpl) {
@@ -5758,7 +5758,7 @@ function createDevServer(deps = {}) {
5758
5758
  const aitSource = deps.aitSource ?? new HttpAitSource({ stateEndpoint });
5759
5759
  const server = new Server({
5760
5760
  name: "ait-devtools",
5761
- version: "0.1.57"
5761
+ version: "0.1.58"
5762
5762
  }, { capabilities: { tools: {} } });
5763
5763
  server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: DEV_TOOL_DEFINITIONS.map((tool) => ({ ...tool })) }));
5764
5764
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
@@ -5776,7 +5776,7 @@ function createDevServer(deps = {}) {
5776
5776
  }
5777
5777
  switch (name) {
5778
5778
  case "list_pages": return envelopeResult("list_pages", buildDevListPagesResult(devtoolsUrl));
5779
- case "get_diagnostics": return envelopeResult("get_diagnostics", await buildDevDiagnostics(devtoolsUrl, stateEndpoint, (url) => fetch(url)));
5779
+ case "get_debug_status": return envelopeResult("get_debug_status", await buildDevDiagnostics(devtoolsUrl, stateEndpoint, (url) => fetch(url)));
5780
5780
  case "measure_safe_area": return envelopeResult("measure_safe_area", await buildDevMeasureSafeArea(aitSource));
5781
5781
  case "call_sdk": {
5782
5782
  const sdkName = request.params.arguments?.name;