@andorra-labs/code 0.1.15 → 0.1.17

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 (242) 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-definitions.js +29 -6
  4. package/dist/src/agent-execution.js +15 -10
  5. package/dist/src/agent-mcp-catalog.js +1 -0
  6. package/dist/src/agent-mcp.d.ts +4 -1
  7. package/dist/src/agent-mcp.js +46 -10
  8. package/dist/src/andorra/entry.d.ts +10 -0
  9. package/dist/src/andorra/entry.js +18 -4
  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 +22 -44
  21. package/dist/src/app-server/protocol.js +5 -1
  22. package/dist/src/app-server/workspace.d.ts +89 -0
  23. package/dist/src/app-server/workspace.js +457 -11
  24. package/dist/src/app-server.d.ts +465 -32
  25. package/dist/src/app-server.js +3308 -517
  26. package/dist/src/auth/deployment.js +2 -2
  27. package/dist/src/bridge/cloud.d.ts +27 -0
  28. package/dist/src/bridge/cloud.js +187 -0
  29. package/dist/src/bridge/command.d.ts +30 -0
  30. package/dist/src/bridge/command.js +347 -0
  31. package/dist/src/bridge/control.d.ts +68 -0
  32. package/dist/src/bridge/control.js +233 -0
  33. package/dist/src/bridge/engines.d.ts +90 -0
  34. package/dist/src/bridge/engines.js +601 -0
  35. package/dist/src/bridge/host-ops.d.ts +9 -0
  36. package/dist/src/bridge/host-ops.js +129 -0
  37. package/dist/src/bridge/host.d.ts +47 -0
  38. package/dist/src/bridge/host.js +540 -0
  39. package/dist/src/bridge/link.d.ts +38 -0
  40. package/dist/src/bridge/link.js +508 -0
  41. package/dist/src/bridge/login-link.d.ts +29 -0
  42. package/dist/src/bridge/login-link.js +54 -0
  43. package/dist/src/bridge/protocol.d.ts +136 -0
  44. package/dist/src/bridge/protocol.js +11 -0
  45. package/dist/src/bridge/store.d.ts +12 -0
  46. package/dist/src/bridge/store.js +61 -0
  47. package/dist/src/bridge/wording.d.ts +6 -0
  48. package/dist/src/bridge/wording.js +10 -0
  49. package/dist/src/browser-runner.js +1 -0
  50. package/dist/src/browser-server.js +7 -1
  51. package/dist/src/browser-ui/style.css +3 -3
  52. package/dist/src/browser-ui/tokens.css +28 -17
  53. package/dist/src/change-authors.d.ts +41 -0
  54. package/dist/src/change-authors.js +146 -0
  55. package/dist/src/claude-provider.js +3 -1
  56. package/dist/src/cli.js +202 -38
  57. package/dist/src/codex-errors.js +4 -1
  58. package/dist/src/coding-tools.js +15 -15
  59. package/dist/src/command-screens.d.ts +6 -0
  60. package/dist/src/command-screens.js +19 -14
  61. package/dist/src/commands.d.ts +14 -1
  62. package/dist/src/compaction-phrases.d.ts +4 -0
  63. package/dist/src/compaction-phrases.js +20 -0
  64. package/dist/src/completion.js +82 -5
  65. package/dist/src/config.d.ts +71 -3
  66. package/dist/src/config.js +202 -77
  67. package/dist/src/context-compaction.js +2 -1
  68. package/dist/src/deadline.js +13 -1
  69. package/dist/src/decision/DecisionManager.js +3 -2
  70. package/dist/src/decision/checks.js +1 -1
  71. package/dist/src/decision/requestPhrases.d.ts +4 -0
  72. package/dist/src/decision/requestPhrases.js +22 -0
  73. package/dist/src/default-graph.js +1 -1
  74. package/dist/src/file-diff.d.ts +4 -0
  75. package/dist/src/file-diff.js +2 -1
  76. package/dist/src/github-app/agent-writes.d.ts +102 -0
  77. package/dist/src/github-app/agent-writes.js +320 -0
  78. package/dist/src/github-app/client.d.ts +349 -0
  79. package/dist/src/github-app/client.js +810 -0
  80. package/dist/src/github-app/event-source.d.ts +208 -0
  81. package/dist/src/github-app/event-source.js +684 -0
  82. package/dist/src/github-app/metrics.d.ts +32 -0
  83. package/dist/src/github-app/metrics.js +49 -0
  84. package/dist/src/github-app/review-loop.d.ts +274 -0
  85. package/dist/src/github-app/review-loop.js +1177 -0
  86. package/dist/src/github-app/review-node.d.ts +81 -0
  87. package/dist/src/github-app/review-node.js +205 -0
  88. package/dist/src/github-app/review-post.d.ts +73 -0
  89. package/dist/src/github-app/review-post.js +139 -0
  90. package/dist/src/github-app/review-text.d.ts +107 -0
  91. package/dist/src/github-app/review-text.js +1133 -0
  92. package/dist/src/github-app/review-threads.d.ts +47 -0
  93. package/dist/src/github-app/review-threads.js +107 -0
  94. package/dist/src/github-app/reviewer.d.ts +121 -0
  95. package/dist/src/github-app/reviewer.js +598 -0
  96. package/dist/src/github-app/store.d.ts +59 -0
  97. package/dist/src/github-app/store.js +148 -0
  98. package/dist/src/github-app/triggers.d.ts +141 -0
  99. package/dist/src/github-app/triggers.js +441 -0
  100. package/dist/src/github-inbox.d.ts +55 -0
  101. package/dist/src/github-inbox.js +153 -0
  102. package/dist/src/github-names.d.ts +8 -0
  103. package/dist/src/github-names.js +8 -0
  104. package/dist/src/glob-search.d.ts +61 -0
  105. package/dist/src/glob-search.js +180 -0
  106. package/dist/src/graph-health.js +13 -4
  107. package/dist/src/graph-manager-chat.js +1 -1
  108. package/dist/src/graph-preview.d.ts +46 -0
  109. package/dist/src/graph-preview.js +55 -0
  110. package/dist/src/graph-provider-portability.js +34 -11
  111. package/dist/src/graph-quota.d.ts +29 -2
  112. package/dist/src/graph-quota.js +68 -10
  113. package/dist/src/graph-runner.js +88 -10
  114. package/dist/src/graph-server.d.ts +1 -1
  115. package/dist/src/graph-server.js +11 -9
  116. package/dist/src/graph-sync.js +3 -3
  117. package/dist/src/graph-ui/app.js +201 -40
  118. package/dist/src/graph-ui/controls.css +1 -0
  119. package/dist/src/graph-ui/embed.js +2 -2
  120. package/dist/src/graph-ui/icons.js +3 -1
  121. package/dist/src/graph-ui/index.html +1 -1
  122. package/dist/src/graph-ui/manager.css +1 -1
  123. package/dist/src/graph-ui/manager.js +2 -2
  124. package/dist/src/graph-ui/sidebar.js +30 -0
  125. package/dist/src/graph-ui/studio-canvas.js +26 -13
  126. package/dist/src/graph-ui/studio.css +15 -7
  127. package/dist/src/graph-ui/studio.js +26 -5
  128. package/dist/src/graph-ui/style.css +77 -45
  129. package/dist/src/graph-ui/theme.js +3 -36
  130. package/dist/src/graph-ui/tokens.css +28 -20
  131. package/dist/src/graphs.d.ts +34 -1
  132. package/dist/src/graphs.js +162 -17
  133. package/dist/src/image-input.d.ts +16 -0
  134. package/dist/src/image-input.js +41 -0
  135. package/dist/src/membership.d.ts +30 -1
  136. package/dist/src/membership.js +48 -8
  137. package/dist/src/model-health-cache.js +1 -1
  138. package/dist/src/model-metadata.d.ts +7 -1
  139. package/dist/src/model-metadata.js +39 -17
  140. package/dist/src/model-relay/local.d.ts +116 -0
  141. package/dist/src/model-relay/local.js +468 -0
  142. package/dist/src/model-relay/remote.d.ts +129 -0
  143. package/dist/src/model-relay/remote.js +252 -0
  144. package/dist/src/model-relay/runs.d.ts +34 -0
  145. package/dist/src/model-relay/runs.js +146 -0
  146. package/dist/src/model-relay/wire.d.ts +5 -0
  147. package/dist/src/model-relay/wire.js +5 -0
  148. package/dist/src/plan-pass.d.ts +59 -0
  149. package/dist/src/plan-pass.js +165 -0
  150. package/dist/src/project-registry.d.ts +21 -0
  151. package/dist/src/project-registry.js +74 -0
  152. package/dist/src/provider-engine.js +3 -0
  153. package/dist/src/provider-import.d.ts +0 -12
  154. package/dist/src/provider-import.js +7 -195
  155. package/dist/src/providers.d.ts +40 -2
  156. package/dist/src/providers.js +93 -23
  157. package/dist/src/pull-request-checks.d.ts +26 -0
  158. package/dist/src/pull-request-checks.js +56 -0
  159. package/dist/src/pull-request-conversation.d.ts +134 -0
  160. package/dist/src/pull-request-conversation.js +221 -0
  161. package/dist/src/pull-request-create.d.ts +175 -0
  162. package/dist/src/pull-request-create.js +392 -0
  163. package/dist/src/pull-request-details.d.ts +242 -0
  164. package/dist/src/pull-request-details.js +614 -0
  165. package/dist/src/pull-request-edit.d.ts +23 -0
  166. package/dist/src/pull-request-edit.js +91 -0
  167. package/dist/src/pull-request-logs.d.ts +87 -0
  168. package/dist/src/pull-request-logs.js +183 -0
  169. package/dist/src/pull-request-merge.d.ts +112 -0
  170. package/dist/src/pull-request-merge.js +258 -0
  171. package/dist/src/pull-request-review.d.ts +137 -0
  172. package/dist/src/pull-request-review.js +401 -0
  173. package/dist/src/pull-requests.d.ts +369 -8
  174. package/dist/src/pull-requests.js +524 -55
  175. package/dist/src/react-runtime.js +38 -5
  176. package/dist/src/remote/engine-pool.d.ts +88 -4
  177. package/dist/src/remote/engine-pool.js +379 -90
  178. package/dist/src/remote/roots.d.ts +19 -0
  179. package/dist/src/remote/roots.js +45 -7
  180. package/dist/src/remote/types.d.ts +0 -44
  181. package/dist/src/run-control.d.ts +17 -0
  182. package/dist/src/run-control.js +47 -0
  183. package/dist/src/run-progress.d.ts +10 -0
  184. package/dist/src/run-progress.js +122 -0
  185. package/dist/src/run-records.d.ts +7 -2
  186. package/dist/src/run-records.js +71 -6
  187. package/dist/src/runtime.d.ts +9 -1
  188. package/dist/src/runtime.js +24 -4
  189. package/dist/src/session-changes.d.ts +35 -0
  190. package/dist/src/session-changes.js +194 -6
  191. package/dist/src/session-monitor.js +2 -1
  192. package/dist/src/session-reaper.d.ts +1 -1
  193. package/dist/src/session-reaper.js +6 -1
  194. package/dist/src/session-summary.d.ts +2 -1
  195. package/dist/src/session-summary.js +2 -1
  196. package/dist/src/sessions.d.ts +11 -1
  197. package/dist/src/sessions.js +17 -4
  198. package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
  199. package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
  200. package/dist/src/skills/bundled/provenance.json +2 -2
  201. package/dist/src/skills/runtime-skills.js +1 -1
  202. package/dist/src/subagent-run.js +1 -0
  203. package/dist/src/telemetry/capture-core.d.ts +17 -0
  204. package/dist/src/telemetry/capture-core.js +59 -1
  205. package/dist/src/telemetry/classify.d.ts +3 -1
  206. package/dist/src/telemetry/classify.js +37 -0
  207. package/dist/src/telemetry/emitter.d.ts +17 -0
  208. package/dist/src/telemetry/emitter.js +76 -5
  209. package/dist/src/telemetry/schema.d.ts +47 -2
  210. package/dist/src/telemetry/schema.js +120 -5
  211. package/dist/src/telemetry/surface.d.ts +3 -1
  212. package/dist/src/telemetry/surface.js +4 -1
  213. package/dist/src/telemetry/uploader.d.ts +6 -1
  214. package/dist/src/telemetry/uploader.js +22 -3
  215. package/dist/src/terminal-ui.d.ts +1 -0
  216. package/dist/src/terminal-ui.js +10 -3
  217. package/dist/src/test-edit-guard.d.ts +7 -0
  218. package/dist/src/test-edit-guard.js +49 -1
  219. package/dist/src/timers.d.ts +2 -0
  220. package/dist/src/tools.js +59 -9
  221. package/dist/src/transcript.js +8 -2
  222. package/dist/src/types.d.ts +7 -0
  223. package/dist/src/usage-analytics.js +18 -10
  224. package/package.json +6 -1
  225. package/dist/src/remote/cert.d.ts +0 -11
  226. package/dist/src/remote/cert.js +0 -87
  227. package/dist/src/remote/client.d.ts +0 -119
  228. package/dist/src/remote/client.js +0 -544
  229. package/dist/src/remote/command.d.ts +0 -4
  230. package/dist/src/remote/command.js +0 -194
  231. package/dist/src/remote/errors.d.ts +0 -11
  232. package/dist/src/remote/errors.js +0 -14
  233. package/dist/src/remote/network.d.ts +0 -22
  234. package/dist/src/remote/network.js +0 -102
  235. package/dist/src/remote/pairing.d.ts +0 -63
  236. package/dist/src/remote/pairing.js +0 -299
  237. package/dist/src/remote/pem.d.ts +0 -2
  238. package/dist/src/remote/pem.js +0 -7
  239. package/dist/src/remote/serve.d.ts +0 -68
  240. package/dist/src/remote/serve.js +0 -244
  241. package/dist/src/remote/server.d.ts +0 -21
  242. package/dist/src/remote/server.js +0 -406
