@andorra-labs/code 0.1.17 → 0.1.19

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 (313) hide show
  1. package/dist/src/account-jev-savings.d.ts +4 -0
  2. package/dist/src/account-jev-savings.js +92 -0
  3. package/dist/src/acp-agent.js +2 -2
  4. package/dist/src/agent-execution.js +441 -53
  5. package/dist/src/agent-mcp.js +7 -1
  6. package/dist/src/agent-modifiers.js +5 -7
  7. package/dist/src/analytics.d.ts +19 -1
  8. package/dist/src/analytics.js +9 -1
  9. package/dist/src/andorra/entry.js +15 -6
  10. package/dist/src/andorra/errors.js +3 -0
  11. package/dist/src/andorra/hosted.d.ts +8 -0
  12. package/dist/src/andorra/hosted.js +22 -3
  13. package/dist/src/andorra/streams.d.ts +49 -0
  14. package/dist/src/andorra/streams.js +98 -0
  15. package/dist/src/antigravity-acp.d.ts +28 -0
  16. package/dist/src/antigravity-acp.js +150 -0
  17. package/dist/src/antigravity-terminal.d.ts +2 -0
  18. package/dist/src/antigravity-terminal.js +214 -0
  19. package/dist/src/app-server/adaptive-routing-settings.d.ts +37 -0
  20. package/dist/src/app-server/adaptive-routing-settings.js +69 -0
  21. package/dist/src/app-server/artifact.d.ts +14 -0
  22. package/dist/src/app-server/artifact.js +46 -0
  23. package/dist/src/app-server/legal-protocol.d.ts +33 -0
  24. package/dist/src/app-server/legal-protocol.js +16 -0
  25. package/dist/src/app-server/protocol.d.ts +34 -3
  26. package/dist/src/app-server/protocol.js +3 -1
  27. package/dist/src/app-server/telemetry-protocol.d.ts +53 -0
  28. package/dist/src/app-server/telemetry-protocol.js +2 -0
  29. package/dist/src/app-server/telemetry.d.ts +38 -0
  30. package/dist/src/app-server/telemetry.js +163 -0
  31. package/dist/src/app-server/workspace.d.ts +21 -0
  32. package/dist/src/app-server/workspace.js +192 -10
  33. package/dist/src/app-server.d.ts +82 -26
  34. package/dist/src/app-server.js +1573 -417
  35. package/dist/src/attachments.d.ts +10 -0
  36. package/dist/src/attachments.js +102 -7
  37. package/dist/src/auth/AuthManager.d.ts +11 -2
  38. package/dist/src/auth/AuthManager.js +56 -13
  39. package/dist/src/auth/index.d.ts +5 -1
  40. package/dist/src/auth/index.js +8 -1
  41. package/dist/src/auth/lifecycle.d.ts +13 -0
  42. package/dist/src/auth/lifecycle.js +109 -0
  43. package/dist/src/auth/store.d.ts +1 -0
  44. package/dist/src/auth/store.js +12 -0
  45. package/dist/src/auth/types.d.ts +12 -0
  46. package/dist/src/automation-runner.js +2 -0
  47. package/dist/src/automation-service.js +7 -2
  48. package/dist/src/automation-tool.js +2 -1
  49. package/dist/src/benchmark-scores.d.ts +88 -0
  50. package/dist/src/benchmark-scores.js +302 -0
  51. package/dist/src/bridge/command.js +16 -1
  52. package/dist/src/bridge/control.d.ts +3 -1
  53. package/dist/src/bridge/control.js +9 -3
  54. package/dist/src/bridge/engines.d.ts +2 -0
  55. package/dist/src/bridge/engines.js +9 -0
  56. package/dist/src/bridge/github.d.ts +108 -0
  57. package/dist/src/bridge/github.js +378 -0
  58. package/dist/src/bridge/host-ops.d.ts +3 -3
  59. package/dist/src/bridge/host-ops.js +14 -2
  60. package/dist/src/bridge/host.d.ts +2 -0
  61. package/dist/src/bridge/host.js +70 -16
  62. package/dist/src/bridge/protocol.d.ts +1 -0
  63. package/dist/src/bridge/protocol.js +1 -0
  64. package/dist/src/browser-panel-tool.d.ts +12 -0
  65. package/dist/src/browser-panel-tool.js +30 -3
  66. package/dist/src/browser-runner.js +53 -62
  67. package/dist/src/browser-server.js +10 -4
  68. package/dist/src/browser-session.d.ts +14 -0
  69. package/dist/src/browser-session.js +57 -12
  70. package/dist/src/browser-view.d.ts +40 -1
  71. package/dist/src/browser-view.js +163 -9
  72. package/dist/src/browser-window-style.d.ts +27 -0
  73. package/dist/src/browser-window-style.js +244 -0
  74. package/dist/src/bug-report-attachments.d.ts +48 -0
  75. package/dist/src/bug-report-attachments.js +327 -0
  76. package/dist/src/bug-report.d.ts +23 -3
  77. package/dist/src/bug-report.js +72 -9
  78. package/dist/src/claude-provider.d.ts +1 -0
  79. package/dist/src/claude-provider.js +77 -36
  80. package/dist/src/cli.d.ts +1 -3
  81. package/dist/src/cli.js +245 -62
  82. package/dist/src/codex-provider.d.ts +1 -0
  83. package/dist/src/codex-provider.js +44 -8
  84. package/dist/src/coding-tools.d.ts +1 -0
  85. package/dist/src/coding-tools.js +28 -7
  86. package/dist/src/command-screens.d.ts +1 -1
  87. package/dist/src/command-screens.js +2 -2
  88. package/dist/src/commands.d.ts +9 -2
  89. package/dist/src/commands.js +69 -64
  90. package/dist/src/completion.js +13 -7
  91. package/dist/src/config.d.ts +14 -3
  92. package/dist/src/config.js +57 -17
  93. package/dist/src/context-budget.d.ts +11 -2
  94. package/dist/src/context-budget.js +38 -4
  95. package/dist/src/context-compaction.d.ts +10 -8
  96. package/dist/src/context-compaction.js +23 -24
  97. package/dist/src/deadline.js +1 -1
  98. package/dist/src/decision/DecisionEngine.d.ts +2 -0
  99. package/dist/src/decision/DecisionManager.d.ts +16 -0
  100. package/dist/src/decision/DecisionManager.js +75 -2
  101. package/dist/src/decision/applyTaskKind.d.ts +8 -0
  102. package/dist/src/decision/applyTaskKind.js +53 -0
  103. package/dist/src/decision/applyToolMenu.js +6 -2
  104. package/dist/src/decision/hostedPolicy.js +6 -3
  105. package/dist/src/decision/optimizationPolicy.d.ts +10 -0
  106. package/dist/src/decision/optimizationPolicy.js +23 -3
  107. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +4 -1
  108. package/dist/src/decision/providers/AndorraDecisionProvider.js +29 -7
  109. package/dist/src/decision/providers/index.js +1 -1
  110. package/dist/src/decision/taskKind.d.ts +52 -0
  111. package/dist/src/decision/taskKind.js +76 -0
  112. package/dist/src/decision/toolFamilies.js +1 -1
  113. package/dist/src/decision/types.d.ts +3 -1
  114. package/dist/src/default-graph.js +1 -1
  115. package/dist/src/efficiency.d.ts +80 -1
  116. package/dist/src/efficiency.js +119 -4
  117. package/dist/src/effort-routing.d.ts +27 -0
  118. package/dist/src/effort-routing.js +34 -0
  119. package/dist/src/evidence.d.ts +110 -0
  120. package/dist/src/evidence.js +195 -0
  121. package/dist/src/extensions.d.ts +2 -0
  122. package/dist/src/extensions.js +30 -20
  123. package/dist/src/github-app/agent-writes.d.ts +1 -1
  124. package/dist/src/github-app/agent-writes.js +1 -1
  125. package/dist/src/github-app/client.d.ts +19 -0
  126. package/dist/src/github-app/client.js +21 -1
  127. package/dist/src/github-app/event-source.d.ts +0 -5
  128. package/dist/src/github-app/event-source.js +1 -31
  129. package/dist/src/github-app/metrics.d.ts +2 -5
  130. package/dist/src/github-app/metrics.js +2 -14
  131. package/dist/src/github-app/review-loop.d.ts +5 -5
  132. package/dist/src/github-app/review-loop.js +1 -1
  133. package/dist/src/github-app/review-node.d.ts +2 -2
  134. package/dist/src/github-app/triggers.d.ts +3 -3
  135. package/dist/src/github-names.d.ts +7 -0
  136. package/dist/src/github-names.js +7 -0
  137. package/dist/src/glob-search.d.ts +1 -0
  138. package/dist/src/glob-search.js +3 -0
  139. package/dist/src/google-provider.d.ts +5 -28
  140. package/dist/src/google-provider.js +6 -141
  141. package/dist/src/graph-editor-session.d.ts +1 -0
  142. package/dist/src/graph-editor-session.js +2 -0
  143. package/dist/src/graph-health.js +3 -1
  144. package/dist/src/graph-preview.d.ts +2 -0
  145. package/dist/src/graph-preview.js +1 -0
  146. package/dist/src/graph-runner.js +20 -14
  147. package/dist/src/graph-selection.d.ts +3 -1
  148. package/dist/src/graph-selection.js +2 -2
  149. package/dist/src/graph-server.d.ts +8 -1
  150. package/dist/src/graph-server.js +49 -12
  151. package/dist/src/graph-sync.d.ts +2 -1
  152. package/dist/src/graph-sync.js +13 -0
  153. package/dist/src/graph-ui/app.js +49 -8
  154. package/dist/src/graph-ui/index.html +1 -1
  155. package/dist/src/graphs.d.ts +23 -1
  156. package/dist/src/graphs.js +58 -7
  157. package/dist/src/grok-provider.js +17 -14
  158. package/dist/src/hardened-runtime.js +39 -25
  159. package/dist/src/jev-savings.d.ts +4 -0
  160. package/dist/src/jev-savings.js +13 -0
  161. package/dist/src/legal/client.d.ts +25 -0
  162. package/dist/src/legal/client.js +47 -0
  163. package/dist/src/legal/command.d.ts +13 -0
  164. package/dist/src/legal/command.js +98 -0
  165. package/dist/src/legal/documents.d.ts +2 -0
  166. package/dist/src/legal/documents.js +14 -0
  167. package/dist/src/legal/gate.d.ts +13 -0
  168. package/dist/src/legal/gate.js +96 -0
  169. package/dist/src/legal/manifest.d.ts +21 -0
  170. package/dist/src/legal/manifest.js +23 -0
  171. package/dist/src/legal/receipt.d.ts +13 -0
  172. package/dist/src/legal/receipt.js +137 -0
  173. package/dist/src/legal/release.d.ts +27 -0
  174. package/dist/src/legal/release.js +28 -0
  175. package/dist/src/managed-sign-in.d.ts +0 -1
  176. package/dist/src/managed-sign-in.js +0 -13
  177. package/dist/src/membership.d.ts +27 -1
  178. package/dist/src/membership.js +139 -7
  179. package/dist/src/model-health-cache.js +1 -1
  180. package/dist/src/model-metadata.js +3 -7
  181. package/dist/src/model-override.d.ts +2 -1
  182. package/dist/src/model-override.js +9 -0
  183. package/dist/src/model-pool.d.ts +99 -0
  184. package/dist/src/model-pool.js +136 -0
  185. package/dist/src/model-relay/local.js +5 -0
  186. package/dist/src/model-relay/remote.d.ts +2 -0
  187. package/dist/src/model-relay/remote.js +4 -0
  188. package/dist/src/model-tiers.d.ts +16 -1
  189. package/dist/src/model-tiers.js +31 -7
  190. package/dist/src/opencode-cli-provider.js +59 -56
  191. package/dist/src/opencode-provider.js +16 -13
  192. package/dist/src/permissions.d.ts +5 -0
  193. package/dist/src/permissions.js +7 -0
  194. package/dist/src/plan-pass.js +2 -1
  195. package/dist/src/pool-scores.d.ts +45 -0
  196. package/dist/src/pool-scores.js +40 -0
  197. package/dist/src/provider-connection.js +3 -17
  198. package/dist/src/provider-engine.d.ts +13 -1
  199. package/dist/src/provider-engine.js +116 -12
  200. package/dist/src/provider-request-error.d.ts +8 -0
  201. package/dist/src/provider-request-error.js +12 -0
  202. package/dist/src/provider-settings.d.ts +1 -1
  203. package/dist/src/provider-settings.js +36 -18
  204. package/dist/src/provider-turn-deadline.d.ts +39 -0
  205. package/dist/src/provider-turn-deadline.js +139 -0
  206. package/dist/src/providers.d.ts +8 -9
  207. package/dist/src/providers.js +211 -150
  208. package/dist/src/pull-request-merge.d.ts +1 -8
  209. package/dist/src/pull-request-merge.js +0 -4
  210. package/dist/src/pull-requests.d.ts +83 -57
  211. package/dist/src/pull-requests.js +266 -225
  212. package/dist/src/qa/runtime/ProcessManager.d.ts +5 -1
  213. package/dist/src/qa/runtime/ProcessManager.js +9 -3
  214. package/dist/src/react-runtime.js +245 -71
  215. package/dist/src/reasoning-probe-cloud.d.ts +10 -0
  216. package/dist/src/reasoning-probe-cloud.js +209 -0
  217. package/dist/src/remote/engine-pool.d.ts +3 -0
  218. package/dist/src/remote/engine-pool.js +88 -21
  219. package/dist/src/remote/recovery.d.ts +6 -0
  220. package/dist/src/remote/recovery.js +37 -0
  221. package/dist/src/run-records.d.ts +13 -3
  222. package/dist/src/run-records.js +59 -34
  223. package/dist/src/runtime.d.ts +47 -2
  224. package/dist/src/runtime.js +33 -7
  225. package/dist/src/session-summary.d.ts +8 -0
  226. package/dist/src/session-summary.js +34 -0
  227. package/dist/src/sessions.d.ts +32 -0
  228. package/dist/src/sessions.js +65 -3
  229. package/dist/src/shell.js +6 -0
  230. package/dist/src/side-panel.js +36 -2
  231. package/dist/src/sign-in-detection.d.ts +1 -1
  232. package/dist/src/sign-in-detection.js +4 -10
  233. package/dist/src/sign-in-offer.js +1 -1
  234. package/dist/src/skill-commands.js +1 -1
  235. package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
  236. package/dist/src/skills/bundled/graph-manager/SKILL.md +2 -2
  237. package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
  238. package/dist/src/skills/bundled/provenance.json +3 -3
  239. package/dist/src/subagent-run.js +50 -50
  240. package/dist/src/subscription-usage.d.ts +50 -0
  241. package/dist/src/subscription-usage.js +92 -0
  242. package/dist/src/task-checkout.d.ts +157 -0
  243. package/dist/src/task-checkout.js +628 -0
  244. package/dist/src/telemetry/access.d.ts +18 -0
  245. package/dist/src/telemetry/access.js +43 -0
  246. package/dist/src/telemetry/aggregate.d.ts +18 -2
  247. package/dist/src/telemetry/aggregate.js +22 -9
  248. package/dist/src/telemetry/capture-core.d.ts +33 -14
  249. package/dist/src/telemetry/capture-core.js +124 -25
  250. package/dist/src/telemetry/capture.d.ts +3 -2
  251. package/dist/src/telemetry/capture.js +21 -1
  252. package/dist/src/telemetry/decision-capture.js +4 -0
  253. package/dist/src/telemetry/emitter.d.ts +6 -7
  254. package/dist/src/telemetry/emitter.js +124 -29
  255. package/dist/src/telemetry/gate.d.ts +41 -2
  256. package/dist/src/telemetry/gate.js +89 -4
  257. package/dist/src/telemetry/home.d.ts +1 -0
  258. package/dist/src/telemetry/home.js +20 -0
  259. package/dist/src/telemetry/identity.d.ts +6 -3
  260. package/dist/src/telemetry/identity.js +19 -6
  261. package/dist/src/telemetry/lifecycle.d.ts +8 -0
  262. package/dist/src/telemetry/lifecycle.js +76 -0
  263. package/dist/src/telemetry/outbox.d.ts +13 -8
  264. package/dist/src/telemetry/outbox.js +68 -12
  265. package/dist/src/telemetry/permission-command.d.ts +38 -0
  266. package/dist/src/telemetry/permission-command.js +208 -0
  267. package/dist/src/telemetry/permission.d.ts +168 -0
  268. package/dist/src/telemetry/permission.js +662 -0
  269. package/dist/src/telemetry/record-installation.d.ts +1 -0
  270. package/dist/src/telemetry/record-installation.js +9 -0
  271. package/dist/src/telemetry/region-data.d.ts +12 -0
  272. package/dist/src/telemetry/region-data.js +1314 -0
  273. package/dist/src/telemetry/region.d.ts +34 -0
  274. package/dist/src/telemetry/region.js +87 -0
  275. package/dist/src/telemetry/run-privacy.d.ts +11 -0
  276. package/dist/src/telemetry/run-privacy.js +165 -0
  277. package/dist/src/telemetry/schema.d.ts +27 -6
  278. package/dist/src/telemetry/schema.js +109 -14
  279. package/dist/src/telemetry/state.d.ts +11 -7
  280. package/dist/src/telemetry/state.js +39 -6
  281. package/dist/src/telemetry/surface.d.ts +20 -3
  282. package/dist/src/telemetry/surface.js +71 -15
  283. package/dist/src/telemetry/uploader.d.ts +6 -11
  284. package/dist/src/telemetry/uploader.js +72 -46
  285. package/dist/src/telemetry/uploads.d.ts +5 -1
  286. package/dist/src/telemetry/uploads.js +25 -6
  287. package/dist/src/telemetry/version.d.ts +5 -0
  288. package/dist/src/telemetry/version.js +34 -0
  289. package/dist/src/telemetry/workspace.d.ts +4 -1
  290. package/dist/src/telemetry/workspace.js +18 -3
  291. package/dist/src/terminal-ui.d.ts +3 -0
  292. package/dist/src/terminal-ui.js +48 -6
  293. package/dist/src/test-edit-guard.d.ts +30 -0
  294. package/dist/src/test-edit-guard.js +167 -2
  295. package/dist/src/thinking-level-detect.d.ts +13 -0
  296. package/dist/src/thinking-level-detect.js +52 -0
  297. package/dist/src/thinking-levels.d.ts +30 -0
  298. package/dist/src/thinking-levels.js +131 -0
  299. package/dist/src/timers.d.ts +3 -0
  300. package/dist/src/todos.d.ts +2 -1
  301. package/dist/src/todos.js +24 -4
  302. package/dist/src/tool-argument-coercion.d.ts +7 -0
  303. package/dist/src/tool-argument-coercion.js +49 -0
  304. package/dist/src/tool-catalog.d.ts +2 -2
  305. package/dist/src/tool-catalog.js +1 -1
  306. package/dist/src/tools.js +67 -22
  307. package/dist/src/transcript.js +3 -2
  308. package/dist/src/types.d.ts +48 -1
  309. package/dist/src/update.js +4 -0
  310. package/dist/src/usage-analytics.d.ts +7 -0
  311. package/dist/src/usage-analytics.js +85 -13
  312. package/dist/telemetry-consent-v1 +1 -0
  313. package/package.json +97 -96
