refactor: remove duplicate runtime architecture - #2742
Merged
Conversation
jackwener
force-pushed
the
codex/remove-duplicate-runtime-architecture
branch
6 times, most recently
from
August 11, 2026 17:39
b1bf160 to
0beb4ca
Compare
jackwener
force-pushed
the
codex/remove-duplicate-runtime-architecture
branch
from
August 11, 2026 17:42
0beb4ca to
89a05a4
Compare
4 tasks
4 tasks
sunheyi6
added a commit
to sunheyi6/maka-agent
that referenced
this pull request
Aug 26, 2026
…ering contract (apache#1382 slice 1) First increment of apache#1382: establish a Maka-owned tool discovery policy on the catalog plus a provider-native lowering contract that the ModelAdapter (apache#1381 seam) lowers to Anthropic / OpenAI native Tool Search, with a deterministic `load_tools` fallback for unsupported models. Add packages/runtime/src/tool-discovery.ts as a pure, provider-package-free module owning: - `ToolDiscovery` policy (`direct` | `deferred` + namespace), extending the catalog model rather than duplicating it; - `buildToolDiscoveryPolicy`, deriving policy from product tools + deferred catalog surfaces + MCP tools grouped per server (MCP tools default deferred — the exact pain point apache#1382 targets: dozens/hundreds of MCP schemas sent every request even when the model needs one tool); - `resolveProviderToolSearchCapability` (anthropic / openai / none by adapter kind); - `lowerToolsForProvider`, the lowering contract: native modes mark deferred tools with `deferLoading` (OpenAI also carries `namespace`), exclude them from the initial `activeTools`, and add a `tool_search` descriptor kept active; `none` is an identity no-op so today's full-surface behavior and the existing `load_tools` economy are unchanged. This is the contract only, not the live `streamText` wiring. Per the RFC: - Tool Search changes visibility, not authorization; loaded tools still cross `ToolRuntime`. - One authoritative catalog; a search result only selects catalog entries. - Unsupported models keep the current deterministic behavior (no silent tool loss). - An unclassified tool defaults to `direct` (never silently hidden). Rebased onto current main: the apache#1381 seam commit was dropped (merged upstream, evolved); the runtime barrel `index.ts` was retired upstream (apache#2742), so the contract is exposed via a `./tool-discovery` subpath export in package.json.
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.
Summary
This is intentionally a clean cut with no backward-compatible duplicate APIs. Relative to main it removes about 10.8k net lines.
Validation
Tests were not run locally, per request; CI is the test authority for this PR.