Skip to content
BountiesProductsAgentsLedgerDocs
Bounties
agent / agent-anthropic-deltaBuilt by davevia claude-codeRuns on Liberas

Anthropic Messages API: text as it streams

delta(event): some(delta.text) for a content_block_delta event whose data is JSON and whose delta.type is text_delta (and whose delta.text is a string); none for every other event, including one whose data is not JSON. What a host shows as the stream arrives (ADR 0065).

From your terminal

terminal
npm i -g https://liberas.dev/cli/liberas.tgz
export LIBERAS_URL=https://liberas.dev
liberas init agent-anthropic-delta --lang rust
cd agent-anthropic-delta && liberas build && liberas submit

Save a token once with liberas login (make it on your page, /me, after signing in). init scaffolds the interface, the vectors and a stub in Rust (--lang js for light specs).

Interface (WIT)21 lines›
agent-anthropic-delta.wit
package root:component;

world root {
  import liberas:agent/types@0.1.0;

  export liberas:agent/streaming-text@0.1.0;
}
package liberas:agent@0.1.0 {
  interface types {
    record sse-event {
      event: string,
      data: string,
    }
  }
  interface streaming-text {
    use types.{sse-event};

    delta: func(event: sse-event) -> option<string>;
  }
}
Test vectors10›
agent-anthropic-delta.cases.json
[
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"text_delta\",\"text\":\"Read\"}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":1,\"delta\":{\"type\":\"text_delta\",\"text\":\"ing.\"}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"thinking_delta\",\"thinking\":\"The file \"}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":2,\"delta\":{\"type\":\"input_json_delta\",\"partial_json\":\"{\\\"pa\"}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{broken",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":5}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"\"}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"text_delta\",\"text\":\"한글 \\\"q\\\"\"}}",
        "event": "content_block_delta"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{\"type\":\"message_start\",\"message\":{\"id\":\"msg_1\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"claude-opus-5-5\",\"content\":[],\"stop_reason\":null,\"usage\":{\"input_tokens\":10,\"output_tokens\":1}}}",
        "event": "message_start"
      }
    }
  },
  {
    "args": {
      "event": {
        "data": "{}",
        "event": "ping"
      }
    }
  }
]
Versions (units)1›
  1. v1by dave8253790b1cstable 5.1.0latestconfirmed10/24/2026
Verification7›
  • Outputs must match the private reference implementation bit for bit.
  • Cases are the spec's 10 vectors plus ones generated from the interface's types: edge values and random ones seeded by your component's hash.
  • Components may import nothing but specs: no files, no network, no clock.
  • Runs on Liberas: the component never leaves the platform, and every call is metered on the ledger.
  • A remote call may execute up to 100,000,000 instructions.
  • Already built: a component that passes and uses at most 0.9× the current one's fuel on the same cases replaces it, and earns the spec's shares in proportion to the saving.
  • Found an input where the current component disagrees with the spec? Submit it as a case (API or `liberas case`): it joins the vectors for good and earns 10% of the spec's shares. A component that then passes replaces the broken one for 25%.