Skip to content

Slice 020: Tool protocol + registry - #26

Merged
HackTuah merged 5 commits into
mainfrom
slice/020-tool-protocol-registry
Sep 20, 2026
Merged

HackTuah merged 5 commits into
mainfrom
slice/020-tool-protocol-registry

Conversation

@HackTuah

Copy link
Copy Markdown
Member

Slice 020 per slices/020-tool-protocol-registry/SLICE.md. Evidence in its PROOF.md; findings and follow-ups in its NOTES.md.

  • Trinity.Tools.Tool (Trinity's own behaviour, ADR-0009), registry over ETS, jsv validation (refuse, never repair), the compile-time effect catalog with its census (AC8), the permissions stub with a code-owned tier map, the concurrent runner with per-tool timeouts.
  • jsv becomes a direct dependency (already locked). No other lock change.
  • Gate exit 0, 204 tests, coverage 67.18% (from 64.41%). No manual queue.

ROADMAP row 020 to in_progress. NOTES.md carries the ten-line build
plan (the behaviour, the schema validator on jsv, the registry with the
namespaced dynamic tools and the compile-time catalog rule, the
permissions stub, the concurrent runner replacing 012's stub, the
declared surface), the empty manual queue, and four deviations stated
before any code. plan_check: PASS.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
Already locked at 0.23.0 through req_llm; Trinity.Tools.Schema calls it,
so it is named in mix.exs and VERSIONS.md (ADR-0009: Trinity's own tool
behaviour with jsv for its schemas). mix.lock unchanged.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
…he catalog rule

Lines 1 to 9 of the G1 plan. Trinity.Tools.Tool (name, description, a
JSON Schema, risk, effect, execute/2, optional timeout/0 and
format_result/1), Context, Result with cap/2 (64 KB, a marker,
original_bytes in meta), Schema.validate/2 on jsv with cast: false.
Trinity.Tools.Registry (GenServer over ETS in Trinity.Tools.Supervisor
with the task supervisor): core tools from config :trinity, :tools,
dynamic ones through register/2 with the namespaced-name rule, the
reserved core names, the schema check and the refusal of a :catalog
claim; definition digests. Trinity.Effects.Catalog, the compile-time
attribute (empty). Trinity.Permissions: tier/1 from a code-owned map
(empty at this slice, every name :ask), the Policy behaviour, the
default that allows, the implementation from config. Trinity.Tools.
Runner: every call of a turn at once under the task supervisor, each
with its tool's timeout, lookup, validate, decide once, execute, cap;
crashes, timeouts and unknown names are error results. The Session
calls run_all/2, writes one tool row per answer with tool_result and
tool_definition_digest, puts the declared surface into the request and
onto the assistant row; Trinity.Tools.surface_diff/1 over a history.

Tests, 27 in test/trinity/tools: AC1 (four test tools listed with
schemas and digests; no lib module names a test tool), AC2 (two 300 ms
sleeps under 500 ms, two rows, a final message), AC3 (a raise and an
exit are error rows, the session goes on, both supervisors keep their
pids), AC4 (a 5 s sleep against a 500 ms timeout answers within 600 ms),
AC5 (truncated row, marker, original size), AC6 (a Mox tool's execute/2
never called on bad arguments), AC7 (a Mox policy's decide/3 exactly
once per call), AC8 (the census over the app's module list: two plants
claiming :catalog are named; the runtime path and the config path are
both refused by name), AC9 (an impostor named echo refused; a
namespaced echo gets :ask). The 012 tool-path test reads the runner's
"no such tool" now. Gate exit 0, 204 tests; credo --strict --all clean.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
PROOF.md with every criterion's evidence: AC1 live (a fifth tool, one
config line, an empty lib/ diff) and in the suite, AC2 to AC7 through
the Session with the fake provider's tool calls and two Mox mocks, AC8
the census over the application's module list with two plants named,
AC9 the impostor refused. NOTES.md carries the nine findings, three of
them G1 deviations that boundary reversed. coverage.tsv: 020 at 67.18%
from 64.41%. ROADMAP row 020 to done. Gate exit 0, 204 tests.

Signed-off-by: Ayla Croft <aylacroft@proton.me>
Signed-off-by: Ayla Croft <aylacroft@proton.me>
@HackTuah
HackTuah merged commit da9eebf into main Sep 20, 2026
4 checks passed
@HackTuah
HackTuah deleted the slice/020-tool-protocol-registry branch September 20, 2026 17:55
@HackTuah HackTuah mentioned this pull request Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant