@andorra-labs/code 0.1.16 → 0.1.18

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 (236) hide show
  1. package/dist/src/acp-agent.d.ts +6 -0
  2. package/dist/src/acp-agent.js +15 -4
  3. package/dist/src/agent-execution.js +108 -19
  4. package/dist/src/agent-mcp-catalog.js +1 -0
  5. package/dist/src/agent-mcp.d.ts +3 -0
  6. package/dist/src/agent-mcp.js +33 -1
  7. package/dist/src/andorra/entry.d.ts +10 -0
  8. package/dist/src/andorra/entry.js +18 -4
  9. package/dist/src/andorra/errors.js +3 -0
  10. package/dist/src/andorra/hosted.d.ts +2 -1
  11. package/dist/src/andorra/hosted.js +2 -1
  12. package/dist/src/andorra/notices.d.ts +5 -0
  13. package/dist/src/andorra/notices.js +7 -0
  14. package/dist/src/andorra/state.d.ts +3 -2
  15. package/dist/src/andorra/state.js +4 -4
  16. package/dist/src/andorra/terminal.js +7 -2
  17. package/dist/src/anthropic-credentials.js +2 -0
  18. package/dist/src/app-server/error.d.ts +5 -0
  19. package/dist/src/app-server/error.js +7 -0
  20. package/dist/src/app-server/protocol.d.ts +30 -44
  21. package/dist/src/app-server/protocol.js +5 -1
  22. package/dist/src/app-server/workspace.d.ts +108 -0
  23. package/dist/src/app-server/workspace.js +608 -11
  24. package/dist/src/app-server.d.ts +390 -33
  25. package/dist/src/app-server.js +3033 -565
  26. package/dist/src/attachments.d.ts +10 -0
  27. package/dist/src/attachments.js +102 -7
  28. package/dist/src/automation-tool.js +2 -1
  29. package/dist/src/bridge/cloud.d.ts +27 -0
  30. package/dist/src/bridge/cloud.js +187 -0
  31. package/dist/src/bridge/command.d.ts +30 -0
  32. package/dist/src/bridge/command.js +359 -0
  33. package/dist/src/bridge/control.d.ts +70 -0
  34. package/dist/src/bridge/control.js +238 -0
  35. package/dist/src/bridge/engines.d.ts +90 -0
  36. package/dist/src/bridge/engines.js +601 -0
  37. package/dist/src/bridge/github.d.ts +108 -0
  38. package/dist/src/bridge/github.js +378 -0
  39. package/dist/src/bridge/host-ops.d.ts +9 -0
  40. package/dist/src/bridge/host-ops.js +139 -0
  41. package/dist/src/bridge/host.d.ts +47 -0
  42. package/dist/src/bridge/host.js +543 -0
  43. package/dist/src/bridge/link.d.ts +38 -0
  44. package/dist/src/bridge/link.js +508 -0
  45. package/dist/src/bridge/login-link.d.ts +29 -0
  46. package/dist/src/bridge/login-link.js +54 -0
  47. package/dist/src/bridge/protocol.d.ts +136 -0
  48. package/dist/src/bridge/protocol.js +11 -0
  49. package/dist/src/bridge/store.d.ts +12 -0
  50. package/dist/src/bridge/store.js +61 -0
  51. package/dist/src/bridge/wording.d.ts +6 -0
  52. package/dist/src/bridge/wording.js +10 -0
  53. package/dist/src/browser-server.js +7 -1
  54. package/dist/src/browser-ui/tokens.css +1 -1
  55. package/dist/src/bug-report-attachments.d.ts +48 -0
  56. package/dist/src/bug-report-attachments.js +327 -0
  57. package/dist/src/bug-report.d.ts +23 -3
  58. package/dist/src/bug-report.js +72 -9
  59. package/dist/src/change-authors.d.ts +41 -0
  60. package/dist/src/change-authors.js +146 -0
  61. package/dist/src/cli.d.ts +1 -3
  62. package/dist/src/cli.js +191 -35
  63. package/dist/src/codex-provider.js +1 -1
  64. package/dist/src/coding-tools.js +24 -17
  65. package/dist/src/command-screens.d.ts +6 -0
  66. package/dist/src/command-screens.js +14 -11
  67. package/dist/src/commands.d.ts +15 -3
  68. package/dist/src/commands.js +2 -1
  69. package/dist/src/compaction-phrases.js +1 -1
  70. package/dist/src/completion.js +89 -8
  71. package/dist/src/config.d.ts +71 -3
  72. package/dist/src/config.js +205 -78
  73. package/dist/src/context-budget.js +15 -2
  74. package/dist/src/deadline.js +13 -1
  75. package/dist/src/decision/DecisionEngine.d.ts +2 -0
  76. package/dist/src/decision/DecisionManager.d.ts +11 -0
  77. package/dist/src/decision/DecisionManager.js +36 -0
  78. package/dist/src/decision/applyTaskKind.d.ts +8 -0
  79. package/dist/src/decision/applyTaskKind.js +53 -0
  80. package/dist/src/decision/checks.js +1 -1
  81. package/dist/src/decision/hostedPolicy.js +2 -1
  82. package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -0
  83. package/dist/src/decision/providers/AndorraDecisionProvider.js +12 -0
  84. package/dist/src/decision/requestPhrases.js +0 -1
  85. package/dist/src/decision/taskKind.d.ts +52 -0
  86. package/dist/src/decision/taskKind.js +76 -0
  87. package/dist/src/decision/types.d.ts +1 -1
  88. package/dist/src/default-graph.js +1 -1
  89. package/dist/src/efficiency.d.ts +5 -0
  90. package/dist/src/efficiency.js +5 -1
  91. package/dist/src/effort-routing.d.ts +27 -0
  92. package/dist/src/effort-routing.js +34 -0
  93. package/dist/src/evidence.d.ts +110 -0
  94. package/dist/src/evidence.js +195 -0
  95. package/dist/src/file-diff.d.ts +4 -0
  96. package/dist/src/file-diff.js +2 -1
  97. package/dist/src/github-app/agent-writes.d.ts +102 -0
  98. package/dist/src/github-app/agent-writes.js +320 -0
  99. package/dist/src/github-app/client.d.ts +368 -0
  100. package/dist/src/github-app/client.js +830 -0
  101. package/dist/src/github-app/event-source.d.ts +208 -0
  102. package/dist/src/github-app/event-source.js +684 -0
  103. package/dist/src/github-app/metrics.d.ts +32 -0
  104. package/dist/src/github-app/metrics.js +49 -0
  105. package/dist/src/github-app/review-loop.d.ts +274 -0
  106. package/dist/src/github-app/review-loop.js +1177 -0
  107. package/dist/src/github-app/review-node.d.ts +81 -0
  108. package/dist/src/github-app/review-node.js +205 -0
  109. package/dist/src/github-app/review-post.d.ts +73 -0
  110. package/dist/src/github-app/review-post.js +139 -0
  111. package/dist/src/github-app/review-text.d.ts +107 -0
  112. package/dist/src/github-app/review-text.js +1133 -0
  113. package/dist/src/github-app/review-threads.d.ts +47 -0
  114. package/dist/src/github-app/review-threads.js +107 -0
  115. package/dist/src/github-app/reviewer.d.ts +121 -0
  116. package/dist/src/github-app/reviewer.js +598 -0
  117. package/dist/src/github-app/store.d.ts +59 -0
  118. package/dist/src/github-app/store.js +148 -0
  119. package/dist/src/github-app/triggers.d.ts +141 -0
  120. package/dist/src/github-app/triggers.js +441 -0
  121. package/dist/src/github-names.d.ts +15 -0
  122. package/dist/src/github-names.js +15 -0
  123. package/dist/src/glob-search.d.ts +61 -0
  124. package/dist/src/glob-search.js +180 -0
  125. package/dist/src/graph-health.js +6 -1
  126. package/dist/src/graph-manager-chat.js +1 -1
  127. package/dist/src/graph-preview.d.ts +48 -0
  128. package/dist/src/graph-preview.js +56 -0
  129. package/dist/src/graph-provider-portability.js +2 -1
  130. package/dist/src/graph-runner.js +65 -4
  131. package/dist/src/graph-server.js +7 -5
  132. package/dist/src/graph-sync.js +3 -3
  133. package/dist/src/graph-ui/app.js +121 -7
  134. package/dist/src/graph-ui/icons.js +2 -1
  135. package/dist/src/graph-ui/studio.js +15 -1
  136. package/dist/src/graph-ui/tokens.css +1 -1
  137. package/dist/src/graphs.d.ts +40 -1
  138. package/dist/src/graphs.js +164 -15
  139. package/dist/src/hardened-runtime.js +32 -21
  140. package/dist/src/image-input.d.ts +16 -0
  141. package/dist/src/image-input.js +41 -0
  142. package/dist/src/membership.d.ts +10 -0
  143. package/dist/src/membership.js +19 -4
  144. package/dist/src/model-health-cache.js +1 -1
  145. package/dist/src/model-metadata.d.ts +6 -0
  146. package/dist/src/model-metadata.js +35 -15
  147. package/dist/src/model-override.d.ts +2 -1
  148. package/dist/src/model-override.js +9 -0
  149. package/dist/src/model-relay/local.d.ts +116 -0
  150. package/dist/src/model-relay/local.js +468 -0
  151. package/dist/src/model-relay/remote.d.ts +129 -0
  152. package/dist/src/model-relay/remote.js +252 -0
  153. package/dist/src/model-relay/runs.d.ts +34 -0
  154. package/dist/src/model-relay/runs.js +146 -0
  155. package/dist/src/model-relay/wire.d.ts +5 -0
  156. package/dist/src/model-relay/wire.js +5 -0
  157. package/dist/src/model-tiers.d.ts +3 -0
  158. package/dist/src/model-tiers.js +3 -3
  159. package/dist/src/project-registry.d.ts +21 -0
  160. package/dist/src/project-registry.js +74 -0
  161. package/dist/src/provider-engine.d.ts +13 -1
  162. package/dist/src/provider-engine.js +74 -0
  163. package/dist/src/provider-import.d.ts +0 -12
  164. package/dist/src/provider-import.js +7 -195
  165. package/dist/src/providers.d.ts +28 -2
  166. package/dist/src/providers.js +59 -12
  167. package/dist/src/pull-request-logs.d.ts +12 -1
  168. package/dist/src/pull-request-logs.js +14 -3
  169. package/dist/src/pull-requests.d.ts +338 -8
  170. package/dist/src/pull-requests.js +482 -53
  171. package/dist/src/react-runtime.js +99 -16
  172. package/dist/src/remote/engine-pool.d.ts +88 -4
  173. package/dist/src/remote/engine-pool.js +367 -90
  174. package/dist/src/remote/roots.d.ts +19 -0
  175. package/dist/src/remote/roots.js +45 -7
  176. package/dist/src/remote/types.d.ts +0 -44
  177. package/dist/src/run-control.d.ts +7 -0
  178. package/dist/src/run-control.js +23 -0
  179. package/dist/src/run-records.d.ts +7 -2
  180. package/dist/src/run-records.js +71 -6
  181. package/dist/src/runtime.d.ts +34 -2
  182. package/dist/src/runtime.js +18 -2
  183. package/dist/src/session-changes.d.ts +35 -0
  184. package/dist/src/session-changes.js +194 -6
  185. package/dist/src/session-monitor.js +2 -1
  186. package/dist/src/session-reaper.d.ts +1 -1
  187. package/dist/src/session-reaper.js +6 -1
  188. package/dist/src/session-summary.d.ts +2 -1
  189. package/dist/src/session-summary.js +2 -1
  190. package/dist/src/sessions.d.ts +35 -1
  191. package/dist/src/sessions.js +70 -4
  192. package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
  193. package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
  194. package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
  195. package/dist/src/skills/bundled/provenance.json +3 -3
  196. package/dist/src/skills/runtime-skills.js +1 -1
  197. package/dist/src/task-checkout.d.ts +141 -0
  198. package/dist/src/task-checkout.js +558 -0
  199. package/dist/src/telemetry/emitter.d.ts +15 -0
  200. package/dist/src/telemetry/emitter.js +35 -1
  201. package/dist/src/telemetry/schema.d.ts +25 -2
  202. package/dist/src/telemetry/schema.js +52 -4
  203. package/dist/src/telemetry/surface.d.ts +2 -1
  204. package/dist/src/telemetry/surface.js +4 -1
  205. package/dist/src/terminal-ui.d.ts +1 -0
  206. package/dist/src/terminal-ui.js +10 -3
  207. package/dist/src/test-edit-guard.d.ts +37 -0
  208. package/dist/src/test-edit-guard.js +216 -3
  209. package/dist/src/thinking-level-detect.d.ts +11 -0
  210. package/dist/src/thinking-level-detect.js +47 -0
  211. package/dist/src/thinking-levels.d.ts +30 -0
  212. package/dist/src/thinking-levels.js +124 -0
  213. package/dist/src/timers.d.ts +3 -0
  214. package/dist/src/tool-catalog.js +1 -1
  215. package/dist/src/tools.js +59 -9
  216. package/dist/src/transcript.js +1 -1
  217. package/dist/src/types.d.ts +34 -0
  218. package/package.json +6 -1
  219. package/dist/src/remote/cert.d.ts +0 -11
  220. package/dist/src/remote/cert.js +0 -87
  221. package/dist/src/remote/client.d.ts +0 -119
  222. package/dist/src/remote/client.js +0 -544
  223. package/dist/src/remote/command.d.ts +0 -4
  224. package/dist/src/remote/command.js +0 -194
  225. package/dist/src/remote/errors.d.ts +0 -11
  226. package/dist/src/remote/errors.js +0 -14
  227. package/dist/src/remote/network.d.ts +0 -22
  228. package/dist/src/remote/network.js +0 -102
  229. package/dist/src/remote/pairing.d.ts +0 -63
  230. package/dist/src/remote/pairing.js +0 -299
  231. package/dist/src/remote/pem.d.ts +0 -2
  232. package/dist/src/remote/pem.js +0 -7
  233. package/dist/src/remote/serve.d.ts +0 -68
  234. package/dist/src/remote/serve.js +0 -244
  235. package/dist/src/remote/server.d.ts +0 -21
  236. package/dist/src/remote/server.js +0 -406
