Coaray
← Back to Coaray

docs/package-adapters

Package adapters & agent harnesses

How one signed Coaray package becomes a bounded OpenWorker realization without moving credentials, approval authority, or operational truth into the agent harness.

Overview

One package. One contract. One authority boundary.

A Coaray package is a compiled, signed, tenant-neutral specification for a kind of worker. It defines what the worker is responsible for, the jobs it accepts, the evidence and outcomes those jobs require, the capabilities it may request, and the policies every execution surface must obey.

A package is not an agent process, a model, a connected account, a deployment, or a folder of prompts. The adapter’s job is to translate the package into a host-native shape without creating a second source of package meaning. The harness runs the model loop. Neither receives the right to approve effects or declare completion.

Current product boundary

OpenWorker is the only wired autonomous runtime. The external Claude and ChatGPT package force-field surface is target architecture; today’s MCP implementation exposes only the read-only worker Registry and activation projection.

The mental model

Package, adapter, harness, and coordinator are different jobs.

Keeping these nouns separate is the core safety property. The package supplies portable intent and policy. The adapter verifies and projects it. The harness owns a native agent session. The coordinator owns consequential state.

Package

Canonical Worker IR and content-addressed assets. Portable business meaning and permission ceiling.

Adapter

A narrow translation and verification seam. It may preserve or narrow package authority, never expand it.

Harness

The environment that hosts the persona, native session, transcript, provider binding, and model loop.

Coordinator

The only authority that admits work, records evidence, approves or dispatches effects, and completes a run.

What the package owns

The package carries method and limits—not customer state.

Canonical Worker IR is the portable contract the adapter must preserve. It contains enough structure to form the worker in a harness, but deliberately excludes everything that would turn a release artifact into a credential or customer-data vessel.

01

Identity

Package, version, and worker-definition identities that remain stable across installation and runtime projection.

02

Worker contract

Responsibility, safe persona instructions, operating boundaries, and the display language shown to the firm.

03

Job contracts

Typed inputs, execution nodes, expected artifacts, business dispositions, and deterministic outcome evaluators.

04

Capabilities

Provider-neutral capability keys, declared risk, and exact approval requirements—never credentials or connected-account IDs.

05

Policy

The permission ceiling, proposal-only model rule, host-only effects, data-handling restrictions, and approval lifecycle.

06

Compatibility

Minimum OpenWorker protocol, required host features, closed schemas, content-addressed assets, and pure WASM components.

Package-owned and host-owned concerns
Package ownsHost owns
Capability keys and risk declarationsConnector implementation and exact account binding
Permission ceiling and approval policyAuthorization grants and persisted approval decisions
Input, artifact, and outcome schemasCustomer evidence, artifacts, ledger, and receipts
Pure deterministic component entry pointsNetwork, filesystem, clocks, storage, and secrets
Minimum protocol and required host featuresRuntime installation, health, provider, and model

Adaptation pipeline

Adaptation is a verified projection, not a prompt conversion.

The adapter does not copy instructions into a persona and hope for equivalent behavior. Each stage binds exact bytes, declared policy, and local authority before the harness can be activated.

  1. 01

    Compile

    Studio source is normalized into canonical Worker IR. The compiler—not the UI or the runtime—defines the executable package meaning.

  2. 02

    Address

    Worker IR, contracts, schemas, and deterministic components become an immutable OCI artifact identified by its manifest digest.

  3. 03

    Sign + attest

    The publisher signs the exact artifact and an independent conformance authority attests the same manifest and Worker IR bytes.

  4. 04

    Admit

    The host checks protocol compatibility, required features, evaluator authorities, pure-component policy, and every capability binding.

  5. 05

    Project

    The adapter derives a host-native persona, skill, read-only tool list, and effect-capability declarations from the admitted release.

  6. 06

    Resolve

    Each provider-neutral capability must resolve to one canonical enabled tool and one exact verified connection revision.

  7. 07

    Bind

    The resulting execution plan is hashed, approved, and rebound to the deployment, persona, session, model, and connection set.

  8. 08

    Run

    The harness may produce text and typed proposals. The coordinator alone advances work, authorizes effects, evaluates outcomes, and issues receipts.

Capability resolution

Provider-neutral requirements become exact local bindings.

Worker IR asks for a capability such as a read or send operation. It does not name a secret, customer account, or mutable provider connection. During provisioning, the OpenWorker execution adapter resolves that requirement against the signed host capability registry and live connection records.

// Canonical Worker IR — illustrative shape
{
  "capabilityKey": "records.read",
  "risk": "read_only",
  "approval": "not_required"
}

// Device-local execution plan — derived, never packaged
{
  "capabilityKey": "records.read",
  "runtimeTool": "records_search",
  "connector": "records",
  "connectionId": "conn_…",
  "connectionRevision": 7,
  "authorityDigest": "sha256:…"
}

The resolver must prove all of the following

  • The capability exists in the host’s canonical registry.
  • The connector identity is canonical—not an alias.
  • The connector is available, connected, and enabled.
  • Exactly one enabled runtime tool matches the binding.
  • Exactly one online, verified connection can perform it.
  • The connection revision and authority digest are exact.
  • Tool, host binding, and package agree on effect risk.
  • Consequential capabilities require exact host approval.
  • No enabled connector tool sits outside the package ceiling.

