The hooks for Claude Code, Codex and the other agents ran the hive-mind-hooks-* packages, which left the repository; ADR-0002 hides the feature in v1. Remove the hook installer surface from the tool launcher, the POST /api/tools/hooks route, the hook status probe in tool detection, and the hook fields of the tool manifest and detection envelope (hookCapable, hookRoot, hookPointer, hooksInstalled, hookPointerPath). Third-party adapter manifests no longer accept the hook fields. In the web UI, remove the hidden hook actions and the "How memory is shared" explainer from the Launcher, adapter.manageHooks, the hook-wired count in Mission Control and the agentHooks and memoryMcp memory feature flags. Launch, watch and stop are unchanged; the roadmap tool note no longer mentions hooks.
48 lines
1.9 KiB
TypeScript
48 lines
1.9 KiB
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { loadThirdPartyManifests } from '../src/tool-manifest-loader.js';
|
|
|
|
function deps(files: Record<string, unknown>) {
|
|
return {
|
|
dir: '/fake',
|
|
readDir: () => Object.keys(files),
|
|
readFile: (p: string) => JSON.stringify(files[p.split(/[/\\]/).pop()!]),
|
|
};
|
|
}
|
|
|
|
describe('loadThirdPartyManifests', () => {
|
|
it('loads a valid PATH manifest, stamped builtin:false', () => {
|
|
const out = loadThirdPartyManifests(deps({
|
|
'foo.json': { id: 'foo-cli', displayName: 'Foo', launchable: true, detect: { kind: 'path', binaryName: 'foo' } },
|
|
}));
|
|
expect(out).toHaveLength(1);
|
|
expect(out[0]).toMatchObject({ id: 'foo-cli', builtin: false, detect: { kind: 'path', binaryName: 'foo' } });
|
|
});
|
|
|
|
it('rejects detect.kind:candidates (code-only strategy)', () => {
|
|
const out = loadThirdPartyManifests(deps({
|
|
'bad.json': { id: 'bad', displayName: 'B', launchable: true, detect: { kind: 'candidates' } },
|
|
}));
|
|
expect(out).toEqual([]);
|
|
});
|
|
|
|
it('rejects shell-metachar / traversal in fields', () => {
|
|
const out = loadThirdPartyManifests(deps({
|
|
'evil.json': { id: '../evil', displayName: 'E', launchable: true, detect: { kind: 'path', binaryName: 'foo; rm -rf /' } },
|
|
}));
|
|
expect(out).toEqual([]);
|
|
});
|
|
|
|
it('returns [] when the dir is missing (readDir throws)', () => {
|
|
expect(loadThirdPartyManifests({ dir: '/none', readDir: () => { throw new Error('ENOENT'); }, readFile: () => '' })).toEqual([]);
|
|
});
|
|
|
|
it('skips a malformed JSON file but keeps the valid ones', () => {
|
|
const out = loadThirdPartyManifests({
|
|
dir: '/fake',
|
|
readDir: () => ['broken.json', 'ok.json'],
|
|
readFile: (p: string) => (p.includes('broken') ? '{not json' : JSON.stringify({ id: 'ok-cli', displayName: 'OK', launchable: true, detect: { kind: 'path', binaryName: 'ok' } })),
|
|
});
|
|
expect(out.map((m) => m.id)).toEqual(['ok-cli']);
|
|
});
|
|
});
|