@andorra-labs/code 0.1.13 → 0.1.14
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/agent-execution.js +300 -140
- package/dist/src/agent-mcp.js +2 -2
- 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 +100 -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 +52 -0
- package/dist/src/andorra/hosted.js +126 -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 +7 -0
- package/dist/src/andorra/notices.js +15 -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 +68 -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 +6 -2
- package/dist/src/app-server/protocol.js +1 -1
- package/dist/src/app-server.d.ts +27 -0
- package/dist/src/app-server.js +292 -85
- package/dist/src/auth/AuthManager.d.ts +9 -0
- package/dist/src/auth/AuthManager.js +161 -21
- 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-runner.js +1 -1
- 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 +65 -0
- package/dist/src/browser-view.js +229 -16
- package/dist/src/cli.js +43 -26
- package/dist/src/command-screens.d.ts +17 -1
- package/dist/src/command-screens.js +192 -21
- package/dist/src/commands.d.ts +7 -1
- package/dist/src/commands.js +78 -27
- package/dist/src/config.d.ts +6 -1
- package/dist/src/config.js +86 -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/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 +159 -5
- package/dist/src/graph-runner.js +27 -0
- package/dist/src/graph-selection.js +2 -1
- package/dist/src/graph-ui/app.js +25 -2
- 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/graphs.js +1 -3
- package/dist/src/hardened-runtime.js +1 -1
- package/dist/src/membership-errors.js +1 -1
- package/dist/src/membership.d.ts +10 -2
- package/dist/src/membership.js +20 -6
- 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 +40 -3
- 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 +15 -0
- package/dist/src/provider-settings.d.ts +16 -1
- package/dist/src/provider-settings.js +36 -20
- package/dist/src/providers.d.ts +14 -2
- package/dist/src/providers.js +69 -11
- package/dist/src/react-runtime.js +12 -7
- package/dist/src/remote/engine-pool.js +5 -4
- package/dist/src/run-control.d.ts +2 -2
- package/dist/src/run-control.js +9 -6
- package/dist/src/runtime.d.ts +2 -0
- package/dist/src/runtime.js +2 -1
- package/dist/src/sessions.d.ts +1 -0
- package/dist/src/sessions.js +4 -2
- package/dist/src/skills/bundled/graph-manager/errors.md +1 -1
- package/dist/src/skills/bundled/provenance.json +738 -738
- 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/terminal-ui.d.ts +21 -0
- package/dist/src/terminal-ui.js +73 -10
- package/dist/src/transcript.js +3 -0
- package/dist/src/types.d.ts +3 -0
- package/dist/src/workspace-instructions.js +1 -1
- package/package.json +12 -1
|
@@ -7,12 +7,16 @@ import { importProvidersFromRemote } from './provider-import.js';
|
|
|
7
7
|
import { DEFAULT_GRAPH, listGraphs, withoutDeletedGraphs } from './graphs.js';
|
|
8
8
|
import { graphStorageDirectory } from './graph-account.js';
|
|
9
9
|
import { configuredGraphSelection, currentGraphSubject, saveGraphSelection } from './graph-selection.js';
|
|
10
|
-
import { getMembership, loadAccessibleGraph, requireGraphMembership
|
|
10
|
+
import { getMembership, loadAccessibleGraph, requireGraphMembership } from './membership.js';
|
|
11
11
|
import { FREE_CUSTOM_GRAPH_LIMIT, FREE_GRAPH_LIMIT_MESSAGE, readGraphQuota } from './graph-quota.js';
|
|
12
12
|
import { GraphProviderUnavailableError } from './graph-provider-portability.js';
|
|
13
13
|
import { confirmAndApplyModelOverride } from './model-override.js';
|
|
14
|
+
import { andorraRefusal } from './commands.js';
|
|
15
|
+
import { ANDORRA_REMOVE_FAILED, removingAndorraEntry } from './andorra/state.js';
|
|
16
|
+
import { cleanModelName } from './andorra/entry.js';
|
|
17
|
+
import { ANDORRA_MODEL_GONE } from './andorra/notices.js';
|
|
14
18
|
import { reconcileSubagentPair } from './config.js';
|
|
15
|
-
import { applyModelContextWindow, createAdapter, providerLabel, providerModels, recordProviderModel } from './providers.js';
|
|
19
|
+
import { applyModelContextWindow, createAdapter, modelDisplayName, providerLabel, providerModels, recordProviderModel } from './providers.js';
|
|
16
20
|
import { configDirectory } from './config.js';
|
|
17
21
|
import { listBundles, installBundle, removeBundle, removeBundleTransactional, setBundleEnabled, validateMcpServer } from './extensions.js';
|
|
18
22
|
import { join } from 'node:path';
|
|
@@ -34,8 +38,11 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
34
38
|
signal.throwIfAborted();
|
|
35
39
|
const previousProviders = [...state.config.providers];
|
|
36
40
|
const reconciled = reconcileSubagentPair(draft);
|
|
41
|
+
// Removing Andorra: the decision is recorded before the config without the entry is saved (and put back when
|
|
42
|
+
// the save fails), so a check in another process can never create the entry again in between.
|
|
43
|
+
const removesAndorra = previousProviders.some(item => item.type === 'andorra' && !reconciled.providers.some(next => next.id === item.id && next.type === 'andorra'));
|
|
37
44
|
try {
|
|
38
|
-
await persist(reconciled);
|
|
45
|
+
await (removesAndorra ? removingAndorraEntry(configDirectory(), () => persist(reconciled)) : persist(reconciled));
|
|
39
46
|
}
|
|
40
47
|
catch {
|
|
41
48
|
await retireUnsavedCodexAccounts(reconciled.providers, state.config.providers, { signal });
|
|
@@ -48,6 +55,8 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
48
55
|
return unchanged;
|
|
49
56
|
}
|
|
50
57
|
Object.assign(state.config, reconciled);
|
|
58
|
+
if (removesAndorra)
|
|
59
|
+
await state.andorra?.entryChanged?.();
|
|
51
60
|
await retireRemovedCodexAccounts(previousProviders, reconciled.providers, { signal }).catch(() => { });
|
|
52
61
|
await retireAnthropicAccounts(droppedAnthropicAccounts(previousProviders, reconciled.providers)).catch(() => { });
|
|
53
62
|
if (reconciled.externalSubagent === undefined)
|
|
@@ -71,7 +80,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
71
80
|
const providerPicked = await ui.select('External subagent provider', [
|
|
72
81
|
...state.config.providers.map(item => {
|
|
73
82
|
const models = providerModels(item);
|
|
74
|
-
return { id: item.id, label: `${providerLabel(item, state.config.providers)} (${item.type})`, description: `Models: ${models.slice(0, 4).join(', ')}${models.length > 4 ? '…' : ''}`, ...(current?.provider === item.id ? { bold: true } : {}) };
|
|
83
|
+
return { id: item.id, label: `${providerLabel(item, state.config.providers)} (${item.type})`, description: `Models: ${models.slice(0, 4).map(model => modelDisplayName(item, model)).join(', ')}${models.length > 4 ? '…' : ''}`, ...(current?.provider === item.id ? { bold: true } : {}) };
|
|
75
84
|
}),
|
|
76
85
|
...(current === undefined ? [] : [{ id: CLEAR_SUBAGENT_SELECTION, label: 'Clear the setting', description: 'External hosts will be asked to pick a provider/model on every run.', separator: true }]),
|
|
77
86
|
], { ...(current ? { selectedId: current.provider } : {}), description: 'The provider and model external hosts (Claude CLI, Codex CLI) must use to run Andorra as a subagent. Mandatory: without a saved pair they receive PROVIDER_NOT_SET.', signal });
|
|
@@ -118,7 +127,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
118
127
|
return unchanged;
|
|
119
128
|
}
|
|
120
129
|
const modelPicked = await ui.select('External subagent model', available.map(id => ({
|
|
121
|
-
id, label: configured.includes(id) && !discovered.includes(id) ? `${id} (configured)` : id,
|
|
130
|
+
id, label: configured.includes(id) && !discovered.includes(id) ? `${modelDisplayName(target, id)} (configured)` : modelDisplayName(target, id),
|
|
122
131
|
...(current?.provider === target.id && current.model === id ? { bold: true } : {}),
|
|
123
132
|
})), { selectedId: current?.provider === target.id ? current.model : target.model, description: `Provider: ${providerLabel(target, state.config.providers)}`, signal });
|
|
124
133
|
if (modelPicked === undefined || signal.aborted)
|
|
@@ -160,6 +169,11 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
160
169
|
const target = state.config.providers.find(item => item.id === picked.provider);
|
|
161
170
|
if (!target)
|
|
162
171
|
throw new Error('Invalid model selection');
|
|
172
|
+
const refusal = andorraRefusal(state, target.id);
|
|
173
|
+
if (refusal) {
|
|
174
|
+
await ui.showScreen('Andorra', [refusal], { signal });
|
|
175
|
+
return unchanged;
|
|
176
|
+
}
|
|
163
177
|
const selected = picked.model;
|
|
164
178
|
let overrideApplied = false;
|
|
165
179
|
if (state.graph) {
|
|
@@ -171,7 +185,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
171
185
|
resolveDirectory: async () => graphStorageDirectory(undefined, await graphSubject()),
|
|
172
186
|
confirm: async (question) => {
|
|
173
187
|
const choice = await ui.select('Override graph models?', [
|
|
174
|
-
{ id: 'override', label: `Override every node with ${target.id}/${selected}`, description: 'Saves the graph; every node and delegation follows this model.' },
|
|
188
|
+
{ id: 'override', label: `Override every node with ${target.id}/${modelDisplayName(target, selected)}`, description: 'Saves the graph; every node and delegation follows this model.' },
|
|
175
189
|
{ id: 'keep', label: 'Keep the models selected in the graph', description: 'Cancels this model change; nothing is saved.' },
|
|
176
190
|
], { description: question, signal });
|
|
177
191
|
return choice === 'override';
|
|
@@ -201,14 +215,62 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
201
215
|
return await save(draft);
|
|
202
216
|
}
|
|
203
217
|
if (command === '/providers') {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
218
|
+
if (!await waitForAndorraCheck(state, ui, signal))
|
|
219
|
+
return unchanged;
|
|
220
|
+
// Saves Andorra because the user chose it; a refusal is shown as its plain sentence. Returns the saved entry's id.
|
|
221
|
+
const addAndorra = async () => {
|
|
222
|
+
const added = await state.andorra?.add?.();
|
|
223
|
+
if (added && !added.added && added.message && !signal.aborted)
|
|
224
|
+
await ui.showScreen('Andorra', [added.message], { signal });
|
|
225
|
+
return added?.added ? added.id ?? state.config.providers.find(item => item.type === 'andorra')?.id : undefined;
|
|
226
|
+
};
|
|
227
|
+
// The rows as the monitor's latest answer has them. They are built again each time the list is drawn, and
|
|
228
|
+
// again in place when a check answers while the list is open (the on-open check runs in the background when
|
|
229
|
+
// there is no Andorra entry, so its answer usually arrives after the list is on screen).
|
|
230
|
+
const rows = () => {
|
|
231
|
+
// Listed by default: while Andorra is offered and the user has not removed it, it is a row like any other
|
|
232
|
+
// provider, first, with its models as the description. It is saved the first time it is chosen.
|
|
233
|
+
const listed = state.andorra?.add ? state.andorra.listed?.() : undefined;
|
|
234
|
+
return [
|
|
235
|
+
...(listed ? [{ id: LISTED_ANDORRA, label: providerLabel(listed, [listed, ...state.config.providers]), description: providerModels(listed).map(model => modelDisplayName(listed, model)).join(', ') }] : []),
|
|
236
|
+
...state.config.providers.map(item => {
|
|
237
|
+
const refusal = andorraRefusal(state, item.id);
|
|
238
|
+
return { id: item.id, label: providerLabel(item, state.config.providers), ...(refusal ? { description: refusal } : {}) };
|
|
239
|
+
}),
|
|
207
240
|
{ id: ':add', label: '+ Add provider' },
|
|
208
241
|
{ id: ':import', label: 'Import from remote connection' },
|
|
209
|
-
]
|
|
242
|
+
];
|
|
243
|
+
};
|
|
244
|
+
while (!signal.aborted) {
|
|
245
|
+
const selected = await ui.select('Providers', rows(), { selectedId: state.config.provider, editPrefix: ':edit:', footer: 'Up/Down Move | Enter Select | Right/e Edit | Esc Back', signal,
|
|
246
|
+
...andorraRefresh(state, rows) });
|
|
210
247
|
if (selected === undefined || signal.aborted)
|
|
211
248
|
return unchanged;
|
|
249
|
+
if (selected === `:edit:${LISTED_ANDORRA}`) {
|
|
250
|
+
// Nothing of a listed, never-saved Andorra can be edited; it can be used, or taken off the list.
|
|
251
|
+
const action = await ui.select('Andorra', [
|
|
252
|
+
{ id: 'use', label: 'Use Andorra', description: 'Saves it to your providers and selects it.' },
|
|
253
|
+
{ id: 'remove', label: 'Remove from this list', description: 'It can be added again from + Add provider while it is offered.' },
|
|
254
|
+
{ id: 'back', label: 'Back' },
|
|
255
|
+
], { selectedId: 'back', signal });
|
|
256
|
+
if (action === 'remove') {
|
|
257
|
+
// Not recorded: it would come back at the next start, so say that nothing was removed.
|
|
258
|
+
if (await state.andorra?.hide?.() === false && !signal.aborted)
|
|
259
|
+
await ui.showScreen('Andorra', [ANDORRA_REMOVE_FAILED], { signal });
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (action !== 'use')
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (selected === LISTED_ANDORRA || selected === `:edit:${LISTED_ANDORRA}`) {
|
|
266
|
+
// The user's own choice: save the entry, then select it as any provider is selected.
|
|
267
|
+
const id = await addAndorra();
|
|
268
|
+
if (id === undefined || signal.aborted)
|
|
269
|
+
continue;
|
|
270
|
+
const draft = structuredClone(state.config);
|
|
271
|
+
draft.provider = id;
|
|
272
|
+
return await save(draft);
|
|
273
|
+
}
|
|
212
274
|
if (selected === ':import') {
|
|
213
275
|
const draft = await importProvidersFromRemote(state.config, ui, signal);
|
|
214
276
|
if (draft)
|
|
@@ -219,7 +281,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
219
281
|
const id = selected === ':add' ? undefined : selected.slice(6);
|
|
220
282
|
if (id && !state.config.providers.some(item => item.id === id))
|
|
221
283
|
throw new Error('Invalid provider selection');
|
|
222
|
-
const draft = await editProviderSettings(state.config, id, ui, signal);
|
|
284
|
+
const draft = await editProviderSettings(state.config, id, ui, signal, undefined, undefined, undefined, undefined, id === undefined && state.andorra?.add ? { description: () => andorraOffer(state), add: async () => { await addAndorra(); }, refresh: rows => andorraRefresh(state, rows).refresh } : undefined);
|
|
223
285
|
if (draft)
|
|
224
286
|
return await save(draft);
|
|
225
287
|
continue;
|
|
@@ -228,6 +290,11 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
228
290
|
return unchanged;
|
|
229
291
|
if (!state.config.providers.some(item => item.id === selected))
|
|
230
292
|
throw new Error('Invalid provider selection');
|
|
293
|
+
const refusal = andorraRefusal(state, selected);
|
|
294
|
+
if (refusal) {
|
|
295
|
+
await ui.showScreen('Andorra', [refusal], { signal });
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
231
298
|
const draft = structuredClone(state.config);
|
|
232
299
|
draft.provider = selected;
|
|
233
300
|
return await save(draft);
|
|
@@ -248,7 +315,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
248
315
|
id: DEFAULT_GRAPH.id,
|
|
249
316
|
label: 'Default',
|
|
250
317
|
description: 'Andorra Agent only. Reads project instructions and completes the task without an Orchestrator.',
|
|
251
|
-
},
|
|
318
|
+
}, ...withoutDeletedGraphs(saved).filter(graph => graph.id !== 'default').map(graph => ({ id: graph.id, label: `${graph.name} (${graph.id}@${graph.revision})`, description: 'Saved custom graph' })), { id: ':divider', label: '', separator: true }, { id: ':create', label: 'Create new graph', description: atLimit ? 'Free tier includes 1 custom graph. Upgrade to Premium for more graphs.' : 'Open the web graph builder' }, { id: ':edit', label: 'Edit Graphs', bold: true, description: 'Open saved graphs in the web graph builder' }];
|
|
252
319
|
while (!signal.aborted) {
|
|
253
320
|
const selected = await ui.select('Graph', items, { selectedId: state.graph ?? DEFAULT_GRAPH.id, description: 'Choose and save your default graph for this account, or create one in the web builder. After saving, reopen /graph to select it.', signal });
|
|
254
321
|
if (selected === undefined || signal.aborted)
|
|
@@ -266,8 +333,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
266
333
|
const changed = selected !== (state.graph ?? 'default');
|
|
267
334
|
if (changed) {
|
|
268
335
|
const name = selected === 'default' ? DEFAULT_GRAPH.name
|
|
269
|
-
:
|
|
270
|
-
: saved.find(graph => graph.id === selected).name;
|
|
336
|
+
: saved.find(graph => graph.id === selected).name;
|
|
271
337
|
const confirmation = await ui.select(`Switch to ${name}?`, [
|
|
272
338
|
{ id: 'switch', label: `Switch to ${name}`, description: 'Use this graph for subsequent tasks and start fresh.' },
|
|
273
339
|
{ id: 'back', label: 'Keep current graph', description: 'Return to the graph list. Nothing changes.' },
|
|
@@ -282,7 +348,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
282
348
|
}
|
|
283
349
|
let unavailable;
|
|
284
350
|
if (selected !== 'default') {
|
|
285
|
-
if (
|
|
351
|
+
if (!saved.some(graph => graph.id === selected))
|
|
286
352
|
throw new Error('Invalid graph selection');
|
|
287
353
|
try {
|
|
288
354
|
await graphAccess.load(selected, signal);
|
|
@@ -535,13 +601,75 @@ function parseModelTreeId(id) {
|
|
|
535
601
|
catch { /* not a tree id */ }
|
|
536
602
|
return undefined;
|
|
537
603
|
}
|
|
604
|
+
/** The row of a listed, not yet saved Andorra. Not a provider id (ids have no colon). */
|
|
605
|
+
const LISTED_ANDORRA = ':andorra';
|
|
606
|
+
/** The hosted model names while Andorra can be added (offered to this account, no entry yet); undefined otherwise. */
|
|
607
|
+
function andorraOffer(state) {
|
|
608
|
+
if (!state.andorra?.add || state.config.providers.some(item => item.type === 'andorra'))
|
|
609
|
+
return undefined;
|
|
610
|
+
const models = state.andorra.offer?.();
|
|
611
|
+
return models?.length ? models.map(model => cleanModelName(model.name) ?? model.id).join(', ') : undefined;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* The `refresh` option for a select whose rows depend on Andorra's state: while the select is open, every settled
|
|
615
|
+
* check (and an added or removed entry) builds the rows again, and the select is redrawn in place only when they
|
|
616
|
+
* differ from what is on screen. Empty when the client has no monitor to listen to.
|
|
617
|
+
*/
|
|
618
|
+
export function andorraRefresh(state, rows) {
|
|
619
|
+
const subscribe = state.andorra?.subscribe;
|
|
620
|
+
if (!subscribe)
|
|
621
|
+
return {};
|
|
622
|
+
return {
|
|
623
|
+
refresh: redraw => {
|
|
624
|
+
let drawn = JSON.stringify(rows());
|
|
625
|
+
return subscribe(() => {
|
|
626
|
+
const next = rows();
|
|
627
|
+
const text = JSON.stringify(next);
|
|
628
|
+
if (text === drawn)
|
|
629
|
+
return;
|
|
630
|
+
drawn = text;
|
|
631
|
+
redraw(next);
|
|
632
|
+
});
|
|
633
|
+
},
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* Runs the on-open Andorra check. With an Andorra entry in the list it runs behind a loading screen, because the
|
|
638
|
+
* answer decides how that row is drawn; `state.andorra.opened()` bounds the wait. Without one the list is drawn
|
|
639
|
+
* at once and the check runs in the background. False when the screen was cancelled (Esc on the loading screen
|
|
640
|
+
* or the screen's signal aborted).
|
|
641
|
+
*/
|
|
642
|
+
async function waitForAndorraCheck(state, ui, signal) {
|
|
643
|
+
const andorra = state.andorra;
|
|
644
|
+
if (!andorra)
|
|
645
|
+
return true;
|
|
646
|
+
if (!state.config.providers.some(item => item.type === 'andorra')) {
|
|
647
|
+
void andorra.opened().catch(() => { });
|
|
648
|
+
return !signal.aborted;
|
|
649
|
+
}
|
|
650
|
+
const done = await ui.loadScreen('Andorra', loadSignal => new Promise(resolve => {
|
|
651
|
+
const finish = () => resolve(true);
|
|
652
|
+
if (loadSignal.aborted)
|
|
653
|
+
return finish();
|
|
654
|
+
loadSignal.addEventListener('abort', finish, { once: true });
|
|
655
|
+
andorra.opened().catch(() => { }).then(() => { loadSignal.removeEventListener('abort', finish); finish(); });
|
|
656
|
+
}), { description: 'Checking Andorra availability', signal });
|
|
657
|
+
return done === true && !signal.aborted;
|
|
658
|
+
}
|
|
538
659
|
/**
|
|
539
660
|
* The /model screen: every configured provider as a collapsed row ending in `>`, with its models
|
|
540
661
|
* indented beneath once expanded (Right Arrow or Enter expands, Left Arrow collapses). A provider's
|
|
541
662
|
* models load the first time it opens; when discovery fails its configured models are shown instead.
|
|
542
663
|
*/
|
|
543
664
|
export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
544
|
-
|
|
665
|
+
if (!await waitForAndorraCheck(state, ui, signal))
|
|
666
|
+
return undefined;
|
|
667
|
+
// A listed, not yet saved Andorra is shown first, like a saved provider. Its models come from the hosted answer:
|
|
668
|
+
// no request is ever sent on its behalf before the user picks it.
|
|
669
|
+
const listedNow = () => state.andorra?.add ? state.andorra.listed?.() : undefined;
|
|
670
|
+
let listed = listedNow();
|
|
671
|
+
let listedId = listed?.id;
|
|
672
|
+
let providers = listed ? [listed, ...state.config.providers] : state.config.providers;
|
|
545
673
|
const active = providers.find(item => item.id === state.config.provider);
|
|
546
674
|
const expanded = new Set();
|
|
547
675
|
const loaded = new Map();
|
|
@@ -549,6 +677,10 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
549
677
|
const load = async (provider) => {
|
|
550
678
|
if (loaded.has(provider.id))
|
|
551
679
|
return true;
|
|
680
|
+
if (provider === listed) {
|
|
681
|
+
loaded.set(provider.id, { models: providerModels(provider), configured: new Set() });
|
|
682
|
+
return true;
|
|
683
|
+
}
|
|
552
684
|
let discovered = [];
|
|
553
685
|
let note;
|
|
554
686
|
try {
|
|
@@ -573,16 +705,25 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
573
705
|
loaded.set(provider.id, { models: [...discovered, ...configured], configured: new Set(configured), ...(note ? { note } : {}) });
|
|
574
706
|
return true;
|
|
575
707
|
};
|
|
576
|
-
|
|
708
|
+
const rows = () => {
|
|
709
|
+
// Rebuilt each time the tree is drawn, and in place when a check answers while it is open.
|
|
710
|
+
listed = listedNow();
|
|
711
|
+
if (listed !== undefined) {
|
|
712
|
+
listedId = listed.id;
|
|
713
|
+
if (expanded.has(listed.id))
|
|
714
|
+
loaded.set(listed.id, { models: providerModels(listed), configured: new Set() });
|
|
715
|
+
}
|
|
716
|
+
providers = listed ? [listed, ...state.config.providers] : state.config.providers;
|
|
577
717
|
const items = [];
|
|
578
718
|
for (const provider of providers) {
|
|
579
719
|
const open = expanded.has(provider.id);
|
|
580
720
|
const isActive = provider.id === active?.id;
|
|
581
721
|
const entry = loaded.get(provider.id);
|
|
722
|
+
const refusal = andorraRefusal(state, provider.id);
|
|
582
723
|
items.push({
|
|
583
724
|
id: modelTreeId({ provider: provider.id }),
|
|
584
725
|
label: `${providerLabel(provider, providers)}${isActive ? ' (current)' : ''} ${open ? 'v' : '>'}`,
|
|
585
|
-
...(open && entry?.note ? { description: entry.note } : {}),
|
|
726
|
+
...(refusal ? { description: refusal } : open && entry?.note ? { description: entry.note } : {}),
|
|
586
727
|
...(isActive ? { bold: true } : {}),
|
|
587
728
|
});
|
|
588
729
|
if (!open || !entry)
|
|
@@ -590,21 +731,28 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
590
731
|
if (!entry.models.length)
|
|
591
732
|
items.push({ id: modelTreeId({ provider: provider.id, model: '' }), label: ' No models available' });
|
|
592
733
|
for (const model of entry.models)
|
|
593
|
-
items.push({ id: modelTreeId({ provider: provider.id, model }), label: ` ${model}${entry.configured.has(model) ? " (configured)" : ""}` });
|
|
734
|
+
items.push({ id: modelTreeId({ provider: provider.id, model }), label: ` ${modelDisplayName(provider, model)}${entry.configured.has(model) ? " (configured)" : ""}` });
|
|
594
735
|
}
|
|
595
|
-
|
|
736
|
+
return items;
|
|
737
|
+
};
|
|
738
|
+
while (!signal.aborted) {
|
|
739
|
+
const choice = await ui.select('Models', rows(), {
|
|
596
740
|
...(cursor ? { selectedId: cursor } : {}),
|
|
597
741
|
checkedId: active ? modelTreeId({ provider: active.id, model: active.model }) : '',
|
|
598
|
-
...(active ? { description: `Current: ${providerLabel(active, providers)} / ${active.model}` } : {}),
|
|
742
|
+
...(active ? { description: `Current: ${providerLabel(active, providers)} / ${modelDisplayName(active, active.model)}` } : {}),
|
|
599
743
|
expandPrefix: MODEL_TREE_EXPAND, collapsePrefix: MODEL_TREE_COLLAPSE,
|
|
600
744
|
footer: '↑↓ Move · → Expand · ← Collapse · Enter Select · Esc Back',
|
|
601
745
|
signal,
|
|
746
|
+
...andorraRefresh(state, rows),
|
|
602
747
|
});
|
|
603
748
|
if (choice === undefined || signal.aborted)
|
|
604
749
|
return undefined;
|
|
605
750
|
const action = choice.startsWith(MODEL_TREE_EXPAND) ? 'expand' : choice.startsWith(MODEL_TREE_COLLAPSE) ? 'collapse' : 'pick';
|
|
606
751
|
const row = parseModelTreeId(action === 'expand' ? choice.slice(MODEL_TREE_EXPAND.length) : action === 'collapse' ? choice.slice(MODEL_TREE_COLLAPSE.length) : choice);
|
|
607
752
|
const provider = row && providers.find(item => item.id === row.provider);
|
|
753
|
+
// The listed Andorra can leave the tree while it is open (turned off, or removed elsewhere): draw it again.
|
|
754
|
+
if (row && !provider && row.provider === listedId)
|
|
755
|
+
continue;
|
|
608
756
|
if (!row || !provider)
|
|
609
757
|
throw new Error('Invalid model selection');
|
|
610
758
|
cursor = modelTreeId(row);
|
|
@@ -627,6 +775,29 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
627
775
|
continue;
|
|
628
776
|
if (!loaded.get(provider.id)?.models.includes(row.model))
|
|
629
777
|
throw new Error('Invalid model selection');
|
|
778
|
+
if (provider === listed) {
|
|
779
|
+
// The user's own choice of an Andorra model: the entry is saved first; the caller then selects it as usual.
|
|
780
|
+
const added = await state.andorra?.add?.(row.model);
|
|
781
|
+
if (!added?.added) {
|
|
782
|
+
if (added?.message && !signal.aborted)
|
|
783
|
+
await ui.showScreen('Andorra', [added.message], { signal });
|
|
784
|
+
continue;
|
|
785
|
+
}
|
|
786
|
+
const saved = state.config.providers.find(item => item.id === (added.id ?? provider.id));
|
|
787
|
+
if (added.modelServed === false || (saved !== undefined && !providerModels(saved).includes(row.model))) {
|
|
788
|
+
// The offer changed between the tree being drawn and the pick: the entry was saved with what is served
|
|
789
|
+
// now, and the model that is gone is not selected. Say so and draw the tree with the saved entry's models.
|
|
790
|
+
if (!signal.aborted)
|
|
791
|
+
await ui.showScreen('Andorra', [added.message ?? ANDORRA_MODEL_GONE], { signal });
|
|
792
|
+
if (saved !== undefined) {
|
|
793
|
+
loaded.set(saved.id, { models: providerModels(saved), configured: new Set() });
|
|
794
|
+
expanded.add(saved.id);
|
|
795
|
+
cursor = modelTreeId({ provider: saved.id });
|
|
796
|
+
}
|
|
797
|
+
continue;
|
|
798
|
+
}
|
|
799
|
+
return { provider: added.id ?? provider.id, model: row.model };
|
|
800
|
+
}
|
|
630
801
|
return { provider: provider.id, model: row.model };
|
|
631
802
|
}
|
|
632
803
|
return undefined;
|
package/dist/src/commands.d.ts
CHANGED
|
@@ -8,7 +8,8 @@ import type { Completion, RunResult } from './runtime.js';
|
|
|
8
8
|
import type { Usage } from './types.js';
|
|
9
9
|
import type { CodeIntelligenceManager } from './code-intelligence/CodeIntelligenceManager.js';
|
|
10
10
|
import { logoutCodex } from './codex-auth.js';
|
|
11
|
-
|
|
11
|
+
import type { TerminalAndorraHooks } from './andorra/terminal.js';
|
|
12
|
+
export declare const HELP = "Commands:\n /browser Open the browser workspace (CLI stays available)\n /session Browse and resume saved sessions (newest first)\n /login [--no-browser] Sign in or create an Andorra account (prints the address over SSH)\n /auth logout Remove this machine's saved Andorra account session\n /auth status Show Andorra account session status\n /model [model-id] Open the provider/model tree (\u2192 expands, \u2190 collapses) or select a model directly; with a graph that pins node models, asks whether to override them\n /model list Discover models from the active provider\n /providers [id] Choose providers; Right/e edits; Add provider configures\n /subagent [id [model]] Set the provider/model external hosts (Claude/Codex CLI) must use for Andorra subagent runs; off clears it\n /reasoning <level> Set default|none|minimal|low|medium|high|xhigh|max\n /graph [id] Select a graph or open the web graph builder\n /codegraph <action> Code intelligence: status|enable|disable|rebuild; enable|disable --global sets the default for every project\n /dashboard Toggle live dashboard and transcript (TTY only)\n /attach <path> Attach a file or folder to your next task (large pastes and dropped files attach automatically)\n /usage Open session usage (Escape to return)\n /permissions [mode] Choose and remember workspace permissions\n /jev <on|off|status> Turn Jev on or off for this session, or show its setting\n /jev global <on|off> Turn the Global Jev switch on or off; off stops Jev in every session and agent\n /feedback <on|off|status> Show the anonymous-feedback setting; Paid accounts can turn it off\n /yolo <on|off> Turn session-wide Full Access on or off (host files and network)\n /tools List available coding tools\n /skills List, install, enable, disable or remove skills\n /<skillname> [args] Apply an enabled imported skill to this and every later message; qualify duplicate names by catalog ID\n /skill [on|off|remove] Show, pause, resume or end the session's active skill\n /plugins List, install, enable, disable or remove plugins\n /mcp Add, edit, enable, disable or delete MCP servers\n /logout Sign out of your Andorra account (then /login to switch accounts)\n /logout --all Sign out, and delete every other Andorra sign-in saved on this machine\n /logout codex Sign out of every configured Codex (ChatGPT) account\n /status Show workspace and current settings\n /clear Clear the conversation on screen and the retained context (session usage is retained)\n /compact Compact retained conversation history to free context\n /goal [text|clear] Set, show or clear the session goal; a run keeps working until a completion check agrees the goal is met\n /help Show commands\n /exit Quit\nSelection screens: Up/Down to browse, Enter or Space to select, Escape to return.\nCtrl+B toggles dashboard; Ctrl+G pages its graph; Ctrl+N cycles dashboard model statistics (display only).\nCtrl+T expands/collapses todos; Ctrl+O expands/collapses tool details; Ctrl+Y collapses/expands live thinking.\nShift+Arrow/Home/End selects prompt text; Ctrl+C copies and Ctrl+X cuts a selection. The wheel scrolls; Up/Down recall prompts. Drag selects and copies transcript text; double-click copies a word.\nCtrl+C stops an interactive run; send direction to resume, or press Ctrl+C again to exit (idle Ctrl+C exits too). /yolo on|off applies immediately, including at approvals. /exit quits. Headless Ctrl+C cancels the run; a second press exits.";
|
|
12
13
|
export interface CommandState {
|
|
13
14
|
config: Config;
|
|
14
15
|
yolo: boolean;
|
|
@@ -29,7 +30,11 @@ export interface CommandState {
|
|
|
29
30
|
confirmModelOverride?: (question: string) => Promise<boolean>;
|
|
30
31
|
history?: ConversationTurn[];
|
|
31
32
|
goal?: SessionGoal;
|
|
33
|
+
jev?: boolean;
|
|
34
|
+
andorra?: TerminalAndorraHooks;
|
|
32
35
|
}
|
|
36
|
+
/** The message refusing a switch to this provider, or undefined when it may be selected. An absent `state.andorra` counts as available. */
|
|
37
|
+
export declare function andorraRefusal(state: Pick<CommandState, 'andorra' | 'config'>, providerId: string): string | undefined;
|
|
33
38
|
export interface CommandResult {
|
|
34
39
|
text: string;
|
|
35
40
|
goalChanged?: boolean;
|
|
@@ -52,6 +57,7 @@ export interface ConversationTurn {
|
|
|
52
57
|
text: string;
|
|
53
58
|
attachments?: import('./attachments.js').UserAttachmentRef[];
|
|
54
59
|
wake?: TurnWake;
|
|
60
|
+
subagentId?: string;
|
|
55
61
|
}[];
|
|
56
62
|
}
|
|
57
63
|
export type TurnWake = 'timer' | 'auto-fix';
|
package/dist/src/commands.js
CHANGED
|
@@ -6,12 +6,12 @@ export function permissionChoices(current) {
|
|
|
6
6
|
}
|
|
7
7
|
import { graphStorageDirectory } from './graph-account.js';
|
|
8
8
|
import { configuredGraphSelection, currentGraphSubject, saveGraphSelection } from './graph-selection.js';
|
|
9
|
-
import { loadAccessibleGraph, requireGraphMembership } from './membership.js';
|
|
9
|
+
import { currentGraphSelection, loadAccessibleGraph, requireGraphMembership } from './membership.js';
|
|
10
10
|
import { GraphProviderUnavailableError } from './graph-provider-portability.js';
|
|
11
11
|
import { confirmAndApplyModelOverride } from './model-override.js';
|
|
12
12
|
import { applyGoalCommand } from './session-goal.js';
|
|
13
13
|
import { changeConfigFile, configDirectory, loadConfig, loadSavedAnalytics } from './config.js';
|
|
14
|
-
import { applyModelContextWindow, providerLabel, recordProviderModel, REASONING_EFFORTS } from './providers.js';
|
|
14
|
+
import { applyModelContextWindow, modelDisplayName, modelIdForDisplayName, providerLabel, recordProviderModel, REASONING_EFFORTS } from './providers.js';
|
|
15
15
|
import { resolveRepositoryId } from './code-intelligence/repository.js';
|
|
16
16
|
import { logoutCodex } from './codex-auth.js';
|
|
17
17
|
import { codexAccountHome } from './codex-rpc.js';
|
|
@@ -21,6 +21,7 @@ import { telemetryDirectory } from './telemetry/identity.js';
|
|
|
21
21
|
import { purgeOutbox } from './telemetry/outbox.js';
|
|
22
22
|
import { recordPreference } from './telemetry/state.js';
|
|
23
23
|
import { telemetryGate } from './telemetry/gate.js';
|
|
24
|
+
import { formatWeekReset } from './andorra/usage-format.js';
|
|
24
25
|
const MAX_CODEINTEL_REPO_OVERRIDES = 100;
|
|
25
26
|
const REASONING_USAGE = 'Usage: /reasoning default|none|minimal|low|medium|high|xhigh|max';
|
|
26
27
|
export const HELP = `Commands:
|
|
@@ -40,7 +41,8 @@ export const HELP = `Commands:
|
|
|
40
41
|
/attach <path> Attach a file or folder to your next task (large pastes and dropped files attach automatically)
|
|
41
42
|
/usage Open session usage (Escape to return)
|
|
42
43
|
/permissions [mode] Choose and remember workspace permissions
|
|
43
|
-
/jev <on|off|status> Turn Jev on or off for
|
|
44
|
+
/jev <on|off|status> Turn Jev on or off for this session, or show its setting
|
|
45
|
+
/jev global <on|off> Turn the Global Jev switch on or off; off stops Jev in every session and agent
|
|
44
46
|
/feedback <on|off|status> Show the anonymous-feedback setting; Paid accounts can turn it off
|
|
45
47
|
/yolo <on|off> Turn session-wide Full Access on or off (host files and network)
|
|
46
48
|
/tools List available coding tools
|
|
@@ -63,6 +65,28 @@ Ctrl+B toggles dashboard; Ctrl+G pages its graph; Ctrl+N cycles dashboard model
|
|
|
63
65
|
Ctrl+T expands/collapses todos; Ctrl+O expands/collapses tool details; Ctrl+Y collapses/expands live thinking.
|
|
64
66
|
Shift+Arrow/Home/End selects prompt text; Ctrl+C copies and Ctrl+X cuts a selection. The wheel scrolls; Up/Down recall prompts. Drag selects and copies transcript text; double-click copies a word.
|
|
65
67
|
Ctrl+C stops an interactive run; send direction to resume, or press Ctrl+C again to exit (idle Ctrl+C exits too). /yolo on|off applies immediately, including at approvals. /exit quits. Headless Ctrl+C cancels the run; a second press exits.`;
|
|
68
|
+
/** `name (id)` when the model has a display name, else the id. */
|
|
69
|
+
function modelWithName(provider, id) {
|
|
70
|
+
const name = modelDisplayName(provider, id);
|
|
71
|
+
return name === id ? id : `${name} (${id})`;
|
|
72
|
+
}
|
|
73
|
+
/** The /status line for Andorra's hosted models, with its leading line break; empty while there is nothing to show. */
|
|
74
|
+
function andorraUsageLine(state) {
|
|
75
|
+
const usage = state.andorra?.usage?.();
|
|
76
|
+
if (!usage)
|
|
77
|
+
return '';
|
|
78
|
+
if (usage.kind === 'not-available')
|
|
79
|
+
return '\nAndorra models: Not available at the moment.';
|
|
80
|
+
const resets = formatWeekReset(usage.resetsAt);
|
|
81
|
+
return `\nAndorra models, this week: ${usage.usedPercent}% used${resets ? `, resets ${resets}` : ''}`;
|
|
82
|
+
}
|
|
83
|
+
/** The message refusing a switch to this provider, or undefined when it may be selected. An absent `state.andorra` counts as available. */
|
|
84
|
+
export function andorraRefusal(state, providerId) {
|
|
85
|
+
if (state.config.providers.find(item => item.id === providerId)?.type !== 'andorra')
|
|
86
|
+
return undefined;
|
|
87
|
+
const availability = state.andorra?.availability();
|
|
88
|
+
return availability && !availability.available ? availability.message : undefined;
|
|
89
|
+
}
|
|
66
90
|
export function compactHistory(turns) {
|
|
67
91
|
const clip = (text, limit) => { const flat = text.replace(/\s+/g, ' ').trim(); return flat.length > limit ? flat.slice(0, limit - 1) + '…' : flat; };
|
|
68
92
|
const lines = turns.map((turn, index) => `${index + 1}. ${clip(turn.task, 160)}${turn.direction === undefined ? '' : ` (continued with: ${clip(turn.direction, 160)})`} → ${clip(turn.completion.summary, 240)}`);
|
|
@@ -211,13 +235,14 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
|
|
|
211
235
|
if (action === 'logout' || action === 'login') {
|
|
212
236
|
delete draft.graph;
|
|
213
237
|
result.clear = true;
|
|
238
|
+
state.andorra?.accountChanged?.();
|
|
214
239
|
}
|
|
215
240
|
}
|
|
216
241
|
else if (codegraph) {
|
|
217
242
|
result = codegraphScope ? await codegraphCommand(codegraph[1] ?? 'status', codegraphScope, draft, signal) : { text: CODEGRAPH_USAGE };
|
|
218
243
|
}
|
|
219
244
|
else if (graphCommand) {
|
|
220
|
-
const id = graphCommand[1];
|
|
245
|
+
const id = currentGraphSelection(graphCommand[1]);
|
|
221
246
|
try {
|
|
222
247
|
signal?.throwIfAborted();
|
|
223
248
|
const subject = await graphSubject();
|
|
@@ -303,6 +328,8 @@ export async function executeCommand(line, state, persist, signal, graphAccess =
|
|
|
303
328
|
state.permissions = draft.permissions;
|
|
304
329
|
if (result.goalChanged)
|
|
305
330
|
state.goal = draft.goal;
|
|
331
|
+
if (draft.jev !== undefined)
|
|
332
|
+
state.jev = draft.jev;
|
|
306
333
|
if (permissionsChanged && draft.permissions !== 'read-only' && draft.permissions !== 'plan')
|
|
307
334
|
await state.codeIntel?.setPermissions(draft.permissions);
|
|
308
335
|
if (draft.graph === undefined)
|
|
@@ -341,23 +368,35 @@ export function handleCommand(line, state) {
|
|
|
341
368
|
if (arg === 'list')
|
|
342
369
|
return { text: '', discover: true };
|
|
343
370
|
if (!arg)
|
|
344
|
-
return { text: `${provider.id}: ${provider.model}` };
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
371
|
+
return { text: `${provider.id}: ${modelWithName(provider, provider.model)}` };
|
|
372
|
+
{ // An Andorra model may also be named by its exact display name; the id is what is saved.
|
|
373
|
+
const chosen = modelIdForDisplayName(provider, arg) ?? (args.length === 1 ? arg : undefined);
|
|
374
|
+
if (chosen === undefined)
|
|
375
|
+
return { text: 'Usage: /model <model-id>' };
|
|
376
|
+
if (provider.model !== chosen) {
|
|
377
|
+
applyModelContextWindow(provider, chosen);
|
|
378
|
+
delete provider.reasoningEffort;
|
|
379
|
+
}
|
|
380
|
+
recordProviderModel(provider, chosen);
|
|
381
|
+
provider.model = chosen;
|
|
382
|
+
return { text: `Model: ${provider.id}/${modelWithName(provider, chosen)}`, save: true, clear: true };
|
|
350
383
|
}
|
|
351
|
-
recordProviderModel(provider, arg);
|
|
352
|
-
provider.model = arg;
|
|
353
|
-
return { text: `Model: ${provider.id}/${arg}`, save: true, clear: true };
|
|
354
384
|
case '/providers':
|
|
355
385
|
if (!arg && !provider)
|
|
356
386
|
return { text: 'No providers configured. Open /providers and choose Add provider.' };
|
|
357
|
-
if (!arg)
|
|
358
|
-
|
|
387
|
+
if (!arg) {
|
|
388
|
+
// Andorra listed by default and not saved yet reads like any provider, first. Naming it here saves nothing.
|
|
389
|
+
const listed = state.andorra?.listed?.();
|
|
390
|
+
const shown = listed ? [listed, ...state.config.providers] : state.config.providers;
|
|
391
|
+
return { text: shown.map(p => `${p !== listed && p.id === provider.id ? '*' : ' '} ${providerLabel(p, shown)} (${p.type}) — ${modelDisplayName(p, p.model)}`).join('\n') };
|
|
392
|
+
}
|
|
359
393
|
if (!state.config.providers.some(p => p.id === arg))
|
|
360
394
|
return { text: `Unknown provider: ${arg}. Use /providers to browse configured providers.` };
|
|
395
|
+
{
|
|
396
|
+
const refusal = andorraRefusal(state, arg);
|
|
397
|
+
if (refusal)
|
|
398
|
+
return { text: refusal };
|
|
399
|
+
}
|
|
361
400
|
state.config.provider = arg;
|
|
362
401
|
return { text: `Provider: ${arg}. Conversation cleared for the new provider.`, save: true, clear: true };
|
|
363
402
|
case '/subagent': {
|
|
@@ -405,7 +444,7 @@ export function handleCommand(line, state) {
|
|
|
405
444
|
if (changed)
|
|
406
445
|
return { text: 'Graph: Default (Andorra Agent)', clear: true };
|
|
407
446
|
}
|
|
408
|
-
return { text: 'Graph: Default - Andorra Agent only. Use the graph selector for
|
|
447
|
+
return { text: 'Graph: Default - Andorra Agent only. Use the graph selector for custom graphs.' };
|
|
409
448
|
case '/permissions':
|
|
410
449
|
if (!arg)
|
|
411
450
|
return { text: permissionChoices(state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval')) };
|
|
@@ -426,18 +465,30 @@ export function handleCommand(line, state) {
|
|
|
426
465
|
? 'YOLO on: session-wide Full Access. Host files, shell, Git, QA, MCP and network operations are automatically approved.'
|
|
427
466
|
: 'YOLO off: session permissions restored to Ask for approval.' };
|
|
428
467
|
case '/jev': {
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
const
|
|
468
|
+
const jevUsage = 'Usage: /jev on|off|status, or /jev global on|off';
|
|
469
|
+
const global = args[0] === 'global';
|
|
470
|
+
const globalArg = global ? args[1] : undefined;
|
|
471
|
+
if (global ? args.length !== 2 || !['on', 'off'].includes(globalArg ?? '') : args.length > 1 || (arg && !['on', 'off', 'status'].includes(arg)))
|
|
472
|
+
return { text: jevUsage };
|
|
473
|
+
const jevStatus = () => {
|
|
474
|
+
const globalOn = state.config.jevEnabled !== false;
|
|
475
|
+
const sessionOn = state.jev !== false;
|
|
476
|
+
return `Jev: ${globalOn && sessionOn ? 'on' : 'off'} for this session (session ${sessionOn ? 'on' : 'off'}, Global Jev switch ${globalOn ? 'on' : 'off'}).`
|
|
477
|
+
+ (globalOn ? ' Applies to Agent nodes with Jev turned on. Requires sign-in and available quota.' : ' The Global Jev switch is off, so no session and no Agent node uses Jev. Turn it on with /jev global on.');
|
|
478
|
+
};
|
|
432
479
|
if (arg === 'status')
|
|
433
|
-
return { text: jevStatus };
|
|
480
|
+
return { text: jevStatus() };
|
|
434
481
|
if (!arg)
|
|
435
|
-
return { text: `${jevStatus}\
|
|
436
|
-
state.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
return { text:
|
|
440
|
-
|
|
482
|
+
return { text: `${jevStatus()}\n${jevUsage}` };
|
|
483
|
+
const kept = state.running ? ' The current run keeps its setting; the change applies after it ends or you interrupt it.' : '';
|
|
484
|
+
if (global) {
|
|
485
|
+
state.config.jevEnabled = globalArg === 'on';
|
|
486
|
+
return { text: `Global Jev switch ${state.config.jevEnabled ? 'on' : 'off'}. Setting saved for this machine.${kept}${state.config.jevEnabled ? ` Each session keeps its own setting; this session is ${state.jev === false ? 'off' : 'on'}.` : ' No session and no Agent node uses Jev until it is turned back on.'}`, save: true };
|
|
487
|
+
}
|
|
488
|
+
state.jev = arg === 'on';
|
|
489
|
+
if (state.config.jevEnabled === false)
|
|
490
|
+
return { text: `Jev ${state.jev ? 'on' : 'off'} for this session, but the Global Jev switch is off, so Jev stays off. Turn it on with /jev global on.` };
|
|
491
|
+
return { text: `Jev ${state.jev ? 'on' : 'off'} for this session.${kept}${state.jev && !state.running ? ' It applies to Agent nodes with Jev turned on and requires sign-in and available quota.' : ''}` };
|
|
441
492
|
}
|
|
442
493
|
case '/feedback': {
|
|
443
494
|
if (args.length > 1 || (arg && !['on', 'off', 'status'].includes(arg)))
|
|
@@ -465,7 +516,7 @@ export function handleCommand(line, state) {
|
|
|
465
516
|
: '';
|
|
466
517
|
return { text: `Session: ${state.usage.requests} model requests, ${state.usage.inputTokens} input + ${state.usage.outputTokens} output tokens${cache} (provider-reported; missing usage is not estimated).\nCost: unavailable; no pricing assumptions.${state.lastRun ? `\nLast run: ${state.lastRun.id} — ${state.lastRun.status}, ${state.lastRun.toolCalls} tool calls` : ''}` };
|
|
467
518
|
}
|
|
468
|
-
case '/status': return { text: `Workspace: ${state.workspace}\nProvider/model: ${provider.id}/${provider.model}\nThinking: ${provider.reasoningEffort ?? 'provider default'}\nContext window: ${provider.contextWindow?.toLocaleString() ?? 'unknown'}\nGraph: ${state.graph ?? 'Default'}\nPermissions: ${permissionLabel(state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval'))}\nYOLO: ${state.yolo ? 'on' : 'off'}` };
|
|
519
|
+
case '/status': return { text: `Workspace: ${state.workspace}\nProvider/model: ${provider.id}/${modelWithName(provider, provider.model)}\nThinking: ${provider.reasoningEffort ?? 'provider default'}\nContext window: ${provider.contextWindow?.toLocaleString() ?? 'unknown'}\nGraph: ${state.graph ?? 'Default'}\nPermissions: ${permissionLabel(state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval'))}\nYOLO: ${state.yolo ? 'on' : 'off'}${andorraUsageLine(state)}` };
|
|
469
520
|
case '/tools': return { text: 'Read, Write, Edit, Glob, Grep, Bash, PowerShell; repo_explore (when CodeGraph is enabled), git_read, qa.*, memory_search and artifact/control tools as permitted.\nEnabled skills add read_skill_resource. Enabled MCP servers and plugins discover namespaced tools at each task start; connection status reports availability. External tools require an agent with shell permission.\nWrites and shell commands obey /permissions; unsupported strict sandboxes fail closed. Host/network escalation and MCP connections/calls require approval unless Full Access is selected. Existing graph configs using retired read_file/search_files/Pi lowercase names are translated internally and are not advertised to models.' };
|
|
470
521
|
default: return { text: `Unknown command: ${command}. Use /help.` };
|
|
471
522
|
}
|