Merge #550: keep Respawn and Ralph visible in Session Options for Claude sessions

This commit is contained in:
Codeman maintainer
2026-10-09 04:46:45 +02:00
6 changed files with 64 additions and 5 deletions
+9 -2
View File
@@ -248,16 +248,23 @@ describe('WebServer.renderIndexHtml', () => {
shortBadge: string;
order: number;
kind: string;
external: boolean;
enabled: boolean;
available: boolean;
}>;
expect(catalog.map((entry) => entry.id)).toEqual(STOCK_CLIS.map((entry) => entry.id));
expect(catalog.find((entry) => entry.id === 'codex')).toMatchObject({ label: 'Codex', kind: 'agent' });
expect(catalog.find((entry) => entry.id === 'codex')).toMatchObject({
label: 'Codex',
kind: 'agent',
external: true,
});
// claude is `kind: 'agent'` too; `external` is what keeps its Respawn/Ralph options visible.
expect(catalog.find((entry) => entry.id === 'claude')).toMatchObject({ kind: 'agent', external: false });
expect(catalog.find((entry) => entry.id === 'shell')).toMatchObject({ enabled: true, available: true });
expect(
catalog.every((entry) =>
Object.keys(entry).every((key) =>
['id', 'label', 'shortBadge', 'order', 'kind', 'enabled', 'available'].includes(key)
['id', 'label', 'shortBadge', 'order', 'kind', 'external', 'enabled', 'available'].includes(key)
)
)
).toBe(true);
+37 -1
View File
@@ -453,7 +453,15 @@ describe('Codex quick start settings', () => {
const src = readFileSync(resolve(import.meta.dirname, `../src/web/public/${file}`), 'utf8');
vm.runInContext(src, context, { filename: file });
}
return { app: new (CodemanApp as any)(), welcomeCliActions, tunnelBtn, runModeCliOptions, modeBtns, menu };
return {
app: new (CodemanApp as any)(),
welcomeCliActions,
tunnelBtn,
runModeCliOptions,
modeBtns,
menu,
context,
};
}
const ALL_OFF = {
@@ -651,6 +659,34 @@ describe('Codex quick start settings', () => {
expect(src).not.toContain('data-mode="codex"');
});
it('keeps Claude-only session options for claude even though it is a registry agent', () => {
const catalog = CATALOG.map((cli) => ({ ...cli, external: cli.id !== 'claude' && cli.id !== 'shell' }));
const { context } = loadUi(undefined, catalog);
expect(context.isExternalCliSession('claude')).toBe(false);
expect(context.isExternalCliSession('shell')).toBe(false);
expect(context.isExternalCliSession('codex')).toBe(true);
expect(context.isExternalCliSession('custom-agent')).toBe(true);
});
it('keeps the served external flag when App Settings resyncs the catalog from /api/clis', () => {
const catalog = CATALOG.map((cli) => ({ ...cli, external: cli.id !== 'claude' && cli.id !== 'shell' }));
const { app, context } = loadUi(undefined, catalog);
// /api/clis rows: no capabilities, so no `external`.
app._cliList = CATALOG.map((cli) => ({ ...cli, installed: true }));
app.runMode = 'claude';
app._syncCliLaunchCatalog();
expect(context.isExternalCliSession('claude')).toBe(false);
expect(context.isExternalCliSession('codex')).toBe(true);
});
it('gates Session Options on isExternalCliSession, not the launch-path check', () => {
const src = readFileSync(resolve(import.meta.dirname, '../src/web/public/session-ui.js'), 'utf8');
const open = src.slice(src.indexOf('\n openSessionOptions('));
const body = open.slice(0, open.indexOf('\n },'));
expect(body).toContain('isExternalCliSession(session.mode)');
expect(body).not.toContain('isExternalCliRunMode(');
});
it('shows everything when the flags were never injected', () => {
// A cached page from a build without the injection, or a solo popup. Hiding
// every run button on a doubt would leave a working install nothing to click.