feat(m7.3): TypeScript registry + ask/run loop, budgets, stop - #29
Merged
Conversation
- CapabilityRegistry: the only path to a capability. Validates arguments against
the schema BEFORE executing (model output is untrusted — the schema is the
prepared statement, §2.6: required keys, JSON types, and additionalProperties all
fail closed), then invokes the handler and returns the outcome as data
(CapabilityResult); a thrown handler error becomes errors-as-data, never crossing
the loop. Unknown names return a closest-match suggestion (Levenshtein). Only a
duplicate registration throws.
- runLoop: the async ETCSLV lifecycle (Engage → Think → Call → Sense → Loop? →
Verify) — the model is the only stochastic step; dispatch and stopping are
deterministic and owned here (§2.14). Returns a RunReport (outcome / output /
finish / usage / turn / executed / reason / trace_id).
- The ask/run boundary: ask() is structurally read-only — a write turn is refused
before anything executes (write_in_read_only, §2.1). run() may write, but the
policy → approval → audit gate lands in M7.4; until then a write fails closed
(write_denied, never executed). The caller's principal propagates as a Context
into every capability call (§2.7).
- Budget {max_turns, max_tokens} + defaultBudget (8 turns) + StopCondition
(GoalReached / MaxTurns / firstStop) — a runaway loop stops deterministically
(§2.13).
- Agent: a config-object class (idiomatic TS rather than Go's functional options)
with ask()/run(); a duplicate capability name is a control-plane throw.
Verified: make js-check green — format, typecheck, 54 tests (registry register/
list/validate/call, unknown-with-suggestions, handler-throw-as-data; read goal
completes; ask refuses + run fails-closed on a write with the handler never
invoked; budget stops a runaway loop; Agent trace id + principal propagation +
duplicate detection).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Verified: make js-check green — format, typecheck, 54 tests (registry register/ list/validate/call, unknown-with-suggestions, handler-throw-as-data; read goal completes; ask refuses + run fails-closed on a write with the handler never invoked; budget stops a runaway loop; Agent trace id + principal propagation + duplicate detection).