@andorra-labs/code 0.1.14 → 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/acp-agent.d.ts +54 -0
- package/dist/src/acp-agent.js +991 -0
- package/dist/src/agent-execution.js +4 -0
- package/dist/src/agent-mcp-catalog.js +2 -0
- package/dist/src/agent-mcp.d.ts +2 -0
- package/dist/src/agent-mcp.js +84 -2
- package/dist/src/andorra/entry.js +21 -3
- package/dist/src/andorra/hosted.d.ts +3 -0
- package/dist/src/andorra/hosted.js +5 -1
- package/dist/src/andorra/notices.d.ts +10 -1
- package/dist/src/andorra/notices.js +25 -2
- package/dist/src/andorra/terminal.d.ts +2 -0
- package/dist/src/andorra/terminal.js +2 -2
- package/dist/src/app-server/protocol.d.ts +6 -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 +8 -0
- package/dist/src/app-server.js +87 -41
- package/dist/src/auth/AuthManager.js +4 -4
- 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-server.d.ts +5 -0
- package/dist/src/browser-server.js +27 -3
- package/dist/src/browser-view.d.ts +16 -0
- package/dist/src/browser-view.js +60 -2
- 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 +164 -34
- package/dist/src/coding-tools.js +7 -7
- package/dist/src/command-screens.d.ts +9 -2
- package/dist/src/command-screens.js +161 -94
- package/dist/src/commands.d.ts +1 -1
- package/dist/src/commands.js +1 -0
- package/dist/src/completion-gates.d.ts +22 -0
- package/dist/src/completion-gates.js +11 -0
- package/dist/src/config.d.ts +5 -0
- package/dist/src/config.js +48 -0
- package/dist/src/google-provider.d.ts +31 -0
- package/dist/src/google-provider.js +153 -0
- package/dist/src/graph-health.js +1 -1
- package/dist/src/graph-manager-chat.js +6 -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 +67 -8
- package/dist/src/graph-ui/edge-router.js +121 -53
- package/dist/src/graph-visibility.d.ts +31 -0
- package/dist/src/graph-visibility.js +102 -0
- 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 +5 -1
- package/dist/src/membership.d.ts +3 -0
- package/dist/src/membership.js +19 -2
- package/dist/src/model-health-cache.js +1 -1
- package/dist/src/model-metadata.js +8 -1
- package/dist/src/paged-transcript.d.ts +2 -0
- package/dist/src/paged-transcript.js +16 -0
- package/dist/src/provider-connection.js +17 -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.js +14 -2
- package/dist/src/providers.d.ts +16 -2
- package/dist/src/providers.js +36 -12
- package/dist/src/react-runtime.js +21 -5
- 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 +26 -2
- package/dist/src/runtime-environment.d.ts +1 -0
- package/dist/src/runtime-environment.js +13 -0
- 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/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 +1 -0
- package/dist/src/skills/bundled/provenance.json +7 -2
- package/dist/src/skills/runtime-skills.js +1 -0
- 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 +8 -1
- package/dist/src/terminal-ui.js +40 -14
- 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 +2 -1
- package/dist/src/types.d.ts +2 -0
- package/package.json +2 -1
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
@@ -61,6 +62,22 @@ export async function testProviderConnection(provider, signal, deps = {}) {
|
|
|
61
62
|
return failed(bounded.aborted ? 'The Grok sign-in check timed out.' : 'Grok sign-in or model discovery is unavailable.');
|
|
62
63
|
}
|
|
63
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
|
+
}
|
|
64
81
|
if (provider.type === 'opencode') {
|
|
65
82
|
try {
|
|
66
83
|
const catalog = await readOpenCodeCatalog(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)
|
|
@@ -6,6 +6,7 @@ import { codexAccountHome } from './codex-rpc.js';
|
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
7
7
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
8
8
|
import { ANTHROPIC_CONSOLE_BASE_URL, anthropicAccountHome } from './anthropic-credentials.js';
|
|
9
|
+
import { GOOGLE_BASE_URL } from './google-provider.js';
|
|
9
10
|
import { GROK_BASE_URL } from './grok-provider.js';
|
|
10
11
|
import { OPENCODE_BASE_URL } from './opencode-cli-provider.js';
|
|
11
12
|
const defaultConsoleAuth = async () => new (await import('./anthropic-console-auth.js')).AnthropicConsoleAuth();
|
|
@@ -56,6 +57,7 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
|
|
|
56
57
|
{ id: 'openai', label: 'OpenAI' }, { id: 'anthropic', label: 'Anthropic' },
|
|
57
58
|
{ id: 'local', label: 'Local server' }, { id: 'codex', label: 'ChatGPT / Codex' },
|
|
58
59
|
{ id: 'claude', label: 'Claude subscription' }, { id: 'grok', label: 'Grok subscription (Grok CLI)' },
|
|
60
|
+
{ id: 'google', label: 'Google sign-in (Antigravity CLI)' },
|
|
59
61
|
{ id: 'opencode', label: 'OpenCode (CLI sign-in)' }, { id: 'opencode-go', label: 'OpenCode Go' },
|
|
60
62
|
{ id: 'custom', label: 'Custom provider' },
|
|
61
63
|
];
|
|
@@ -80,6 +82,7 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
|
|
|
80
82
|
codex: { type: 'codex', baseUrl: 'https://chatgpt.com/backend-api/codex', model: '' },
|
|
81
83
|
claude: { type: 'claude', baseUrl: 'https://api.anthropic.com', model: '' },
|
|
82
84
|
grok: { type: 'grok', baseUrl: GROK_BASE_URL, model: '' },
|
|
85
|
+
google: { type: 'google', baseUrl: GOOGLE_BASE_URL, model: '' },
|
|
83
86
|
opencode: { type: 'opencode', baseUrl: OPENCODE_BASE_URL, model: '' },
|
|
84
87
|
'opencode-go': { type: 'opencode-go', baseUrl: 'https://opencode.ai/inference/go', model: '' },
|
|
85
88
|
custom: { type: 'openai-compatible', baseUrl: 'https://api.openai.com/v1', model: '' },
|
|
@@ -130,7 +133,8 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
|
|
|
130
133
|
const isClaude = provider.type === 'claude';
|
|
131
134
|
const isGrok = provider.type === 'grok';
|
|
132
135
|
const isOpenCode = provider.type === 'opencode';
|
|
133
|
-
const
|
|
136
|
+
const isGoogle = provider.type === 'google';
|
|
137
|
+
const managed = isCodex || isClaude || isGrok || isOpenCode || isGoogle;
|
|
134
138
|
// Andorra's entry has a fixed endpoint, no key and a model list the service keeps current.
|
|
135
139
|
const isAndorra = provider.type === 'andorra';
|
|
136
140
|
const isConsole = provider.type === 'anthropic' && provider.anthropicAuth === 'console';
|
|
@@ -147,7 +151,7 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
|
|
|
147
151
|
{ id: 'apiKey', label: `API key: ${provider.apiKey ? 'saved (hidden)' : 'not saved'}` },
|
|
148
152
|
{ id: 'apiKeyEnv', label: `Environment fallback: ${provider.apiKeyEnv ?? 'none'}` },
|
|
149
153
|
...(provider.apiKey || provider.apiKeyEnv ? [{ id: 'clearAuth', label: 'Remove authentication' }] : []),
|
|
150
|
-
] : [{ id: 'login', label: isClaude ? 'Check Claude Code sign-in' : isGrok ? 'Check Grok sign-in' : isOpenCode ? 'Check OpenCode connection' : 'Sign in with ChatGPT / Codex' }]),
|
|
154
|
+
] : [{ id: 'login', label: isClaude ? 'Check Claude Code sign-in' : isGrok ? 'Check Grok sign-in' : isGoogle ? 'Check Google sign-in' : isOpenCode ? 'Check OpenCode connection' : 'Sign in with ChatGPT / Codex' }]),
|
|
151
155
|
{ id: 'name', label: `Display name: ${provider.name || 'not set'}` },
|
|
152
156
|
{ id: 'model', label: `Active model: ${provider.model ? modelDisplayName(provider, provider.model) : 'not set'}` },
|
|
153
157
|
...(isAndorra ? [] : [{ id: 'models', label: `Models: ${providerModels(provider).length || 'none'} configured` }]),
|
|
@@ -241,6 +245,8 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
|
|
|
241
245
|
return (await (await import('./claude-provider.js')).readClaudeCatalog(loadSignal)).models.map(id => ({ id }));
|
|
242
246
|
if (isGrok)
|
|
243
247
|
return (await (await import('./grok-provider.js')).readGrokCatalog(loadSignal)).models.map(id => ({ id }));
|
|
248
|
+
if (isGoogle)
|
|
249
|
+
return (await (await import('./google-provider.js')).readGoogleCatalog(loadSignal)).models.map(id => ({ id }));
|
|
244
250
|
if (isOpenCode)
|
|
245
251
|
return (await (await import('./opencode-cli-provider.js')).readOpenCodeCatalog(loadSignal)).models.map(model => ({ id: model.id }));
|
|
246
252
|
return (await discover(candidate, loadSignal) ?? []).map(id => ({ id }));
|
|
@@ -436,6 +442,12 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
|
|
|
436
442
|
throw new Error('Run grok login on this machine, then retry.');
|
|
437
443
|
return catalog.models.map(id => ({ id }));
|
|
438
444
|
}
|
|
445
|
+
if (isGoogle) {
|
|
446
|
+
const catalog = await (await import('./google-provider.js')).readGoogleCatalog(loadSignal);
|
|
447
|
+
if (!catalog.signedIn)
|
|
448
|
+
throw new Error('Run agy acp --login on this machine, then retry.');
|
|
449
|
+
return catalog.models.map(id => ({ id }));
|
|
450
|
+
}
|
|
439
451
|
if (isOpenCode) {
|
|
440
452
|
const catalog = await (await import('./opencode-cli-provider.js')).readOpenCodeCatalog(loadSignal);
|
|
441
453
|
if (!catalog.models.length)
|
package/dist/src/providers.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { ModelAdapter } from './types.js';
|
|
2
2
|
export declare const REASONING_EFFORTS: readonly ["none", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
3
|
+
/** Provider types whose requests carry a thinking-effort override. */
|
|
4
|
+
export declare const REASONING_EFFORT_PROVIDER_TYPES: readonly ["openai-compatible", "opencode-go", "anthropic"];
|
|
5
|
+
export declare function supportsReasoningEffort(type: string): boolean;
|
|
3
6
|
export type ReasoningEffort = typeof REASONING_EFFORTS[number];
|
|
4
|
-
export declare const PROVIDER_TYPES: readonly ["openai-compatible", "anthropic", "codex", "claude", "opencode-go", "grok", "opencode", "andorra"];
|
|
7
|
+
export declare const PROVIDER_TYPES: readonly ["openai-compatible", "anthropic", "codex", "claude", "opencode-go", "grok", "opencode", "google", "andorra"];
|
|
5
8
|
export type ProviderType = typeof PROVIDER_TYPES[number];
|
|
6
|
-
export declare const SIGN_IN_PROVIDER_TYPES: readonly ["codex", "claude", "grok", "opencode"];
|
|
9
|
+
export declare const SIGN_IN_PROVIDER_TYPES: readonly ["codex", "claude", "grok", "opencode", "google"];
|
|
7
10
|
export declare function isSignInProviderType(type: unknown): type is typeof SIGN_IN_PROVIDER_TYPES[number];
|
|
8
11
|
export declare const DEFAULT_REQUEST_TIMEOUT_MS: number;
|
|
9
12
|
export declare const MAX_REQUEST_TIMEOUT_MS = 86400000;
|
|
@@ -22,6 +25,10 @@ export interface ProviderConfig {
|
|
|
22
25
|
modelContextWindows?: Record<string, number>;
|
|
23
26
|
/** Andorra only: the router's display name for each model id. Shown to people; never used to look a model up. */
|
|
24
27
|
modelNames?: Record<string, string>;
|
|
28
|
+
/** Andorra only: the size the router states for a model id, in billions of parameters. Shown to people. */
|
|
29
|
+
modelParameters?: Record<string, number>;
|
|
30
|
+
/** Andorra only: the model ids the router serves free of the weekly allowance. Shown to people as a badge. */
|
|
31
|
+
freeModels?: string[];
|
|
25
32
|
contextWindow?: number;
|
|
26
33
|
reasoningEffort?: ReasoningEffort;
|
|
27
34
|
requestTimeoutMs?: number;
|
|
@@ -32,6 +39,11 @@ export interface ProviderConfig {
|
|
|
32
39
|
name?: string;
|
|
33
40
|
}
|
|
34
41
|
export declare function providerLabel(provider: Pick<ProviderConfig, 'id' | 'type' | 'codexEmail' | 'name'>, providers: readonly Pick<ProviderConfig, 'type'>[]): string;
|
|
42
|
+
/** The bounds of a hosted model's size in billions of parameters; the router and the admin page use the same ones. */
|
|
43
|
+
export declare const MIN_MODEL_PARAMETERS_BILLIONS = 0.001;
|
|
44
|
+
export declare const MAX_MODEL_PARAMETERS_BILLIONS = 100000;
|
|
45
|
+
/** Whether `value` is a size a hosted model may state: a finite number of billions of parameters in range. */
|
|
46
|
+
export declare function isModelParameters(value: unknown): value is number;
|
|
35
47
|
/** What a person reads for `model`: an Andorra entry's stored display name, otherwise the id itself. */
|
|
36
48
|
export declare function modelDisplayName(provider: Pick<ProviderConfig, 'type' | 'modelNames'> | undefined, model: string): string;
|
|
37
49
|
/** The model id an exact display name (any case) names on an Andorra entry; undefined for an id, another provider, or a name two models share. */
|
|
@@ -55,6 +67,8 @@ export declare function defaultProviders(): ProviderConfig[];
|
|
|
55
67
|
export declare const MALFORMED_RESPONSE_RETRIES = 5;
|
|
56
68
|
export declare class ProviderRequestError extends Error {
|
|
57
69
|
readonly contextOverflow: boolean;
|
|
70
|
+
/** The system error code behind a connection that could not be made; recorded with the failure, never part of the message. */
|
|
71
|
+
connectionCause?: string;
|
|
58
72
|
constructor(message: string, contextOverflow?: boolean);
|
|
59
73
|
}
|
|
60
74
|
export declare const BLANK_TOOL_CALL_LIMIT = 4096;
|
package/dist/src/providers.js
CHANGED
|
@@ -3,6 +3,7 @@ import { COMPLETION_TOOL } from './completion.js';
|
|
|
3
3
|
import { createCodexAdapter } from './codex-provider.js';
|
|
4
4
|
import { createClaudeAdapter } from './claude-provider.js';
|
|
5
5
|
import { createOpenCodeAdapter } from './opencode-provider.js';
|
|
6
|
+
import { createGoogleAdapter } from './google-provider.js';
|
|
6
7
|
import { createGrokAdapter } from './grok-provider.js';
|
|
7
8
|
import { createOpenCodeCliAdapter } from './opencode-cli-provider.js';
|
|
8
9
|
import { providerAuthHeaders } from './anthropic-credentials.js';
|
|
@@ -11,12 +12,17 @@ import { andorraRefusal } from './andorra/errors.js';
|
|
|
11
12
|
import { generateEngineResponse, isEngineContextOverflow } from './provider-engine.js';
|
|
12
13
|
import { estimateStreamedTokens } from './token-rate.js';
|
|
13
14
|
export const REASONING_EFFORTS = ['none', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
14
|
-
|
|
15
|
-
export const
|
|
15
|
+
/** Provider types whose requests carry a thinking-effort override. */
|
|
16
|
+
export const REASONING_EFFORT_PROVIDER_TYPES = ['openai-compatible', 'opencode-go', 'anthropic'];
|
|
17
|
+
export function supportsReasoningEffort(type) {
|
|
18
|
+
return REASONING_EFFORT_PROVIDER_TYPES.includes(type);
|
|
19
|
+
}
|
|
20
|
+
export const PROVIDER_TYPES = ['openai-compatible', 'anthropic', 'codex', 'claude', 'opencode-go', 'grok', 'opencode', 'google', 'andorra'];
|
|
21
|
+
export const SIGN_IN_PROVIDER_TYPES = ['codex', 'claude', 'grok', 'opencode', 'google'];
|
|
16
22
|
export function isSignInProviderType(type) {
|
|
17
23
|
return SIGN_IN_PROVIDER_TYPES.includes(type);
|
|
18
24
|
}
|
|
19
|
-
const SIGN_IN_PRODUCT = { codex: 'Codex', claude: 'Claude', grok: 'Grok', opencode: 'OpenCode' };
|
|
25
|
+
const SIGN_IN_PRODUCT = { codex: 'Codex', claude: 'Claude', grok: 'Grok', opencode: 'OpenCode', google: 'Google' };
|
|
20
26
|
export const DEFAULT_REQUEST_TIMEOUT_MS = 10 * 60_000;
|
|
21
27
|
export const MAX_REQUEST_TIMEOUT_MS = 86_400_000;
|
|
22
28
|
export function assertRequestTimeout(provider) {
|
|
@@ -56,6 +62,13 @@ export function providerLabel(provider, providers) {
|
|
|
56
62
|
const local = provider.codexEmail?.split('@')[0] || provider.id;
|
|
57
63
|
return `codex - ${local.length > 32 ? `${local.slice(0, 31)}…` : local}`;
|
|
58
64
|
}
|
|
65
|
+
/** The bounds of a hosted model's size in billions of parameters; the router and the admin page use the same ones. */
|
|
66
|
+
export const MIN_MODEL_PARAMETERS_BILLIONS = 0.001;
|
|
67
|
+
export const MAX_MODEL_PARAMETERS_BILLIONS = 100_000;
|
|
68
|
+
/** Whether `value` is a size a hosted model may state: a finite number of billions of parameters in range. */
|
|
69
|
+
export function isModelParameters(value) {
|
|
70
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= MIN_MODEL_PARAMETERS_BILLIONS && value <= MAX_MODEL_PARAMETERS_BILLIONS;
|
|
71
|
+
}
|
|
59
72
|
/** What a person reads for `model`: an Andorra entry's stored display name, otherwise the id itself. */
|
|
60
73
|
export function modelDisplayName(provider, model) {
|
|
61
74
|
const names = provider?.type === 'andorra' ? provider.modelNames : undefined;
|
|
@@ -152,7 +165,7 @@ export function assertProviderCredentials(provider) {
|
|
|
152
165
|
if (provider.type === 'claude' && (provider.apiKey !== undefined || provider.apiKeyEnv !== undefined)) {
|
|
153
166
|
throw new Error('Claude providers use Claude Code sign-in; API key overrides are not supported.');
|
|
154
167
|
}
|
|
155
|
-
if ((provider.type === 'grok' || provider.type === 'opencode') && (provider.apiKey !== undefined || provider.apiKeyEnv !== undefined)) {
|
|
168
|
+
if ((provider.type === 'grok' || provider.type === 'opencode' || provider.type === 'google') && (provider.apiKey !== undefined || provider.apiKeyEnv !== undefined)) {
|
|
156
169
|
throw new Error(`${SIGN_IN_PRODUCT[provider.type]} providers use their CLI sign-in; API key overrides are not supported.`);
|
|
157
170
|
}
|
|
158
171
|
if (provider.type === 'andorra' && (provider.apiKey !== undefined || provider.apiKeyEnv !== undefined)) {
|
|
@@ -185,17 +198,22 @@ export function defaultProviders() {
|
|
|
185
198
|
{ id: 'local', type: 'openai-compatible', baseUrl: 'http://127.0.0.1:1234/v1', model: 'local-model' },
|
|
186
199
|
];
|
|
187
200
|
}
|
|
188
|
-
|
|
189
|
-
const REQUEST_RETRY_DELAYS_MS = [
|
|
201
|
+
// A transport fault is retried seven times: twice 5 seconds apart, three times 15 seconds apart, then twice a minute apart.
|
|
202
|
+
const REQUEST_RETRY_DELAYS_MS = [5_000, 5_000, 15_000, 15_000, 15_000, 60_000, 60_000];
|
|
203
|
+
const MAX_REQUEST_RETRIES = REQUEST_RETRY_DELAYS_MS.length;
|
|
190
204
|
const MALFORMED_STREAM_RETRY_DELAYS_MS = [1_000, 3_000, 10_000];
|
|
205
|
+
const MALFORMED_STREAM_RETRIES = MALFORMED_STREAM_RETRY_DELAYS_MS.length;
|
|
191
206
|
// A malformed response is usually the model's own slip (tool-call arguments that are not valid JSON), so asking
|
|
192
207
|
// again gets a fresh sample. It needs no long backoff and is retried quietly, more often than a transport fault.
|
|
193
208
|
export const MALFORMED_RESPONSE_RETRIES = 5;
|
|
194
209
|
const MALFORMED_RESPONSE_RETRY_DELAYS_MS = [250, 250, 500, 1_000, 2_000];
|
|
195
210
|
const MALFORMED_RESPONSE_MESSAGE = 'Provider returned a malformed response.';
|
|
196
|
-
|
|
211
|
+
// The longest Retry-After a provider may ask for; it is not tied to the backoff above.
|
|
212
|
+
const MAX_AUTOMATIC_RETRY_AFTER_MS = 120_000;
|
|
197
213
|
export class ProviderRequestError extends Error {
|
|
198
214
|
contextOverflow;
|
|
215
|
+
/** The system error code behind a connection that could not be made; recorded with the failure, never part of the message. */
|
|
216
|
+
connectionCause;
|
|
199
217
|
constructor(message, contextOverflow = false) {
|
|
200
218
|
super(message);
|
|
201
219
|
this.contextOverflow = contextOverflow;
|
|
@@ -223,7 +241,7 @@ class MalformedStreamProviderError extends MalformedResponseProviderError {
|
|
|
223
241
|
}
|
|
224
242
|
export const BLANK_TOOL_CALL_LIMIT = 4096;
|
|
225
243
|
class BlankToolCallProviderError extends RetryableProviderError {
|
|
226
|
-
constructor() { super('Provider streamed a tool call that kept generating blank output.', 0, MALFORMED_STREAM_RETRY_DELAYS_MS); }
|
|
244
|
+
constructor() { super('Provider streamed a tool call that kept generating blank output.', 0, MALFORMED_STREAM_RETRY_DELAYS_MS, MALFORMED_STREAM_RETRIES); }
|
|
227
245
|
}
|
|
228
246
|
export function createBlankToolCallGuard(limit = BLANK_TOOL_CALL_LIMIT) {
|
|
229
247
|
let blank = 0;
|
|
@@ -717,6 +735,8 @@ export function createAdapter(config, options = {}) {
|
|
|
717
735
|
return createClaudeAdapter(config);
|
|
718
736
|
if (config.type === 'grok')
|
|
719
737
|
return createGrokAdapter(config);
|
|
738
|
+
if (config.type === 'google')
|
|
739
|
+
return createGoogleAdapter(config);
|
|
720
740
|
if (config.type === 'opencode')
|
|
721
741
|
return createOpenCodeCliAdapter(config);
|
|
722
742
|
if (config.type === 'opencode-go')
|
|
@@ -787,9 +807,9 @@ export function createAdapter(config, options = {}) {
|
|
|
787
807
|
// A connection that could not be made is not one of the router's refusals: it gets the usual bounded
|
|
788
808
|
// retries, and the plain sentence (no address, no error code) while retrying and when they run out.
|
|
789
809
|
if (andorra) {
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
throw
|
|
810
|
+
const failure = permanentConnectionFailure(error) ? new ProviderRequestError(ANDORRA_UNAVAILABLE_MESSAGE) : new RetryableProviderError(ANDORRA_UNAVAILABLE_MESSAGE);
|
|
811
|
+
failure.connectionCause = connectionFailureDetail(error);
|
|
812
|
+
throw failure;
|
|
793
813
|
}
|
|
794
814
|
const cause = connectionFailureDetail(error);
|
|
795
815
|
const message = `Provider connection failed${cause ? ` (${cause})` : ''}. Check its URL and network connection.`;
|
|
@@ -936,7 +956,8 @@ export function createAdapter(config, options = {}) {
|
|
|
936
956
|
const reason = error instanceof MalformedStreamProviderError
|
|
937
957
|
? 'Provider returned a malformed streamed response; retrying without streaming.'
|
|
938
958
|
: error.message;
|
|
939
|
-
await onRetry?.({ retry: retry + 1, maxRetries: error.maxRetries, delayMs, reason, ...(error.quiet ? { quiet: true } : {})
|
|
959
|
+
await onRetry?.({ retry: retry + 1, maxRetries: error.maxRetries, delayMs, reason, ...(error.quiet ? { quiet: true } : {}),
|
|
960
|
+
...(error.connectionCause ? { cause: error.connectionCause } : {}) });
|
|
940
961
|
try {
|
|
941
962
|
await delay(delayMs, undefined, { signal });
|
|
942
963
|
}
|
|
@@ -961,6 +982,9 @@ export function createAdapter(config, options = {}) {
|
|
|
961
982
|
providerId: config.id, baseUrl: base.href.replace(/\/$/, ''), anthropic,
|
|
962
983
|
contextWindow: model === config.model ? config.contextWindow ?? 128_000 : 128_000,
|
|
963
984
|
reasoningEffort: model === config.model ? config.reasoningEffort : undefined,
|
|
985
|
+
// DeepSeek takes an empty string. Andorra's router rejects an empty one like an absent one (HTTP 400,
|
|
986
|
+
// "Missing required parameter: 'messages[n].reasoning_content'") and takes a single space.
|
|
987
|
+
...(andorra ? { missingReasoning: ' ' } : base.origin === 'https://api.deepseek.com' ? { missingReasoning: '' } : {}),
|
|
964
988
|
async send(body) {
|
|
965
989
|
deadline = undefined;
|
|
966
990
|
dispose?.();
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { runtimeEnvironmentNote } from './runtime-environment.js';
|
|
1
2
|
import { createGoalCompletionVerifier } from './goal-completion-verification.js';
|
|
2
3
|
import { goalSystemNote, withGoalSystemNote } from './session-goal.js';
|
|
3
4
|
import { validateExtendedToolSchema } from './tool-schema-compatibility.js';
|
|
@@ -10,7 +11,7 @@ import { andorraIsContextOverflow } from '../vendor/engine/runtime/ai/utils/over
|
|
|
10
11
|
import { toEngineResponse, engineModel } from './engine/protocol.js';
|
|
11
12
|
import { ProviderRequestError } from './providers.js';
|
|
12
13
|
import { COMPLETION_ALONE_ERROR, COMPLETION_TOOL, COMPLETION_GUIDANCE, FINAL_RESPONSE_GUIDANCE, OUTPUT_STOOD_IN_NOTE, RESPONSE_STRUCTURE_GUIDANCE, completionTool, completionResponse, parseCompletion, withoutTrailingEnvelope } from './completion.js';
|
|
13
|
-
import { MAX_GATE_ASKS, MAX_IDLE_UNFINISHED_ASKS, finalAnswerGate } from './completion-gates.js';
|
|
14
|
+
import { MAX_GATE_ASKS, MAX_IDLE_UNFINISHED_ASKS, finalAnswerGate, proseIsFinalAnswer } from './completion-gates.js';
|
|
14
15
|
import { TestEditGuard, testEditNudge } from './test-edit-guard.js';
|
|
15
16
|
import { HistoryCompactor, CompactionRecoveryError, pinnedContextChars, PINNED_CONTEXT_GUIDANCE, retireSupersededNodeScaffolding, clipOldPinnedMessages, isNodePrompt, recentHumanMessages } from './context-compaction.js';
|
|
16
17
|
import { createHash, randomUUID } from 'node:crypto';
|
|
@@ -324,7 +325,8 @@ export class AndorraAgentEngine {
|
|
|
324
325
|
const recentFailures = [];
|
|
325
326
|
let decisionTask = options.decisionTask ?? options.task;
|
|
326
327
|
let taskChanged = Boolean(options.resumeMessages);
|
|
327
|
-
const messages = [{ role: 'system', content: ((options.graph || options.completionPolicy || options.subagentId ? '' : DEFAULT_AGENT_INSTRUCTIONS + '\n') + SYSTEM) +
|
|
328
|
+
const messages = [{ role: 'system', content: ((options.graph || options.completionPolicy || options.subagentId ? '' : DEFAULT_AGENT_INSTRUCTIONS + '\n') + SYSTEM) + `
|
|
329
|
+
${runtimeEnvironmentNote()}` + (options.systemPrompt ? `\nAgent instructions:\n${options.systemPrompt}` : '') + (options.instructions ? `\nWorkspace guidance:\n${options.instructions}` : '') }];
|
|
328
330
|
const completionGuidance = options.completionPolicy ? COMPLETION_GUIDANCE : COMPLETION_GUIDANCE.replace('Finish with complete_agent alone or final JSON.', 'When finished, return your answer in natural prose. Legacy complete_agent or final JSON is also accepted.');
|
|
329
331
|
messages[0].content += `\n${completionGuidance}`;
|
|
330
332
|
const declaredOutcomes = options.completionPolicy ? (options.completionPolicy.mode === 'single' ? [options.completionPolicy.outcome] : options.completionPolicy.outcomes) : [];
|
|
@@ -1531,13 +1533,27 @@ export class AndorraAgentEngine {
|
|
|
1531
1533
|
catch { }
|
|
1532
1534
|
}
|
|
1533
1535
|
const explicit = response.completionSource === 'complete_agent' || objectText && (!!options.completionPolicy || !!legacyCompletion);
|
|
1534
|
-
|
|
1536
|
+
const policy = options.completionPolicy;
|
|
1537
|
+
let proseCompletion;
|
|
1538
|
+
if (!explicit && policy?.mode === 'single' && proseIsFinalAnswer({
|
|
1539
|
+
text: response.text, stopReason: response.stopReason, endsRun: !!options.finalAnswerOutcomes?.includes(policy.outcome),
|
|
1540
|
+
hasOutputSchema: !!options.outputSchema, userPresent: tools.some(tool => tool.name === 'ask_user'),
|
|
1541
|
+
acted: result.toolCalls > 0 || todoCalls > 0 || !!options.resumeMessages, openTodos: todoStore.snapshot().filter(todo => todo.status !== 'completed').length,
|
|
1542
|
+
toolCallDropped: suspectedDroppedToolCall(response), carriesEnvelope: withoutTrailingEnvelope(response.text) !== response.text,
|
|
1543
|
+
})) {
|
|
1544
|
+
const summary = response.text.trim();
|
|
1545
|
+
const candidate = { summary, tests: [], outcome: policy.outcome, artifacts: [],
|
|
1546
|
+
output: { summary, tests: [], ...(options.canonicalTask !== undefined ? { originalTask: options.canonicalTask } : {}) } };
|
|
1547
|
+
if (!options.completionGuard?.(candidate))
|
|
1548
|
+
proseCompletion = candidate;
|
|
1549
|
+
}
|
|
1550
|
+
if (!explicit && !proseCompletion && options.completionPolicy && finishingRequest && finishHolds < 1) {
|
|
1535
1551
|
finishHolds++;
|
|
1536
1552
|
finishOnly = true;
|
|
1537
1553
|
await emit('efficiency.facts.action', { action: 'finish_only', reason: 'held' });
|
|
1538
1554
|
return { continue: true, context: FINISH_HELD_GUIDANCE };
|
|
1539
1555
|
}
|
|
1540
|
-
if (!explicit && options.completionPolicy) {
|
|
1556
|
+
if (!explicit && !proseCompletion && options.completionPolicy) {
|
|
1541
1557
|
const dropped = suspectedDroppedToolCall(response);
|
|
1542
1558
|
const shown = withoutTrailingEnvelope(response.text, SENT_BACK_ENVELOPE_NOTE);
|
|
1543
1559
|
if (shown.trim())
|
|
@@ -1639,7 +1655,7 @@ export class AndorraAgentEngine {
|
|
|
1639
1655
|
}
|
|
1640
1656
|
}
|
|
1641
1657
|
if (!explicit) {
|
|
1642
|
-
const completion = { summary: candidateText, tests: [] };
|
|
1658
|
+
const completion = proseCompletion ?? { summary: candidateText, tests: [] };
|
|
1643
1659
|
const rejected = options.completionGuard?.(completion);
|
|
1644
1660
|
if (rejected) {
|
|
1645
1661
|
completionRejectionEmitted = true;
|
|
@@ -9,6 +9,8 @@ export interface DocumentReadOptions {
|
|
|
9
9
|
maxOutput: number;
|
|
10
10
|
maxLineChars: number;
|
|
11
11
|
}
|
|
12
|
+
/** The note a Read of anything but a PDF carries when the call named `pages` or `render`: they are dropped, not refused. */
|
|
13
|
+
export declare const pdfOnlyArgumentsIgnored: (options: Pick<DocumentReadOptions, "pages" | "render">, what: string) => string;
|
|
12
14
|
export declare function parsePageSelection(spec: string, pageCount: number): number[];
|
|
13
15
|
export declare function readDocumentObservation(context: ToolContext, shownPath: string, bytes: Buffer, options: DocumentReadOptions): Promise<string | undefined>;
|
|
14
16
|
export declare function legacyTextObservation(shownPath: string, decoded: {
|
|
@@ -7,6 +7,8 @@ export const READ_PDF_RENDER_PAGES = 4;
|
|
|
7
7
|
const CACHE_LIMIT = 3;
|
|
8
8
|
const LABEL = { pdf: 'PDF', docx: 'Word document', doc: 'Word 97-2003 document' };
|
|
9
9
|
const cache = new Map();
|
|
10
|
+
/** The note a Read of anything but a PDF carries when the call named `pages` or `render`: they are dropped, not refused. */
|
|
11
|
+
export const pdfOnlyArgumentsIgnored = (options, what) => options.pages !== undefined || options.render ? `[pages and render apply to PDF files only and were ignored: this is ${what}, paged with offset and limit.]` : '';
|
|
10
12
|
export function parsePageSelection(spec, pageCount) {
|
|
11
13
|
const selected = [];
|
|
12
14
|
const parts = spec.split(',').map(part => part.trim()).filter(Boolean);
|
|
@@ -75,9 +77,8 @@ export async function readDocumentObservation(context, shownPath, bytes, options
|
|
|
75
77
|
const size = formatBytes(bytes.length);
|
|
76
78
|
const notes = document.notes.length ? ` ${document.notes.join(' ')}` : '';
|
|
77
79
|
if (document.kind !== 'pdf') {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const header = `[${LABEL[document.kind]} ${shownPath} (${size}): its text follows. This is extracted text, not the file itself, so Edit and Write cannot change the document.${notes}]`;
|
|
80
|
+
const ignored = pdfOnlyArgumentsIgnored(options, 'a Word document');
|
|
81
|
+
const header = `[${LABEL[document.kind]} ${shownPath} (${size}): its text follows. This is extracted text, not the file itself, so Edit and Write cannot change the document.${notes}]${ignored && `\n${ignored}`}`;
|
|
81
82
|
return pageOfLines(header, document.text.split('\n'), options, 'the extracted text');
|
|
82
83
|
}
|
|
83
84
|
const pages = document.pages ?? [];
|
|
@@ -124,9 +125,8 @@ export async function readDocumentObservation(context, shownPath, bytes, options
|
|
|
124
125
|
return pageOfLines(header, lines, options, 'the extracted text');
|
|
125
126
|
}
|
|
126
127
|
export function legacyTextObservation(shownPath, decoded, options) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
const header = `[${shownPath} is not UTF-8; it is shown decoded as ${decoded.encoding}. Edit and Write cannot change it in this encoding: convert it to UTF-8 with a script first if it has to be edited.]`;
|
|
128
|
+
const ignored = pdfOnlyArgumentsIgnored(options, 'a text file');
|
|
129
|
+
const header = `[${shownPath} is not UTF-8; it is shown decoded as ${decoded.encoding}. Edit and Write cannot change it in this encoding: convert it to UTF-8 with a script first if it has to be edited.]${ignored && `\n${ignored}`}`;
|
|
130
130
|
const lines = decoded.text.replace(/\r\n?/g, '\n').split('\n');
|
|
131
131
|
return pageOfLines(header, lines, options, 'the file');
|
|
132
132
|
}
|
|
@@ -30,7 +30,7 @@ const PRIMARY_METHODS = new Set([
|
|
|
30
30
|
'sessions.changes.list', 'sessions.changes.get', 'sessions.changes.keep', 'sessions.changes.undo',
|
|
31
31
|
'runs.list', 'runs.get', 'timers.list',
|
|
32
32
|
'workspace.tree', 'workspace.read', 'workspace.git', 'workspace.branches', 'workspace.checkout', 'workspace.diff',
|
|
33
|
-
'graphs.list', 'graphs.get', 'graphs.select',
|
|
33
|
+
'graphs.list', 'graphs.get', 'graphs.select', 'graphs.visibility.set', 'graphs.visibility.import',
|
|
34
34
|
'attachments.read',
|
|
35
35
|
'config.get', 'projects.list', 'projects.add', 'projects.remove', 'projects.relink',
|
|
36
36
|
'extensions.list', 'project.extensions',
|
|
@@ -52,6 +52,7 @@ const SESSION_MUTATION_METHODS = new Set(['sessions.rename', 'sessions.setJev',
|
|
|
52
52
|
const MUTATING_METHODS = new Set([
|
|
53
53
|
...RUN_START_METHODS, ...RUN_TARGET_METHODS, ...SESSION_MUTATION_METHODS, 'sessions.skill.update', 'sessions.changes.keep', 'sessions.changes.undo',
|
|
54
54
|
'terminal.open', 'terminal.write', 'terminal.close', 'terminal.closeAll', 'workspace.checkout', 'projects.add', 'projects.remove', 'projects.relink',
|
|
55
|
+
'graphs.visibility.set', 'graphs.visibility.import',
|
|
55
56
|
'browser.runtime.install', 'browser.view.open', 'browser.view.navigate', 'browser.view.go', 'browser.view.activate',
|
|
56
57
|
'browser.view.closeTab', 'browser.view.show', 'browser.view.hide', 'browser.view.stream', 'browser.view.input', 'browser.cookies.import',
|
|
57
58
|
'browser.panel.op', 'browser.panel.cancel',
|
|
@@ -485,10 +486,17 @@ export class RemoteEngineRelay {
|
|
|
485
486
|
}
|
|
486
487
|
async translateParams(viewerWorkspaceId, params) {
|
|
487
488
|
const workspaces = Array.isArray(params.workspaces) ? params.workspaces : undefined;
|
|
489
|
+
// Graph visibility names projects: a list in graphs.visibility.set, lists per graph in graphs.visibility.import.
|
|
490
|
+
const projects = Array.isArray(params.projects) ? params.projects : undefined;
|
|
491
|
+
const visibility = params.visibility && typeof params.visibility === 'object' && !Array.isArray(params.visibility)
|
|
492
|
+
? params.visibility : undefined;
|
|
493
|
+
const spelledList = (list) => Array.isArray(list) && list.some(value => typeof value === 'string' && isRemoteProjectSpelling(value));
|
|
488
494
|
const needs = (typeof params.workspace === 'string' && isRemoteProjectSpelling(params.workspace))
|
|
489
495
|
|| (typeof params.cwd === 'string' && isRemoteProjectSpelling(params.cwd))
|
|
490
496
|
|| (typeof params.path === 'string' && isRemoteProjectSpelling(params.path))
|
|
491
|
-
|| (workspaces !== undefined && workspaces
|
|
497
|
+
|| (workspaces !== undefined && spelledList(workspaces))
|
|
498
|
+
|| (projects !== undefined && spelledList(projects))
|
|
499
|
+
|| (visibility !== undefined && Object.values(visibility).some(spelledList));
|
|
492
500
|
if (!needs)
|
|
493
501
|
return params;
|
|
494
502
|
const translation = await this.translation(viewerWorkspaceId);
|
|
@@ -511,6 +519,22 @@ export class RemoteEngineRelay {
|
|
|
511
519
|
}
|
|
512
520
|
});
|
|
513
521
|
}
|
|
522
|
+
// A visibility list is stored on this host, so it keeps host paths only. A viewer spelling this host cannot place
|
|
523
|
+
// names no folder it shares and could never match here; it is left out rather than saved as a viewer's ID.
|
|
524
|
+
const hostPaths = (list) => !Array.isArray(list) ? list : list.flatMap(value => {
|
|
525
|
+
if (typeof value !== 'string' || !isRemoteProjectSpelling(value))
|
|
526
|
+
return [value];
|
|
527
|
+
try {
|
|
528
|
+
return [translation.toHost(value)];
|
|
529
|
+
}
|
|
530
|
+
catch {
|
|
531
|
+
return [];
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
if (projects !== undefined)
|
|
535
|
+
next.projects = hostPaths(projects);
|
|
536
|
+
if (visibility !== undefined)
|
|
537
|
+
next.visibility = Object.fromEntries(Object.entries(visibility).map(([graph, list]) => [graph, hostPaths(list)]));
|
|
514
538
|
return next;
|
|
515
539
|
}
|
|
516
540
|
async restoreRequestedEcho(answer, original, viewerWorkspaceId) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runtimeEnvironmentNote(platform?: NodeJS.Platform, arch?: string, release?: string): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
// One line in the system message naming the host the tools run on, so the model picks commands
|
|
3
|
+
// for this operating system instead of guessing (a run on Linux once reached for powershell).
|
|
4
|
+
// It stays constant for the life of the process, so it does not disturb prompt caching.
|
|
5
|
+
export function runtimeEnvironmentNote(platform = process.platform, arch = process.arch, release = os.release()) {
|
|
6
|
+
if (platform === 'win32') {
|
|
7
|
+
return `Environment: the tools run on Windows (${arch}). The shell tool runs PowerShell; use PowerShell syntax and Windows paths.`;
|
|
8
|
+
}
|
|
9
|
+
const system = platform === 'darwin' ? 'macOS' : platform === 'linux' ? 'Linux' : platform;
|
|
10
|
+
const detail = platform === 'linux' && /microsoft|wsl/i.test(release) ? `WSL, ${arch}` : arch;
|
|
11
|
+
const userland = platform === 'darwin' ? ' with the BSD userland' : '';
|
|
12
|
+
return `Environment: the tools run on ${system} (${detail}). The shell tool runs Bash${userland}; use POSIX commands and paths. PowerShell and cmd.exe are not available.`;
|
|
13
|
+
}
|
package/dist/src/save-lock.js
CHANGED
|
@@ -146,13 +146,20 @@ export async function acquireSaveLock(folder, options = {}) {
|
|
|
146
146
|
}
|
|
147
147
|
export async function removeLockedFolder(folder, onDetached) {
|
|
148
148
|
const detached = join(dirname(folder), `.removing-${basename(folder)}-${randomUUID()}`);
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
149
|
+
// Windows refuses to rename a folder while any file in it is open, and a sync pass opens them briefly.
|
|
150
|
+
for (let attempt = 0;; attempt++) {
|
|
151
|
+
try {
|
|
152
|
+
await rename(folder, detached);
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
const code = error.code;
|
|
157
|
+
if (code === 'ENOENT')
|
|
158
|
+
return;
|
|
159
|
+
if (attempt >= 4 || !['EPERM', 'EACCES', 'EBUSY'].includes(code ?? ''))
|
|
160
|
+
throw error;
|
|
161
|
+
await new Promise(resolve => setTimeout(resolve, 25 * (attempt + 1)));
|
|
162
|
+
}
|
|
156
163
|
}
|
|
157
164
|
try {
|
|
158
165
|
await onDetached?.();
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export type TabState = 'idle' | 'working' | 'input';
|
|
2
|
+
/** The working spinner: the terminal title while a run works, and the TUI's inline loading rows. */
|
|
3
|
+
export declare const WORKING_SPINNER_FRAMES: string[];
|
|
4
|
+
export declare const WORKING_SPINNER_TICK_MS = 125;
|
|
2
5
|
export declare class SessionTitle {
|
|
3
6
|
private readonly output;
|
|
4
7
|
private name;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from 'node:util';
|
|
2
|
-
|
|
2
|
+
/** The working spinner: the terminal title while a run works, and the TUI's inline loading rows. */
|
|
3
|
+
export const WORKING_SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
4
|
+
export const WORKING_SPINNER_TICK_MS = 125;
|
|
5
|
+
const workingFrames = WORKING_SPINNER_FRAMES;
|
|
3
6
|
export class SessionTitle {
|
|
4
7
|
output;
|
|
5
8
|
name = '';
|
|
@@ -31,7 +34,7 @@ export class SessionTitle {
|
|
|
31
34
|
}
|
|
32
35
|
this.render();
|
|
33
36
|
if (state !== 'idle') {
|
|
34
|
-
this.timer = setInterval(() => { this.frame++; this.render(); }, state === 'input' ? 500 :
|
|
37
|
+
this.timer = setInterval(() => { this.frame++; this.render(); }, state === 'input' ? 500 : WORKING_SPINNER_TICK_MS);
|
|
35
38
|
this.timer.unref?.();
|
|
36
39
|
}
|
|
37
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from './config.js';
|
|
2
2
|
import type { ProviderConfig } from './providers.js';
|
|
3
|
-
export declare const DETECTABLE_SIGN_IN_TYPES: readonly ["claude", "codex", "grok", "opencode"];
|
|
3
|
+
export declare const DETECTABLE_SIGN_IN_TYPES: readonly ["claude", "codex", "grok", "opencode", "google"];
|
|
4
4
|
export type DetectableSignInType = typeof DETECTABLE_SIGN_IN_TYPES[number];
|
|
5
5
|
export declare function isDetectableSignInType(value: unknown): value is DetectableSignInType;
|
|
6
6
|
export interface DetectedSignIn {
|
|
@@ -4,19 +4,20 @@ import { resolveCliExecutable } from './cli-executable.js';
|
|
|
4
4
|
import { readCodexModels } from './codex-auth.js';
|
|
5
5
|
import { resolveCodexExecutable } from './codex-executable.js';
|
|
6
6
|
import { connectCodex } from './codex-rpc.js';
|
|
7
|
+
import { GOOGLE_BASE_URL, GOOGLE_EXECUTABLE, readGoogleCatalog } from './google-provider.js';
|
|
7
8
|
import { GROK_BASE_URL, GROK_EXECUTABLE, readGrokCatalog } from './grok-provider.js';
|
|
8
9
|
import { OPENCODE_BASE_URL, OPENCODE_EXECUTABLE, readOpenCodeCatalog, sharedOpenCodeServer } from './opencode-cli-provider.js';
|
|
9
10
|
import { uniqueProviderId } from './provider-import.js';
|
|
10
|
-
export const DETECTABLE_SIGN_IN_TYPES = ['claude', 'codex', 'grok', 'opencode'];
|
|
11
|
+
export const DETECTABLE_SIGN_IN_TYPES = ['claude', 'codex', 'grok', 'opencode', 'google'];
|
|
11
12
|
export function isDetectableSignInType(value) {
|
|
12
13
|
return DETECTABLE_SIGN_IN_TYPES.includes(value);
|
|
13
14
|
}
|
|
14
15
|
const SIGNED_OUT = { signedIn: false, models: [] };
|
|
15
16
|
const MAX_MODELS = 5000;
|
|
16
17
|
const FIXED_BASE_URL = {
|
|
17
|
-
claude: 'https://api.anthropic.com', codex: 'https://chatgpt.com/backend-api/codex', grok: GROK_BASE_URL, opencode: OPENCODE_BASE_URL,
|
|
18
|
+
claude: 'https://api.anthropic.com', codex: 'https://chatgpt.com/backend-api/codex', grok: GROK_BASE_URL, opencode: OPENCODE_BASE_URL, google: GOOGLE_BASE_URL,
|
|
18
19
|
};
|
|
19
|
-
const DISPLAY_NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode' };
|
|
20
|
+
const DISPLAY_NAME = { claude: 'Claude', codex: 'ChatGPT', grok: 'Grok', opencode: 'OpenCode', google: 'Google' };
|
|
20
21
|
export function defaultSignInProbes() {
|
|
21
22
|
const present = async (resolve) => { try {
|
|
22
23
|
await resolve();
|
|
@@ -59,6 +60,12 @@ export function defaultSignInProbes() {
|
|
|
59
60
|
const catalog = await readGrokCatalog(signal);
|
|
60
61
|
return { signedIn: catalog.signedIn, models: catalog.models, ...(catalog.email ? { email: catalog.email } : {}) };
|
|
61
62
|
},
|
|
63
|
+
google: async (signal) => {
|
|
64
|
+
if (!await present(() => resolveCliExecutable(GOOGLE_EXECUTABLE)))
|
|
65
|
+
return SIGNED_OUT;
|
|
66
|
+
const catalog = await readGoogleCatalog(signal);
|
|
67
|
+
return { signedIn: catalog.signedIn, models: catalog.models };
|
|
68
|
+
},
|
|
62
69
|
opencode: async (signal) => {
|
|
63
70
|
if (!await present(() => resolveCliExecutable(OPENCODE_EXECUTABLE)))
|
|
64
71
|
return SIGNED_OUT;
|