@developerz.ai/ui-debugger-mcp 1.9.0 → 1.11.0

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 (274) hide show
  1. package/README.md +63 -47
  2. package/dist/adapters/android/abortable.d.ts +6 -0
  3. package/dist/adapters/android/abortable.js +22 -0
  4. package/dist/adapters/android/abortable.js.map +1 -0
  5. package/dist/adapters/android/adb.d.ts +19 -7
  6. package/dist/adapters/android/adb.js +50 -13
  7. package/dist/adapters/android/adb.js.map +1 -1
  8. package/dist/adapters/android/android-adapter.d.ts +20 -12
  9. package/dist/adapters/android/android-adapter.js +113 -165
  10. package/dist/adapters/android/android-adapter.js.map +1 -1
  11. package/dist/adapters/android/commands.d.ts +10 -0
  12. package/dist/adapters/android/commands.js +22 -0
  13. package/dist/adapters/android/commands.js.map +1 -1
  14. package/dist/adapters/android/emulator.d.ts +41 -0
  15. package/dist/adapters/android/emulator.js +115 -0
  16. package/dist/adapters/android/emulator.js.map +1 -0
  17. package/dist/adapters/android/logcat.d.ts +87 -0
  18. package/dist/adapters/android/logcat.js +352 -0
  19. package/dist/adapters/android/logcat.js.map +1 -0
  20. package/dist/adapters/android/ports.js.map +1 -1
  21. package/dist/adapters/android/sdk.d.ts +65 -0
  22. package/dist/adapters/android/sdk.js +107 -0
  23. package/dist/adapters/android/sdk.js.map +1 -0
  24. package/dist/adapters/android/uiautomator.d.ts +23 -7
  25. package/dist/adapters/android/uiautomator.js +31 -7
  26. package/dist/adapters/android/uiautomator.js.map +1 -1
  27. package/dist/adapters/availability.d.ts +39 -0
  28. package/dist/adapters/availability.js +62 -0
  29. package/dist/adapters/availability.js.map +1 -0
  30. package/dist/adapters/browser/browser-adapter.d.ts +11 -22
  31. package/dist/adapters/browser/browser-adapter.js +90 -71
  32. package/dist/adapters/browser/browser-adapter.js.map +1 -1
  33. package/dist/adapters/browser/cdp.d.ts +22 -17
  34. package/dist/adapters/browser/cdp.js +118 -72
  35. package/dist/adapters/browser/cdp.js.map +1 -1
  36. package/dist/adapters/browser/exchange-read.d.ts +39 -0
  37. package/dist/adapters/browser/exchange-read.js +102 -0
  38. package/dist/adapters/browser/exchange-read.js.map +1 -0
  39. package/dist/adapters/browser/extractor.js +9 -2
  40. package/dist/adapters/browser/extractor.js.map +1 -1
  41. package/dist/adapters/browser/filters.d.ts +1 -1
  42. package/dist/adapters/browser/filters.js.map +1 -1
  43. package/dist/adapters/browser/geometry.js.map +1 -1
  44. package/dist/adapters/browser/launch.d.ts +14 -5
  45. package/dist/adapters/browser/launch.js +14 -5
  46. package/dist/adapters/browser/launch.js.map +1 -1
  47. package/dist/adapters/browser/lifecycle.d.ts +91 -0
  48. package/dist/adapters/browser/lifecycle.js +141 -0
  49. package/dist/adapters/browser/lifecycle.js.map +1 -0
  50. package/dist/adapters/browser/locate.d.ts +18 -2
  51. package/dist/adapters/browser/locate.js +48 -3
  52. package/dist/adapters/browser/locate.js.map +1 -1
  53. package/dist/adapters/browser/log-filters.d.ts +2 -2
  54. package/dist/adapters/browser/log-filters.js +15 -4
  55. package/dist/adapters/browser/log-filters.js.map +1 -1
  56. package/dist/adapters/browser/log-format.d.ts +23 -20
  57. package/dist/adapters/browser/log-format.js +133 -56
  58. package/dist/adapters/browser/log-format.js.map +1 -1
  59. package/dist/adapters/browser/tab-context.d.ts +30 -0
  60. package/dist/adapters/browser/tab-context.js +41 -0
  61. package/dist/adapters/browser/tab-context.js.map +1 -0
  62. package/dist/adapters/contract.d.ts +113 -10
  63. package/dist/adapters/contract.js +7 -2
  64. package/dist/adapters/contract.js.map +1 -1
  65. package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
  66. package/dist/adapters/desktop/atspi-busctl.js +332 -0
  67. package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
  68. package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
  69. package/dist/adapters/desktop/atspi-parse.js +155 -0
  70. package/dist/adapters/desktop/atspi-parse.js.map +1 -0
  71. package/dist/adapters/desktop/atspi.d.ts +81 -50
  72. package/dist/adapters/desktop/atspi.js +64 -285
  73. package/dist/adapters/desktop/atspi.js.map +1 -1
  74. package/dist/adapters/desktop/capture.d.ts +11 -20
  75. package/dist/adapters/desktop/capture.js +68 -37
  76. package/dist/adapters/desktop/capture.js.map +1 -1
  77. package/dist/adapters/desktop/desktop-adapter.d.ts +22 -2
  78. package/dist/adapters/desktop/desktop-adapter.js +202 -86
  79. package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
  80. package/dist/adapters/desktop/input.d.ts +19 -5
  81. package/dist/adapters/desktop/input.js +29 -13
  82. package/dist/adapters/desktop/input.js.map +1 -1
  83. package/dist/adapters/desktop/managed-app.d.ts +43 -0
  84. package/dist/adapters/desktop/managed-app.js +114 -0
  85. package/dist/adapters/desktop/managed-app.js.map +1 -0
  86. package/dist/adapters/desktop/proc.d.ts +34 -4
  87. package/dist/adapters/desktop/proc.js +37 -6
  88. package/dist/adapters/desktop/proc.js.map +1 -1
  89. package/dist/adapters/desktop/wait-poll.d.ts +17 -0
  90. package/dist/adapters/desktop/wait-poll.js +38 -0
  91. package/dist/adapters/desktop/wait-poll.js.map +1 -0
  92. package/dist/adapters/factory.d.ts +13 -6
  93. package/dist/adapters/factory.js +30 -4
  94. package/dist/adapters/factory.js.map +1 -1
  95. package/dist/adapters/log-format.d.ts +38 -0
  96. package/dist/adapters/log-format.js +47 -0
  97. package/dist/adapters/log-format.js.map +1 -0
  98. package/dist/agent/belt/act.d.ts +426 -23
  99. package/dist/agent/belt/act.js +44 -64
  100. package/dist/agent/belt/act.js.map +1 -1
  101. package/dist/agent/belt/look.d.ts +479 -16
  102. package/dist/agent/belt/look.js +94 -16
  103. package/dist/agent/belt/look.js.map +1 -1
  104. package/dist/agent/belt/observe.d.ts +652 -65
  105. package/dist/agent/belt/observe.js +119 -231
  106. package/dist/agent/belt/observe.js.map +1 -1
  107. package/dist/agent/belt/redact-output.d.ts +20 -0
  108. package/dist/agent/belt/redact-output.js +70 -0
  109. package/dist/agent/belt/redact-output.js.map +1 -0
  110. package/dist/agent/belt/report.d.ts +754 -48
  111. package/dist/agent/belt/report.js +121 -38
  112. package/dist/agent/belt/report.js.map +1 -1
  113. package/dist/agent/belt/same-origin.d.ts +21 -0
  114. package/dist/agent/belt/same-origin.js +38 -0
  115. package/dist/agent/belt/same-origin.js.map +1 -0
  116. package/dist/agent/belt/target-refs.d.ts +39 -0
  117. package/dist/agent/belt/target-refs.js +60 -0
  118. package/dist/agent/belt/target-refs.js.map +1 -0
  119. package/dist/agent/belt/trail.d.ts +44 -16
  120. package/dist/agent/belt/trail.js +46 -11
  121. package/dist/agent/belt/trail.js.map +1 -1
  122. package/dist/agent/belt/tree-targets.d.ts +79 -0
  123. package/dist/agent/belt/tree-targets.js +242 -0
  124. package/dist/agent/belt/tree-targets.js.map +1 -0
  125. package/dist/agent/capabilities.js.map +1 -1
  126. package/dist/agent/fallback.d.ts +33 -0
  127. package/dist/agent/fallback.js +84 -0
  128. package/dist/agent/fallback.js.map +1 -0
  129. package/dist/agent/loop-frames.d.ts +26 -0
  130. package/dist/agent/loop-frames.js +106 -0
  131. package/dist/agent/loop-frames.js.map +1 -0
  132. package/dist/agent/loop.d.ts +56 -65
  133. package/dist/agent/loop.js +122 -189
  134. package/dist/agent/loop.js.map +1 -1
  135. package/dist/agent/models.d.ts +10 -6
  136. package/dist/agent/models.js +15 -9
  137. package/dist/agent/models.js.map +1 -1
  138. package/dist/agent/prompts/compose.d.ts +1 -1
  139. package/dist/agent/prompts/debug-agent.js +48 -10
  140. package/dist/agent/prompts/debug-agent.js.map +1 -1
  141. package/dist/agent/prompts/web-addendum.d.ts +2 -2
  142. package/dist/agent/prompts/web-addendum.js +26 -25
  143. package/dist/agent/prompts/web-addendum.js.map +1 -1
  144. package/dist/agent/provider.d.ts +41 -1
  145. package/dist/agent/provider.js +59 -5
  146. package/dist/agent/provider.js.map +1 -1
  147. package/dist/boot.d.ts +64 -0
  148. package/dist/boot.js +147 -0
  149. package/dist/boot.js.map +1 -0
  150. package/dist/cli/chromium-libs.d.ts +267 -0
  151. package/dist/cli/chromium-libs.js +546 -0
  152. package/dist/cli/chromium-libs.js.map +1 -0
  153. package/dist/cli/control.js +79 -12
  154. package/dist/cli/control.js.map +1 -1
  155. package/dist/cli/init.d.ts +52 -3
  156. package/dist/cli/init.js +62 -10
  157. package/dist/cli/init.js.map +1 -1
  158. package/dist/config/load.d.ts +25 -8
  159. package/dist/config/load.js +50 -13
  160. package/dist/config/load.js.map +1 -1
  161. package/dist/config/schema.d.ts +18 -6
  162. package/dist/config/schema.js +34 -17
  163. package/dist/config/schema.js.map +1 -1
  164. package/dist/errors.d.ts +30 -15
  165. package/dist/errors.js +49 -30
  166. package/dist/errors.js.map +1 -1
  167. package/dist/findings/schema.d.ts +44 -6
  168. package/dist/findings/schema.js +39 -3
  169. package/dist/findings/schema.js.map +1 -1
  170. package/dist/index.d.ts +1 -1
  171. package/dist/index.js +1 -1
  172. package/dist/index.js.map +1 -1
  173. package/dist/main.js +4 -82
  174. package/dist/main.js.map +1 -1
  175. package/dist/mcp/server.js +10 -1
  176. package/dist/mcp/server.js.map +1 -1
  177. package/dist/mcp/tools/describe.d.ts +5 -4
  178. package/dist/mcp/tools/describe.js +14 -10
  179. package/dist/mcp/tools/describe.js.map +1 -1
  180. package/dist/mcp/tools/end-session.d.ts +3 -1
  181. package/dist/mcp/tools/end-session.js +8 -3
  182. package/dist/mcp/tools/end-session.js.map +1 -1
  183. package/dist/mcp/tools/output.d.ts +12 -4
  184. package/dist/mcp/tools/output.js +15 -2
  185. package/dist/mcp/tools/output.js.map +1 -1
  186. package/dist/mcp/tools/result.d.ts +10 -1
  187. package/dist/mcp/tools/result.js +12 -7
  188. package/dist/mcp/tools/result.js.map +1 -1
  189. package/dist/mcp/tools/start-debug.js +7 -5
  190. package/dist/mcp/tools/start-debug.js.map +1 -1
  191. package/dist/redact.d.ts +44 -0
  192. package/dist/redact.js +166 -0
  193. package/dist/redact.js.map +1 -0
  194. package/dist/services/auth-persona.d.ts +19 -0
  195. package/dist/services/auth-persona.js +32 -0
  196. package/dist/services/auth-persona.js.map +1 -0
  197. package/dist/services/catalog.d.ts +28 -0
  198. package/dist/services/catalog.js +65 -0
  199. package/dist/services/catalog.js.map +1 -0
  200. package/dist/services/debug-api.d.ts +179 -0
  201. package/dist/services/debug-api.js +9 -0
  202. package/dist/services/debug-api.js.map +1 -0
  203. package/dist/services/debug-service.d.ts +26 -174
  204. package/dist/services/debug-service.js +159 -227
  205. package/dist/services/debug-service.js.map +1 -1
  206. package/dist/services/foreign-findings.d.ts +22 -0
  207. package/dist/services/foreign-findings.js +38 -0
  208. package/dist/services/foreign-findings.js.map +1 -0
  209. package/dist/services/login-failure.d.ts +10 -0
  210. package/dist/services/login-failure.js +24 -0
  211. package/dist/services/login-failure.js.map +1 -0
  212. package/dist/services/login-selectors.d.ts +18 -0
  213. package/dist/services/login-selectors.js +44 -0
  214. package/dist/services/login-selectors.js.map +1 -0
  215. package/dist/services/login-session.d.ts +25 -0
  216. package/dist/services/login-session.js +59 -0
  217. package/dist/services/login-session.js.map +1 -0
  218. package/dist/services/login.d.ts +16 -29
  219. package/dist/services/login.js +269 -97
  220. package/dist/services/login.js.map +1 -1
  221. package/dist/services/replay.js +15 -3
  222. package/dist/services/replay.js.map +1 -1
  223. package/dist/services/retained-snapshot.d.ts +36 -0
  224. package/dist/services/retained-snapshot.js +63 -0
  225. package/dist/services/retained-snapshot.js.map +1 -0
  226. package/dist/services/session-builder.d.ts +26 -0
  227. package/dist/services/session-builder.js +63 -21
  228. package/dist/services/session-builder.js.map +1 -1
  229. package/dist/services/shutdown.d.ts +8 -4
  230. package/dist/services/shutdown.js +21 -8
  231. package/dist/services/shutdown.js.map +1 -1
  232. package/dist/services/start-guards.d.ts +37 -0
  233. package/dist/services/start-guards.js +61 -0
  234. package/dist/services/start-guards.js.map +1 -0
  235. package/dist/services/summarize.d.ts +12 -3
  236. package/dist/services/summarize.js +13 -5
  237. package/dist/services/summarize.js.map +1 -1
  238. package/dist/session/cleanup.d.ts +3 -2
  239. package/dist/session/cleanup.js +6 -2
  240. package/dist/session/cleanup.js.map +1 -1
  241. package/dist/session/finalize.d.ts +45 -0
  242. package/dist/session/finalize.js +150 -0
  243. package/dist/session/finalize.js.map +1 -0
  244. package/dist/session/findings-store.d.ts +2 -1
  245. package/dist/session/findings-store.js +30 -2
  246. package/dist/session/findings-store.js.map +1 -1
  247. package/dist/session/flock-backend.d.ts +117 -0
  248. package/dist/session/flock-backend.js +293 -0
  249. package/dist/session/flock-backend.js.map +1 -0
  250. package/dist/session/live-pointer.d.ts +19 -0
  251. package/dist/session/live-pointer.js +41 -0
  252. package/dist/session/live-pointer.js.map +1 -0
  253. package/dist/session/manager.d.ts +11 -1
  254. package/dist/session/manager.js +46 -2
  255. package/dist/session/manager.js.map +1 -1
  256. package/dist/session/owner-lock.d.ts +117 -0
  257. package/dist/session/owner-lock.js +218 -0
  258. package/dist/session/owner-lock.js.map +1 -0
  259. package/dist/session/process-identity.js.map +1 -1
  260. package/dist/session/session.js +40 -109
  261. package/dist/session/session.js.map +1 -1
  262. package/dist/session/state-file.d.ts +74 -14
  263. package/dist/session/state-file.js +211 -21
  264. package/dist/session/state-file.js.map +1 -1
  265. package/dist/session/workspace.d.ts +32 -2
  266. package/dist/session/workspace.js +65 -4
  267. package/dist/session/workspace.js.map +1 -1
  268. package/package.json +11 -11
  269. package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
  270. package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
  271. package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
  272. package/dist/mcp/server.test-helpers.d.ts +0 -23
  273. package/dist/mcp/server.test-helpers.js +0 -49
  274. package/dist/mcp/server.test-helpers.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/agent/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH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C,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAClD,MAAM,SAAS,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAmB,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,IAAI,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IAC3D,MAAM,qBAAqB,GAAG,GAAG,EAAE,CACjC,MAAM,CAAC,YAAY,KAAK,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC;IAChF,OAAO,qBAAqB,EAAE,IAAI,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;QACzF,MAAM,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -2,13 +2,14 @@
