Skip to content

WarToolsAI Architecture

WarToolsAI separates specification, runtime policy, transport, and workbench presentation into four clean layers:

  1. Canonical Spec (spec/):
  2. spec/registry-manifest.json defines all 51 tools, 17 domains, 5 frozen presets (explicit tool-name lists), input/output schemas, and schema token estimates.
  3. spec/contracts/<domain>.json defines language-agnostic test fixtures covering happy paths, TOOL_DISABLED, invalid input handling, maxOutputChars truncation (meta.truncated), SSRF blocking, symlink sandbox escape detection (SANDBOX_PATH_DENIED), persistent KV TTL across restarts, and trace sink exports.
  4. spec/data/*.json holds shared datasets. python3 scripts/gen-shared-data.py generates packages/node/src/generated/shared-data.ts, packages/python/src/warlockcode_wartools_ai/_generated/shared_data.py and packages/dotnet/src/WarlockCode.WarToolsAI/Generated/SharedData.g.cs. --check (run by npm run sync:check via scripts/sync-manifest.py) fails when they are stale or when a pattern/regex string uses non-portable constructs (lookbehind, named groups, \d \w \s \b, possessive quantifiers, atomic groups).
  5. spec/unit/*.json holds shared unit vectors asserted identically by every SDK (UnicodeKit/NumKit).
  6. Default-Off Policy Engine:
  7. Every runtime (packages/node, packages/python, packages/dotnet) initializes with preset = "none" and enable = [].
  8. Presets are frozen explicit tool-name lists. User enable selectors expand *, <domain>.*, or exact tool names (time.now) against the manifest.
  9. Pluggable Persistence & Traceability:
  10. KvStore / IKvStore supports MemoryKvStore and JsonFileKvStore (persisting KV entries with ttlSeconds, scratchpad state, and checkpoints per sessionId).
  11. TraceSink / ITraceSink supports MemoryTraceSink and FileTraceSink JSONL export.
  12. Transports & Workbench:
  13. Node and Python provide MCP JSON-RPC servers (stdio, plus HTTP SSE in Node).
  14. Root server.ts mounts the workbench API (/api/catalog, /api/tools/execute, /api/session, /api/docs) delegating directly to packages/node/src.