Chio/Docs

Bridges

Chio mediates several upstream protocols through bridge and edge crates. Each surface routes invocations through the kernel guard pipeline, produces a signed receipt, and reports a fidelity rating so clients can tell whether the projection is lossless, adapted, or unsupported.

Source

This page normatively reflects spec/BRIDGES.md in the chio repository. Status: Normative companion to PROTOCOL.md. Version 3.0.

Shared invariant

Every bridge and edge maintains the same security invariant: every mediated action flows through the Chio kernel guard pipeline, producing a signed receipt regardless of the upstream or downstream protocol.

Bridge Model

Two integration shapes appear in the spec:

  • Bridges map an upstream protocol surface inward to MCP-style Chio tools. The OpenAPI-to-MCP bridge takes an OpenAPI spec and exposes each operation as an MCP tool.
  • Edges project Chio kernel-governed tools outward to a different protocol. The A2A and ACP edges serve Chio tools to A2A and ACP clients respectively. The OpenAI adapter wraps OpenAI-style function calls.

In every case the kernel evaluates the invocation, signs the receipt, and emits the result through the originating surface.

Fidelity Levels

All edges classify each tool projection at registration time using a three-level rating. The rating is reported to clients in discovery metadata so they can decide whether the surface is sufficient for their needs.

LevelMeaningGuidance
losslessThe Chio tool maps cleanly to the target protocol's native primitivesNo caveats are required and the bridge MAY publish by default
adaptedThe Chio tool is publishable only with explicit caveatsDiscovery metadata MUST surface the caveats honestly
unsupportedThe target protocol cannot represent the required semantics honestlyThe tool MUST remain unpublished on that surface

Per-Protocol Fidelity Matrix

The matrix below summarizes how each surface handles common Chio feature requirements. Cells reflect the rules in the per-protocol sections that follow.

FeatureOpenAPI bridgeA2A edgeACP edgeOpenAI adapter
Capability validationlosslesslosslesslosslesslossless
Signed receiptslosslesslosslesslosslesslossless
Side-effecting toolslossless (via DenyByDefault)adapted (caveat surfaced)adapted (permission required)lossless
Approval-required toolslosslessunsupportedunsupportedlossless
Streaming outputunsupporteddeferred task lifecycledeferred task lifecyclenot applicable
Cancellationunsupportedvia task/cancelvia tool/cancelnot applicable
Filesystem / terminal toolsnot applicableadaptedlossless (native categories)lossless
Browser toolsnot applicableadaptedunsupported (auto-suppressed)lossless

OpenAPI-to-MCP Bridge

Crate: chio-openapi-mcp-bridge. The bridge presents a Chio-governed HTTP API as an MCP tool surface. Given an OpenAPI 3.x specification, it produces a manifest, exposes each operation as an MCP tool, and routes invocations through the kernel before dispatching to the upstream HTTP API.

Scope

  • Parses the spec via chio-openapi to produce ToolDefinition values.
  • Wraps each HTTP operation as an MCP-visible tool via chio-mcp-edge.
  • Routes invocations through the kernel for capability validation and receipt signing before dispatch.

Manifest validity

The bridge MUST generate a valid chio.manifest.v1 manifest from the OpenAPI spec. If the spec contains zero publishable operations, the bridge MUST reject construction with a manifest error.

tools/list Generation

Each (method, path) pair becomes one entry in the MCP tools/list response.

OpenAPI fieldMCP tool fieldNotes
operationIdnameFalls back to "{METHOD} {path}" when absent
summary / descriptiondescriptionConcatenated when both present
Request body schema or parametersinputSchemaMerged into a single JSON Schema object
Response schema (200/201)outputSchemaOptional; included when include_output_schemas is set
HTTP methodannotations.readOnlyHinttrue for GET/HEAD/OPTIONS; false otherwise

The bridge MUST set has_side_effects to false for GET, HEAD, and OPTIONS operations and true for all other HTTP methods. When x-chio-* extensions are present, they propagate to the corresponding ToolDefinition fields per the rules on the OpenAPI Integration page.

Invocation Flow

The bridge MUST resolve the route binding from the tool name before dispatching. If the tool name does not match any known route binding, the bridge MUST return a ToolNotFound error without contacting the upstream API.

The structuredContent field in the MCP response MUST include:

  • httpStatus: HTTP status from the upstream response
  • method: HTTP method used
  • path: URL path template
  • body: parsed response body

Receipt Generation

Every bridged invocation that reaches the upstream HTTP API MUST produce a signed Chio receipt. The receipt MUST include:

  • tool_name: the MCP tool name (derived from operationId)
  • server_id: the bridge's configured server ID
  • decision: allow for successful invocations; deny if the guard pipeline rejects

Simulation mode

When no HTTP dispatcher is configured, the bridge operates in simulation mode. Simulation responses MUST set structuredContent.bridgeMode to "simulation" and SHOULD NOT produce receipts since no upstream call occurs.

Kernel Integration

The bridge implements ToolServerConnection, allowing direct registration with a kernel instance. Two variants exist:

  • BridgeToolServer<'a>: borrows the bridge for scoped registration.
  • OwnedBridgeToolServer: consumes the bridge for long-lived registration.

