Weak final ABI
Provider packages encode structured errors into strings because the WIT response has no typed outcome.
One existing runtime outcome, one central processor, fewer wrappers, safe protocol defaults, and additive persistence—without credential probing or new lifecycle states.
Transport is already mediated and final model output is already hardened. The unnecessary complexity is the chain of wrappers and repeated matches between dispatch and the runtime outcome.
RuntimeAdapterResult / DispatchError
│
▼
CapabilityDispatchResult
│
▼
CapabilityInvocationResult / CapabilityInvocationError
│
▼
completion helpers / translation helper / resume-specific matches
│
▼
RuntimeCapabilityOutcome
Provider packages encode structured errors into strings because the WIT response has no typed outcome.
The JSON-RPC envelope is parsed, but the semantic CallToolResult error bit is not.
Useful details depend on which helper or handler happened to map the response.
Typed errors exist, but provider rejection, auth, and infrastructure are still not one semantic vocabulary.
IronClaw already has the right runtime-neutral outcome. The defect is that no single owner constructs it, so success, auth, and failure are repeatedly renamed and reclassified.
The protocol default handles conventional behavior. Provider code overrides only decoding; after trusted dispatch and CapabilityHost lifecycle work, one processor produces the existing RuntimeCapabilityOutcome.
CapabilityInvocationResult, completion helper chains, duplicated resume matches, lane-named provider failures, and the synthetic-only Unknown runtime outcome.
Runtime protocol adaptation, trusted dispatch identity, CapabilityHost authority and obligations, and loop-owned persistence/model safety.
Result<CapabilityDispatchResult, CapabilityInvocationError>
│
▼
CapabilityResponseProcessor
│
▼
RuntimeCapabilityOutcome
├── Completed(...)
├── Failed(... + ProviderDiagnostic)
├── AuthRequired(... + ProviderDiagnostic)
└── ApprovalRequired(...)
Other host orchestration paths retain
ResourceBlocked(...) and SpawnedProcess(...)
ProviderDiagnostic
├── code: Option<ProviderErrorCode>
├── message: Option<UntrustedProviderMessage>
└── retry_after: Option<Duration>
DispatchAttemptAccounting
├── usage: ResourceUsage
└── receipt: ResourceReceipt
2xx success; attributable provider 401 auth; 403 permission; 429 retry; proxy or redirect 401 stays a rejection.
JSON-RPC errors and CallToolResult.isError become rejections; malformed protocol is an execution fault.
Slack ok:false, GraphQL errors, GitHub validation, Google envelopes, side-effect evidence.
One concrete processor applies policy and returns the existing runtime outcome; no override bypasses host safety.
The processor is a concrete host-runtime module, not a trait. Add a decoder strategy trait only when two production implementations actually meet at one selection boundary.
Active means configured for use. A provider rejection becomes new evidence during execution, not a reason to delete the stored credential.
Do not move the host checkpoint back to Configured and do not clear credentials. Unknown commit state or ambiguous credential attribution must fail without a resumable auth gate. If the card must react, fold only a valid unresolved caller-scoped auth gate into setup_needed.
The runtime enum stays in memory. Existing durable gate, resolution, event, and projection records use additive Serde fields and fail-closed required authority.
New fields default to None, are omitted when absent, tolerate unknown fields, and are covered by old/new golden fixtures.
Tenant, user, invocation, gate, credential authority, authorization evidence, and side-effect proof remain required.
#[derive(Serialize, Deserialize)]
struct PersistedAuthGate {
gate_id: RuntimeGateId, // required
capability_id: CapabilityId, // required
credential_requirements: Vec<...>, // required
#[serde(default, skip_serializing_if = "Option::is_none")]
provider_diagnostic: Option<ModelDiagnostic>,
}
WASM, MCP, first-party, and native responses adapt to the same dispatch contract.
A concrete processor constructs inline runtime outcomes and hides no alternate execution path.
Use existing adapter selection; add a trait only when two production decoders require dynamic selection.
The fixed call sequence and ordered message extraction do not need Template Method or responsibility-chain hierarchies.
Adding optional provider context does not justify a migration. Before deleting the in-memory Unknown outcome, a legacy persisted-resolution fixture must prove unknown failure tags still project as bounded Unclassified failures without becoming success.
Each phase starts with caller-level regression coverage and leaves a reversible compatibility boundary.
Pin all invocation modes, add the concrete processor, remove CapabilityInvocationResult, prove legacy persisted-tag replay, then remove Unknown across host-runtime, loop-host, and composition.
Shared diagnostics, host-owned credential enrichment, existing-kind ambiguity failures, dispatcher-owned attempt settlement, default HTTP/MCP decoding, and safe auth resume.
WIT variant, legacy compatibility, six bundled guest migrations, artifact rebuilds, and transitive freshness coverage.
Optional setup_needed overlay, removal of string-error parsing, removal of parallel diagnostics, and additive persistence verification.
The migration is not complete while legacy WASM string parsing, MCP isError-as-success, or separate auth diagnostic plumbing remains.