@ait-co/devtools 0.1.127 → 0.1.129
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/{attach-orchestrator-CpE0dMew.js → attach-orchestrator-Bdt5Zdo9.js} +3 -94
- package/dist/attach-orchestrator-Bdt5Zdo9.js.map +1 -0
- package/dist/{attach-orchestrator-CPMQWkGV.js → attach-orchestrator-DvrgUIx7.js} +4 -95
- package/dist/attach-orchestrator-DvrgUIx7.js.map +1 -0
- package/dist/{bundle-Cb3GFuw6.d.ts → bundle-BKqyhEK9.d.ts} +1 -1
- package/dist/{bundle-Cb3GFuw6.d.ts.map → bundle-BKqyhEK9.d.ts.map} +1 -1
- package/dist/{capture-B1zfGyTo.d.ts → capture-ltuV0gZa.d.ts} +1 -1
- package/dist/{capture-B1zfGyTo.d.ts.map → capture-ltuV0gZa.d.ts.map} +1 -1
- package/dist/{cdp-connection-Dxw_EY8s.d.ts → cdp-connection-D7AYQck2.d.ts} +1 -1
- package/dist/{cdp-connection-Dxw_EY8s.d.ts.map → cdp-connection-D7AYQck2.d.ts.map} +1 -1
- package/dist/{cell-D0dJSGHi.js → cell-DA_lcpDI.js} +2 -2
- package/dist/{cell-D0dJSGHi.js.map → cell-DA_lcpDI.js.map} +1 -1
- package/dist/{cell-CX92lDI0.js → cell-DLRv4iG6.js} +2 -2
- package/dist/{cell-CX92lDI0.js.map → cell-DLRv4iG6.js.map} +1 -1
- package/dist/{debug-server-Dctc9GAh.js → debug-server--Y0QZVJS.js} +57 -58
- package/dist/debug-server--Y0QZVJS.js.map +1 -0
- package/dist/debug-server-Bu3pCG9c.js +436 -0
- package/dist/debug-server-Bu3pCG9c.js.map +1 -0
- package/dist/debug-server-e1qPe0ZB.js +379 -0
- package/dist/{debug-server-BzzNkETg.js.map → debug-server-e1qPe0ZB.js.map} +1 -1
- package/dist/log-CUik_tHp.js +95 -0
- package/dist/log-CUik_tHp.js.map +1 -0
- package/dist/mcp/cli.js +1296 -1230
- package/dist/mcp/cli.js.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/panel/index.js +1 -1
- package/dist/{pool-DBLKNeRC.d.ts → pool-C0pc7T2p.d.ts} +4 -4
- package/dist/{pool-DBLKNeRC.d.ts.map → pool-C0pc7T2p.d.ts.map} +1 -1
- package/dist/{qr-http-server-Bo8LMOJQ.js → qr-http-server-HANhOFwI.js} +1 -1
- package/dist/{qr-http-server-Bo8LMOJQ.js.map → qr-http-server-HANhOFwI.js.map} +1 -1
- package/dist/{relay-factory-Dug7W6Ao.js → relay-factory-Ck3vBonr.js} +6 -6
- package/dist/{relay-factory-Dug7W6Ao.js.map → relay-factory-Ck3vBonr.js.map} +1 -1
- package/dist/{relay-secret-store-DKxs7zwq.js → relay-secret-store-DzxDsK6S.js} +1 -1
- package/dist/{relay-secret-store-DKxs7zwq.js.map → relay-secret-store-DzxDsK6S.js.map} +1 -1
- package/dist/{relay-url-store-xmUuTjXA.js → relay-url-store-D3rY-GJJ.js} +2 -2
- package/dist/{relay-url-store-xmUuTjXA.js.map → relay-url-store-D3rY-GJJ.js.map} +1 -1
- package/dist/{debug-server-BzzNkETg.js → relay-worker-Bt0QYKQH.js} +212 -346
- package/dist/relay-worker-Bt0QYKQH.js.map +1 -0
- package/dist/{relay-worker-TReZtzGl.d.ts → relay-worker-o0M2ndyJ.d.ts} +7 -7
- package/dist/relay-worker-o0M2ndyJ.d.ts.map +1 -0
- package/dist/{runtime-ozyPnRbU.d.ts → runtime-9xhN9pr8.d.ts} +1 -1
- package/dist/{runtime-ozyPnRbU.d.ts.map → runtime-9xhN9pr8.d.ts.map} +1 -1
- package/dist/test-runner/bin.js +721 -15
- package/dist/test-runner/bin.js.map +1 -1
- package/dist/test-runner/bundle.d.ts +1 -1
- package/dist/test-runner/capture.d.ts +1 -1
- package/dist/test-runner/config.d.ts +1 -1
- package/dist/test-runner/config.js +1 -1
- package/dist/test-runner/pool.d.ts +1 -1
- package/dist/test-runner/pool.js +1 -1
- package/dist/test-runner/relay-factory.d.ts +1 -1
- package/dist/test-runner/relay-factory.js +1 -1
- package/dist/test-runner/relay-worker.d.ts +1 -1
- package/dist/test-runner/relay-worker.js +1 -183
- package/dist/test-runner/report.d.ts +3 -3
- package/dist/test-runner/rpc.d.ts +2 -2
- package/dist/test-runner/rpc.js +12 -3
- package/dist/test-runner/rpc.js.map +1 -1
- package/dist/test-runner/runtime.d.ts +1 -1
- package/dist/test-runner/task-graph.d.ts +1 -1
- package/package.json +1 -1
- package/dist/attach-orchestrator-CPMQWkGV.js.map +0 -1
- package/dist/attach-orchestrator-CpE0dMew.js.map +0 -1
- package/dist/debug-server-1dhDA3aw.js +0 -980
- package/dist/debug-server-1dhDA3aw.js.map +0 -1
- package/dist/debug-server-Dctc9GAh.js.map +0 -1
- package/dist/relay-worker-TReZtzGl.d.ts.map +0 -1
- package/dist/test-runner/relay-worker.js.map +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//#region src/mcp/log.ts
|
|
2
|
+
/**
|
|
3
|
+
* Allowed field keys that may pass through to a log line.
|
|
4
|
+
* Unknown keys are dropped. Values are still redact-scanned.
|
|
5
|
+
*/
|
|
6
|
+
const ALLOWED_KEYS = new Set([
|
|
7
|
+
"ts",
|
|
8
|
+
"level",
|
|
9
|
+
"event",
|
|
10
|
+
"msg",
|
|
11
|
+
"port",
|
|
12
|
+
"totpEnabled",
|
|
13
|
+
"env",
|
|
14
|
+
"tool",
|
|
15
|
+
"deploymentId",
|
|
16
|
+
"errorKind",
|
|
17
|
+
"reason",
|
|
18
|
+
"prevTargetId",
|
|
19
|
+
"mode",
|
|
20
|
+
"fileCount",
|
|
21
|
+
"passed",
|
|
22
|
+
"failed",
|
|
23
|
+
"skipped"
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Patterns that match secret values.
|
|
27
|
+
* Match order matters — more-specific patterns first.
|
|
28
|
+
*
|
|
29
|
+
* #268 redact script covers: relay=wss://…, at=<TOTP>, _deploymentId=<uuid>.
|
|
30
|
+
* Here we extend to in-process value-level patterns used in server logs.
|
|
31
|
+
*/
|
|
32
|
+
const SECRET_PATTERNS = [
|
|
33
|
+
/^\d{6}$/,
|
|
34
|
+
/^(aitcc_|AITCC_)/i,
|
|
35
|
+
/^[A-Za-z0-9_-]+=.{4,}/,
|
|
36
|
+
/^wss:\/\//,
|
|
37
|
+
/(?:^|[?&])at=[A-Z0-9]{6}/i
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Returns `true` when the string value matches any known-secret pattern.
|
|
41
|
+
* Only string values are tested — numbers/booleans are always safe.
|
|
42
|
+
*/
|
|
43
|
+
function isSecretValue(value) {
|
|
44
|
+
return SECRET_PATTERNS.some((re) => re.test(value));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Redacts a single scalar value.
|
|
48
|
+
* - strings: return "***" if the value matches a secret pattern.
|
|
49
|
+
* - other: return as-is.
|
|
50
|
+
*/
|
|
51
|
+
function redactValue(value) {
|
|
52
|
+
if (typeof value === "string" && isSecretValue(value)) return "***";
|
|
53
|
+
return value;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Builds a safe log payload from raw fields.
|
|
57
|
+
*
|
|
58
|
+
* - Only keys in `ALLOWED_KEYS` are included.
|
|
59
|
+
* - String values are scanned for secret patterns and replaced with "***".
|
|
60
|
+
* - `ts` and `level` and `event` are always included (they are injected by the
|
|
61
|
+
* logger functions below, not by callers).
|
|
62
|
+
*/
|
|
63
|
+
function buildPayload(level, event, fields) {
|
|
64
|
+
const out = {
|
|
65
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
66
|
+
level,
|
|
67
|
+
event
|
|
68
|
+
};
|
|
69
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
70
|
+
if (!ALLOWED_KEYS.has(key)) continue;
|
|
71
|
+
if (key === "ts" || key === "level" || key === "event") continue;
|
|
72
|
+
out[key] = redactValue(value);
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Writes a single JSON log line to stderr.
|
|
78
|
+
* MCP stdio transport uses stdout; all diagnostics go to stderr.
|
|
79
|
+
*/
|
|
80
|
+
function writeLog(level, event, fields = {}) {
|
|
81
|
+
const payload = buildPayload(level, event, fields);
|
|
82
|
+
process.stderr.write(`${JSON.stringify(payload)}\n`);
|
|
83
|
+
}
|
|
84
|
+
/** Log an informational structured event. */
|
|
85
|
+
function logInfo(event, fields = {}) {
|
|
86
|
+
writeLog("info", event, fields);
|
|
87
|
+
}
|
|
88
|
+
/** Log an error structured event. */
|
|
89
|
+
function logError(event, fields = {}) {
|
|
90
|
+
writeLog("error", event, fields);
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { logInfo as n, logError as t };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=log-CUik_tHp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-CUik_tHp.js","names":[],"sources":["../src/mcp/log.ts"],"sourcesContent":["/**\n * Structured JSON-line server logger + allowlist-based secret redact.\n *\n * Every log line emitted by the debug-mode MCP server is a single JSON object:\n * { \"ts\": \"<ISO-8601>\", \"level\": \"info\"|\"warn\"|\"error\", \"event\": \"<category>\", ...fields }\n *\n * Allowlist approach — only the keys in ALLOWED_KEYS pass through to the output\n * object unchanged. Any value that matches a known-secret pattern is replaced\n * with \"***\" regardless of key name. This provides two complementary layers:\n * 1. Key allowlist — unknown keys (e.g. a future field accidentally containing\n * a credential) are dropped entirely.\n * 2. Value redact — pattern matching catches secrets that slip through under\n * an allowed key name (e.g. a message string that includes a TOTP code).\n *\n * SECRET-HANDLING (MUST NOT appear in stdout/stderr/logs):\n * - TOTP 6-digit codes (pattern: standalone 6-digit run)\n * - AITCC_API_KEY values (pattern: \"aitcc_\" or \"AITCC_\" prefix — Deploy Key format)\n * - cookie header values (pattern: \"cookie:\" header content)\n * - relay WSS URLs (contain the relay host which is semi-sensitive)\n * - \"at=<TOTP>\" query params\n *\n * Canonical event categories:\n * server.start — MCP server started (relay port, TOTP enabled, etc.)\n * tunnel.up — cloudflared tunnel assigned a public URL\n * tunnel.down — tunnel error / shutdown\n * page.attached — first CDP target appeared (deploymentId, env)\n * page.detached — target evicted / session replaced\n * page.crashed — target crash detected\n * tool.call — MCP tool invocation (tool name only — no args/results)\n * tool.error — MCP tool error (tool name + safe error category)\n */\n\n/** Structured log levels. */\nexport type LogLevel = 'info' | 'warn' | 'error';\n\n/** Every valid event category. */\nexport type LogEvent =\n | 'server.start'\n | 'tunnel.up'\n | 'tunnel.down'\n | 'page.attached'\n | 'page.detached'\n | 'page.crashed'\n | 'tool.call'\n | 'tool.error'\n // run_tests progress (#646) — operator-visible in the daemon log, never in\n // the agent response. Carries only counts (secret-free, redact-safe numbers).\n | 'run_tests.start'\n | 'run_tests.done';\n\n/**\n * Allowed field keys that may pass through to a log line.\n * Unknown keys are dropped. Values are still redact-scanned.\n */\nconst ALLOWED_KEYS = new Set([\n 'ts',\n 'level',\n 'event',\n 'msg',\n 'port',\n 'totpEnabled',\n 'env',\n 'tool',\n 'deploymentId',\n 'errorKind',\n 'reason',\n 'prevTargetId',\n 'mode',\n // run_tests progress counts (#646) — numbers, redact-safe.\n 'fileCount',\n 'passed',\n 'failed',\n 'skipped',\n]);\n\n/**\n * Patterns that match secret values.\n * Match order matters — more-specific patterns first.\n *\n * #268 redact script covers: relay=wss://…, at=<TOTP>, _deploymentId=<uuid>.\n * Here we extend to in-process value-level patterns used in server logs.\n */\nconst SECRET_PATTERNS: RegExp[] = [\n // TOTP 6-digit code as a standalone value (whole string is exactly 6 digits).\n /^\\d{6}$/,\n // Deploy Key — AITCC_API_KEY value prefix formats.\n /^(aitcc_|AITCC_)/i,\n // Cookie header value (whole string starts with a cookie-like name=value pair).\n /^[A-Za-z0-9_-]+=.{4,}/,\n // WSS relay URL value.\n /^wss:\\/\\//,\n // TOTP \"at=\" query param embedded in a string.\n /(?:^|[?&])at=[A-Z0-9]{6}/i,\n];\n\n/**\n * Returns `true` when the string value matches any known-secret pattern.\n * Only string values are tested — numbers/booleans are always safe.\n */\nfunction isSecretValue(value: string): boolean {\n return SECRET_PATTERNS.some((re) => re.test(value));\n}\n\n/**\n * Redacts a single scalar value.\n * - strings: return \"***\" if the value matches a secret pattern.\n * - other: return as-is.\n */\nfunction redactValue(value: unknown): unknown {\n if (typeof value === 'string' && isSecretValue(value)) {\n return '***';\n }\n return value;\n}\n\n/**\n * Builds a safe log payload from raw fields.\n *\n * - Only keys in `ALLOWED_KEYS` are included.\n * - String values are scanned for secret patterns and replaced with \"***\".\n * - `ts` and `level` and `event` are always included (they are injected by the\n * logger functions below, not by callers).\n */\nfunction buildPayload(\n level: LogLevel,\n event: LogEvent,\n fields: Record<string, unknown>,\n): Record<string, unknown> {\n const out: Record<string, unknown> = {\n ts: new Date().toISOString(),\n level,\n event,\n };\n\n for (const [key, value] of Object.entries(fields)) {\n if (!ALLOWED_KEYS.has(key)) continue;\n // ts/level/event are controlled above.\n if (key === 'ts' || key === 'level' || key === 'event') continue;\n out[key] = redactValue(value);\n }\n\n return out;\n}\n\n/**\n * Writes a single JSON log line to stderr.\n * MCP stdio transport uses stdout; all diagnostics go to stderr.\n */\nfunction writeLog(level: LogLevel, event: LogEvent, fields: Record<string, unknown> = {}): void {\n const payload = buildPayload(level, event, fields);\n process.stderr.write(`${JSON.stringify(payload)}\\n`);\n}\n\n// ---------------------------------------------------------------------------\n// Public logger functions — one per level.\n// ---------------------------------------------------------------------------\n\n/** Log an informational structured event. */\nexport function logInfo(event: LogEvent, fields: Record<string, unknown> = {}): void {\n writeLog('info', event, fields);\n}\n\n/** Log a warning structured event. */\nexport function logWarn(event: LogEvent, fields: Record<string, unknown> = {}): void {\n writeLog('warn', event, fields);\n}\n\n/** Log an error structured event. */\nexport function logError(event: LogEvent, fields: Record<string, unknown> = {}): void {\n writeLog('error', event, fields);\n}\n\n// ---------------------------------------------------------------------------\n// Exported redact helper for use in tests and callers that need to sanitise\n// before passing to the logger (e.g. error message strings).\n// ---------------------------------------------------------------------------\n\n/**\n * Returns a redacted copy of `value`:\n * - string: \"***\" if it matches a secret pattern, otherwise the original.\n * - other types: returned as-is.\n *\n * Exposed for unit tests and for callers that build dynamic `msg` strings.\n */\nexport function redact(value: unknown): unknown {\n return redactValue(value);\n}\n"],"mappings":";;;;;AAsDA,MAAM,eAAe,IAAI,IAAI;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACD,CAAC;;;;;;;;AASF,MAAM,kBAA4B;CAEhC;CAEA;CAEA;CAEA;CAEA;CACD;;;;;AAMD,SAAS,cAAc,OAAwB;AAC7C,QAAO,gBAAgB,MAAM,OAAO,GAAG,KAAK,MAAM,CAAC;;;;;;;AAQrD,SAAS,YAAY,OAAyB;AAC5C,KAAI,OAAO,UAAU,YAAY,cAAc,MAAM,CACnD,QAAO;AAET,QAAO;;;;;;;;;;AAWT,SAAS,aACP,OACA,OACA,QACyB;CACzB,MAAM,MAA+B;EACnC,qBAAI,IAAI,MAAM,EAAC,aAAa;EAC5B;EACA;EACD;AAED,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,EAAE;AACjD,MAAI,CAAC,aAAa,IAAI,IAAI,CAAE;AAE5B,MAAI,QAAQ,QAAQ,QAAQ,WAAW,QAAQ,QAAS;AACxD,MAAI,OAAO,YAAY,MAAM;;AAG/B,QAAO;;;;;;AAOT,SAAS,SAAS,OAAiB,OAAiB,SAAkC,EAAE,EAAQ;CAC9F,MAAM,UAAU,aAAa,OAAO,OAAO,OAAO;AAClD,SAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,CAAC,IAAI;;;AAQtD,SAAgB,QAAQ,OAAiB,SAAkC,EAAE,EAAQ;AACnF,UAAS,QAAQ,OAAO,OAAO;;;AASjC,SAAgB,SAAS,OAAiB,SAAkC,EAAE,EAAQ;AACpF,UAAS,SAAS,OAAO,OAAO"}
|