Repository navigation
feat(adapter): arc 1 — typed protocol descriptors on AdapterCapabilities - #1543
Merged
Merged
Conversation
…ies (card 42bd9367) The bool-flag `AdapterCapabilities` (supports_tool_use, supports_vision, etc.) was unsigned about HOW each capability is provided — fine for "is the feature available" questions, useless for "which protocol does cognition need to speak." Arc 1 of the substrate plan addresses this directly. This commit adds three typed descriptors alongside the existing bool flags (kept for back-compat; new selectors should consult the typed fields): - `tool_call_protocol: ToolCallProtocol` — enumerates HOW the adapter accepts tool calls. None / JsonInPrompt / JsonMode / NativeFunctionCalling / XmlTags. Cognition's tool loop routes through this without special-casing per adapter name. - `structured_output_protocol: StructuredOutputProtocol` — None / JsonSchema / GrammarConstrained (llama.cpp GBNF) / PromptOnly. Lets cognition pick the right enforcement strategy per workload per adapter. - `modalities: ModalitySet` — typed text_in/text_out/vision_in/audio_in/ audio_out booleans declaring what the adapter handles NATIVELY. Modalities NOT in the set get bridged by the substrate (VisionDescriptionService, STT, TTS) before the adapter sees the request. LCD personas get sensory parity via bridges per the [[ai-namespace-multimodal-crutches]] doctrine. - `max_output_tokens: u32` — distinct from `max_context_window`; bounds the compose phase. Each existing adapter declares truthfully: - **HeuristicAdapter** — TEXT_ONLY, no tool protocol, no structured output. Substrate doesn't try to use it for what it can't do. - **OpenAI-compatible** (OpenAI/DeepSeek/Together/Fireworks/Groq/xAI/ Mistral) — NativeFunctionCalling + JsonSchema when supports_tools. Vision-in native when supports_vision. - **Anthropic** — NativeFunctionCalling (tool_use blocks) + JsonSchema. Vision-in native. - **LlamaCpp** — JsonInPrompt (prompt-driven tool emulation) + GrammarConstrained (GBNF). Vision-in handled by mmproj adapter separately. - **AircRemoteAdapter** — defers to None / TEXT_ONLY until a capability-discovery handshake card lands (future work). Per [[adapter-pattern-is-the-pivot-insurance]]: every ML-touching capability sits behind this trait so the substrate pivots (swap framework, swap model, swap provider) by declaration, not rewrite. Arc 2 (#122 LoRA paging) and arc 3 (teacher routing) build on this. Tests: 48/48 ai:: tests pass; no behavior changes (existing capability queries continue to work via bool flags; new typed fields are purely additive). Co-Authored-By: Claude Opus 4.7 <[email protected]>
joelteply
added a commit
that referenced
this pull request
Oct 6, 2026
…; history is never replayed down a stream (#1543) (#4817) InboxRequest gained before (the backward page); the core's two forward inbox reads pass None. Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
feat(adapter): arc 1 — typed protocol descriptors on AdapterCapabilities (card 42bd9367)
The bool-flag
AdapterCapabilities(supports_tool_use, supports_vision, etc.)was unsigned about HOW each capability is provided — fine for "is the
feature available" questions, useless for "which protocol does cognition
need to speak." Arc 1 of the substrate plan addresses this directly.
This commit adds three typed descriptors alongside the existing bool
flags (kept for back-compat; new selectors should consult the typed
fields):
tool_call_protocol: ToolCallProtocol— enumerates HOW the adapteraccepts tool calls. None / JsonInPrompt / JsonMode /
NativeFunctionCalling / XmlTags. Cognition's tool loop routes through
this without special-casing per adapter name.
structured_output_protocol: StructuredOutputProtocol— None /JsonSchema / GrammarConstrained (llama.cpp GBNF) / PromptOnly. Lets
cognition pick the right enforcement strategy per workload per adapter.
modalities: ModalitySet— typed text_in/text_out/vision_in/audio_in/audio_out booleans declaring what the adapter handles NATIVELY.
Modalities NOT in the set get bridged by the substrate
(VisionDescriptionService, STT, TTS) before the adapter sees the
request. LCD personas get sensory parity via bridges per the
[[ai-namespace-multimodal-crutches]] doctrine.
max_output_tokens: u32— distinct frommax_context_window; boundsthe compose phase.
Each existing adapter declares truthfully:
output. Substrate doesn't try to use it for what it can't do.
Mistral) — NativeFunctionCalling + JsonSchema when supports_tools.
Vision-in native when supports_vision.
JsonSchema. Vision-in native.
GrammarConstrained (GBNF). Vision-in handled by mmproj adapter
separately.
capability-discovery handshake card lands (future work).
Per [[adapter-pattern-is-the-pivot-insurance]]: every ML-touching
capability sits behind this trait so the substrate pivots (swap
framework, swap model, swap provider) by declaration, not rewrite.
Arc 2 (#122 LoRA paging) and arc 3 (teacher routing) build on this.
Tests: 48/48 ai:: tests pass; no behavior changes (existing capability
queries continue to work via bool flags; new typed fields are purely
additive).
Co-Authored-By: Claude Opus 4.7 [email protected]