Let people define custom agent CLIs and start them from the app and the launcher

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-25 21:26:08 -07:00
1 parent 3e22d53bf5
commit 94063fc0a9
27 files changed
+4025 -95

No files matched your search

+21 -1
View File
@@ -17,7 +17,8 @@ export const NEXT_STEP_LABELS = {
* text as a queued message while its turn is busy, and the button only shows
* once the agent stopped checking in with the console, so by then the turn is
* stuck and the queued word would never send by itself: for it, the send-now
* chord (ctrl+x ctrl+s) follows.
* chord (ctrl+x ctrl+s) follows. Any id it does not know (a custom agent)
* gets the plain word and Enter.
*/
export function continueKeys(kind) {
const keys = ['continue', '\r'];
@@ -25,6 +26,25 @@ export function continueKeys(kind) {
return keys;
}
/**
* Which agent the launch card starts on, from `agent_availability`'s list
* (built-ins first, then custom agents): the remembered id when it is
* installed, else the first installed built-in, else the first installed
* custom agent, else the remembered id or the first entry, so the card's
* missing-agent line explains what is wrong instead of picking silently.
*/
export function pickDefaultAgent(availability, remembered) {
const list = Array.isArray(availability) ? availability : [];
const rememberedEntry = list.find((a) => a.id === remembered);
if (rememberedEntry && rememberedEntry.installed) return remembered;
const builtIn = list.find((a) => a.installed && !a.custom);
if (builtIn) return builtIn.id;
const custom = list.find((a) => a.installed && a.custom);
if (custom) return custom.id;
if (remembered) return remembered;
return list.length > 0 ? list[0].id : null;
}
/**
* What the right end of the bar offers, most pressing first: the bar shows
* the first step (short text plus its one button) and counts the rest as