@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.
- package/dist/src/acp-agent.d.ts +6 -0
- package/dist/src/acp-agent.js +15 -4
- package/dist/src/agent-execution.js +108 -19
- package/dist/src/agent-mcp-catalog.js +1 -0
- package/dist/src/agent-mcp.d.ts +3 -0
- package/dist/src/agent-mcp.js +33 -1
- package/dist/src/andorra/entry.d.ts +10 -0
- package/dist/src/andorra/entry.js +18 -4
- package/dist/src/andorra/errors.js +3 -0
- package/dist/src/andorra/hosted.d.ts +2 -1
- package/dist/src/andorra/hosted.js +2 -1
- package/dist/src/andorra/notices.d.ts +5 -0
- package/dist/src/andorra/notices.js +7 -0
- package/dist/src/andorra/state.d.ts +3 -2
- package/dist/src/andorra/state.js +4 -4
- package/dist/src/andorra/terminal.js +7 -2
- package/dist/src/anthropic-credentials.js +2 -0
- package/dist/src/app-server/error.d.ts +5 -0
- package/dist/src/app-server/error.js +7 -0
- package/dist/src/app-server/protocol.d.ts +30 -44
- package/dist/src/app-server/protocol.js +5 -1
- package/dist/src/app-server/workspace.d.ts +108 -0
- package/dist/src/app-server/workspace.js +608 -11
- package/dist/src/app-server.d.ts +390 -33
- package/dist/src/app-server.js +3033 -565
- package/dist/src/attachments.d.ts +10 -0
- package/dist/src/attachments.js +102 -7
- package/dist/src/automation-tool.js +2 -1
- package/dist/src/bridge/cloud.d.ts +27 -0
- package/dist/src/bridge/cloud.js +187 -0
- package/dist/src/bridge/command.d.ts +30 -0
- package/dist/src/bridge/command.js +359 -0
- package/dist/src/bridge/control.d.ts +70 -0
- package/dist/src/bridge/control.js +238 -0
- package/dist/src/bridge/engines.d.ts +90 -0
- package/dist/src/bridge/engines.js +601 -0
- package/dist/src/bridge/github.d.ts +108 -0
- package/dist/src/bridge/github.js +378 -0
- package/dist/src/bridge/host-ops.d.ts +9 -0
- package/dist/src/bridge/host-ops.js +139 -0
- package/dist/src/bridge/host.d.ts +47 -0
- package/dist/src/bridge/host.js +543 -0
- package/dist/src/bridge/link.d.ts +38 -0
- package/dist/src/bridge/link.js +508 -0
- package/dist/src/bridge/login-link.d.ts +29 -0
- package/dist/src/bridge/login-link.js +54 -0
- package/dist/src/bridge/protocol.d.ts +136 -0
- package/dist/src/bridge/protocol.js +11 -0
- package/dist/src/bridge/store.d.ts +12 -0
- package/dist/src/bridge/store.js +61 -0
- package/dist/src/bridge/wording.d.ts +6 -0
- package/dist/src/bridge/wording.js +10 -0
- package/dist/src/browser-server.js +7 -1
- package/dist/src/browser-ui/tokens.css +1 -1
- package/dist/src/bug-report-attachments.d.ts +48 -0
- package/dist/src/bug-report-attachments.js +327 -0
- package/dist/src/bug-report.d.ts +23 -3
- package/dist/src/bug-report.js +72 -9
- package/dist/src/change-authors.d.ts +41 -0
- package/dist/src/change-authors.js +146 -0
- package/dist/src/cli.d.ts +1 -3
- package/dist/src/cli.js +191 -35
- package/dist/src/codex-provider.js +1 -1
- package/dist/src/coding-tools.js +24 -17
- package/dist/src/command-screens.d.ts +6 -0
- package/dist/src/command-screens.js +14 -11
- package/dist/src/commands.d.ts +15 -3
- package/dist/src/commands.js +2 -1
- package/dist/src/compaction-phrases.js +1 -1
- package/dist/src/completion.js +89 -8
- package/dist/src/config.d.ts +71 -3
- package/dist/src/config.js +205 -78
- package/dist/src/context-budget.js +15 -2
- package/dist/src/deadline.js +13 -1
- package/dist/src/decision/DecisionEngine.d.ts +2 -0
- package/dist/src/decision/DecisionManager.d.ts +11 -0
- package/dist/src/decision/DecisionManager.js +36 -0
- package/dist/src/decision/applyTaskKind.d.ts +8 -0
- package/dist/src/decision/applyTaskKind.js +53 -0
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/hostedPolicy.js +2 -1
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +2 -0
- package/dist/src/decision/providers/AndorraDecisionProvider.js +12 -0
- package/dist/src/decision/requestPhrases.js +0 -1
- package/dist/src/decision/taskKind.d.ts +52 -0
- package/dist/src/decision/taskKind.js +76 -0
- package/dist/src/decision/types.d.ts +1 -1
- package/dist/src/default-graph.js +1 -1
- package/dist/src/efficiency.d.ts +5 -0
- package/dist/src/efficiency.js +5 -1
- package/dist/src/effort-routing.d.ts +27 -0
- package/dist/src/effort-routing.js +34 -0
- package/dist/src/evidence.d.ts +110 -0
- package/dist/src/evidence.js +195 -0
- package/dist/src/file-diff.d.ts +4 -0
- package/dist/src/file-diff.js +2 -1
- package/dist/src/github-app/agent-writes.d.ts +102 -0
- package/dist/src/github-app/agent-writes.js +320 -0
- package/dist/src/github-app/client.d.ts +368 -0
- package/dist/src/github-app/client.js +830 -0
- package/dist/src/github-app/event-source.d.ts +208 -0
- package/dist/src/github-app/event-source.js +684 -0
- package/dist/src/github-app/metrics.d.ts +32 -0
- package/dist/src/github-app/metrics.js +49 -0
- package/dist/src/github-app/review-loop.d.ts +274 -0
- package/dist/src/github-app/review-loop.js +1177 -0
- package/dist/src/github-app/review-node.d.ts +81 -0
- package/dist/src/github-app/review-node.js +205 -0
- package/dist/src/github-app/review-post.d.ts +73 -0
- package/dist/src/github-app/review-post.js +139 -0
- package/dist/src/github-app/review-text.d.ts +107 -0
- package/dist/src/github-app/review-text.js +1133 -0
- package/dist/src/github-app/review-threads.d.ts +47 -0
- package/dist/src/github-app/review-threads.js +107 -0
- package/dist/src/github-app/reviewer.d.ts +121 -0
- package/dist/src/github-app/reviewer.js +598 -0
- package/dist/src/github-app/store.d.ts +59 -0
- package/dist/src/github-app/store.js +148 -0
- package/dist/src/github-app/triggers.d.ts +141 -0
- package/dist/src/github-app/triggers.js +441 -0
- package/dist/src/github-names.d.ts +15 -0
- package/dist/src/github-names.js +15 -0
- package/dist/src/glob-search.d.ts +61 -0
- package/dist/src/glob-search.js +180 -0
- package/dist/src/graph-health.js +6 -1
- package/dist/src/graph-manager-chat.js +1 -1
- package/dist/src/graph-preview.d.ts +48 -0
- package/dist/src/graph-preview.js +56 -0
- package/dist/src/graph-provider-portability.js +2 -1
- package/dist/src/graph-runner.js +65 -4
- package/dist/src/graph-server.js +7 -5
- package/dist/src/graph-sync.js +3 -3
- package/dist/src/graph-ui/app.js +121 -7
- package/dist/src/graph-ui/icons.js +2 -1
- package/dist/src/graph-ui/studio.js +15 -1
- package/dist/src/graph-ui/tokens.css +1 -1
- package/dist/src/graphs.d.ts +40 -1
- package/dist/src/graphs.js +164 -15
- package/dist/src/hardened-runtime.js +32 -21
- package/dist/src/image-input.d.ts +16 -0
- package/dist/src/image-input.js +41 -0
- package/dist/src/membership.d.ts +10 -0
- package/dist/src/membership.js +19 -4
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +6 -0
- package/dist/src/model-metadata.js +35 -15
- package/dist/src/model-override.d.ts +2 -1
- package/dist/src/model-override.js +9 -0
- package/dist/src/model-relay/local.d.ts +116 -0
- package/dist/src/model-relay/local.js +468 -0
- package/dist/src/model-relay/remote.d.ts +129 -0
- package/dist/src/model-relay/remote.js +252 -0
- package/dist/src/model-relay/runs.d.ts +34 -0
- package/dist/src/model-relay/runs.js +146 -0
- package/dist/src/model-relay/wire.d.ts +5 -0
- package/dist/src/model-relay/wire.js +5 -0
- package/dist/src/model-tiers.d.ts +3 -0
- package/dist/src/model-tiers.js +3 -3
- package/dist/src/project-registry.d.ts +21 -0
- package/dist/src/project-registry.js +74 -0
- package/dist/src/provider-engine.d.ts +13 -1
- package/dist/src/provider-engine.js +74 -0
- package/dist/src/provider-import.d.ts +0 -12
- package/dist/src/provider-import.js +7 -195
- package/dist/src/providers.d.ts +28 -2
- package/dist/src/providers.js +59 -12
- package/dist/src/pull-request-logs.d.ts +12 -1
- package/dist/src/pull-request-logs.js +14 -3
- package/dist/src/pull-requests.d.ts +338 -8
- package/dist/src/pull-requests.js +482 -53
- package/dist/src/react-runtime.js +99 -16
- package/dist/src/remote/engine-pool.d.ts +88 -4
- package/dist/src/remote/engine-pool.js +367 -90
- package/dist/src/remote/roots.d.ts +19 -0
- package/dist/src/remote/roots.js +45 -7
- package/dist/src/remote/types.d.ts +0 -44
- package/dist/src/run-control.d.ts +7 -0
- package/dist/src/run-control.js +23 -0
- package/dist/src/run-records.d.ts +7 -2
- package/dist/src/run-records.js +71 -6
- package/dist/src/runtime.d.ts +34 -2
- package/dist/src/runtime.js +18 -2
- package/dist/src/session-changes.d.ts +35 -0
- package/dist/src/session-changes.js +194 -6
- package/dist/src/session-monitor.js +2 -1
- package/dist/src/session-reaper.d.ts +1 -1
- package/dist/src/session-reaper.js +6 -1
- package/dist/src/session-summary.d.ts +2 -1
- package/dist/src/session-summary.js +2 -1
- package/dist/src/sessions.d.ts +35 -1
- package/dist/src/sessions.js +70 -4
- package/dist/src/skills/bundled/bug-report/SKILL.md +51 -7
- package/dist/src/skills/bundled/diagram/SKILL.md +5 -3
- package/dist/src/skills/bundled/graph-manager/SKILL.md +7 -4
- package/dist/src/skills/bundled/provenance.json +3 -3
- package/dist/src/skills/runtime-skills.js +1 -1
- package/dist/src/task-checkout.d.ts +141 -0
- package/dist/src/task-checkout.js +558 -0
- package/dist/src/telemetry/emitter.d.ts +15 -0
- package/dist/src/telemetry/emitter.js +35 -1
- package/dist/src/telemetry/schema.d.ts +25 -2
- package/dist/src/telemetry/schema.js +52 -4
- package/dist/src/telemetry/surface.d.ts +2 -1
- package/dist/src/telemetry/surface.js +4 -1
- package/dist/src/terminal-ui.d.ts +1 -0
- package/dist/src/terminal-ui.js +10 -3
- package/dist/src/test-edit-guard.d.ts +37 -0
- package/dist/src/test-edit-guard.js +216 -3
- package/dist/src/thinking-level-detect.d.ts +11 -0
- package/dist/src/thinking-level-detect.js +47 -0
- package/dist/src/thinking-levels.d.ts +30 -0
- package/dist/src/thinking-levels.js +124 -0
- package/dist/src/timers.d.ts +3 -0
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/tools.js +59 -9
- package/dist/src/transcript.js +1 -1
- package/dist/src/types.d.ts +34 -0
- package/package.json +6 -1
- package/dist/src/remote/cert.d.ts +0 -11
- package/dist/src/remote/cert.js +0 -87
- package/dist/src/remote/client.d.ts +0 -119
- package/dist/src/remote/client.js +0 -544
- package/dist/src/remote/command.d.ts +0 -4
- package/dist/src/remote/command.js +0 -194
- package/dist/src/remote/errors.d.ts +0 -11
- package/dist/src/remote/errors.js +0 -14
- package/dist/src/remote/network.d.ts +0 -22
- package/dist/src/remote/network.js +0 -102
- package/dist/src/remote/pairing.d.ts +0 -63
- package/dist/src/remote/pairing.js +0 -299
- package/dist/src/remote/pem.d.ts +0 -2
- package/dist/src/remote/pem.js +0 -7
- package/dist/src/remote/serve.d.ts +0 -68
- package/dist/src/remote/serve.js +0 -244
- package/dist/src/remote/server.d.ts +0 -21
- package/dist/src/remote/server.js +0 -406
|
@@ -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
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Message as EngineMessage, Model } from '../vendor/engine/runtime/ai/types.js';
|
|
2
|
-
import type { GenerateRequest, ModelResponse } from './types.js';
|
|
2
|
+
import type { GenerateRequest, ModelResponse, RouterReasoningDetail } from './types.js';
|
|
3
3
|
import { type ProviderToolNameCodec } from './tool-names.js';
|
|
4
4
|
export interface EngineTransport {
|
|
5
5
|
providerId: string;
|
|
@@ -25,6 +25,13 @@ export interface EngineTransport {
|
|
|
25
25
|
}
|
|
26
26
|
export declare function isEngineContextOverflow(errorMessage: string): boolean;
|
|
27
27
|
export declare function relocateConversationBreakpoint(body: Record<string, unknown>, mutableTail: number): void;
|
|
28
|
+
/**
|
|
29
|
+
* Whether Andorra's router can rebuild this turn from its `reasoning_details` and the text and tool calls the engine will
|
|
30
|
+
* send: the router's own check (`replayedBlocks` in infra/andorra-router/src/messages.ts). The engine sends no text
|
|
31
|
+
* that is only whitespace and replaces a lone surrogate, and the run may have rewritten the turn since (a completion);
|
|
32
|
+
* entries that no longer fit would only be dropped there, so they are not sent.
|
|
33
|
+
*/
|
|
34
|
+
export declare function routerReasoningFits(details: readonly RouterReasoningDetail[], content: string, calls: number): boolean;
|
|
28
35
|
export declare function toEngineMessages(request: GenerateRequest, model: Model<any>, names?: ProviderToolNameCodec): EngineMessage[];
|
|
29
36
|
type AnthropicEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
30
37
|
export interface AnthropicThinkingPlan {
|
|
@@ -38,6 +45,11 @@ interface AnthropicCatalogEntry {
|
|
|
38
45
|
};
|
|
39
46
|
thinkingLevelMap?: Record<string, string | null | undefined>;
|
|
40
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* The thinking levels a catalogued Anthropic model runs at as distinct settings. `minimal` is never one: it is sent as
|
|
50
|
+
* `low`. Undefined for a model the catalog does not list.
|
|
51
|
+
*/
|
|
52
|
+
export declare function anthropicCatalogLevels(modelId: string): ('none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max')[] | undefined;
|
|
41
53
|
export declare function anthropicThinkingPlan(effort: string | undefined, catalog: AnthropicCatalogEntry | undefined, modelId?: string): AnthropicThinkingPlan | undefined;
|
|
42
54
|
export declare function generateEngineResponse(request: GenerateRequest, host: EngineTransport): Promise<ModelResponse>;
|
|
43
55
|
export {};
|
|
@@ -30,6 +30,57 @@ export function relocateConversationBreakpoint(body, mutableTail) {
|
|
|
30
30
|
if (anchor)
|
|
31
31
|
anchor.cache_control = control;
|
|
32
32
|
}
|
|
33
|
+
const LONE_SURROGATE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/;
|
|
34
|
+
/**
|
|
35
|
+
* Whether Andorra's router can rebuild this turn from its `reasoning_details` and the text and tool calls the engine will
|
|
36
|
+
* send: the router's own check (`replayedBlocks` in infra/andorra-router/src/messages.ts). The engine sends no text
|
|
37
|
+
* that is only whitespace and replaces a lone surrogate, and the run may have rewritten the turn since (a completion);
|
|
38
|
+
* entries that no longer fit would only be dropped there, so they are not sent.
|
|
39
|
+
*/
|
|
40
|
+
export function routerReasoningFits(details, content, calls) {
|
|
41
|
+
if (LONE_SURROGATE.test(content))
|
|
42
|
+
return false;
|
|
43
|
+
const text = content.trim() ? content : '';
|
|
44
|
+
let chars = 0;
|
|
45
|
+
const used = new Set(), indices = new Set();
|
|
46
|
+
for (const detail of details) {
|
|
47
|
+
if (indices.has(detail.index))
|
|
48
|
+
return false;
|
|
49
|
+
indices.add(detail.index);
|
|
50
|
+
let block;
|
|
51
|
+
try {
|
|
52
|
+
block = JSON.parse(detail.data);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (typeof block !== 'object' || block === null)
|
|
58
|
+
return false;
|
|
59
|
+
const entry = block;
|
|
60
|
+
if (entry.type === 'thinking') {
|
|
61
|
+
if (typeof entry.thinking !== 'string' || typeof entry.signature !== 'string')
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
else if (entry.type === 'redacted_thinking') {
|
|
65
|
+
if (typeof entry.data !== 'string')
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
else if (entry.type === 'text') {
|
|
69
|
+
if (!Number.isSafeInteger(entry.chars) || entry.chars < 0)
|
|
70
|
+
return false;
|
|
71
|
+
chars += entry.chars;
|
|
72
|
+
}
|
|
73
|
+
else if (entry.type === 'tool_use') {
|
|
74
|
+
const call = entry.call;
|
|
75
|
+
if (!Number.isSafeInteger(call) || call < 0 || call >= calls || used.has(call))
|
|
76
|
+
return false;
|
|
77
|
+
used.add(call);
|
|
78
|
+
}
|
|
79
|
+
else
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return details.length > 0 && used.size === calls && chars === [...text].length;
|
|
83
|
+
}
|
|
33
84
|
export function toEngineMessages(request, model, names) {
|
|
34
85
|
const encode = names?.encode ?? ((name) => name);
|
|
35
86
|
const historyNames = new Map(request.messages.flatMap(m => (m.toolCalls ?? []).map(c => [c.id, encode(c.name)])));
|
|
@@ -47,6 +98,10 @@ export function toEngineMessages(request, model, names) {
|
|
|
47
98
|
const continuation = message.providerContinuation;
|
|
48
99
|
if (continuation && continuation.api === model.api && continuation.provider === model.provider && continuation.model === model.id) {
|
|
49
100
|
content.push(...structuredClone(continuation.thinking));
|
|
101
|
+
// The engine sends a thinking block's signature that parses as a `reasoning_details` list back as the message's
|
|
102
|
+
// `reasoning_details`, unchanged, in place of a raw reasoning field.
|
|
103
|
+
if (continuation.reasoningDetails?.length && routerReasoningFits(continuation.reasoningDetails, message.content, message.toolCalls?.length ?? 0))
|
|
104
|
+
content.push({ type: 'thinking', thinking: '', thinkingSignature: JSON.stringify(continuation.reasoningDetails) });
|
|
50
105
|
}
|
|
51
106
|
else if (model.api === 'openai-completions' && message.reasoningContent !== undefined) {
|
|
52
107
|
content.push({ type: 'thinking', thinking: message.reasoningContent, thinkingSignature: 'reasoning_content' });
|
|
@@ -142,6 +197,24 @@ function anthropicUncatalogedEra(modelId) {
|
|
|
142
197
|
const major = Number(modern[1]), minor = modern[2] === undefined ? 0 : Number(modern[2]);
|
|
143
198
|
return major < 4 || (major === 4 && minor <= 5) ? 'legacy' : 'adaptive';
|
|
144
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* The thinking levels a catalogued Anthropic model runs at as distinct settings. `minimal` is never one: it is sent as
|
|
202
|
+
* `low`. Undefined for a model the catalog does not list.
|
|
203
|
+
*/
|
|
204
|
+
export function anthropicCatalogLevels(modelId) {
|
|
205
|
+
if (!Object.hasOwn(ANTHROPIC_MODELS, modelId))
|
|
206
|
+
return undefined;
|
|
207
|
+
const entry = ANTHROPIC_MODELS[modelId];
|
|
208
|
+
if (entry.reasoning === false)
|
|
209
|
+
return [];
|
|
210
|
+
const adaptive = entry.compat?.forceAdaptiveThinking === true;
|
|
211
|
+
const map = entry.thinkingLevelMap;
|
|
212
|
+
return [
|
|
213
|
+
...(map?.off === null ? [] : ['none']), 'low', 'medium', 'high',
|
|
214
|
+
...(!adaptive || map?.xhigh === 'xhigh' ? ['xhigh'] : []),
|
|
215
|
+
...(!adaptive || map?.max === 'max' ? ['max'] : []),
|
|
216
|
+
];
|
|
217
|
+
}
|
|
145
218
|
export function anthropicThinkingPlan(effort, catalog, modelId) {
|
|
146
219
|
if (effort === undefined)
|
|
147
220
|
return undefined;
|
|
@@ -428,6 +501,7 @@ export async function generateEngineResponse(request, host) {
|
|
|
428
501
|
return { text: validated?.text ?? text, toolCalls: decodeCalls(validated?.toolCalls ?? host.checkCalls(calls)), stopReason: validated?.stopReason ?? result.rawStopReason ?? (result.stopReason === 'toolUse' ? 'tool_calls' : result.stopReason),
|
|
429
502
|
...(!host.anthropic && thoughts.length ? { reasoningContent: thoughts.join('') } : {}),
|
|
430
503
|
...(host.anthropic && thinking.length ? { providerContinuation: { api: model.api, provider: model.provider, model: model.id, thinking } } : {}),
|
|
504
|
+
...(!host.anthropic && validated?.providerContinuation ? { providerContinuation: { ...validated.providerContinuation, api: model.api, provider: model.provider, model: model.id } } : {}),
|
|
431
505
|
usage: { inputTokens: result.usage.input + cacheRead + cacheWrite, outputTokens: result.usage.output, requests: 1,
|
|
432
506
|
...(streamReportsCacheRead && validatedCounter(result.usage.cacheRead) ? { cacheRead: result.usage.cacheRead } : {}),
|
|
433
507
|
...(streamReportsCacheWrite && validatedCounter(result.usage.cacheWrite) ? { cacheWrite: result.usage.cacheWrite } : {}),
|
|
@@ -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 {
|
|
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
|
-
}
|
package/dist/src/providers.d.ts
CHANGED
|
@@ -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,8 +31,15 @@ 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;
|
|
38
|
+
/** Per model id: the thinking levels the model accepts (detected) and the ones the user switched off. */
|
|
39
|
+
thinkingLevels?: Record<string, {
|
|
40
|
+
supported?: ReasoningEffort[];
|
|
41
|
+
disabled?: ReasoningEffort[];
|
|
42
|
+
}>;
|
|
34
43
|
requestTimeoutMs?: number;
|
|
35
44
|
streamIdleTimeoutMs?: number;
|
|
36
45
|
codexAccount?: string;
|
|
@@ -57,6 +66,13 @@ export declare function freeCodexAccountSlot(base: string, providers: readonly P
|
|
|
57
66
|
export declare function freeDraftCodexAccountSlot(base: string, draft: readonly Pick<ProviderConfig, 'id' | 'codexAccount'>[], saved: readonly Pick<ProviderConfig, 'id' | 'codexAccount'>[]): string;
|
|
58
67
|
export declare function allocateCodexAccountSlots(stored: readonly ProviderConfig[], next: readonly ProviderConfig[]): ProviderConfig[];
|
|
59
68
|
export declare function providerModels(provider: Pick<ProviderConfig, 'model' | 'models'>): string[];
|
|
69
|
+
/**
|
|
70
|
+
* The provider a run resolves by id: the providers the run started with first, then the live configuration.
|
|
71
|
+
* Editing or deleting a provider while the run works saves configuration for later tasks, so the running task
|
|
72
|
+
* keeps the entry it began with (its endpoint, protocol and credentials); a provider added during the run is
|
|
73
|
+
* found in the configuration. Only an explicit switch moves the run onto a provider's edited settings.
|
|
74
|
+
*/
|
|
75
|
+
export declare function runProvider(config: Config, started: readonly ProviderConfig[], id: string): ProviderConfig | undefined;
|
|
60
76
|
/**
|
|
61
77
|
* Provider and model ids are matched without regard to case, so a graph saved on a machine whose provider is "GX10"
|
|
62
78
|
* runs on a machine that calls the same provider "gx10". An exact match always wins; otherwise the one entry whose id
|
|
@@ -88,6 +104,13 @@ export declare class ProviderRequestError extends Error {
|
|
|
88
104
|
export declare function runFailureCode(error: unknown): string;
|
|
89
105
|
/** The telemetry error code for a failed provider request: an OS code, a named kind, or `http_<status>`. */
|
|
90
106
|
export declare function providerFailureCode(error: unknown): string;
|
|
107
|
+
export declare class RetryableProviderError extends ProviderRequestError {
|
|
108
|
+
readonly retryAfterMs: number;
|
|
109
|
+
readonly retryDelaysMs: readonly number[];
|
|
110
|
+
readonly maxRetries: number;
|
|
111
|
+
readonly quiet: boolean;
|
|
112
|
+
constructor(message: string, retryAfterMs?: number, retryDelaysMs?: readonly number[], maxRetries?: number, quiet?: boolean);
|
|
113
|
+
}
|
|
91
114
|
export declare const BLANK_TOOL_CALL_LIMIT = 4096;
|
|
92
115
|
export declare function createBlankToolCallGuard(limit?: number): {
|
|
93
116
|
fragment(text: string): void;
|
|
@@ -97,6 +120,9 @@ export declare function createDecodeWindow(now?: () => number): {
|
|
|
97
120
|
stamp(text: string): void;
|
|
98
121
|
measure(): number | undefined;
|
|
99
122
|
};
|
|
123
|
+
/** The router reads `x-andorra-session` only in this form and ignores anything else, so nothing else is sent. */
|
|
124
|
+
export declare const ANDORRA_SESSION_ID: RegExp;
|
|
125
|
+
/** The adapter for a provider entry. Requests for one of its text-only models never carry an image. */
|
|
100
126
|
export declare function createAdapter(config: ProviderConfig, options?: {
|
|
101
127
|
sessionId?: string;
|
|
102
128
|
}): ModelAdapter;
|