aegisone 1.0.8 → 1.0.10
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/README.md +2 -2
- package/bin/aegis.js +5 -0
- package/install.ps1 +5 -0
- package/install.sh +5 -0
- package/package.json +1 -1
- package/scripts/bump.mjs +5 -0
- package/scripts/bundle.js +5 -0
- package/scripts/predist.mjs +7 -0
- package/src/child.js +5 -0
- package/src/dispatch.js +5 -0
- package/src/doctor.js +5 -0
- package/src/host.js +5 -0
- package/src/permissions.js +5 -0
- package/src/probes.js +5 -0
- package/src/release.js +5 -0
- package/vendor/cli/bin/aegiscode.js +137 -0
- package/vendor/cli/package.json +1 -1
- package/vendor/cli/scripts/check.mjs +5 -0
- package/vendor/cli/scripts/demo.mjs +5 -0
- package/vendor/cli/scripts/predist.mjs +29 -2
- package/vendor/cli/scripts/runtests.mjs +5 -0
- package/vendor/cli/scripts/seal-gate.mjs +76 -0
- package/vendor/cli/src/agents.js +5 -0
- package/vendor/cli/src/app.js +5 -0
- package/vendor/cli/src/art.js +5 -0
- package/vendor/cli/src/autonomous.js +23 -0
- package/vendor/cli/src/caps.js +5 -0
- package/vendor/cli/src/chatflow.js +109 -31
- package/vendor/cli/src/checkpoint.js +5 -0
- package/vendor/cli/src/clipboard.js +5 -0
- package/vendor/cli/src/cloudsync.js +5 -0
- package/vendor/cli/src/commands.js +326 -14
- package/vendor/cli/src/config.js +5 -0
- package/vendor/cli/src/credentials.js +5 -0
- package/vendor/cli/src/deps.js +5 -0
- package/vendor/cli/src/devrun.js +5 -0
- package/vendor/cli/src/diff.js +5 -0
- package/vendor/cli/src/diffview.js +5 -0
- package/vendor/cli/src/engine.js +5 -0
- package/vendor/cli/src/entitlement.js +5 -0
- package/vendor/cli/src/events.js +15 -0
- package/vendor/cli/src/export.js +5 -0
- package/vendor/cli/src/fingerprint.js +5 -0
- package/vendor/cli/src/format.js +5 -0
- package/vendor/cli/src/fuzzy.js +5 -0
- package/vendor/cli/src/gate.js +12 -0
- package/vendor/cli/src/history.js +5 -0
- package/vendor/cli/src/init.js +5 -0
- package/vendor/cli/src/input.js +5 -0
- package/vendor/cli/src/keys.js +34 -2
- package/vendor/cli/src/limits.js +192 -0
- package/vendor/cli/src/markdown.js +5 -0
- package/vendor/cli/src/mcp.js +13 -0
- package/vendor/cli/src/models.js +5 -0
- package/vendor/cli/src/naming.js +5 -0
- package/vendor/cli/src/overlays.js +12 -2
- package/vendor/cli/src/panels.js +5 -0
- package/vendor/cli/src/permissions.js +56 -1
- package/vendor/cli/src/ping.js +5 -0
- package/vendor/cli/src/presence.js +5 -0
- package/vendor/cli/src/provenance.js +238 -0
- package/vendor/cli/src/provenance.lock.json +36 -0
- package/vendor/cli/src/render.js +5 -0
- package/vendor/cli/src/screen.js +5 -0
- package/vendor/cli/src/screens.js +53 -37
- package/vendor/cli/src/secret.js +5 -0
- package/vendor/cli/src/securefs.js +5 -0
- package/vendor/cli/src/settings.js +5 -0
- package/vendor/cli/src/shared.js +5 -0
- package/vendor/cli/src/sharedpaths.js +5 -0
- package/vendor/cli/src/signup.js +5 -0
- package/vendor/cli/src/summarize.js +5 -0
- package/vendor/cli/src/sysdiag.js +587 -0
- package/vendor/cli/src/system.js +5 -0
- package/vendor/cli/src/theme.js +5 -0
- package/vendor/cli/src/title.js +5 -0
- package/vendor/cli/src/todos.js +5 -0
- package/vendor/cli/src/tokens.js +5 -0
- package/vendor/cli/src/topup.js +5 -0
- package/vendor/cli/src/update.js +5 -0
- package/vendor/cli/vendor/client/aegis.js +5 -0
- package/vendor/cli/vendor/client/attest.js +5 -0
- package/vendor/cli/vendor/client/authorship-key.js +5 -0
- package/vendor/cli/vendor/client/auto-provision.js +5 -0
- package/vendor/cli/vendor/client/brain-catalog.js +5 -0
- package/vendor/cli/vendor/client/byok-catalog.js +5 -0
- package/vendor/cli/vendor/client/credentials.js +5 -0
- package/vendor/cli/vendor/client/device-fingerprint.js +5 -0
- package/vendor/cli/vendor/client/env-file.js +5 -0
- package/vendor/cli/vendor/client/fingerprint.js +5 -0
- package/vendor/cli/vendor/client/foreign-memory.js +5 -0
- package/vendor/cli/vendor/client/hooks.js +5 -0
- package/vendor/cli/vendor/client/model-discovery.js +332 -0
- package/vendor/cli/vendor/client/platform.js +5 -0
- package/vendor/cli/vendor/client/prefs.js +5 -0
- package/vendor/cli/vendor/client/presence-constants.js +5 -0
- package/vendor/cli/vendor/client/presence.js +5 -0
- package/vendor/cli/vendor/client/record-vault.js +5 -0
- package/vendor/cli/vendor/client/session-store.js +5 -0
- package/vendor/cli/vendor/client/topup.js +5 -0
- package/vendor/cli/vendor/client/touch.js +5 -0
- package/vendor/cli/vendor/client/update.js +5 -0
- package/vendor/cli/vendor/client/user-models.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/cli/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/autonomous.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/engine.js +129 -0
- package/vendor/cli/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/cli/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/cli/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/cli/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/cli/vendor/desktop/lib/settings.js +5 -0
- package/vendor/cli/vendor/desktop/renderer/usage.js +5 -0
- package/vendor/cli/vendor/mcp/server.js +5 -0
- package/vendor/cli/vendor/mcp/tools.js +5 -0
- package/vendor/cli/vendor/tools/agent-gate.mjs +23 -0
- package/vendor/desktop/bin/aegis.js +5 -0
- package/vendor/desktop/lib/auto.js +5 -0
- package/vendor/desktop/lib/avatar/companion.js +5 -0
- package/vendor/desktop/lib/avatar/cosmetics.js +5 -0
- package/vendor/desktop/lib/avatar/events.js +5 -0
- package/vendor/desktop/lib/avatar/holder-turn.js +5 -0
- package/vendor/desktop/lib/avatar/holders.js +5 -0
- package/vendor/desktop/lib/avatar/identity.js +5 -0
- package/vendor/desktop/lib/avatar/level.js +5 -0
- package/vendor/desktop/lib/avatar/mirror.js +5 -0
- package/vendor/desktop/lib/avatar/persona.js +5 -0
- package/vendor/desktop/lib/avatar/profile.js +5 -0
- package/vendor/desktop/lib/avatar/register.js +5 -0
- package/vendor/desktop/lib/avatar/store.js +5 -0
- package/vendor/desktop/lib/avatar/tiers.js +5 -0
- package/vendor/desktop/lib/avatar/transfer.js +5 -0
- package/vendor/desktop/lib/avatar/turn.js +5 -0
- package/vendor/desktop/lib/avatar/voice.js +5 -0
- package/vendor/desktop/lib/avatar/xp.js +5 -0
- package/vendor/desktop/lib/deep-link.js +5 -0
- package/vendor/desktop/lib/fingerprint.js +5 -0
- package/vendor/desktop/lib/local/aegis-seal.mjs +5 -0
- package/vendor/desktop/lib/local/agents.js +5 -0
- package/vendor/desktop/lib/local/autonomous.js +5 -0
- package/vendor/desktop/lib/local/context.js +5 -0
- package/vendor/desktop/lib/local/covenant.js +5 -0
- package/vendor/desktop/lib/local/engine.js +129 -0
- package/vendor/desktop/lib/local/entitlement.js +5 -0
- package/vendor/desktop/lib/local/git-scope.js +5 -0
- package/vendor/desktop/lib/local/local.js +5 -0
- package/vendor/desktop/lib/local/prompt.js +5 -0
- package/vendor/desktop/lib/local/queue.js +5 -0
- package/vendor/desktop/lib/local/session-rounds.js +5 -0
- package/vendor/desktop/lib/local/shell.js +88 -9
- package/vendor/desktop/lib/local/telemetry.js +5 -0
- package/vendor/desktop/lib/local/tools.js +13 -6
- package/vendor/desktop/lib/local/turn-guard.js +5 -0
- package/vendor/desktop/lib/local/worktree-lock.js +5 -0
- package/vendor/desktop/lib/provider-key-mirror.js +5 -0
- package/vendor/desktop/lib/quick-launcher.js +5 -0
- package/vendor/desktop/lib/settings.js +5 -0
- package/vendor/desktop/lib/sync/memory-queue.js +5 -0
- package/vendor/desktop/lib/sync/persist-gate.js +5 -0
- package/vendor/desktop/lib/sync/sessions.js +5 -0
- package/vendor/desktop/lib/window-state.js +5 -0
- package/vendor/desktop/main.js +34 -0
- package/vendor/desktop/package.json +1 -1
- package/vendor/desktop/preload.js +14 -0
- package/vendor/desktop/renderer/app.js +111 -0
- package/vendor/desktop/renderer/avatar/assemble.js +5 -0
- package/vendor/desktop/renderer/avatar/avatar.css +7 -0
- package/vendor/desktop/renderer/avatar/avatar.js +5 -0
- package/vendor/desktop/renderer/avatar/cards.js +5 -0
- package/vendor/desktop/renderer/avatar/hud.js +5 -0
- package/vendor/desktop/renderer/avatar/machine.js +5 -0
- package/vendor/desktop/renderer/avatar/pane.js +5 -0
- package/vendor/desktop/renderer/avatar/parts.js +5 -0
- package/vendor/desktop/renderer/budget.js +5 -0
- package/vendor/desktop/renderer/diff.js +5 -0
- package/vendor/desktop/renderer/diffview.js +5 -0
- package/vendor/desktop/renderer/fingerprint.css +7 -0
- package/vendor/desktop/renderer/fingerprint.js +5 -0
- package/vendor/desktop/renderer/fonts/fonts.css +7 -0
- package/vendor/desktop/renderer/index.html +7 -0
- package/vendor/desktop/renderer/markdown.js +5 -0
- package/vendor/desktop/renderer/quick.css +7 -0
- package/vendor/desktop/renderer/quick.html +7 -0
- package/vendor/desktop/renderer/quick.js +5 -0
- package/vendor/desktop/renderer/stream-policy.js +5 -0
- package/vendor/desktop/renderer/style.css +7 -0
- package/vendor/desktop/renderer/transcript-view.js +5 -0
- package/vendor/desktop/renderer/usage.js +5 -0
- package/vendor/desktop/vendor/aegis.js +5 -0
- package/vendor/desktop/vendor/agent-gate.mjs +23 -0
- package/vendor/desktop/vendor/attest.js +5 -0
- package/vendor/desktop/vendor/authorship-key.js +5 -0
- package/vendor/desktop/vendor/auto-provision.js +5 -0
- package/vendor/desktop/vendor/brain-catalog.js +5 -0
- package/vendor/desktop/vendor/byok-catalog.js +5 -0
- package/vendor/desktop/vendor/credentials.js +5 -0
- package/vendor/desktop/vendor/device-fingerprint.js +5 -0
- package/vendor/desktop/vendor/env-file.js +5 -0
- package/vendor/desktop/vendor/fingerprint.js +5 -0
- package/vendor/desktop/vendor/foreign-memory.js +5 -0
- package/vendor/desktop/vendor/hooks.js +5 -0
- package/vendor/desktop/vendor/model-discovery.js +332 -0
- package/vendor/desktop/vendor/platform.js +5 -0
- package/vendor/desktop/vendor/prefs.js +5 -0
- package/vendor/desktop/vendor/presence-constants.js +5 -0
- package/vendor/desktop/vendor/presence.js +5 -0
- package/vendor/desktop/vendor/record-vault.js +5 -0
- package/vendor/desktop/vendor/session-store.js +5 -0
- package/vendor/desktop/vendor/topup.js +5 -0
- package/vendor/desktop/vendor/touch.js +5 -0
- package/vendor/desktop/vendor/update.js +5 -0
- package/vendor/desktop/vendor/user-models.js +5 -0
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -372,6 +377,10 @@ function shortcutsGrid(cols, ctx) {
|
|
|
372
377
|
cell('/', 'for commands', '?', 'for shortcuts'),
|
|
373
378
|
cell('ctrl + c', 'to quit', 'ctrl + o', 'for permissions'),
|
|
374
379
|
cell('alt + p', 'to switch model', 'alt + t', 'to toggle thinking'),
|
|
380
|
+
// The shift chords the two pickers commit with. They are on the sheet for
|
|
381
|
+
// the same reason every other row is: `handleOverlayKey` handles them now,
|
|
382
|
+
// and a key a user cannot read about is a key that does not exist.
|
|
383
|
+
cell('shift + ↑/↓', 'pins as it moves', 'shift + enter', 'runs the row'),
|
|
375
384
|
cell('esc', 'to interrupt a turn', 'ctrl + l', 'to clear the screen'),
|
|
376
385
|
cell('ctrl + t', 'to show tokens', 'ctrl + r', 'to resume a session'),
|
|
377
386
|
cell('↑ / ↓', 'for history', 'tab', 'to complete a command'),
|
|
@@ -901,6 +910,18 @@ async function runSession(host) {
|
|
|
901
910
|
const lineCache = new WeakMap();
|
|
902
911
|
|
|
903
912
|
let overlay = null;
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* The palette's rows: the ONE ranking the frame draws and the key handlers
|
|
916
|
+
* act on. Tab and Enter each wrote this expression out in full, which is two
|
|
917
|
+
* chances for the row that is completed or run to be a different row than the
|
|
918
|
+
* one highlighted. A function declaration so `render`'s closure can call it
|
|
919
|
+
* whatever order the definitions are initialised in.
|
|
920
|
+
*/
|
|
921
|
+
function paletteRows(query) {
|
|
922
|
+
const q = paletteQuery(query == null ? (overlay && overlay.query) || '' : query);
|
|
923
|
+
return fuzzy.fuzzyRankWithAliases(q, host.visibleCommands(), (c) => c.name, (c) => c.aliases || []);
|
|
924
|
+
}
|
|
904
925
|
// Automode's running tally of silent "continue" answers to the round-budget
|
|
905
926
|
// dialog (see autoContinuePlan above). Cleared whenever the human is
|
|
906
927
|
// actually asked (autoContinuePlan resets it once the allowance is spent),
|
|
@@ -1998,6 +2019,24 @@ async function runSession(host) {
|
|
|
1998
2019
|
}
|
|
1999
2020
|
};
|
|
2000
2021
|
|
|
2022
|
+
/**
|
|
2023
|
+
* Pin a model row — the ONE path a row is applied through, shared by Enter,
|
|
2024
|
+
* shift+enter and the shift+arrow chord. Written out once because applying a
|
|
2025
|
+
* model is not just a config write: it may have to move the class first and
|
|
2026
|
+
* it may have to collect the provider key the row needs. A second apply path
|
|
2027
|
+
* would eventually skip one of those (the reference's own picker pinned the
|
|
2028
|
+
* id and left the class behind), and the user would be running on a model
|
|
2029
|
+
* whose key this machine does not hold.
|
|
2030
|
+
*/
|
|
2031
|
+
const applyModelRow = async (chosen) => {
|
|
2032
|
+
if (!chosen) return;
|
|
2033
|
+
if (chosen.cls === 'byok' && ctx.modelClass !== 'byok') await dispatch('/class byok');
|
|
2034
|
+
ctx.model = chosen.id;
|
|
2035
|
+
host.updateConfig({ model: chosen.id, currentModelId: chosen.id, modelClass: ctx.modelClass });
|
|
2036
|
+
note(`model: ${chosen.id}${chosen.cls === 'byok' ? ' (byok)' : ''}`);
|
|
2037
|
+
await collectKeyFor(chosen);
|
|
2038
|
+
};
|
|
2039
|
+
|
|
2001
2040
|
const handleOverlayKey = async (key) => {
|
|
2002
2041
|
const type = overlay.type;
|
|
2003
2042
|
if (key.name === KEY.ESC || key.name === KEY.CTRL_C) {
|
|
@@ -2011,16 +2050,11 @@ async function runSession(host) {
|
|
|
2011
2050
|
return;
|
|
2012
2051
|
}
|
|
2013
2052
|
if (key.name === KEY.TAB && type === 'palette') {
|
|
2014
|
-
// Tab completes the query to the highlighted command
|
|
2015
|
-
// same
|
|
2016
|
-
// row
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
host.visibleCommands(),
|
|
2020
|
-
(c) => c.name,
|
|
2021
|
-
(c) => c.aliases || []
|
|
2022
|
-
);
|
|
2023
|
-
const chosen = list[overlay.sel || 0];
|
|
2053
|
+
// Tab completes the query to the highlighted command. The ranking is
|
|
2054
|
+
// `paletteRows()`, the same list the frame drew and Enter runs, so the
|
|
2055
|
+
// row completed is the row highlighted. Nothing highlighted (no matches)
|
|
2056
|
+
// → do nothing.
|
|
2057
|
+
const chosen = paletteRows()[overlay.sel || 0];
|
|
2024
2058
|
if (chosen) {
|
|
2025
2059
|
overlay.query = chosen.name;
|
|
2026
2060
|
overlay.sel = 0;
|
|
@@ -2032,13 +2066,7 @@ async function runSession(host) {
|
|
|
2032
2066
|
if (type === 'palette') {
|
|
2033
2067
|
// Rank with the same function the palette rendered with, so the row
|
|
2034
2068
|
// highlighted is the row Enter runs.
|
|
2035
|
-
const
|
|
2036
|
-
paletteQuery(overlay.query),
|
|
2037
|
-
host.visibleCommands(),
|
|
2038
|
-
(c) => c.name,
|
|
2039
|
-
(c) => c.aliases || []
|
|
2040
|
-
);
|
|
2041
|
-
const chosen = list[overlay.sel || 0];
|
|
2069
|
+
const chosen = paletteRows()[overlay.sel || 0];
|
|
2042
2070
|
const arg = String(overlay.query || '').trim().split(/\s+/).slice(1).join(' ');
|
|
2043
2071
|
overlay = null;
|
|
2044
2072
|
render();
|
|
@@ -2051,20 +2079,7 @@ async function runSession(host) {
|
|
|
2051
2079
|
const chosen = (overlay.items || [])[overlay.sel || 0];
|
|
2052
2080
|
overlay = null;
|
|
2053
2081
|
render();
|
|
2054
|
-
|
|
2055
|
-
// A direct-provider (byok) row needs the class the id actually
|
|
2056
|
-
// belongs to before the pin can route anywhere.
|
|
2057
|
-
if (chosen.cls === 'byok' && ctx.modelClass !== 'byok') await dispatch('/class byok');
|
|
2058
|
-
ctx.model = chosen.id;
|
|
2059
|
-
host.updateConfig({ model: chosen.id, currentModelId: chosen.id, modelClass: ctx.modelClass });
|
|
2060
|
-
note(`model: ${chosen.id}${chosen.cls === 'byok' ? ' (byok)' : ''}`);
|
|
2061
|
-
// Then the key, if this row needs one this machine does not have —
|
|
2062
|
-
// collected here rather than as a warning to run some command
|
|
2063
|
-
// afterward. See collectKeyFor: the decision comes from the shared
|
|
2064
|
-
// env-file module, so the variable a key is written to is the same
|
|
2065
|
-
// one the desktop reads, instead of each host keeping a private copy.
|
|
2066
|
-
await collectKeyFor(chosen);
|
|
2067
|
-
}
|
|
2082
|
+
await applyModelRow(chosen);
|
|
2068
2083
|
render();
|
|
2069
2084
|
return;
|
|
2070
2085
|
}
|
|
@@ -2092,6 +2107,69 @@ async function runSession(host) {
|
|
|
2092
2107
|
render();
|
|
2093
2108
|
return;
|
|
2094
2109
|
}
|
|
2110
|
+
if (key.name === KEY.SHIFT_UP || key.name === KEY.SHIFT_DOWN) {
|
|
2111
|
+
// Shift is the one-keystroke commit in the two pickers that write a
|
|
2112
|
+
// setting: it moves the highlight one row in the pressed direction and
|
|
2113
|
+
// applies THAT row immediately, so changing the model is a single key
|
|
2114
|
+
// instead of point-then-Enter. It routes into the same apply paths Enter
|
|
2115
|
+
// uses, so the chord cannot pin a model Enter would refuse to pin, skip
|
|
2116
|
+
// the provider-key prompt a byok row needs, or store an effort level the
|
|
2117
|
+
// picker's own table does not contain.
|
|
2118
|
+
const step = key.name === KEY.SHIFT_UP ? -1 : 1;
|
|
2119
|
+
const max = Math.max(0, overlayRowCount() - 1);
|
|
2120
|
+
overlay.sel = Math.min(max, Math.max(0, (overlay.sel || 0) + step));
|
|
2121
|
+
if (type === 'model') {
|
|
2122
|
+
const chosen = (overlay.items || [])[overlay.sel || 0];
|
|
2123
|
+
overlay = null;
|
|
2124
|
+
render();
|
|
2125
|
+
await applyModelRow(chosen);
|
|
2126
|
+
render();
|
|
2127
|
+
return;
|
|
2128
|
+
}
|
|
2129
|
+
if (type === 'effort') {
|
|
2130
|
+
const chosen = overlays.EFFORT_VALUES[overlay.sel || 0];
|
|
2131
|
+
overlay = null;
|
|
2132
|
+
ctx.effort = chosen || 'high';
|
|
2133
|
+
host.updateConfig({ effort: ctx.effort });
|
|
2134
|
+
note(`effort: ${ctx.effort}`);
|
|
2135
|
+
render();
|
|
2136
|
+
return;
|
|
2137
|
+
}
|
|
2138
|
+
render();
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
if (key.name === KEY.SHIFT_ENTER) {
|
|
2142
|
+
// The same commit as Enter, in the spelling terminals that have no other
|
|
2143
|
+
// way to send it: on the palette it runs the highlighted command without
|
|
2144
|
+
// the user reaching for the Enter key proper, and in a picker it applies
|
|
2145
|
+
// the highlighted row. Both read the same sel/items every other path
|
|
2146
|
+
// reads, so the chord cannot run a different row than the frame drew.
|
|
2147
|
+
if (type === 'palette') {
|
|
2148
|
+
const chosen = paletteRows()[overlay.sel || 0];
|
|
2149
|
+
overlay = null;
|
|
2150
|
+
render();
|
|
2151
|
+
if (chosen) await dispatch(`/${chosen.name}`);
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
if (type === 'model') {
|
|
2155
|
+
const chosen = (overlay.items || [])[overlay.sel || 0];
|
|
2156
|
+
overlay = null;
|
|
2157
|
+
render();
|
|
2158
|
+
await applyModelRow(chosen);
|
|
2159
|
+
render();
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
if (type === 'effort') {
|
|
2163
|
+
const chosen = overlays.EFFORT_VALUES[overlay.sel || 0];
|
|
2164
|
+
overlay = null;
|
|
2165
|
+
ctx.effort = chosen || 'high';
|
|
2166
|
+
host.updateConfig({ effort: ctx.effort });
|
|
2167
|
+
note(`effort: ${ctx.effort}`);
|
|
2168
|
+
render();
|
|
2169
|
+
return;
|
|
2170
|
+
}
|
|
2171
|
+
return;
|
|
2172
|
+
}
|
|
2095
2173
|
if (key.name === KEY.UP) {
|
|
2096
2174
|
overlay.sel = Math.max(0, (overlay.sel || 0) - 1);
|
|
2097
2175
|
render();
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -93,6 +98,9 @@ const { pickerEntries } = require('./models.js');
|
|
|
93
98
|
const { resolveShared } = require('./sharedpaths.js');
|
|
94
99
|
const { createCliEntitlement, paymentView, probeFee } = require('./entitlement.js');
|
|
95
100
|
const { openUrl, URLS } = require('./system.js');
|
|
101
|
+
// The machine checks behind `/doctor system` — see cli/src/sysdiag.js for why
|
|
102
|
+
// they exist and why they never mutate anything.
|
|
103
|
+
const sysdiag = require('./sysdiag.js');
|
|
96
104
|
const { sniffProject, buildAegisMd } = require('./init.js');
|
|
97
105
|
const { upgradeAdvice, latestPublishedVersion } = require('./update.js');
|
|
98
106
|
const {
|
|
@@ -410,8 +418,120 @@ const {
|
|
|
410
418
|
withUserModels,
|
|
411
419
|
addUserModel,
|
|
412
420
|
removeUserModel,
|
|
421
|
+
userModelIdsFor,
|
|
422
|
+
userModelsPath,
|
|
413
423
|
} = require(resolveShared(path.join('client', 'user-models.js')));
|
|
414
424
|
|
|
425
|
+
/**
|
|
426
|
+
* Ask the VENDOR what it serves (`client/model-discovery.js`), so `/model-add`
|
|
427
|
+
* can offer a list instead of asking the user to recall an id.
|
|
428
|
+
*
|
|
429
|
+
* Same `resolveShared` resolution as its two siblings above: one implementation
|
|
430
|
+
* of "what does this provider's key actually reach", read by both faces. It is
|
|
431
|
+
* loaded at module scope rather than lazily inside the handler because the
|
|
432
|
+
* command needs it to decide what to PROMPT with — a discovery module that
|
|
433
|
+
* loads only after discovery was decided to be possible would be circular.
|
|
434
|
+
*
|
|
435
|
+
* The module does no I/O at load (no key store, no network), so pulling it in
|
|
436
|
+
* with `/help` costs a `require` and nothing else.
|
|
437
|
+
*/
|
|
438
|
+
const {
|
|
439
|
+
discoverModels: discoverVendorModels,
|
|
440
|
+
endpointFor: vendorEndpointFor,
|
|
441
|
+
discoverableProviders,
|
|
442
|
+
} = require(resolveShared(path.join('client', 'model-discovery.js')));
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* The vendor key for a provider, resolved the way the engine resolves it:
|
|
446
|
+
* the saved provider-key row first, then `~/.aegiscode/.env` (and the shell).
|
|
447
|
+
*
|
|
448
|
+
* Deliberately the same ORDER as `desktop/lib/local/engine.js`'s
|
|
449
|
+
* `providerKeyFromEnv` + `byok:<provider>` lookup, because discovery must use
|
|
450
|
+
* the key the NEXT TURN will use — a listing fetched with a different key than
|
|
451
|
+
* the one the call runs on is a listing of somebody else's catalog. This is
|
|
452
|
+
* read-only: it never writes a key, never logs one, and returns '' when the
|
|
453
|
+
* machine has none, which the caller reports as "no key to ask with".
|
|
454
|
+
*/
|
|
455
|
+
function byokKeyForProvider(c, provider) {
|
|
456
|
+
const id = String(provider || '').trim().toLowerCase();
|
|
457
|
+
if (!id) return '';
|
|
458
|
+
try {
|
|
459
|
+
const store = c && c.settings && c.settings();
|
|
460
|
+
if (store && typeof store.rawKey === 'function' && typeof c.byokNamespace === 'function') {
|
|
461
|
+
const saved = store.rawKey(c.byokNamespace(id));
|
|
462
|
+
if (typeof saved === 'string' && saved.trim()) return saved.trim();
|
|
463
|
+
}
|
|
464
|
+
} catch {
|
|
465
|
+
/* a store that throws is a store with no key, not a reason to stop */
|
|
466
|
+
}
|
|
467
|
+
try {
|
|
468
|
+
const { providerKeyFromEnv } = require(resolveShared(path.join('client', 'env-file.js')));
|
|
469
|
+
return (providerKeyFromEnv(id) || {}).key || '';
|
|
470
|
+
} catch {
|
|
471
|
+
return '';
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Ask the provider's own list endpoint, if this machine can. Never throws.
|
|
477
|
+
*
|
|
478
|
+
* `fetchImpl` is injectable through the context so the CLI tests drive a stub
|
|
479
|
+
* and never open a socket; `c.fetchImpl` is undefined in a real run, which is
|
|
480
|
+
* the module's normal `fetch`.
|
|
481
|
+
*/
|
|
482
|
+
async function discoverProviderModels(c, provider, key) {
|
|
483
|
+
try {
|
|
484
|
+
return await discoverVendorModels(provider, { key, fetchImpl: c && c.fetchImpl });
|
|
485
|
+
} catch (err) {
|
|
486
|
+
return { ok: false, provider, supported: true, error: (err && err.message) || String(err) };
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* The provider's own catalog, best-effort, as `[ids]`. Undefined when the
|
|
492
|
+
* vendor could not be asked — the caller then falls back to a free-form id
|
|
493
|
+
* prompt, because that path works and must keep working offline.
|
|
494
|
+
*/
|
|
495
|
+
async function offeredModelIds(c, provider, key) {
|
|
496
|
+
const res = await discoverProviderModels(c, provider, key);
|
|
497
|
+
return res && res.ok && Array.isArray(res.ids) && res.ids.length ? res.ids : undefined;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Declare ids into the store, skipping the ones already there. Returns the
|
|
502
|
+
* count added, plus what was skipped and WHY, so the caller can say
|
|
503
|
+
* "3 added, 2 already declared" instead of claiming work it did not do.
|
|
504
|
+
*
|
|
505
|
+
* The cap matters here more than anywhere else: a vendor's list endpoint
|
|
506
|
+
* answers with everything it serves — OpenAI currently returns 100 ids — and
|
|
507
|
+
* the store holds at most 32 per provider by design. Without this the bulk
|
|
508
|
+
* path would report sixty-eight "refused" models, which reads as sixty-eight
|
|
509
|
+
* broken ids rather than one deliberate ceiling. So the cap ends the batch and
|
|
510
|
+
* is reported as itself.
|
|
511
|
+
*/
|
|
512
|
+
function addManyUserModels(provider, ids) {
|
|
513
|
+
let added = 0;
|
|
514
|
+
let capped = 0;
|
|
515
|
+
const already = [];
|
|
516
|
+
const failed = [];
|
|
517
|
+
for (const id of ids) {
|
|
518
|
+
try {
|
|
519
|
+
if (addUserModel(provider, id).added) added += 1;
|
|
520
|
+
else already.push(id);
|
|
521
|
+
} catch (err) {
|
|
522
|
+
const message = (err && err.message) || String(err);
|
|
523
|
+
if (/the cap/.test(message)) {
|
|
524
|
+
// Every remaining id would hit the same wall, so stop rather than
|
|
525
|
+
// loop sixty more times to collect sixty copies of one message.
|
|
526
|
+
capped = ids.length - added - already.length - failed.length;
|
|
527
|
+
break;
|
|
528
|
+
}
|
|
529
|
+
failed.push({ id, reason: message });
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
return { added, already, failed, capped };
|
|
533
|
+
}
|
|
534
|
+
|
|
415
535
|
/**
|
|
416
536
|
* The server's BYOK provider catalog, or null when it cannot be reached.
|
|
417
537
|
*
|
|
@@ -1630,12 +1750,12 @@ const COMMANDS = [
|
|
|
1630
1750
|
},
|
|
1631
1751
|
},
|
|
1632
1752
|
{
|
|
1633
|
-
name: 'doctor', args: ['action'], hint: '[fix]', category: 'support',
|
|
1753
|
+
name: 'doctor', args: ['action'], hint: '[fix|system]', category: 'support',
|
|
1634
1754
|
desc: 'Run diagnostic checks on this environment',
|
|
1635
1755
|
handler: async (c, args) => {
|
|
1636
1756
|
const action = ((args && args.action) || '').toLowerCase();
|
|
1637
|
-
if (action && action !== 'fix') {
|
|
1638
|
-
note(c, 'Usage: /doctor [fix] — "fix" re-tightens the data dir to 0700/0600');
|
|
1757
|
+
if (action && action !== 'fix' && action !== 'system') {
|
|
1758
|
+
note(c, 'Usage: /doctor [fix|system] — "fix" re-tightens the data dir to 0700/0600, "system" checks the machine itself');
|
|
1639
1759
|
c.render();
|
|
1640
1760
|
return true;
|
|
1641
1761
|
}
|
|
@@ -1710,6 +1830,29 @@ const COMMANDS = [
|
|
|
1710
1830
|
repaired.failed.map((f) => `${f.rel}: ${f.reason}`).join(', ')
|
|
1711
1831
|
);
|
|
1712
1832
|
}
|
|
1833
|
+
// `/doctor system` — the machine, not the checkout. Read-only by design:
|
|
1834
|
+
// cli/src/sysdiag.js holds the nine checks and each one's remedy, and
|
|
1835
|
+
// nothing here executes a remedy, because all of them need elevation and
|
|
1836
|
+
// the ordering matters (VSS has to survive DoSnapshotSet before a restore
|
|
1837
|
+
// point can exist). An unread probe is its own state, never a ✔.
|
|
1838
|
+
let systemReport = null;
|
|
1839
|
+
if (action === 'system') {
|
|
1840
|
+
const probe = sysdiag.collect();
|
|
1841
|
+
if (!probe.ok) {
|
|
1842
|
+
ok(
|
|
1843
|
+
'machine checks',
|
|
1844
|
+
false,
|
|
1845
|
+
probe.reason === 'not-windows'
|
|
1846
|
+
? 'not available on this platform — the machine audit is Windows-only (cli/src/sysdiag.js)'
|
|
1847
|
+
: `could not run: ${probe.reason}`,
|
|
1848
|
+
);
|
|
1849
|
+
} else {
|
|
1850
|
+
systemReport = sysdiag.assess(probe.data);
|
|
1851
|
+
for (const f of systemReport.findings) ok(`${f.title} (${f.severity})`, false, `${f.detail} → ${f.remedyText}`);
|
|
1852
|
+
for (const p of systemReport.clean) ok(p.title, true, p.detail);
|
|
1853
|
+
for (const u of systemReport.unassessed) ok(`${u.title} (unassessed)`, false, u.reason);
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1713
1856
|
const lines = [[span(C.gold + BOLD, 'Doctor'), span(BOLD_OFF, '')], [span(C.gray, '─'.repeat(30))]];
|
|
1714
1857
|
for (const [good, label, detail] of checks) {
|
|
1715
1858
|
lines.push([
|
|
@@ -1718,6 +1861,15 @@ const COMMANDS = [
|
|
|
1718
1861
|
span(C.gray, String(detail)),
|
|
1719
1862
|
]);
|
|
1720
1863
|
}
|
|
1864
|
+
if (systemReport && systemReport.findings.length) {
|
|
1865
|
+
const s = systemReport.summary;
|
|
1866
|
+
lines.push([
|
|
1867
|
+
span(C.gold, ' Remedy'),
|
|
1868
|
+
span(C.gray, ` — ${s.findings} finding(s) across ${s.assessed}/${s.total} measured checks.`),
|
|
1869
|
+
]);
|
|
1870
|
+
lines.push([span(C.gray, ' Run in an ELEVATED PowerShell. AEGIS diagnoses this; it does not change your machine.')]);
|
|
1871
|
+
for (const line of sysdiag.remedyScript().split('\n')) lines.push([span(C.gray, ` ${line}`)]);
|
|
1872
|
+
}
|
|
1721
1873
|
panel(c, lines);
|
|
1722
1874
|
c.render();
|
|
1723
1875
|
return true;
|
|
@@ -3010,9 +3162,9 @@ const COMMANDS = [
|
|
|
3010
3162
|
// the next refresh and the window shows it on ITS next refresh. The file is
|
|
3011
3163
|
// printed on success, because a hand-edit is the bulk path and a store the
|
|
3012
3164
|
// user cannot find is a store they will not use.
|
|
3013
|
-
name: 'model-add', aliases: ['add-model'], args: ['provider'], hint: '<provider>
|
|
3165
|
+
name: 'model-add', aliases: ['add-model'], args: ['provider'], hint: '<provider> [model-id|*]',
|
|
3014
3166
|
category: 'model',
|
|
3015
|
-
desc: 'Offer a model id the AEGIS catalog does not name (
|
|
3167
|
+
desc: 'Offer a model id the AEGIS catalog does not name (asks the vendor when it can)',
|
|
3016
3168
|
handler: async (c, a) => {
|
|
3017
3169
|
const args = a || {};
|
|
3018
3170
|
const typed = String(args.provider || '').trim();
|
|
@@ -3023,15 +3175,6 @@ const COMMANDS = [
|
|
|
3023
3175
|
const rest = String(args._rest || '').trim();
|
|
3024
3176
|
const sp = rest.indexOf(' ');
|
|
3025
3177
|
let model = sp === -1 ? '' : rest.slice(sp + 1).trim();
|
|
3026
|
-
if (!model) {
|
|
3027
|
-
// Plain inline input, NOT readSecret: a model id is not a secret, and
|
|
3028
|
-
// hiding it would make a typo unreviewable before it is stored.
|
|
3029
|
-
model = String((await c.askInput(`model id for ${typed}: `)) || '').trim();
|
|
3030
|
-
}
|
|
3031
|
-
if (!model) {
|
|
3032
|
-
c.push({ role: 'note', text: 'nothing saved.' });
|
|
3033
|
-
return true;
|
|
3034
|
-
}
|
|
3035
3178
|
// Resolve the provider against the relay's catalog first. A slug the
|
|
3036
3179
|
// server does not list can never be attached to a key, so storing it
|
|
3037
3180
|
// would produce a declaration that is invisible in every picker — the
|
|
@@ -3052,6 +3195,76 @@ const COMMANDS = [
|
|
|
3052
3195
|
return true;
|
|
3053
3196
|
}
|
|
3054
3197
|
const id = (match && match.provider && match.provider.id) || typed.toLowerCase();
|
|
3198
|
+
// ── what the vendor says, before we ask the user to remember it ──────
|
|
3199
|
+
//
|
|
3200
|
+
// The whole cost of this feature used to be "know the vendor's model id",
|
|
3201
|
+
// which is the release-lag problem handed to the user instead of solved.
|
|
3202
|
+
// When this machine holds a key for the provider, its own list endpoint
|
|
3203
|
+
// answers that in one request. Best-effort by construction: no key, no
|
|
3204
|
+
// endpoint, no network or an unparseable reply all fall through to the
|
|
3205
|
+
// free-form prompt below, which is the path that already worked offline.
|
|
3206
|
+
const key = byokKeyForProvider(c, id);
|
|
3207
|
+
const offered = await offeredModelIds(c, id, key);
|
|
3208
|
+
|
|
3209
|
+
// `*` is the bulk path: declare everything the vendor currently serves.
|
|
3210
|
+
// Only the CHAT rows are declared (an embeddings or TTS id in a model
|
|
3211
|
+
// picker is a row nobody can run), and only after the vendor answered —
|
|
3212
|
+
// with no list there is nothing to take all of, and saying so is the
|
|
3213
|
+
// honest outcome rather than an empty success.
|
|
3214
|
+
if (model === '*') {
|
|
3215
|
+
if (!offered) {
|
|
3216
|
+
const why = await discoverProviderModels(c, id, key);
|
|
3217
|
+
c.push({
|
|
3218
|
+
role: 'error',
|
|
3219
|
+
text: `cannot list ${id}: ${(why && why.error) || 'no list available'} — type the ids instead: /model-add ${id} <model-id>`,
|
|
3220
|
+
});
|
|
3221
|
+
return true;
|
|
3222
|
+
}
|
|
3223
|
+
const bulk = addManyUserModels(id, offered);
|
|
3224
|
+
if (typeof c.refreshByokModels === 'function') {
|
|
3225
|
+
try { await c.refreshByokModels(); } catch { /* the next refresh reads the file anyway */ }
|
|
3226
|
+
}
|
|
3227
|
+
c.push({
|
|
3228
|
+
role: 'done',
|
|
3229
|
+
text: `added ${bulk.added} of the ${offered.length} model ids ${id} serves${bulk.already.length ? ` (${bulk.already.length} were already declared)` : ''}.`,
|
|
3230
|
+
});
|
|
3231
|
+
if (bulk.capped) {
|
|
3232
|
+
// The store's per-provider ceiling, named as a ceiling. A vendor list
|
|
3233
|
+
// is a hundred rows; this is one deliberate limit, not sixty broken
|
|
3234
|
+
// ids, and the two must not read the same in the transcript.
|
|
3235
|
+
c.push({
|
|
3236
|
+
role: 'note',
|
|
3237
|
+
text: `stopped at the store's per-provider cap (32) — ${bulk.capped} more id(s) were left out; /model-add ${id} <model-id> stores a specific one, /model-rm frees a slot.`,
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
if (bulk.failed.length) {
|
|
3241
|
+
c.push({ role: 'note', text: `${bulk.failed.length} id(s) were refused: ${bulk.failed.map((f) => f.id).join(', ')}` });
|
|
3242
|
+
}
|
|
3243
|
+
c.push({ role: 'note', text: `stored in ${userModelsPath()} — the desktop reads the same file. /model-discover ${id} lists what the vendor serves.` });
|
|
3244
|
+
return true;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
if (!model) {
|
|
3248
|
+
// Plain inline input, NOT readSecret: a model id is not a secret, and
|
|
3249
|
+
// hiding it would make a typo unreviewable before it is stored.
|
|
3250
|
+
if (offered) {
|
|
3251
|
+
c.push({ role: 'note', text: `${id} serves ${offered.length} model ids — ${offered.slice(0, 12).join(', ')}${offered.length > 12 ? ', …' : ''}` });
|
|
3252
|
+
}
|
|
3253
|
+
const typedId = String((await c.askInput(
|
|
3254
|
+
offered
|
|
3255
|
+
? `model id for ${id} (1-${offered.length}, or type one): `
|
|
3256
|
+
: `model id for ${id}: `
|
|
3257
|
+
)) || '').trim();
|
|
3258
|
+
// A bare number picks the row it is listed under. Only an in-range
|
|
3259
|
+
// integer is read that way, so an id that happens to start with a digit
|
|
3260
|
+
// is still stored verbatim unless it is exactly a listed position.
|
|
3261
|
+
const n = /^\d+$/.test(typedId) ? Number(typedId) : 0;
|
|
3262
|
+
model = n >= 1 && n <= offered.length ? offered[n - 1] : typedId;
|
|
3263
|
+
}
|
|
3264
|
+
if (!model) {
|
|
3265
|
+
c.push({ role: 'note', text: 'nothing saved.' });
|
|
3266
|
+
return true;
|
|
3267
|
+
}
|
|
3055
3268
|
let res;
|
|
3056
3269
|
try {
|
|
3057
3270
|
res = addUserModel(id, model);
|
|
@@ -3090,10 +3303,109 @@ const COMMANDS = [
|
|
|
3090
3303
|
text: `saved, but no row will be offered for "${id}" yet — the relay lists no provider of that id (or that provider lists no models).`,
|
|
3091
3304
|
});
|
|
3092
3305
|
}
|
|
3306
|
+
if (res.added && offered) {
|
|
3307
|
+
// The vendor was asked and it lists more than the one id just stored.
|
|
3308
|
+
// Naming the size of that list is the difference between "the picker has
|
|
3309
|
+
// four models" and "this vendor ships forty and you have one of them".
|
|
3310
|
+
c.push({
|
|
3311
|
+
role: 'note',
|
|
3312
|
+
text: `${id} currently serves ${offered.length} model ids — /model-discover ${id} lists them, /model-add ${id} '*' takes them all.`,
|
|
3313
|
+
});
|
|
3314
|
+
}
|
|
3093
3315
|
c.push({ role: 'note', text: `stored in ${res.file} — the desktop reads the same file.` });
|
|
3094
3316
|
return true;
|
|
3095
3317
|
},
|
|
3096
3318
|
},
|
|
3319
|
+
{
|
|
3320
|
+
// ── what the vendor serves, right now ─────────────────────────────────
|
|
3321
|
+
//
|
|
3322
|
+
// `/model-add` answers "store THIS id"; this answers "which ids are there",
|
|
3323
|
+
// which is the question a user actually has when a vendor ships something
|
|
3324
|
+
// on a Tuesday. It reads the same key `client/env-file.js` and the provider
|
|
3325
|
+
// CRUD share (saved row first, `~/.aegiscode/.env` second) and hits the
|
|
3326
|
+
// vendor's own list endpoint, so the answer cannot be stale by
|
|
3327
|
+
// construction — that is the whole point of asking instead of shipping
|
|
3328
|
+
// another hand-copied list.
|
|
3329
|
+
//
|
|
3330
|
+
// Offline, keyless and shape-changed are all REPORTED, never thrown: this
|
|
3331
|
+
// command sits beside a manual path that works, so its worst case has to be
|
|
3332
|
+
// a sentence, not a stack trace.
|
|
3333
|
+
name: 'model-discover', aliases: ['discover-models', 'vendor-models'], args: ['provider'], hint: '<provider>',
|
|
3334
|
+
category: 'model',
|
|
3335
|
+
desc: "List the model ids your provider's own API serves",
|
|
3336
|
+
handler: async (c, a) => {
|
|
3337
|
+
const args = a || {};
|
|
3338
|
+
const typed = String(args.provider || '').trim();
|
|
3339
|
+
if (!typed) {
|
|
3340
|
+
c.push({
|
|
3341
|
+
role: 'error',
|
|
3342
|
+
text: `Usage: /model-discover <provider> — this client can ask: ${discoverableProviders().join(', ')}`,
|
|
3343
|
+
});
|
|
3344
|
+
return true;
|
|
3345
|
+
}
|
|
3346
|
+
// Resolve the alias against the relay's catalog when it is reachable, so
|
|
3347
|
+
// `/model-discover xai` and `/model-discover grok` are one request.
|
|
3348
|
+
const providers = await byokCatalog(c.client);
|
|
3349
|
+
const match = providers ? findByokProvider(providers, typed) : null;
|
|
3350
|
+
const id = ((match && match.provider && match.provider.id) || typed).toLowerCase();
|
|
3351
|
+
const entry = vendorEndpointFor(id);
|
|
3352
|
+
if (!entry) {
|
|
3353
|
+
c.push({
|
|
3354
|
+
role: 'error',
|
|
3355
|
+
text: `no list endpoint for "${id}" in this client — /model-add ${id} <model-id> stores an id you already know. Providers it can ask: ${discoverableProviders().join(', ')}`,
|
|
3356
|
+
});
|
|
3357
|
+
return true;
|
|
3358
|
+
}
|
|
3359
|
+
const key = byokKeyForProvider(c, id);
|
|
3360
|
+
if (!key) {
|
|
3361
|
+
c.push({
|
|
3362
|
+
role: 'error',
|
|
3363
|
+
text: `no ${id} key on this machine — /byok-key ${id} saves one (or put it in ~/.aegiscode/.env), then this lists what the key reaches.`,
|
|
3364
|
+
});
|
|
3365
|
+
return true;
|
|
3366
|
+
}
|
|
3367
|
+
const res = await discoverProviderModels(c, id, key);
|
|
3368
|
+
if (!res || !res.ok) {
|
|
3369
|
+
c.push({ role: 'error', text: `could not list ${id}: ${(res && res.error) || 'no answer'}` });
|
|
3370
|
+
return true;
|
|
3371
|
+
}
|
|
3372
|
+
// Where the user stands: which of these are already offered here.
|
|
3373
|
+
const declared = new Set(userModelIdsFor(id));
|
|
3374
|
+
const known = new Set(
|
|
3375
|
+
((match && match.provider && match.provider.models) || []).map((m) => String(m))
|
|
3376
|
+
);
|
|
3377
|
+
c.push({ role: 'note', text: `${id} at ${entry.url}${entry.note ? ` (${entry.note})` : ''}` });
|
|
3378
|
+
c.push({
|
|
3379
|
+
role: 'note',
|
|
3380
|
+
text: `${res.count} chat model id(s) the vendor serves — mark: [seen] the relay already lists it, [your] you declared it, [new] this machine does not offer it yet.`,
|
|
3381
|
+
});
|
|
3382
|
+
const lines = res.ids.map((m, i) => {
|
|
3383
|
+
const mark = declared.has(m) ? '[your]' : known.has(m) ? '[seen]' : '[new]';
|
|
3384
|
+
return `${String(i + 1).padStart(3)}. ${mark} ${m}`;
|
|
3385
|
+
});
|
|
3386
|
+
if (lines.length) c.push({ role: 'panel', lines });
|
|
3387
|
+
if (!lines.length) {
|
|
3388
|
+
c.push({ role: 'note', text: `the vendor answered with no chat models — /model-add ${id} <model-id> stores one by hand.` });
|
|
3389
|
+
}
|
|
3390
|
+
if (res.others.length) {
|
|
3391
|
+
// Named, not hidden. "the vendor lists 60 and you were shown 12" is a
|
|
3392
|
+
// fact the user is owed; a silent filter is how a picker looks empty
|
|
3393
|
+
// for a reason nobody can see.
|
|
3394
|
+
c.push({
|
|
3395
|
+
role: 'note',
|
|
3396
|
+
text: `${res.others.length} id(s) are not chat models (embeddings, audio, moderation or an unsupported method) and are left out: ${res.others.slice(0, 8).join(', ')}${res.others.length > 8 ? ', …' : ''}`,
|
|
3397
|
+
});
|
|
3398
|
+
}
|
|
3399
|
+
const fresh = res.ids.filter((m) => !declared.has(m) && !known.has(m));
|
|
3400
|
+
if (fresh.length) {
|
|
3401
|
+
c.push({
|
|
3402
|
+
role: 'note',
|
|
3403
|
+
text: `${fresh.length} of them are not offered on this machine yet — /model-add ${id} '<model-id>' stores one, /model-add ${id} '*' stores every chat model the vendor serves.`,
|
|
3404
|
+
});
|
|
3405
|
+
}
|
|
3406
|
+
return true;
|
|
3407
|
+
},
|
|
3408
|
+
},
|
|
3097
3409
|
{
|
|
3098
3410
|
name: 'model-rm', aliases: ['rm-model'], args: ['provider'], hint: '<provider> <model-id>',
|
|
3099
3411
|
category: 'model',
|
package/vendor/cli/src/config.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|
package/vendor/cli/src/deps.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
2
|
+
// Copyright (C) 2026 Niklas Borneklint — AEGIS Code (aegiscode) / Aegiscloud.
|
|
3
|
+
// AEGIS Code (aegiscode) — source: https://github.com/aegisinfo/aegiscode-plugin
|
|
4
|
+
// Conveying a modified copy, or running one as a network service, owes the
|
|
5
|
+
// corresponding source under this licence (§5/§13) — see LICENSING.md.
|
|
1
6
|
'use strict';
|
|
2
7
|
|
|
3
8
|
/**
|