Skip to content

refactor(kernel-agents): make the exo membrane the sole capability arg enforcer#960

Draft
grypez wants to merge 1 commit into
feat/capabilities-as-discoverable-exosfrom
refactor/retire-agent-arg-validation
Draft

refactor(kernel-agents): make the exo membrane the sole capability arg enforcer#960
grypez wants to merge 1 commit into
feat/capabilities-as-discoverable-exosfrom
refactor/retire-agent-arg-validation

Conversation

@grypez

@grypez grypez commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Explanation

Now that every capability is a pattern-guarded discoverable exo (base PR),
retires the membraneless authoring and validation paths so the exo's interface
guard is the single argument enforcer:

  • Removes the capability() authoring helper and the validateCapabilityArgs validator (and its now-dead module). The chat strategy no longer re-validates arguments before invoking — it relies on the guard rejection it already catches and reports as a tool error.
  • Adds a test/make-capability.ts helper that builds a guarded, discovered capability from the described*() combinators, and migrates the chat and JSON evaluator tests (and the capability test, repurposed to cover the surviving extract* helpers) onto it.
  • Drops the now-unused @metamask/superstruct dependency.

Breaking changes

  • capability and validateCapabilityArgs are no longer exported from @ocap/kernel-agents. Author capabilities as discoverable exos (via the described*() combinators) and convert them with discover / discoverLocal.

Test plan

  • yarn workspace @ocap/kernel-agents test:dev:quiet (50 pass)
  • yarn workspace @ocap/kernel-agents-repl test:dev:quiet (178 pass)
  • build + lint for both packages; changelog validates

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 71.32%
⬆️ +0.22%
8834 / 12386
🔵 Statements 71.14%
⬆️ +0.23%
8982 / 12625
🔵 Functions 72.5%
⬆️ +0.31%
2131 / 2939
🔵 Branches 64.77%
⬆️ +0.09%
3557 / 5491
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/kernel-agents/src/types.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
packages/kernel-agents/src/capabilities/capability.ts 100%
⬆️ +25.00%
100%
🟰 ±0%
100%
⬆️ +40.00%
100%
⬆️ +25.00%
packages/kernel-agents/src/strategies/chat-agent.ts 90.76%
⬇️ -0.14%
87.5%
🟰 ±0%
100%
🟰 ±0%
90.16%
⬇️ -0.16%
140, 185-193
packages/kernel-agents/src/types/capability.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #4468 for commit 41f106b by the Vitest Coverage Report Action

@grypez grypez force-pushed the feat/capabilities-as-discoverable-exos branch from 9e110e2 to 6c6abee Compare June 17, 2026 16:41
@grypez grypez force-pushed the refactor/retire-agent-arg-validation branch from 6465e1f to 99b92e4 Compare June 17, 2026 16:41
@grypez grypez force-pushed the feat/capabilities-as-discoverable-exos branch from 6c6abee to 620c437 Compare June 18, 2026 15:37
@grypez grypez force-pushed the refactor/retire-agent-arg-validation branch from 99b92e4 to 41f106b Compare June 18, 2026 15:37
…g enforcer

Now that every capability is a pattern-guarded discoverable exo, retire the
membraneless authoring and validation paths:

- Remove the `capability()` authoring helper and the `validateCapabilityArgs`
  validator (and its now-dead module). A capability's arguments are enforced
  only by its exo's interface guard; the chat strategy no longer re-validates
  before invoking, relying on the guard rejection it already catches.
- Add a `test/make-capability.ts` helper that builds a guarded capability from
  the `described*()` combinators via `makeInternalCapabilities`, and migrate the
  chat and JSON evaluator tests (and the capability test, repurposed to cover
  the surviving `extract*` helpers) onto it.
- Collapse the redundant `CapabilitySchema` type into kernel-utils'
  `MethodSchema`: a capability's `schema` is exactly the `MethodSchema` its exo
  describes, so the parallel type (and its `ExtractRecordKeys` helper) is gone.
- Drop the unused `@metamask/superstruct` dependency.

BREAKING: `capability` and `validateCapabilityArgs` are no longer exported.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@grypez grypez force-pushed the refactor/retire-agent-arg-validation branch from 41f106b to cf4502f Compare June 18, 2026 15:55
@grypez grypez force-pushed the feat/capabilities-as-discoverable-exos branch from 620c437 to 1812ca4 Compare June 18, 2026 15:56
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