Files
Leon Aburime 9166c3bf09 feat(contracts): agent-ready capability contracts + design RFCs (#5398) (#5400)
* feat(contracts): agent-ready capability contracts + design RFCs (#5398)

Slice 1 of the "agent-ready OD" proposal (#5398): pure-TypeScript contract
shapes for the assistant's capability layer, plus the design RFCs. No behavior
code.

- packages/contracts/src/agent-tools/: descriptor (declare), actions
  (call/result), manifest (list + paged search), registry (port), task
  (cross-project AgentTask). Discriminated on `surface`; dual-track law is
  structural; action identity is a daemon-minted `invocationId`.
- docs/rfc-drafts/agent-ready.md: umbrella design + slice roadmap, the
  MCP/WebMCP-congruent capability model, tool-search options, and
  "options considered -> recommendation" for the load-bearing decisions.
- docs/rfc-drafts/agent-ready-cross-project.md: the maintainer's separate
  reviewable permissions writeup (AgentTask + permission options).

Registry runtime, endpoints, and behavior are later slices per the roadmap.

* fix(contracts): narrow AgentToolSearchQuery.surface to 'api'

Search is the PULL path over the persistent registry, which per the RFC
holds only api-surface tools — browser availability is PUSH-advertised
per-session and cannot be answered by a session-less search query. Narrow
the searchable surface to 'api' so the contract does not encode a
browser-tool discovery path the runtime would have to special-case or
break. Addresses the blocking review on #5400.

* fix(contracts): address review — narrow search result to api-only; distinct browser vs api call paths

Resolves the two remaining blocking findings on PR #5400:

- manifest.ts: narrow `AgentToolSearchResult.tools` from the full
  `AgentToolDescriptor` union to `ApiToolDescriptor[]`, enforcing the
  PULL/api-only search invariant on the response side too (the query
  `surface` was already narrowed to `'api'`). A registry impl can no
  longer type-check while leaking `browser` descriptors into a
  session-less search result.

- agent-ready.md: stop presenting `BrowserActionRequest` as the generic
  `tools/call` for every capability. The two surfaces now have distinct
  request paths: `api` tools are invoked through their declared `/api/*`
  route + `od` subcommand (no round-trip envelope), while
  `BrowserActionRequest`/`Result` is the browser-surface path only — the
  genuinely new inbound seam.

- agent-ready-cross-project.md: reconcile the slice-5 cross-project
  routing fields (`taskId?`/`targetProjectId?`) with the distinct-paths
  model — added on both the browser envelope and the api-call request,
  not bolted onto `BrowserActionRequest` for api tools.

Validation: contracts typecheck pass; pnpm guard pass.

---------

Co-authored-by: LA <la@LAs-MacBook-Pro.lan>
2026-07-11 08:38:54 +00:00
..