feat: de-risk agent loop — semantic tool schema + agent loop + real-WP spike harness
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
This commit is contained in:
SinachPat
2026-08-15 23:49:07 +01:00
parent 69b2481299
commit b61ff21710
15 changed files with 592 additions and 1 deletions
+23
View File
@@ -0,0 +1,23 @@
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);
});
});