Both delegate invoke() to the bridge's internal dispatch logic, mapping BridgeError to KernelError::ToolServerError. See the bridge OpenAPI to MCP guide and the OpenAPI sidecar example.


A2A Edge

Crate: chio-a2a-edge. The A2A edge exposes Chio kernel-governed tools as A2A skills. This is the reverse of chio-a2a-adapter: instead of consuming a remote A2A server, this crate serves Chio tools to external A2A clients. Every invocation flows through the kernel guard pipeline, producing a signed receipt.

Agent Card Generation

The edge MUST serve an Agent Card at /.well-known/agent-card.json. The card is generated from the edge configuration and registered tool manifests.

FieldSourceNotes
nameA2aEdgeConfig.agent_nameMUST be non-empty
descriptionA2aEdgeConfig.agent_descriptionHuman-readable summary
versionA2aEdgeConfig.agent_versionSemantic version
supportedInterfacesDerived from configOne entry per endpoint URL
capabilities.streamingFixed false on the authoritative profileChio does not advertise a receipt-bearing push-stream lifecycle
defaultInputModes["text"]Fixed for current implementation
defaultOutputModes["text"]Fixed for current implementation
skillsDerived from tool manifestsOne skill per Chio tool

Each interface entry MUST include:

  • url: A2A endpoint URL
  • protocolBinding: protocol binding (default "JSONRPC")
  • protocolVersion: "1.0"

Skill Projection

Each Chio ToolDefinition from registered manifests becomes one A2A skill entry.

Chio fieldA2A skill fieldNotes
tool.nameid, nameSkill ID matches the Chio tool name
tool.descriptiondescriptionPassed through unchanged
(inferred)tagsEmpty by default; MAY be populated by operators
(fixed)inputModes["text"]
(fixed)outputModes["text"]
tool.has_side_effectsbridgeFidelityUsed as fidelity signal

Ambiguous names

When multiple manifests contain tools with the same name, the edge MUST NOT silently collapse them. Unqualified ambiguous names are withheld from the authoritative surface, and only deterministic qualified identifiers are published.

SendMessage and SendStreamingMessage

message/send is a blocking request. The edge resolves the target skill from params.metadata.chio.targetSkillId. If only one skill is registered, the edge MAY infer the target. With multiple skills and no target, the edge MUST return JSON-RPC error code -32602.

The task response MUST include:

  • id: monotonically increasing identifier (format a2a-task-{n})
  • status: completed on success; failed on tool server error
  • message: present when status is completed; carries the converted tool result
  • statusMessage: present when status is failed; carries the error description

message/stream is exposed as a deferred receipt-bearing task lifecycle rather than a push-stream transport. It MUST resolve the target skill using the same rules, create a working TaskResponse with signed-authority metadata and receiptPending = true, persist the deferred execution request under the returned task ID, and require follow-up task/get or task/cancel calls to resolve or cancel the task. task/get MUST execute the deferred request through the authoritative path the first time it is called for a working task. Terminal task results MUST carry the same signed receipt metadata as message/send.

Result Conversion

Result typeA2A part typeConversion
String valuetextUsed directly
Object with content arraytext (per entry)Each content[].text becomes a text part
Other object or arraydataPassed through as structured data
Other scalartextConverted via to_string()

A2A BridgeFidelity Evaluation

LevelCriteriaImplications
losslessTool is publishable and does not depend on approval, deferred-stream, cancellation, or partial-output caveatsThe current A2A edge can project the tool without semantic loss
adaptedTool is publishable but side-effect, deferred-stream, cancellation, or partial-output semantics require explicit caveatsThe edge preserves the tool but MUST surface caveats in discovery metadata
unsupportedTool requires interactive approval or explicit publication suppression (x-chio-publish: false)The tool MUST NOT be auto-published on the A2A surface

The bridgeFidelity field is included in each skill entry. Clients SHOULD use this field to assess whether the A2A interface is sufficient. unsupported skills are withheld from the Agent Card entirely. The implementation reads these semantic hints when present on the tool schema:

  • x-chio-publish
  • x-chio-approval-required
  • x-chio-streaming
  • x-chio-cancellation
  • x-chio-partial-output

See the A2A adapter integration page and the hello-a2a example.

Kernel-Mediated Receipts

Every SendMessage invocation that reaches the tool server MUST flow through the kernel guard pipeline. The signed receipt includes:

  • tool_name: matches the A2A skill ID
  • server_id: from the manifest that owns the tool
  • decision: allow for completed tasks; deny for guard rejections

When the tool server returns an error, the task status is failed but a receipt is still generated with the deny or incomplete decision as appropriate.


ACP Edge

Crate: chio-acp-edge. The edge exposes Chio kernel-governed tools as ACP (Agent Client Protocol) capabilities so ACP-compatible editors and IDEs can reach Chio tools through the ACP permission model.

ACP organizes tools around four categories: filesystem, terminal, browser, and generic tool. The edge maps Chio tools into this model with category inference and fidelity assessment.

Capability Mapping

