2 Commits
Author SHA1 Message Date
Nick 59efd385db feat(tool_protocol): literal-100% residue — dichotomy wave
Port the five audit-unmatched helpers name-preserving into the Go crate
(gaps.go): _utc_now_iso (Python isoformat law — six-digit fraction iff
nonzero, injectable clock seam pinned by the battery to the frozen
oracle instants), _contains_tool_object_key (name-preserving twin of
the outside-strings scanner), to_ollama_tools (registry → Ollama
function shape), dispatch_validated_tool (validate-before-dispatch with
an Executor seam; invalid calls provably never reach the executor),
tool_requires_approval (fail-closed against the 12-name READ_ONLY
frozenset; NOT derived from registry risk — lint_file runs a linter).
Truth 17→32 cases (utc both instants, 8 scanner cases, full-registry
ollama conversion, dispatch alias/invalid, approval verdict for every
registered tool + alias + unknown with schema-valid minimal args);
regen x2 identical modulo the pre-existing uuid call_id quirk.
DEFECT FOUND+FIXED: the landed containsToolObjectKey reused ONE
json.Decoder across candidates (wrong offsets after the first decode)
and dropped the oracle's colon check — the new frozen true-positive
cases exposed it; rewritten to the oracle's per-candidate raw-decode +
colon law (fix-first, proof = battery green). go test/vet/gofmt/build
clean; pytest 60+29 subtests both pins. tool_protocol 22/27 → 27/27
fn-level.
2026-10-15 08:03:52 +01:00
Nick 4032c753f3 feat(go): factory batch 1 — tool-protocol validation core (contract BUILDER-2026-10-07T22:11:52Z-9ffb73)
The model→tool boundary ported to tool-protocol:
- ValidateToolRequest: alias canonicalization BEFORE schema (grep→
  grep_files, bash→run_command — bash never bypasses run_command's
  approval boundary), exact Python error texts (unknown tool / required
  argument missing / unknown argument / must be <type>), array item
  type checks, deterministic arg iteration for error stability
- schemas from the FROZEN tools_registry.json (shared with
  tool-executor — the set-equality authority)
- NormalizeOllamaToolCalls: native envelope + string-arguments JSON
  decode, malformed-shape errors
- ContainsInternalProtocol: result/error markers + xml tool_call spans
- ToolRequest dataclass aligned to the Python shape (Arguments field)
- 17-case truth battery from the live oracle; span-surgery surfaces
  (extract_visible_text, text-fallback parse) pinned for batch 2
2026-10-07 23:48:24 +01:00