@@ -0,0 +1,136 @@
1
+ export declare const PROTOCOL_VERSION = 1;
2
+ export declare const MAX_FRAME_BYTES: number;
3
+ /** The hello, the only frame the relay reads before `ready`, may be at most this large. */
4
+ export declare const PRE_HELLO_MAX_BYTES: number;
5
+ /** Once ready, a client sends `ping` this often, so both ends notice a dead socket while idle. */
6
+ export declare const CLIENT_PING_MS = 20000;
7
+ /** A client that has received no frame of any kind for this long treats the socket as dead and reconnects. */
8
+ export declare const CLIENT_DEAD_MS = 50000;
9
+ export type Host = {
10
+ hostname: string;
11
+ platform: string;
12
+ version: string;
13
+ };
14
+ export type EngineFrame = {
15
+ engine: string;
16
+ event: string;
17
+ data: Record<string, unknown>;
18
+ };
19
+ /** `version` is a desktop's own engine version, `major.minor.patch`; the relay copies only that shape into `open`. */
20
+ export type Hello = {
21
+ t: 'hello';
22
+ v: 1;
23
+ role: 'bridge' | 'desktop';
24
+ token: string;
25
+ host?: Host;
26
+ version?: string;
27
+ };
28
+ export type Auth = {
29
+ t: 'auth';
30
+ token: string;
31
+ };
32
+ export type Ping = {
33
+ t: 'ping';
34
+ };
35
+ export type Pong = {
36
+ t: 'pong';
37
+ };
38
+ export type DesktopOut = {
39
+ t: 'open';
40
+ env: string;
41
+ connectionId: string;
42
+ viewerWorkspaceId?: string;
43
+ } | {
44
+ t: 'request';
45
+ env: string;
46
+ id: string;
47
+ body: unknown;
48
+ } | {
49
+ t: 'host';
50
+ env: string;
51
+ id: string;
52
+ op: string;
53
+ params: Record<string, unknown>;
54
+ } | {
55
+ t: 'close';
56
+ env: string;
57
+ connectionId: string;
58
+ } | {
59
+ t: 'presence';
60
+ } | Ping;
61
+ export type DesktopIn = {
62
+ t: 'ready';
63
+ } | {
64
+ t: 'opened';
65
+ env: string;
66
+ connectionId: string;
67
+ host: Host;
68
+ } | {
69
+ t: 'answer';
70
+ env: string;
71
+ id: string;
72
+ answer: unknown;
73
+ } | {
74
+ t: 'event';
75
+ env: string;
76
+ connectionId: string;
77
+ frame: EngineFrame;
78
+ } | {
79
+ t: 'closed';
80
+ env: string;
81
+ connectionId?: string;
82
+ reason: 'offline' | 'not-found' | 'slow' | 'unlinked' | 'limit';
83
+ } | {
84
+ t: 'presence';
85
+ online: string[];
86
+ } | Pong;
87
+ export type BridgeIn = {
88
+ t: 'ready';
89
+ } | {
90
+ t: 'open';
91
+ viewer: string;
92
+ connectionId: string;
93
+ viewerWorkspaceId?: string;
94
+ version?: string;
95
+ } | {
96
+ t: 'request';
97
+ viewer: string;
98
+ id: string;
99
+ body: unknown;
100
+ } | {
101
+ t: 'host';
102
+ viewer: string;
103
+ id: string;
104
+ op: string;
105
+ params: Record<string, unknown>;
106
+ } | {
107
+ t: 'close';
108
+ viewer: string;
109
+ connectionId: string;
110
+ } | {
111
+ t: 'viewer-gone';
112
+ viewer: string;
113
+ } | Pong;
114
+ export type BridgeOut = {
115
+ t: 'opened';
116
+ viewer: string;
117
+ connectionId: string;
118
+ host: Host;
119
+ } | {
120
+ t: 'answer';
121
+ viewer: string;
122
+ id: string;
123
+ answer: unknown;
124
+ } | {
125
+ t: 'event';
126
+ viewer: string;
127
+ connectionId: string;
128
+ frame: EngineFrame;
129
+ } | Ping;
130
+ export declare const CLOSE: {
131
+ readonly unauthorized: 4401;
132
+ readonly replaced: 4409;
133
+ readonly protocol: 4400;
134
+ readonly tooLarge: 4413;
135
+ readonly expired: 4403;
136
+ };
@@ -0,0 +1,11 @@
1
+ // The wire protocol between a bridge host, the relay and a desktop engine. Every frame is one JSON text
2
+ // message of at most MAX_FRAME_BYTES. The bridge host and the engine client keep a byte-for-byte copy of this file.
3
+ export const PROTOCOL_VERSION = 1;
4
+ export const MAX_FRAME_BYTES = 16 * 1024 * 1024;
5
+ /** The hello, the only frame the relay reads before `ready`, may be at most this large. */
6
+ export const PRE_HELLO_MAX_BYTES = 16 * 1024;
7
+ /** Once ready, a client sends `ping` this often, so both ends notice a dead socket while idle. */
8
+ export const CLIENT_PING_MS = 20_000;
9
+ /** A client that has received no frame of any kind for this long treats the socket as dead and reconnects. */
10
+ export const CLIENT_DEAD_MS = 50_000;
11
+ export const CLOSE = { unauthorized: 4401, replaced: 4409, protocol: 4400, tooLarge: 4413, expired: 4403 };
@@ -0,0 +1,12 @@
1
+ import type { RemoteShare } from '../remote/types.js';
2
+ export interface BridgeIdentity {
3
+ environmentId: string;
4
+ name: string;
5
+ secret: string;
6
+ linkedAt: string;
7
+ }
8
+ export declare function readBridgeIdentity(directory: string): Promise<BridgeIdentity | undefined>;
9
+ export declare function writeBridgeIdentity(directory: string, identity: BridgeIdentity): Promise<void>;
10
+ export declare function clearBridgeIdentity(directory: string): Promise<void>;
11
+ /** Shares a folder with the machine's desktops: the real path is stored, and a folder already shared keeps its id. */
12
+ export declare function shareFolder(directory: string, value: string, label?: string): Promise<RemoteShare>;
@@ -0,0 +1,61 @@
1
+ import { mkdir, readFile, realpath, rename, rm, stat, writeFile } from 'node:fs/promises';
2
+ import { join, resolve } from 'node:path';
3
+ import { randomBytes, randomUUID } from 'node:crypto';
4
+ import { changeConfigFile } from '../config.js';
5
+ const FILE = 'bridge.json';
6
+ const MAX_FOLDERS = 64;
7
+ function isIdentity(value) {
8
+ if (!value || typeof value !== 'object' || Array.isArray(value))
9
+ return false;
10
+ const found = value;
11
+ return ['environmentId', 'name', 'secret', 'linkedAt'].every(key => typeof found[key] === 'string' && found[key].length > 0);
12
+ }
13
+ export async function readBridgeIdentity(directory) {
14
+ try {
15
+ const parsed = JSON.parse(await readFile(join(directory, FILE), 'utf8'));
16
+ if (!isIdentity(parsed))
17
+ return undefined;
18
+ const { environmentId, name, secret, linkedAt } = parsed;
19
+ return { environmentId, name, secret, linkedAt };
20
+ }
21
+ catch {
22
+ return undefined;
23
+ }
24
+ }
25
+ export async function writeBridgeIdentity(directory, identity) {
26
+ await mkdir(directory, { recursive: true });
27
+ const target = join(directory, FILE);
28
+ const temporary = `${target}.${randomUUID()}.tmp`;
29
+ try {
30
+ await writeFile(temporary, `${JSON.stringify(identity, null, 2)}\n`, { mode: 0o600 });
31
+ await rename(temporary, target);
32
+ }
33
+ catch (error) {
34
+ await rm(temporary, { force: true }).catch(() => undefined);
35
+ throw error;
36
+ }
37
+ }
38
+ export async function clearBridgeIdentity(directory) {
39
+ await rm(join(directory, FILE), { force: true });
40
+ }
41
+ /** Shares a folder with the machine's desktops: the real path is stored, and a folder already shared keeps its id. */
42
+ export async function shareFolder(directory, value, label) {
43
+ const real = await realpath(resolve(value)).catch(() => undefined);
44
+ if (!real)
45
+ throw new Error(`That folder does not exist: ${value}`);
46
+ if (!(await stat(real)).isDirectory())
47
+ throw new Error(`That path is not a folder: ${value}`);
48
+ let stored = { id: randomBytes(6).toString('hex'), path: real, ...(label === undefined ? {} : { label }) };
49
+ await changeConfigFile(directory, config => {
50
+ const current = config.bridge?.folders ?? [];
51
+ const existing = current.find(folder => folder.path === real);
52
+ if (existing) {
53
+ stored = existing;
54
+ return config;
55
+ }
56
+ if (current.length >= MAX_FOLDERS)
57
+ throw new Error('This machine already shares the maximum number of folders.');
58
+ return { ...config, bridge: { ...config.bridge, folders: [...current, stored] } };
59
+ });
60
+ return stored;
61
+ }
@@ -0,0 +1,6 @@
1
+ /** The launcher (npx @andorra-labs/bridge) sets ANDORRA_BRIDGE_LAUNCHER=1 for every engine it starts; that machine has no "andorra" command. */
2
+ export declare function launchedFromEnvironment(): boolean;
3
+ /** How a person types a bridge command on this machine: the text is fixed here, the environment only selects it. */
4
+ export declare function bridgeCommand(name: string, launched?: boolean): string;
5
+ /** A command named to a desktop, which cannot tell how that machine runs the bridge: both forms. */
6
+ export declare function bothBridgeCommands(name: string): string;
@@ -0,0 +1,10 @@
1
+ /** The launcher (npx @andorra-labs/bridge) sets ANDORRA_BRIDGE_LAUNCHER=1 for every engine it starts; that machine has no "andorra" command. */
2
+ export function launchedFromEnvironment() { return process.env.ANDORRA_BRIDGE_LAUNCHER === '1'; }
3
+ /** How a person types a bridge command on this machine: the text is fixed here, the environment only selects it. */
4
+ export function bridgeCommand(name, launched = launchedFromEnvironment()) {
5
+ return `${launched ? 'npx @andorra-labs/bridge' : 'andorra bridge'} ${name}`;
6
+ }
7
+ /** A command named to a desktop, which cannot tell how that machine runs the bridge: both forms. */
8
+ export function bothBridgeCommands(name) {
9
+ return `${bridgeCommand(name, false)}, or ${bridgeCommand(name, true)}`;
10
+ }
@@ -253,6 +253,7 @@ export async function runBrowserTask(session, task, control, options = {}) {
253
253
  status: result.status, ...(result.reason === undefined ? {} : { reason: result.reason }),
254
254
  ...(result.providerRequestFailed ? { providerRequestFailed: true } : {}),
255
255
  ...(result.providerOverflow ? { providerOverflow: true } : {}),
256
+ ...(result.failureCode === undefined ? {} : { errorCode: result.failureCode }),
256
257
  ...(result.telemetry !== undefined || probeModels.size > 0 ? { telemetry: finishedTelemetry } : {}),
257
258
  toolCalls: result.toolCalls,
258
259
  });
