Files
waggle-os/packages/shared/tests/tool-manifests.test.ts
shumeiko.it 80db300485 refactor(shared): drop the headless task contract from tool manifests
The `task` spec (argv templates, access modes, output dialects) and the
capability flags headlessTask, structuredProgress, resumable and
liveWaggleDance described how a Waggle Room run drove a coding agent
without its UI. Nothing runs tools headless any more, so built-in
manifests, the third-party adapter loader and detection results no
longer carry them. An adapter file that still declares `task` is
rejected like any other unknown key.
2026-11-01 11:08:26 +01:00

64 lines
2.6 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import {
BUILTIN_TOOL_MANIFESTS, SUPPORTED_TOOLS, LAUNCH_COHORT, TOOL_DISPLAY_NAMES,
applyPromptArgTemplate,
} from '../src/tool-detection.js';
describe('BUILTIN_TOOL_MANIFESTS', () => {
it('has one manifest per supported tool, ids matching SUPPORTED_TOOLS', () => {
expect(BUILTIN_TOOL_MANIFESTS.map((m) => m.id).sort()).toEqual([...SUPPORTED_TOOLS].sort());
});
it('marks every registered surface as built in', () => {
for (const m of BUILTIN_TOOL_MANIFESTS) {
expect(m.builtin).toBe(true);
}
});
it('keeps roadmap integrations detectable but outside the launch cohort', () => {
const roadmap = BUILTIN_TOOL_MANIFESTS.filter((m) => m.releaseStatus === 'roadmap');
expect(roadmap.map((m) => m.id)).toEqual(['cursor', 'openclaw']);
for (const manifest of roadmap) {
expect(manifest.launchable).toBe(false);
}
});
it('derives TOOL_DISPLAY_NAMES and the release-qualified launch cohort from manifests', () => {
expect(TOOL_DISPLAY_NAMES['claude-code']).toBe('Claude Code');
expect(TOOL_DISPLAY_NAMES['codex']).toBe('Codex CLI');
expect(TOOL_DISPLAY_NAMES['hermes-desktop']).toBe('Hermes Desktop');
expect([...LAUNCH_COHORT].sort()).toEqual(
SUPPORTED_TOOLS.filter((id) => id !== 'cursor' && id !== 'openclaw').sort(),
);
});
it('models Hermes CLI and Desktop as separate execution surfaces', () => {
const cli = BUILTIN_TOOL_MANIFESTS.find((m) => m.id === 'hermes')!;
const desktop = BUILTIN_TOOL_MANIFESTS.find((m) => m.id === 'hermes-desktop')!;
expect(cli).toMatchObject({
displayName: 'Hermes Agent CLI',
detect: { kind: 'path', binaryName: 'hermes' },
launchable: true,
});
expect(desktop).toMatchObject({
displayName: 'Hermes Desktop',
detect: { kind: 'candidates' },
launchable: true,
});
});
it('claude-code detects by PATH binary "claude" (not its id)', () => {
const cc = BUILTIN_TOOL_MANIFESTS.find((m) => m.id === 'claude-code')!;
expect(cc.detect).toEqual({ kind: 'path', binaryName: 'claude' });
});
});
describe('applyPromptArgTemplate (#5 fast-follow)', () => {
it('substitutes {prompt} in each template entry', () => {
expect(applyPromptArgTemplate(['--print', '{prompt}'], 'hello')).toEqual(['--print', 'hello']);
});
it('substitutes within an entry and across multiple entries', () => {
expect(applyPromptArgTemplate(['-m', 'msg={prompt}', '{prompt}'], 'hi')).toEqual(['-m', 'msg=hi', 'hi']);
});
it('leaves entries without the placeholder untouched', () => {
expect(applyPromptArgTemplate(['--yes', '--fast'], 'hi')).toEqual(['--yes', '--fast']);
});
});