@ait-co/devtools 0.1.128 → 0.1.131

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.
Files changed (113) hide show
  1. package/dist/{attach-orchestrator-CPMQWkGV.js → attach-orchestrator-BiaYiNOr.js} +34 -107
  2. package/dist/attach-orchestrator-BiaYiNOr.js.map +1 -0
  3. package/dist/{attach-orchestrator-RhOdO3DS.js → attach-orchestrator-Cjdhir2U.js} +31 -13
  4. package/dist/{attach-orchestrator-RhOdO3DS.js.map → attach-orchestrator-Cjdhir2U.js.map} +1 -1
  5. package/dist/{attach-orchestrator-CpE0dMew.js → attach-orchestrator-ca34r46y.js} +33 -106
  6. package/dist/attach-orchestrator-ca34r46y.js.map +1 -0
  7. package/dist/{bundle-Cb3GFuw6.d.ts → bundle-BKqyhEK9.d.ts} +1 -1
  8. package/dist/{bundle-Cb3GFuw6.d.ts.map → bundle-BKqyhEK9.d.ts.map} +1 -1
  9. package/dist/{capture-B1zfGyTo.d.ts → capture-ltuV0gZa.d.ts} +1 -1
  10. package/dist/{capture-B1zfGyTo.d.ts.map → capture-ltuV0gZa.d.ts.map} +1 -1
  11. package/dist/{cdp-connection-Dxw_EY8s.d.ts → cdp-connection-D7AYQck2.d.ts} +1 -1
  12. package/dist/{cdp-connection-Dxw_EY8s.d.ts.map → cdp-connection-D7AYQck2.d.ts.map} +1 -1
  13. package/dist/{cell-D0dJSGHi.js → cell-Bi8MAPA8.js} +11 -7
  14. package/dist/cell-Bi8MAPA8.js.map +1 -0
  15. package/dist/{cell-Ba9lCI3B.js → cell-Cw4fVOl2.js} +11 -7
  16. package/dist/cell-Cw4fVOl2.js.map +1 -0
  17. package/dist/{cell-CX92lDI0.js → cell-rr6gL9AT.js} +11 -7
  18. package/dist/cell-rr6gL9AT.js.map +1 -0
  19. package/dist/debug-server-BSbfnFR5.js +436 -0
  20. package/dist/debug-server-BSbfnFR5.js.map +1 -0
  21. package/dist/debug-server-CD4zYBq4.js +379 -0
  22. package/dist/{debug-server-BzzNkETg.js.map → debug-server-CD4zYBq4.js.map} +1 -1
  23. package/dist/{debug-server-Dctc9GAh.js → debug-server-qRSRG7YZ.js} +68 -65
  24. package/dist/debug-server-qRSRG7YZ.js.map +1 -0
  25. package/dist/in-app/auto.js +15 -0
  26. package/dist/in-app/auto.js.map +1 -1
  27. package/dist/in-app/index.d.ts +27 -0
  28. package/dist/in-app/index.d.ts.map +1 -1
  29. package/dist/in-app/index.js +15 -0
  30. package/dist/in-app/index.js.map +1 -1
  31. package/dist/log-CUik_tHp.js +95 -0
  32. package/dist/log-CUik_tHp.js.map +1 -0
  33. package/dist/mcp/cli.js +1272 -1111
  34. package/dist/mcp/cli.js.map +1 -1
  35. package/dist/mcp/server.js +1 -1
  36. package/dist/panel/index.js +11 -1
  37. package/dist/panel/index.js.map +1 -1
  38. package/dist/{pool-DBLKNeRC.d.ts → pool-BaSCZALv.d.ts} +12 -4
  39. package/dist/{pool-DBLKNeRC.d.ts.map → pool-BaSCZALv.d.ts.map} +1 -1
  40. package/dist/{qr-http-server-Bo8LMOJQ.js → qr-http-server-BdNGPRoL.js} +76 -6
  41. package/dist/qr-http-server-BdNGPRoL.js.map +1 -0
  42. package/dist/{qr-http-server-CrGohOwC.js → qr-http-server-Bq9zR7-z.js} +76 -6
  43. package/dist/qr-http-server-Bq9zR7-z.js.map +1 -0
  44. package/dist/{qr-http-server-Bt_RAxFn.cjs → qr-http-server-BxoRp2w7.cjs} +76 -6
  45. package/dist/qr-http-server-BxoRp2w7.cjs.map +1 -0
  46. package/dist/{qr-http-server-DM2R25jP.cjs → qr-http-server-CV6TA9ZN.cjs} +76 -6
  47. package/dist/qr-http-server-CV6TA9ZN.cjs.map +1 -0
  48. package/dist/{qr-http-server-s1iW_5VQ.js → qr-http-server-DCbjORFa.js} +76 -6
  49. package/dist/qr-http-server-DCbjORFa.js.map +1 -0
  50. package/dist/{qr-http-server-BH0UFeUn.js → qr-http-server-cKbciY5k.js} +76 -6
  51. package/dist/qr-http-server-cKbciY5k.js.map +1 -0
  52. package/dist/{relay-factory-Dug7W6Ao.js → relay-factory-Cloog1jb.js} +34 -14
  53. package/dist/relay-factory-Cloog1jb.js.map +1 -0
  54. package/dist/{relay-secret-store-DKxs7zwq.js → relay-secret-store-DzxDsK6S.js} +1 -1
  55. package/dist/{relay-secret-store-DKxs7zwq.js.map → relay-secret-store-DzxDsK6S.js.map} +1 -1
  56. package/dist/{relay-url-store-xmUuTjXA.js → relay-url-store-D3rY-GJJ.js} +2 -2
  57. package/dist/{relay-url-store-xmUuTjXA.js.map → relay-url-store-D3rY-GJJ.js.map} +1 -1
  58. package/dist/{debug-server-BzzNkETg.js → relay-worker-CCAHLC4a.js} +220 -350
  59. package/dist/relay-worker-CCAHLC4a.js.map +1 -0
  60. package/dist/{relay-worker-TReZtzGl.d.ts → relay-worker-o0M2ndyJ.d.ts} +7 -7
  61. package/dist/relay-worker-o0M2ndyJ.d.ts.map +1 -0
  62. package/dist/{runtime-ozyPnRbU.d.ts → runtime-9xhN9pr8.d.ts} +1 -1
  63. package/dist/{runtime-ozyPnRbU.d.ts.map → runtime-9xhN9pr8.d.ts.map} +1 -1
  64. package/dist/test-runner/bin.js +744 -25
  65. package/dist/test-runner/bin.js.map +1 -1
  66. package/dist/test-runner/bundle.d.ts +1 -1
  67. package/dist/test-runner/capture.d.ts +1 -1
  68. package/dist/test-runner/config.d.ts +15 -9
  69. package/dist/test-runner/config.d.ts.map +1 -1
  70. package/dist/test-runner/config.js +1 -1
  71. package/dist/test-runner/pool.d.ts +1 -1
  72. package/dist/test-runner/pool.js +1 -1
  73. package/dist/test-runner/pool.js.map +1 -1
  74. package/dist/test-runner/relay-factory.d.ts +23 -9
  75. package/dist/test-runner/relay-factory.d.ts.map +1 -1
  76. package/dist/test-runner/relay-factory.js +32 -12
  77. package/dist/test-runner/relay-factory.js.map +1 -1
  78. package/dist/test-runner/relay-worker.d.ts +1 -1
  79. package/dist/test-runner/relay-worker.js +1 -187
  80. package/dist/test-runner/report.d.ts +3 -3
  81. package/dist/test-runner/rpc.d.ts +2 -2
  82. package/dist/test-runner/runtime.d.ts +1 -1
  83. package/dist/test-runner/task-graph.d.ts +1 -1
  84. package/dist/{tunnel-DyEV6WwL.cjs → tunnel-B2UCKAc7.cjs} +4 -3
  85. package/dist/{tunnel-DyEV6WwL.cjs.map → tunnel-B2UCKAc7.cjs.map} +1 -1
  86. package/dist/{tunnel-BFwOSwT4.js → tunnel-C-rQ34dM.js} +4 -3
  87. package/dist/{tunnel-BFwOSwT4.js.map → tunnel-C-rQ34dM.js.map} +1 -1
  88. package/dist/unplugin/index.cjs +1 -1
  89. package/dist/unplugin/index.js +1 -1
  90. package/dist/unplugin/tunnel.cjs +3 -2
  91. package/dist/unplugin/tunnel.cjs.map +1 -1
  92. package/dist/unplugin/tunnel.d.cts.map +1 -1
  93. package/dist/unplugin/tunnel.d.ts.map +1 -1
  94. package/dist/unplugin/tunnel.js +3 -2
  95. package/dist/unplugin/tunnel.js.map +1 -1
  96. package/package.json +1 -1
  97. package/dist/attach-orchestrator-CPMQWkGV.js.map +0 -1
  98. package/dist/attach-orchestrator-CpE0dMew.js.map +0 -1
  99. package/dist/cell-Ba9lCI3B.js.map +0 -1
  100. package/dist/cell-CX92lDI0.js.map +0 -1
  101. package/dist/cell-D0dJSGHi.js.map +0 -1
  102. package/dist/debug-server-1dhDA3aw.js +0 -980
  103. package/dist/debug-server-1dhDA3aw.js.map +0 -1
  104. package/dist/debug-server-Dctc9GAh.js.map +0 -1
  105. package/dist/qr-http-server-BH0UFeUn.js.map +0 -1
  106. package/dist/qr-http-server-Bo8LMOJQ.js.map +0 -1
  107. package/dist/qr-http-server-Bt_RAxFn.cjs.map +0 -1
  108. package/dist/qr-http-server-CrGohOwC.js.map +0 -1
  109. package/dist/qr-http-server-DM2R25jP.cjs.map +0 -1
  110. package/dist/qr-http-server-s1iW_5VQ.js.map +0 -1
  111. package/dist/relay-factory-Dug7W6Ao.js.map +0 -1
  112. package/dist/relay-worker-TReZtzGl.d.ts.map +0 -1
  113. package/dist/test-runner/relay-worker.js.map +0 -1
