Skip to content

feat(m7.3): TypeScript registry + ask/run loop, budgets, stop - #29

Merged
shamspias merged 1 commit into
mainfrom
build/m7.3-ts-loop
Jul 5, 2026
Merged

feat(m7.3): TypeScript registry + ask/run loop, budgets, stop#29
shamspias merged 1 commit into
mainfrom
build/m7.3-ts-loop

Conversation

@shamspias

Copy link
Copy Markdown
Owner
  • 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).

- 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).
@shamspias
shamspias merged commit a09210c into main Jul 5, 2026
3 checks passed
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