@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,4 +1,5 @@
|
|
|
1
1
|
import { executeCommand } from './commands.js';
|
|
2
|
+
import { WORKING_SPINNER_FRAMES, WORKING_SPINNER_TICK_MS } from './session-title.js';
|
|
2
3
|
import { PERMISSION_OPTIONS } from './permissions.js';
|
|
3
4
|
import { editProviderSettings } from './provider-settings.js';
|
|
4
5
|
import { retireRemovedCodexAccounts, retireUnsavedCodexAccounts } from './codex-auth.js';
|
|
@@ -24,6 +25,21 @@ export function pickPermissionMode(state, ui, signal, options = {}) {
|
|
|
24
25
|
const current = state.permissions ?? (state.yolo ? 'full-access' : 'ask-for-approval');
|
|
25
26
|
return ui.select('Update Model Permissions', PERMISSION_OPTIONS.map((option, index) => ({ id: option.id, label: `${index + 1}. ${option.label}${option.id === current ? ' (current)' : ''}`, description: option.description })), { selectedId: current, description: 'Remembered for this workspace. Restricted commands require the Codex CLI OS sandbox.', signal, ...options });
|
|
26
27
|
}
|
|
28
|
+
/** The config with `model` on `providerId` as the selected pair: what choosing it in /model saves. */
|
|
29
|
+
export function withSelectedModel(config, providerId, model) {
|
|
30
|
+
const draft = structuredClone(config);
|
|
31
|
+
const next = draft.providers.find(item => item.id === providerId);
|
|
32
|
+
if (!next)
|
|
33
|
+
throw new Error(`Unknown provider: ${providerId}`);
|
|
34
|
+
draft.provider = providerId;
|
|
35
|
+
recordProviderModel(next, model);
|
|
36
|
+
if (next.model !== model) {
|
|
37
|
+
next.model = model;
|
|
38
|
+
applyModelContextWindow(next, model);
|
|
39
|
+
delete next.reasoningEffort;
|
|
40
|
+
}
|
|
41
|
+
return draft;
|
|
42
|
+
}
|
|
27
43
|
export function isScreenCommand(line) {
|
|
28
44
|
return ['/model', '/providers', '/graph', '/usage', '/permissions', '/skills', '/plugins', '/mcp', '/subagent'].includes(line.trim());
|
|
29
45
|
}
|
|
@@ -203,16 +219,7 @@ export async function runCommandScreen(line, state, ui, persist, signal, adapter
|
|
|
203
219
|
}
|
|
204
220
|
if (target.id === state.config.provider && selected === target.model)
|
|
205
221
|
return overrideApplied ? { clear: true } : unchanged;
|
|
206
|
-
|
|
207
|
-
draft.provider = target.id;
|
|
208
|
-
const next = draft.providers.find(item => item.id === target.id);
|
|
209
|
-
recordProviderModel(next, selected);
|
|
210
|
-
if (next.model !== selected) {
|
|
211
|
-
next.model = selected;
|
|
212
|
-
applyModelContextWindow(next, selected);
|
|
213
|
-
delete next.reasoningEffort;
|
|
214
|
-
}
|
|
215
|
-
return await save(draft);
|
|
222
|
+
return await save(withSelectedModel(state.config, target.id, selected));
|
|
216
223
|
}
|
|
217
224
|
if (command === '/providers') {
|
|
218
225
|
if (!await waitForAndorraCheck(state, ui, signal))
|
|
@@ -587,6 +594,18 @@ async function runExtensionScreen(command, state, ui, save, signal) {
|
|
|
587
594
|
}
|
|
588
595
|
export const MODEL_TREE_EXPAND = ':expand:';
|
|
589
596
|
export const MODEL_TREE_COLLAPSE = ':collapse:';
|
|
597
|
+
/** How long a /model provider loads before its loading row and spinner are drawn, so a quick answer never flashes one. */
|
|
598
|
+
const MODEL_LOADING_GRACE_MS = 150;
|
|
599
|
+
/**
|
|
600
|
+
* Lets an answer already in hand (a stub, a cache) land before the tree is drawn again, waiting on microtasks only:
|
|
601
|
+
* no key or terminal event can be handled meanwhile, so nothing typed is lost while no screen is open.
|
|
602
|
+
*/
|
|
603
|
+
async function settleWithoutYielding(job) {
|
|
604
|
+
let settled = false;
|
|
605
|
+
void job.then(() => { settled = true; });
|
|
606
|
+
for (let turn = 0; turn < 32 && !settled; turn++)
|
|
607
|
+
await Promise.resolve();
|
|
608
|
+
}
|
|
590
609
|
export const modelTreeId = (row) => JSON.stringify(row.model === undefined ? [row.provider] : [row.provider, row.model]);
|
|
591
610
|
function parseModelTreeId(id) {
|
|
592
611
|
try {
|
|
@@ -639,7 +658,7 @@ export function andorraRefresh(state, rows) {
|
|
|
639
658
|
* at once and the check runs in the background. False when the screen was cancelled (Esc on the loading screen
|
|
640
659
|
* or the screen's signal aborted).
|
|
641
660
|
*/
|
|
642
|
-
async function waitForAndorraCheck(state, ui, signal) {
|
|
661
|
+
async function waitForAndorraCheck(state, ui, signal, yields = {}) {
|
|
643
662
|
const andorra = state.andorra;
|
|
644
663
|
if (!andorra)
|
|
645
664
|
return true;
|
|
@@ -653,16 +672,19 @@ async function waitForAndorraCheck(state, ui, signal) {
|
|
|
653
672
|
return finish();
|
|
654
673
|
loadSignal.addEventListener('abort', finish, { once: true });
|
|
655
674
|
andorra.opened().catch(() => { }).then(() => { loadSignal.removeEventListener('abort', finish); finish(); });
|
|
656
|
-
}), { description: 'Checking Andorra availability', signal });
|
|
675
|
+
}), { description: 'Checking Andorra availability', signal, ...yields });
|
|
657
676
|
return done === true && !signal.aborted;
|
|
658
677
|
}
|
|
659
678
|
/**
|
|
660
679
|
* The /model screen: every configured provider as a collapsed row ending in `>`, with its models
|
|
661
680
|
* indented beneath once expanded (Right Arrow or Enter expands, Left Arrow collapses). A provider's
|
|
662
|
-
* models load the first time it opens; when discovery fails its
|
|
681
|
+
* models load the first time it opens, behind a loading row in the open tree; when discovery fails its
|
|
682
|
+
* configured models are shown instead.
|
|
663
683
|
*/
|
|
664
|
-
export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
665
|
-
|
|
684
|
+
export async function pickProviderModel(state, ui, adapterFactory, signal, options = {}) {
|
|
685
|
+
// Opened while a run is working, the tree closes when the run asks a question (an approval, a clarification).
|
|
686
|
+
const yields = options.yieldToQuestions ? { yieldToQuestions: true } : {};
|
|
687
|
+
if (!await waitForAndorraCheck(state, ui, signal, yields))
|
|
666
688
|
return undefined;
|
|
667
689
|
// A listed, not yet saved Andorra is shown first, like a saved provider. Its models come from the hosted answer:
|
|
668
690
|
// no request is ever sent on its behalf before the user picks it.
|
|
@@ -674,36 +696,50 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
674
696
|
const expanded = new Set();
|
|
675
697
|
const loaded = new Map();
|
|
676
698
|
let cursor = active ? modelTreeId({ provider: active.id }) : undefined;
|
|
677
|
-
|
|
699
|
+
// Discovery runs behind the open tree: the expanded provider shows a loading row where its first model will be,
|
|
700
|
+
// and the rows are redrawn in place when the answer lands. Closing the picker abandons every load still running.
|
|
701
|
+
const loads = new AbortController();
|
|
702
|
+
const abandon = () => loads.abort();
|
|
703
|
+
signal.addEventListener('abort', abandon, { once: true });
|
|
704
|
+
const pending = new Map();
|
|
705
|
+
const pendingSince = new Map();
|
|
706
|
+
let frame = 0;
|
|
707
|
+
let redrawOpen;
|
|
708
|
+
const load = (provider) => {
|
|
678
709
|
if (loaded.has(provider.id))
|
|
679
|
-
return
|
|
710
|
+
return undefined;
|
|
680
711
|
if (provider === listed) {
|
|
681
712
|
loaded.set(provider.id, { models: providerModels(provider), configured: new Set() });
|
|
682
|
-
return
|
|
713
|
+
return undefined;
|
|
683
714
|
}
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
715
|
+
const running = pending.get(provider.id);
|
|
716
|
+
if (running)
|
|
717
|
+
return running;
|
|
718
|
+
const job = (async () => {
|
|
719
|
+
let discovered = [];
|
|
720
|
+
let note;
|
|
721
|
+
try {
|
|
688
722
|
const adapter = adapterFactory(provider);
|
|
689
723
|
if (!adapter.listModels)
|
|
690
724
|
throw new Error('Model discovery unavailable');
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
725
|
+
const models = await adapter.listModels(loads.signal);
|
|
726
|
+
discovered = [...new Set(models)].filter(id => typeof id === 'string' && id.trim().length > 0);
|
|
727
|
+
if (!discovered.length)
|
|
728
|
+
note = 'The provider returned no models.';
|
|
729
|
+
}
|
|
730
|
+
catch {
|
|
731
|
+
if (loads.signal.aborted)
|
|
732
|
+
return;
|
|
733
|
+
note = 'Could not load models; check the endpoint and credentials in /providers. Showing configured models.';
|
|
734
|
+
}
|
|
735
|
+
if (loads.signal.aborted)
|
|
736
|
+
return;
|
|
737
|
+
const configured = providerModels(provider).filter(id => !discovered.includes(id));
|
|
738
|
+
loaded.set(provider.id, { models: [...discovered, ...configured], configured: new Set(configured), ...(note ? { note } : {}) });
|
|
739
|
+
})().finally(() => { pending.delete(provider.id); pendingSince.delete(provider.id); redrawOpen?.(); });
|
|
740
|
+
pending.set(provider.id, job);
|
|
741
|
+
pendingSince.set(provider.id, Date.now());
|
|
742
|
+
return job;
|
|
707
743
|
};
|
|
708
744
|
const rows = () => {
|
|
709
745
|
// Rebuilt each time the tree is drawn, and in place when a check answers while it is open.
|
|
@@ -726,6 +762,13 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
726
762
|
...(refusal ? { description: refusal } : open && entry?.note ? { description: entry.note } : {}),
|
|
727
763
|
...(isActive ? { bold: true } : {}),
|
|
728
764
|
});
|
|
765
|
+
if (open && !entry && pending.has(provider.id)) {
|
|
766
|
+
// Takes the place of the first model once the load has run past the grace period (the spinner's ticks
|
|
767
|
+
// redraw it in); picking it does nothing, like the empty-list row.
|
|
768
|
+
if (Date.now() - (pendingSince.get(provider.id) ?? 0) >= MODEL_LOADING_GRACE_MS)
|
|
769
|
+
items.push({ id: modelTreeId({ provider: provider.id, model: '' }), label: ` ${WORKING_SPINNER_FRAMES[frame % WORKING_SPINNER_FRAMES.length]} Loading models…` });
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
729
772
|
if (!open || !entry)
|
|
730
773
|
continue;
|
|
731
774
|
if (!entry.models.length)
|
|
@@ -735,70 +778,94 @@ export async function pickProviderModel(state, ui, adapterFactory, signal) {
|
|
|
735
778
|
}
|
|
736
779
|
return items;
|
|
737
780
|
};
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
781
|
+
try {
|
|
782
|
+
while (!signal.aborted) {
|
|
783
|
+
const choice = await ui.select('Models', rows(), {
|
|
784
|
+
...(cursor ? { selectedId: cursor } : {}),
|
|
785
|
+
checkedId: active ? modelTreeId({ provider: active.id, model: active.model }) : '',
|
|
786
|
+
...(active ? { description: `Current: ${providerLabel(active, providers)} / ${modelDisplayName(active, active.model)}` } : {}),
|
|
787
|
+
expandPrefix: MODEL_TREE_EXPAND, collapsePrefix: MODEL_TREE_COLLAPSE,
|
|
788
|
+
footer: '↑↓ Move · → Expand · ← Collapse · Enter Select · Esc Back',
|
|
789
|
+
signal, ...yields,
|
|
790
|
+
refresh: redraw => {
|
|
791
|
+
const stopAndorra = andorraRefresh(state, rows).refresh?.(redraw);
|
|
792
|
+
redrawOpen = () => redraw(rows());
|
|
793
|
+
// The loading row's spinner turns while any provider is still loading.
|
|
794
|
+
const spinner = pending.size ? setInterval(() => {
|
|
795
|
+
if (!pending.size) {
|
|
796
|
+
clearInterval(spinner);
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
frame++;
|
|
800
|
+
redraw(rows());
|
|
801
|
+
}, WORKING_SPINNER_TICK_MS) : undefined;
|
|
802
|
+
spinner?.unref?.();
|
|
803
|
+
return () => { redrawOpen = undefined; if (spinner)
|
|
804
|
+
clearInterval(spinner); stopAndorra?.(); };
|
|
805
|
+
},
|
|
806
|
+
});
|
|
807
|
+
if (choice === undefined || signal.aborted)
|
|
808
|
+
return undefined;
|
|
809
|
+
const action = choice.startsWith(MODEL_TREE_EXPAND) ? 'expand' : choice.startsWith(MODEL_TREE_COLLAPSE) ? 'collapse' : 'pick';
|
|
810
|
+
const row = parseModelTreeId(action === 'expand' ? choice.slice(MODEL_TREE_EXPAND.length) : action === 'collapse' ? choice.slice(MODEL_TREE_COLLAPSE.length) : choice);
|
|
811
|
+
const provider = row && providers.find(item => item.id === row.provider);
|
|
812
|
+
// The listed Andorra can leave the tree while it is open (turned off, or removed elsewhere): draw it again.
|
|
813
|
+
if (row && !provider && row.provider === listedId)
|
|
814
|
+
continue;
|
|
815
|
+
if (!row || !provider)
|
|
816
|
+
throw new Error('Invalid model selection');
|
|
817
|
+
cursor = modelTreeId(row);
|
|
818
|
+
if (action === 'collapse') {
|
|
819
|
+
// Left on a model row folds its provider, like a file tree.
|
|
767
820
|
expanded.delete(provider.id);
|
|
821
|
+
cursor = modelTreeId({ provider: provider.id });
|
|
768
822
|
continue;
|
|
769
823
|
}
|
|
770
|
-
if (
|
|
824
|
+
if (row.model === undefined) {
|
|
825
|
+
if (action === 'pick' && expanded.has(provider.id)) {
|
|
826
|
+
expanded.delete(provider.id);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
771
829
|
expanded.add(provider.id);
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
if (!loaded.get(provider.id)?.models.includes(row.model))
|
|
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 });
|
|
830
|
+
// The tree is drawn again at once, keeping the keyboard; a slow answer lands in it through `refresh`.
|
|
831
|
+
const job = load(provider);
|
|
832
|
+
if (job)
|
|
833
|
+
await settleWithoutYielding(job);
|
|
784
834
|
continue;
|
|
785
835
|
}
|
|
786
|
-
|
|
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
|
-
}
|
|
836
|
+
if (action === 'expand' || row.model === '')
|
|
797
837
|
continue;
|
|
838
|
+
if (!loaded.get(provider.id)?.models.includes(row.model))
|
|
839
|
+
throw new Error('Invalid model selection');
|
|
840
|
+
if (provider === listed) {
|
|
841
|
+
// The user's own choice of an Andorra model: the entry is saved first; the caller then selects it as usual.
|
|
842
|
+
const added = await state.andorra?.add?.(row.model);
|
|
843
|
+
if (!added?.added) {
|
|
844
|
+
if (added?.message && !signal.aborted)
|
|
845
|
+
await ui.showScreen('Andorra', [added.message], { signal, ...yields });
|
|
846
|
+
continue;
|
|
847
|
+
}
|
|
848
|
+
const saved = state.config.providers.find(item => item.id === (added.id ?? provider.id));
|
|
849
|
+
if (added.modelServed === false || (saved !== undefined && !providerModels(saved).includes(row.model))) {
|
|
850
|
+
// The offer changed between the tree being drawn and the pick: the entry was saved with what is served
|
|
851
|
+
// now, and the model that is gone is not selected. Say so and draw the tree with the saved entry's models.
|
|
852
|
+
if (!signal.aborted)
|
|
853
|
+
await ui.showScreen('Andorra', [added.message ?? ANDORRA_MODEL_GONE], { signal, ...yields });
|
|
854
|
+
if (saved !== undefined) {
|
|
855
|
+
loaded.set(saved.id, { models: providerModels(saved), configured: new Set() });
|
|
856
|
+
expanded.add(saved.id);
|
|
857
|
+
cursor = modelTreeId({ provider: saved.id });
|
|
858
|
+
}
|
|
859
|
+
continue;
|
|
860
|
+
}
|
|
861
|
+
return { provider: added.id ?? provider.id, model: row.model };
|
|
798
862
|
}
|
|
799
|
-
return { provider:
|
|
863
|
+
return { provider: provider.id, model: row.model };
|
|
800
864
|
}
|
|
801
|
-
return
|
|
865
|
+
return undefined;
|
|
866
|
+
}
|
|
867
|
+
finally {
|
|
868
|
+
signal.removeEventListener('abort', abandon);
|
|
869
|
+
abandon();
|
|
802
870
|
}
|
|
803
|
-
return undefined;
|
|
804
871
|
}
|
package/dist/src/commands.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ 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
|
+
export declare const HELP = "Commands:\n /browser Open the browser workspace (CLI stays available)\n /session Browse and resume saved sessions (newest first)\n /resume Same as /session\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.";
|
|
13
13
|
export interface CommandState {
|
|
14
14
|
config: Config;
|
|
15
15
|
yolo: boolean;
|
package/dist/src/commands.js
CHANGED
|
@@ -27,6 +27,7 @@ const REASONING_USAGE = 'Usage: /reasoning default|none|minimal|low|medium|high|
|
|
|
27
27
|
export const HELP = `Commands:
|
|
28
28
|
/browser Open the browser workspace (CLI stays available)
|
|
29
29
|
/session Browse and resume saved sessions (newest first)
|
|
30
|
+
/resume Same as /session
|
|
30
31
|
/login [--no-browser] Sign in or create an Andorra account (prints the address over SSH)
|
|
31
32
|
/auth logout Remove this machine's saved Andorra account session
|
|
32
33
|
/auth status Show Andorra account session status
|
|
@@ -21,3 +21,25 @@ export interface FinalAnswerGateResult {
|
|
|
21
21
|
}
|
|
22
22
|
export declare function declaresUnfinishedWork(summary: string | undefined): boolean;
|
|
23
23
|
export declare function finalAnswerGate(input: FinalAnswerGateInput): FinalAnswerGateResult | undefined;
|
|
24
|
+
export interface ProseFinalAnswerInput {
|
|
25
|
+
text: string;
|
|
26
|
+
stopReason?: string;
|
|
27
|
+
/** The node declares exactly one outcome and that outcome ends the run. */
|
|
28
|
+
endsRun: boolean;
|
|
29
|
+
hasOutputSchema: boolean;
|
|
30
|
+
/** Someone is there to read the answer and reply to it. */
|
|
31
|
+
userPresent: boolean;
|
|
32
|
+
/** The run called a tool or wrote todos, or resumes an earlier invocation whose tool calls are not counted here. */
|
|
33
|
+
acted: boolean;
|
|
34
|
+
openTodos: number;
|
|
35
|
+
/** The response looks like a tool call the provider discarded. */
|
|
36
|
+
toolCallDropped: boolean;
|
|
37
|
+
/** The text carries a completion envelope written out as JSON. */
|
|
38
|
+
carriesEnvelope: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Whether a plain reply from a graph node is its final answer, so the node ends without a second
|
|
42
|
+
* request that only restates it through complete_agent. True only where nothing can be left undone
|
|
43
|
+
* or unrouted: no work was started, one outcome exists, it ends the run, and a user reads the reply.
|
|
44
|
+
*/
|
|
45
|
+
export declare function proseIsFinalAnswer(input: ProseFinalAnswerInput): boolean;
|
|
@@ -55,3 +55,14 @@ export function finalAnswerGate(input) {
|
|
|
55
55
|
}
|
|
56
56
|
return { gates, waived, message: `Completion not accepted yet. ${parts.join(' ')}${gates.includes('unfinished') ? '' : ' Then call complete_agent again.'}`, ...waiver };
|
|
57
57
|
}
|
|
58
|
+
const NATURAL_STOPS = [undefined, 'stop', 'end_turn'];
|
|
59
|
+
/**
|
|
60
|
+
* Whether a plain reply from a graph node is its final answer, so the node ends without a second
|
|
61
|
+
* request that only restates it through complete_agent. True only where nothing can be left undone
|
|
62
|
+
* or unrouted: no work was started, one outcome exists, it ends the run, and a user reads the reply.
|
|
63
|
+
*/
|
|
64
|
+
export function proseIsFinalAnswer(input) {
|
|
65
|
+
return input.endsRun && input.userPresent && !input.hasOutputSchema && !input.acted && input.openTodos === 0
|
|
66
|
+
&& !input.toolCallDropped && !input.carriesEnvelope && NATURAL_STOPS.includes(input.stopReason)
|
|
67
|
+
&& !!input.text.trim() && !declaresUnfinishedWork(input.text);
|
|
68
|
+
}
|
package/dist/src/config.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ export interface Config {
|
|
|
41
41
|
providers: ProviderConfig[];
|
|
42
42
|
graph?: string;
|
|
43
43
|
graphSelections?: Record<string, string>;
|
|
44
|
+
graphVisibility?: Record<string, Record<string, string[]>>;
|
|
45
|
+
graphVisibilityChosen?: Record<string, string[]>;
|
|
44
46
|
codeIntel?: CodeIntelConfig;
|
|
45
47
|
memory?: MemoryConfig;
|
|
46
48
|
analytics?: AnalyticsConfig;
|
|
@@ -107,6 +109,9 @@ export declare const MAX_SYSTEM_PROMPT_OVERRIDE = 16000;
|
|
|
107
109
|
export declare const AUTO_ARCHIVE_MIN_DAYS = 1;
|
|
108
110
|
export declare const AUTO_ARCHIVE_MAX_DAYS = 30;
|
|
109
111
|
export declare function configDirectory(environment?: NodeJS.ProcessEnv): string;
|
|
112
|
+
export declare const MAX_GRAPH_VISIBILITY_PROJECTS = 500;
|
|
113
|
+
/** Per account (subject), per graph id: the project paths the graph is listed in. A graph with no entry is listed everywhere. */
|
|
114
|
+
export declare function validGraphVisibility(value: unknown): value is Record<string, Record<string, string[]>>;
|
|
110
115
|
export declare function validateConfig(value: unknown): Config;
|
|
111
116
|
export declare function reconcileSubagentPair(config: Config): Config;
|
|
112
117
|
export declare function validateMcpServer(value: unknown): McpServerConfig;
|
package/dist/src/config.js
CHANGED
|
@@ -6,7 +6,9 @@ import { randomUUID } from 'node:crypto';
|
|
|
6
6
|
import { isIP } from 'node:net';
|
|
7
7
|
import { cleanModelName, fallbackProviderId } from './andorra/entry.js';
|
|
8
8
|
import { readHostedState } from './andorra/state.js';
|
|
9
|
+
import { isModelParameters } from './providers.js';
|
|
9
10
|
import { assertProviderCredentials, assertRequestTimeout, assertStreamIdleTimeout, MAX_CODEX_ACCOUNT_KEY_LENGTH, MAX_PROVIDER_NAME_LENGTH, PROVIDER_TYPES, REASONING_EFFORTS } from './providers.js';
|
|
11
|
+
import { GOOGLE_BASE_URL } from './google-provider.js';
|
|
10
12
|
import { GROK_BASE_URL } from './grok-provider.js';
|
|
11
13
|
import { ANDORRA_PROVIDER_BASE_URL } from './andorra/endpoint.js';
|
|
12
14
|
import { OPENCODE_BASE_URL } from './opencode-cli-provider.js';
|
|
@@ -129,6 +131,29 @@ function privateHttpHost(host) {
|
|
|
129
131
|
*/
|
|
130
132
|
function normaliseAndorraEntry(provider) {
|
|
131
133
|
provider.baseUrl = ANDORRA_PROVIDER_BASE_URL;
|
|
134
|
+
const usable = (model) => typeof model === 'string' && !!model.trim() && model.length <= 500 && !['__proto__', 'constructor', 'prototype'].includes(model);
|
|
135
|
+
// The sizes and the free list are descriptive, like the names: what cannot be shown is dropped, never refused.
|
|
136
|
+
if (provider.modelParameters !== undefined) {
|
|
137
|
+
const saved = provider.modelParameters;
|
|
138
|
+
const sizes = {};
|
|
139
|
+
if (saved && typeof saved === 'object' && !Array.isArray(saved)) {
|
|
140
|
+
for (const [model, size] of Object.entries(saved))
|
|
141
|
+
if (usable(model) && isModelParameters(size))
|
|
142
|
+
sizes[model] = size;
|
|
143
|
+
}
|
|
144
|
+
if (Object.keys(sizes).length > 0)
|
|
145
|
+
provider.modelParameters = sizes;
|
|
146
|
+
else
|
|
147
|
+
delete provider.modelParameters;
|
|
148
|
+
}
|
|
149
|
+
if (provider.freeModels !== undefined) {
|
|
150
|
+
const saved = provider.freeModels;
|
|
151
|
+
const free = Array.isArray(saved) ? [...new Set(saved.filter(usable))] : [];
|
|
152
|
+
if (free.length > 0)
|
|
153
|
+
provider.freeModels = free;
|
|
154
|
+
else
|
|
155
|
+
delete provider.freeModels;
|
|
156
|
+
}
|
|
132
157
|
if (provider.modelNames === undefined)
|
|
133
158
|
return;
|
|
134
159
|
const saved = provider.modelNames;
|
|
@@ -147,6 +172,17 @@ function normaliseAndorraEntry(provider) {
|
|
|
147
172
|
else
|
|
148
173
|
delete provider.modelNames;
|
|
149
174
|
}
|
|
175
|
+
export const MAX_GRAPH_VISIBILITY_PROJECTS = 500;
|
|
176
|
+
const isPlainRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
177
|
+
/** Per account (subject), per graph id: the project paths the graph is listed in. A graph with no entry is listed everywhere. */
|
|
178
|
+
export function validGraphVisibility(value) {
|
|
179
|
+
if (!isPlainRecord(value))
|
|
180
|
+
return false;
|
|
181
|
+
return Object.entries(value).every(([subject, graphs]) => /^[A-Za-z0-9-]{1,128}$/.test(subject) && isPlainRecord(graphs)
|
|
182
|
+
&& Object.entries(graphs).every(([graph, paths]) => /^[\w-]{1,128}$/.test(graph) && graph !== 'default' && Array.isArray(paths)
|
|
183
|
+
&& paths.length <= MAX_GRAPH_VISIBILITY_PROJECTS
|
|
184
|
+
&& paths.every(path => typeof path === 'string' && path.length > 0 && path.length <= 4096 && !path.includes('\0'))));
|
|
185
|
+
}
|
|
150
186
|
export function validateConfig(value) {
|
|
151
187
|
const c = value;
|
|
152
188
|
if (!c || c.version !== 1 || typeof c.provider !== 'string' || !Array.isArray(c.providers)) {
|
|
@@ -161,6 +197,11 @@ export function validateConfig(value) {
|
|
|
161
197
|
if (c.graphSelections !== undefined && (!c.graphSelections || typeof c.graphSelections !== 'object' || Array.isArray(c.graphSelections)
|
|
162
198
|
|| Object.entries(c.graphSelections).some(([subject, graph]) => !/^[A-Za-z0-9-]{1,128}$/.test(subject) || typeof graph !== 'string' || !/^[\w-]{1,128}$/.test(graph))))
|
|
163
199
|
throw new Error('Invalid account graph selections');
|
|
200
|
+
if (c.graphVisibility !== undefined && !validGraphVisibility(c.graphVisibility))
|
|
201
|
+
throw new Error('Invalid account graph visibility');
|
|
202
|
+
if (c.graphVisibilityChosen !== undefined && (!isPlainRecord(c.graphVisibilityChosen) || Object.entries(c.graphVisibilityChosen).some(([subject, graphs]) => !/^[A-Za-z0-9-]{1,128}$/.test(subject)
|
|
203
|
+
|| !Array.isArray(graphs) || graphs.some(graph => typeof graph !== 'string' || !/^[\w-]{1,128}$/.test(graph)))))
|
|
204
|
+
throw new Error('Invalid account graph visibility choices');
|
|
164
205
|
if (c.externalSubagent !== undefined && (!c.externalSubagent || typeof c.externalSubagent !== 'object' || Array.isArray(c.externalSubagent)
|
|
165
206
|
|| typeof c.externalSubagent.provider !== 'string' || !/^[\w-]+$/.test(c.externalSubagent.provider)
|
|
166
207
|
|| typeof c.externalSubagent.model !== 'string' || !c.externalSubagent.model.trim() || c.externalSubagent.model.length > 500)) {
|
|
@@ -271,6 +312,10 @@ export function validateConfig(value) {
|
|
|
271
312
|
throw new Error('Provider modelNames is an Andorra-only map of model ids to one-line display names of up to 80 characters');
|
|
272
313
|
}
|
|
273
314
|
}
|
|
315
|
+
// An Andorra entry's were normalised above; on any other provider the keys have no meaning.
|
|
316
|
+
if (p.type !== 'andorra' && (p.modelParameters !== undefined || p.freeModels !== undefined)) {
|
|
317
|
+
throw new Error('Provider modelParameters and freeModels are Andorra-only and maintained by Andorra Code');
|
|
318
|
+
}
|
|
274
319
|
if (p.reasoningEffort !== undefined && (!['openai-compatible', 'opencode-go', 'anthropic'].includes(p.type) || !REASONING_EFFORTS.includes(p.reasoningEffort))) {
|
|
275
320
|
throw new Error('Invalid reasoningEffort: use an OpenAI-compatible, OpenCode Go or Anthropic provider and none, minimal, low, medium, high, xhigh, or max');
|
|
276
321
|
}
|
|
@@ -299,6 +344,9 @@ export function validateConfig(value) {
|
|
|
299
344
|
if (p.type === 'grok' && p.baseUrl !== GROK_BASE_URL) {
|
|
300
345
|
throw new Error('Grok providers use the installed Grok CLI sign-in; custom endpoints are not supported');
|
|
301
346
|
}
|
|
347
|
+
if (p.type === 'google' && p.baseUrl !== GOOGLE_BASE_URL) {
|
|
348
|
+
throw new Error('Google providers use the installed Antigravity CLI sign-in; custom endpoints are not supported');
|
|
349
|
+
}
|
|
302
350
|
if (p.type === 'opencode' && p.baseUrl !== OPENCODE_BASE_URL) {
|
|
303
351
|
throw new Error('OpenCode providers use the installed OpenCode CLI; custom endpoints are not supported');
|
|
304
352
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type CliExecutableSpec } from './cli-executable.js';
|
|
2
|
+
import type { ModelAdapter, ModelResponse, ToolSchema } from './types.js';
|
|
3
|
+
export declare const GOOGLE_BASE_URL = "https://antigravity.google";
|
|
4
|
+
export declare const GOOGLE_EXECUTABLE: CliExecutableSpec;
|
|
5
|
+
export declare function googleEnvironment(source?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
6
|
+
export interface GoogleRunOptions {
|
|
7
|
+
input?: string;
|
|
8
|
+
captureStderr?: boolean;
|
|
9
|
+
acceptedExitCodes?: number[];
|
|
10
|
+
}
|
|
11
|
+
export type GoogleRun = (args: string[], signal: AbortSignal, options?: GoogleRunOptions) => Promise<{
|
|
12
|
+
stdout: string;
|
|
13
|
+
stderr: string;
|
|
14
|
+
}>;
|
|
15
|
+
export interface GoogleDependencies {
|
|
16
|
+
run?: GoogleRun;
|
|
17
|
+
}
|
|
18
|
+
export declare const runGoogleProcess: GoogleRun;
|
|
19
|
+
export declare function parseGoogleModels(output: string): {
|
|
20
|
+
signedIn: boolean;
|
|
21
|
+
models: string[];
|
|
22
|
+
};
|
|
23
|
+
export declare function readGoogleCatalog(signal: AbortSignal, dependencies?: GoogleDependencies): Promise<{
|
|
24
|
+
signedIn: boolean;
|
|
25
|
+
models: string[];
|
|
26
|
+
}>;
|
|
27
|
+
export declare function parseGoogleResponse(output: string, tools?: readonly Pick<ToolSchema, 'name'>[]): ModelResponse;
|
|
28
|
+
export declare function parseGoogleText(output: string): ModelResponse;
|
|
29
|
+
export declare function createGoogleAdapter(_config: {
|
|
30
|
+
model: string;
|
|
31
|
+
}, dependencies?: GoogleDependencies): ModelAdapter;
|