@@ -1,4 +1,5 @@
1
1
  import { r as generateTotp } from "./totp-DfekTBk3.js";
2
+ import { n as logInfo } from "./log-CUik_tHp.js";
2
3
  import { randomBytes } from "node:crypto";
3
4
  import { Tunnel, bin, install } from "cloudflared";
4
5
  //#region src/mcp/deeplink.ts
@@ -244,98 +245,6 @@ function classifyToolError(err, toolName, isLocal = false) {
244
245
  return mcpError(`${toolName} 실패: ${message}\nlist_pages로 미니앱이 relay에 attach됐는지 확인하세요.`);
245
246
  }
246
247
  //#endregion
247
- //#region src/mcp/log.ts
248
- /**
249
- * Allowed field keys that may pass through to a log line.
250
- * Unknown keys are dropped. Values are still redact-scanned.
251
- */
252
- const ALLOWED_KEYS = new Set([
253
- "ts",
254
- "level",
255
- "event",
256
- "msg",
257
- "port",
258
- "totpEnabled",
259
- "env",
260
- "tool",
261
- "deploymentId",
262
- "errorKind",
263
- "reason",
264
- "prevTargetId",
265
- "mode",
266
- "fileCount",
267
- "passed",
268
- "failed",
269
- "skipped"
270
- ]);
271
- /**
272
- * Patterns that match secret values.
273
- * Match order matters — more-specific patterns first.
274
- *
275
- * #268 redact script covers: relay=wss://…, at=<TOTP>, _deploymentId=<uuid>.
276
- * Here we extend to in-process value-level patterns used in server logs.
277
- */
278
- const SECRET_PATTERNS = [
279
- /^\d{6}$/,
280
- /^(aitcc_|AITCC_)/i,
281
- /^[A-Za-z0-9_-]+=.{4,}/,
282
- /^wss:\/\//,
283
- /(?:^|[?&])at=[A-Z0-9]{6}/i
284
- ];
285
- /**
286
- * Returns `true` when the string value matches any known-secret pattern.
287
- * Only string values are tested — numbers/booleans are always safe.
288
- */
289
- function isSecretValue(value) {
290
- return SECRET_PATTERNS.some((re) => re.test(value));
291
- }
292
- /**
293
- * Redacts a single scalar value.
294
- * - strings: return "***" if the value matches a secret pattern.
295
- * - other: return as-is.
296
- */
297
- function redactValue(value) {
298
- if (typeof value === "string" && isSecretValue(value)) return "***";
299
- return value;
300
- }
301
- /**
302
- * Builds a safe log payload from raw fields.
303
- *
304
- * - Only keys in `ALLOWED_KEYS` are included.
305
- * - String values are scanned for secret patterns and replaced with "***".
306
- * - `ts` and `level` and `event` are always included (they are injected by the
307
- * logger functions below, not by callers).
308
- */
309
- function buildPayload(level, event, fields) {
310
- const out = {
311
- ts: (/* @__PURE__ */ new Date()).toISOString(),
312
- level,
313
- event
314
- };
315
- for (const [key, value] of Object.entries(fields)) {
316
- if (!ALLOWED_KEYS.has(key)) continue;
317
- if (key === "ts" || key === "level" || key === "event") continue;
318
- out[key] = redactValue(value);
319
- }
320
- return out;
321
- }
322
- /**
323
- * Writes a single JSON log line to stderr.
324
- * MCP stdio transport uses stdout; all diagnostics go to stderr.
325
- */
326
- function writeLog(level, event, fields = {}) {
327
- const payload = buildPayload(level, event, fields);
328
- process.stderr.write(`${JSON.stringify(payload)}\n`);
329
- }
330
- /** Log an informational structured event. */
331
- function logInfo(event, fields = {}) {
332
- writeLog("info", event, fields);
333
- }
334
- /** Log an error structured event. */
335
- function logError(event, fields = {}) {
336
- writeLog("error", event, fields);
337
- }
338
- //#endregion
339
248
  //#region src/mcp/sdk-signatures.ts
