@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,21 @@
1
+ export declare function addProjectEntry(path: string, options?: {
2
+ name?: string;
3
+ directory?: string;
4
+ }): Promise<void>;
5
+ export declare function relinkProjectEntry(from: string, to: string, options?: {
6
+ name?: string;
7
+ directory?: string;
8
+ }): Promise<boolean>;
9
+ /**
10
+ * The id `path` answers to, storing `candidate` when it has none yet and returning whichever id is actually on the entry.
11
+ * Two tasks created at the same moment on a folder that has just been added would otherwise each store their own id, and
12
+ * the loser keeps an identity the registry never accepted, splitting the project's browser profiles for good.
13
+ */
14
+ export declare function ensureProjectIdentity(path: string, candidate: string, directory?: string): Promise<string | undefined>;
15
+ /**
16
+ * Remembers the project id a folder answers to, so a task started after a rename or a
17
+ * merge belongs to the same project as the tasks that were already there.
18
+ * An id already on the entry wins: a second rename must not restart the project's identity.
19
+ */
20
+ export declare function rememberProjectIdentity(path: string, id: string, directory?: string): Promise<void>;
21
+ export declare function removeProjectEntry(path: string, directory?: string): Promise<boolean>;
@@ -0,0 +1,74 @@
1
+ import { changeConfigFile, configDirectory } from './config.js';
2
+ // The local project registry (`projects` in config.json): the folders the sidebar lists and the identity each answers to.
3
+ export async function addProjectEntry(path, options = {}) {
4
+ const directory = options.directory ?? configDirectory();
5
+ const name = typeof options.name === 'string' && options.name.trim() ? options.name.trim().slice(0, 100) : undefined;
6
+ await changeConfigFile(directory, config => {
7
+ const projects = config.projects ?? [];
8
+ if (projects.some(project => project.path === path))
9
+ return config;
10
+ if (projects.length >= 256)
11
+ throw new Error('The project registry is full.');
12
+ return { ...config, projects: [...projects, { path, ...(name ? { name } : {}), addedAt: new Date().toISOString() }] };
13
+ });
14
+ }
15
+ export async function relinkProjectEntry(from, to, options = {}) {
16
+ const directory = options.directory ?? configDirectory();
17
+ const name = typeof options.name === 'string' && options.name.trim() ? options.name.trim().slice(0, 100) : undefined;
18
+ let relinked = false;
19
+ await changeConfigFile(directory, config => {
20
+ const projects = config.projects ?? [];
21
+ if (!projects.some(project => project.path === from) || projects.some(project => project.path === to))
22
+ return config;
23
+ relinked = true;
24
+ return { ...config, projects: projects.map(project => {
25
+ if (project.path !== from)
26
+ return project;
27
+ const { name: _previous, ...kept } = project;
28
+ return { ...kept, path: to, ...(name ? { name } : {}) };
29
+ }) };
30
+ });
31
+ return relinked;
32
+ }
33
+ /**
34
+ * The id `path` answers to, storing `candidate` when it has none yet and returning whichever id is actually on the entry.
35
+ * Two tasks created at the same moment on a folder that has just been added would otherwise each store their own id, and
36
+ * the loser keeps an identity the registry never accepted, splitting the project's browser profiles for good.
37
+ */
38
+ export async function ensureProjectIdentity(path, candidate, directory = configDirectory()) {
39
+ let id;
40
+ await changeConfigFile(directory, config => {
41
+ const projects = config.projects ?? [];
42
+ const entry = projects.find(project => project.path === path);
43
+ if (!entry)
44
+ return config;
45
+ if (typeof entry.id === 'string' && /^[a-f0-9]{16}$/.test(entry.id)) {
46
+ id = entry.id;
47
+ return config;
48
+ }
49
+ id = candidate;
50
+ return { ...config, projects: projects.map(project => (project === entry ? { ...project, id: candidate } : project)) };
51
+ });
52
+ return id;
53
+ }
54
+ /**
55
+ * Remembers the project id a folder answers to, so a task started after a rename or a
56
+ * merge belongs to the same project as the tasks that were already there.
57
+ * An id already on the entry wins: a second rename must not restart the project's identity.
58
+ */
59
+ export async function rememberProjectIdentity(path, id, directory = configDirectory()) {
60
+ await changeConfigFile(directory, config => ({
61
+ ...config,
62
+ projects: (config.projects ?? []).map(project => project.path === path && project.id === undefined ? { ...project, id } : project),
63
+ }));
64
+ }
65
+ export async function removeProjectEntry(path, directory = configDirectory()) {
66
+ let removed = false;
67
+ await changeConfigFile(directory, config => {
68
+ const projects = config.projects ?? [];
69
+ const kept = projects.filter(project => project.path !== path);
70
+ removed = kept.length !== projects.length;
71
+ return removed ? { ...config, projects: kept } : config;
72
+ });
73
+ return removed;
74
+ }
@@ -228,13 +228,16 @@ export async function generateEngineResponse(request, host) {
228
228
  const status = error.status;
229
229
  if (status !== 400 && status !== 422)
230
230
  throw error;
231
+ const recovered = () => request.onRecoveredError?.(`http_${status}`);
231
232
  if (body.tool_choice !== undefined) {
232
233
  const { tool_choice: _choice, ...unforced } = body;
234
+ recovered();
233
235
  return sendWithFallbacks(unforced);
234
236
  }
235
237
  if (host.streamingDisabled?.())
236
238
  throw error;
237
239
  const { stream_options: _options, ...plain } = body;
240
+ recovered();
238
241
  return host.send({ ...plain, stream: false });
239
242
  }
