@developerz.ai/ui-debugger-mcp 1.9.0 → 1.10.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 (201) hide show
  1. package/README.md +56 -44
  2. package/dist/adapters/android/adb.d.ts +19 -7
  3. package/dist/adapters/android/adb.js +50 -13
  4. package/dist/adapters/android/adb.js.map +1 -1
  5. package/dist/adapters/android/android-adapter.d.ts +42 -2
  6. package/dist/adapters/android/android-adapter.js +366 -36
  7. package/dist/adapters/android/android-adapter.js.map +1 -1
  8. package/dist/adapters/android/commands.js.map +1 -1
  9. package/dist/adapters/android/ports.js.map +1 -1
  10. package/dist/adapters/android/sdk.d.ts +65 -0
  11. package/dist/adapters/android/sdk.js +107 -0
  12. package/dist/adapters/android/sdk.js.map +1 -0
  13. package/dist/adapters/android/uiautomator.d.ts +23 -7
  14. package/dist/adapters/android/uiautomator.js +31 -7
  15. package/dist/adapters/android/uiautomator.js.map +1 -1
  16. package/dist/adapters/availability.d.ts +39 -0
  17. package/dist/adapters/availability.js +62 -0
  18. package/dist/adapters/availability.js.map +1 -0
  19. package/dist/adapters/browser/browser-adapter.d.ts +11 -22
  20. package/dist/adapters/browser/browser-adapter.js +98 -67
  21. package/dist/adapters/browser/browser-adapter.js.map +1 -1
  22. package/dist/adapters/browser/cdp.d.ts +15 -7
  23. package/dist/adapters/browser/cdp.js +25 -3
  24. package/dist/adapters/browser/cdp.js.map +1 -1
  25. package/dist/adapters/browser/filters.d.ts +1 -1
  26. package/dist/adapters/browser/filters.js.map +1 -1
  27. package/dist/adapters/browser/geometry.js.map +1 -1
  28. package/dist/adapters/browser/launch.d.ts +14 -5
  29. package/dist/adapters/browser/launch.js +14 -5
  30. package/dist/adapters/browser/launch.js.map +1 -1
  31. package/dist/adapters/browser/lifecycle.d.ts +58 -0
  32. package/dist/adapters/browser/lifecycle.js +98 -0
  33. package/dist/adapters/browser/lifecycle.js.map +1 -0
  34. package/dist/adapters/browser/log-filters.d.ts +2 -2
  35. package/dist/adapters/browser/log-filters.js.map +1 -1
  36. package/dist/adapters/browser/log-format.d.ts +14 -23
  37. package/dist/adapters/browser/log-format.js +16 -55
  38. package/dist/adapters/browser/log-format.js.map +1 -1
  39. package/dist/adapters/browser/tab-context.d.ts +30 -0
  40. package/dist/adapters/browser/tab-context.js +41 -0
  41. package/dist/adapters/browser/tab-context.js.map +1 -0
  42. package/dist/adapters/contract.d.ts +91 -5
  43. package/dist/adapters/contract.js +7 -2
  44. package/dist/adapters/contract.js.map +1 -1
  45. package/dist/adapters/desktop/atspi-busctl.d.ts +26 -0
  46. package/dist/adapters/desktop/atspi-busctl.js +330 -0
  47. package/dist/adapters/desktop/atspi-busctl.js.map +1 -0
  48. package/dist/adapters/desktop/atspi-parse.d.ts +39 -0
  49. package/dist/adapters/desktop/atspi-parse.js +155 -0
  50. package/dist/adapters/desktop/atspi-parse.js.map +1 -0
  51. package/dist/adapters/desktop/atspi.d.ts +75 -50
  52. package/dist/adapters/desktop/atspi.js +64 -285
  53. package/dist/adapters/desktop/atspi.js.map +1 -1
  54. package/dist/adapters/desktop/capture.d.ts +11 -20
  55. package/dist/adapters/desktop/capture.js +68 -37
  56. package/dist/adapters/desktop/capture.js.map +1 -1
  57. package/dist/adapters/desktop/desktop-adapter.d.ts +20 -2
  58. package/dist/adapters/desktop/desktop-adapter.js +91 -9
  59. package/dist/adapters/desktop/desktop-adapter.js.map +1 -1
  60. package/dist/adapters/desktop/input.d.ts +18 -4
  61. package/dist/adapters/desktop/input.js +15 -10
  62. package/dist/adapters/desktop/input.js.map +1 -1
  63. package/dist/adapters/desktop/proc.d.ts +32 -4
  64. package/dist/adapters/desktop/proc.js +33 -6
  65. package/dist/adapters/desktop/proc.js.map +1 -1
  66. package/dist/adapters/factory.d.ts +12 -5
  67. package/dist/adapters/factory.js +29 -3
  68. package/dist/adapters/factory.js.map +1 -1
  69. package/dist/adapters/log-format.d.ts +32 -0
  70. package/dist/adapters/log-format.js +39 -0
  71. package/dist/adapters/log-format.js.map +1 -0
  72. package/dist/agent/belt/act.d.ts +421 -21
  73. package/dist/agent/belt/act.js +4 -4
  74. package/dist/agent/belt/act.js.map +1 -1
  75. package/dist/agent/belt/look.d.ts +471 -14
  76. package/dist/agent/belt/look.js +74 -12
  77. package/dist/agent/belt/look.js.map +1 -1
  78. package/dist/agent/belt/observe.d.ts +663 -42
  79. package/dist/agent/belt/observe.js +76 -12
  80. package/dist/agent/belt/observe.js.map +1 -1
  81. package/dist/agent/belt/report.d.ts +754 -48
  82. package/dist/agent/belt/report.js +121 -38
  83. package/dist/agent/belt/report.js.map +1 -1
  84. package/dist/agent/belt/trail.d.ts +44 -16
  85. package/dist/agent/belt/trail.js +46 -11
  86. package/dist/agent/belt/trail.js.map +1 -1
  87. package/dist/agent/capabilities.js.map +1 -1
  88. package/dist/agent/fallback.d.ts +33 -0
  89. package/dist/agent/fallback.js +84 -0
  90. package/dist/agent/fallback.js.map +1 -0
  91. package/dist/agent/loop.d.ts +54 -52
  92. package/dist/agent/loop.js +173 -176
  93. package/dist/agent/loop.js.map +1 -1
  94. package/dist/agent/models.d.ts +10 -6
  95. package/dist/agent/models.js +15 -9
  96. package/dist/agent/models.js.map +1 -1
  97. package/dist/agent/prompts/compose.d.ts +1 -1
  98. package/dist/agent/prompts/debug-agent.js +45 -8
  99. package/dist/agent/prompts/debug-agent.js.map +1 -1
  100. package/dist/agent/prompts/web-addendum.d.ts +1 -1
  101. package/dist/agent/prompts/web-addendum.js +15 -3
  102. package/dist/agent/prompts/web-addendum.js.map +1 -1
  103. package/dist/agent/provider.d.ts +38 -0
  104. package/dist/agent/provider.js +55 -3
  105. package/dist/agent/provider.js.map +1 -1
  106. package/dist/boot.d.ts +64 -0
  107. package/dist/boot.js +145 -0
  108. package/dist/boot.js.map +1 -0
  109. package/dist/cli/chromium-libs.d.ts +262 -0
  110. package/dist/cli/chromium-libs.js +522 -0
  111. package/dist/cli/chromium-libs.js.map +1 -0
  112. package/dist/cli/control.js +51 -9
  113. package/dist/cli/control.js.map +1 -1
  114. package/dist/cli/init.d.ts +52 -3
  115. package/dist/cli/init.js +62 -10
  116. package/dist/cli/init.js.map +1 -1
  117. package/dist/config/load.d.ts +25 -8
  118. package/dist/config/load.js +40 -13
  119. package/dist/config/load.js.map +1 -1
  120. package/dist/config/schema.d.ts +18 -6
  121. package/dist/config/schema.js +22 -7
  122. package/dist/config/schema.js.map +1 -1
  123. package/dist/errors.d.ts +14 -0
  124. package/dist/errors.js +18 -0
  125. package/dist/errors.js.map +1 -1
  126. package/dist/findings/schema.d.ts +44 -6
  127. package/dist/findings/schema.js +39 -3
  128. package/dist/findings/schema.js.map +1 -1
  129. package/dist/index.d.ts +1 -1
  130. package/dist/index.js +1 -1
  131. package/dist/index.js.map +1 -1
  132. package/dist/main.js +4 -82
  133. package/dist/main.js.map +1 -1
  134. package/dist/mcp/server.js.map +1 -1
  135. package/dist/mcp/tools/describe.d.ts +5 -4
  136. package/dist/mcp/tools/describe.js +14 -10
  137. package/dist/mcp/tools/describe.js.map +1 -1
  138. package/dist/mcp/tools/end-session.d.ts +3 -1
  139. package/dist/mcp/tools/end-session.js +7 -3
  140. package/dist/mcp/tools/end-session.js.map +1 -1
  141. package/dist/mcp/tools/output.d.ts +5 -4
  142. package/dist/mcp/tools/output.js +10 -2
  143. package/dist/mcp/tools/output.js.map +1 -1
  144. package/dist/mcp/tools/result.d.ts +10 -1
  145. package/dist/mcp/tools/result.js +8 -6
  146. package/dist/mcp/tools/result.js.map +1 -1
  147. package/dist/mcp/tools/start-debug.js +7 -5
  148. package/dist/mcp/tools/start-debug.js.map +1 -1
  149. package/dist/redact.d.ts +28 -0
  150. package/dist/redact.js +51 -0
  151. package/dist/redact.js.map +1 -0
  152. package/dist/services/catalog.d.ts +28 -0
  153. package/dist/services/catalog.js +65 -0
  154. package/dist/services/catalog.js.map +1 -0
  155. package/dist/services/debug-api.d.ts +172 -0
  156. package/dist/services/debug-api.js +9 -0
  157. package/dist/services/debug-api.js.map +1 -0
  158. package/dist/services/debug-service.d.ts +25 -173
  159. package/dist/services/debug-service.js +108 -175
  160. package/dist/services/debug-service.js.map +1 -1
  161. package/dist/services/login.d.ts +7 -2
  162. package/dist/services/login.js +203 -29
  163. package/dist/services/login.js.map +1 -1
  164. package/dist/services/retained-snapshot.d.ts +36 -0
  165. package/dist/services/retained-snapshot.js +63 -0
  166. package/dist/services/retained-snapshot.js.map +1 -0
  167. package/dist/services/session-builder.d.ts +26 -0
  168. package/dist/services/session-builder.js +46 -19
  169. package/dist/services/session-builder.js.map +1 -1
  170. package/dist/services/start-guards.d.ts +32 -0
  171. package/dist/services/start-guards.js +50 -0
  172. package/dist/services/start-guards.js.map +1 -0
  173. package/dist/services/summarize.d.ts +12 -3
  174. package/dist/services/summarize.js +13 -5
  175. package/dist/services/summarize.js.map +1 -1
  176. package/dist/session/cleanup.js.map +1 -1
  177. package/dist/session/findings-store.d.ts +2 -1
  178. package/dist/session/findings-store.js +30 -2
  179. package/dist/session/findings-store.js.map +1 -1
  180. package/dist/session/live-pointer.d.ts +19 -0
  181. package/dist/session/live-pointer.js +41 -0
  182. package/dist/session/live-pointer.js.map +1 -0
  183. package/dist/session/manager.d.ts +11 -1
  184. package/dist/session/manager.js +46 -2
  185. package/dist/session/manager.js.map +1 -1
  186. package/dist/session/owner-lock.d.ts +208 -0
  187. package/dist/session/owner-lock.js +499 -0
  188. package/dist/session/owner-lock.js.map +1 -0
  189. package/dist/session/process-identity.js.map +1 -1
  190. package/dist/session/session.js +61 -7
  191. package/dist/session/session.js.map +1 -1
  192. package/dist/session/state-file.d.ts +74 -14
  193. package/dist/session/state-file.js +203 -21
  194. package/dist/session/state-file.js.map +1 -1
  195. package/package.json +7 -7
  196. package/dist/adapters/android/android-adapter.test-helpers.d.ts +0 -52
  197. package/dist/adapters/android/android-adapter.test-helpers.js +0 -115
  198. package/dist/adapters/android/android-adapter.test-helpers.js.map +0 -1
  199. package/dist/mcp/server.test-helpers.d.ts +0 -23
  200. package/dist/mcp/server.test-helpers.js +0 -49
  201. 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,OAAO,EAAyC,WAAW,EAAa,aAAa,EAAE,MAAM,IAAI,CAAC;AAClG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEpC,kGAAkG;AAClG,MAAM,CAAC,MAAM,cAAc,GACzB,qGAAqG,CAAC;AAsCxG;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,MAAM,EAAE,CAAC;SACN,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;QACjB,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KAC5C,CAAC,CACH;SACA,OAAO,CAAC,EAAE,CAAC;CACf,CAAC,CAAC;AAEH,oFAAoF;AACpF,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;SACzF,OAAO,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KAAK,IAAI,cAAc,EAAE,OAAO,CAAC,CAAC;YACzE,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;gBACvC,OAAO,GAAG;oBACR,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;iBACxB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAYD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAA4B;IACvD,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,GAAG,cAAc,EAAE,GAAG,OAAO,CAAC;IAChE,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AAC7E,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,6 +25,16 @@ 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 = {
@@ -32,6 +43,19 @@ const SELF_LOOK_MODE = {
32
43
  // `pruneStaleFrames` (agent/loop.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
@@ -84,11 +108,12 @@ Replace instead — pass \`clear: true\`:
84
108
  Use \`clear\` whenever the field may be non-empty — a retry, a second item through
85
109
  the same form, any field you have not just read as empty.
86
110
 
87
- ## Budget — an unreported run produces NOTHING
111
+ ## Budget — spending it all still costs the verdict
88
112
 
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.
113
+ Steps are limited. Spend them all without calling \`report\` and the run ends with
114
+ NO verdict. What is lost is the conclusion, not the evidence: whatever you streamed
115
+ along the way ${mode.streamed}
116
+ Worse than a partial report, far worse than a failed verdict.
92
117
 
93
118
  - Load-bearing checks first. The goal will take longer than you think.
94
119
  - Warned the budget is nearly spent → STOP exploring, \`report\` what you have.
@@ -149,12 +174,21 @@ beats a long one padded with noise.
149
174
 
150
175
  ## Visual findings
151
176
 
152
- \`{ issue: "what", where: "which component/area", severity: "low|medium|high", screenshot?: "path" }\`
177
+ \`{ issue: "what", where: "which component/area", severity: "${VISUAL_SEVERITIES.join('|')}", screenshot?: "path" }\`
153
178
 
154
179
  - \`high\` — broken layout, text overlap, invisible interactive elements.
155
180
  - \`medium\` — misalignment, bad spacing, contrast issue.
156
181
  - \`low\` — polish (rounding, colour shade, icon size).
157
182
 
183
+ ### Visual inspection checklist
184
+
185
+ Use \`look\` for these checks (ask it explicitly in separate-eye mode):
186
+ - Inspect text overlapping neighboring elements.
187
+ - Inspect borders striking through text.
188
+ - On table-heavy pages, inspect table-column boundaries for text crossing into adjacent columns.
189
+ Report only what the screenshot supports, with the affected area and screenshot path.
190
+ If unclear or not inspected, say uncertain or unverified — never claim it passed.
191
+
158
192
  ## Verdict
159
193
 
160
194
  With \`criteria\`: \`status:"passed"\` only when ALL pass; any failure → \`"failed"\`.
@@ -167,14 +201,17 @@ Goal complete (or step limit hit) → call \`report\` exactly once:
167
201
 
168
202
  \`\`\`json
169
203
  {
170
- "status": "passed" | "failed",
204
+ "status": ${TERMINAL_STATUSES.map((s) => `"${s}"`).join(' | ')},
171
205
  "steps": [ { "step": "...", "ok": true, "note": "...", "screenshot": "..." } ],
172
- "bugs": [ { "kind": "console"|"network"|"flow", "detail": "...", "evidence": "..." } ],
173
- "visual": [ { "issue": "...", "where": "...", "severity": "low"|"medium"|"high", "screenshot": "..." } ],
206
+ "bugs": [ { "kind": ${BUG_KINDS.map((k) => `"${k}"`).join('|')}, "detail": "...", "evidence": "..." } ],
207
+ "visual": [ { "issue": "...", "where": "...", "severity": ${VISUAL_SEVERITIES.map((s) => `"${s}"`).join('|')}, "screenshot": "..." } ],
208
+ "dismissStreamed": false,
174
209
  "summary": "One-paragraph verdict the smart agent can act on."
175
210
  }
176
211
  \`\`\`
177
212
 
213
+ ${mode.carried}
214
+
178
215
  NEVER stop before \`report\`. NEVER call it twice. The summary is for the smart
179
216
  agent — make it actionable: what broke, where, what to fix.
180
217
  `;
@@ -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;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;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;;;;;;;;;;;;;;;;gBAgBvD,IAAI,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+DA8DkC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2B5E,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;;0BAEtC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,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"}
@@ -6,4 +6,4 @@
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 \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- 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\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`, `id`, `url`, `title`, `active`, `visible`). `active` means the controlled\npage; `visible` measures live document visibility, NOT OS-window focus. Attachment\nadopts a page without foregrounding it, so an active page can be hidden.\nA 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 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` is the tab\n(`tab-1`, `tab-2`, \u2026) and follows the PAGE for the whole run, so it survives the\nshift. A console or network row carries that same label as `tab`: a row with\n`tab:\"tab-2\"` came from the tab whose `id` is `tab-2`. To drive that tab, find\nits `id` in the CURRENT `tabs` listing and switch to that entry's `index` \u2014 the\nlabel is NOT an index, and `switch_tab` rejects it.\n\nSwitch back the same way when the popup flow is done.\n";
@@ -87,6 +87,7 @@ text (plain text resolves) or \`role "name"\`. Avoid XPath and positional CSS.
87
87
  - \`observe({kind:"console", filters:{level_eq:"error"}})\` — just JS errors.
88
88
  - \`observe({kind:"network", filters:{status_gte:400}})\` — just failed requests.
89
89
  - \`limit\` caps rows when you need only the latest few.
90
+ - Every row carries \`tab\` — the id of the tab it came from (see Tabs).
90
91
 
91
92
  Check both after actions that plausibly error (submits, navigations, API calls) —
92
93
  not mechanically after every \`act\`. Record what you find as \`console\`/\`network\`
@@ -124,13 +125,24 @@ on a node you can see → check for \`frame\`, and prefer clicking the node obje
124
125
  ### Tabs — a click can open one
125
126
 
126
127
  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
+ (\`index\`, \`id\`, \`url\`, \`title\`, \`active\`, \`visible\`). \`active\` means the controlled
129
+ page; \`visible\` measures live document visibility, NOT OS-window focus. Attachment
130
+ adopts a page without foregrounding it, so an active page can be hidden.
131
+ A click on an external link, an OAuth button
128
132
  or \`target="_blank"\` opens a new tab and **you stay on the old one** — a click that
129
133
  seems to have done nothing means check \`tabs\` before calling the button broken.
130
134
 
131
135
  - \`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.
136
+ - \`act({action:"switch_tab", target:"1"})\` — drive the tab at index 1 from now on
137
+ and explicitly bring it forward. Console and network capture follow you; the
138
+ previous tab's records are kept.
139
+
140
+ \`index\` is a POSITION — it shifts when an earlier tab closes. \`id\` is the tab
141
+ (\`tab-1\`, \`tab-2\`, …) and follows the PAGE for the whole run, so it survives the
142
+ shift. A console or network row carries that same label as \`tab\`: a row with
143
+ \`tab:"tab-2"\` came from the tab whose \`id\` is \`tab-2\`. To drive that tab, find
144
+ its \`id\` in the CURRENT \`tabs\` listing and switch to that entry's \`index\` — the
145
+ label is NOT an index, and \`switch_tab\` rejects it.
134
146
 
135
147
  Switch back the same way when the popup flow is done.
136
148
  `;
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2IlC,CAAC"}
@@ -3,10 +3,48 @@
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;
@@ -5,6 +5,58 @@
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;
@@ -13,9 +65,9 @@ const DEFAULT_BASE_URL = 'https://openrouter.ai/api/v1';
13
65
  * Throws ProviderError if no API key is found or if it's empty.
14
66
  */
15
67
  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.');
68
+ const apiKey = resolveProviderApiKey(options.apiKey);
69
+ if (!apiKey) {
70
+ throw new ProviderError(providerApiKeyGuidance());
19
71
  }
20
72
  const baseURL = options.baseURL || process.env.OPENAI_BASE_URL || DEFAULT_BASE_URL;
21
73
  return { apiKey, baseURL };
@@ -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,8BA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E,MAAM,EAAE,OAAO,EAAE,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC3D,OAAO,gBAAgB,CAAC;QACtB,MAAM;QACN,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>;