@andorra-labs/code 0.1.18 → 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 (277) 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 +347 -45
  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/hosted.d.ts +8 -0
  11. package/dist/src/andorra/hosted.js +22 -3
  12. package/dist/src/andorra/streams.d.ts +49 -0
  13. package/dist/src/andorra/streams.js +98 -0
  14. package/dist/src/antigravity-acp.d.ts +28 -0
  15. package/dist/src/antigravity-acp.js +150 -0
  16. package/dist/src/antigravity-terminal.d.ts +2 -0
  17. package/dist/src/antigravity-terminal.js +214 -0
  18. package/dist/src/app-server/adaptive-routing-settings.d.ts +37 -0
  19. package/dist/src/app-server/adaptive-routing-settings.js +69 -0
  20. package/dist/src/app-server/artifact.d.ts +14 -0
  21. package/dist/src/app-server/artifact.js +46 -0
  22. package/dist/src/app-server/legal-protocol.d.ts +33 -0
  23. package/dist/src/app-server/legal-protocol.js +16 -0
  24. package/dist/src/app-server/protocol.d.ts +23 -3
  25. package/dist/src/app-server/protocol.js +3 -1
  26. package/dist/src/app-server/telemetry-protocol.d.ts +53 -0
  27. package/dist/src/app-server/telemetry-protocol.js +2 -0
  28. package/dist/src/app-server/telemetry.d.ts +38 -0
  29. package/dist/src/app-server/telemetry.js +163 -0
  30. package/dist/src/app-server/workspace.d.ts +3 -1
  31. package/dist/src/app-server/workspace.js +39 -8
  32. package/dist/src/app-server.d.ts +50 -25
  33. package/dist/src/app-server.js +1008 -400
  34. package/dist/src/auth/AuthManager.d.ts +11 -2
  35. package/dist/src/auth/AuthManager.js +56 -13
  36. package/dist/src/auth/index.d.ts +5 -1
  37. package/dist/src/auth/index.js +8 -1
  38. package/dist/src/auth/lifecycle.d.ts +13 -0
  39. package/dist/src/auth/lifecycle.js +109 -0
  40. package/dist/src/auth/store.d.ts +1 -0
  41. package/dist/src/auth/store.js +12 -0
  42. package/dist/src/auth/types.d.ts +12 -0
  43. package/dist/src/automation-runner.js +2 -0
  44. package/dist/src/automation-service.js +7 -2
  45. package/dist/src/benchmark-scores.d.ts +88 -0
  46. package/dist/src/benchmark-scores.js +302 -0
  47. package/dist/src/bridge/command.js +4 -1
  48. package/dist/src/bridge/control.js +2 -1
  49. package/dist/src/bridge/engines.d.ts +2 -0
  50. package/dist/src/bridge/engines.js +9 -0
  51. package/dist/src/bridge/host-ops.d.ts +2 -2
  52. package/dist/src/bridge/host-ops.js +4 -2
  53. package/dist/src/bridge/host.d.ts +2 -0
  54. package/dist/src/bridge/host.js +63 -12
  55. package/dist/src/bridge/protocol.d.ts +1 -0
  56. package/dist/src/bridge/protocol.js +1 -0
  57. package/dist/src/browser-panel-tool.d.ts +12 -0
  58. package/dist/src/browser-panel-tool.js +30 -3
  59. package/dist/src/browser-runner.js +53 -62
  60. package/dist/src/browser-server.js +10 -4
  61. package/dist/src/browser-session.d.ts +14 -0
  62. package/dist/src/browser-session.js +57 -12
  63. package/dist/src/browser-view.d.ts +40 -1
  64. package/dist/src/browser-view.js +163 -9
  65. package/dist/src/browser-window-style.d.ts +27 -0
  66. package/dist/src/browser-window-style.js +244 -0
  67. package/dist/src/claude-provider.d.ts +1 -0
  68. package/dist/src/claude-provider.js +77 -36
  69. package/dist/src/cli.js +235 -58
  70. package/dist/src/codex-provider.d.ts +1 -0
  71. package/dist/src/codex-provider.js +43 -7
  72. package/dist/src/coding-tools.d.ts +1 -0
  73. package/dist/src/coding-tools.js +19 -5
  74. package/dist/src/command-screens.d.ts +1 -1
  75. package/dist/src/command-screens.js +2 -2
  76. package/dist/src/commands.d.ts +8 -1
  77. package/dist/src/commands.js +67 -63
  78. package/dist/src/completion.js +5 -3
  79. package/dist/src/config.d.ts +14 -3
  80. package/dist/src/config.js +54 -16
  81. package/dist/src/context-budget.d.ts +11 -2
  82. package/dist/src/context-budget.js +23 -2
  83. package/dist/src/context-compaction.d.ts +10 -8
  84. package/dist/src/context-compaction.js +23 -24
  85. package/dist/src/deadline.js +1 -1
  86. package/dist/src/decision/DecisionManager.d.ts +5 -0
  87. package/dist/src/decision/DecisionManager.js +39 -2
  88. package/dist/src/decision/applyToolMenu.js +6 -2
  89. package/dist/src/decision/hostedPolicy.js +6 -4
  90. package/dist/src/decision/optimizationPolicy.d.ts +10 -0
  91. package/dist/src/decision/optimizationPolicy.js +23 -3
  92. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -1
  93. package/dist/src/decision/providers/AndorraDecisionProvider.js +17 -7
  94. package/dist/src/decision/providers/index.js +1 -1
  95. package/dist/src/decision/toolFamilies.js +1 -1
  96. package/dist/src/decision/types.d.ts +2 -0
  97. package/dist/src/efficiency.d.ts +75 -1
  98. package/dist/src/efficiency.js +114 -3
  99. package/dist/src/extensions.d.ts +2 -0
  100. package/dist/src/extensions.js +30 -20
  101. package/dist/src/github-app/agent-writes.d.ts +1 -1
  102. package/dist/src/github-app/agent-writes.js +1 -1
  103. package/dist/src/github-app/event-source.d.ts +0 -5
  104. package/dist/src/github-app/event-source.js +1 -31
  105. package/dist/src/github-app/metrics.d.ts +2 -5
  106. package/dist/src/github-app/metrics.js +2 -14
  107. package/dist/src/github-app/review-loop.d.ts +5 -5
  108. package/dist/src/github-app/review-loop.js +1 -1
  109. package/dist/src/github-app/review-node.d.ts +2 -2
  110. package/dist/src/github-app/triggers.d.ts +3 -3
  111. package/dist/src/glob-search.d.ts +1 -0
  112. package/dist/src/glob-search.js +3 -0
  113. package/dist/src/google-provider.d.ts +5 -28
  114. package/dist/src/google-provider.js +6 -141
  115. package/dist/src/graph-editor-session.d.ts +1 -0
  116. package/dist/src/graph-editor-session.js +2 -0
  117. package/dist/src/graph-health.js +3 -1
  118. package/dist/src/graph-runner.js +19 -13
  119. package/dist/src/graph-selection.d.ts +3 -1
  120. package/dist/src/graph-selection.js +2 -2
  121. package/dist/src/graph-server.d.ts +8 -1
  122. package/dist/src/graph-server.js +45 -10
  123. package/dist/src/graph-sync.d.ts +2 -1
  124. package/dist/src/graph-sync.js +13 -0
  125. package/dist/src/graph-ui/app.js +19 -8
  126. package/dist/src/graph-ui/index.html +1 -1
  127. package/dist/src/graphs.d.ts +17 -1
  128. package/dist/src/graphs.js +51 -5
  129. package/dist/src/grok-provider.js +17 -14
  130. package/dist/src/hardened-runtime.js +7 -4
  131. package/dist/src/jev-savings.d.ts +4 -0
  132. package/dist/src/jev-savings.js +13 -0
  133. package/dist/src/legal/client.d.ts +25 -0
  134. package/dist/src/legal/client.js +47 -0
  135. package/dist/src/legal/command.d.ts +13 -0
  136. package/dist/src/legal/command.js +98 -0
  137. package/dist/src/legal/documents.d.ts +2 -0
  138. package/dist/src/legal/documents.js +14 -0
  139. package/dist/src/legal/gate.d.ts +13 -0
  140. package/dist/src/legal/gate.js +96 -0
  141. package/dist/src/legal/manifest.d.ts +21 -0
  142. package/dist/src/legal/manifest.js +23 -0
  143. package/dist/src/legal/receipt.d.ts +13 -0
  144. package/dist/src/legal/receipt.js +137 -0
  145. package/dist/src/legal/release.d.ts +27 -0
  146. package/dist/src/legal/release.js +28 -0
  147. package/dist/src/managed-sign-in.d.ts +0 -1
  148. package/dist/src/managed-sign-in.js +0 -13
  149. package/dist/src/membership.d.ts +27 -1
  150. package/dist/src/membership.js +139 -7
  151. package/dist/src/model-metadata.js +3 -7
  152. package/dist/src/model-pool.d.ts +99 -0
  153. package/dist/src/model-pool.js +136 -0
  154. package/dist/src/model-relay/local.js +5 -0
  155. package/dist/src/model-relay/remote.d.ts +2 -0
  156. package/dist/src/model-relay/remote.js +4 -0
  157. package/dist/src/model-tiers.d.ts +13 -1
  158. package/dist/src/model-tiers.js +28 -4
  159. package/dist/src/opencode-cli-provider.js +59 -56
  160. package/dist/src/opencode-provider.js +16 -13
  161. package/dist/src/permissions.d.ts +5 -0
  162. package/dist/src/permissions.js +7 -0
  163. package/dist/src/plan-pass.js +2 -1
  164. package/dist/src/pool-scores.d.ts +45 -0
  165. package/dist/src/pool-scores.js +40 -0
  166. package/dist/src/provider-connection.js +3 -17
  167. package/dist/src/provider-engine.js +42 -12
  168. package/dist/src/provider-request-error.d.ts +8 -0
  169. package/dist/src/provider-request-error.js +12 -0
  170. package/dist/src/provider-settings.d.ts +1 -1
  171. package/dist/src/provider-settings.js +36 -18
  172. package/dist/src/provider-turn-deadline.d.ts +39 -0
  173. package/dist/src/provider-turn-deadline.js +139 -0
  174. package/dist/src/providers.d.ts +3 -9
  175. package/dist/src/providers.js +181 -146
  176. package/dist/src/pull-request-merge.d.ts +1 -8
  177. package/dist/src/pull-request-merge.js +0 -4
  178. package/dist/src/pull-requests.d.ts +82 -66
  179. package/dist/src/pull-requests.js +266 -276
  180. package/dist/src/qa/runtime/ProcessManager.d.ts +5 -1
  181. package/dist/src/qa/runtime/ProcessManager.js +9 -3
  182. package/dist/src/react-runtime.js +147 -56
  183. package/dist/src/reasoning-probe-cloud.d.ts +10 -0
  184. package/dist/src/reasoning-probe-cloud.js +209 -0
  185. package/dist/src/remote/engine-pool.d.ts +3 -0
  186. package/dist/src/remote/engine-pool.js +85 -18
  187. package/dist/src/remote/recovery.d.ts +6 -0
  188. package/dist/src/remote/recovery.js +37 -0
  189. package/dist/src/run-records.d.ts +13 -3
  190. package/dist/src/run-records.js +59 -34
  191. package/dist/src/runtime.d.ts +18 -1
  192. package/dist/src/runtime.js +25 -7
  193. package/dist/src/session-summary.d.ts +8 -0
  194. package/dist/src/session-summary.js +34 -0
  195. package/dist/src/sessions.d.ts +8 -0
  196. package/dist/src/sessions.js +12 -3
  197. package/dist/src/shell.js +6 -0
  198. package/dist/src/side-panel.js +36 -2
  199. package/dist/src/sign-in-detection.d.ts +1 -1
  200. package/dist/src/sign-in-detection.js +4 -10
  201. package/dist/src/sign-in-offer.js +1 -1
  202. package/dist/src/skill-commands.js +1 -1
  203. package/dist/src/skills/bundled/graph-manager/SKILL.md +2 -2
  204. package/dist/src/skills/bundled/graph-manager/patterns.md +13 -19
  205. package/dist/src/skills/bundled/provenance.json +2 -2
  206. package/dist/src/subagent-run.js +50 -50
  207. package/dist/src/subscription-usage.d.ts +50 -0
  208. package/dist/src/subscription-usage.js +92 -0
  209. package/dist/src/task-checkout.d.ts +20 -4
  210. package/dist/src/task-checkout.js +78 -8
  211. package/dist/src/telemetry/access.d.ts +18 -0
  212. package/dist/src/telemetry/access.js +43 -0
  213. package/dist/src/telemetry/aggregate.d.ts +18 -2
  214. package/dist/src/telemetry/aggregate.js +22 -9
  215. package/dist/src/telemetry/capture-core.d.ts +33 -14
  216. package/dist/src/telemetry/capture-core.js +124 -25
  217. package/dist/src/telemetry/capture.d.ts +3 -2
  218. package/dist/src/telemetry/capture.js +21 -1
  219. package/dist/src/telemetry/decision-capture.js +4 -0
  220. package/dist/src/telemetry/emitter.d.ts +6 -7
  221. package/dist/src/telemetry/emitter.js +124 -29
  222. package/dist/src/telemetry/gate.d.ts +41 -2
  223. package/dist/src/telemetry/gate.js +89 -4
  224. package/dist/src/telemetry/home.d.ts +1 -0
  225. package/dist/src/telemetry/home.js +20 -0
  226. package/dist/src/telemetry/identity.d.ts +6 -3
  227. package/dist/src/telemetry/identity.js +19 -6
  228. package/dist/src/telemetry/lifecycle.d.ts +8 -0
  229. package/dist/src/telemetry/lifecycle.js +76 -0
  230. package/dist/src/telemetry/outbox.d.ts +13 -8
  231. package/dist/src/telemetry/outbox.js +68 -12
  232. package/dist/src/telemetry/permission-command.d.ts +38 -0
  233. package/dist/src/telemetry/permission-command.js +208 -0
  234. package/dist/src/telemetry/permission.d.ts +168 -0
  235. package/dist/src/telemetry/permission.js +662 -0
  236. package/dist/src/telemetry/record-installation.d.ts +1 -0
  237. package/dist/src/telemetry/record-installation.js +9 -0
  238. package/dist/src/telemetry/region-data.d.ts +12 -0
  239. package/dist/src/telemetry/region-data.js +1314 -0
  240. package/dist/src/telemetry/region.d.ts +34 -0
  241. package/dist/src/telemetry/region.js +87 -0
  242. package/dist/src/telemetry/run-privacy.d.ts +11 -0
  243. package/dist/src/telemetry/run-privacy.js +165 -0
  244. package/dist/src/telemetry/schema.d.ts +27 -6
  245. package/dist/src/telemetry/schema.js +109 -14
  246. package/dist/src/telemetry/state.d.ts +11 -7
  247. package/dist/src/telemetry/state.js +39 -6
  248. package/dist/src/telemetry/surface.d.ts +20 -3
  249. package/dist/src/telemetry/surface.js +71 -15
  250. package/dist/src/telemetry/uploader.d.ts +6 -11
  251. package/dist/src/telemetry/uploader.js +72 -46
  252. package/dist/src/telemetry/uploads.d.ts +5 -1
  253. package/dist/src/telemetry/uploads.js +25 -6
  254. package/dist/src/telemetry/version.d.ts +5 -0
  255. package/dist/src/telemetry/version.js +34 -0
  256. package/dist/src/telemetry/workspace.d.ts +4 -1
  257. package/dist/src/telemetry/workspace.js +18 -3
  258. package/dist/src/terminal-ui.d.ts +3 -0
  259. package/dist/src/terminal-ui.js +48 -6
  260. package/dist/src/thinking-level-detect.d.ts +3 -1
  261. package/dist/src/thinking-level-detect.js +8 -3
  262. package/dist/src/thinking-levels.d.ts +1 -1
  263. package/dist/src/thinking-levels.js +11 -4
  264. package/dist/src/timers.d.ts +2 -0
  265. package/dist/src/todos.d.ts +2 -1
  266. package/dist/src/todos.js +24 -4
  267. package/dist/src/tool-argument-coercion.d.ts +7 -0
  268. package/dist/src/tool-argument-coercion.js +49 -0
  269. package/dist/src/tool-catalog.d.ts +2 -2
  270. package/dist/src/tools.js +67 -22
  271. package/dist/src/transcript.js +2 -1
  272. package/dist/src/types.d.ts +14 -1
  273. package/dist/src/update.js +4 -0
  274. package/dist/src/usage-analytics.d.ts +7 -0
  275. package/dist/src/usage-analytics.js +85 -13
  276. package/dist/telemetry-consent-v1 +1 -0
  277. package/package.json +97 -96
