feat: add in-chat skill discovery and local registry install command

This commit is contained in:
William Valentin
2026-02-18 10:41:12 -08:00
parent f34a974210
commit 02fa604c7c
9 changed files with 267 additions and 4 deletions
+73
View File
@@ -911,6 +911,79 @@ describe('daemon command fast-path integration', () => {
await expect(pendingPromise).resolves.toEqual({ approved: true });
expect(processSpy).not.toHaveBeenCalled();
});
it('handles /skill list via command fast-path', async () => {
const processSpy = vi.spyOn(AgentOrchestrator.prototype, 'process');
const session = {
id: 'telegram:skill-user',
addMessage: vi.fn(),
getHistory: vi.fn(() => []),
clear: vi.fn(),
replaceHistory: vi.fn(),
getConfig: vi.fn(() => undefined),
setConfig: vi.fn(),
deleteConfig: vi.fn(),
};
const commandRegistry = new CommandRegistry();
registerBuiltinCommands(commandRegistry);
const router = createMessageRouter({
sessionManager: {
getSession: vi.fn(() => session),
} as unknown as MessageRouterDeps['sessionManager'],
modelRouter: {
getAvailableTiers: () => ['fast', 'default', 'complex', 'local'],
getAllLabels: () => ({ fast: 'fast', default: 'default', complex: 'complex', local: 'local' }),
getLabel: (tier: string) => tier,
} as unknown as MessageRouterDeps['modelRouter'],
systemPrompt: 'test prompt',
toolRegistry: {
clone() { return this; },
register: vi.fn(),
} as unknown as MessageRouterDeps['toolRegistry'],
toolExecutor: {} as unknown as MessageRouterDeps['toolExecutor'],
config: {
agents: {
primary_tier: 'default',
delegation: {
compaction: 'fast',
memory_extraction: 'fast',
classification: 'fast',
tool_summarisation: 'fast',
complex_reasoning: 'complex',
},
max_delegation_depth: 3,
max_iterations: 10,
},
compaction: { enabled: false },
models: { default: { provider: 'anthropic', model: 'claude' } },
} as unknown as MessageRouterDeps['config'],
commandRegistry,
skillRegistry: {
listAvailable: () => ([
{ manifest: { name: 'calendar', tier: 'managed', version: '1.2.0' } },
{ manifest: { name: 'todoist', tier: 'workspace', version: '0.4.1' } },
]),
} as unknown as MessageRouterDeps['skillRegistry'],
});
const reply = vi.fn(async (_message: OutboundMessage) => {});
await router.handler({
id: 'skill-1',
channel: 'telegram',
senderId: 'skill-user',
text: '/skill list',
timestamp: Date.now(),
metadata: { isCommand: true, command: 'skill', commandArgs: 'list' },
} as MessageRouterInput, reply);
expect(processSpy).not.toHaveBeenCalled();
const outbound = reply.mock.calls[0]?.[0] as OutboundMessage | undefined;
expect(String(outbound?.text)).toContain('Available skills (2):');
expect(String(outbound?.text)).toContain('calendar');
expect(String(outbound?.text)).toContain('todoist');
});
});
describe('daemon external backend integration', () => {