240
243
  };
@@ -1,19 +1,7 @@
1
- import type { CommandScreenUI } from './command-screens.js';
2
- import { type Config } from './config.js';
3
1
  import { type ProviderConfig } from './providers.js';
4
- import type { RemoteWorkspace } from './remote/types.js';
5
- export declare const PEER_PROVIDER_EXPORT_CAPABILITY = "remote.providers.export";
6
2
  export declare function normalizeExportedProvider(value: unknown): ProviderConfig | undefined;
7
3
  export declare function normalizeExportedProviders(payload: unknown): {
8
4
  providers: ProviderConfig[];
9
5
  rejected: string[];
10
6
  };
11
7
  export declare function uniqueProviderId(taken: (id: string) => boolean, base: string): string;
12
- export declare function reconcileImportedCodexAccount(incoming: ProviderConfig, existing: ProviderConfig | undefined, draft: readonly ProviderConfig[], saved: readonly ProviderConfig[]): ProviderConfig;
13
- export interface PeerProviderExportResult {
14
- providers: ProviderConfig[];
15
- rejected: string[];
16
- hostname: string;
17
- }
18
- export declare function fetchPeerProviderExport(workspace: RemoteWorkspace, signal?: AbortSignal): Promise<PeerProviderExportResult>;
19
- export declare function importProvidersFromRemote(config: Config, ui: CommandScreenUI, signal: AbortSignal, fetch?: (workspace: RemoteWorkspace, loadSignal: AbortSignal) => Promise<PeerProviderExportResult>): Promise<Config | undefined>;
@@ -1,12 +1,7 @@
1
1
  import { validateConfig } from './config.js';
2
- import { freeDraftCodexAccountSlot, MAX_PROVIDER_NAME_LENGTH } from './providers.js';
3
- import { peerProviderExport, peerWhoami } from './remote/client.js';
4
- import { RemotePeerError } from './remote/errors.js';
5
- export const PEER_PROVIDER_EXPORT_CAPABILITY = 'remote.providers.export';
6
- const PEER_IMPORT_DEADLINE_MS = 60_000;
2
+ import { MAX_PROVIDER_NAME_LENGTH } from './providers.js';
7
3
  const MAX_EXPORTED_PROVIDERS = 100;
8
4
  const IMPORT_PROVIDER_TYPES = new Set(['openai-compatible', 'anthropic', 'codex', 'claude', 'opencode-go', 'grok', 'opencode', 'google']);