@@ -0,0 +1,38 @@
1
+ import type { Config } from '../config.js';
2
+ import { type TelemetryPermissionStatus } from '../telemetry/permission.js';
3
+ import { type TelemetryLocationSignals } from '../telemetry/region.js';
4
+ import type { TelemetryAccess } from '../telemetry/access.js';
5
+ import type { TelemetryStatusResult, TelemetrySetConsentResult } from './telemetry-protocol.js';
6
+ /** Strict, bounded transport. Errors never echo raw location hints. */
7
+ export declare function rendererTelemetryHints(value: unknown): TelemetryLocationSignals;
8
+ /** Purpose-limited shared run-file read; a blocked read never gets an analytics subtree. */
9
+ export declare function readTelemetryRunRecord(home: string, path: string, access?: TelemetryAccess): Promise<Record<string, unknown>>;
10
+ /** One execution process's transient protective context; never a second permission store. */
11
+ export declare class AppServerTelemetry {
12
+ readonly home: string;
13
+ private readonly changed;
14
+ private readonly invalidated;
15
+ private renderer?;
16
+ private lastStatus?;
17
+ private watcher?;
18
+ private permissionKey?;
19
+ private polling;
20
+ private watchEpoch;
21
+ constructor(home: string, changed: (result: TelemetryStatusResult) => void, invalidated?: () => void);
22
+ readonly signals: () => import("../telemetry/region.js").TelemetryRegionSignals;
23
+ private protectProcess;
24
+ private addRenderer;
25
+ permission(): Promise<TelemetryPermissionStatus>;
26
+ snapshot(): Promise<TelemetryStatusResult & {
27
+ analytics?: Config['analytics'] & {
28
+ plan: 'paid' | 'free' | 'legacy' | 'unknown';
29
+ canOptOut: boolean;
30
+ };
31
+ }>;
32
+ private publish;
33
+ status(params: Record<string, unknown>): Promise<TelemetryStatusResult>;
34
+ setConsent(params: Record<string, unknown>): Promise<TelemetrySetConsentResult>;
35
+ private poll;
36
+ watch(): void;
37
+ close(): void;
38
+ }
@@ -0,0 +1,163 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { getAuthStatus } from '../auth/index.js';
3
+ import { telemetryStatusGate } from '../telemetry/gate.js';
4
+ import { TELEMETRY_NOTICE, TELEMETRY_NOTICE_VERSION, TelemetryPrivacyError, setTelemetryConsent, telemetryPermission, withTelemetryAdmission } from '../telemetry/permission.js';
5
+ import { readLocalTelemetrySignals, resolveTelemetryRegion } from '../telemetry/region.js';
6
+ import { scrubRuns, functionalRunRecord } from '../run-records.js';
7
+ import { admittedRunRecord } from '../telemetry/run-privacy.js';
8
+ /** Strict, bounded transport. Errors never echo raw location hints. */
9
+ export function rendererTelemetryHints(value) {
10
+ if (!value || typeof value !== 'object' || Array.isArray(value))
11
+ throw new TelemetryPrivacyError('invalid-params', 'renderer must be an object');
12
+ const hints = value;
13
+ if (Object.keys(hints).some(key => key !== 'timeZone' && key !== 'locales'))
14
+ throw new TelemetryPrivacyError('invalid-params', 'renderer accepts only timeZone and locales');
15
+ const signal = (entry) => typeof entry === 'string' && entry.length <= 128 && !/[\u0000-\u001f\u007f]/.test(entry);
16
+ if (hints.timeZone !== undefined && !signal(hints.timeZone))
17
+ throw new TelemetryPrivacyError('invalid-params', 'timeZone must be a string of at most 128 characters');
18
+ if (hints.locales !== undefined && (!Array.isArray(hints.locales) || hints.locales.length > 4 || !hints.locales.every(signal)))
19
+ throw new TelemetryPrivacyError('invalid-params', 'locales must contain at most four strings of at most 128 characters');
20
+ return { ...(hints.timeZone === undefined ? {} : { timeZone: hints.timeZone }), ...(hints.locales === undefined ? {} : { locales: [...hints.locales] }) };
21
+ }
22
+ function wireStatus(permission) {
23
+ const { permitted, reason, ...status } = permission;
24
+ return { ...status, report: permitted, reason: reason === 'outside-policy' ? 'included-with-plan' : reason };
25
+ }
26
+ /** Purpose-limited shared run-file read; a blocked read never gets an analytics subtree. */
27
+ export async function readTelemetryRunRecord(home, path, access) {
28
+ const read = async () => JSON.parse(await readFile(path, 'utf8'));
29
+ const admitted = await withTelemetryAdmission({ home, signals: access?.signals }, async (admission) => admittedRunRecord(await read(), admission.lease), access?.lease);
30
+ return admitted ?? functionalRunRecord(await read());
31
+ }
32
+ /** One execution process's transient protective context; never a second permission store. */
33
+ export class AppServerTelemetry {
34
+ home;
35
+ changed;
36
+ invalidated;
37
+ renderer;
38
+ lastStatus;
39
+ watcher;
40
+ permissionKey;
41
+ polling = false;
42
+ watchEpoch = 0;
43
+ constructor(home, changed, invalidated = () => { }) {
44
+ this.home = home;
45
+ this.changed = changed;
46
+ this.invalidated = invalidated;
47
+ // Must run before recovery, membership, configuration or any producer. Missing transport is
48
+ // normal for CLI hosts. Malformed supplied transport is not evidence for an outside waiver.
49
+ const raw = process.env.ANDORRA_TELEMETRY_RENDERER_HINTS;
50
+ // Consume the transport before parsing: even malformed hints must not reach tools, MCP or PTYs.
51
+ delete process.env.ANDORRA_TELEMETRY_RENDERER_HINTS;
52
+ if (raw !== undefined) {
53
+ try {
54
+ if (raw.length > 4096)
55
+ throw new Error();
56
+ this.addRenderer(rendererTelemetryHints(JSON.parse(raw)));
57
+ }
58
+ catch {
59
+ this.protectProcess();
60
+ }
61
+ }
62
+ }
63
+ signals = () => readLocalTelemetrySignals({ renderer: this.renderer });
64
+ protectProcess() {
65
+ // Some functional membership/graph helpers own their own nested telemetry calls. The process-
66
+ // local, one-way ask policy protects those too, and is inherited before any child can start.
67
+ // This is NOT a shell export, a persisted hint or affirmative permission. Never restore auto.
68
+ process.env.ANDORRA_TELEMETRY_POLICY = 'ask';
69
+ }
70
+ addRenderer(hints) {
71
+ // Keep only a bounded protective representative, not an accumulating location history.
72
+ if (resolveTelemetryRegion({ renderer: hints }).region === 'in') {
73
+ this.renderer = hints;
74
+ this.protectProcess();
75
+ }
76
+ }
77
+ permission() { return telemetryPermission({ home: this.home, signals: this.signals }); }
78
+ async snapshot() {
79
+ const gate = await telemetryStatusGate({ home: this.home, signals: this.signals, subject: async () => {
80
+ const auth = await getAuthStatus(undefined, { readOnly: true }).catch(() => undefined); // no refresh or recovery write
81
+ return auth?.signedIn ? auth.subject : undefined;
82
+ } });
83
+ this.permissionKey = JSON.stringify(gate.permission);
84
+ return { status: { ...wireStatus(gate.permission), report: gate.report, canChange: gate.canOptOut,
85
+ reason: gate.permission.permissionRequired ? wireStatus(gate.permission).reason : gate.plan === 'paid' ? 'paid-preference' : 'included-with-plan' },
86
+ notice: TELEMETRY_NOTICE,
87
+ ...(!gate.permission.permissionRequired ? { analytics: { ...gate.savedAnalytics, plan: gate.plan, canOptOut: gate.canOptOut } } : {}) };
88
+ }
89
+ publish(result) {
90
+ const key = JSON.stringify(result);
91
+ if (this.lastStatus !== key) {
92
+ this.lastStatus = key;
93
+ this.changed(result);
94
+ }
95
+ }
96
+ async status(params) {
97
+ if (Object.keys(params).some(key => key !== 'renderer'))
98
+ throw new TelemetryPrivacyError('invalid-params', 'telemetry.status accepts only renderer');
99
+ if (Object.hasOwn(params, 'renderer'))
100
+ this.addRenderer(rendererTelemetryHints(params.renderer));
101
+ const { status, notice } = await this.snapshot();
102
+ const result = { status, notice };
103
+ this.publish(result);
104
+ return result;
105
+ }
106
+ async setConsent(params) {
107
+ const { answer, expectedRevision, noticeVersion } = params;
108
+ if (Object.keys(params).some(key => !['answer', 'expectedRevision', 'noticeVersion'].includes(key)) || (answer !== 'yes' && answer !== 'no')
109
+ || !Number.isSafeInteger(expectedRevision) || expectedRevision < 0 || noticeVersion !== TELEMETRY_NOTICE_VERSION) {
110
+ throw new TelemetryPrivacyError('invalid-params', 'answer, a nonnegative expectedRevision and the current noticeVersion are required');
111
+ }
112
+ const current = await this.permission();
113
+ if (!current.permissionRequired)
114
+ throw new TelemetryPrivacyError('invalid-params', 'Outside protected policy, use the saved analytics preference');
115
+ // Avoid cancelling live work for an already-known stale refusal. The store still performs
116
+ // the authoritative CAS under its barrier; a race after this read remains fail-closed.
117
+ if (expectedRevision !== current.revision && !(answer === 'no' && current.answer === 'no')) {
118
+ return { saved: false, conflict: true, status: wireStatus(current), notice: TELEMETRY_NOTICE };
119
+ }
120
+ const update = await setTelemetryConsent({ home: this.home, signals: this.signals }, { action: answer === 'yes' ? 'allow' : 'deny', expectedRevision: expectedRevision, noticeVersion: noticeVersion }, scrubRuns);
121
+ const result = { ...update, status: wireStatus(update.status), notice: TELEMETRY_NOTICE };
122
+ this.publish({ status: result.status, notice: result.notice });
123
+ return result;
124
+ }
125
+ async poll(epoch) {
126
+ if (this.polling)
127
+ return;
128
+ this.polling = true;
129
+ try {
130
+ // A display poll never resolves a subject, reads analytics config/cache, or takes auth's
131
+ // machine-wide lock. Only explicit status/config reads need those outside-plan details.
132
+ const permission = await this.permission();
133
+ if (!this.watcher || epoch !== this.watchEpoch)
134
+ return;
135
+ const key = JSON.stringify(permission);
136
+ if (key === this.permissionKey)
137
+ return;
138
+ this.permissionKey = key;
139
+ if (permission.permissionRequired)
140
+ this.publish({ status: wireStatus(permission), notice: TELEMETRY_NOTICE });
141
+ else
142
+ this.invalidated(); // request a real display refresh; never invent outside plan/reporting
143
+ }
144
+ finally {
145
+ this.polling = false;
146
+ }
147
+ }
148
+ watch() {
149
+ if (this.watcher)
150
+ return;
151
+ const epoch = ++this.watchEpoch;
152
+ // Missing privacy/ is normal. No mkdir/prompt election, no overlapping reads, and a slower
153
+ // necessary-state poll. Local writes and desktop focus/status already refresh immediately.
154
+ this.watcher = setInterval(() => { void this.poll(epoch).catch(() => { }); }, 2000);
155
+ this.watcher.unref();
156
+ }
157
+ close() {
158
+ if (this.watcher)
159
+ clearInterval(this.watcher);
160
+ this.watcher = undefined;
161
+ this.watchEpoch++;
162
+ }
163
+ }
@@ -31,7 +31,9 @@ export declare function imageTypeOf(path: string): string | undefined;
31
31
  * A project image's bytes, base64, for the Files tab's preview (`workspace.image`). `tooLarge` past 10 MB, with no
