pi-c  Artifact [dd9ddce992]

Artifact dd9ddce992557b87cdce34d23e9586459e7438ae3559cb69e48fd8d300269651:

  • File test/pic/decode.sh — part of check-in [dd694d986b] at 2026-11-19 01:08:50 on branch stage-4 — Add the OpenAI Responses adapter

    Output items are kept whole, so reasoning items with encrypted_content go back verbatim to the same model under store:false; the final output list is authoritative and fills in late encrypted_content. The neutral form follows Pi: reasoning to thinking, messages to text, function calls to tool calls with call_id|item_id ids. Requests send input items, function_call_output under the call ids, flat tools, and reasoning effort with encrypted reasoning for reasoning models. Recorded streams, a fuzz target and fake server cases cover it, including conversations moving between the Messages API and Responses both ways. (user: dmestas, size: 975) [annotate] [blame] [check-ins using] [more...]


#!/bin/sh
# Decodes every recorded stream and compares it with its checked-in summary:
# Messages API streams in streams/, Chat Completions streams in chat-streams/.
# Usage: decode.sh DECODER [--update]
set -eu
decoder=$1
here=$(dirname "$0")
for dir in streams chat-streams responses-streams; do
    mode=
    [ "$dir" = chat-streams ] && mode=--chat
    [ "$dir" = responses-streams ] && mode=--responses
    for stream in "$here/$dir"/*.sse; do
        want=${stream%.sse}.want
        if [ "${2:-}" = --update ]; then
            # shellcheck disable=SC2086
            "$decoder" $mode "$stream" > "$want"
            continue
        fi
        # shellcheck disable=SC2086
        if ! "$decoder" $mode "$stream" | cmp -s - "$want"; then
            echo "FAIL $stream" >&2
            # shellcheck disable=SC2086
            "$decoder" $mode "$stream" | diff "$want" - >&2 || true
            exit 1
        fi
    done
done
echo "decode: all recorded streams match"