mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-17 11:49:33 +01:00
fix(local-model): a chip that was only looked at never hides "Start a session"
Selecting a chip stored it for the device at once. Someone who clicked "DeepSeek" (Needs setup) or "Pi" (Not installed) just to see what it says then got a window that reopened on that chip: "Install Pi", or no main button at all, with "Start a session" out of sight. The device now remembers the agent a session was STARTED with, an opening of the window selects it only while it can be started, and a selection made in one opening does not carry into the next. Otherwise the server's default agent is selected, as before. Also: a real-browser test for the chips (they wrap inside the window at 1440, 390 and 320 px, the install command included, one tab stop), and one sentence in the API reference: a readiness mark says the composer is there, not that nothing else is (DeepSeek Harness's setup guide draws the same glyph). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f9f877a5a
commit
bd362f736b
5 files changed
+117
-12
No files matched your search
@@ -510,6 +510,71 @@ describe('the local model window (real Chromium)', () => {
|
||||
expect(overflow).toBeLessThanOrEqual(0);
|
||||
});
|
||||
|
||||
it('the coding agents: chips that wrap inside the window at every width, the install command included', async () => {
|
||||
const agents = [
|
||||
{ cli: 'opencode', cliLabel: 'OpenCode', default: true, status: 'ready', actions: ['start-session'] },
|
||||
{
|
||||
cli: 'claude',
|
||||
cliLabel: 'Claude Code',
|
||||
default: false,
|
||||
status: 'ready',
|
||||
slowFirstTurn: true,
|
||||
actions: ['start-session'],
|
||||
},
|
||||
{
|
||||
cli: 'pi',
|
||||
cliLabel: 'Pi',
|
||||
default: false,
|
||||
status: 'installable',
|
||||
installCommand: 'npm install -g --ignore-scripts @earendil-works/pi-coding-agent',
|
||||
actions: ['install'],
|
||||
},
|
||||
{ cli: 'deepseek', cliLabel: 'DeepSeek', default: false, status: 'setup-needed', actions: [] },
|
||||
];
|
||||
const answer = {
|
||||
...INSTALLED,
|
||||
install: {
|
||||
...INSTALLED.install,
|
||||
harnesses: agents,
|
||||
actions: [...INSTALLED.install.actions, 'install-agent'],
|
||||
},
|
||||
};
|
||||
for (const [width, height] of [
|
||||
[1440, 900],
|
||||
[390, 844],
|
||||
[320, 640],
|
||||
]) {
|
||||
await load(width, height, answer);
|
||||
await open();
|
||||
// The agent that is not on this Mac: its command is the longest line of the block.
|
||||
await p.locator('.lm-agent', { hasText: 'Pi' }).click();
|
||||
const seen = await p.evaluate(() => {
|
||||
const frame = document.querySelector('.local-model-window')!.getBoundingClientRect();
|
||||
const body = document.getElementById('localModelWindowBody')!;
|
||||
const outside = [...document.querySelectorAll('.lm-agent, .lm-agents .lm-command, .lm-buttons button')]
|
||||
.map((el) => el.getBoundingClientRect())
|
||||
.filter((box) => box.width > 0 && (box.left < frame.left - 0.5 || box.right > frame.right + 0.5)).length;
|
||||
const chips = [...document.querySelectorAll<HTMLElement>('.lm-agent')];
|
||||
return {
|
||||
chips: chips.length,
|
||||
outside,
|
||||
sideways: body.scrollWidth - body.clientWidth,
|
||||
checked: document.querySelector('.lm-agent[aria-checked="true"] .lm-agent-name')!.textContent,
|
||||
tabStops: chips.filter((chip) => chip.tabIndex === 0).length,
|
||||
main: document.querySelector('.lm-buttons .wt-btn-primary')!.textContent,
|
||||
};
|
||||
});
|
||||
expect(seen, `${width}px`).toEqual({
|
||||
chips: 4,
|
||||
outside: 0,
|
||||
sideways: 0,
|
||||
checked: 'Pi',
|
||||
tabStops: 1,
|
||||
main: 'Install Pi',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it('paints above App Settings when it is opened from there', async () => {
|
||||
await load(1440);
|
||||
await p.evaluate(() => document.getElementById('appSettingsModal')!.classList.add('active'));
|
||||
|
||||
Reference in new issue
Block a user