Mirror to GitHub / mirror (push) Canceled after 0s
- api/agents: tool-schemas (semantic allowlist), agent-loop (multi-step + budget), circuit-breaker, llm-client/tool-executor interfaces - api/agents: WpRestExecutor (real WP REST), OpenRouterLlmClient - e2e/agent: multi-step prompts + run-agent-spike runner (scores rendered changes) - ADR 0017; 101 unit tests green
24 lines
854 B
TypeScript
24 lines
854 B
TypeScript
import { describe, it, expect } from 'vitest';
|
|
import { ALLOWED_TOOL_NAMES, generateToolSchemas } from '../../src/agents/tool-schemas.ts';
|
|
|
|
describe('generateToolSchemas', () => {
|
|
it('returns a non-empty tool set', () => {
|
|
expect(generateToolSchemas().length).toBeGreaterThan(0);
|
|
});
|
|
|
|
it('only exposes allowlisted semantic tools', () => {
|
|
const names = generateToolSchemas().map((s) => s.function.name);
|
|
expect(names.length).toBeGreaterThan(0);
|
|
for (const name of names) {
|
|
expect(ALLOWED_TOOL_NAMES).toContain(name);
|
|
}
|
|
});
|
|
|
|
it('exposes no eval, config, raw SQL, rm, or arbitrary plugin install surface', () => {
|
|
const blob = generateToolSchemas()
|
|
.map((s) => JSON.stringify(s))
|
|
.join(' ');
|
|
expect(blob).not.toMatch(/wp eval|wp config|DROP TABLE|DELETE FROM|\brm\b|plugin install http/i);
|
|
});
|
|
});
|