@andorra-labs/code 0.1.13 → 0.1.15
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/account-presentation.js +4 -1
- package/dist/src/acp-agent.d.ts +54 -0
- package/dist/src/acp-agent.js +991 -0
- package/dist/src/agent-execution.js +304 -140
- package/dist/src/agent-mcp-catalog.js +2 -0
- package/dist/src/agent-mcp.d.ts +2 -0
- package/dist/src/agent-mcp.js +86 -4
- package/dist/src/andorra/endpoint.d.ts +7 -0
- package/dist/src/andorra/endpoint.js +46 -0
- package/dist/src/andorra/entry.d.ts +21 -0
- package/dist/src/andorra/entry.js +118 -0
- package/dist/src/andorra/errors.d.ts +2 -0
- package/dist/src/andorra/errors.js +39 -0
- package/dist/src/andorra/hosted.d.ts +55 -0
- package/dist/src/andorra/hosted.js +130 -0
- package/dist/src/andorra/monitor.d.ts +151 -0
- package/dist/src/andorra/monitor.js +393 -0
- package/dist/src/andorra/notices.d.ts +16 -0
- package/dist/src/andorra/notices.js +38 -0
- package/dist/src/andorra/opt-in.d.ts +58 -0
- package/dist/src/andorra/opt-in.js +112 -0
- package/dist/src/andorra/request-watch.d.ts +6 -0
- package/dist/src/andorra/request-watch.js +10 -0
- package/dist/src/andorra/state.d.ts +86 -0
- package/dist/src/andorra/state.js +238 -0
- package/dist/src/andorra/terminal.d.ts +70 -0
- package/dist/src/andorra/terminal.js +125 -0
- package/dist/src/andorra/usage-format.d.ts +9 -0
- package/dist/src/andorra/usage-format.js +19 -0
- package/dist/src/anthropic-credentials.js +9 -1
- package/dist/src/app-server/protocol.d.ts +10 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server/workspace.d.ts +1 -0
- package/dist/src/app-server/workspace.js +141 -10
- package/dist/src/app-server.d.ts +35 -0
- package/dist/src/app-server.js +377 -124
- package/dist/src/auth/AuthManager.d.ts +9 -0
- package/dist/src/auth/AuthManager.js +164 -24
- package/dist/src/auth/deployment.d.ts +1 -0
- package/dist/src/auth/deployment.js +1 -0
- package/dist/src/auth/index.d.ts +1 -1
- package/dist/src/auth/index.js +1 -1
- package/dist/src/auth/store.d.ts +26 -0
- package/dist/src/auth/store.js +34 -1
- package/dist/src/browser-bridge.d.ts +1 -0
- package/dist/src/browser-bridge.js +5 -2
- package/dist/src/browser-external-app.d.ts +27 -0
- package/dist/src/browser-external-app.js +60 -0
- package/dist/src/browser-panel-tool.d.ts +6 -0
- package/dist/src/browser-panel-tool.js +36 -0
- package/dist/src/browser-runner.js +1 -1
- package/dist/src/browser-server.d.ts +5 -0
- package/dist/src/browser-server.js +27 -3
- package/dist/src/browser-stealth.d.ts +19 -1
- package/dist/src/browser-stealth.js +23 -3
- package/dist/src/browser-ui/tokens.css +4 -4
- package/dist/src/browser-view.d.ts +81 -0
- package/dist/src/browser-view.js +289 -18
- package/dist/src/bug-report.d.ts +81 -0
- package/dist/src/bug-report.js +235 -0
- package/dist/src/claude-provider.d.ts +2 -1
- package/dist/src/claude-provider.js +10 -8
- package/dist/src/cli-sign-in.d.ts +3 -1
- package/dist/src/cli-sign-in.js +4 -1
- package/dist/src/cli.js +205 -58
- package/dist/src/coding-tools.js +7 -7
- package/dist/src/command-screens.d.ts +26 -3
- package/dist/src/command-screens.js +323 -85
- package/dist/src/commands.d.ts +7 -1
- package/dist/src/commands.js +79 -27
- package/dist/src/completion-gates.d.ts +22 -0
- package/dist/src/completion-gates.js +11 -0
- package/dist/src/config.d.ts +11 -1
- package/dist/src/config.js +134 -3
- package/dist/src/dashboard-view.d.ts +2 -0
- package/dist/src/dashboard-view.js +11 -2
- package/dist/src/decision/PreparedSteps.js +1 -1
- package/dist/src/decision/applyToolMenu.js +1 -1
- package/dist/src/decision/toolFamilies.js +1 -1
- package/dist/src/decision/types.d.ts +1 -0
- package/dist/src/google-provider.d.ts +31 -0
- package/dist/src/google-provider.js +153 -0
- package/dist/src/graph-health.d.ts +11 -0
- package/dist/src/graph-health.js +36 -4
- package/dist/src/graph-manager-chat.d.ts +33 -0
- package/dist/src/graph-manager-chat.js +165 -6
- package/dist/src/graph-runner.js +27 -0
- package/dist/src/graph-selection.js +2 -1
- package/dist/src/graph-sync.d.ts +1 -0
- package/dist/src/graph-sync.js +93 -34
- package/dist/src/graph-tool.d.ts +2 -0
- package/dist/src/graph-tool.js +2 -2
- package/dist/src/graph-ui/app.js +92 -10
- package/dist/src/graph-ui/edge-router.js +121 -53
- package/dist/src/graph-ui/manager.js +40 -5
- package/dist/src/graph-ui/style.css +5 -2
- package/dist/src/graph-ui/tokens.css +4 -4
- package/dist/src/graph-visibility.d.ts +31 -0
- package/dist/src/graph-visibility.js +102 -0
- package/dist/src/graphs.js +1 -3
- package/dist/src/hardened-runtime.js +1 -1
- package/dist/src/live-model.d.ts +24 -0
- package/dist/src/live-model.js +37 -0
- package/dist/src/managed-sign-in.d.ts +1 -0
- package/dist/src/managed-sign-in.js +13 -0
- package/dist/src/membership-errors.d.ts +2 -0
- package/dist/src/membership-errors.js +6 -2
- package/dist/src/membership.d.ts +13 -2
- package/dist/src/membership.js +39 -8
- package/dist/src/model-context-windows.d.ts +2 -0
- package/dist/src/model-context-windows.js +24 -0
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.d.ts +1 -0
- package/dist/src/model-metadata.js +47 -3
- package/dist/src/paged-transcript.d.ts +2 -0
- package/dist/src/paged-transcript.js +16 -0
- package/dist/src/palette.d.ts +1 -0
- package/dist/src/palette.js +1 -1
- package/dist/src/permissions.js +17 -4
- package/dist/src/provider-connection.js +32 -0
- package/dist/src/provider-engine.d.ts +5 -0
- package/dist/src/provider-engine.js +3 -3
- package/dist/src/provider-import.js +3 -1
- package/dist/src/provider-settings.d.ts +16 -1
- package/dist/src/provider-settings.js +50 -22
- package/dist/src/providers.d.ts +29 -3
- package/dist/src/providers.js +100 -18
- package/dist/src/react-runtime.js +33 -12
- package/dist/src/read-document-tool.d.ts +2 -0
- package/dist/src/read-document-tool.js +6 -6
- package/dist/src/remote/engine-pool.js +31 -6
- package/dist/src/run-control.d.ts +2 -2
- package/dist/src/run-control.js +9 -6
- package/dist/src/runtime-environment.d.ts +1 -0
- package/dist/src/runtime-environment.js +13 -0
- package/dist/src/runtime.d.ts +2 -0
- package/dist/src/runtime.js +2 -1
- package/dist/src/save-lock.js +14 -7
- package/dist/src/session-title.d.ts +3 -0
- package/dist/src/session-title.js +5 -2
- package/dist/src/sessions.d.ts +1 -0
- package/dist/src/sessions.js +4 -2
- package/dist/src/sign-in-detection.d.ts +1 -1
- package/dist/src/sign-in-detection.js +10 -3
- package/dist/src/sign-in-offer.js +1 -1
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/bug-report/SKILL.md +80 -0
- package/dist/src/skills/bundled/graph-manager/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/errors.md +2 -1
- package/dist/src/skills/bundled/provenance.json +743 -738
- package/dist/src/skills/runtime-skills.js +1 -0
- package/dist/src/subagent-run.d.ts +2 -0
- package/dist/src/subagent-run.js +14 -3
- package/dist/src/telemetry/schema.d.ts +1 -1
- package/dist/src/telemetry/schema.js +2 -2
- package/dist/src/telemetry/uploader.d.ts +7 -1
- package/dist/src/telemetry/uploader.js +11 -2
- package/dist/src/terminal-links.d.ts +16 -0
- package/dist/src/terminal-links.js +113 -0
- package/dist/src/terminal-ui.d.ts +29 -1
- package/dist/src/terminal-ui.js +113 -24
- package/dist/src/tool-catalog.js +1 -1
- package/dist/src/trajectory.js +6 -1
- package/dist/src/transcript.d.ts +2 -0
- package/dist/src/transcript.js +5 -1
- package/dist/src/types.d.ts +5 -0
- package/dist/src/workspace-instructions.js +1 -1
- package/package.json +13 -1
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
const FEATURES = '
|
|
1
|
+
const FEATURES = 'custom graphs and the Graph Editor';
|
|
2
2
|
const REASONS = {
|
|
3
3
|
tls: 'a secure connection to the account service could not be verified',
|
|
4
4
|
dns: 'the account service address could not be resolved',
|
|
5
5
|
network: 'the account service could not be reached',
|
|
6
6
|
};
|
|
7
7
|
export class PaidMembershipRequiredError extends Error {
|
|
8
|
+
/** The membership could not be checked (timeout, 5xx, 429, network). Says nothing about the account's plan. */
|
|
9
|
+
unavailable = false;
|
|
8
10
|
constructor(message = `Paid membership is required for ${FEATURES}. Use /login to sign in. If already signed in, check your membership or connection.`) { super(message); }
|
|
9
11
|
static for(access) {
|
|
10
12
|
if (access.unavailable) {
|
|
11
13
|
const reason = access.failureReason ? `: ${REASONS[access.failureReason]}` : ' right now';
|
|
12
|
-
|
|
14
|
+
const error = new PaidMembershipRequiredError(`Your Andorra membership could not be checked${reason}. This does not mean you were signed out; check your connection and retry.`);
|
|
15
|
+
error.unavailable = true;
|
|
16
|
+
return error;
|
|
13
17
|
}
|
|
14
18
|
if (!access.subject)
|
|
15
19
|
return new PaidMembershipRequiredError(`You are signed out of your Andorra account; ${FEATURES} need a signed-in account. Use /login to sign in again.`);
|
package/dist/src/membership.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Graph } from './graphs.js';
|
|
2
2
|
import type { TelemetryPlan } from './telemetry/schema.js';
|
|
3
3
|
export declare const SOFTWARE_ENGINEER_HARNESS: Graph;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare function
|
|
4
|
+
export declare const RETIRED_ANDORRA_SELECTION = ":andorra";
|
|
5
|
+
export declare function currentGraphSelection(id: string): string;
|
|
6
6
|
export type MembershipFailureReason = 'tls' | 'dns' | 'network';
|
|
7
7
|
export type MembershipTier = 'free' | 'legacy' | 'paid';
|
|
8
8
|
export declare const MEMBERSHIP_TIERS: readonly MembershipTier[];
|
|
@@ -11,6 +11,7 @@ export interface Membership {
|
|
|
11
11
|
paid: boolean;
|
|
12
12
|
unavailable?: boolean;
|
|
13
13
|
failureReason?: MembershipFailureReason;
|
|
14
|
+
failureDetail?: string;
|
|
14
15
|
subject?: string;
|
|
15
16
|
email?: string;
|
|
16
17
|
tier?: MembershipTier;
|
|
@@ -18,14 +19,23 @@ export interface Membership {
|
|
|
18
19
|
dailyDecisionUsed?: number;
|
|
19
20
|
dailyDecisionResetsAt?: string;
|
|
20
21
|
decisionsSinceRollout?: number;
|
|
22
|
+
/**
|
|
23
|
+
* The rolling allowance: Free accounts get `windowDecisionLimit` decisions per `windowDays` UTC days;
|
|
24
|
+
* Legacy accounts are unlimited under fair use (`fairUse`), with a daily and a window cap.
|
|
25
|
+
* `windowDecisionResetsAt` is when the oldest counted decision leaves the window.
|
|
26
|
+
*/
|
|
21
27
|
fairUse?: boolean;
|
|
22
28
|
windowDays?: number;
|
|
23
29
|
windowDecisionLimit?: number;
|
|
24
30
|
windowDecisionUsed?: number;
|
|
25
31
|
windowDecisionResetsAt?: string;
|
|
32
|
+
/** Uncapped Paid account: no daily, window or global cap applies. The service answers `unlimited: true` and omits every allowance field. */
|
|
33
|
+
unlimited?: boolean;
|
|
26
34
|
billingUrl?: string;
|
|
27
35
|
}
|
|
28
36
|
export declare function membershipPlanLabel(tier: MembershipTier | undefined, paid: boolean): string;
|
|
37
|
+
/** Which step of the lookup failed and the first concrete error code under it, e.g. "sign-in token: ECONNRESET". */
|
|
38
|
+
export declare function transportFailureDetail(error: unknown, step: 'sign-in token' | 'account check'): string;
|
|
29
39
|
export declare function safeAccountEmail(value: unknown): string | undefined;
|
|
30
40
|
export { PaidMembershipRequiredError } from './membership-errors.js';
|
|
31
41
|
export interface PlanConfirmation {
|
|
@@ -47,4 +57,5 @@ export declare function readGraphMembership(signal?: AbortSignal): Promise<Membe
|
|
|
47
57
|
export declare function loadAccessibleGraph(id?: string, signal?: AbortSignal, membership?: (signal?: AbortSignal, home?: string) => Promise<Membership>, options?: {
|
|
48
58
|
bindProviders?: boolean;
|
|
49
59
|
allowDeleted?: boolean;
|
|
60
|
+
allowRetired?: boolean;
|
|
50
61
|
}): Promise<Graph>;
|
package/dist/src/membership.js
CHANGED
|
@@ -12,14 +12,21 @@ export const SOFTWARE_ENGINEER_HARNESS = {
|
|
|
12
12
|
schemaVersion: 2, id: 'software-engineer', name: DEFAULT_AGENT_GRAPH.name, revision: 1, entry: DEFAULT_AGENT_GRAPH.entry,
|
|
13
13
|
nodes: structuredClone(DEFAULT_AGENT_GRAPH.nodes), edges: structuredClone(DEFAULT_AGENT_GRAPH.edges),
|
|
14
14
|
};
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
// The built-in paid "Andorra" preset (Orchestrator -> Andorra Agent) was removed: the only built-in
|
|
16
|
+
// graph is Default. A selection saved while the preset existed runs the Default graph.
|
|
17
|
+
export const RETIRED_ANDORRA_SELECTION = ':andorra';
|
|
18
|
+
// What the preset ran. Kept only so an attempt that stopped on it can be resumed against the nodes its
|
|
19
|
+
// journal and checkpoints name; nothing offers it for a new task.
|
|
20
|
+
function retiredAndorraHarness() {
|
|
17
21
|
const graph = { ...structuredClone(DEFAULT_HARNESS), id: 'andorra', name: 'Andorra' };
|
|
18
22
|
for (const node of Object.values(graph.nodes))
|
|
19
23
|
if (node.type === 'agent')
|
|
20
24
|
node.jevEnabled = true;
|
|
21
25
|
return graph;
|
|
22
26
|
}
|
|
27
|
+
export function currentGraphSelection(id) {
|
|
28
|
+
return id === RETIRED_ANDORRA_SELECTION ? 'default' : id;
|
|
29
|
+
}
|
|
23
30
|
export const MEMBERSHIP_TIERS = ['free', 'legacy', 'paid'];
|
|
24
31
|
export function windowFields(result) {
|
|
25
32
|
const positive = (value) => Number.isSafeInteger(value) && value > 0;
|
|
@@ -67,6 +74,21 @@ function transportFailureReason(error) {
|
|
|
67
74
|
}
|
|
68
75
|
return network ? 'network' : undefined;
|
|
69
76
|
}
|
|
77
|
+
/** Which step of the lookup failed and the first concrete error code under it, e.g. "sign-in token: ECONNRESET". */
|
|
78
|
+
export function transportFailureDetail(error, step) {
|
|
79
|
+
let current = error;
|
|
80
|
+
for (let depth = 0; depth < 8 && current && typeof current === 'object'; depth++) {
|
|
81
|
+
const failure = current;
|
|
82
|
+
if (typeof failure.code === 'string' && /^[A-Z][A-Z0-9_]{1,63}$/.test(failure.code))
|
|
83
|
+
return `${step}: ${failure.code}`;
|
|
84
|
+
if (failure.name === 'TimeoutError')
|
|
85
|
+
return `${step}: timeout`;
|
|
86
|
+
if (current instanceof AuthError && failure.code !== 'network')
|
|
87
|
+
return `${step}: ${current.code}`;
|
|
88
|
+
current = failure.cause;
|
|
89
|
+
}
|
|
90
|
+
return step;
|
|
91
|
+
}
|
|
70
92
|
export function safeAccountEmail(value) {
|
|
71
93
|
return typeof value === 'string' && value.length <= 254
|
|
72
94
|
&& /^[^\s@\p{Cc}\p{Cf}\p{Cs}]+@[^\s@\p{Cc}\p{Cf}\p{Cs}]+$/u.test(value) ? value : undefined;
|
|
@@ -97,7 +119,7 @@ export function createMembershipClient(deps) {
|
|
|
97
119
|
}).catch(error => { throw Object.assign(new Error('Membership connection unavailable'), { cause: error, membershipNetworkFailure: true }); });
|
|
98
120
|
if (!response.ok) {
|
|
99
121
|
await response.body?.cancel();
|
|
100
|
-
return { paid: false, ...(response.status >= 500 || response.status === 429 ? { unavailable: true } : {}) };
|
|
122
|
+
return { paid: false, ...(response.status >= 500 || response.status === 429 ? { unavailable: true, failureDetail: `account check: HTTP ${response.status}` } : {}) };
|
|
101
123
|
}
|
|
102
124
|
const reader = response.body?.getReader();
|
|
103
125
|
if (!reader)
|
|
@@ -137,6 +159,7 @@ export function createMembershipClient(deps) {
|
|
|
137
159
|
const observedAt = new Date().toISOString();
|
|
138
160
|
await (deps.recordPlan ?? recordPlanConfirmation)({ subject: result.subject, tier: analyticsPlanFromMembership(tier, result.paid), observedAt }, home).catch(() => { });
|
|
139
161
|
const windowed = windowFields(result);
|
|
162
|
+
const unlimited = typeof result.unlimited === 'boolean' ? result.unlimited : undefined;
|
|
140
163
|
const lifetime = Number.isSafeInteger(result.decisionsSinceRollout) && result.decisionsSinceRollout >= 0
|
|
141
164
|
? result.decisionsSinceRollout : undefined;
|
|
142
165
|
const billing = typeof result.billingUrl === 'string' && /^https:\/\//.test(result.billingUrl) && result.billingUrl.length <= 2048
|
|
@@ -145,6 +168,7 @@ export function createMembershipClient(deps) {
|
|
|
145
168
|
...(validUsage ? { dailyDecisionUsed: result.dailyDecisionUsed, dailyDecisionResetsAt: reset } : {}),
|
|
146
169
|
...(lifetime === undefined ? {} : { decisionsSinceRollout: lifetime }),
|
|
147
170
|
...windowed,
|
|
171
|
+
...(unlimited === undefined ? {} : { unlimited }),
|
|
148
172
|
...(billing === undefined ? {} : { billingUrl: billing }) };
|
|
149
173
|
}
|
|
150
174
|
catch (error) {
|
|
@@ -152,8 +176,10 @@ export function createMembershipClient(deps) {
|
|
|
152
176
|
const failureReason = transportFailureReason(error);
|
|
153
177
|
const refused = error instanceof AuthError && (error.code === 'login_required' || error.code === 'invalid_token');
|
|
154
178
|
const unavailable = !refused && (bounded === undefined || bounded.aborted || failureReason !== undefined);
|
|
179
|
+
const failureDetail = unavailable ? transportFailureDetail(error, bounded ? 'account check' : 'sign-in token') : undefined;
|
|
155
180
|
return { paid: false, ...(unavailable ? { unavailable: true } : {}),
|
|
156
|
-
...(unavailable && !bounded?.aborted && failureReason ? { failureReason } : {})
|
|
181
|
+
...(unavailable && !bounded?.aborted && failureReason ? { failureReason } : {}),
|
|
182
|
+
...(failureDetail ? { failureDetail } : {}) };
|
|
157
183
|
}
|
|
158
184
|
};
|
|
159
185
|
}
|
|
@@ -177,16 +203,21 @@ export async function readGraphMembership(signal) {
|
|
|
177
203
|
}
|
|
178
204
|
export async function loadAccessibleGraph(id = 'default', signal, membership = getMembership, options = {}) {
|
|
179
205
|
signal?.throwIfAborted();
|
|
180
|
-
if (id ===
|
|
206
|
+
if (id === RETIRED_ANDORRA_SELECTION && options.allowRetired) {
|
|
207
|
+
const access = await membership(signal);
|
|
208
|
+
signal?.throwIfAborted();
|
|
209
|
+
if (!access.paid)
|
|
210
|
+
throw PaidMembershipRequiredError.for(access);
|
|
211
|
+
return retiredAndorraHarness();
|
|
212
|
+
}
|
|
213
|
+
if (currentGraphSelection(id) === 'default')
|
|
181
214
|
return structuredClone(SOFTWARE_ENGINEER_HARNESS);
|
|
182
215
|
if (id === GRAPH_MANAGER_GRAPH_ID)
|
|
183
216
|
return structuredClone(GRAPH_MANAGER_HARNESS);
|
|
184
217
|
const access = await membership(signal);
|
|
185
218
|
signal?.throwIfAborted();
|
|
186
|
-
if (!access.paid &&
|
|
219
|
+
if (!access.paid && access.unavailable)
|
|
187
220
|
throw PaidMembershipRequiredError.for(access);
|
|
188
|
-
if (id === ANDORRA_GRAPH_SELECTION)
|
|
189
|
-
return getAndorraHarness();
|
|
190
221
|
if (!access.subject)
|
|
191
222
|
throw PaidMembershipRequiredError.for(access);
|
|
192
223
|
if (!/^[A-Za-z0-9-]{1,128}$/.test(access.subject))
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ANTHROPIC_MODELS } from '../vendor/engine/runtime/ai/providers/anthropic.models.js';
|
|
2
|
+
// Claude models newer than the vendored engine catalog. The Claude CLI's model
|
|
3
|
+
// catalog lists ids only, so without these a signed-in Claude provider ran
|
|
4
|
+
// with the engine's 128k fallback even on 1M-token models.
|
|
5
|
+
const CLAUDE_CONTEXT_WINDOWS = {
|
|
6
|
+
'claude-opus-5-5': 1_000_000,
|
|
7
|
+
'claude-sonnet-5-5': 1_000_000,
|
|
8
|
+
'claude-haiku-5-5': 1_000_000,
|
|
9
|
+
'claude-fable-5-2': 1_000_000,
|
|
10
|
+
};
|
|
11
|
+
/** The context window Andorra knows for a Claude model id, or undefined when it has none on record. */
|
|
12
|
+
export function knownClaudeContextWindow(model) {
|
|
13
|
+
const id = model.trim();
|
|
14
|
+
// The Claude CLI marks its long-context variants with a "[1m]" suffix.
|
|
15
|
+
if (/\[1m\]$/i.test(id))
|
|
16
|
+
return 1_000_000;
|
|
17
|
+
const base = id.replace(/\[[^\]]+\]$/, '');
|
|
18
|
+
if (Object.hasOwn(CLAUDE_CONTEXT_WINDOWS, base))
|
|
19
|
+
return CLAUDE_CONTEXT_WINDOWS[base];
|
|
20
|
+
if (!Object.hasOwn(ANTHROPIC_MODELS, base))
|
|
21
|
+
return undefined;
|
|
22
|
+
const window = ANTHROPIC_MODELS[base]?.contextWindow;
|
|
23
|
+
return typeof window === 'number' && Number.isSafeInteger(window) && window > 0 ? window : undefined;
|
|
24
|
+
}
|
|
@@ -4,7 +4,7 @@ import { join } from 'node:path';
|
|
|
4
4
|
export const MODEL_HEALTH_TTL_MS = 10 * 60_000;
|
|
5
5
|
const REFRESH_INTERVAL_MS = 60_000;
|
|
6
6
|
const FILE = 'model-health.json';
|
|
7
|
-
const DESCRIPTIVE_FIELDS = new Set(['model', 'models', 'modelContextWindows', 'contextWindow', 'reasoningEffort']);
|
|
7
|
+
const DESCRIPTIVE_FIELDS = new Set(['model', 'models', 'modelContextWindows', 'modelNames', 'modelParameters', 'freeModels', 'contextWindow', 'reasoningEffort']);
|
|
8
8
|
export function modelHealthKey(provider, model) {
|
|
9
9
|
const reach = Object.fromEntries(Object.entries(provider)
|
|
10
10
|
.filter(([name]) => !DESCRIPTIVE_FIELDS.has(name))
|
|
@@ -7,4 +7,5 @@ export declare function resolveModelContext(provider: ProviderConfig, model: str
|
|
|
7
7
|
export declare function configuredModelSnapshot(provider: ProviderConfig, model: string | undefined): ProviderConfig;
|
|
8
8
|
export declare function withEvaluationReasoningEffort(snapshot: ProviderConfig, effort: string | undefined): ProviderConfig;
|
|
9
9
|
export declare function refreshModelContext(provider: ProviderConfig, signal: AbortSignal): Promise<ProviderConfig>;
|
|
10
|
+
/** What the provider lists, with Andorra-known Claude windows filled in where the listing gives none. */
|
|
10
11
|
export declare function discoverModelMetadata(provider: ProviderConfig, signal: AbortSignal): Promise<ModelMetadata[]>;
|
|
@@ -5,8 +5,12 @@ import { readOpenCodeModels } from './opencode-catalog.js';
|
|
|
5
5
|
import { readCodexCatalog } from './codex-provider.js';
|
|
6
6
|
import { codexConnectFor } from './codex-rpc.js';
|
|
7
7
|
import { readClaudeCatalog } from './claude-provider.js';
|
|
8
|
+
import { knownClaudeContextWindow } from './model-context-windows.js';
|
|
9
|
+
import { readGoogleCatalog } from './google-provider.js';
|
|
8
10
|
import { readGrokCatalog } from './grok-provider.js';
|
|
9
11
|
import { readOpenCodeCatalog } from './opencode-cli-provider.js';
|
|
12
|
+
import { ANDORRA_SIGN_IN_MESSAGE, ANDORRA_UNAVAILABLE_MESSAGE } from './andorra/endpoint.js';
|
|
13
|
+
import { createHostedClient } from './andorra/hosted.js';
|
|
10
14
|
export async function resolveModelContext(provider, model, signal) {
|
|
11
15
|
return refreshModelContext(configuredModelSnapshot(provider, model), signal);
|
|
12
16
|
}
|
|
@@ -32,10 +36,21 @@ export function withEvaluationReasoningEffort(snapshot, effort) {
|
|
|
32
36
|
export async function refreshModelContext(provider, signal) {
|
|
33
37
|
const snapshot = configuredModelSnapshot(provider, undefined);
|
|
34
38
|
signal.throwIfAborted();
|
|
35
|
-
if (snapshot.type === '
|
|
39
|
+
if (snapshot.type === 'claude') {
|
|
40
|
+
// The Claude CLI's catalog carries no windows; asking it would only cost a process spawn.
|
|
41
|
+
if (snapshot.contextWindow === undefined) {
|
|
42
|
+
const known = knownClaudeContextWindow(snapshot.model);
|
|
43
|
+
if (known !== undefined)
|
|
44
|
+
snapshot.contextWindow = known;
|
|
45
|
+
}
|
|
46
|
+
return snapshot;
|
|
47
|
+
}
|
|
48
|
+
// Andorra entries carry the router's windows already (saved from GET /v1/hosted).
|
|
49
|
+
if (snapshot.type === 'codex' || snapshot.type === 'grok' || snapshot.type === 'google' || snapshot.type === 'andorra')
|
|
36
50
|
return snapshot;
|
|
37
51
|
try {
|
|
38
|
-
|
|
52
|
+
// The raw listing: a catalog default must not displace a window the user saved.
|
|
53
|
+
const models = await listModelMetadata(snapshot, signal);
|
|
39
54
|
signal.throwIfAborted();
|
|
40
55
|
const reported = models.find(model => model.id === snapshot.model)?.contextWindow;
|
|
41
56
|
if (reported !== undefined)
|
|
@@ -44,6 +59,11 @@ export async function refreshModelContext(provider, signal) {
|
|
|
44
59
|
catch {
|
|
45
60
|
signal.throwIfAborted();
|
|
46
61
|
}
|
|
62
|
+
if (snapshot.type === 'anthropic' && snapshot.contextWindow === undefined) {
|
|
63
|
+
const known = knownClaudeContextWindow(snapshot.model);
|
|
64
|
+
if (known !== undefined)
|
|
65
|
+
snapshot.contextWindow = known;
|
|
66
|
+
}
|
|
47
67
|
return snapshot;
|
|
48
68
|
}
|
|
49
69
|
function object(value) {
|
|
@@ -77,22 +97,42 @@ function lmStudioMetadata(data) {
|
|
|
77
97
|
}
|
|
78
98
|
return result;
|
|
79
99
|
}
|
|
100
|
+
/** What the provider lists, with Andorra-known Claude windows filled in where the listing gives none. */
|
|
80
101
|
export async function discoverModelMetadata(provider, signal) {
|
|
102
|
+
const models = await listModelMetadata(provider, signal);
|
|
103
|
+
return provider.type === 'anthropic' ? models.map(model => model.contextWindow === undefined ? withKnownClaudeWindow(model.id) : model) : models;
|
|
104
|
+
}
|
|
105
|
+
async function listModelMetadata(provider, signal) {
|
|
81
106
|
validateConfig({ version: 1, provider: provider.id, providers: [provider] });
|
|
82
107
|
if (provider.type === 'codex')
|
|
83
108
|
return (await readCodexCatalog(signal, codexConnectFor(provider))).models.map(id => ({ id }));
|
|
84
109
|
if (provider.type === 'claude')
|
|
85
|
-
return (await readClaudeCatalog(signal)).models.map(
|
|
110
|
+
return (await readClaudeCatalog(signal)).models.map(withKnownClaudeWindow);
|
|
86
111
|
if (provider.type === 'grok') {
|
|
87
112
|
const catalog = await readGrokCatalog(signal);
|
|
88
113
|
if (!catalog.signedIn)
|
|
89
114
|
throw new Error('Sign in to Grok on this machine before listing its models.');
|
|
90
115
|
return catalog.models.map(id => ({ id }));
|
|
91
116
|
}
|
|
117
|
+
if (provider.type === 'google') {
|
|
118
|
+
const catalog = await readGoogleCatalog(signal);
|
|
119
|
+
if (!catalog.signedIn)
|
|
120
|
+
throw new Error('Sign in with Google in the Antigravity CLI on this machine before listing its models.');
|
|
121
|
+
return catalog.models.map(id => ({ id }));
|
|
122
|
+
}
|
|
92
123
|
if (provider.type === 'opencode')
|
|
93
124
|
return (await readOpenCodeCatalog(signal)).models.map(model => ({ id: model.id, ...(model.contextWindow ? { contextWindow: model.contextWindow } : {}) }));
|
|
94
125
|
if (provider.type === 'opencode-go')
|
|
95
126
|
return readOpenCodeModels(signal, fetch, provider.requestTimeoutMs);
|
|
127
|
+
if (provider.type === 'andorra') {
|
|
128
|
+
const check = await createHostedClient()(signal);
|
|
129
|
+
signal.throwIfAborted();
|
|
130
|
+
if (check.kind === 'signed-out')
|
|
131
|
+
throw new Error(ANDORRA_SIGN_IN_MESSAGE);
|
|
132
|
+
if (check.kind === 'failed')
|
|
133
|
+
throw new Error(ANDORRA_UNAVAILABLE_MESSAGE);
|
|
134
|
+
return check.answer.models.map(model => ({ id: model.id, contextWindow: model.contextWindow }));
|
|
135
|
+
}
|
|
96
136
|
const deadlineMs = provider.requestTimeoutMs !== undefined && provider.requestTimeoutMs > 0
|
|
97
137
|
? Math.min(provider.requestTimeoutMs, MODEL_LISTING_TIMEOUT_MS)
|
|
98
138
|
: MODEL_LISTING_TIMEOUT_MS;
|
|
@@ -244,3 +284,7 @@ export async function discoverModelMetadata(provider, signal) {
|
|
|
244
284
|
}
|
|
245
285
|
return models;
|
|
246
286
|
}
|
|
287
|
+
function withKnownClaudeWindow(id) {
|
|
288
|
+
const contextWindow = knownClaudeContextWindow(id);
|
|
289
|
+
return contextWindow === undefined ? { id } : { id, contextWindow };
|
|
290
|
+
}
|
|
@@ -26,6 +26,8 @@ export declare class PagedTranscript<T extends Body, R> {
|
|
|
26
26
|
omitted: boolean;
|
|
27
27
|
};
|
|
28
28
|
append(value: T): void;
|
|
29
|
+
/** Puts `value` where the newest entry is, for a line that reports progress by rewriting itself. */
|
|
30
|
+
replaceLast(value: T): void;
|
|
29
31
|
private size;
|
|
30
32
|
private remember;
|
|
31
33
|
private materialize;
|
|
@@ -68,6 +68,22 @@ export class PagedTranscript {
|
|
|
68
68
|
this.omitted = true;
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
+
/** Puts `value` where the newest entry is, for a line that reports progress by rewriting itself. */
|
|
72
|
+
replaceLast(value) {
|
|
73
|
+
if (this.closed)
|
|
74
|
+
return;
|
|
75
|
+
const last = this.entries.pop();
|
|
76
|
+
if (last) {
|
|
77
|
+
const cached = this.cache.get(last);
|
|
78
|
+
if (cached) {
|
|
79
|
+
this.cachedChars -= this.size(cached);
|
|
80
|
+
this.cache.delete(last);
|
|
81
|
+
}
|
|
82
|
+
if (!last.fallback)
|
|
83
|
+
this.offset = last.offset;
|
|
84
|
+
}
|
|
85
|
+
this.append(value);
|
|
86
|
+
}
|
|
71
87
|
size(body) { return body.text.length + (body.detail?.length ?? 0); }
|
|
72
88
|
remember(entry, body) {
|
|
73
89
|
const old = this.cache.get(entry);
|
package/dist/src/palette.d.ts
CHANGED
package/dist/src/palette.js
CHANGED
|
@@ -5,7 +5,7 @@ export const SUBTLE = 250;
|
|
|
5
5
|
export const WHITE = 231;
|
|
6
6
|
export const ACCENT_INDEX = WHITE;
|
|
7
7
|
export const SKILL_CHIP = 147;
|
|
8
|
-
export const STATUS = { ok: 114, error: 203, added: 114 };
|
|
8
|
+
export const STATUS = { ok: 114, error: 203, added: 114, warn: 214 };
|
|
9
9
|
export const ATTENTION = '1;39';
|
|
10
10
|
export const ATTACHMENT_TOKEN = '1;39';
|
|
11
11
|
export function supportsTruecolor(env = process.env) {
|
package/dist/src/permissions.js
CHANGED
|
@@ -24,11 +24,24 @@ export function serializeApprovals(approve, mode) {
|
|
|
24
24
|
let tail = Promise.resolve();
|
|
25
25
|
return (name, args, signal) => {
|
|
26
26
|
const decidedUnder = mode();
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const previous = tail;
|
|
28
|
+
// A caller cancelled while it waits its turn is refused at once, not when the question ahead of it is
|
|
29
|
+
// answered. The queue itself still waits for that question, so prompts never overlap.
|
|
30
|
+
const pending = new Promise((resolveTurn, rejectTurn) => {
|
|
31
|
+
const abort = () => rejectTurn(signal.reason);
|
|
32
|
+
if (signal.aborted) {
|
|
33
|
+
abort();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
37
|
+
void previous.then(() => {
|
|
38
|
+
signal.removeEventListener('abort', abort);
|
|
39
|
+
if (signal.aborted)
|
|
40
|
+
return;
|
|
41
|
+
resolveTurn(mode() === decidedUnder ? approve(name, args, signal) : 'policy-changed');
|
|
42
|
+
});
|
|
30
43
|
});
|
|
31
|
-
tail = pending.catch(() => { });
|
|
44
|
+
tail = previous.then(() => pending.catch(() => { }));
|
|
32
45
|
return pending;
|
|
33
46
|
};
|
|
34
47
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { readCodexCatalog } from './codex-provider.js';
|
|
2
2
|
import { codexConnectFor } from './codex-rpc.js';
|
|
3
3
|
import { readClaudeCatalog } from './claude-provider.js';
|
|
4
|
+
import { readGoogleCatalog } from './google-provider.js';
|
|
4
5
|
import { readGrokCatalog } from './grok-provider.js';
|
|
5
6
|
import { readOpenCodeCatalog } from './opencode-cli-provider.js';
|
|
6
7
|
import { CliUnavailableError } from './cli-executable.js';
|
|
7
8
|
import { deadlinePhrase } from './providers.js';
|
|
8
9
|
import { providerAuthHeaders } from './anthropic-credentials.js';
|
|
10
|
+
import { ANDORRA_SIGN_IN_MESSAGE, ANDORRA_UNAVAILABLE_MESSAGE } from './andorra/endpoint.js';
|
|
11
|
+
import { createHostedClient } from './andorra/hosted.js';
|
|
9
12
|
const TEST_TIMEOUT_MS = 15_000;
|
|
10
13
|
const MAX_TEST_BODY_BYTES = 1024 * 1024;
|
|
11
14
|
const MAX_LISTING_PAGES = 100;
|
|
@@ -59,6 +62,22 @@ export async function testProviderConnection(provider, signal, deps = {}) {
|
|
|
59
62
|
return failed(bounded.aborted ? 'The Grok sign-in check timed out.' : 'Grok sign-in or model discovery is unavailable.');
|
|
60
63
|
}
|
|
61
64
|
}
|
|
65
|
+
if (provider.type === 'google') {
|
|
66
|
+
try {
|
|
67
|
+
const catalog = await readGoogleCatalog(bounded);
|
|
68
|
+
signal.throwIfAborted();
|
|
69
|
+
if (!catalog.signedIn)
|
|
70
|
+
return failed('Sign in with Google in the Antigravity CLI on this machine before using this provider.');
|
|
71
|
+
return { ok: true, latencyMs: Date.now() - startedAt, modelCount: catalog.models.length,
|
|
72
|
+
...(provider.model.trim() ? { modelAvailable: catalog.models.includes(provider.model) } : {}) };
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
signal.throwIfAborted();
|
|
76
|
+
if (error instanceof CliUnavailableError)
|
|
77
|
+
return failed(error.message);
|
|
78
|
+
return failed(bounded.aborted ? 'The Google sign-in check timed out.' : 'Google sign-in or model discovery is unavailable.');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
62
81
|
if (provider.type === 'opencode') {
|
|
63
82
|
try {
|
|
64
83
|
const catalog = await readOpenCodeCatalog(bounded);
|
|
@@ -76,6 +95,19 @@ export async function testProviderConnection(provider, signal, deps = {}) {
|
|
|
76
95
|
return failed(bounded.aborted ? 'The OpenCode check timed out.' : 'OpenCode is unavailable. Check the OpenCode CLI and try again.');
|
|
77
96
|
}
|
|
78
97
|
}
|
|
98
|
+
if (provider.type === 'andorra') {
|
|
99
|
+
// The same router and account token the adapter uses: the saved URL is informational, and the
|
|
100
|
+
// token never goes anywhere the adapter would not send it.
|
|
101
|
+
const result = await createHostedClient(deps.fetch ? { fetch: deps.fetch } : {})(bounded);
|
|
102
|
+
signal.throwIfAborted();
|
|
103
|
+
if (result.kind === 'signed-out')
|
|
104
|
+
return failed(ANDORRA_SIGN_IN_MESSAGE);
|
|
105
|
+
if (result.kind === 'failed' || !result.answer.enabled)
|
|
106
|
+
return failed(ANDORRA_UNAVAILABLE_MESSAGE);
|
|
107
|
+
const ids = result.answer.models.map(model => model.id);
|
|
108
|
+
return { ok: true, latencyMs: Date.now() - startedAt, modelCount: ids.length,
|
|
109
|
+
...(provider.model.trim() ? { modelAvailable: ids.includes(provider.model) } : {}) };
|
|
110
|
+
}
|
|
79
111
|
if (provider.type === 'codex') {
|
|
80
112
|
try {
|
|
81
113
|
const catalog = await (deps.codexCatalog ?? ((codexSignal) => readCodexCatalog(codexSignal, codexConnectFor(provider))))(bounded);
|
|
@@ -7,6 +7,11 @@ export interface EngineTransport {
|
|
|
7
7
|
anthropic: boolean;
|
|
8
8
|
contextWindow: number;
|
|
9
9
|
reasoningEffort?: string;
|
|
10
|
+
/**
|
|
11
|
+
* What an earlier assistant message carries as `reasoning_content` when none was kept for it (a turn replayed
|
|
12
|
+
* from a session, a summary, a model change). Set for endpoints that reject the request otherwise.
|
|
13
|
+
*/
|
|
14
|
+
missingReasoning?: string;
|
|
10
15
|
send(body: Record<string, unknown>): Promise<Response>;
|
|
11
16
|
parseWhole(response: Response): Promise<ModelResponse>;
|
|
12
17
|
streamValidator?(): {
|
|
@@ -366,10 +366,10 @@ export async function generateEngineResponse(request, host) {
|
|
|
366
366
|
delete body.store;
|
|
367
367
|
if (host.reasoningEffort !== undefined)
|
|
368
368
|
body.reasoning_effort = host.reasoningEffort;
|
|
369
|
-
if (
|
|
369
|
+
if (host.missingReasoning !== undefined) {
|
|
370
370
|
for (const message of body.messages) {
|
|
371
|
-
if (message.role === 'assistant' && message.reasoning_content === undefined)
|
|
372
|
-
message.reasoning_content =
|
|
371
|
+
if (message.role === 'assistant' && (message.reasoning_content === undefined || message.reasoning_content === ''))
|
|
372
|
+
message.reasoning_content = host.missingReasoning;
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
}
|
|
@@ -5,7 +5,7 @@ import { RemotePeerError } from './remote/errors.js';
|
|
|
5
5
|
export const PEER_PROVIDER_EXPORT_CAPABILITY = 'remote.providers.export';
|
|
6
6
|
const PEER_IMPORT_DEADLINE_MS = 60_000;
|
|
7
7
|
const MAX_EXPORTED_PROVIDERS = 100;
|
|
8
|
-
const IMPORT_PROVIDER_TYPES = new Set(['openai-compatible', 'anthropic', 'codex', 'claude', 'opencode-go', 'grok', 'opencode']);
|
|
8
|
+
const IMPORT_PROVIDER_TYPES = new Set(['openai-compatible', 'anthropic', 'codex', 'claude', 'opencode-go', 'grok', 'opencode', 'google']);
|
|
9
9
|
function message(error) { return error instanceof Error ? error.message : String(error); }
|
|
10
10
|
export function normalizeExportedProvider(value) {
|
|
11
11
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
@@ -169,6 +169,8 @@ function credentialNote(provider) {
|
|
|
169
169
|
return 'Claude Code sign-in does not transfer; sign in on this machine after importing';
|
|
170
170
|
if (provider.type === 'grok')
|
|
171
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';
|
|
172
174
|
if (provider.type === 'opencode')
|
|
173
175
|
return 'OpenCode sign-ins do not transfer; connect its providers on this machine after importing';
|
|
174
176
|
if (provider.apiKey)
|
|
@@ -5,5 +5,20 @@ import { retireUnsavedCodexAccounts } from './codex-auth.js';
|
|
|
5
5
|
import type { AnthropicConsoleAuth } from './anthropic-console-auth.js';
|
|
6
6
|
type ConsoleAuth = Pick<AnthropicConsoleAuth, 'start' | 'status' | 'cancel'>;
|
|
7
7
|
type ModelLister = (provider: ProviderConfig, signal: AbortSignal) => Promise<string[] | undefined>;
|
|
8
|
-
|
|
8
|
+
type PresetRow = {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Andorra in the Add provider list. `description()` is the hosted model names while Andorra can be added right
|
|
15
|
+
* now, undefined otherwise (asked each time the list is drawn); `add` adds it; `refresh` is the select's refresh
|
|
16
|
+
* option for rows that follow Andorra's state while the list is open.
|
|
17
|
+
*/
|
|
18
|
+
export interface AndorraOffer {
|
|
19
|
+
description(): string | undefined;
|
|
20
|
+
add(): Promise<void>;
|
|
21
|
+
refresh?(rows: () => PresetRow[]): ((redraw: (items: PresetRow[]) => void) => () => void) | undefined;
|
|
22
|
+
}
|
|
23
|
+
export declare function editProviderSettings(config: Config, id: string | undefined, ui: CommandScreenUI, signal: AbortSignal, login?: typeof import('./codex-auth.js').loginCodex, retire?: typeof retireUnsavedCodexAccounts, consoleAuth?: () => Promise<ConsoleAuth>, discover?: ModelLister, andorra?: AndorraOffer): Promise<Config | undefined>;
|
|
9
24
|
export {};
|