The complete plan is canonicalized and hashed. Session binding and restart inspection recompute the plan and require the same digest, so a changed connection, model, tool inventory, or permission cannot quietly inherit an earlier approval.

The runtime harness

OpenWorker hosts the agent. Coaray keeps the authority.

The internal runtime port isolates upstream OpenWorker protocol details behind four domain operations: inspect the installation, prepare a deployment, read a transcript, and run a model turn. Production runtime kind is exactlyopenworker; this seam is not a runtime marketplace.

01

Inspect installation

Verify loopback endpoint, runtime digest, adapter version, protocol identity, and deployment conformance.

02

Prepare deployment

Create or reopen one native session, deploy the exact projected persona, and bind the canonical connection set.

03

Read transcript

Let OpenWorker own its durable native history while Coaray keeps its conversation and deployment identities separate.

04

Run model turn

Return bounded assistant output and typed proposals. Never approve an effect, mutate a run, or declare completion.

Why proposal-only matters

Model output and tool arguments are untrusted input. A model may recommend work, but only the coordinator can bind an exact payload, request approval, dispatch through the connection broker, persist the provider response, evaluate the outcome, and issue a receipt.

Authority boundary

The adapter may narrow authority. It may never manufacture it.

Three independently checked boundaries prevent the harness from becoming operational truth: release admission, persona consent, and coordinator authorization.

Release boundary

Exact bytes enter

Publisher signature, independent conformance, OCI structure, Worker IR digest, evaluator authority, protocol, and pure WASM policy must all agree.

Harness boundary

Exact tools surface

The generated persona has an exact tool policy, read-only external tools only, declared effect capabilities, no MCP expansion, and no native consequential authority.

Execution boundary

Exact proposals leave

Consequential work crosses into the coordinator as a typed proposal. Approval, dispatch, evidence, evaluation, and completion remain ledger-owned.

Integrity chain

artifactDigest
  ├─ workerIrDigest
  ├─ publisher signature
  ├─ independent conformance report
  └─ registry admission
       ↓
provisioning envelope
       ↓
materializationDigest + personaDigest + skillDigest
       ↓
capabilityPlanDigest + connection revisions
       ↓
runtime deployment binding

Failure behavior

When proof breaks, execution stops honestly.

The adapter is intentionally intolerant of ambiguity. A missing proof does not produce a degraded worker; it produces a specific blocking state the operator can resolve.

Digest or signature mismatch

Reject the release before materialization.

The downloaded bytes are not the exact publisher-signed and independently attested artifact.

Unsupported protocol or host feature

Fail package admission.

The harness cannot honestly satisfy the release’s declared compatibility contract.

Missing or ambiguous connection

Block the execution plan.

Every capability requires exactly one verified connection identity and revision.

Extra enabled connector tool

Block the execution plan.

A connector cannot expose authority outside the package capability ceiling.

Persona consent exceeds the release

Reject installation or activation.

The host-native persona must preserve the exact projected tool and effect boundary.

Materialized files drift

Fail restart verification.

The installed persona, skill, or OCI blob no longer matches its admitted digest.

OpenWorker unavailable

Expose an explicit blocking state.

Coaray never substitutes another runtime or simulates successful execution.

Implementation status

What is real now—and what still blocks the full promise.

This page describes the governing package-adapter boundary. The implementation already enforces substantial parts of that boundary, but the complete sellable lifecycle is not finished.

Implemented in the current code

  • Canonical Worker IR compilation and structural validation
  • Content-addressed OCI package construction and verification
  • Publisher signature plus independent conformance attestation
  • Signed host admission for protocol, features, evaluators, capabilities, and pure WASM
  • OpenWorker persona and skill materialization from the admitted release
  • Exact capability-to-tool-to-connection execution-plan resolution
  • Proposal-only internal OpenWorker runtime port and transcript ownership boundary
  • Read-only MCP worker Registry and activation projection

Still required

  • The complete OS-managed CoarayLocalHostService boundary
  • Worker-host lease fencing and the full prepare / commit / final activation saga
  • Every canonical deployment-authority digest in the runtime binding
  • Compiler-emitted PackageForceField and forceFieldDigest
  • Package-derived external MCP tools, typed job delegation, and verified-result retrieval
  • A clean-customer autonomous trigger-to-real-destination acceptance journey

Reference

Where the boundary lives in the codebase.

src/lib/packages/worker-ir-*.tsCanonical package schema, compilation, ordering, and validation.src/lib/packages/package-release-admission.tsPublisher, conformance, protocol, feature, evaluator, and capability admission.src/lib/openworker/desktop-release-materialization.tsVerified device-local persona and skill materialization.src/lib/openworker/openworker-execution-adapter.tsExact capability, connector, tool, connection, and model plan resolution.src/lib/runtime/worker-runtime-adapter.tsThe internal runtime port.src/lib/runtime/openworker-reference-runtime-adapter.tsThe sole production runtime adapter and proposal-only model-turn boundary.