32
32
  * bytes. The type comes from the extension only: the desktop draws it in an <img>, which never runs an SVG's script.
33
33
  */
34
- export declare function readWorkspaceImage(root: string, name: unknown): Promise<{
34
+ export declare function readWorkspaceImage(root: string, name: unknown, options?: {
35
+ outside?: boolean;
36
+ }): Promise<{
35
37
  mimeType: string;
36
38
  size: number;
37
39
  dataBase64?: string;
@@ -4,8 +4,10 @@ import { createReadStream } from 'node:fs';
4
4
  import { opendir, open, readFile, readdir, realpath, stat } from 'node:fs/promises';
5
5
  import { StringDecoder } from 'node:string_decoder';
6
6
  import { dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from 'node:path';
7
+ import { readTelemetryRunRecord } from './telemetry.js';
7
8
  import { runRecordPath, runRecordsDirectory, sessionHasOpenRun } from '../run-records.js';
8
9
  import { validSavedSession } from '../sessions.js';
10
+ import { decodeDoubleEscapedSummary, stripEchoedEnvelope } from '../completion.js';
9
11
  import { listBundles } from '../extensions.js';
10
12
  import { builtinSkillEntries } from '../skills/invocable-skills.js';
11
13
  const SKIP_NAMES = new Set(['.git', '.andorracode']);
@@ -172,12 +174,27 @@ export const MAX_IMAGE_BYTES = 10 * 1024 * 1024;
172
174
  export function imageTypeOf(path) {
173
175
  return IMAGE_TYPES[extname(path).toLowerCase()];
174
176
  }
177
+ /**
178
+ * An image path for the chat's preview of a Read, which may have looked at an image anywhere on this machine: resolved
179
+ * from the project, links followed, and not held to the project. The caller still accepts only an image file, judged
180
+ * by the followed path's extension, so a link named `.png` cannot reach a file of another kind.
181
+ */
182
+ async function resolveImageAnywhere(root, name) {
183
+ if (typeof name !== 'string' || !name || name.length > 4096 || name.includes('\0'))
184
+ throw new Error('An image path must be a string of up to 4096 characters');
185
+ const candidate = resolve(root, name);
186
+ return realpath(candidate).catch((error) => {
187
+ if (error.code === 'ENOENT')
188
+ return candidate;
189
+ throw error;
190
+ });
191
+ }
175
192
  /**
176
193
  * A project image's bytes, base64, for the Files tab's preview (`workspace.image`). `tooLarge` past 10 MB, with no
177
194
  * bytes. The type comes from the extension only: the desktop draws it in an <img>, which never runs an SVG's script.
178
195
  */
179
- export async function readWorkspaceImage(root, name) {
180
- const path = await resolveInside(root, name);
196
+ export async function readWorkspaceImage(root, name, options = {}) {
197
+ const path = options.outside ? await resolveImageAnywhere(root, name) : await resolveInside(root, name);
181
198
  const mimeType = imageTypeOf(path);
182
199
  if (!mimeType)
183
200
  throw new Error('This file is not an image the Files tab can show');
@@ -704,12 +721,12 @@ async function readJournalTail(path, limit) {
704
721
  await handle?.close().catch(() => { });
705
722
  }
706
723
  }
707
- // Events that say which graph nodes and subagents ran. A long run's journal is read from its tail,
708
- // and without these the desktop's Graph list loses every node and subagent that started before the
709
- // newest events: a long run's entry node went missing that way.
724
+ // Keep graph and subagent metadata and answered questions from before the journal tail.
725
+ // The desktop uses these to restore the graph outline and inline question history.
710
726
  const OUTLINE_TYPES = [
711
727
  'graph.started', 'graph.node.started', 'graph.node.completed', 'graph.finalization.resumed', 'graph.completed', 'graph.stopped',
712
728
  'graph.todos.updated', 'graph.widgets.updated', 'subagent.started', 'subagent.completed', 'subagent.change',
729
+ 'agent.clarification.answered',
713
730
  ];
714
731
  // Journal lines are written as {"type":"…",…}, so a line is matched on its opening bytes.
715
732
  const OUTLINE_PREFIXES = OUTLINE_TYPES.map(type => Buffer.from(`{"type":"${type}"`));
@@ -816,11 +833,11 @@ async function readJournalOutline(path, end, collector) {
816
833
  }
817
834
  }
818
835
  // `events` is the newest part of the journal. When older events were left out, `outline` carries
819
- // the graph, node and subagent events among them, in journal order, so a reader can still tell
820
- // which nodes and subagents ran.
836
+ // selected graph, node, subagent and clarification events among them, in journal order.
821
837
  export async function readRun(directory, id) {
822
838
  const path = runRecordPath(directory, id, 'json');
823
- const result = JSON.parse(await readFile(path, 'utf8'));
839
+ const result = await readTelemetryRunRecord(directory, path);
840
+ displayRunCompletion(result);
824
841
  const journal = runRecordPath(directory, id, 'jsonl');
825
842
  const { lines, start, truncated } = await readJournalTail(journal, MAX_RUN_EVENTS);
826
843
  const parsed = [];
@@ -848,6 +865,20 @@ export async function readRun(directory, id) {
848
865
  const outline = collector.events();
849
866
  return { result, events, truncated, ...(outline.length > 0 ? { outline } : {}) };
850
867
  }
868
+ /** The record's completion summary is display text: restore line breaks its JSON escaped away, as saved sessions do. */
869
+ function displayRunCompletion(result) {
870
+ if (!result || typeof result !== 'object')
871
+ return;
872
+ const completion = result.completion;
873
+ if (!completion || typeof completion !== 'object')
874
+ return;
875
+ const record = completion;
876
+ if (typeof record.summary !== 'string')
877
+ return;
878
+ const summary = stripEchoedEnvelope(decodeDoubleEscapedSummary(record.summary), typeof record.outcome === 'string' ? record.outcome : undefined);
879
+ if (summary !== record.summary)
880
+ record.summary = summary;
881
+ }
851
882
  export async function runRecordFile(directory, id) {
852
883
  const path = resolve(runRecordPath(directory, id, 'json'));
853
884
  let raw;
@@ -1,4 +1,5 @@
1
1
  import { type Config } from './config.js';
2
+ import { AppServerTelemetry } from './app-server/telemetry.js';
2
3
  import { type ProviderConfig } from './providers.js';
3
4
  import { removeCodexAccount } from './codex-auth.js';
4
5
  import { CodexAccountAuth } from './codex-browser-auth.js';
@@ -40,7 +41,7 @@ export interface CloudView {
40
41
  deleteAt?: string;
41
42
  error?: 'boot_timeout' | 'no_capacity';
42
43
  stopReason?: CloudStatus['stopReason'];
43
- /** True when the instance runs a different version from this engine. */
44
+ /** True when a bridge without automatic updates was booted for a different desktop engine version. */
44
45
  outdated: boolean;
45
46
  }
46
47
  export type RelayLinkPort = Pick<RelayLink, 'open' | 'request' | 'host' | 'close' | 'presence' | 'dispose'>;
@@ -67,7 +68,6 @@ export interface AppServerOptions {
67
68
  managedSignIn?: {
68
69
  claude?: ManagedSignInService;
69
70
  grok?: ManagedSignInService;
70
- google?: ManagedSignInService;
71
71
  opencode?: OpenCodeSignInService;
72
72
  };
73
73
  signInProbes?: Partial<SignInProbes>;
@@ -111,6 +111,7 @@ export declare class AppServer {
111
111
  private readonly manualAutomationTasks;
112
112
  private readonly automationController;
113
113
  private readonly directory;
114
+ readonly telemetry: AppServerTelemetry;
114
115
  private readonly output;
115
116
  private readonly error;
116
117
  private readonly checkGraphHealth;
@@ -121,7 +122,6 @@ export declare class AppServer {
121
122
  private readonly anthropicAuth;
122
123
  private readonly claudeSignIn;
123
124
  private readonly grokSignIn;
124
- private readonly googleSignIn;
125
125
  private readonly openCodeSignIn;
126
126
  private readonly signInProbes;
127
127
  private readonly detectedSignIns;
@@ -136,18 +136,17 @@ export declare class AppServer {
136
136
  private readonly githubEvents;
137
137
  /** "@andorra-code" mentions on a task's PR (phase 3): the access check, the 👀 and the wake. */
138
138
  private readonly mentions;
139
- /** The App's bot login (`bot` from `GET /v1/github`, or `as` from a bot write), for the Auto-fix prompt. */
139
+ /** The App's bot login (`bot` from `GET /v1/github`, or `as` from a bot write), for review findings. */
140
140
  private githubBot?;
141
141
  private readonly pullRequestReader;
142
142
  private readonly sessionChanges;
143
- private readonly autoFixWakes;
144
143
  /** Wakes the PR tab's Fix with Agent armed: delivered as the person's request, not as a timer. */
145
144
  private readonly fixWakes;
146
145
  /** Wakes a mention of the App's bot on the task's PR armed: delivered as "Mentioned on GitHub", not as a timer. */
147
146
  private readonly mentionWakes;
148
147
  private readonly reviewWaiters;
149
148
  private readonly reviewWaitsStarting;
150
- /** The Andorra review loop's fixer wakes, beside Auto-fix's: delivered as "Andorra review", routed like Auto-fix's. */
149
+ /** The Andorra review loop's fixer wakes, routed to the node that took the pull request. */
151
150
  private readonly reviewWakes;
152
151
  /** Each review wait's run, when it started, and the review loop it watches (the one running when it started, or after). */
153
152
  private readonly reviewWaitRuns;
@@ -224,6 +223,7 @@ export declare class AppServer {
224
223
  private readonly sessionTitles;
225
224
  /** Automatic titles waiting to be asked again, by session, after an attempt was refused, failed, or cut short. */
226
225
  private readonly titleRetries;
226
+ private readonly draftGraphProbes;
227
227
  private readonly operations;
228
228
  private prepareTask?;
229
229
  private foreignEngineWatch?;
@@ -232,6 +232,8 @@ export declare class AppServer {
232
232
  private codeIntel?;
233
233
  private codeIntelOpening;
234
234
  private readonly engineLinks;
235
+ /** The telemetry lease in force when the current GitHub watch window began; its counts are reported only under that lease. */
236
+ private githubWatchLease;
235
237
  private readonly environmentOptions;
236
238
  private relay?;
237
239
  private environmentIds?;
@@ -243,6 +245,8 @@ export declare class AppServer {
243
245
  /** Bumped when the account changes, so an answer fetched for the previous account is never cached. */
244
246
  private accountGeneration;
245
247
  private closed;
248
+ private readonly antigravityStartups;
249
+ private readonly antigravitySessions;
246
250
  private emitsStopped;
247
251
  private readonly hosted;
248
252
  private hostedStarted;
@@ -284,6 +288,7 @@ export declare class AppServer {
284
288
  handle(line: string): Promise<void>;
285
289
  private dispatchLine;
286
290
  private write;
291
+ private antigravityRequest;
287
292
  private dispatch;
288
293
  private store;
289
294
  private listableWorkspace;
@@ -292,6 +297,7 @@ export declare class AppServer {
292
297
  private slotLock;
293
298
  private setConfig;
294
299
  private projectExtensionEntry;
300
+ private workspacePermissionEntry;
295
301
  private setProjectExtensionEntry;
296
302
  private extensionKind;
297
303
  private skillResources;
@@ -322,9 +328,19 @@ export declare class AppServer {
322
328
  private testProviderEndpoint;
323
329
  private thinkingLevelTarget;
324
330
  private thinkingLevelsView;
331
+ private getThinkingLevels;
325
332
  /** Finds out which thinking levels a model accepts and saves them. An inconclusive answer saves nothing. */
326
333
  private detectThinkingLevels;
334
+ private flushReasoningProbeQueue;
327
335
  private setThinkingLevels;
336
+ /** The subscription usage windows of every provider whose client reports them, by provider id. */
337
+ private providerUsage;
338
+ /**
339
+ * Scores every configured model from published benchmarks (the average of three providers' general-purpose scores,
340
+ * at each thinking level they list) and saves the scores that routing chooses by
341
+ * (`efficiency.adaptiveRouting.scores`). A refresh that scores no model saves nothing.
342
+ */
343
+ private refreshRoutingScores;
328
344
  private saveThinkingLevels;
329
345
  private operation;
330
346
  private accountStatus;
@@ -369,7 +385,10 @@ export declare class AppServer {
369
385
  private setSessionReviewed;
370
386
  /** Pins or unpins a task in the rail. The pin is rail-owned like a rename, so this window's own run may be pinned too: the run carries it forward when it saves. */
371
387
  private setSessionPinned;
388
+ /** Moves a task into another project folder: the rail lists it there, and its next run works there. */
389
+ private setSessionWorkspace;
372
390
  private deleteSession;
391
+ private beginRunTelemetry;
373
392
  private startRun;
374
393
  private resumeRun;
375
394
  private switchBranch;
@@ -392,6 +411,13 @@ export declare class AppServer {
392
411
  /** Saves an automatic title under the same lock and guards a user rename takes. */
393
412
  /** `saved`: the name landed. `busy`: a run owns the session — the title can land once it settles. `stale`: the record is gone, renamed, already carrying the name, or waiting on a failed final save that recovery owns. */
394
413
  private saveSessionTitle;
414
+ /**
415
+ * Names a new task's branch from a model summary of the task (`task/fix-login-redirect-loop`), replacing the random
416
+ * id the start gave it. Runs once the run has answered once, beside the title work. Any failure keeps the random
417
+ * id: the branch name is a nicety, never worth a retry of its own.
418
+ */
419
+ private nameWorktreeBranch;
420
+ private nameWorktreeBranchTracked;
395
421
  /** A title that never landed waits and asks again, so one busy moment does not leave the session with its prompt's first words. */
396
422
  private scheduleTitleRetry;
397
423
  private retrySessionTitle;
@@ -450,6 +476,9 @@ export declare class AppServer {
450
476
  private importGraphVisibilityMethod;
451
477
  private exportAgent;
452
478
  private getGraph;
479
+ private checkDraftGraphModels;
480
+ private graphModelWarning;
481
+ private graphProviderWarning;
453
482
  private selectGraph;
454
483
  private openEditor;
455
484
  private closeEditor;
@@ -482,6 +511,12 @@ export declare class AppServer {
482
511
  private refuseWhileReconnecting;
483
512
  private hostOperation;
484
513
  private remoteEngineConnect;
514
+ /**
515
+ * Relayed work reaches only a machine that proved it asks before product telemetry and, for coding or policy
516
+ * calls, that it records policy acceptance. The proof is the capabilities its `whoami` named for this link; a
517
+ * machine that could not be asked is refused, never assumed capable.
518
+ */
519
+ private assertRemotePolicy;
485
520
  /** What the machine's `whoami` adds to its host description (grant, capabilities); undefined when it could not be read. */
486
521
  private machineIdentity;
487
522
  /** A reopen whose `whoami` failed asks again once the link is up, and reports the full host with another `reopened`. */
@@ -603,6 +638,7 @@ export declare class AppServer {
603
638
  private listTimers;
604
639
  private emitSessionSkills;
605
640
  private updateSessionSkill;
641
+ private pullRequestForClient;
606
642
  private emitPullRequest;
607
643
  /**
608
644
  * The end of the review loop a wait watches: the loop running when the wait started, or the first one switched on
@@ -612,22 +648,13 @@ export declare class AppServer {
612
648
  /** A wait ended: the marker that held the review loop's round for it goes, unless a newer wait wrote its own. */
613
649
  private clearReviewWaiting;
614
650
  private awaitReview;
615
- /**
616
- * One read of Codex's signals on a waiting session's PR; answers how long until the next read.
617
- *
618
- * A sign-off on the head commit ends the wait as approved, unless a review comment is still to be handed
619
- * over: comments come first. Where Codex shows nothing at all for the head (no eyes, no review, no comment,
620
- * nobody asked yet), the next read comes after the bump delay, and if that one is as quiet the wait posts
621
- * "@codex review", once per head and only in a repository Codex is known to review.
622
- */
651
+ /** Polls GitHub only while the agent has an explicit wait. The record stores activity already reported. */
623
652
  private reviewWaitFromSignals;
624
653
  /**
625
654
  * One look at the record for a wait, in whichever engine process it runs: how the PR or the review loop ended, the
626
- * review loop's next round (taken from the record, so a round another process posted reaches this wait), Auto-fix's
627
- * comments, and the marker that tells the lease holder this run waits.
655
+ * review loop's next round (including one posted by another engine), and the marker that this run is waiting.
628
656
  */
629
657
  private reviewWaitFromRecord;
630
- private recordAutoFixDelivered;
631
658
  private emitSessionChanges;
632
659
  private attachPullRequest;
633
660
  /** How many turns a task's history holds, a running turn included, for the review loop's transcript lines. */
@@ -669,10 +696,10 @@ export declare class AppServer {
669
696
  * gh becomes `not-installed`, with the hint to install the App there: the service never says "not installed".
670
697
  */
671
698
  private githubStatus;
672
- /** Settings → GitHub → "Agent replies on pull requests": `bot` (as the App's bot) or `me` (through gh as the person). Per engine. */
699
+ /** Settings → GitHub → Agent replies on pull requests. */
673
700
  private githubSetAgentWrites;
674
701
  /**
675
- * Who an agent write on this session's PR goes to first, decided one way for the tool and the Auto-fix prompt:
702
+ * Who an agent write on this session's PR goes to first, decided one way for the tool and review findings:
676
703
  * the setting, and the PR's coverage as the event source (or, in another process, the lease holder) last
677
704
  * learned it. Events switched off here, or a PR the source has not looked at yet, are not covered.
678
705
  */
@@ -681,8 +708,8 @@ export declare class AppServer {
681
708
  private agentPullRequestWrite;
682
709
  /** The App's bot login: `GET /v1/github`'s `bot`, read once (bounded) and kept, or learned from a write's `as`. */
683
710
  private githubBotName;
684
- /** For the Auto-fix prompt: whether this session's replies post as the bot (the tool's own rule), and the bot's name. */
685
- private autoFixWrites;
711
+ /** For review findings: whether this session's replies post as the bot (the tool's own rule), and the bot's name. */
712
+ private reviewCommentWrites;
686
713
  /**
687
714
  * For a mention's prompt: who the agent's answer posts as on this session's PR (the pull_request tool's rule),
688
715
  * and the bot's login, which also names the mention (`@andorra-code`, `@andorra-code-dev` on staging).
@@ -729,7 +756,7 @@ export declare class AppServer {
729
756
  /** A merge-side write's answer, with the merge state read again so the tab shows what GitHub now holds. */
730
757
  private afterMergeWrite;
731
758
  /**
732
- * Merges the task's PR now, or sets it to merge when ready (GitHub's auto-merge), with the method and
759
+ * Merges the task's PR or adds it to the merge queue. A direct merge uses the method and
733
760
  * commit message the person chose, at the head commit they read. Deleting the head branch afterwards
734
761
  * is said separately: the merge has happened even when that fails.
735
762
  */
@@ -797,15 +824,13 @@ export declare class AppServer {
797
824
  * answer), and asks the watcher to catch up on a state it has not seen.
798
825
  */
799
826
  private syncPullRequestRecord;
800
- private cancelAutoFixWake;
801
827
  private pullRequestControl;
802
828
  /**
803
829
  * The Andorra review loop's fixer wake: straight into a run of the session waiting in await_review here (which then holds
804
- * the round), or as the next turn, routed like Auto-fix's to the node that took the PR.
830
+ * the round), or as the next turn at the node that took the PR.
805
831
  */
806
832
  private wakeForReview;
807
833
  private cancelReviewWake;
808
- private wakeForPullRequest;
809
834
  private emitTimers;
810
835
  private settleSessionTimers;
811
836
  private armTimerCheck;