@@ -6,9 +6,9 @@ import { dirname, join } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
7
  import { observePage, observationResult } from './browser-observation.js';
8
8
  import { externalAppPromptNote, externalAppScheme, guardExternalApps } from './browser-external-app.js';
9
+ import { browserPidsFromCdp, taskbarStyleApply } from './browser-window-style.js';
9
10
  import { desktopUaOverride, hardenContext, stealthLaunchArgs, STEALTH_LOCALE, userAgentMetadata } from './browser-stealth.js';
10
11
  export const VIEW_TAB_LIMIT = 6;
11
- export const VIEW_SESSION_LIMIT = 4;
12
12
  export const VIEW_IDLE_CLOSE_MS = 10 * 60 * 1000;
13
13
  export const VIEW_HOLD_MAX_MS = 10 * 60 * 1000;
14
14
  export const VIEW_FRAME_MIN_INTERVAL_MS = 16;
@@ -259,6 +259,10 @@ export function channelCandidate(channel, platform, chromiumExecutable) {
259
259
  const EXTENSION_RESTART_POLL_MS = 5_000;
260
260
  const EXTENSION_PROBE_TIMEOUT_MS = 4_000;
261
261
  const PROFILE_CLOSE_TIMEOUT_MS = 5_000;
262
+ const PARK_WINDOW_POLL_MS = 250;
263
+ const PARK_WINDOW_ATTEMPTS = 20;
264
+ /** Upper bound on waiting for a restore script to finish before the next taskbar transition. */
265
+ const TASKBAR_RESTORE_WAIT_MS = 10_000;
262
266
  const EXTENSION_PAGE_CLAIM_MS = 300;
263
267
  export class BrowserViewManager {
264
268
  emit;
@@ -266,6 +270,9 @@ export class BrowserViewManager {
266
270
  options;
267
271
  sessions = new Map();
268
272
  desired = new Map();
273
+ // A desktop viewport the agent chose with browser.panel resize. It wins over the panel's own size
274
+ // until the agent resets it or the session is released; the panel letterboxes the frames meanwhile.
275
+ agentViewports = new Map();
269
276
  displayScale = 1;
270
277
  launching = new Map();
271
278
  runtime = { state: 'checking' };
@@ -283,6 +290,12 @@ export class BrowserViewManager {
283
290
  restartingProfiles = new Map();
284
291
  restoring = new Map();
285
292
  restartPoll;
293
+ /** The taskbar watcher holding each parked browser's real window out of the taskbar, keyed by its browser object. */
294
+ taskbarWatchers = new WeakMap();
295
+ /** A launch park still looking for its window, keyed by its browser object; an explicit move cancels it. */
296
+ pendingParks = new WeakMap();
297
+ /** The taskbar transition under way for each browser, so overlapping requests order after it. */
298
+ taskbarQueue = new WeakMap();
286
299
  closed = false;
287
300
  constructor(emit, launchBrowser, options = {}) {
288
301
  this.emit = emit;
@@ -497,15 +510,102 @@ export class BrowserViewManager {
497
510
  const session = browser?.newBrowserCDPSession?.();
498
511
  if (!session)
499
512
  return;
513
+ const pending = { cancelled: false };
514
+ this.pendingParks.set(browser, pending);
500
515
  void Promise.resolve().then(() => session).then(async (cdp) => {
501
- const windowId = await this.windowIdFor(cdp, undefined);
502
- if (windowId === undefined)
516
+ const windowId = await this.windowIdWhenPresent(cdp);
517
+ if (windowId === undefined || pending.cancelled)
503
518
  return;
504
519
  await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal', ...VIEW_OFFSCREEN_POSITION } });
505
- }).catch(() => { });
520
+ if (pending.cancelled)
521
+ return;
522
+ // A parked window is still a taskbar button and an Alt-Tab entry on Windows;
523
+ // the watcher holds it out of both while it is offscreen (the pane shows the
524
+ // page by screencasting it, so the window needs no taskbar presence), and
525
+ // stops when the user asks to see the window on screen.
526
+ await this.setTaskbarHidden(browser, cdp, true);
527
+ }).catch(() => { }).finally(() => {
528
+ if (this.pendingParks.get(browser) === pending)
529
+ this.pendingParks.delete(browser);
530
+ });
506
531
  }
507
532
  catch { /* same: never let window parking break the launch */ }
508
533
  }
534
+ /**
535
+ * An isolated launch starts with no web contents, and the real window only exists
536
+ * once a tab does; the park is worth asserting on that window, so wait briefly for
537
+ * it instead of giving up at launch time. A persistent launch already has its blank
538
+ * page at launch and lands on the first attempt.
539
+ */
540
+ async windowIdWhenPresent(cdp) {
541
+ for (let attempt = 0; attempt < PARK_WINDOW_ATTEMPTS; attempt++) {
542
+ const windowId = await this.windowIdFor(cdp, undefined);
543
+ if (windowId !== undefined)
544
+ return windowId;
545
+ await new Promise(resolve => { const timer = setTimeout(resolve, PARK_WINDOW_POLL_MS); timer.unref?.(); });
546
+ }
547
+ return undefined;
548
+ }
549
+ /**
550
+ * Holds a parked browser's real window out of the taskbar and the Alt-Tab list, and
551
+ * returns it to normal window behaviour when the user asks to see it. The watcher is
552
+ * keyed by the browser object, so sessions of one browser share one watcher.
553
+ */
554
+ async setTaskbarHidden(browser, cdp, hidden) {
555
+ if (!browser)
556
+ return;
557
+ // One transition at a time per browser: two overlapping requests could both pass
558
+ // the watcher check while the pid lookup resolves and each start a watcher, and a
559
+ // later release would only kill the recorded one while an orphan kept re-hiding
560
+ // the window. A request that overlaps waits for the in-flight one and decides on
561
+ // its result instead.
562
+ const base = (this.taskbarQueue.get(browser) ?? Promise.resolve()).catch(() => { });
563
+ const run = base.then(() => this.taskbarTransition(browser, cdp, hidden)).catch(() => { });
564
+ this.taskbarQueue.set(browser, run);
565
+ try {
566
+ await run;
567
+ }
568
+ finally {
569
+ if (this.taskbarQueue.get(browser) === run)
570
+ this.taskbarQueue.delete(browser);
571
+ }
572
+ }
573
+ /** One serialized taskbar transition: start (hidden) or tear down (shown) the watcher for this browser. */
574
+ async taskbarTransition(browser, cdp, hidden) {
575
+ if (hidden) {
576
+ if (this.taskbarWatchers.has(browser))
577
+ return;
578
+ const pids = await browserPidsFromCdp(cdp).catch(() => []);
579
+ if (!pids.length)
580
+ return;
581
+ const watcher = taskbarStyleApply(pids, true);
582
+ if (watcher)
583
+ this.taskbarWatchers.set(browser, watcher);
584
+ return;
585
+ }
586
+ const watcher = this.taskbarWatchers.get(browser);
587
+ if (!watcher)
588
+ return;
589
+ this.taskbarWatchers.delete(browser);
590
+ try {
591
+ watcher.kill();
592
+ }
593
+ catch { /* already gone */ }
594
+ // The taskbar does not refresh on ownership changes alone; ask it to put the
595
+ // button back explicitly so a shown browser is a normal window again at once.
596
+ const pids = await browserPidsFromCdp(cdp).catch(() => []);
597
+ if (!pids.length)
598
+ return;
599
+ const restore = taskbarStyleApply(pids, false);
600
+ // The restore runs as its own PowerShell process, so wait for it before the
601
+ // transition is done: a quick Hide would otherwise start its watcher while the
602
+ // restore's unconditional AddTab was still in flight, and that AddTab would put the
603
+ // parked window back into the taskbar. A hung restore only delays the next
604
+ // transition, bounded by the timeout below.
605
+ if (restore?.exit) {
606
+ await Promise.race([restore.exit, new Promise(resolve => { const timer = setTimeout(resolve, TASKBAR_RESTORE_WAIT_MS); timer.unref?.(); })]);
607
+ }
608
+ }
509
609
  /**
510
610
  * Finds the id of the window that should be moved. The precise way is the target
511
611
  * id of the tab the user is looking at; without one the browser target itself has
@@ -634,6 +734,13 @@ export class BrowserViewManager {
634
734
  const session = this.sessions.get(sessionId);
635
735
  if (!session || session.closing)
636
736
  throw new Error('No browser tab is open for this session');
737
+ // An explicit move from the user cancels any launch park still looking for its
738
+ // window: the park would otherwise move the window back offscreen and hide it from
739
+ // the taskbar after this move ran, leaving the panel saying shown while the window
740
+ // sat parked.
741
+ const pending = this.pendingParks.get(this.browserFor(session));
742
+ if (pending)
743
+ pending.cancelled = true;
637
744
  this.scheduleIdleClose(sessionId, session);
638
745
  const cdp = await this.browserCdpFor(session);
639
746
  const active = session.activeTabId ? session.tabs.get(session.activeTabId) : undefined;
@@ -641,6 +748,9 @@ export class BrowserViewManager {
641
748
  if (windowId === undefined)
642
749
  throw new Error('The browser window could not be found to move');
643
750
  await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal', ...position } });
751
+ // Showing the window gives it its normal window behaviour back (a taskbar button
752
+ // of its own); parking it again takes the button and the Alt-Tab entry away.
753
+ await this.setTaskbarHidden(this.browserFor(session), cdp, !activate);
644
754
  if (activate) {
645
755
  // Showing the window also raises the tab the panel is showing: the manager's
646
756
  // selection and the native browser's selected tab are separate, so without
@@ -1313,13 +1423,11 @@ export class BrowserViewManager {
1313
1423
  const inflight = this.launching.get(sessionId);
1314
1424
  if (inflight)
1315
1425
  return await inflight;
1316
- if (this.sessions.size + this.launching.size >= VIEW_SESSION_LIMIT)
1317
- throw new Error('Too many open panel browsers; close one first');
1318
1426
  if (this.closed)
1319
1427
  throw new Error('Application is shutting down');
1320
1428
  const starting = (async () => {
1321
1429
  const desired = this.desired.get(sessionId);
1322
- const viewport = desired?.viewport ?? clampViewport(undefined, undefined);
1430
+ const viewport = this.viewportFor(sessionId, desired);
1323
1431
  const opened = await this.openBrowserFor(sessionId, viewport, desired?.scale ?? this.displayScale);
1324
1432
  if (this.closed) {
1325
1433
  await this.disposeBrowser({ ...opened, tabs: new Map() });
@@ -1332,7 +1440,7 @@ export class BrowserViewManager {
1332
1440
  const current = this.desired.get(sessionId);
1333
1441
  const session = {
1334
1442
  ...opened, tabs: new Map(), activeTabId: undefined, pendingTabs: 0,
1335
- viewport: current?.viewport ?? viewport,
1443
+ viewport: current ? this.viewportFor(sessionId, current) : viewport,
1336
1444
  mode: current?.mode ?? 'desktop',
1337
1445
  scale: current?.scale ?? this.displayScale,
1338
1446
  streaming: current !== undefined, quality: current?.quality ?? VIEW_STREAM_QUALITY, idleTimer: undefined,
@@ -1575,9 +1683,16 @@ export class BrowserViewManager {
1575
1683
  if (options.scale !== undefined)
1576
1684
  this.displayScale = scale;
1577
1685
  this.desired.set(sessionId, { viewport, quality, mode, scale });
1686
+ await this.applyStream(sessionId);
1687
+ }
1688
+ /** Applies the panel's last stream request, with the agent's viewport in place of the panel's size when it set one. */
1689
+ async applyStream(sessionId) {
1690
+ const desired = this.desired.get(sessionId);
1578
1691
  const session = this.sessions.get(sessionId);
1579
- if (!session)
1692
+ if (!desired || !session)
1580
1693
  return;
1694
+ const { mode, quality, scale } = desired;
1695
+ const viewport = this.viewportFor(sessionId, desired);
1581
1696
  session.streaming = true;
1582
1697
  const modeChanged = mode !== session.mode;
1583
1698
  const resized = viewport.width !== session.viewport.width || viewport.height !== session.viewport.height
@@ -1613,6 +1728,44 @@ export class BrowserViewManager {
1613
1728
  if (reattached)
1614
1729
  await this.captureFrame(sessionId, session, active);
1615
1730
  }
1731
+ viewportFor(sessionId, desired) {
1732
+ if (desired?.mode === 'mobile')
1733
+ return { ...VIEW_MOBILE_VIEWPORT };
1734
+ const chosen = this.agentViewports.get(sessionId);
1735
+ return chosen ? { ...chosen } : desired?.viewport ?? clampViewport(undefined, undefined);
1736
+ }
1737
+ /**
1738
+ * Sets the desktop viewport the agent browses at, or with no size returns it to the panel's own size.
1739
+ * A page too crowded at the panel's width (collapsed menus, overlapping controls) gets room this way;
1740
+ * the panel shows the larger page scaled to fit. The user's mobile mode is theirs and is not overridden.
1741
+ */
1742
+ async agentResize(sessionId, size) {
1743
+ const desired = this.desired.get(sessionId);
1744
+ const session = this.sessions.get(sessionId);
1745
+ if (size && (session?.mode ?? desired?.mode) === 'mobile') {
1746
+ throw new Error('The Browser panel is in mobile viewport mode (390x844), which the user chose; ask them to switch it back to desktop before resizing.');
1747
+ }
1748
+ if (size)
1749
+ this.agentViewports.set(sessionId, { width: size.width, height: size.height });
1750
+ else
1751
+ this.agentViewports.delete(sessionId);
1752
+ if (session && desired)
1753
+ await this.applyStream(sessionId);
1754
+ else if (session) {
1755
+ // A hidden panel keeps the mode it last streamed in, and mobile emulation stays at its fixed size.
1756
+ const viewport = session.mode === 'mobile' ? { ...VIEW_MOBILE_VIEWPORT } : this.viewportFor(sessionId, undefined);
1757
+ if (viewport.width !== session.viewport.width || viewport.height !== session.viewport.height) {
1758
+ session.viewport = viewport;
1759
+ const active = session.activeTabId ? session.tabs.get(session.activeTabId) : undefined;
1760
+ if (active) {
1761
+ active.budget = undefined;
1762
+ await this.queueViewportMode(session, active);
1763
+ }
1764
+ }
1765
+ }
1766
+ const viewport = this.sessions.get(sessionId)?.viewport ?? this.viewportFor(sessionId, desired);
1767
+ return { viewport: { ...viewport }, follows: this.agentViewports.has(sessionId) ? 'agent' : 'panel' };
1768
+ }
1616
1769
  async input(sessionId, payload) {
1617
1770
  const session = this.sessions.get(sessionId);
1618
1771
  if (!session)
@@ -1891,6 +2044,7 @@ export class BrowserViewManager {
1891
2044
  if (restoring)
1892
2045
  restoring.cancelled = true;
1893
2046
  this.incognito.delete(sessionId);
2047
+ this.agentViewports.delete(sessionId);
1894
2048
  try {
1895
2049
  await this.closeSession(sessionId, reason);
1896
2050
  }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * A running taskbar style change. A watcher keeps running until killed; a restore is a
3
+ * one-shot whose `exit` resolves when its PowerShell process is done (the caller waits
4
+ * for it so a following transition cannot overlap the restore).
5
+ */
6
+ export interface TaskbarWatcher {
7
+ kill(): void;
8
+ exit?: Promise<void>;
9
+ }
10
+ /** The pids of the browser processes behind one CDP connection: the browser process is the one that owns the window. */
11
+ export declare function browserPidsFromCdp(cdp: any): Promise<number[]>;
12
+ /** The full PowerShell script for one watcher; empty when there is nothing to do. */
13
+ export declare function taskbarWatcherScript(pids: number[]): string;
14
+ /** The one-shot script that asks the taskbar to put the button back. */
15
+ export declare function taskbarRestoreScript(pids: number[]): string;
16
+ type Spawner = (file: string, args: string[]) => {
17
+ kill(): void;
18
+ exit?: Promise<void>;
19
+ } | undefined;
20
+ /** Test seam: stands in for the watcher process spawn. */
21
+ export declare function setTaskbarStyleSpawner(spawner: Spawner | undefined): void;
22
+ export declare function applyWindowsTaskbarStyle(pids: number[], hidden: boolean): TaskbarWatcher | undefined;
23
+ /** Test seam: stands in for the style change so view tests never spawn PowerShell. */
24
+ export declare function setTaskbarStyleApply(apply: (pids: number[], hidden: boolean) => TaskbarWatcher | undefined): void;
25
+ /** Starts (hidden=true) or tears down (hidden=false) the taskbar watcher for these pids. */
26
+ export declare function taskbarStyleApply(pids: number[], hidden: boolean): TaskbarWatcher | undefined;
27
+ export {};
@@ -0,0 +1,244 @@
1
+ import { spawn } from 'node:child_process';
2
+ /**
3
+ * The panel's parked browser is a real Chromium window held offscreen, and Windows
4
+ * would still give it a taskbar button and an Alt-Tab entry. Making it a tool window
5
+ * does not last: Chromium re-applies its own window styles within a second, clearing
6
+ * the bit again. What does last is ownership: a window whose owner is not visible
7
+ * gets no taskbar button and is excluded from Alt-Tab, and Chromium never touches the
8
+ * owner. So this module runs a tiny watcher process whose only jobs are to hold a
9
+ * hidden proxy window and to set it as the owner of the browser's windows until the
10
+ * manager releases it (the user asked to see the browser) or the browser is gone.
11
+ */
12
+ const WATCHER_SCRIPT = `
13
+ $ErrorActionPreference = 'Stop'
14
+ Add-Type -TypeDefinition @'
15
+ using System; using System.Text; using System.Threading; using System.Runtime.InteropServices;
16
+ public static class AndorraTaskbarWatcher
17
+ {
18
+ delegate bool EnumProc(IntPtr hWnd, IntPtr lParam);
19
+ delegate IntPtr WndProc(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam);
20
+
21
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
22
+ struct WNDCLASS { public uint style; public IntPtr wndProc; public int clsExtra, wndExtra; public IntPtr instance, icon, cursor, background; public string menuName; public string className; }
23
+
24
+ [DllImport("user32.dll")] static extern bool EnumWindows(EnumProc callback, IntPtr lParam);
25
+ [DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
26
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern int GetClassName(IntPtr hWnd, StringBuilder name, int max);
27
+ [DllImport("user32.dll", EntryPoint = "GetWindowLongPtrW")] static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int index);
28
+ [DllImport("user32.dll", EntryPoint = "SetWindowLongPtrW")] static extern IntPtr SetWindowLongPtr(IntPtr hWnd, int index, IntPtr value);
29
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern ushort RegisterClassW(ref WNDCLASS wndClass);
30
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern IntPtr CreateWindowExW(uint exStyle, string className, string name, uint style, int x, int y, int width, int height, IntPtr parent, IntPtr menu, IntPtr instance, IntPtr param);
31
+ [DllImport("user32.dll")] static extern bool DestroyWindow(IntPtr hWnd);
32
+ [DllImport("user32.dll")] static extern IntPtr DefWindowProcW(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam);
33
+ [DllImport("user32.dll")] static extern bool PeekMessageW(out MSG message, IntPtr hwnd, uint min, uint max, uint remove);
34
+ [DllImport("user32.dll")] static extern bool TranslateMessage(ref MSG message);
35
+ [DllImport("user32.dll")] static extern IntPtr DispatchMessageW(ref MSG message);
36
+ [DllImport("user32.dll")] static extern int MsgWaitForMultipleObjectsEx(int count, IntPtr[] handles, uint timeout, uint wakeMask, uint flags);
37
+
38
+ [StructLayout(LayoutKind.Sequential)]
39
+ struct MSG { public IntPtr hwnd; public uint message; public IntPtr wParam; public IntPtr lParam; public uint time; public int pointX; public int pointY; }
40
+
41
+ const uint QS_ALLINPUT = 0x04FF;
42
+ const uint MWMO_INPUTAVAILABLE = 0x0004;
43
+ const uint PM_REMOVE = 0x0001;
44
+
45
+ const int GWL_HWNDPARENT = -8;
46
+ const int IDLE_TICKS_BEFORE_EXIT = 15;
47
+
48
+ static WndProc messageLoop = DefWindowProcW;
49
+ static IntPtr proxy;
50
+
51
+ static bool OwnsBrowserWindows(long[] processes)
52
+ {
53
+ bool found = false;
54
+ for (int i = 0; i < processes.Length; i++)
55
+ {
56
+ long pid = processes[i];
57
+ EnumWindows(delegate(IntPtr hWnd, IntPtr lParam)
58
+ {
59
+ uint owner;
60
+ GetWindowThreadProcessId(hWnd, out owner);
61
+ if (owner != (uint)pid) return true;
62
+ StringBuilder name = new StringBuilder(64);
63
+ GetClassName(hWnd, name, 64);
64
+ if (!name.ToString().StartsWith("Chrome_WidgetWin_1", StringComparison.Ordinal)) return true;
65
+ found = true;
66
+ if (GetWindowLongPtr(hWnd, GWL_HWNDPARENT) != proxy) SetWindowLongPtr(hWnd, GWL_HWNDPARENT, proxy);
67
+ return true;
68
+ }, IntPtr.Zero);
69
+ }
70
+ return found;
71
+ }
72
+
73
+ public static void Watch(long[] processes)
74
+ {
75
+ if (processes == null || processes.Length == 0) return;
76
+ WNDCLASS wndClass = new WNDCLASS();
77
+ wndClass.wndProc = Marshal.GetFunctionPointerForDelegate(messageLoop);
78
+ wndClass.className = "AndorraOwnerProxy";
79
+ wndClass.instance = Marshal.GetHINSTANCE(typeof(AndorraTaskbarWatcher).Module);
80
+ if (RegisterClassW(ref wndClass) == 0) return;
81
+ proxy = CreateWindowExW(0, "AndorraOwnerProxy", "andorra-owner-proxy", 0, 0, 0, 0, 0, IntPtr.Zero, IntPtr.Zero, wndClass.instance, IntPtr.Zero);
82
+ if (proxy == IntPtr.Zero) return;
83
+ try
84
+ {
85
+ int idleTicks = 0;
86
+ MSG message;
87
+ while (idleTicks < IDLE_TICKS_BEFORE_EXIT)
88
+ {
89
+ // As the owner of Chromium's windows the proxy shares their input queues,
90
+ // so this thread must service the proxy's window messages: an unresponsive
91
+ // owner window can stall browser focus/activation and leave synchronous
92
+ // broadcasts to it waiting for the sender to time out. Thread.Sleep does
93
+ // not pump messages, so wait for input or the next poll tick and drain
94
+ // whatever arrived before re-checking the browser's windows.
95
+ while (PeekMessageW(out message, IntPtr.Zero, 0, 0, PM_REMOVE))
96
+ {
97
+ TranslateMessage(ref message);
98
+ DispatchMessageW(ref message);
99
+ }
100
+ if (OwnsBrowserWindows(processes)) idleTicks = 0;
101
+ else idleTicks++;
102
+ MsgWaitForMultipleObjectsEx(0, null, 1000, QS_ALLINPUT, MWMO_INPUTAVAILABLE);
103
+ }
104
+ }
105
+ finally { DestroyWindow(proxy); }
106
+ }
107
+ }
108
+ '@
109
+ [AndorraTaskbarWatcher]::Watch([long[]]@(__PIDS__))
110
+ `;
111
+ /**
112
+ * What runs when the manager asks to see the browser again: the taskbar only notices
113
+ * an owner change on window events, so the button is put back explicitly through
114
+ * ITaskbarList.AddTab instead of waiting for a refresh that may never come.
115
+ */
116
+ const RESTORE_SCRIPT = `
117
+ $ErrorActionPreference = 'Stop'
118
+ Add-Type -TypeDefinition @'
119
+ using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices;
120
+ public static class AndorraTaskbarRestore
121
+ {
122
+ [ComImport, Guid("56FDF342-FD6D-11d0-958A-006097C9A090"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
123
+ interface ITaskbarList
124
+ {
125
+ void HrInit();
126
+ void AddTab(IntPtr hwnd);
127
+ void DeleteTab(IntPtr hwnd);
128
+ void ActivateTab(IntPtr hwnd);
129
+ void SetActiveAlt(IntPtr hwnd);
130
+ }
131
+ [ComImport, Guid("56FDF344-FD6D-11d0-958A-006097C9A090")]
132
+ class TaskbarList { }
133
+
134
+ delegate bool EnumProc(IntPtr hWnd, IntPtr lParam);
135
+ [DllImport("user32.dll")] static extern bool EnumWindows(EnumProc callback, IntPtr lParam);
136
+ [DllImport("user32.dll")] static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint processId);
137
+ [DllImport("user32.dll", CharSet = CharSet.Unicode)] static extern int GetClassName(IntPtr hWnd, StringBuilder name, int max);
138
+
139
+ public static void Restore(long[] processes)
140
+ {
141
+ if (processes == null || processes.Length == 0) return;
142
+ List<IntPtr> windows = new List<IntPtr>();
143
+ for (int i = 0; i < processes.Length; i++)
144
+ {
145
+ long pid = processes[i];
146
+ EnumWindows(delegate(IntPtr hWnd, IntPtr lParam)
147
+ {
148
+ uint owner;
149
+ GetWindowThreadProcessId(hWnd, out owner);
150
+ if (owner != (uint)pid) return true;
151
+ StringBuilder name = new StringBuilder(64);
152
+ GetClassName(hWnd, name, 64);
153
+ if (name.ToString().StartsWith("Chrome_WidgetWin_1", StringComparison.Ordinal)) windows.Add(hWnd);
154
+ return true;
155
+ }, IntPtr.Zero);
156
+ }
157
+ if (windows.Count == 0) return;
158
+ var list = (ITaskbarList)(object)new TaskbarList();
159
+ list.HrInit();
160
+ for (int i = 0; i < windows.Count; i++) list.AddTab(windows[i]);
161
+ }
162
+ }
163
+ '@
164
+ [AndorraTaskbarRestore]::Restore([long[]]@(__PIDS__))
165
+ `;
166
+ /** The pids of the browser processes behind one CDP connection: the browser process is the one that owns the window. */
167
+ export async function browserPidsFromCdp(cdp) {
168
+ const info = await cdp.send('SystemInfo.getProcessInfo');
169
+ const entries = Array.isArray(info?.processInfo) ? info.processInfo : [];
170
+ return entries
171
+ .filter((entry) => entry?.type === 'browser'
172
+ && Number.isSafeInteger(entry.id) && entry.id > 0)
173
+ .map((entry) => entry.id);
174
+ }
175
+ /** The full PowerShell script for one watcher; empty when there is nothing to do. */
176
+ export function taskbarWatcherScript(pids) {
177
+ return styleScript(pids, WATCHER_SCRIPT);
178
+ }
179
+ /** The one-shot script that asks the taskbar to put the button back. */
180
+ export function taskbarRestoreScript(pids) {
181
+ return styleScript(pids, RESTORE_SCRIPT);
182
+ }
183
+ const styleScript = (pids, template) => {
184
+ const targets = (Array.isArray(pids) ? pids : [])
185
+ .filter(pid => Number.isSafeInteger(pid) && pid > 0)
186
+ .map(String).join(',');
187
+ if (!targets)
188
+ return '';
189
+ return template.replace('__PIDS__', targets);
190
+ };
191
+ let taskbarStyleSpawnerImpl = undefined;
192
+ /** Test seam: stands in for the watcher process spawn. */
193
+ export function setTaskbarStyleSpawner(spawner) {
194
+ taskbarStyleSpawnerImpl = spawner;
195
+ }
196
+ function defaultSpawner(file, args) {
197
+ try {
198
+ const child = spawn(file, args, { stdio: 'ignore', windowsHide: true });
199
+ child.once('error', () => { });
200
+ child.unref?.();
201
+ const exit = new Promise(resolve => {
202
+ child.once('close', () => resolve());
203
+ child.once('error', () => resolve());
204
+ });
205
+ return {
206
+ kill: () => { try {
207
+ child.kill();
208
+ }
209
+ catch { /* already gone */ } },
210
+ exit,
211
+ };
212
+ }
213
+ catch {
214
+ return undefined;
215
+ }
216
+ }
217
+ export function applyWindowsTaskbarStyle(pids, hidden) {
218
+ if (process.platform !== 'win32')
219
+ return undefined;
220
+ const spawner = taskbarStyleSpawnerImpl ?? defaultSpawner;
221
+ if (!hidden) {
222
+ const script = taskbarRestoreScript(pids);
223
+ if (!script)
224
+ return undefined;
225
+ return spawner('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', encodeCommand(script)]);
226
+ }
227
+ const script = taskbarWatcherScript(pids);
228
+ if (!script)
229
+ return undefined;
230
+ const child = spawner('powershell.exe', ['-NoProfile', '-NonInteractive', '-EncodedCommand', encodeCommand(script)]);
231
+ if (!child)
232
+ return undefined;
233
+ return child;
234
+ }
235
+ const encodeCommand = (script) => Buffer.from(script, 'utf16le').toString('base64');
236
+ let taskbarStyleImpl = applyWindowsTaskbarStyle;
237
+ /** Test seam: stands in for the style change so view tests never spawn PowerShell. */
238
+ export function setTaskbarStyleApply(apply) {
239
+ taskbarStyleImpl = apply;
240
+ }
241
+ /** Starts (hidden=true) or tears down (hidden=false) the taskbar watcher for these pids. */
242
+ export function taskbarStyleApply(pids, hidden) {
243
+ return taskbarStyleImpl(pids, hidden);
244
+ }
@@ -0,0 +1,48 @@
1
+ /** Byte limits the service enforces on the two attachments (infra/andorra-auth/bug_report.py). */
2
+ export declare const GRAPH_LIMIT = 8000;
3
+ export declare const TRAJECTORY_LIMIT = 12000;
4
+ export interface ReportSession {
5
+ id: string;
6
+ name: string;
7
+ updatedAt: string;
8
+ current?: true;
9
+ }
10
+ export interface SessionAttachments {
11
+ graph?: string;
12
+ trajectory?: string;
13
+ }
14
+ /**
15
+ * The sessions a report can be about: the newest saved ones, with the one this run belongs to first. Only the
16
+ * newest files are opened, so a home with thousands of sessions costs a directory listing and a few reads.
17
+ */
18
+ export declare function listReportSessions(home: string, currentId?: string, limit?: number): Promise<ReportSession[]>;
19
+ /**
20
+ * A graph as one line per node and edge. Settings are listed; the text of an instruction, prompt or command is
21
+ * replaced by its length, because a bug in routing or tools is visible without the user's wording.
22
+ */
23
+ export declare function graphOutline(value: unknown): string | undefined;
24
+ /**
25
+ * Reads a session's trajectory into the two attachments: the graph of the last run it reports, and each run as a short
26
+ * list of steps (nodes, tools, retries, refusals, how it stopped). It never copies a prompt, a model reply, tool
27
+ * arguments or a successful tool's output; a failed step keeps the first 200 characters of its error.
28
+ */
29
+ export declare class TrajectoryDigest {
30
+ private readonly runs;
31
+ /** One line of the trajectory file. Model requests and replies are the bulk of the file and are skipped unparsed. */
32
+ add(line: string): void;
33
+ private run;
34
+ private at;
35
+ private flush;
36
+ private event;
37
+ /** `skipOpenRun` leaves out a last run that has not finished: in the reporting session, that run is the report itself. */
38
+ result(options?: {
39
+ skipOpenRun?: boolean;
40
+ }): SessionAttachments;
41
+ }
42
+ /** Whether this machine has a saved session or a trajectory under that id. */
43
+ export declare function sessionExists(home: string, sessionId: string): Promise<boolean>;
44
+ /** The graph and compressed trajectory of one saved session, or nothing when the session left no trajectory. */
45
+ export declare function sessionAttachments(home: string, sessionId: string, options?: {
46
+ current?: boolean;
47
+ signal?: AbortSignal;
48
+ }): Promise<SessionAttachments>;