Merge P2.2 part 2: remove the excluded packages and scrub internal names
This commit is contained in:
@@ -23,7 +23,7 @@ describe('listWindowsDrives', () => {
|
||||
expect(drives[0]).toEqual({ name: 'C:', path: 'C:\\', type: 'directory' });
|
||||
});
|
||||
|
||||
it('returns both C: and D: on a dual-drive machine like Marko\'s', () => {
|
||||
it('returns both C: and D: on a dual-drive machine like Alex\'s', () => {
|
||||
const drives = listWindowsDrives((p) => p === 'C:\\' || p === 'D:\\');
|
||||
expect(drives).toHaveLength(2);
|
||||
expect(drives.map((d) => d.name)).toEqual(['C:', 'D:']);
|
||||
|
||||
@@ -106,12 +106,12 @@ describe('DiscordAdapter gateway', () => {
|
||||
handshake(ws);
|
||||
ws.serverSend({
|
||||
op: 0, t: 'MESSAGE_CREATE', s: 2,
|
||||
d: { id: 'm1', channel_id: 'c1', content: 'hello', author: { id: 'u1', username: 'marko' } },
|
||||
d: { id: 'm1', channel_id: 'c1', content: 'hello', author: { id: 'u1', username: 'alex' } },
|
||||
});
|
||||
await tick();
|
||||
expect(ctx.received[0]).toEqual({
|
||||
platform: 'discord', chatId: 'c1', senderId: 'u1',
|
||||
senderName: 'marko', text: 'hello', messageId: 'm1',
|
||||
senderName: 'alex', text: 'hello', messageId: 'm1',
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('PairingStore codes', () => {
|
||||
it('consumes a valid code exactly once and pairs the sender', () => {
|
||||
const store = new PairingStore(dir);
|
||||
const { code } = store.generateCode('telegram');
|
||||
expect(store.consumeCode('telegram', code, 'user-1', 'marko')).toBe(true);
|
||||
expect(store.consumeCode('telegram', code, 'user-1', 'alex')).toBe(true);
|
||||
expect(store.isPaired('telegram', 'user-1')).toBe(true);
|
||||
// Single-use: second redemption fails.
|
||||
expect(store.consumeCode('telegram', code, 'user-2')).toBe(false);
|
||||
@@ -70,11 +70,11 @@ describe('PairingStore persistence', () => {
|
||||
it('persists allowlist across store instances (channels.json)', () => {
|
||||
const a = new PairingStore(dir);
|
||||
const { code } = a.generateCode('telegram');
|
||||
a.consumeCode('telegram', code, 'user-1', 'marko');
|
||||
a.consumeCode('telegram', code, 'user-1', 'alex');
|
||||
|
||||
const b = new PairingStore(dir);
|
||||
expect(b.isPaired('telegram', 'user-1')).toBe(true);
|
||||
expect(b.listPaired().telegram?.[0]?.senderName).toBe('marko');
|
||||
expect(b.listPaired().telegram?.[0]?.senderName).toBe('alex');
|
||||
});
|
||||
|
||||
it('does NOT persist pending codes (in-memory only)', () => {
|
||||
|
||||
@@ -36,7 +36,7 @@ function makeFetchScript(updateBatches: unknown[][]) {
|
||||
return { fetchImpl, calls };
|
||||
}
|
||||
|
||||
function telegramUpdate(id: number, text: string, from = { id: 42, username: 'marko' }) {
|
||||
function telegramUpdate(id: number, text: string, from = { id: 42, username: 'alex' }) {
|
||||
return { update_id: id, message: { message_id: id, text, chat: { id: -100 }, from } };
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('TelegramAdapter polling', () => {
|
||||
platform: 'telegram',
|
||||
chatId: '-100',
|
||||
senderId: '42',
|
||||
senderName: 'marko',
|
||||
senderName: 'alex',
|
||||
text: 'hello',
|
||||
messageId: '7',
|
||||
});
|
||||
|
||||
@@ -105,7 +105,7 @@ function textMessage(overrides: Partial<WaMessageLike> = {}): WaMessageLike {
|
||||
body: 'zdravo',
|
||||
type: 'chat',
|
||||
id: { _serialized: 'false_3816x@c.us_m1' },
|
||||
_data: { notifyName: 'Marko' },
|
||||
_data: { notifyName: 'Alex' },
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
@@ -253,7 +253,7 @@ describe('WhatsAppAdapter inbound', () => {
|
||||
platform: 'whatsapp',
|
||||
chatId: '3816x@c.us',
|
||||
senderId: '3816x@c.us',
|
||||
senderName: 'Marko',
|
||||
senderName: 'Alex',
|
||||
text: 'zdravo',
|
||||
messageId: 'false_3816x@c.us_m1',
|
||||
});
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* D11 (UX-Refactor P4) — dataDir resolution.
|
||||
*
|
||||
* - resolveDataDir: explicit option > WAGGLE_DATA_DIR env > ~/.waggle. Before
|
||||
* D11, startService ignored the env var while local/index.ts, the
|
||||
* marketplace installer, and memory-mcp honored it — a custom install split
|
||||
* D11, startService ignored the env var while local/index.ts and the
|
||||
* marketplace installer honored it — a custom install split
|
||||
* its state across two directories.
|
||||
*/
|
||||
import { describe, it, expect, afterEach, vi } from 'vitest';
|
||||
|
||||
@@ -11,8 +11,6 @@ const manifest = (promptArgTemplate?: string[]): ToolManifest => ({
|
||||
id: 'foo',
|
||||
displayName: 'Foo',
|
||||
launchable: true,
|
||||
hookCapable: false,
|
||||
hookPointer: '.foo/hm.json',
|
||||
detect: { kind: 'path', binaryName: 'foo' },
|
||||
...(promptArgTemplate ? { promptArgTemplate } : {}),
|
||||
builtin: false,
|
||||
|
||||
@@ -26,8 +26,6 @@ function detectedTool(id: string, installed = true): DetectedTool {
|
||||
installed,
|
||||
installedPath: installed ? `/tools/${id}` : null,
|
||||
version: installed ? '1.0.0' : null,
|
||||
hooksInstalled: false,
|
||||
hookPointerPath: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -34,8 +34,6 @@ describe('external tool roadmap gate', () => {
|
||||
installed: true,
|
||||
installedPath: 'C:\\tools\\openclaw.cmd',
|
||||
version: 'test',
|
||||
hooksInstalled: false,
|
||||
hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', runner);
|
||||
|
||||
@@ -189,7 +189,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'codex', displayName: 'Codex CLI', installed: true,
|
||||
installedPath: 'C:\\trusted\\codex.cmd', version: 'test',
|
||||
hooksInstalled: true, hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
@@ -418,7 +417,7 @@ describe('external tool run routes', () => {
|
||||
} as never);
|
||||
server.decorate('externalToolDetector', async () => ({
|
||||
platform: 'win32', detectedAt: new Date().toISOString(),
|
||||
tools: [{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'C:\\trusted\\codex.cmd', version: 'test', hooksInstalled: true, hookPointerPath: null }],
|
||||
tools: [{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'C:\\trusted\\codex.cmd', version: 'test' }],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
calls.push({
|
||||
@@ -551,10 +550,10 @@ describe('external tool run routes', () => {
|
||||
server.decorate('externalToolDetector', async () => ({
|
||||
platform: 'win32', detectedAt: new Date().toISOString(),
|
||||
tools: [
|
||||
{ id: 'claude-code', displayName: 'Claude Code', installed: true, installedPath: 'claude.exe', version: 'test', hooksInstalled: true, hookPointerPath: null },
|
||||
{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.exe', version: 'test', hooksInstalled: true, hookPointerPath: null },
|
||||
{ id: 'hermes', displayName: 'Hermes', installed: true, installedPath: 'hermes.exe', version: 'test', hooksInstalled: true, hookPointerPath: null },
|
||||
{ id: 'openclaw', displayName: 'OpenClaw', installed: true, installedPath: 'openclaw.exe', version: openClawVersion, hooksInstalled: true, hookPointerPath: null },
|
||||
{ id: 'claude-code', displayName: 'Claude Code', installed: true, installedPath: 'claude.exe', version: 'test' },
|
||||
{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.exe', version: 'test' },
|
||||
{ id: 'hermes', displayName: 'Hermes', installed: true, installedPath: 'hermes.exe', version: 'test' },
|
||||
{ id: 'openclaw', displayName: 'OpenClaw', installed: true, installedPath: 'openclaw.exe', version: openClawVersion },
|
||||
],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
@@ -845,7 +844,7 @@ describe('external tool run routes', () => {
|
||||
} as never);
|
||||
server.decorate('externalToolDetector', async () => ({
|
||||
platform: 'win32', detectedAt: new Date().toISOString(),
|
||||
tools: [{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.cmd', version: 'test', hooksInstalled: false, hookPointerPath: null }],
|
||||
tools: [{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.cmd', version: 'test' }],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async () => ({
|
||||
status: 'failed', exitCode: 1, summary: 'Partial provider answer', stdoutTail: '',
|
||||
@@ -890,7 +889,7 @@ describe('external tool run routes', () => {
|
||||
server.decorate('externalCollaborationRuntime', collaborationRuntime);
|
||||
server.decorate('externalToolDetector', async () => ({
|
||||
platform: 'win32', detectedAt: new Date().toISOString(),
|
||||
tools: [{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.cmd', version: 'test', hooksInstalled: false, hookPointerPath: null }],
|
||||
tools: [{ id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.cmd', version: 'test' }],
|
||||
}));
|
||||
server.decorate('externalToolRunner', (request) => new Promise<ExternalToolRunResult>((resolve) => {
|
||||
request.onEvent?.({
|
||||
@@ -968,7 +967,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'codex', displayName: 'Codex CLI', installed: true,
|
||||
installedPath: 'codex.cmd', version: 'test',
|
||||
hooksInstalled: false, hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
@@ -1083,7 +1081,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'openclaw', displayName: 'OpenClaw', installed: true,
|
||||
installedPath: 'openclaw.cmd', version: 'test',
|
||||
hooksInstalled: false, hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', runner);
|
||||
@@ -1153,7 +1150,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'openclaw', displayName: 'OpenClaw', installed: true,
|
||||
installedPath: 'openclaw.cmd', version: 'test',
|
||||
hooksInstalled: false, hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
@@ -1380,7 +1376,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'openclaw', displayName: 'OpenClaw', installed: true,
|
||||
installedPath, version: binaryVersion,
|
||||
hooksInstalled: false, hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
@@ -1469,7 +1464,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'openclaw', displayName: 'OpenClaw', installed: true,
|
||||
installedPath: 'openclaw.cmd', version: 'test',
|
||||
hooksInstalled: false, hookPointerPath: null,
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async (request) => {
|
||||
@@ -1571,7 +1565,6 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'openclaw' as const, displayName: 'OpenClaw', installed: true,
|
||||
installedPath: 'openclaw.cmd', version: 'test',
|
||||
hooksInstalled: false, hookPointerPath: null,
|
||||
}],
|
||||
};
|
||||
});
|
||||
@@ -1622,7 +1615,7 @@ describe('external tool run routes', () => {
|
||||
platform: 'win32', detectedAt: new Date().toISOString(),
|
||||
tools: [{
|
||||
id: 'codex', displayName: 'Codex CLI', installed: true, installedPath: 'codex.cmd',
|
||||
version: 'test', hooksInstalled: false, hookPointerPath: null,
|
||||
version: 'test',
|
||||
}],
|
||||
}));
|
||||
server.decorate('externalToolRunner', async () => {
|
||||
@@ -1678,7 +1671,7 @@ describe('external tool run routes', () => {
|
||||
tools: [{
|
||||
id: 'codex', displayName: 'Codex CLI', installed: true,
|
||||
installedPath: 'C:\\Program Files\\WindowsApps\\OpenAI.Codex\\resources\\codex.exe',
|
||||
version: null, hooksInstalled: false, hookPointerPath: null,
|
||||
version: null,
|
||||
launchable: false, diagnostic: 'The Store resource CLI cannot launch outside its package.',
|
||||
}],
|
||||
}));
|
||||
|
||||
@@ -74,13 +74,13 @@ const card = (id: string, pendingCount: number, rankTs: number): { card: RecentW
|
||||
|
||||
describe('personalizeGreeting (P2 — B8 name in greeting)', () => {
|
||||
it('splices the name before the first sentence break', () => {
|
||||
expect(personalizeGreeting("Good morning. Here's your day", 'Marko'))
|
||||
.toBe("Good morning, Marko. Here's your day");
|
||||
expect(personalizeGreeting("Good morning. Here's your day", 'Alex'))
|
||||
.toBe("Good morning, Alex. Here's your day");
|
||||
});
|
||||
|
||||
it('handles the em-dash fresh-state greeting', () => {
|
||||
expect(personalizeGreeting('Welcome — anything you discuss here will be remembered.', 'Marko'))
|
||||
.toBe('Welcome, Marko — anything you discuss here will be remembered.');
|
||||
expect(personalizeGreeting('Welcome — anything you discuss here will be remembered.', 'Alex'))
|
||||
.toBe('Welcome, Alex — anything you discuss here will be remembered.');
|
||||
});
|
||||
|
||||
it('passes through without a name', () => {
|
||||
@@ -89,7 +89,7 @@ describe('personalizeGreeting (P2 — B8 name in greeting)', () => {
|
||||
});
|
||||
|
||||
it('passes through greetings with no sentence break', () => {
|
||||
expect(personalizeGreeting('Hello there', 'Marko')).toBe('Hello there');
|
||||
expect(personalizeGreeting('Hello there', 'Alex')).toBe('Hello there');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -180,14 +180,14 @@ describe('GET /api/home/briefing (P2 — J08 needsReviewCount + greeting)', () =
|
||||
it('greets by name when identity is seeded (B8)', async () => {
|
||||
boot([{ id: 'w1', name: 'Alpha', group: 'Personal', created: new Date().toISOString() }]);
|
||||
new IdentityLayer(server.waggleDb).create({
|
||||
name: 'Marko', role: 'Founder', department: 'Egzakta',
|
||||
name: 'Alex', role: 'Founder', department: 'Egzakta',
|
||||
personality: '', capabilities: '', system_prompt: '',
|
||||
});
|
||||
const res = await server.inject({ method: 'GET', url: '/api/home/briefing' });
|
||||
expect(res.statusCode).toBe(200);
|
||||
const briefing = res.json();
|
||||
expect(briefing.userName).toBe('Marko');
|
||||
expect(briefing.greeting).toContain(', Marko');
|
||||
expect(briefing.userName).toBe('Alex');
|
||||
expect(briefing.greeting).toContain(', Alex');
|
||||
});
|
||||
|
||||
it('greeting stays name-free when no identity exists', async () => {
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('POST /api/identity — merge-on-update', () => {
|
||||
boot();
|
||||
const first = await server.inject({
|
||||
method: 'POST', url: '/api/identity',
|
||||
payload: { name: 'Marko', role: 'Founder', department: 'Egzakta' },
|
||||
payload: { name: 'Alex', role: 'Founder', department: 'Egzakta' },
|
||||
});
|
||||
expect(first.statusCode).toBe(200);
|
||||
|
||||
@@ -39,11 +39,11 @@ describe('POST /api/identity — merge-on-update', () => {
|
||||
// survive (the old `body.x ?? ''` semantics silently wiped them).
|
||||
const partial = await server.inject({
|
||||
method: 'POST', url: '/api/identity',
|
||||
payload: { name: 'Marko M.' },
|
||||
payload: { name: 'Alex M.' },
|
||||
});
|
||||
expect(partial.statusCode).toBe(200);
|
||||
const body = partial.json();
|
||||
expect(body.name).toBe('Marko M.');
|
||||
expect(body.name).toBe('Alex M.');
|
||||
expect(body.role).toBe('Founder');
|
||||
expect(body.department).toBe('Egzakta');
|
||||
});
|
||||
@@ -52,14 +52,14 @@ describe('POST /api/identity — merge-on-update', () => {
|
||||
boot();
|
||||
await server.inject({
|
||||
method: 'POST', url: '/api/identity',
|
||||
payload: { name: 'Marko', role: 'Founder' },
|
||||
payload: { name: 'Alex', role: 'Founder' },
|
||||
});
|
||||
const cleared = await server.inject({
|
||||
method: 'POST', url: '/api/identity',
|
||||
payload: { role: '' },
|
||||
});
|
||||
expect(cleared.json().role).toBe('');
|
||||
expect(cleared.json().name).toBe('Marko');
|
||||
expect(cleared.json().name).toBe('Alex');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -87,10 +87,10 @@ describe('SignalBus', () => {
|
||||
|
||||
it('filters by teamId', () => {
|
||||
const bus = new SignalBus(10);
|
||||
bus.record(makeSignal({ id: 'p1', teamId: 'personal::marko' }));
|
||||
bus.record(makeSignal({ id: 'p1', teamId: 'personal::alex' }));
|
||||
bus.record(makeSignal({ id: 't1', teamId: 'team-egzakta' }));
|
||||
bus.record(makeSignal({ id: 'p2', teamId: 'personal::marko' }));
|
||||
const personal = bus.query({ teamId: 'personal::marko' });
|
||||
bus.record(makeSignal({ id: 'p2', teamId: 'personal::alex' }));
|
||||
const personal = bus.query({ teamId: 'personal::alex' });
|
||||
expect(personal.map((s) => s.id)).toEqual(['p2', 'p1']);
|
||||
});
|
||||
|
||||
|
||||
@@ -800,7 +800,6 @@ describe('Tauri Production Configuration', () => {
|
||||
'js-yaml': '4.3.1',
|
||||
'better-sqlite3': '12.6.2',
|
||||
'@huggingface/transformers': { sharp: '0.35.3' },
|
||||
next: '16.3.0',
|
||||
};
|
||||
|
||||
expect(manifest.engines?.node).toBe('^20.19.0 || >=22.12.0');
|
||||
@@ -821,7 +820,6 @@ describe('Tauri Production Configuration', () => {
|
||||
|
||||
const betterSqliteRanges = [
|
||||
'core',
|
||||
'hive-mind-core',
|
||||
'launcher',
|
||||
'marketplace',
|
||||
'server',
|
||||
@@ -1366,14 +1364,14 @@ describe('Tauri Production Configuration', () => {
|
||||
fixtureResources,
|
||||
'node_modules',
|
||||
'@waggle',
|
||||
'hive-mind-core',
|
||||
'core',
|
||||
'package.json',
|
||||
);
|
||||
const coreDistEntry = path.join(
|
||||
fixtureResources,
|
||||
'node_modules',
|
||||
'@waggle',
|
||||
'hive-mind-core',
|
||||
'core',
|
||||
'dist',
|
||||
'index.js',
|
||||
);
|
||||
@@ -1381,7 +1379,7 @@ describe('Tauri Production Configuration', () => {
|
||||
fs.writeFileSync(
|
||||
coreManifestPath,
|
||||
JSON.stringify({
|
||||
name: '@waggle/hive-mind-core',
|
||||
name: '@waggle/core',
|
||||
main,
|
||||
...(exports === undefined ? {} : { exports }),
|
||||
}),
|
||||
@@ -1683,14 +1681,14 @@ describe('Tauri Production Configuration', () => {
|
||||
);
|
||||
writeFixtureFile(
|
||||
path.join(fixtureResources, 'node_modules'),
|
||||
'@waggle/hive-mind-core/src/evolution-runs.ts',
|
||||
'export const proprietary = true;\n',
|
||||
'@waggle/core/src/private.ts',
|
||||
'export const privateSource = true;\n',
|
||||
);
|
||||
const hiveSourceDir = path.join(
|
||||
const coreSourceDir = path.join(
|
||||
fixtureResources,
|
||||
'node_modules',
|
||||
'@waggle',
|
||||
'hive-mind-core',
|
||||
'core',
|
||||
'src',
|
||||
);
|
||||
writeFixtureFile(
|
||||
@@ -1721,22 +1719,22 @@ describe('Tauri Production Configuration', () => {
|
||||
);
|
||||
const firstPartyReadme = writeFixtureFile(
|
||||
path.join(fixtureResources, 'node_modules'),
|
||||
'@waggle/hive-mind-core/README.md',
|
||||
'@waggle/core/README.md',
|
||||
'internal package documentation\n',
|
||||
);
|
||||
const disallowedPayloadResult = await runChecker();
|
||||
expect(disallowedPayloadResult.status).toBe(1);
|
||||
for (const diagnostic of [
|
||||
'resources/service.js.map must not be packaged',
|
||||
'resources/node_modules/@waggle/hive-mind-core/src/evolution-runs.ts must not be packaged',
|
||||
'resources/node_modules/@waggle/core/src/private.ts must not be packaged',
|
||||
'resources/node_modules/waggle-test-runtime/src/private.ts must not be packaged',
|
||||
'resources/node_modules/vendor/node_modules/@waggle/shared/src/private.ts must not be packaged',
|
||||
'resources/node_modules/@waggle/hive-mind-core/README.md is not a runtime package entry',
|
||||
'resources/node_modules/@waggle/core/README.md is not a runtime package entry',
|
||||
]) {
|
||||
expect(disallowedPayloadResult.stderr).toContain(diagnostic);
|
||||
}
|
||||
fs.rmSync(serviceMapPath);
|
||||
fs.rmSync(hiveSourceDir, { recursive: true });
|
||||
fs.rmSync(coreSourceDir, { recursive: true });
|
||||
fs.rmSync(unscopedSourceDir, { recursive: true });
|
||||
fs.rmSync(nestedVendorDir, { recursive: true });
|
||||
fs.rmSync(firstPartyReadme);
|
||||
@@ -1785,7 +1783,7 @@ describe('Tauri Production Configuration', () => {
|
||||
fixtureResources,
|
||||
'node_modules',
|
||||
'@waggle',
|
||||
'hive-mind-core',
|
||||
'core',
|
||||
'dist',
|
||||
'runtime-directory',
|
||||
);
|
||||
@@ -1834,7 +1832,7 @@ describe('Tauri Production Configuration', () => {
|
||||
const inlineMapResult = await runChecker();
|
||||
expect(inlineMapResult.status).toBe(1);
|
||||
expect(inlineMapResult.stderr).toContain(
|
||||
'resources/node_modules/@waggle/hive-mind-core/dist/index.js contains a sourceMappingURL directive',
|
||||
'resources/node_modules/@waggle/core/dist/index.js contains a sourceMappingURL directive',
|
||||
);
|
||||
expect(inlineMapResult.stderr).toContain(
|
||||
'resources/service.js contains a sourceMappingURL directive',
|
||||
@@ -2106,13 +2104,6 @@ describe('CI/CD Configuration', () => {
|
||||
const vendorPackage = JSON.parse(
|
||||
fs.readFileSync(path.join(ROOT, 'vendor', 'pptxgenjs', 'package.json'), 'utf-8'),
|
||||
) as { name?: string; version?: string };
|
||||
const workflow = parseYaml(fs.readFileSync(
|
||||
path.join(ROOT, '.github', 'workflows', 'hive-mind-cli-cross-platform.yml'),
|
||||
'utf-8',
|
||||
)) as {
|
||||
on?: { pull_request?: { paths?: string[] } };
|
||||
jobs?: Record<string, { steps?: Array<{ name?: string; run?: string }> }>;
|
||||
};
|
||||
const vaultTests = fs.readFileSync(
|
||||
path.join(ROOT, 'packages', 'core', 'tests', 'vault.test.ts'),
|
||||
'utf-8',
|
||||
@@ -2147,18 +2138,6 @@ describe('CI/CD Configuration', () => {
|
||||
});
|
||||
expect(vendorPackage).toMatchObject({ name: 'pptxgenjs', version: '4.0.1-waggle.0' });
|
||||
|
||||
const installStep = workflow.jobs?.['install-and-smoke']?.steps?.find(
|
||||
(step) => step.name === 'Install workspace deps',
|
||||
);
|
||||
expect(installStep?.run).toBe('npm ci');
|
||||
expect(workflow.on?.pull_request?.paths).toEqual(
|
||||
expect.arrayContaining([
|
||||
'vendor/pptxgenjs/**',
|
||||
'package.json',
|
||||
'package-lock.json',
|
||||
'.github/workflows/hive-mind-cli-cross-platform.yml',
|
||||
]),
|
||||
);
|
||||
expect(vaultTests).toMatch(
|
||||
/removes a pre-existing explicit Everyone allow ACE[\s\S]*?node_modules\/vite-node\/vite-node\.mjs[\s\S]*?'--config'[\s\S]*?probePath[\s\S]*?\r?\n\s*210_000,\r?\n\s*\);/,
|
||||
);
|
||||
@@ -4158,40 +4137,6 @@ Expect-Rejection {
|
||||
expect(workflow).toContain('stage-sidecar-deps');
|
||||
});
|
||||
|
||||
it('Windows desktop workflows verify isolated packaged hook lifecycles after staging', () => {
|
||||
const workflows = [
|
||||
{
|
||||
name: 'release.yml',
|
||||
windowsJob: ' build-windows-prebuilt:',
|
||||
nextJob: ' sign-windows:',
|
||||
},
|
||||
{
|
||||
name: 'tauri-build-pr.yml',
|
||||
windowsJob: ' verify-windows:',
|
||||
nextJob: ' verify-macos:',
|
||||
},
|
||||
];
|
||||
|
||||
for (const { name, windowsJob, nextJob } of workflows) {
|
||||
const workflow = fs.readFileSync(
|
||||
path.join(ROOT, '.github', 'workflows', name),
|
||||
'utf-8',
|
||||
);
|
||||
const windowsStart = workflow.indexOf(windowsJob);
|
||||
const nextStart = workflow.indexOf(nextJob, windowsStart);
|
||||
expect(windowsStart).toBeGreaterThanOrEqual(0);
|
||||
expect(nextStart).toBeGreaterThan(windowsStart);
|
||||
|
||||
const windowsSteps = workflow.slice(windowsStart, nextStart);
|
||||
const stageIndex = windowsSteps.indexOf('node scripts/stage-sidecar-deps.mjs');
|
||||
const lifecycleIndex = windowsSteps.indexOf('hook-packages-runtime.test.ts');
|
||||
expect(stageIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(lifecycleIndex).toBeGreaterThan(stageIndex);
|
||||
expect(windowsSteps).toContain('WAGGLE_VERIFY_STAGED_HOOK_RUNTIME');
|
||||
expect(windowsSteps).toContain('runs staged Tauri hook lifecycles');
|
||||
}
|
||||
});
|
||||
|
||||
it('PR Windows workflow certifies the locally built NSIS lifecycle before upload', () => {
|
||||
const workflow = fs.readFileSync(
|
||||
path.join(ROOT, '.github', 'workflows', 'tauri-build-pr.yml'),
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
/**
|
||||
* AI-OS Phase 2A — integration tests for /api/tools/launch and
|
||||
* /api/tools/hooks.
|
||||
* AI-OS Phase 2A — integration tests for /api/tools/launch.
|
||||
*
|
||||
* The launch + hook routes call into `@waggle/agent`'s launchTool /
|
||||
* runHookCommand. To keep these tests hermetic AND non-destructive
|
||||
* (`npx --yes @waggle/hive-mind-hooks-claude-code install` would
|
||||
* actually modify ~/.claude/settings.json on the test machine), we
|
||||
* mock the launcher module at the module level.
|
||||
* The launch route calls into `@waggle/agent`'s launchTool. To keep these
|
||||
* tests hermetic AND non-destructive (a real launch would start the tool on
|
||||
* the test machine), we mock the launcher module at the module level.
|
||||
*
|
||||
* The launcher unit tests (`packages/agent/tests/tool-launcher.test.ts`)
|
||||
* cover the actual spawn / exec paths with injected deps — this
|
||||
@@ -32,8 +29,6 @@ vi.mock('@waggle/agent', async (importOriginal) => {
|
||||
id: 'foo-cli',
|
||||
displayName: 'Foo CLI',
|
||||
launchable: true,
|
||||
hookCapable: false,
|
||||
hookPointer: '.foo/hive-mind-install.json',
|
||||
detect: { kind: 'path' as const, binaryName: 'foo' },
|
||||
promptArgTemplate: ['--print', '{prompt}'],
|
||||
builtin: false,
|
||||
@@ -50,8 +45,6 @@ vi.mock('@waggle/agent', async (importOriginal) => {
|
||||
installed: true,
|
||||
installedPath: `/server-detected/${manifest.id}`,
|
||||
version: 'test',
|
||||
hooksInstalled: false,
|
||||
hookPointerPath: null,
|
||||
})),
|
||||
})),
|
||||
launchTool: vi.fn((opts: { id: string; installedPath: string }) => ({
|
||||
@@ -59,22 +52,12 @@ vi.mock('@waggle/agent', async (importOriginal) => {
|
||||
pid: 99999,
|
||||
executed: { binary: opts.installedPath, args: [] },
|
||||
})),
|
||||
runHookCommand: vi.fn(
|
||||
async (opts: { id: string; action: string }) => ({
|
||||
ok: true,
|
||||
action: opts.action,
|
||||
packageName: `@waggle/hive-mind-hooks-${opts.id}`,
|
||||
stdout: 'mock install output',
|
||||
stderr: '',
|
||||
code: 0,
|
||||
}),
|
||||
),
|
||||
};
|
||||
});
|
||||
|
||||
import { buildLocalServer } from '../src/local/index.js';
|
||||
import { injectWithAuth } from './test-utils.js';
|
||||
import { detectInstalledTools, launchTool, runHookCommand } from '@waggle/agent';
|
||||
import { detectInstalledTools, launchTool } from '@waggle/agent';
|
||||
import { loopbackSidecarUrl } from '../src/local/routes/tools.js';
|
||||
import { resolveWorkspaceExecutionRoot } from '../src/local/workspace-execution-root.js';
|
||||
|
||||
@@ -240,7 +223,7 @@ describe('POST /api/tools/launch', () => {
|
||||
tools: [{
|
||||
id: 'codex', displayName: 'Codex CLI', installed: true,
|
||||
installedPath: 'C:\\Program Files\\WindowsApps\\OpenAI.Codex\\resources\\codex.exe',
|
||||
version: null, hooksInstalled: false, hookPointerPath: null,
|
||||
version: null,
|
||||
launchable: false, diagnostic: 'The Store resource CLI cannot launch outside its package.',
|
||||
}],
|
||||
});
|
||||
@@ -935,112 +918,14 @@ describe('POST /api/tools/hooks', () => {
|
||||
if (tmpDir) cleanupDir(tmpDir);
|
||||
});
|
||||
|
||||
it('runs install action and returns 200 + stdout', async () => {
|
||||
vi.mocked(runHookCommand).mockClear();
|
||||
it('is gone: coding-agent hooks are not part of the community edition (ADR-0002)', async () => {
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: { id: 'claude-code', action: 'install' },
|
||||
});
|
||||
expect(res.statusCode).toBe(200);
|
||||
const body = res.json();
|
||||
expect(body.ok).toBe(true);
|
||||
expect(body.action).toBe('install');
|
||||
expect(body.stdout).toBe('mock install output');
|
||||
expect(runHookCommand).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ id: 'claude-code', action: 'install' }),
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects a client-supplied CLI path instead of executing it', async () => {
|
||||
vi.mocked(runHookCommand).mockClear();
|
||||
const response = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: {
|
||||
id: 'claude-code',
|
||||
action: 'install',
|
||||
cliPath: 'C:\\hive-mind-cli.js',
|
||||
},
|
||||
});
|
||||
expect(response.statusCode).toBe(400);
|
||||
expect(runHookCommand).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each(['install', 'verify', 'uninstall'])(
|
||||
'accepts action=%s',
|
||||
async (action) => {
|
||||
vi.mocked(runHookCommand).mockClear();
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: { id: 'cursor', action },
|
||||
});
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(runHookCommand).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ id: 'cursor', action }),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
it('rejects unknown action', async () => {
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: { id: 'claude-code', action: 'destroy' },
|
||||
});
|
||||
expect(res.statusCode).toBe(400);
|
||||
});
|
||||
|
||||
it('rejects unknown tool id', async () => {
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: { id: 'unknown-tool', action: 'install' },
|
||||
});
|
||||
expect(res.statusCode).toBe(400);
|
||||
});
|
||||
|
||||
it('returns 400 when the underlying command fails', async () => {
|
||||
vi.mocked(runHookCommand).mockResolvedValueOnce({
|
||||
ok: false,
|
||||
action: 'install',
|
||||
packageName: '@waggle/hive-mind-hooks-claude-code',
|
||||
stdout: '',
|
||||
stderr: 'permission denied writing settings.json',
|
||||
code: 1,
|
||||
});
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST',
|
||||
url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: { id: 'claude-code', action: 'install' },
|
||||
});
|
||||
expect(res.statusCode).toBe(400);
|
||||
expect(res.json().stderr).toContain('permission denied');
|
||||
});
|
||||
|
||||
it('returns 503 when the packaged hook runtime is missing', async () => {
|
||||
vi.mocked(runHookCommand).mockResolvedValueOnce({
|
||||
ok: false,
|
||||
action: 'install',
|
||||
packageName: '@waggle/hive-mind-hooks-claude-code',
|
||||
stdout: '', stderr: '', code: -1,
|
||||
errorCode: 'hook_runtime_missing',
|
||||
error: 'runtime missing',
|
||||
});
|
||||
const res = await injectWithAuth(server, {
|
||||
method: 'POST', url: '/api/tools/hooks',
|
||||
headers: { 'content-type': 'application/json' },
|
||||
payload: { id: 'claude-code', action: 'install' },
|
||||
});
|
||||
expect(res.statusCode).toBe(503);
|
||||
expect(res.json().errorCode).toBe('hook_runtime_missing');
|
||||
expect(res.statusCode).toBe(404);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@ vi.mock('@waggle/agent', async (importOriginal) => {
|
||||
installed: true,
|
||||
installedPath: '/server-detected/claude-code',
|
||||
version: 'test',
|
||||
hooksInstalled: false,
|
||||
hookPointerPath: null,
|
||||
}],
|
||||
})),
|
||||
launchTool: vi.fn((opts: { id: string; installedPath: string }) => ({
|
||||
|
||||
@@ -93,10 +93,8 @@ describe('GET /api/tools/detect', () => {
|
||||
expect(t).toHaveProperty('installed');
|
||||
expect(t).toHaveProperty('installedPath');
|
||||
expect(t).toHaveProperty('version');
|
||||
expect(t).toHaveProperty('hooksInstalled');
|
||||
expect(t).toHaveProperty('hookPointerPath');
|
||||
expect(t).not.toHaveProperty('hooksInstalled');
|
||||
expect(typeof t.installed).toBe('boolean');
|
||||
expect(typeof t.hooksInstalled).toBe('boolean');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user