The executor router could propose Claude Code, Codex or Hermes and dispatch the task as a Waggle Room run through POST /api/tools/run, which is gone with the collaboration runtime. Confirming such a proposal could only fail. - ExecutorRegistry offers the five v1 personas; it no longer detects external tools. - Route proposals dispatch persona chat turns only. The memory brief and its egress disclosure existed only for external executors, so executor-brief.ts, the egress fields and removeFrameIds go too. - RouteProposalCard drops the memory disclosure, "Run without memory" and the link to an external run in the Room.
87 lines
2.7 KiB
TypeScript
87 lines
2.7 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
import type { AgentPersona } from '@waggle/agent';
|
|
import { ExecutorRegistry } from '../../src/local/executor-registry.js';
|
|
|
|
function persona(id: string, overrides: Partial<AgentPersona> = {}): AgentPersona {
|
|
return {
|
|
id,
|
|
name: id,
|
|
description: '',
|
|
icon: '',
|
|
systemPrompt: '',
|
|
modelPreference: '',
|
|
tools: [],
|
|
workspaceAffinity: [],
|
|
suggestedCommands: [],
|
|
defaultWorkflow: null,
|
|
...overrides,
|
|
};
|
|
}
|
|
|
|
const PERSONAS = [
|
|
persona('writer'),
|
|
persona('coordinator'),
|
|
persona('analyst'),
|
|
persona('general-purpose'),
|
|
persona('researcher'),
|
|
persona('coder'),
|
|
persona('planner', { isReadOnly: true }),
|
|
];
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks();
|
|
});
|
|
|
|
describe('ExecutorRegistry', () => {
|
|
it('offers the five v1 personas and no external coding agents', async () => {
|
|
const registry = new ExecutorRegistry({ personas: () => PERSONAS });
|
|
|
|
const candidates = await registry.snapshot(1_000);
|
|
|
|
expect(candidates.map((candidate) => candidate.id)).toEqual([
|
|
'persona:general-purpose',
|
|
'persona:coder',
|
|
'persona:writer',
|
|
'persona:researcher',
|
|
'persona:analyst',
|
|
]);
|
|
expect(candidates.find((candidate) => candidate.id === 'persona:coder')).toMatchObject({
|
|
kind: 'persona',
|
|
authClass: 'api-key',
|
|
installed: true,
|
|
healthy: true,
|
|
rateLimit: { state: 'unknown' },
|
|
supportsHeadless: false,
|
|
egressDestination: 'configured model provider',
|
|
taskFit: { coding: 0.85, writing: 0.3 },
|
|
});
|
|
});
|
|
|
|
it('expires rate-limit observations', async () => {
|
|
vi.spyOn(Date, 'now').mockReturnValue(10_000);
|
|
const registry = new ExecutorRegistry({ personas: () => PERSONAS });
|
|
|
|
registry.noteRateLimit('persona:coder', null);
|
|
const exhausted = (await registry.snapshot(10_000))
|
|
.find((candidate) => candidate.id === 'persona:coder');
|
|
expect(exhausted?.rateLimit).toEqual({ state: 'observed_exhausted' });
|
|
|
|
const recovered = (await registry.snapshot(10_000 + 15 * 60_000))
|
|
.find((candidate) => candidate.id === 'persona:coder');
|
|
expect(recovered?.rateLimit).toEqual({ state: 'available' });
|
|
|
|
registry.noteRateLimit('persona:coder', 2_000_000);
|
|
const withReset = (await registry.snapshot(1_999_999))
|
|
.find((candidate) => candidate.id === 'persona:coder');
|
|
expect(withReset?.rateLimit).toEqual({
|
|
state: 'observed_exhausted',
|
|
resumeAtMs: 2_000_000,
|
|
});
|
|
|
|
registry.noteHealthy('persona:coder');
|
|
const healthy = (await registry.snapshot(1_999_999))
|
|
.find((candidate) => candidate.id === 'persona:coder');
|
|
expect(healthy?.rateLimit).toEqual({ state: 'available' });
|
|
});
|
|
});
|