2
2
  * Per-role model resolver — binds the three actors' model ids to `LanguageModel`s.
3
3
  *
4
4
  * Each role's id resolves from project config over the per-role defaults
5
- * (`DEFAULT_MODELS`): deepseek for text (driver + summary), glm for image
6
- * (vision) — see `idea/models.md`. Resolved ids are bound to the
7
- * OpenAI-compatible provider via `provider.chat(modelId)`, yielding the
8
- * `LanguageModel`s the agent loop hands to the Vercel AI SDK.
5
+ * (`DEFAULT_MODELS`): free OpenRouter models, one paid `fallback` behind every
6
+ * role — see `idea/models.md`. Resolved ids are bound to the OpenAI-compatible
7
+ * provider via `provider.chat(modelId)` and wrapped by `withFallback`, yielding
8
+ * the `LanguageModel`s the agent loop hands to the Vercel AI SDK.
9
9
  */
10
10
  import type { LanguageModel } from 'ai';
11
11
  import type { Models } from '../config/schema.js';
12
+ import { type OnFallback } from './fallback.js';
12
13
  import type { OpenRouterProvider } from './provider.js';
13
14
  /** The three actors' models, bound and ready for the AI SDK. */
14
15
  export interface RoleModels {
@@ -19,8 +20,11 @@ export interface RoleModels {
19
20
  /** summary — compresses findings for the smart agent. */
20
21
  summary: LanguageModel;
21
22
  }
23
+ /** Every fallback names its role, so a log line says WHICH actor left its primary. */
24
+ export type OnRoleFallback = (role: keyof RoleModels, event: Parameters<OnFallback>[0]) => void;
22
25
  /**
23
26
  * Resolve per-role model ids (config over `DEFAULT_MODELS`) and bind each to the
24
- * provider as a chat `LanguageModel`. Omitted roles fall back to the defaults.
27
+ * provider as a chat `LanguageModel` with the fallback behind it. Omitted roles
28
+ * fall back to the defaults. A role whose primary IS the fallback is bound bare.
25
29
  */
26
- export declare function resolveModels(provider: OpenRouterProvider, models?: Partial<Models>): RoleModels;
30
+ export declare function resolveModels(provider: OpenRouterProvider, models?: Partial<Models>, onFallback?: OnRoleFallback): RoleModels;
@@ -2,21 +2,27 @@
2
2
  * Per-role model resolver — binds the three actors' model ids to `LanguageModel`s.
3
3
  *
4
4
  * Each role's id resolves from project config over the per-role defaults
5
- * (`DEFAULT_MODELS`): deepseek for text (driver + summary), glm for image
6
- * (vision) — see `idea/models.md`. Resolved ids are bound to the
7
- * OpenAI-compatible provider via `provider.chat(modelId)`, yielding the
8
- * `LanguageModel`s the agent loop hands to the Vercel AI SDK.
5
+ * (`DEFAULT_MODELS`): free OpenRouter models, one paid `fallback` behind every
6
+ * role — see `idea/models.md`. Resolved ids are bound to the OpenAI-compatible
7
+ * provider via `provider.chat(modelId)` and wrapped by `withFallback`, yielding
8
+ * the `LanguageModel`s the agent loop hands to the Vercel AI SDK.
9
9
  */
10
10
  import { DEFAULT_MODELS } from '../config/load.js';
11
+ import { withFallback } from './fallback.js';
11
12
  /**
12
13
  * Resolve per-role model ids (config over `DEFAULT_MODELS`) and bind each to the
13
- * provider as a chat `LanguageModel`. Omitted roles fall back to the defaults.
14
+ * provider as a chat `LanguageModel` with the fallback behind it. Omitted roles
15
+ * fall back to the defaults. A role whose primary IS the fallback is bound bare.
14
16
  */
15
- export function resolveModels(provider, models = {}) {
17
+ export function resolveModels(provider, models = {}, onFallback = () => { }) {
18
+ const fallbackId = models.fallback ?? DEFAULT_MODELS.fallback;
19
+ const bind = (role, id) => id === fallbackId
20
+ ? provider.chat(id)
21
+ : withFallback(provider.chat(id), provider.chat(fallbackId), (event) => onFallback(role, event));
16
22
  return {
17
- driver: provider.chat(models.driver ?? DEFAULT_MODELS.driver),
18
- vision: provider.chat(models.vision ?? DEFAULT_MODELS.vision),
19
- summary: provider.chat(models.summary ?? DEFAULT_MODELS.summary),
23
+ driver: bind('driver', models.driver ?? DEFAULT_MODELS.driver),
24
+ vision: bind('vision', models.vision ?? DEFAULT_MODELS.vision),
25
+ summary: bind('summary', models.summary ?? DEFAULT_MODELS.summary),
20
26
  };
21
27
  }
22
28
  //# sourceMappingURL=models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/agent/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAcnD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA4B,EAC5B,SAA0B,EAAE;IAE5B,OAAO;QACL,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;QAC7D,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;QAC7D,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC;KACjE,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/agent/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,EAAmB,YAAY,EAAE,MAAM,eAAe,CAAC;AAgB9D;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,QAA4B,EAC5B,MAAM,GAAoB,EAAE,EAC5B,UAAU,GAAmB,GAAG,EAAE,GAAE,CAAC;IAErC,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,IAAI,cAAc,CAAC,QAAQ,CAAC;IAC9D,MAAM,IAAI,GAAG,CAAC,IAAsB,EAAE,EAAU,EAAiB,EAAE,CACjE,EAAE,KAAK,UAAU;QACf,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnB,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CACnE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CACxB,CAAC;IACR,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;QAC9D,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,IAAI,cAAc,CAAC,MAAM,CAAC;QAC9D,OAAO,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC;KACnE,CAAC;AACJ,CAAC"}
@@ -45,7 +45,7 @@ export interface ComposeOptions {
45
45
  * NAME AND PATH ONLY. The credentials are typed out-of-band before the first
46
46
  * step and never enter this prompt — the system prompt is resent to the
47
47
  * provider on EVERY step, and the repo's standing rule for a secret is that it
48
- * never reaches the model's context (see `adapters/browser/log-format.ts`).
48
+ * never reaches the model's context (see `src/redact.ts`).
49
49
  * What the driver needs is not the recipe, it is knowing it is already inside.
50
50
  */
51
51
  auth?: {
@@ -13,6 +13,7 @@
13
13
  * Only the paragraphs that would contradict the live tool differ; everything
14
14
  * else is shared so the two variants can never drift.
15
15
  */
16
+ import { BUG_KINDS, TERMINAL_STATUSES, VISUAL_SEVERITIES } from '../../findings/schema.js';
16
17
  /** Blind driver + separate vision guy: `look` is a second model call, and it can latch off. */
17
18
  const VISION_MODE = {
18
19
  eyes: 'You are FAST and BLIND: you NEVER see pixels. When visual judgment is needed, call `look`.',
@@ -24,14 +25,37 @@ const VISION_MODE = {
24
25
  - If \`look\` reports it is unavailable for this run, do not call it again — finish
25
26
  the structural checks and state in your report summary that visual checks could
26
27
  not be performed (unverified, not passed).`,
28
+ // `createLookTool` records every issue the vision guy flags on the trail, so
29
+ // `report` can carry them even when the driver forgets to list them.
30
+ carried: `Console errors and look issues you surfaced earlier are carried into the verdict
31
+ EVEN if you forget to list them — omission cannot erase evidence, so still list
32
+ what matters (your wording wins). Set "dismissStreamed": true ONLY to drop
33
+ streamed findings you deliberately ruled out.`,
34
+ // `createLookTool` records every look issue the vision guy flags on the trail,
35
+ // so a step-capped run keeps them like the act steps and console errors.
36
+ streamed: `(act steps, console errors, look issues) is kept on disk as partial,
37
+ unconfirmed findings.`,
27
38
  };
28
39
  /** Multimodal driver: `look` hands the frame back to it — no vision guy, no latch. */
29
40
  const SELF_LOOK_MODE = {
30
41
  eyes: 'You are FAST and MULTIMODAL: `look` attaches the current frame to the tool result, and YOU judge it with your own eyes.',
31
42
  belt: '- `look` — capture the current screen and judge it yourself; the frame comes back attached.',
32
- // `pruneStaleFrames` (agent/loop.ts) drops older frames from the re-sent history.
43
+ // `pruneStaleFrames` (agent/loop-frames.ts) drops older frames from the re-sent history.
33
44
  cost: 'Only the newest frame stays in your context, so judge each one as it arrives.',
34
45
  extraRule: '',
46
+ // `createSelfLookTool` (look.ts) records NOTHING on the trail — it hands the
47
+ // frame back and the driver judges it. An unlisted look issue is simply lost.
48
+ carried: `Console errors you surfaced earlier are carried into the verdict EVEN if you
49
+ forget to list them — omission cannot erase them. Look issues are NOT carried:
50
+ YOU judged the frames, nothing recorded them, so every visual finding MUST be
51
+ in your report or it is lost. Set "dismissStreamed": true ONLY to drop
52
+ streamed findings you deliberately ruled out.`,
53
+ // `createSelfLookTool` (look.ts) records NOTHING on the trail — the frame comes
54
+ // back and the driver judges it. A step-capped run keeps the streamed act steps
55
+ // and console errors; an unlisted look issue is gone, as `carried` below warns.
56
+ streamed: `(act steps, console errors) is kept on disk as partial, unconfirmed
57
+ findings. Look judgments are NOT recorded — you saw the frames yourself, so a
58
+ visual issue you never write down is lost with the run.`,
35
59
  };
36
60
  /**
37
61
  * Build the base prompt for one eye mode. `selfLook` must match the `look` tool
@@ -82,13 +106,15 @@ target. Re-typing a used field yields \`old textnew text\` — YOUR bug, not the
82
106
  Replace instead — pass \`clear: true\`:
83
107
  \`act({action:"type", target:"...", text:"...", clear:true})\`
84
108
  Use \`clear\` whenever the field may be non-empty — a retry, a second item through
85
- the same form, any field you have not just read as empty.
109
+ the same form, any field you have not just read as empty. To EMPTY a field:
110
+ \`text:"", clear:true\`.
86
111
 
87
- ## Budget — an unreported run produces NOTHING
112
+ ## Budget — spending it all still costs the verdict
88
113
 
89
- Steps are limited. Spend them all without calling \`report\` and the whole run is
90
- discarded: no findings, no verdict. Worse than a partial report, far worse than a
91
- failed verdict.
114
+ Steps are limited. Spend them all without calling \`report\` and the run ends with
115
+ NO verdict. What is lost is the conclusion, not the evidence: whatever you streamed
116
+ along the way ${mode.streamed}
117
+ Worse than a partial report, far worse than a failed verdict.
92
118
 
93
119
  - Load-bearing checks first. The goal will take longer than you think.
94
120
  - Warned the budget is nearly spent → STOP exploring, \`report\` what you have.
@@ -149,12 +175,21 @@ beats a long one padded with noise.
149
175
 
150
176
  ## Visual findings
151
177
 
152
- \`{ issue: "what", where: "which component/area", severity: "low|medium|high", screenshot?: "path" }\`
178
+ \`{ issue: "what", where: "which component/area", severity: "${VISUAL_SEVERITIES.join('|')}", screenshot?: "path" }\`
153
179
 
154
180
  - \`high\` — broken layout, text overlap, invisible interactive elements.
155
181
  - \`medium\` — misalignment, bad spacing, contrast issue.
156
182
  - \`low\` — polish (rounding, colour shade, icon size).
157
183
 
184
+ ### Visual inspection checklist
185
+
186
+ Use \`look\` for these checks (ask it explicitly in separate-eye mode):
187
+ - Inspect text overlapping neighboring elements.
188
+ - Inspect borders striking through text.
189
+ - On table-heavy pages, inspect table-column boundaries for text crossing into adjacent columns.
190
+ Report only what the screenshot supports, with the affected area and screenshot path.
191
+ If unclear or not inspected, say uncertain or unverified — never claim it passed.
192
+
158
193
  ## Verdict
159
194
 
160
195
  With \`criteria\`: \`status:"passed"\` only when ALL pass; any failure → \`"failed"\`.
@@ -167,14 +202,17 @@ Goal complete (or step limit hit) → call \`report\` exactly once:
167
202
 
168
203
  \`\`\`json
169
204
  {
170
- "status": "passed" | "failed",
205
+ "status": ${TERMINAL_STATUSES.map((s) => `"${s}"`).join(' | ')},
171
206
  "steps": [ { "step": "...", "ok": true, "note": "...", "screenshot": "..." } ],
172
- "bugs": [ { "kind": "console"|"network"|"flow", "detail": "...", "evidence": "..." } ],
173
- "visual": [ { "issue": "...", "where": "...", "severity": "low"|"medium"|"high", "screenshot": "..." } ],
207
+ "bugs": [ { "kind": ${BUG_KINDS.map((k) => `"${k}"`).join('|')}, "detail": "...", "evidence": "..." } ],
208
+ "visual": [ { "issue": "...", "where": "...", "severity": ${VISUAL_SEVERITIES.map((s) => `"${s}"`).join('|')}, "screenshot": "..." } ],
209
+ "dismissStreamed": false,
174
210
  "summary": "One-paragraph verdict the smart agent can act on."
175
211
  }
176
212
  \`\`\`
177
213
 
214
+ ${mode.carried}
215
+
178
216
  NEVER stop before \`report\`. NEVER call it twice. The summary is for the smart
179
217
  agent — make it actionable: what broke, where, what to fix.
180
218
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"debug-agent.js","sourceRoot":"","sources":["../../../src/agent/prompts/debug-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAcH,+FAA+F;AAC/F,MAAM,WAAW,GAAa;IAC5B,IAAI,EAAE,4FAA4F;IAClG,IAAI,EAAE,yFAAyF;IAC/F,IAAI,EAAE,8BAA8B;IACpC,iFAAiF;IACjF,iFAAiF;IACjF,SAAS,EAAE;;;6CAGgC;CAC5C,CAAC;AAEF,sFAAsF;AACtF,MAAM,cAAc,GAAa;IAC/B,IAAI,EAAE,yHAAyH;IAC/H,IAAI,EAAE,6FAA6F;IACnG,kFAAkF;IAClF,IAAI,EAAE,+EAA+E;IACrF,SAAS,EAAE,EAAE;CACd,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAiB;IAChD,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC;IAErD,OAAO;;;EAGP,IAAI,CAAC,IAAI;;;;;;EAMT,IAAI,CAAC,IAAI;;;;;;;;KAQN,IAAI,CAAC,IAAI;;;;;;;;;;;;;;;yDAe2C,IAAI,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGtE,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"debug-agent.js","sourceRoot":"","sources":["../../../src/agent/prompts/debug-agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAkB3F,+FAA+F;AAC/F,MAAM,WAAW,GAAa;IAC5B,IAAI,EAAE,4FAA4F;IAClG,IAAI,EAAE,yFAAyF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G,CAAC;8DACJ,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;EAM5G,IAAI,CAAC,OAAO;;;;CAIb,CAAC;AACF,CAAC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Web-target addendum for the debug agent system prompt.
3
3
  *
4
- * Teaches CDP reach: which domains to use, why, and the DOM-first rule.
4
+ * Teaches web reach: tree queries, selectors, console/network, iframes, tabs.
5
5
  * Appended to the base prompt by `compose.ts` when target is "web".
6
6
  *
7
7
  * Provider-agnostic — no vendor tricks; any competent model drives the same loop.
8
8
  */
9
- export declare const WEB_ADDENDUM_PROMPT = "## Web target \u2014 CDP reach\n\nYour browser connection is the Chrome DevTools Protocol: DOM, console, network,\ninput, screenshots on the current page.\n\n| CDP domain | Gives you | Reach via |\n|------------|-----------|-----------|\n| `Page` | navigate, wait for load, screenshot | `act({action:\"navigate\"})`, `observe({kind:\"screenshot\"})` |\n| `DOM` | element tree, attributes, text | `observe({kind:\"tree\"})` |\n| `Network` | status, failed requests, timing | `observe({kind:\"network\"})` |\n| `Log` | console messages, JS errors | `observe({kind:\"console\"})` |\n\n### DOM-first\n\n1. `observe({kind:\"tree\"})` \u2014 roles, names, bounds, enabled state.\n2. Element not in the tree \u2192 scroll or wait, then re-observe.\n3. `observe({kind:\"console\"})` + `observe({kind:\"network\"})` (filtered) after\n actions that plausibly error \u2014 errors land there before they show visually.\n4. Only when the tree has no answer: `look`.\n\n### Tree queries\n\n- `query` accepts: a bare tag (`span`, `img`), CSS (`.cart span`), `role \"name\"`\n (`button \"Add to cart\"`), an engine (`data-testid=cart-count`, `text=Subscribe`),\n or plain visible text.\n- `data-testid` elements always appear in the default tree with their `testid`.\n Read a counter/value from that node's `name` (its text). Re-observe the same\n node after acting to confirm the change.\n- `within` scopes a read: a selector string, or a node OBJECT exactly as a previous\n observe returned it \u2014 NEVER a JSON-stringified node.\n\n### Contrast \u2014 no vision needed\n\nText nodes carry `style` = `{ color, backgroundColor, contrast }` (WCAG 1\u201321),\nomitted by default. Request `fields:[\"role\",\"name\",\"style\"]`, or sweep in ONE call:\n`observe({kind:\"tree\", query:\"p, span, div, a, li\", filters:{contrast_lt: 4.5}})`\n(returns only hard-to-read text; empty = fine). `contrast < 4.5` \u2192 `medium` visual\nfinding; `< 1.5` \u2192 `high` (effectively invisible). ALWAYS sweep once when the goal\nmentions readability, contrast, or visual polish.\n\n### Follow links by CLICKING \u2014 never invent URLs\n\nThe tree does not expose `href`s. `act({action:\"click\"})` the node. NEVER fabricate\na URL from a label (\"Help Center\" \u2192 `/help-center`) \u2014 a guessed URL that 404s is\nYOUR error, not a site bug. Only `navigate` to URLs from the goal or from network\nentries. Click target hidden inside a closed menu \u2192 click the parent menu item\nfirst, then re-observe.\n\n### Verify input from the TREE, never vision\n\nForm controls carry live state: `value` (input/textarea/select) and `checked`\n(checkbox/radio). `name` stays the label, so you can still target by it.\n\nAfter typing or toggling:\n`observe({kind:\"tree\", query:\"input\", fields:[\"name\",\"value\",\"checked\"]})`\n\nNEVER spend a `look` on \"did my text land?\" or \"is the box checked?\" \u2014 the tree\nanswers exactly, instantly, free. Vision is for how things LOOK.\n\n### Login bypass\n\nTarget supports `?debug-ai=true` (the app's captcha gate) \u2192 append it to the login\nURL before navigating. Skips captcha only, not auth. Needs `ALLOW_AI_DEBUG_LOGIN=true`\nin the app's environment.\n\n### Selectors \u2014 copy the node's `target`\n\nMost actionable nodes carry a ready `target` (`data-testid=\"cart-count\"`, else\n`role=button[name=\"Add to cart\" i]`, with `>> nth=N` when names repeat). COPY it\nverbatim into `act({action, target})`. NEVER hand-craft a selector \u2014 guessed CSS\nlike `button[name=\"...\"]` will not resolve.\n\nNo `target` (unnamed node, or a scoped `within`/`filters` read) \u2192 pass its visible\ntext (plain text resolves) or `role \"name\"`. Avoid XPath and positional CSS.\n\n### Console + network \u2014 filter, don't dump\n\n- `observe({kind:\"console\", filters:{level_eq:\"error\"}})` \u2014 just JS errors.\n- `observe({kind:\"network\", filters:{status_gte:400}})` \u2014 just failed requests.\n- `limit` caps rows when you need only the latest few.\n\nCheck both after actions that plausibly error (submits, navigations, API calls) \u2014\nnot mechanically after every `act`. Record what you find as `console`/`network`\nbugs: request URL or error message as `detail`, screenshot path as `evidence`.\n\n### Network rows carry the WHY\n\nEach row is a full exchange: `method`, `url`, `status`, `ok`, `durationMs`, plus\n`requestBody`, `responseBody` and redacted `requestHeaders`/`responseHeaders` for\n`fetch`/`xhr`.\n\n**A failing request is half-reported without its `responseBody`.** NEVER stop at\n\"POST /api/x returned 400\" \u2014 quote what the server said\n(`{\"error\":\"password too short\"}`); that string turns a finding into a fix. The\n`requestBody` shows whether the UI even sent what you typed.\n\nCredential header values arrive as `<redacted, N chars>` \u2014 deliberate. Presence is\nwhat you need (a missing `cookie` explains a 401), never the secret.\n\n- `filters:{duration_gte:1000}` \u2014 slow enough to be a UX bug.\n- `filters:{body_contains:\"error\"}` \u2014 failures that still returned 200.\n\nA default `network` read hides SUCCESSFUL static assets and reports the count as\n`hidden` \u2014 on a dev server they outnumber API calls ~15:1. Failed assets are always\nshown (a 404 image is a real bug). Inspect assets deliberately:\n`observe({kind:\"network\", filters:{resource_in:[\"script\",\"stylesheet\",\"image\"]}})`.\n\n### iframes \u2014 already in the tree\n\n`observe({kind:\"tree\"})` reads embedded documents (payment fields, editors, consent\nscreens). A node inside one carries `frame` = the iframe URL; its `bounds` are page\ncoordinates, so clicking needs nothing special. A selector that mysteriously fails\non a node you can see \u2192 check for `frame`, and prefer clicking the node object.\n\n### Tabs \u2014 a click can open one\n\nWith more than one tab open, every `act` result carries `tabs`\n(`index`, `url`, `title`, `active`). A click on an external link, an OAuth button\nor `target=\"_blank\"` opens a new tab and **you stay on the old one** \u2014 a click that\nseems to have done nothing means check `tabs` before calling the button broken.\n\n- `observe({kind:\"tabs\"})` \u2014 list them.\n- `act({action:\"switch_tab\", target:\"1\"})` \u2014 drive tab 1 from now on. Console and\n network capture follow you; the previous tab's records are kept.\n\nSwitch back the same way when the popup flow is done.\n";
9
+ export declare const WEB_ADDENDUM_PROMPT = "## Web target\n\nYou drive ONE browser page: DOM tree, console, network, input, screenshots.\n\n- Element not in the tree \u2192 scroll or wait, then re-observe.\n- Errors land in console/network before they show visually (see below).\n- Only when the tree has no answer: `look`.\n\n### Tree queries\n\n- `query` accepts: a bare tag (`span`, `img`), CSS (`.cart span`), `role \"name\"`\n (`button \"Add to cart\"`), an engine (`data-testid=cart-count`, `text=Subscribe`),\n or plain visible text.\n- `data-testid` elements always appear in the default tree with their `testid`.\n Read a counter/value from that node's `name` (its text). Re-observe the same\n node after acting to confirm the change.\n- `within` scopes a read: a selector string, or a node OBJECT exactly as a previous\n observe returned it \u2014 NEVER a JSON-stringified node.\n\n### Contrast \u2014 no vision needed\n\nText nodes carry `style` = `{ color, backgroundColor, contrast }` (WCAG 1\u201321),\nomitted by default. Request `fields:[\"role\",\"name\",\"style\"]`, or sweep in ONE call:\n`observe({kind:\"tree\", query:\"p, span, div, a, li\", filters:{contrast_lt: 4.5}})`\n(returns only hard-to-read text; empty = fine). `contrast < 4.5` \u2192 `medium` visual\nfinding; `< 1.5` \u2192 `high` (effectively invisible). ALWAYS sweep once when the goal\nmentions readability, contrast, or visual polish.\n\n### Follow links by CLICKING \u2014 never invent URLs\n\nThe tree does not expose `href`s. `act({action:\"click\"})` the node. NEVER fabricate\na URL from a label (\"Help Center\" \u2192 `/help-center`) \u2014 a guessed URL that 404s is\nYOUR error, not a site bug. Only `navigate` to URLs from the goal or from network\nentries. Click target hidden inside a closed menu \u2192 click the parent menu item\nfirst, then re-observe.\n\n### Verify input from the TREE, never vision\n\nForm controls carry live state: `value` (input/textarea/select) and `checked`\n(checkbox/radio). `name` stays the label, so you can still target by it.\n\nAfter typing or toggling:\n`observe({kind:\"tree\", query:\"input\", fields:[\"name\",\"value\",\"checked\"]})`\n\nNEVER spend a `look` on \"did my text land?\" or \"is the box checked?\" \u2014 the tree\nanswers exactly, instantly, free. Vision is for how things LOOK.\n\n### Login bypass\n\nTarget supports `?debug-ai=true` (the app's captcha gate) \u2192 append it to the login\nURL before navigating. Skips captcha only, not auth. Needs `ALLOW_AI_DEBUG_LOGIN=true`\nin the app's environment.\n\n### Selectors \u2014 copy the node's `target`\n\nMost actionable nodes carry a ready `target` (`data-testid=\"cart-count\"`, else\n`role=button[name=\"Add to cart\" i]`, with `>> nth=N` when names repeat). COPY it\nverbatim into `act({action, target})`. NEVER hand-craft a selector \u2014 guessed CSS\nlike `button[name=\"...\"]` will not resolve.\n\nNo `target` (unnamed node, or a scoped `within`/`filters` read) \u2192 pass its visible\ntext (plain text resolves) or `role \"name\"`. Avoid XPath and positional CSS.\n\n### Console + network \u2014 filter, don't dump\n\n- `observe({kind:\"console\", filters:{level_eq:\"error\"}})` \u2014 just JS errors.\n- `observe({kind:\"network\", filters:{status_gte:400}})` \u2014 just failed requests.\n- `limit` caps rows when you need only the latest few.\n- Every row carries `tab` \u2014 the id of the tab it came from (see Tabs).\n\nCheck both after actions that plausibly error (submits, navigations, API calls) \u2014\nnot mechanically after every `act`. Record what you find as `console`/`network`\nbugs: request URL or error message as `detail`, screenshot path as `evidence`.\n\n### Network rows carry the WHY\n\nEach row is a full exchange: `method`, `url`, `status`, `ok`, `durationMs`, plus\n`requestBody`, `responseBody` and redacted `requestHeaders`/`responseHeaders` for\n`fetch`/`xhr`.\n\n**A failing request is half-reported without its `responseBody`.** NEVER stop at\n\"POST /api/x returned 400\" \u2014 quote what the server said\n(`{\"error\":\"password too short\"}`); that string turns a finding into a fix. The\n`requestBody` shows whether the UI even sent what you typed.\n\nCredentials arrive as `<redacted, N chars>` \u2014 header values, and the signed-in\npersona's values wherever they appear (bodies, urls, node names and `value`s).\nDeliberate, never a bug. Presence is what you need (a missing `cookie` explains a\n401). Such a node's `target` is an opaque `@@ref:N` \u2014 copy it like any other.\n\n- `filters:{duration_gte:1000}` \u2014 slow enough to be a UX bug.\n- `filters:{body_contains:\"error\"}` \u2014 failures that still returned 200.\n- `filters:{pending_eq:true}` \u2014 still in flight (no response yet): the hung call\n behind a spinner.\n\nA default `network` read hides SUCCESSFUL static assets and reports the count as\n`hidden` \u2014 on a dev server they outnumber API calls ~15:1. Failed assets are always\nshown (a 404 image is a real bug). Inspect assets deliberately:\n`observe({kind:\"network\", filters:{resource_in:[\"script\",\"stylesheet\",\"image\"]}})`.\n\n### iframes \u2014 already in the tree\n\n`observe({kind:\"tree\"})` reads embedded documents (payment fields, editors, consent\nscreens). A node inside one carries `frame` = the iframe URL; its `bounds` are page\ncoordinates, so clicking needs nothing special. A selector that mysteriously fails\non a node you can see \u2192 check for `frame`, and prefer clicking the node object.\n\n### Tabs \u2014 a click can open one\n\nWith more than one tab open, every `act` result carries `tabs`\n(`index`, `id`, `url`, `title`, `active`, `visible`). `active` = the page you\ncontrol; `visible` = document visibility, NOT window focus (an active page can be\nhidden). A click on an external link, an OAuth button or `target=\"_blank\"` opens a\nnew tab and **you stay on the old one** \u2014 a click that seems to have done nothing\nmeans check `tabs` before calling the button broken.\n\n- `observe({kind:\"tabs\"})` \u2014 list them.\n- `act({action:\"switch_tab\", target:\"1\"})` \u2014 drive the tab at index 1 from now on\n and explicitly bring it forward. Console and network capture follow you; the\n previous tab's records are kept.\n\n`index` is a POSITION \u2014 it shifts when an earlier tab closes. `id` (`tab-1`,\n`tab-2`, \u2026) follows the PAGE for the whole run; console/network rows carry it as\n`tab`. To drive that tab, find its `id` in the CURRENT `tabs` listing and switch\nto that entry's `index` \u2014 the label is NOT an index, and `switch_tab` rejects it.\n\nSwitch back the same way when the popup flow is done.\n";
@@ -1,31 +1,19 @@
1
1
  /**
2
2
  * Web-target addendum for the debug agent system prompt.
3
3
  *
4
- * Teaches CDP reach: which domains to use, why, and the DOM-first rule.
4
+ * Teaches web reach: tree queries, selectors, console/network, iframes, tabs.
5
5
  * Appended to the base prompt by `compose.ts` when target is "web".
6
6
  *
7
7
  * Provider-agnostic — no vendor tricks; any competent model drives the same loop.
8
8
  */
9
9
  export const WEB_ADDENDUM_PROMPT = `\
10
- ## Web target — CDP reach
10
+ ## Web target
11
11
 
12
- Your browser connection is the Chrome DevTools Protocol: DOM, console, network,
13
- input, screenshots on the current page.
12
+ You drive ONE browser page: DOM tree, console, network, input, screenshots.
14
13
 
15
- | CDP domain | Gives you | Reach via |
16
- |------------|-----------|-----------|
17
- | \`Page\` | navigate, wait for load, screenshot | \`act({action:"navigate"})\`, \`observe({kind:"screenshot"})\` |
18
- | \`DOM\` | element tree, attributes, text | \`observe({kind:"tree"})\` |
19
- | \`Network\` | status, failed requests, timing | \`observe({kind:"network"})\` |
20
- | \`Log\` | console messages, JS errors | \`observe({kind:"console"})\` |
21
-
22
- ### DOM-first
23
-
24
- 1. \`observe({kind:"tree"})\` — roles, names, bounds, enabled state.
25
- 2. Element not in the tree → scroll or wait, then re-observe.
26
- 3. \`observe({kind:"console"})\` + \`observe({kind:"network"})\` (filtered) after
27
- actions that plausibly error — errors land there before they show visually.
28
- 4. Only when the tree has no answer: \`look\`.
14
+ - Element not in the tree → scroll or wait, then re-observe.
15
+ - Errors land in console/network before they show visually (see below).
16
+ - Only when the tree has no answer: \`look\`.
29
17
 
30
18
  ### Tree queries
31
19
 
@@ -87,6 +75,7 @@ text (plain text resolves) or \`role "name"\`. Avoid XPath and positional CSS.
87
75
  - \`observe({kind:"console", filters:{level_eq:"error"}})\` — just JS errors.
88
76
  - \`observe({kind:"network", filters:{status_gte:400}})\` — just failed requests.
89
77
  - \`limit\` caps rows when you need only the latest few.
78
+ - Every row carries \`tab\` — the id of the tab it came from (see Tabs).
90
79
 
91
80
  Check both after actions that plausibly error (submits, navigations, API calls) —
92
81
  not mechanically after every \`act\`. Record what you find as \`console\`/\`network\`
@@ -103,11 +92,15 @@ Each row is a full exchange: \`method\`, \`url\`, \`status\`, \`ok\`, \`duration
103
92
  (\`{"error":"password too short"}\`); that string turns a finding into a fix. The
104
93
  \`requestBody\` shows whether the UI even sent what you typed.
105
94
 
106
- Credential header values arrive as \`<redacted, N chars>\` — deliberate. Presence is
107
- what you need (a missing \`cookie\` explains a 401), never the secret.
95
+ Credentials arrive as \`<redacted, N chars>\` — header values, and the signed-in
96
+ persona's values wherever they appear (bodies, urls, node names and \`value\`s).
97
+ Deliberate, never a bug. Presence is what you need (a missing \`cookie\` explains a
98
+ 401). Such a node's \`target\` is an opaque \`@@ref:N\` — copy it like any other.
108
99
 
109
100
  - \`filters:{duration_gte:1000}\` — slow enough to be a UX bug.
110
101
  - \`filters:{body_contains:"error"}\` — failures that still returned 200.
102
+ - \`filters:{pending_eq:true}\` — still in flight (no response yet): the hung call
103
+ behind a spinner.
111
104
 
112
105
  A default \`network\` read hides SUCCESSFUL static assets and reports the count as
113
106
  \`hidden\` — on a dev server they outnumber API calls ~15:1. Failed assets are always
@@ -124,13 +117,21 @@ on a node you can see → check for \`frame\`, and prefer clicking the node obje
124
117
  ### Tabs — a click can open one
125
118
 
126
119
  With more than one tab open, every \`act\` result carries \`tabs\`
127
- (\`index\`, \`url\`, \`title\`, \`active\`). A click on an external link, an OAuth button
128
- or \`target="_blank"\` opens a new tab and **you stay on the old one** — a click that
129
- seems to have done nothing means check \`tabs\` before calling the button broken.
120
+ (\`index\`, \`id\`, \`url\`, \`title\`, \`active\`, \`visible\`). \`active\` = the page you
121
+ control; \`visible\` = document visibility, NOT window focus (an active page can be
122
+ hidden). A click on an external link, an OAuth button or \`target="_blank"\` opens a
123
+ new tab and **you stay on the old one** — a click that seems to have done nothing
124
+ means check \`tabs\` before calling the button broken.
130
125
 
131
126
  - \`observe({kind:"tabs"})\` — list them.
132
- - \`act({action:"switch_tab", target:"1"})\` — drive tab 1 from now on. Console and
133
- network capture follow you; the previous tab's records are kept.
127
+ - \`act({action:"switch_tab", target:"1"})\` — drive the tab at index 1 from now on
128
+ and explicitly bring it forward. Console and network capture follow you; the
129
+ previous tab's records are kept.
130
+
131
+ \`index\` is a POSITION — it shifts when an earlier tab closes. \`id\` (\`tab-1\`,
132
+ \`tab-2\`, …) follows the PAGE for the whole run; console/network rows carry it as
133
+ \`tab\`. To drive that tab, find its \`id\` in the CURRENT \`tabs\` listing and switch
134
+ to that entry's \`index\` — the label is NOT an index, and \`switch_tab\` rejects it.
134
135
 
135
136
  Switch back the same way when the popup flow is done.
136
137
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"web-addendum.js","sourceRoot":"","sources":["../../../src/agent/prompts/web-addendum.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+HlC,CAAC"}
1
+ {"version":3,"file":"web-addendum.js","sourceRoot":"","sources":["../../../src/agent/prompts/web-addendum.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgIlC,CAAC"}
@@ -3,14 +3,54 @@
3
3
  * Resolves API key and base URL with fallbacks from environment variables.
4
4
  */
5
5
  import { type OpenRouterProvider } from '@openrouter/ai-sdk-provider';
6
+ /**
7
+ * The provider credential contract — ONE list, used by every entry point that
8
+ * resolves an API key (the runtime provider here, the boot-time config loader
9
+ * in `src/config/load.ts`). Order is precedence: `OPENAI_API_KEY` wins over
10
+ * `OPENROUTER_API_KEY` when both are set.
11
+ *
12
+ * Keep this list and {@link resolveProviderApiKey} in sync by using both — a
13
+ * missing-key message that names a key this list does not accept sends the
14
+ * user to a variable the resolver never reads.
15
+ */
16
+ export declare const PROVIDER_API_KEY_ENV_VARS: readonly ['OPENAI_API_KEY', 'OPENROUTER_API_KEY'];
17
+ /** An environment-shaped record of provider credentials. */
18
+ export type ProviderEnv = Record<string, string | undefined>;
6
19
  export interface ProviderOptions {
7
20
  apiKey?: string;
8
21
  baseURL?: string;
9
22
  }
23
+ /**
24
+ * Resolve the provider API key: explicit value → `OPENAI_API_KEY` →
25
+ * `OPENROUTER_API_KEY` (see {@link PROVIDER_API_KEY_ENV_VARS} for the
26
+ * precedence). Blank values count as absent, so an empty variable falls
27
+ * through to the next source instead of shadowing it.
28
+ *
29
+ * Returns the key only — never the whole environment, and never an error
30
+ * message that could carry a credential value.
31
+ */
32
+ export declare function resolveProviderApiKey(explicit?: string, env?: ProviderEnv): string | undefined;
33
+ /**
34
+ * The precedence clause shared by every missing-key message: the accepted
35
+ * environment variables IN RESOLUTION ORDER, and the fact that the first one
36
+ * wins when several are set. Derived from {@link PROVIDER_API_KEY_ENV_VARS} so
37
+ * the resolver and the message can never drift apart.
38
+ *
39
+ * Never includes a credential value.
40
+ */
41
+ export declare function providerApiKeyPrecedence(): string;
42
+ /**
43
+ * The missing-key guidance, naming ONLY the environment variables this module
44
+ * accepts. Derived from {@link PROVIDER_API_KEY_ENV_VARS} so it can never
45
+ * drift out of sync, and never includes a credential value.
46
+ */
47
+ export declare function providerApiKeyGuidance(): string;
10
48
  /**
11
49
  * Resolve the provider endpoint the same way `createOpenRouterProvider` does —
12
50
  * apiKey: provided value → OPENAI_API_KEY → OPENROUTER_API_KEY;
13
- * baseURL: provided value → OPENAI_BASE_URL → DEFAULT_BASE_URL.
51
+ * baseURL: provided value → DEFAULT_BASE_URL. `OPENAI_BASE_URL` is NOT read
52
+ * here: the config loader (`src/config/load.ts`) is its one, validated source
53
+ * and boot passes the result in.
14
54
  * Exported so capability probes hit the exact endpoint the models run against.
15
55
  * Throws ProviderError if no API key is found or if it's empty.
16
56
  */
@@ -5,19 +5,73 @@
5
5
  import { createOpenRouter } from '@openrouter/ai-sdk-provider';
6
6
  import { ProviderError } from '../errors.js';
7
7
  const DEFAULT_BASE_URL = 'https://openrouter.ai/api/v1';
8
+ /**
9
+ * The provider credential contract — ONE list, used by every entry point that
10
+ * resolves an API key (the runtime provider here, the boot-time config loader
11
+ * in `src/config/load.ts`). Order is precedence: `OPENAI_API_KEY` wins over
12
+ * `OPENROUTER_API_KEY` when both are set.
13
+ *
14
+ * Keep this list and {@link resolveProviderApiKey} in sync by using both — a
15
+ * missing-key message that names a key this list does not accept sends the
16
+ * user to a variable the resolver never reads.
17
+ */
18
+ export const PROVIDER_API_KEY_ENV_VARS = ['OPENAI_API_KEY', 'OPENROUTER_API_KEY'];
19
+ /**
20
+ * Resolve the provider API key: explicit value → `OPENAI_API_KEY` →
21
+ * `OPENROUTER_API_KEY` (see {@link PROVIDER_API_KEY_ENV_VARS} for the
22
+ * precedence). Blank values count as absent, so an empty variable falls
23
+ * through to the next source instead of shadowing it.
24
+ *
25
+ * Returns the key only — never the whole environment, and never an error
26
+ * message that could carry a credential value.
27
+ */
28
+ export function resolveProviderApiKey(explicit, env = process.env) {
29
+ const provided = explicit?.trim();
30
+ if (provided)
31
+ return provided;
32
+ for (const name of PROVIDER_API_KEY_ENV_VARS) {
33
+ const value = env[name]?.trim();
34
+ if (value)
35
+ return value;
36
+ }
37
+ return undefined;
38
+ }
39
+ /**
40
+ * The precedence clause shared by every missing-key message: the accepted
41
+ * environment variables IN RESOLUTION ORDER, and the fact that the first one
42
+ * wins when several are set. Derived from {@link PROVIDER_API_KEY_ENV_VARS} so
43
+ * the resolver and the message can never drift apart.
44
+ *
45
+ * Never includes a credential value.
46
+ */
47
+ export function providerApiKeyPrecedence() {
48
+ const [first, ...rest] = PROVIDER_API_KEY_ENV_VARS;
49
+ const tieBreak = rest.length > 0 ? ` (${first} wins if both are set)` : '';
50
+ return `Set ${PROVIDER_API_KEY_ENV_VARS.join(' or ')} in the environment${tieBreak}`;
51
+ }
52
+ /**
53
+ * The missing-key guidance, naming ONLY the environment variables this module
54
+ * accepts. Derived from {@link PROVIDER_API_KEY_ENV_VARS} so it can never
55
+ * drift out of sync, and never includes a credential value.
56
+ */
57
+ export function providerApiKeyGuidance() {
58
+ return `No API key found. ${providerApiKeyPrecedence()} Or provide apiKey in options.`;
59
+ }
8
60
  /**
9
61
  * Resolve the provider endpoint the same way `createOpenRouterProvider` does —
10
62
  * apiKey: provided value → OPENAI_API_KEY → OPENROUTER_API_KEY;
11
- * baseURL: provided value → OPENAI_BASE_URL → DEFAULT_BASE_URL.
63
+ * baseURL: provided value → DEFAULT_BASE_URL. `OPENAI_BASE_URL` is NOT read
64
+ * here: the config loader (`src/config/load.ts`) is its one, validated source
65
+ * and boot passes the result in.
12
66
  * Exported so capability probes hit the exact endpoint the models run against.
13
67
  * Throws ProviderError if no API key is found or if it's empty.
14
68
  */
15
69
  export function resolveProviderConfig(options = {}) {
16
- const apiKey = options.apiKey || process.env.OPENAI_API_KEY || process.env.OPENROUTER_API_KEY || '';
17
- if (!apiKey || apiKey.trim() === '') {
18
- throw new ProviderError('No API key found. Set OPENAI_API_KEY or OPENROUTER_API_KEY in the environment, or provide apiKey in options.');
70
+ const apiKey = resolveProviderApiKey(options.apiKey);
71
+ if (!apiKey) {
72
+ throw new ProviderError(providerApiKeyGuidance());
19
73
  }
20
- const baseURL = options.baseURL || process.env.OPENAI_BASE_URL || DEFAULT_BASE_URL;
74
+ const baseURL = options.baseURL || DEFAULT_BASE_URL;
21
75
  return { apiKey, baseURL };
22
76
  }
23
77
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/agent/provider.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,gBAAgB,EAA2B,MAAM,6BAA6B,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AAOxD;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAA2B,EAA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ACN,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CAAC,CAAC;AACL,CAAC"}
package/dist/boot.d.ts ADDED
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Server boot — the sequence that turns a project directory into a live stdio
3
+ * MCP server.
4
+ *
5
+ * It lives apart from the CLI (`src/main.ts`) for one reason: the boot has a
6
+ * GATE in front of it. The workspace's one-run ownership rests on a
7
+ * kernel-held `flock(2)`, and a host that cannot provide that backend can
8
+ * never enforce it — two servers would each believe it owns the workspace. So
9
+ * the gate runs FIRST: a host without a flock backend must not have created a
10
+ * workspace, read a config, probed a provider or accepted a run.
11
+ *
12
+ * Everything after the gate is the wiring `main.ts` used to do inline, moved
13
+ * verbatim: config → workspace → provider/models → self-look → the debug
14
+ * service → the outer tools → the stdio server, plus the shutdown path.
15
+ *
16
+ * Every step a test needs to observe is a seam ({@link BootDeps}), so the
17
+ * whole boot is drivable in-process — no module mock, which would leak into
18
+ * the suites running alongside.
19
+ */
20
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
21
+ import { type McpTool } from './mcp/server.js';
22
+ import { type StatePort } from './session/state-file.js';
23
+ import { type WorkspacePaths } from './session/workspace.js';
24
+ /** The seams the boot drives — each injectable, so the boot is drivable in-process. */
25
+ export interface BootDeps {
26
+ /**
27
+ * The owner-lock backend gate: resolve the platform's `flock(2)` WITHOUT
28
+ * taking a lock. Defaults to the real one (`assertOwnerLockBackend`), which
29
+ * fails loud when the host has no such backend.
30
+ */
31
+ assertOwnerLockBackend?: () => Promise<void>;
32
+ /** Start the MCP server. Defaults to the stdio server. */
33
+ startServer?: (tools: McpTool[], init: {
34
+ onClose?: () => void;
35
+ }) => Promise<McpServer>;
36
+ /** Terminate the process. Defaults to `process.exit`. */
37
+ exit?: (code: number) => void;
38
+ /**
39
+ * Build the state port the debug service records into. Defaults to
40
+ * `new FileStatePort(workspace, { cwd })` — a real server MUST pass `cwd`
41
+ * through, because that is the only thing that makes `record()` drop the
42
+ * config-independent live pointer `status`/`stop` resolve the workspace
43
+ * from after a config edit (see `live-pointer.ts`). A test seam so that
44
+ * can be pinned without a full `start_debug` run.
45
+ */
46
+ createStatePort?: (workspace: WorkspacePaths, opts: {
47
+ cwd?: string;
48
+ }) => StatePort;
49
+ }
50
+ /** What a successful boot hands back. */
51
+ export interface BootResult {
52
+ /** The live MCP server. */
53
+ server: McpServer;
54
+ /** Remove the signal handlers this boot installed (test seam). */
55
+ dispose: () => void;
56
+ }
57
+ /**
58
+ * Boot the stdio MCP server for `cwd`.
59
+ *
60
+ * The owner-lock backend gate runs FIRST — a host that cannot lock the
61
+ * workspace must not get one. Everything after it is the wiring moved out of
62
+ * `main.ts`.
63
+ */
64
+ export declare function bootServer(cwd: string, deps?: BootDeps): Promise<BootResult>;