mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-10 01:09:43 +02:00
fix(session-options): keep the external flag when App Settings resyncs the CLI catalog
_syncCliLaunchCatalog() rebuilt window.__codemanCliCatalog from /api/clis rows, which carry no capabilities, so after App Settings loaded the CLI list isExternalCliSession('claude') fell back to the kind check and Respawn and Ralph disappeared again until a reload. The rebuild now carries external over from the served catalog; a newly created custom CLI has no previous entry and falls back to kind, which is right since custom entries are external. Tests pin the resync and the openSessionOptions() call site, and the /api/clis comment names the page catalog as the deliberate capabilities exception.
This commit is contained in:
@@ -556,6 +556,25 @@ describe('Codex quick start settings', () => {
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user