340
249
  function isObject(v) {
341
250
  return typeof v === "object" && v !== null && !Array.isArray(v);
@@ -1469,7 +1378,7 @@ async function prepareAttach(deps, env, args, conn) {
1469
1378
  const buildProjectRoot = typeof rawProjectRoot === "string" ? rawProjectRoot : void 0;
1470
1379
  let tunnelHttpUrl = process.env.AIT_TUNNEL_BASE_URL?.trim() ?? "";
1471
1380
  if (tunnelHttpUrl === "" && buildProjectRoot !== void 0) {
1472
- const { readRelayUrls } = await import("./relay-url-store-xmUuTjXA.js");
1381
+ const { readRelayUrls } = await import("./relay-url-store-D3rY-GJJ.js");
1473
1382
  tunnelHttpUrl = (await readRelayUrls({ projectRoot: buildProjectRoot }))?.tunnelBaseUrl ?? "";
1474
1383
  }
1475
1384
  if (tunnelHttpUrl === "") return {
@@ -1716,34 +1625,52 @@ async function renderAndMaybeWait(deps, prep, waitForAttach, callTimeoutMs, conn
1716
1625
  }, null, 2)}\n\n${qr}`);
1717
1626
  }
1718
1627
  /**
1719
- * Builds a self-contained IIFE DOM expression that renders a dismissible
1720
- * "Debugger Connected" badge on the bottom-left of the phone screen.
1628
+ * Builds a self-contained IIFE DOM expression that renders a LIVE
1629
+ * "Debugger Connected" / "Debugger Disconnected" badge on the bottom-left of
1630
+ * the phone screen (#730).
1721
1631
  *
1722
1632
  * **Pure function** — returns a JS expression string; does NOT inject it.
1723
1633
  * Injection is performed by {@link injectDebugIndicator} in `cell.ts`.
1724
1634
  *
1725
1635
  * The expression, when evaluated on the page, does the following:
1726
- * 1. Early-returns if `#__ait_debug_indicator` already exists (idempotent
1727
- * prevents duplicate badges on re-injection after page reload).
1728
- * 2. Appends a fixed-position `<div id="__ait_debug_indicator">` at the
1729
- * bottom-left, accounting for safe-area insets.
1730
- * 3. Attaches a `{ once: true }` `pointerdown` listener that removes the
1731
- * badge on first touch one-tap dismiss.
1636
+ * 1. Idempotent controller a single `window.__ait_indicator` controller
1637
+ * object is created once (keyed on its presence, not on the DOM node).
1638
+ * Re-injection (e.g. explicit disconnect notice from `close()`) UPDATES
1639
+ * the existing badge's state/label in place — it never duplicates the
1640
+ * `<div>` or stacks a second observer.
1641
+ * 2. Renders a fixed-position `<div id="__ait_debug_indicator">` at the
1642
+ * bottom-left, accounting for safe-area insets. Background/text flip
1643
+ * between the attached (red) and disconnected (grey) visuals.
1644
+ * 3. A `pointerdown` listener dismisses (hides) the badge on tap — dismiss
1645
+ * is NON-terminal: a later state transition un-dismisses it, so a
1646
+ * genuine disconnect after a dismissed tap is still visible.
1647
+ * 4. Observes relay-socket lifecycle WITHOUT opening any new connection:
1648
+ * - Preferred path: if the in-app module (`src/in-app/attach.ts`) has
1649
+ * already installed its relay-WS observer (`window.__ait_relay_ws_observed`),
1650
+ * subscribe to the `ait:relay-ws-state` CustomEvent it broadcasts.
1651
+ * - Fallback path: wrap `window.WebSocket` in a `Proxy` and match dials
1652
+ * by PATHNAME SHAPE only (`/target/`) — never by host/wss value — so a
1653
+ * bare CDP-injected badge (no in-app bundle) still reacts to the
1654
+ * chii target socket's own open/close lifecycle.
1732
1655
  *