9
- function message(error) { return error instanceof Error ? error.message : String(error); }
10
5
  export function normalizeExportedProvider(value) {
11
6
  if (!value || typeof value !== 'object' || Array.isArray(value))
12
7
  return undefined;
@@ -50,6 +45,12 @@ export function normalizeExportedProvider(value) {
50
45
  return undefined;
51
46
  provider.modelContextWindows = Object.fromEntries(entries);
52
47
  }
48
+ if (raw.textOnlyModels !== undefined) {
49
+ if (!Array.isArray(raw.textOnlyModels) || raw.textOnlyModels.some(model => typeof model !== 'string' || !model.trim() || model.length > 500))
50
+ return undefined;
51
+ if (raw.textOnlyModels.length)
52
+ provider.textOnlyModels = raw.textOnlyModels;
53
+ }
53
54
  if (raw.contextWindow !== undefined) {
54
55
  const bound = raw.contextWindow;
55
56
  if (typeof bound !== 'number' || !Number.isSafeInteger(bound))
@@ -111,192 +112,3 @@ export function uniqueProviderId(taken, base) {
111
112
  candidate = `${base}-${suffix}`;
112
113
  return candidate;
113
114
  }
114
- export function reconcileImportedCodexAccount(incoming, existing, draft, saved) {
115
- if (incoming.type !== 'codex')
116
- return incoming;
117
- if (existing?.type === 'codex') {
118
- return {
119
- ...incoming,
120
- ...(existing.codexAccount === undefined ? {} : { codexAccount: existing.codexAccount }),
121
- ...(existing.codexEmail === undefined ? {} : { codexEmail: existing.codexEmail }),
122
- };
123
- }
124
- return draft.some(item => item.type === 'codex' && item.id !== incoming.id)
125
- ? { ...incoming, codexAccount: freeDraftCodexAccountSlot(incoming.id, draft, saved) }
126
- : incoming;
127
- }
128
- export async function fetchPeerProviderExport(workspace, signal) {
129
- const hosts = [...(workspace.host !== undefined ? [workspace.host] : []), ...workspace.hosts]
130
- .filter((host, index, list) => list.indexOf(host) === index);
131
- if (!hosts.length)
132
- throw new RemotePeerError('offline', 'No host to contact.');
133
- const target = {
134
- host: hosts[0], port: workspace.port, transport: workspace.transport, fingerprint: workspace.fingerprint,
135
- ...(workspace.certPem !== undefined ? { certPem: workspace.certPem } : {}),
136
- ...(workspace.token !== undefined ? { token: workspace.token } : {}),
137
- };
138
- const deadlineAt = Date.now() + PEER_IMPORT_DEADLINE_MS;
139
- let lastError;
140
- for (const host of hosts) {
141
- signal?.throwIfAborted();
142
- try {
143
- const identity = await peerWhoami(target, host, deadlineAt, signal);
144
- if (identity.grant !== 'full') {
145
- throw new RemotePeerError('rejected', `${workspace.nickname} granted this machine browse-only access. On that machine, give this device full control (Remote settings) or pair again with a full-access invitation, then retry.`);
146
- }
147
- if (!identity.capabilities?.includes(PEER_PROVIDER_EXPORT_CAPABILITY)) {
148
- throw new RemotePeerError('rejected', `${workspace.nickname} runs an older Andorra Code that cannot export providers. Update Andorra Code on that machine, then retry.`);
149
- }
150
- const { providers, rejected } = normalizeExportedProviders(await peerProviderExport(target, host, deadlineAt, signal));
151
- return { providers, rejected, hostname: identity.hostname };
152
- }
153
- catch (error) {
154
- signal?.throwIfAborted();
155
- const failure = error instanceof RemotePeerError ? error : new RemotePeerError('network', message(error));
156
- if (failure.kind === 'offline' || failure.kind === 'network') {
157
- lastError = failure;
158
- continue;
159
- }
160
- throw failure;
161
- }
162
- }
163
- throw lastError ?? new RemotePeerError('offline', `Could not reach ${workspace.nickname}.`);
164
- }
165
- function credentialNote(provider) {
166
- if (provider.type === 'codex')
167
- return 'ChatGPT sign-in does not transfer; sign in again after importing';
168
- if (provider.type === 'claude')
169
- return 'Claude Code sign-in does not transfer; sign in on this machine after importing';
170
- if (provider.type === 'grok')
171
- return 'Grok sign-in does not transfer; sign in on this machine after importing';
172
- if (provider.type === 'google')
173
- return 'Google sign-in does not transfer; sign in on this machine after importing';
174
- if (provider.type === 'opencode')
175
- return 'OpenCode sign-ins do not transfer; connect its providers on this machine after importing';
176
- if (provider.apiKey)
177
- return 'API key transfers';
178
- if (provider.apiKeyEnv)
179
- return `key from environment ${provider.apiKeyEnv}`;
180
- return 'no credential';
181
- }
182
- export async function importProvidersFromRemote(config, ui, signal, fetch = fetchPeerProviderExport) {
183
- const workspaces = config.remote?.workspaces ?? [];
184
- if (!workspaces.length) {
185
- await ui.showScreen('No remote connections', [
186
- 'Importing copies provider settings, saved API keys included, from a machine you paired with.',
187
- 'On the other machine, start sharing: andorra remote serve, or open its desktop app.',
188
- 'Pair it here: andorra remote pair <pairing-code> --name <nickname>',
189
- 'Then reopen /providers and import from that connection.',
190
- ], { signal });
191
- return;
192
- }
193
- const draft = structuredClone(config);
194
- const staged = [];
195
- const rejectedByWorkspace = new Map();
196
- const workspaceById = new Map(workspaces.map(workspace => [workspace.id, workspace]));
197
- while (!signal.aborted) {
198
- const choice = await ui.select('Import providers from', [
199
- ...workspaces.map(workspace => ({ id: workspace.id, label: workspace.nickname, description: `${workspace.host ?? workspace.hosts[0]}:${workspace.port} · ${workspace.transport}` })),
200
- ...(staged.length ? [{ id: ':divider', label: '', separator: true }, { id: ':done', label: `Import ${staged.length} provider${staged.length === 1 ? '' : 's'}`, bold: true }] : []),
201
- ], { signal });
202
- if (choice === undefined || signal.aborted)
203
- return;
204
- if (choice === ':divider')
205
- continue;
206
- if (choice === ':done') {
207
- if (!draft.provider)
208
- draft.provider = staged[0].id;
209
- try {
210
- validateConfig(draft);
211
- }
212
- catch (error) {
213
- await ui.showScreen('Import not applied', [message(error), 'Nothing was saved.'], { signal });
214
- return;
215
- }
216
- await ui.showScreen('Ready to import', [
217
- ...staged.map(entry => `${entry.mode === 'replace' ? 'Replaces' : 'Adds'} ${entry.id} — from ${entry.from} (${credentialNote(draft.providers.find(item => item.id === entry.id))})`),
218
- ...[...rejectedByWorkspace.values()].filter(item => item.rejected.length).map(item => `${item.nickname}: ${item.rejected.length} provider(s) could not be imported (${item.rejected.slice(0, 5).join(', ')}${item.rejected.length > 5 ? ', …' : ''})`),
219
- '',
220
- 'Saved API keys are copied over the paired connection into this machine\'s configuration.',
221
- ], { signal });
222
- return draft;
223
- }
224
- const workspace = workspaceById.get(choice);
225
- if (!workspace)
226
- continue;
227
- let fetched;
228
- try {
229
- fetched = await ui.loadScreen(`Providers on ${workspace.nickname}`, loadSignal => fetch(workspace, loadSignal), { signal, description: `${workspace.host ?? workspace.hosts[0]}:${workspace.port}` });
230
- }
231
- catch (error) {
232
- if (signal.aborted)
233
- return;
234
- await ui.showScreen('Import unavailable', [
235
- error instanceof RemotePeerError ? error.message : message(error),
236
- ...(error instanceof RemotePeerError && error.kind === 'identity'
237
- ? ['Unpair that machine (andorra remote unpair) and pair it again.'] : []),
238
- ], { signal });
239
- continue;
240
- }
241
- if (!fetched || signal.aborted)
242
- continue;
243
- rejectedByWorkspace.set(workspace.id, { nickname: workspace.nickname, rejected: fetched.rejected });
244
- if (fetched.rejected.length && fetched.providers.length) {
245
- await ui.showScreen('Some providers unavailable', [
246
- `${fetched.rejected.length} provider(s) from ${workspace.nickname} could not be imported:`,
247
- ...fetched.rejected.slice(0, 10),
248
- ...(fetched.rejected.length > 10 ? [`…and ${fetched.rejected.length - 10} more`] : []),
249
- 'Only valid providers will be offered for import.',
250
- ], { signal });
251
- if (signal.aborted)
252
- return;
253
- }
254
- if (!fetched.providers.length) {
255
- await ui.showScreen('No providers', [
256
- `${workspace.nickname} has no configured providers.`,
257
- ...(fetched.rejected.length ? [`${fetched.rejected.length} of its provider settings could not be read.`] : []),
258
- ], { signal });
259
- continue;
260
- }
261
- while (!signal.aborted) {
262
- const remaining = fetched.providers.filter(provider => !staged.some(entry => entry.origin === workspace.id && entry.peerId === provider.id));
263
- if (!remaining.length)
264
- break;
265
- const pick = await ui.select(`Providers on ${workspace.nickname}`, [
266
- ...(fetched.providers.length > 1 ? [{ id: ':all', label: 'Import all providers' }] : []),
267
- ...remaining.map(provider => ({ id: provider.id, label: `${provider.id} — ${provider.model}`, description: `${provider.type} · ${provider.baseUrl} · ${credentialNote(provider)}` })),
268
- { id: ':back', label: 'Back' },
269
- ], { signal });
270
- if (pick === undefined || signal.aborted || pick === ':back')
271
- break;
272
- const queue = pick === ':all' ? remaining : [fetched.providers.find(provider => provider.id === pick)];
273
- for (const provider of queue) {
274
- const existing = draft.providers.find(item => item.id === provider.id);
275
- if (!existing) {
276
- draft.providers.push(reconcileImportedCodexAccount(provider, undefined, draft.providers, config.providers));
277
- staged.push({ origin: workspace.id, peerId: provider.id, id: provider.id, mode: 'add', from: workspace.nickname });
278
- continue;
279
- }
280
- const renamed = uniqueProviderId(id => draft.providers.some(item => item.id === id), provider.id);
281
- const action = await ui.select(`${provider.id} already exists`, [
282
- { id: 'replace', label: `Replace ${provider.id}`, description: 'Overwrites this machine\'s settings and saved key for it.' },
283
- { id: 'rename', label: `Import as ${renamed}`, description: 'Keeps the existing provider unchanged.' },
284
- { id: 'skip', label: 'Skip this provider' },
285
- ], { selectedId: 'replace', signal });
286
- if (action === 'rename') {
287
- const renamedEntry = { ...provider, id: renamed };
288
- draft.providers.push(reconcileImportedCodexAccount(renamedEntry, undefined, draft.providers, config.providers));
289
- staged.push({ origin: workspace.id, peerId: provider.id, id: renamed, mode: 'add', from: workspace.nickname });
290
- }
291
- else if (action === 'replace') {
292
- draft.providers[draft.providers.indexOf(existing)] = reconcileImportedCodexAccount(provider, existing, draft.providers, config.providers);
293
- const earlier = staged.findIndex(entry => entry.id === provider.id);
294
- if (earlier !== -1)
295
- staged.splice(earlier, 1);
296
- staged.push({ origin: workspace.id, peerId: provider.id, id: provider.id,
297
- mode: config.providers.some(item => item.id === provider.id) ? 'replace' : 'add', from: workspace.nickname });
298
- }
299
- }
300
- }
301
- }
302
- }
@@ -1,10 +1,12 @@
1
+ import type { Config } from './config.js';
1
2
  import type { ModelAdapter } from './types.js';
3
+ export { acceptsImages } from './image-input.js';
2
4
  export declare const REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
3
5
  /** Provider types whose requests carry a thinking-effort override. */
4
- export declare const REASONING_EFFORT_PROVIDER_TYPES: readonly ["openai-compatible", "opencode-go", "anthropic"];
6
+ export declare const REASONING_EFFORT_PROVIDER_TYPES: readonly ["openai-compatible", "opencode-go", "anthropic", "relayed"];
5
7
  export declare function supportsReasoningEffort(type: string): boolean;
6
8
  export type ReasoningEffort = typeof REASONING_EFFORTS[number];
7
- export declare const PROVIDER_TYPES: readonly ["openai-compatible", "anthropic", "codex", "claude", "opencode-go", "grok", "opencode", "google", "andorra"];
9
+ export declare const PROVIDER_TYPES: readonly ["openai-compatible", "anthropic", "codex", "claude", "opencode-go", "grok", "opencode", "google", "andorra", "relayed"];
8
10
  export type ProviderType = typeof PROVIDER_TYPES[number];
9
11
  export declare const SIGN_IN_PROVIDER_TYPES: readonly ["codex", "claude", "grok", "opencode", "google"];
10
12
  export declare function isSignInProviderType(type: unknown): type is typeof SIGN_IN_PROVIDER_TYPES[number];
@@ -29,6 +31,8 @@ export interface ProviderConfig {
29
31
  modelParameters?: Record<string, number>;
30
32
  /** Andorra only: the model ids the router serves free of the weekly allowance. Shown to people as a badge. */
31
33
  freeModels?: string[];
34
+ /** Model ids that cannot take images: the engine keeps every image out of requests to them. Absent: all accept images. */
35
+ textOnlyModels?: string[];
32
36
  contextWindow?: number;
33
37
  reasoningEffort?: ReasoningEffort;
34
38
  requestTimeoutMs?: number;
@@ -57,6 +61,21 @@ export declare function freeCodexAccountSlot(base: string, providers: readonly P
57
61
  export declare function freeDraftCodexAccountSlot(base: string, draft: readonly Pick<ProviderConfig, 'id' | 'codexAccount'>[], saved: readonly Pick<ProviderConfig, 'id' | 'codexAccount'>[]): string;
58
62
  export declare function allocateCodexAccountSlots(stored: readonly ProviderConfig[], next: readonly ProviderConfig[]): ProviderConfig[];
59
63
  export declare function providerModels(provider: Pick<ProviderConfig, 'model' | 'models'>): string[];
64
+ /**
65
+ * The provider a run resolves by id: the providers the run started with first, then the live configuration.
66
+ * Editing or deleting a provider while the run works saves configuration for later tasks, so the running task
67
+ * keeps the entry it began with (its endpoint, protocol and credentials); a provider added during the run is
68
+ * found in the configuration. Only an explicit switch moves the run onto a provider's edited settings.
69
+ */
70
+ export declare function runProvider(config: Config, started: readonly ProviderConfig[], id: string): ProviderConfig | undefined;
71
+ /**
72
+ * Provider and model ids are matched without regard to case, so a graph saved on a machine whose provider is "GX10"
73
+ * runs on a machine that calls the same provider "gx10". An exact match always wins; otherwise the one entry whose id
74
+ * differs only in case is taken, and none when several do. Callers use the returned entry's own spelling from then on.
75
+ */
76
+ export declare function findProviderById<P extends Pick<ProviderConfig, 'id'>>(providers: readonly P[], id: string | undefined): P | undefined;
77
+ /** The provider's own spelling of `model`, matched as findProviderById matches ids; undefined when it does not offer it. */
78
+ export declare function providerModelId(provider: Pick<ProviderConfig, 'model' | 'models'>, model: string): string | undefined;
60
79
  export declare function configuredContextWindow(provider: Pick<ProviderConfig, 'model' | 'modelContextWindows'>, model: string | undefined): number | undefined;
61
80
  export declare function applyModelContextWindow(provider: ProviderConfig, model: string): void;
62
81
  export declare function providerSecrets(providers: ProviderConfig[], env?: NodeJS.ProcessEnv): string[];
@@ -69,8 +88,24 @@ export declare class ProviderRequestError extends Error {
69
88
  readonly contextOverflow: boolean;
70
89
  /** The system error code behind a connection that could not be made; recorded with the failure, never part of the message. */
71
90
  connectionCause?: string;
91
+ /** What kind of failure this was, for telemetry (`provider_timeout`, `http_429`); never shown and never part of the message. */
92
+ telemetryCode?: string;
72
93
  constructor(message: string, contextOverflow?: boolean);
73
94
  }
95
+ /**
96
+ * The telemetry error code for an error that ended a run: a provider failure's code, a record-only
97
+ * `telemetryCode` another adapter attached (Claude's exhausted malformed steps), or `runtime_error`.
98
+ */
99
+ export declare function runFailureCode(error: unknown): string;
100
+ /** The telemetry error code for a failed provider request: an OS code, a named kind, or `http_<status>`. */
101
+ export declare function providerFailureCode(error: unknown): string;
102
+ export declare class RetryableProviderError extends ProviderRequestError {
103
+ readonly retryAfterMs: number;
104
+ readonly retryDelaysMs: readonly number[];
105
+ readonly maxRetries: number;
106
+ readonly quiet: boolean;
107
+ constructor(message: string, retryAfterMs?: number, retryDelaysMs?: readonly number[], maxRetries?: number, quiet?: boolean);
108
+ }
74
109
  export declare const BLANK_TOOL_CALL_LIMIT = 4096;
75
110
  export declare function createBlankToolCallGuard(limit?: number): {
76
111
  fragment(text: string): void;
@@ -80,6 +115,9 @@ export declare function createDecodeWindow(now?: () => number): {
80
115
  stamp(text: string): void;
81
116
  measure(): number | undefined;
82
117
  };
118
+ /** The router reads `x-andorra-session` only in this form and ignores anything else, so nothing else is sent. */
119
+ export declare const ANDORRA_SESSION_ID: RegExp;
120
+ /** The adapter for a provider entry. Requests for one of its text-only models never carry an image. */
83
121
  export declare function createAdapter(config: ProviderConfig, options?: {
84
122
  sessionId?: string;
85
123
  }): ModelAdapter;