This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import type { Database } from '@pig/db';
|
||||
import { createPigTools, PIG_TOOL_NAMES, recordFactInput } from '../src/tools';
|
||||
|
||||
test('the Piggy registry has no ambient coding tools', () => {
|
||||
const tools = createPigTools({} as Database, {
|
||||
task: {} as Parameters<typeof createPigTools>[1]['task'],
|
||||
agentRunId: '10000000-0000-4000-8000-000000000001',
|
||||
});
|
||||
assert.deepEqual(tools.map((tool) => tool.name), [...PIG_TOOL_NAMES]);
|
||||
assert.equal(tools.some((tool) => /bash|shell|file/i.test(tool.name)), false);
|
||||
});
|
||||
|
||||
test('agent claims require both a source URL and an evidence excerpt', () => {
|
||||
const claim = {
|
||||
targetType: 'account',
|
||||
targetId: '10000000-0000-4000-8000-000000000001',
|
||||
field: 'description',
|
||||
value: 'GPU cloud',
|
||||
score: 0.8,
|
||||
};
|
||||
assert.equal(recordFactInput.safeParse(claim).success, false);
|
||||
assert.equal(
|
||||
recordFactInput.safeParse({
|
||||
...claim,
|
||||
sourceUrl: 'https://example.com/source',
|
||||
evidenceExcerpt: 'Example operates a GPU cloud.',
|
||||
}).success,
|
||||
true,
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user