Chio fieldACP capability fieldNotes
tool.nameid, nameCapability ID matches the Chio tool name
tool.descriptiondescriptionPassed through unchanged
(inferred)categorySee the inference rules below
tool.has_side_effects + configrequiresPermissiontrue when config requires permission OR the tool has side effects
(evaluated)bridgeFidelitySee the fidelity rules below

Category Inference and Routing

The edge infers the ACP category from the tool name using keyword matching, applied in order:

PatternCategoryExamples
Name contains read_file, write_file, list_dir, or starts with fs_filesystemread_file, fs_stat, write_file
Name contains terminal, exec, shell, or commandterminalexec_command, run_shell
Name contains browser, navigate, or screenshotbrowserbrowser_click, take_screenshot
No matchtool (configurable default)search, get_weather

When no pattern matches, the edge MUST fall back to AcpEdgeConfig.default_category, which defaults to tool.

Permission Evaluation

The edge implements fail-closed permission evaluation backed by Chio capabilities. It handles session/request_permission requests by:

  1. Looking up the capability by ID. If unknown, the edge MUST return deny.
  2. If requiresPermission is true, the edge MUST return deny by default. Explicit permission grants require kernel capability token validation (full integration deferred to Phase 324).
  3. If requiresPermission is false, the edge MUST return allow.

ACP BridgeFidelity Assessment

LevelCriteriaImplications
losslessCategory is filesystem or terminal and no caveated semantic hints are presentACP natively supports the projection without caveats
adaptedCapability is publishable but depends on permission-preview, collected streaming, partial-output, cancellation, or generic-tool-category caveatsThe capability remains discoverable but caveats MUST be surfaced in bridgeFidelity
unsupportedCategory is browser, category is generic mutating tool, or publication is disabled with x-chio-publish: falseThe capability MUST NOT be auto-published on the ACP surface

unsupported capabilities are withheld from session/list_capabilities.

JSON-RPC Interface

MethodPurposeResponse
session/list_capabilitiesList all ACP capabilities{ capabilities: [...] }
session/request_permissionEvaluate permission for a capability{ decision: "allow" | "deny" }
tool/invokeInvoke a capability through the kernelInvocation result or error
tool/streamCreate a deferred authoritative invocation task{ task: {...} }
tool/cancelCancel a deferred invocation task before execution{ task: {...} }
tool/resumeResolve a deferred invocation task through the kernel{ task: {...}, result: {...} }

Unknown methods MUST return JSON-RPC error code -32601.

See the wrap an ACP server guide and the hello-acp example.


OpenAI Adapter

Crate: chio-openai. The adapter intercepts OpenAI-style tool_use / function-calling requests and routes them through the Chio kernel for capability validation and receipt signing. It supports both the Chat Completions API format and the Responses API format. Every function call produces a signed receipt; guards fail closed by default.

Function Definition Generation

Chio fieldOpenAI fieldNotes
tool.namefunction.nameUsed directly; MUST match the receipt tool_name
tool.descriptionfunction.descriptionPassed through unchanged
tool.input_schemafunction.parametersJSON Schema for function parameters

Chat Completions tool envelope:

json
[
  {
    "type": "function",
    "function": {
      "name": "get_weather",
      "description": "Get the weather for a location",
      "parameters": {
        "type": "object",
        "properties": {
          "location": { "type": "string" }
        },
        "required": ["location"]
      }
    }
  }
]

Receipt Behavior

Every function call MUST produce a signed receipt. The receipt MUST include tool_name, server_id, the kernel-issued receipt_ref, and the signed ChioReceipt object when the call reached the kernel.

Outcomedeniedreceipt_refNotes
Successful invocationfalsePresentKernel returns signed receipt with allow verdict
Guard denialtruePresentKernel returns signed denial receipt
Tool server errortruePresentKernel returns signed denial receipt
Function not foundtrueAbsentNo kernel interaction occurred
Argument parse failuretrueAbsentNo kernel interaction occurred

Batch Execution

execute_tool_calls() processes calls sequentially in input order. A failure in one call MUST NOT prevent execution of subsequent calls. The caller receives the full results array and inspects each entry's denied field individually. Each call that reaches the kernel returns the kernel-issued receipt.id as its receipt_ref.


Cross-Cutting Requirements

Fail-Closed Invariant

All bridges and edges MUST maintain the fail-closed invariant:

  • If the kernel is unreachable, requests MUST be denied.
  • If a capability token is invalid or expired, requests MUST be denied.
  • If guard evaluation produces an error, the request MUST be denied.
  • Unknown tools, capabilities, or functions MUST be rejected before any upstream dispatch occurs.
  • Unknown JSON-RPC methods MUST return error code -32601.

Receipt Chain Continuity

Signed receipts from bridged invocations MUST be compatible with the core receipt contract defined in protocol section 6:

  • Receipts use the same chio.receipt.v1 schema.
  • Receipts join the same Merkle-committed receipt log.
  • Bridged receipts are indistinguishable from native Chio receipts to downstream consumers (trust-control, evidence export, federation).

Auditors and operators see one unified evidence trail regardless of the protocol surface that originated the invocation.