@@ -26,6 +26,12 @@ function withRailFields(target, predecessor, carryFiling) {
26
26
  }
27
27
  return target;
28
28
  }
29
+ /** An archived task leaves the rail's list, so it does not stay pinned there (the engine's `sessions.setArchived` does the same). */
30
+ function withoutPinWhenArchived(target) {
31
+ if (target.archived === true)
32
+ delete target.pinned;
33
+ return target;
34
+ }
29
35
  function terminalCompletion(completion, status) {
30
36
  return completion.status === undefined ? { ...completion, status } : completion;
31
37
  }
@@ -382,7 +388,7 @@ export async function startBrowserServer(options = {}) {
382
388
  const now = new Date().toISOString();
383
389
  const apply = (target) => change === 'rename'
384
390
  ? { ...target, name, renamed: true, updatedAt: now }
385
- : { ...target, archived: body.archived };
391
+ : withoutPinWhenArchived({ ...target, archived: body.archived });
386
392
  let copy;
387
393
  try {
388
394
  const { previousPrimaryDigest, ...saved } = JSON.parse(await readFile(join(folder, `${id}.json`), 'utf8'));
@@ -72,9 +72,9 @@ textarea{resize:none;line-height:var(--leading-sm)}
72
72
  .mark{width:16px;height:16px;flex:none;display:inline-grid;place-items:center}
73
73
  .mark::before{content:'';display:block;box-sizing:border-box;border-radius:var(--radius-full)}
74
74
  .mark.running::before{width:12px;height:12px;border:1.5px solid var(--border-strong);border-top-color:var(--text-2);animation:spin var(--loop-spin) linear infinite}
75
- .mark.waiting::before{width:8px;height:8px;background:var(--text)}
76
- .mark.failed::before{width:8px;height:8px;background:var(--err)}
77
- .mark.stopped::before{width:8px;height:8px;border:1.5px solid var(--text-3)}
75
+ .mark.waiting::before{width:6px;height:6px;background:var(--status-waiting)}
76
+ .mark.failed::before{width:6px;height:6px;background:var(--err)}
77
+ .mark.stopped::before{content:none}
78
78
  .mark.unread::before{width:6px;height:6px;background:var(--text-3)}
79
79
  @keyframes spin{to{transform:rotate(360deg)}}
80
80
  .empty-projects{padding:var(--space-2) var(--space-3);color:var(--text-3);font-size:var(--type-xs);line-height:var(--leading-xs)}
@@ -1,10 +1,12 @@
1
1
  :root {
2
- --rail-width: 232px;
3
- --rail-task-indent: 28px;
4
- --chrome-height: 36px;
2
+ --rail-width: 252px;
3
+ --rail-task-indent: 12px;
4
+ --chrome-height: 44px;
5
5
  --reading-measure: 792px;
6
6
  --settings-measure: 880px;
7
- --row-height: 28px;
7
+ --group-radius: 10px;
8
+ --settings-page-measure: 680px;
9
+ --row-height: 30px;
8
10
  --row-radius: 6px;
9
11
  --control-height: 28px;
10
12
  --btn-height: 32px;
@@ -21,17 +23,17 @@
21
23
  --type-section: 15px;
22
24
  --type-hint: 12px;
23
25
  --type-h1: 17px;
24
- --weight-regular: 400; --weight-strong: 500;
26
+ --weight-regular: 400; --weight-strong: 500; --weight-title: 600;
25
27
  --leading-xs: 16px; --leading-sm: 18px; --leading-md: 20px; --leading-prose: 22px; --leading-lg: 24px;
26
28
  --leading-code: 18px;
27
29
  --tracking-sm: -0.08px; --tracking-title: -0.01em; --tracking-code: .06em;
28
30
  --type-prose: 14px; --weight-prose: 400; --weight-prose-strong: 600; --weight-prose-bold: 500;
29
- --text-prose: color-mix(in srgb, var(--text) 80%, var(--bg-surface));
31
+ --text-prose: var(--text);
30
32
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
31
33
  --input-height: 32px;
32
34
  --input-radius: 8px;
33
35
 
34
- --bg-rail: #101010; --bg-app: #141414; --bg-surface: #191919; --bg-input: #1f1f1f;
36
+ --bg-rail: #181818; --bg-app: #141414; --bg-surface: #141414; --bg-input: #212121;
35
37
  --text: #f5f5f5; --text-2: rgba(245,245,245,.74); --text-3: rgba(245,245,245,.60); --shimmer-dim: 40%;
36
38
  --text-disabled: rgba(245,245,245,.36);
37
39
  --border: rgba(245,245,245,.08); --border-strong: rgba(245,245,245,.12);
@@ -39,16 +41,20 @@
39
41
  --bg-control: rgba(245,245,245,.08); --bg-control-hover: rgba(245,245,245,.14);
40
42
  --bg-raised: rgba(245,245,245,.16);
41
43
  --bg-card-solid: color-mix(in srgb, var(--text) 6%, var(--bg-surface));
42
- --switch-off: var(--text-disabled);
43
- --hover: color-mix(in srgb, var(--text) 7%, transparent);
44
- --selected: color-mix(in srgb, var(--text) 12%, transparent);
44
+ --bg-group: color-mix(in srgb, var(--text) 4%, var(--bg-surface));
45
+ --bg-bubble: var(--bg-input);
46
+ --switch-off: color-mix(in srgb, var(--text) 18%, transparent); --switch-on: #3fa266; --switch-knob: #ffffff;
47
+ --hover: color-mix(in srgb, var(--text) 5%, transparent);
48
+ --selected: color-mix(in srgb, var(--text) 8%, transparent);
49
+ --pressed: color-mix(in srgb, var(--text) 10%, transparent);
45
50
  --bg-hover: var(--hover);
46
51
  --accent: #ececec; --accent-soft: rgba(245,245,245,.16); --on-accent: #141414;
47
52
  --accent-hover: #ffffff; --accent-ring: rgba(245,245,245,.36);
48
- --accent-fill: #1372da; --accent-fill-hover: #2a7fdd; --on-accent-fill: #f5f5f5;
53
+ --accent-fill: #1372da; --accent-fill-hover: #2a7fdd; --accent-fill-pressed: #0f63c2; --on-accent-fill: #f5f5f5;
49
54
  --accent-text: #71aeff; --focus: #1f87fc;
55
+ --status-waiting: #518cce;
50
56
  --ok: #2f9e6a; --err: #e5484d; --warn: #c9c9c9; --caution: #d9a520; --caution-text: #f2c94c;
51
- --ok-text: #7cc79a; --err-text: #f47174; --warn-text: #ececec; --merged-text: #bba4f2; --draft-text: #f0a35e;
57
+ --ok-text: #7cc79a; --err-text: #f47174; --warn-text: #ececec; --merged-text: #bba4f2;
52
58
  --skill: #aab8ff; --skill-wash: rgba(120,140,255,.18);
53
59
  --ok-wash: rgba(47,158,106,.14); --err-wash: rgba(229,72,77,.14); --merged-wash: rgba(142,110,224,.14);
54
60
  --add-wash: rgba(47,158,106,.16); --del-wash: rgba(229,72,77,.16);
@@ -67,7 +73,7 @@
67
73
  --shadow-raised: 0 1px 2px rgba(0,0,0,.32);
68
74
  --shadow-knob: 0 1px 2px rgba(0,0,0,.4);
69
75
 
70
- --z-raised: 10; --z-chrome: 30; --z-rail-menu: 40; --z-dialog: 50; --z-menu: 60; --z-palette: 70; --z-toast: 80;
76
+ --z-raised: 10; --z-chrome: 30; --z-dialog: 50; --z-menu: 60; --z-palette: 70; --z-toast: 80;
71
77
  --z-lightbox: 90; --z-tooltip: 100;
72
78
 
73
79
  --dur-0: 80ms; --dur-1: 120ms; --dur-2: 160ms; --dur-3: 200ms; --dur-4: 240ms;
@@ -78,6 +84,7 @@
78
84
  --pop-distance: 4px; --pop-scale: .98;
79
85
  --loop-spin: 1s; --loop-shimmer: 1.8s; --loop-breathe: 2.4s;
80
86
  --delay-hover-intent: 150ms;
87
+ --delay-startup-status: 800ms;
81
88
 
82
89
  color-scheme: dark;
83
90
  }
@@ -85,17 +92,21 @@
85
92
  :root[data-theme="light"] {
86
93
  --bg-rail: #f5f5f5; --bg-app: #ffffff; --bg-surface: #ffffff; --bg-input: #ffffff;
87
94
  --text: #1c1c1c; --text-2: rgba(28,28,28,.74); --text-3: rgba(28,28,28,.66); --shimmer-dim: 34%; --text-disabled: rgba(28,28,28,.36);
88
- --border: rgba(28,28,28,.08); --border-strong: rgba(28,28,28,.12);
95
+ --border: rgba(28,28,28,.10); --border-strong: rgba(28,28,28,.14);
89
96
  --bg-card: rgba(28,28,28,.06);
90
97
  --bg-control: rgba(28,28,28,.08); --bg-control-hover: rgba(28,28,28,.14);
91
98
  --bg-raised: #ffffff;
92
- --switch-off: color-mix(in srgb, var(--text) 50%, transparent);
99
+ --switch-off: color-mix(in srgb, var(--text) 50%, transparent); --switch-on: #2f9e6a;
100
+ --bg-group: rgba(28,28,28,.035); --bg-bubble: #f5f5f5;
101
+ --hover: color-mix(in srgb, var(--text) 6%, transparent); --selected: color-mix(in srgb, var(--text) 10%, transparent);
102
+ --pressed: color-mix(in srgb, var(--text) 13%, transparent);
93
103
  --accent: #1c1c1c; --accent-soft: rgba(28,28,28,.16); --on-accent: #ffffff;
94
104
  --accent-hover: #333333; --accent-ring: rgba(28,28,28,.48);
95
- --accent-fill: #1680f3; --accent-fill-hover: #1776dd; --on-accent-fill: #ffffff;
105
+ --accent-fill: #1680f3; --accent-fill-hover: #1776dd; --accent-fill-pressed: #1468c8; --on-accent-fill: #ffffff;
96
106
  --accent-text: #0b6dd3; --focus: #1680f3;
107
+ --status-waiting: #2f6fbd;
97
108
  --ok: #3d7a5c; --err: #d13438; --warn: #45464b; --caution: #b8860b; --caution-text: #8a6100;
98
- --ok-text: #36704f; --err-text: #c4262e; --warn-text: #1c1c1c; --merged-text: #6a4fc4; --draft-text: #b35a0e;
109
+ --ok-text: #36704f; --err-text: #c4262e; --warn-text: #1c1c1c; --merged-text: #6a4fc4;
99
110
  --skill: #3b4fc4; --skill-wash: rgba(59,79,196,.10);
100
111
  --ok-wash: rgba(61,122,92,.08); --err-wash: rgba(209,52,56,.08); --merged-wash: rgba(106,79,196,.08);
101
112
  --add-wash: rgba(61,122,92,.14); --del-wash: rgba(209,52,56,.13);
@@ -0,0 +1,41 @@
1
+ import { type FileDiffHunk } from './file-diff.js';
2
+ /**
3
+ * Who wrote which lines of a file the agent and the person both changed (design/specs/files-tab-v3.md, "As built
4
+ * (wrap-up)"). Three texts are compared: the baseline from before the task, what the agent last wrote (with the
5
+ * person's lines it carried over from an earlier save), and the file now. A line of the file now that is not in the
6
+ * agent's copy is the person's; a baseline line that the agent's copy kept but the file now lacks is one the person
7
+ * removed. Everything else the task changed is the agent's.
8
+ */
9
+ export type LineRange = [number, number];
10
+ /** How the lines of one text map to another's: lines only in the new text, lines only in the old, and the rest paired. */
11
+ export interface LineMap {
12
+ added: Set<number>;
13
+ removed: Set<number>;
14
+ newOfOld: Map<number, number>;
15
+ }
16
+ /** The line pairing of two texts, or undefined when they are too large to pair line by line. Lines count from 1. */
17
+ export declare function lineMap(oldText: string, newText: string): LineMap | undefined;
18
+ /** Sorted, merged ranges of a set of line numbers. */
19
+ export declare function rangesOf(lines: Iterable<number>): LineRange[];
20
+ /**
21
+ * The person's lines in `current`: those not in the agent's copy, and those the agent's copy carried over from the
22
+ * person (`carried`, in the agent copy's numbering) that are still there. Undefined when the texts are too large.
23
+ */
24
+ export declare function userLines(agentText: string, current: string, carried?: readonly LineRange[]): Set<number> | undefined;
25
+ /**
26
+ * The person's lines an agent write keeps: the person's lines in the text the agent wrote over (`before`) that the
27
+ * agent's text (`after`) still has, in the agent text's numbering.
28
+ */
29
+ export declare function carriedUserLines(previousAgent: string, previousCarried: readonly LineRange[], before: string, after: string): LineRange[] | undefined;
30
+ /**
31
+ * The baseline lines the person removed, in the baseline's numbering (which never moves): those the agent's copy kept
32
+ * that `current` lacks, and those an earlier save removed (`carried`) that are still gone.
33
+ */
34
+ export declare function userRemovedLines(baseline: string, agentText: string, current: string, carried?: readonly LineRange[]): Set<number> | undefined;
35
+ /**
36
+ * Marks each added and removed line of the task's diff (baseline against the file now) with its author. Returns false,
37
+ * leaving the hunks unmarked, when the texts are too large to pair.
38
+ */
39
+ export declare function markAuthors(hunks: FileDiffHunk[], baseline: string, agentText: string, current: string, carried?: readonly LineRange[], carriedRemoved?: readonly LineRange[]): boolean;
40
+ /** "line 12", "lines 12–14", "lines 3, 12–14 and 30"; past `limit` ranges, "… and 9 more places". */
41
+ export declare function linesWords(ranges: readonly LineRange[], limit?: number): string;
@@ -0,0 +1,146 @@
1
+ import { textDiff } from './file-diff.js';
2
+ /** The line pairing of two texts, or undefined when they are too large to pair line by line. Lines count from 1. */
3
+ export function lineMap(oldText, newText) {
4
+ const diff = textDiff(oldText, newText, { context: 0, maxLines: Number.MAX_SAFE_INTEGER, maxChars: Number.MAX_SAFE_INTEGER, lineChars: 1 });
5
+ // A matcher that gave up pairs nothing in the middle: no line could be told apart, so nothing is claimed.
6
+ if (diff.coarse || diff.approximate)
7
+ return undefined;
8
+ const added = new Set();
9
+ const removed = new Set();
10
+ for (const hunk of diff.hunks)
11
+ for (const line of hunk.lines) {
12
+ if (line.kind === 'add' && line.newLine !== undefined)
13
+ added.add(line.newLine);
14
+ else if (line.kind === 'del' && line.oldLine !== undefined)
15
+ removed.add(line.oldLine);
16
+ }
17
+ const newOfOld = new Map();
18
+ const oldCount = countLines(oldText);
19
+ const newCount = countLines(newText);
20
+ for (let oldLine = 1, newLine = 1; oldLine <= oldCount; oldLine++) {
21
+ if (removed.has(oldLine))
22
+ continue;
23
+ while (newLine <= newCount && added.has(newLine))
24
+ newLine++;
25
+ if (newLine > newCount)
26
+ break;
27
+ newOfOld.set(oldLine, newLine);
28
+ newLine++;
29
+ }
30
+ return { added, removed, newOfOld };
31
+ }
32
+ function countLines(text) {
33
+ if (text === '')
34
+ return 0;
35
+ let count = 0;
36
+ for (let at = text.indexOf('\n'); at >= 0; at = text.indexOf('\n', at + 1))
37
+ count++;
38
+ return text.endsWith('\n') ? count : count + 1;
39
+ }
40
+ /** Whether `line` falls in sorted, non-overlapping `ranges` (binary search: a file can hold many of them). */
41
+ const inRanges = (ranges, line) => {
42
+ let low = 0, high = ranges.length - 1;
43
+ while (low <= high) {
44
+ const middle = (low + high) >> 1;
45
+ const [start, end] = ranges[middle];
46
+ if (line < start)
47
+ high = middle - 1;
48
+ else if (line > end)
49
+ low = middle + 1;
50
+ else
51
+ return true;
52
+ }
53
+ return false;
54
+ };
55
+ /** Sorted, merged ranges of a set of line numbers. */
56
+ export function rangesOf(lines) {
57
+ const sorted = [...new Set(lines)].sort((left, right) => left - right);
58
+ const out = [];
59
+ for (const line of sorted) {
60
+ const last = out.at(-1);
61
+ if (last && line === last[1] + 1)
62
+ last[1] = line;
63
+ else
64
+ out.push([line, line]);
65
+ }
66
+ return out;
67
+ }
68
+ /**
69
+ * The person's lines in `current`: those not in the agent's copy, and those the agent's copy carried over from the
70
+ * person (`carried`, in the agent copy's numbering) that are still there. Undefined when the texts are too large.
71
+ */
72
+ export function userLines(agentText, current, carried = []) {
73
+ const map = lineMap(agentText, current);
74
+ if (!map)
75
+ return undefined;
76
+ const lines = new Set(map.added);
77
+ if (carried.length)
78
+ for (const [oldLine, newLine] of map.newOfOld)
79
+ if (inRanges(carried, oldLine))
80
+ lines.add(newLine);
81
+ return lines;
82
+ }
83
+ /**
84
+ * The person's lines an agent write keeps: the person's lines in the text the agent wrote over (`before`) that the
85
+ * agent's text (`after`) still has, in the agent text's numbering.
86
+ */
87
+ export function carriedUserLines(previousAgent, previousCarried, before, after) {
88
+ const theirs = userLines(previousAgent, before, previousCarried);
89
+ if (!theirs)
90
+ return undefined;
91
+ if (!theirs.size)
92
+ return [];
93
+ const map = lineMap(before, after);
94
+ if (!map)
95
+ return undefined;
96
+ const kept = [];
97
+ for (const line of theirs) {
98
+ const moved = map.newOfOld.get(line);
99
+ if (moved !== undefined)
100
+ kept.push(moved);
101
+ }
102
+ return rangesOf(kept);
103
+ }
104
+ /**
105
+ * The baseline lines the person removed, in the baseline's numbering (which never moves): those the agent's copy kept
106
+ * that `current` lacks, and those an earlier save removed (`carried`) that are still gone.
107
+ */
108
+ export function userRemovedLines(baseline, agentText, current, carried = []) {
109
+ const agentKept = lineMap(baseline, agentText);
110
+ const now = lineMap(baseline, current);
111
+ if (!agentKept || !now)
112
+ return undefined;
113
+ const lines = new Set();
114
+ for (const line of now.removed)
115
+ if (!agentKept.removed.has(line) || inRanges(carried, line))
116
+ lines.add(line);
117
+ return lines;
118
+ }
119
+ /**
120
+ * Marks each added and removed line of the task's diff (baseline against the file now) with its author. Returns false,
121
+ * leaving the hunks unmarked, when the texts are too large to pair.
122
+ */
123
+ export function markAuthors(hunks, baseline, agentText, current, carried = [], carriedRemoved = []) {
124
+ const theirs = userLines(agentText, current, carried);
125
+ const removed = userRemovedLines(baseline, agentText, current, carriedRemoved);
126
+ if (!theirs || !removed)
127
+ return false;
128
+ for (const hunk of hunks)
129
+ for (const line of hunk.lines) {
130
+ if (line.kind === 'add' && line.newLine !== undefined)
131
+ line.author = theirs.has(line.newLine) ? 'user' : 'agent';
132
+ else if (line.kind === 'del' && line.oldLine !== undefined)
133
+ line.author = removed.has(line.oldLine) ? 'user' : 'agent';
134
+ }
135
+ return true;
136
+ }
137
+ /** "line 12", "lines 12–14", "lines 3, 12–14 and 30"; past `limit` ranges, "… and 9 more places". */
138
+ export function linesWords(ranges, limit = 8) {
139
+ if (ranges.length > limit) {
140
+ const rest = ranges.length - limit;
141
+ return `${linesWords(ranges.slice(0, limit), limit).replace(' and ', ', ')}, and ${rest} more ${rest === 1 ? 'place' : 'places'}`;
142
+ }
143
+ const words = ranges.map(([start, end]) => (start === end ? `${start}` : `${start}–${end}`));
144
+ const noun = ranges.length === 1 && ranges[0][0] === ranges[0][1] ? 'line' : 'lines';
145
+ return `${noun} ${words.length > 1 ? `${words.slice(0, -1).join(', ')} and ${words.at(-1)}` : words[0]}`;
146
+ }
@@ -183,6 +183,8 @@ export async function readClaudeCatalog(signal, dependencies = {}) {
183
183
  }
184
184
  class MalformedClaudeStep extends Error {
185
185
  unparsedReply;
186
+ /** Record-only telemetry code; the error keeps its class so whole-agent retries behave as before. */
187
+ telemetryCode = 'malformed_response';
186
188
  constructor(message, unparsedReply) {
187
189
  super(message);
188
190
  this.unparsedReply = unparsedReply;
@@ -628,7 +630,7 @@ export function createClaudeAdapter(_config, dependencies = {}) {
628
630
  catch (error) {
629
631
  if (!(error instanceof MalformedClaudeStep) || attempt >= STEP_ATTEMPTS)
630
632
  throw error;
631
- await request.onRetry?.({ retry: attempt, maxRetries: STEP_ATTEMPTS - 1, delayMs: 0, reason: `${error.message}. Asking again.`, quiet: true,
633
+ await request.onRetry?.({ retry: attempt, maxRetries: STEP_ATTEMPTS - 1, delayMs: 0, reason: `${error.message}. Asking again.`, quiet: true, code: 'malformed_response',
632
634
  ...(error.unparsedReply === undefined ? {} : { unparsedReply: error.unparsedReply }) });
633
635
  input = compose(retryNote(error.message));
634
636
  }