1733
1656
  * The expression intentionally contains NO relay URLs, wss addresses, TOTP
1734
- * codes, or any other secrets. It is pure DOM UI text only.
1657
+ * codes, or any other secrets. It is pure DOM UI text + enum state only.
1735
1658
  *
1736
1659
  * SECRET-HANDLING: this expression contains no secrets, relay URLs, wss
1737
- * addresses, or TOTP codes whatsoever — DOM label text only.
1660
+ * addresses, or TOTP codes whatsoever — DOM label text + a structural
1661
+ * pathname match (`/target/`) only.
1738
1662
  *
1739
- * @param opts.label - Badge text (default: `'Debugger Connected'`).
1663
+ * @param opts.label - Attached-state badge text (default: `'Debugger Connected'`).
1664
+ * @param opts.disconnectedLabel - Disconnected-state badge text (default: `'Debugger Disconnected'`).
1665
+ * @param opts.state - Initial/forced state for THIS injection call (default: `'attached'`).
1740
1666
  * @returns A JS expression string suitable for `Runtime.evaluate`.
1741
1667
  */
1742
1668
  function buildIndicatorExpression(opts) {
1743
1669
  const label = opts?.label ?? "Debugger Connected";
1744
- return `(() => {if (document.getElementById('__ait_debug_indicator')) return;const el = document.createElement('div');el.id = '__ait_debug_indicator';el.style.cssText = ['position:fixed','left:max(12px,calc(env(safe-area-inset-left,0px) + 8px))','bottom:max(12px,calc(env(safe-area-inset-bottom,0px) + 8px))','z-index:2147483647','background:#e5484d','color:#fff','font:bold 11px/1 system-ui,sans-serif','padding:5px 9px','border-radius:6px','pointer-events:auto','user-select:none',].join(';');el.textContent = ${JSON.stringify(label)};el.addEventListener('pointerdown', () => el.remove(), { once: true });document.body.appendChild(el);})()`;
1670
+ const disconnectedLabel = opts?.disconnectedLabel ?? "Debugger Disconnected";
1671
+ return `(() => {var W = window;function render(c) {if (c.dismissed) { c.el.style.display = 'none'; return; }c.el.style.display = 'block';var up = c.state !== 'disconnected';c.el.style.background = up ? '#e5484d' : '#8a8f98';c.el.textContent = up ? ${JSON.stringify(label)} : ${JSON.stringify(disconnectedLabel)};}function setState(c, next) { c.state = next; c.dismissed = false; render(c); }var c = W.__ait_indicator;if (!c) {var el = document.createElement('div');el.id = '__ait_debug_indicator';el.style.cssText = ['position:fixed','left:max(12px,calc(env(safe-area-inset-left,0px) + 8px))','bottom:max(12px,calc(env(safe-area-inset-bottom,0px) + 8px))','z-index:2147483647','color:#fff','font:bold 11px/1 system-ui,sans-serif','padding:5px 9px','border-radius:6px','pointer-events:auto','user-select:none',].join(';');document.body.appendChild(el);c = { el: el, state: 'attached', dismissed: false };el.addEventListener('pointerdown', function () { c.dismissed = true; render(c); }, { passive: true });W.__ait_indicator = c;if (W.__ait_relay_ws_observed) {W.addEventListener('ait:relay-ws-state', function (e) {setState(c, e.detail && e.detail.state === 'open' ? 'attached' : 'disconnected');});} else {try {var Native = W.WebSocket;W.WebSocket = new Proxy(Native, {construct: function (t, a) {var ws = Reflect.construct(t, a);try {var u = new URL(String(a[0]), location.href);if (/\\/target\\//.test(u.pathname)) {ws.addEventListener('open', function () { setState(c, 'attached'); });ws.addEventListener('close', function () { setState(c, 'disconnected'); });ws.addEventListener('error', function () { setState(c, 'disconnected'); });}} catch (_) {}return ws;},});} catch (_) {}}}setState(c, ${JSON.stringify(opts?.state ?? "attached")});})()`;
1745
1672
  }
1746
1673
  //#endregion
1747
- export { RELAY_SANDBOX_STALE_PAGE_MS, START_ATTACH_REMINT_THRESHOLD_MS, START_ATTACH_SEGMENT_MS, startTunnelHealthProbe as a, buildIndicatorExpression, extractDeploymentId, startQuickTunnel as i, isSandboxPageFresh, mintAttachUrl, makeTunnelStatus as n, logError as o, prepareAttach, printAttachBanner as r, renderAndMaybeWait, logInfo as s, generateAttachToken as t };
1674
+ export { RELAY_SANDBOX_STALE_PAGE_MS, START_ATTACH_REMINT_THRESHOLD_MS, START_ATTACH_SEGMENT_MS, startTunnelHealthProbe as a, buildIndicatorExpression, extractDeploymentId, startQuickTunnel as i, isSandboxPageFresh, mintAttachUrl, makeTunnelStatus as n, prepareAttach, printAttachBanner as r, renderAndMaybeWait, generateAttachToken as t };
1748
1675
 
1749
- //# sourceMappingURL=attach-orchestrator-CPMQWkGV.js.map
1676
+ //# sourceMappingURL=attach-orchestrator-BiaYiNOr.js.map