@@ -7,18 +7,43 @@ import { OpenCodeSignIn } from './managed-sign-in.js';
7
7
  import { type SignInProbes } from './sign-in-detection.js';
8
8
  import type { CliSignIn } from './cli-sign-in.js';
9
9
  import { checkGraphModelHealth } from './graph-health.js';
10
- import { loadAccessibleGraph } from './membership.js';
10
+ import { loadAccessibleGraph, type Membership } from './membership.js';
11
11
  import { type SavedSession } from './sessions.js';
12
12
  import { type GitRunner } from './pull-request-create.js';
13
13
  import { type GhRunner } from './pull-requests.js';
14
14
  import { type Completion, type RunResult } from './runtime.js';
15
+ import { type GitHubAppClient } from './github-app/client.js';
16
+ import { type ReviewLoopDependencies } from './github-app/review-loop.js';
15
17
  import { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
16
- import { type AppServerErrorCode } from './app-server/protocol.js';
18
+ import { AppServerError } from './app-server/error.js';
19
+ import { type CloudStatus, type EnvironmentRecord } from './bridge/control.js';
20
+ import { RelayLink } from './bridge/link.js';
17
21
  import { type HostedMonitorOptions } from './andorra/monitor.js';
18
- declare class AppServerError extends Error {
19
- readonly code: AppServerErrorCode;
20
- constructor(code: AppServerErrorCode, message: string);
22
+ /** The account calls behind environments.*, each taking the desktop's Andorra access token. */
23
+ export interface EnvironmentControl {
24
+ list(accessToken: string): Promise<EnvironmentRecord[]>;
25
+ claim(accessToken: string, code: string, name: string): Promise<EnvironmentRecord>;
26
+ rename(accessToken: string, id: string, name: string): Promise<EnvironmentRecord>;
27
+ remove(accessToken: string, id: string): Promise<void>;
28
+ cloudGet(accessToken: string): Promise<CloudStatus>;
29
+ cloudStart(accessToken: string, version: string): Promise<CloudStatus>;
30
+ cloudStop(accessToken: string): Promise<CloudStatus>;
31
+ cloudDelete(accessToken: string, environmentId?: string): Promise<CloudStatus>;
21
32
  }
33
+ /** What the desktop is told about its Cloud instance. */
34
+ export interface CloudView {
35
+ state: CloudStatus['state'];
36
+ enabled: boolean;
37
+ environmentId?: string;
38
+ label?: string;
39
+ step?: 'machine' | 'bridge';
40
+ deleteAt?: string;
41
+ error?: 'boot_timeout' | 'no_capacity';
42
+ stopReason?: CloudStatus['stopReason'];
43
+ /** True when the instance runs a different version from this engine. */
44
+ outdated: boolean;
45
+ }
46
+ export type RelayLinkPort = Pick<RelayLink, 'open' | 'request' | 'host' | 'close' | 'presence' | 'dispose'>;
22
47
  type ManagedSignInService = Pick<CliSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
23
48
  type OpenCodeSignInService = Pick<OpenCodeSignIn, 'start' | 'status' | 'cancel' | 'logout' | 'submitCode' | 'close'>;
24
49
  export declare function rekeyProjectExtensions(config: Config, fromKey: string, toKey: string, merged: boolean): Config;
@@ -34,6 +59,8 @@ export interface AppServerOptions {
34
59
  modelHealthTtlMs?: number;
35
60
  createCodeIntelligence?: typeof CodeIntelligenceManager.create;
36
61
  loadGraph?: typeof loadAccessibleGraph;
62
+ /** The clock the model relay's re-announce, claim-silence and away timers use; tests pass a manual one. */
63
+ modelRelayTimers?: typeof globalThis;
37
64
  codexAuth?: Pick<CodexAccountAuth, 'start' | 'status' | 'cancel' | 'logout' | 'close'>;
38
65
  removeCodexAccount?: typeof removeCodexAccount;
39
66
  anthropicAuth?: Pick<AnthropicConsoleAuth, 'start' | 'status' | 'cancel' | 'logout' | 'discard' | 'close'>;
@@ -50,6 +77,31 @@ export interface AppServerOptions {
50
77
  pullRequestPollMs?: number;
51
78
  hostedCheck?: HostedMonitorOptions['check'];
52
79
  hostedNow?: () => number;
80
+ /** The relay link, account calls and access token behind environments.* and remote.* (tests pass fakes). */
81
+ environments?: {
82
+ relayLink?: () => RelayLinkPort;
83
+ control?: EnvironmentControl;
84
+ accessToken?: () => Promise<string>;
85
+ };
86
+ /** The GitHub App's account routes and the sign-in check behind github.* and the event source (tests pass fakes). */
87
+ /** A review wait's timing, for tests: how often it reads Codex's signals, and how long a head stays quiet before "@codex review". */
88
+ reviewSignals?: {
89
+ intervalMs?: number;
90
+ bumpDelayMs?: number;
91
+ };
92
+ githubApp?: {
93
+ client?: GitHubAppClient;
94
+ signedIn?: (signal?: AbortSignal) => Promise<boolean>;
95
+ subject?: () => Promise<string | undefined>;
96
+ now?: () => number;
97
+ checkNowDelayMs?: number;
98
+ reactionBudgetMs?: number;
99
+ mentionRetryMs?: number[];
100
+ /** The plan read that gates switching the Andorra review loop on (tests answer it without the account service). */
101
+ membership?: (signal?: AbortSignal) => Promise<Membership>;
102
+ /** The review loop's reviewer, worktree, waits and ids (tests run it without a model or a child process). */
103
+ reviewLoop?: Partial<Pick<ReviewLoopDependencies, 'prepareWorkspace' | 'runReviewer' | 'sweep' | 'newRequestId' | 'sleep' | 'now' | 'tickMs' | 'reviewerEnv'>>;
104
+ };
53
105
  }
54
106
  export declare class AppServer {
55
107
  private automationCheck?;
@@ -77,13 +129,34 @@ export declare class AppServer {
77
129
  private readonly gh;
78
130
  private readonly git;
79
131
  private readonly pullRequestWatcher;
132
+ private readonly githubClient;
133
+ private readonly githubSignedIn;
134
+ /** The signed-in account's subject, for gating the `github.watch` telemetry on its plan and opt-out. */
135
+ private readonly githubAccount;
136
+ private readonly githubEvents;
137
+ /** "@andorra-code" mentions on a task's PR (phase 3): the access check, the 👀 and the wake. */
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. */
140
+ private githubBot?;
80
141
  private readonly pullRequestReader;
81
142
  private readonly sessionChanges;
82
143
  private readonly autoFixWakes;
83
144
  /** Wakes the PR tab's Fix with Agent armed: delivered as the person's request, not as a timer. */
84
145
  private readonly fixWakes;
146
+ /** Wakes a mention of the App's bot on the task's PR armed: delivered as "Mentioned on GitHub", not as a timer. */
147
+ private readonly mentionWakes;
85
148
  private readonly reviewWaiters;
86
149
  private readonly reviewWaitsStarting;
150
+ /** The Andorra review loop's fixer wakes, beside Auto-fix's: delivered as "Andorra review", routed like Auto-fix's. */
151
+ private readonly reviewWakes;
152
+ /** Each review wait's run, when it started, and the review loop it watches (the one running when it started, or after). */
153
+ private readonly reviewWaitRuns;
154
+ private readonly reviewLoop;
155
+ private readonly githubMembership;
156
+ private readonly reviewSignalMs;
157
+ private readonly reviewBumpDelayMs;
158
+ /** Repositories (lower-case owner/name) where Codex was seen on a recent PR, so the question is asked once. */
159
+ private readonly codexRepositories;
87
160
  private readonly graphSync;
88
161
  private readonly stopGraphVisibilityWatch;
89
162
  private readonly terminals;
@@ -93,9 +166,39 @@ export declare class AppServer {
93
166
  private readonly browserViews;
94
167
  private readonly browserExtensions;
95
168
  private extensionStatus;
169
+ /** The Files tab's search in flight per channel, so a newer query cancels the older one. */
170
+ private readonly workspaceSearches;
96
171
  private readonly pending;
97
172
  private readonly waiting;
98
173
  private readonly panelRelays;
174
+ private readonly modelRelay;
175
+ /** Answers the model calls of relayed runs on linked machines with this computer's providers. */
176
+ private readonly localRelay;
177
+ /** Machines being removed: refused at once, before the config file drops them from `environments.modelRelay`. */
178
+ private readonly modelRelayRevoked;
179
+ /** Machines allowed here whose save to `environments.modelRelay` failed, as `subject\0env`: allowed for this engine's lifetime. */
180
+ private readonly modelRelayUnsaved;
181
+ /** The runs this computer started or resumed on each machine: only their model requests are answered. */
182
+ private readonly modelRelayRuns;
183
+ /** Runs whose record failed to save, as `subject\0env\0runId`: answered for this engine's lifetime, saved again at 30 s. */
184
+ private readonly modelRelayRunsUnsaved;
185
+ /**
186
+ * Allowed machines a fresh account listing did not name, as `subject\0env`, with when that was first seen. Only a
187
+ * machine missing from two fresh listings a refresh apart is forgotten.
188
+ */
189
+ private readonly modelRelayMissing;
190
+ /** Each provider's resolved context windows for the relay block, by the fields that determine them. */
191
+ private readonly relayWindowsCache;
192
+ /** Reconciliations of the engine's own links in flight; close waits for them. */
193
+ private readonly modelRelayChores;
194
+ /** Machines whose removal is in flight: a run they take meanwhile does not allow them again. */
195
+ private readonly modelRelayRemoving;
196
+ /** This engine's own links to the machines allowed to use this computer's models, apart from the window's. */
197
+ private readonly modelRelayLinks;
198
+ private modelRelayRefresh?;
199
+ private readonly modelRelaySaveRetries;
200
+ /** Bumped by every reconciliation of the engine's links, so only the latest one acts. */
201
+ private modelRelaySync;
99
202
  private readonly panelOperations;
100
203
  private readonly panelOperationRuns;
101
204
  private readonly requests;
@@ -119,7 +222,8 @@ export declare class AppServer {
119
222
  private readonly titleReleases;
120
223
  private readonly titleAnswered;
121
224
  private readonly sessionTitles;
122
- private workGeneration;
225
+ /** Automatic titles waiting to be asked again, by session, after an attempt was refused, failed, or cut short. */
226
+ private readonly titleRetries;
123
227
  private readonly operations;
124
228
  private prepareTask?;
125
229
  private foreignEngineWatch?;
@@ -127,10 +231,17 @@ export declare class AppServer {
127
231
  private editorTask?;
128
232
  private codeIntel?;
129
233
  private codeIntelOpening;
130
- private remoteServe?;
131
234
  private readonly engineLinks;
132
- private readonly lastKnownGrants;
133
- private remoteOps;
235
+ private readonly environmentOptions;
236
+ private relay?;
237
+ private environmentIds?;
238
+ private environmentIdsLoading?;
239
+ /** The id of the account's Cloud environment, once a list or a Cloud answer has named it. */
240
+ private cloudEnvironmentId?;
241
+ /** The last failed read of the account's list: within ENVIRONMENT_IDS_TTL_MS, reads fail with it without asking again. */
242
+ private environmentIdsFailure?;
243
+ /** Bumped when the account changes, so an answer fetched for the previous account is never cached. */
244
+ private accountGeneration;
134
245
  private closed;
135
246
  private emitsStopped;
136
247
  private readonly hosted;
@@ -187,6 +298,11 @@ export declare class AppServer {
187
298
  private skillRead;
188
299
  private skillWrite;
189
300
  private installExtension;
301
+ /**
302
+ * Whether a task's run is open anywhere on this home. A review loop's reviewer (a hidden session) is not a task: it
303
+ * uses no skill or plugin, so it never holds up an edit or a removal.
304
+ */
305
+ private taskRunsOpen;
190
306
  private removeExtension;
191
307
  private setExtensionEnabled;
192
308
  private mutateMcp;
@@ -204,6 +320,12 @@ export declare class AppServer {
204
320
  private anthropicProviderAuth;
205
321
  private recordCodexEmail;
206
322
  private testProviderEndpoint;
323
+ private thinkingLevelTarget;
324
+ private thinkingLevelsView;
325
+ /** Finds out which thinking levels a model accepts and saves them. An inconclusive answer saves nothing. */
326
+ private detectThinkingLevels;
327
+ private setThinkingLevels;
328
+ private saveThinkingLevels;
207
329
  private operation;
208
330
  private accountStatus;
209
331
  private accountProfile;
@@ -211,6 +333,14 @@ export declare class AppServer {
211
333
  private sessionStats;
212
334
  private signIn;
213
335
  private signOut;
336
+ /** The stored sign-in was rejected and removed: the account is signed out without anyone asking. */
337
+ private accountSignedOut;
338
+ /**
339
+ * The relay socket and every machine link were opened for the signed-in account. When the account changes or
340
+ * signs out they all end: each link with `remote.engine.closed` and `reason` (`login-required` after a sign-out,
341
+ * `account-changed` after a sign-in), and the socket itself, so the next use dials again with the new sign-in.
342
+ */
343
+ private endAccountLinks;
214
344
  /** Signing in or out changes what Andorra offers this account: ask now instead of at the next interval. */
215
345
  private checkHostedAfterAccountChange;
216
346
  private publishAccount;
@@ -235,17 +365,39 @@ export declare class AppServer {
235
365
  private compactSession;
236
366
  private saveFinalizedSession;
237
367
  private setSessionArchived;
368
+ /** Marks a task's completed turn reviewed, as Needs you's Mark Reviewed does: only the turn the lead was shown. */
369
+ private setSessionReviewed;
370
+ /** 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
+ private setSessionPinned;
238
372
  private deleteSession;
239
373
  private startRun;
240
374
  private resumeRun;
241
375
  private switchBranch;
376
+ /** Makes a writing task's worktree before its run starts; the same key returns the same worktree on a retry. */
377
+ private prepareTaskCheckout;
378
+ private sessionCheckoutState;
379
+ private refuseCheckoutChange;
380
+ /** Recreates a task's missing worktree from its branch, or takes the folder it moved to. */
381
+ private recoverSessionCheckout;
382
+ private inspectSessionCheckout;
383
+ /** Removes a task's worktree after the lead saw what it holds; the branch stays when it has commits nothing else has. */
384
+ private removeSessionCheckout;
242
385
  private assertRunning;
243
386
  private prepareRun;
244
387
  private graphForRun;
388
+ /** `source`: a relayed run's graph, already read; it is bound to `config` (the run's relayed providers) instead of being loaded. */
245
389
  private loadResumeGraph;
246
390
  private prepareRunValidated;
247
391
  private titleSessionFromPrompt;
392
+ /** Saves an automatic title under the same lock and guards a user rename takes. */
393
+ /** `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
+ private saveSessionTitle;
395
+ /** 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
+ private scheduleTitleRetry;
397
+ private retrySessionTitle;
398
+ private runTitleRetry;
248
399
  private releaseTitleWaiter;
400
+ /** Abort title work for the session given, or for all: the request on the wire, and a retry that is still waiting is moved back, not dropped. */
249
401
  private cancelSessionTitles;
250
402
  private executeRun;
251
403
  private reasoningAdapter;
@@ -273,6 +425,15 @@ export declare class AppServer {
273
425
  private approve;
274
426
  private ask;
275
427
  private settleApproval;
428
+ /**
429
+ * The adapter a run talks to. A relayed provider's model is on the desktop, so its requests go through the model
430
+ * relay as `runId`'s (the live run's when none is given, read when the request is made).
431
+ */
432
+ private adapterFor;
433
+ /** The id, run and claimant of a model.relay call; the claimant is the connection the desktop's engine speaks through. */
434
+ private relayCall;
435
+ private relayProgress;
436
+ private relayResult;
276
437
  private panelBrowserRelayFor;
277
438
  private settlePanelRelay;
278
439
  private settleAnswer;
@@ -292,39 +453,143 @@ export declare class AppServer {
292
453
  private selectGraph;
293
454
  private openEditor;
294
455
  private closeEditor;
295
- private serializeRemote;
296
- startRemoteServe(): Promise<void>;
297
- private remoteError;
298
- private remoteStatusFailure;
299
- private peerCall;
300
- private remoteTarget;
301
- private remoteWorkspaceView;
302
- private remoteHostingStatus;
303
- private remoteHostingInvitationFull;
304
- private remoteHostingInvitationRegenerate;
305
- private remoteShareAdd;
306
- private remoteShareRemove;
307
- private remoteDeviceRevoke;
308
- private remoteDeviceGrant;
456
+ /** The one relay link this engine uses for every machine, created on first use and disposed in `close`. */
457
+ private relayLink;
458
+ private environmentAccessToken;
459
+ private environmentControl;
460
+ private environmentError;
461
+ private onlineEnvironments;
462
+ private environmentsList;
463
+ private environmentClaim;
464
+ private environmentRename;
465
+ private environmentCloud;
466
+ private cloudView;
467
+ private environmentRemove;
468
+ /**
469
+ * Whether `env` is one of the caller's environments, from the control list cached for 30 s, or the account's Cloud. The relay answers
470
+ * not-found both for a machine whose bridge is away and for one the caller does not own; this tells them apart.
471
+ * 'unknown' when the list could not be read for a reason other than sign-in, which callers treat as offline.
472
+ */
473
+ private environmentMembership;
474
+ /**
475
+ * The account's environment ids, cached for 30 s. A read that failed is remembered for as long, so callers that run
476
+ * by themselves (answering model requests, retrying links) do not ask the service again on every turn; `fresh`
477
+ * (a person's own action) asks it regardless.
478
+ */
479
+ private listedEnvironmentIds;
480
+ private offlineEnvironmentLine;
481
+ /** A call for a machine whose link is waiting for it to come back fails now instead of at its deadline. */
482
+ private refuseWhileReconnecting;
483
+ private hostOperation;
309
484
  private remoteEngineConnect;
485
+ /** What the machine's `whoami` adds to its host description (grant, capabilities); undefined when it could not be read. */
486
+ private machineIdentity;
487
+ /** A reopen whose `whoami` failed asks again once the link is up, and reports the full host with another `reopened`. */
488
+ private retryMachineIdentity;
489
+ /** Whether `link` is still the one held for `env` in its own map, and not ended. */
490
+ private linkIsCurrent;
491
+ private openEngineLink;
492
+ private emitEngineFrame;
493
+ private engineLinkEnded;
494
+ /** A transient end keeps the link: the desktop keeps its clients and transcript while the engine reopens it. */
495
+ private awaitMachine;
496
+ private retryEngineLink;
497
+ /**
498
+ * Opens `link` again (or, for the engine's own link, the first time); one that fails is retried in 5 s, or for the
499
+ * engine's own link on its backoff.
500
+ */
501
+ private attemptEngineLink;
502
+ /**
503
+ * Ends `link` for good. The machine's model work stops with it unless the machine is still reachable through its
504
+ * other link; a machine that left the account stops either way.
505
+ */
506
+ private forgetEngineLink;
507
+ /** Closes `link`. The machine's model work is kept: a new link may replace this one and deliver it. */
508
+ private dropEngineLink;
310
509
  private remoteEngineDisconnect;
311
- private runEngineLink;
510
+ /**
511
+ * Whether a model request from `env` is answered here: allowed here for the signed-in account, not being removed,
512
+ * and on that account's list. Which of its runs are answered is the run store's to say.
513
+ */
514
+ private modelRelayAnswers;
515
+ /** Whether `subject` started or resumed `runId` on `env` from this computer: recorded, or held in memory after a failed save. */
516
+ private relayRunStartedHere;
517
+ /** Forgets the unsaved runs of `env` (for `subject`, or every account). */
518
+ private forgetUnsavedRuns;
519
+ /**
520
+ * The machines `subject` allowed to use this computer's models: its saved list and any whose save failed, less those
521
+ * removed. Signed out, none.
522
+ */
523
+ private modelRelayAllowed;
524
+ /** Brings the engine's own links in line with the machines allowed here and on the account's list. */
525
+ private syncModelRelayLinks;
526
+ private reconcileModelRelayLinks;
527
+ /**
528
+ * Drops from `subject`'s entry, and from its recorded runs, the machines no longer on its account's list: those
529
+ * missing from this fresh listing and from one at least a refresh interval earlier. Their links are closed at once by
530
+ * the reconcile; only this forgetting waits. Nothing is written once `stale` says the engine closed or the account changed.
531
+ */
532
+ private pruneModelRelayList;
533
+ /** Closes the engine's link to a machine that is no longer answered here, and stops its model work. */
534
+ private releaseModelRelayLink;
535
+ private openModelRelayLink;
536
+ private scheduleModelRelayRefresh;
537
+ private stopModelRelayRefresh;
538
+ /** Runs `save` once, MODEL_RELAY_SAVE_RETRY_MS from now; a second failure is logged and left to memory. */
539
+ private retryModelRelaySave;
312
540
  private remoteEngineRequest;
313
- private remoteWorkspacesList;
314
- private remoteWorkspaceState;
315
- private remoteWorkspaceProbe;
316
- private remoteProbeIdentity;
317
- private remoteTrustIdentity;
318
- private remoteWorkspaceAdd;
319
- private remoteWorkspaceRemove;
320
- private remoteWorkspaceRename;
321
- private remoteWorkspaceSetHost;
541
+ /**
542
+ * Records the run a relayed start or resume answered with as this computer's on `env` (from the answer's `runId`),
543
+ * lets a request of it that arrived first be taken now, and allows the machine.
544
+ */
545
+ private adoptRelayedRun;
546
+ /**
547
+ * `params` of a run.start or run.resume for a machine that takes relayed providers, with `relay` added: this
548
+ * computer's providers by id, model, models, context windows and effort only (never an address, a key or a sign-in),
549
+ * and the graph to run when it is one only this computer has. A start always names its graph, so the machine never
550
+ * falls back to one of its own. Undefined when this computer has no provider to offer: the request then goes as it
551
+ * was, and the machine runs it on its own providers if it has any.
552
+ */
553
+ private withModelRelay;
554
+ /**
555
+ * A run.setModel for a machine that takes relayed providers: a provider of this computer's may be switched only to a
556
+ * model on its list. A provider id this computer does not have is the machine's own and is left to it.
557
+ */
558
+ private checkRelayedModel;
559
+ /**
560
+ * Each provider as a relay entry, with the effective window of each listed model resolved here within 5 s in all.
561
+ * A provider's windows are reused for 5 minutes while its address and models stay the same.
562
+ */
563
+ private relayedProviders;
564
+ /** A graph this computer has, loaded under its membership rules; a graph it may not use fails with their message. */
565
+ private desktopGraph;
566
+ /** The graph a relayed run on `env` ran, from the machine's record of it, when it is one this computer has. */
567
+ private relayedResumeGraph;
568
+ /** `graph` with its portable provider ids bound to `providers`; one that cannot be bound is refused as a local start is. */
569
+ private relayBoundGraph;
570
+ /** Lists `env` among the machines `subject` allowed to use this computer's providers, the first time a relayed run starts there. */
571
+ private allowModelRelay;
572
+ /** Withdraws `env`'s permission to use this computer's providers, for every account that allowed it. */
573
+ private forgetModelRelayEnvironment;
574
+ /**
575
+ * Rewrites `environments.modelRelay`, a list per account; `change` answers undefined when there is nothing to change.
576
+ * The list shape from before accounts were told apart is read as empty and replaced.
577
+ */
578
+ private changeModelRelayList;
579
+ /**
580
+ * A model.relay call to `env`'s engine `engine`. Without `via` it goes through the engine's own link when that is
581
+ * up, else the window's; with `via` only through that link, since the machine takes a claim's later calls only
582
+ * from the connection that claimed. A link that is gone or down answers cancelled or network.
583
+ */
584
+ private sendModelRelay;
322
585
  private remoteRootsList;
323
586
  private remoteProjectsFetch;
324
587
  private remoteBrowse;
325
588
  private remoteOwnerRoots;
326
589
  private remoteOwnerBrowse;
327
590
  private remoteOwnerAddProject;
591
+ /** Asks a Cloud machine to clone a GitHub repository and register it; answered at once, and asked again while it clones. */
592
+ private remoteOwnerGitHubClone;
328
593
  private listProjects;
329
594
  private addProject;
330
595
  private removeProject;
@@ -339,13 +604,99 @@ export declare class AppServer {
339
604
  private emitSessionSkills;
340
605
  private updateSessionSkill;
341
606
  private emitPullRequest;
607
+ /**
608
+ * The end of the review loop a wait watches: the loop running when the wait started, or the first one switched on
609
+ * while it waits. A loop that had already ended before is never answered again.
610
+ */
611
+ private watchedLoopEnded;
612
+ /** A wait ended: the marker that held the review loop's round for it goes, unless a newer wait wrote its own. */
613
+ private clearReviewWaiting;
342
614
  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
+ */
623
+ private reviewWaitFromSignals;
624
+ /**
625
+ * 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.
628
+ */
343
629
  private reviewWaitFromRecord;
344
630
  private recordAutoFixDelivered;
345
631
  private emitSessionChanges;
346
632
  private attachPullRequest;
633
+ /** How many turns a task's history holds, a running turn included, for the review loop's transcript lines. */
634
+ private sessionTurnCount;
635
+ /** The reviewer's model from `reviewModel`: null clears it, undefined leaves it; a provider this engine lacks is refused. */
636
+ private reviewModelChange;
637
+ /** The Andorra review loop's settings on a record (the switch-on checks were made); the gh-backed settings are not here. */
638
+ private applyReviewSettingsTo;
639
+ /** A graph run's Andorra review nodes: rounds on the session's PR through the review loop (design/specs/andorra-review-loop.md, R12). */
640
+ private reviewNodeService;
641
+ /** R18: not on the Free plan, and not while the plan cannot be read. Read outside the PR record's lock (up to 10 s). */
642
+ private checkReviewPlan;
643
+ /**
644
+ * Why the Andorra review loop cannot be switched on for this PR (design/specs/andorra-review-loop.md, R11, R17), if it
645
+ * cannot: the checks on the record as it is now, under its lock. The plan (R18) is read before the lock.
646
+ */
647
+ private checkReviewSwitchOn;
648
+ /** After a settings write: a switch-off ends the loop's round and wake; anything else is looked at by the loop. */
649
+ private reviewSettingsApplied;
650
+ /** A PR a task's `gh pr create` opened: with `github.app.reviewNewPullRequests`, its review loop starts on. A refusal is logged. */
651
+ private reviewNewPullRequest;
652
+ /** The PR's GitHub App coverage for the review loop: the event source's, or the lease holder's in another process. */
653
+ private reviewCoverage;
654
+ /** Whether a run of the session is open anywhere, leaving out `except`: the run held in await_review. */
655
+ private sessionBusyForReview;
347
656
  private updatePullRequest;
657
+ /** With `agentChecked`, the agent's dismiss: the record is removed only while it is still that open PR. */
348
658
  private dismissPullRequest;
659
+ /**
660
+ * The agent's own dismiss (the `pull_request` tool). A merged or closed PR stays on the task, where the
661
+ * sidebar and the PR tab show how the work ended; only the person removes that one. GitHub is asked first,
662
+ * because an agent that has just merged calls this before the watcher has recorded the merge.
663
+ */
664
+ private dismissPullRequestForAgent;
665
+ private githubError;
666
+ /**
667
+ * Settings → GitHub: the account's GitHub connection and installations from the account API, whether this
668
+ * engine is in event mode, and each watched PR's coverage. `not-covered` for a PR this engine reads through
669
+ * gh becomes `not-installed`, with the hint to install the App there: the service never says "not installed".
670
+ */
671
+ 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. */
673
+ private githubSetAgentWrites;
674
+ /**
675
+ * Who an agent write on this session's PR goes to first, decided one way for the tool and the Auto-fix prompt:
676
+ * the setting, and the PR's coverage as the event source (or, in another process, the lease holder) last
677
+ * learned it. Events switched off here, or a PR the source has not looked at yet, are not covered.
678
+ */
679
+ private agentWriteRoute;
680
+ /** The pull_request tool's reply, resolve and comment on the session's tracked PR (design/specs/github-app.md, "Bot replies"). */
681
+ private agentPullRequestWrite;
682
+ /** The App's bot login: `GET /v1/github`'s `bot`, read once (bounded) and kept, or learned from a write's `as`. */
683
+ 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;
686
+ /**
687
+ * For a mention's prompt: who the agent's answer posts as on this session's PR (the pull_request tool's rule),
688
+ * and the bot's login, which also names the mention (`@andorra-code`, `@andorra-code-dev` on staging).
689
+ */
690
+ private mentionWrites;
691
+ /**
692
+ * Wakes the task for a mention, as Fix with Agent does: into a review wait the agent is in, or as the next
693
+ * turn, shown as "Mentioned on GitHub". Each comment wakes once (`MentionTriggers` keeps the ids).
694
+ */
695
+ private wakeForMention;
696
+ private githubConnect;
697
+ /** The repositories the GitHub App can reach for this account's linked GitHub user: what a Cloud machine may clone. */
698
+ private githubRepositories;
699
+ private githubDisconnect;
349
700
  /**
350
701
  * The PR tab's read of a task's pull request: branches, author, mergeability, description, commits,
351
702
  * checks and reviews, through the account that can read it. Answers come from a short cache (see
@@ -448,6 +799,12 @@ export declare class AppServer {
448
799
  private syncPullRequestRecord;
449
800
  private cancelAutoFixWake;
450
801
  private pullRequestControl;
802
+ /**
803
+ * 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.
805
+ */
806
+ private wakeForReview;
807
+ private cancelReviewWake;
451
808
  private wakeForPullRequest;
452
809
  private emitTimers;
453
810
  private settleSessionTimers;