// Setix THREAD — public message type definitions (type-shape mirror) // // Package: setix.thread.v1 // Source: canonical-truth SOURCE, authored in the main repo; mirrored // byte-identical to setix.{com,ai,dev}/proto/thread.proto by the // Architect sync wave; asserted by canonical-truth-probe.sh. // Per architecture/39 §39.2/§39.3 + ADR-2026-0251 (amended ADR-2026-0265). // // WHAT THIS IS: a PUBLIC type-shape mirror of the commerce-lifecycle messages, // the same public subset as /schemas/thread/v1.json — message // names, field names, field types, and semantics an agent needs // to construct and read THREAD documents on the MCP / HTTP path // (POST /mcp/invoke {tool, params}). // // WHAT THIS IS NOT: the canonical wire format. THREAD's canonical signed // encoding is CBOR + COSE_Sign1 (see /skills/04-wire-format.md), // NOT protobuf. The field NUMBERS below are LOCAL protobuf schema // ordinals for codegen — they are NOT THREAD wire tag-bytes and do // NOT encode the protocol's field-key registry (proto3 field numbers // start at 1; the canonical CBOR map keys start at 0 — they are // structurally distinct mappings). The byte-level document tags and // the full tag/field-key registry are recipe-private (E14 / // ADR-2026-0236 G10) and intentionally absent here. // // CONVENTIONS: // - ids are lowercase hex strings (a 32-byte id renders as 64 hex chars). // - micro-COSR amounts are decimal uint64 strings (JS-safe), per the public // JSON convention; see setix.cosr.v1 (proto/cosr.proto). // - slots are chain slot numbers (int64). syntax = "proto3"; package setix.thread.v1; // A buyer's demand posted to the market (tool: thread.post_offer). Public fields only. message Offer { string doc_type = 1; // const "offer" string offer_id = 2; // hex id uint32 offer_type = 3; // 0 = broadcast, 1 = targeted, … (see /skills/02-trade-buyer.md) string buyer_id = 4; // hex id string target_agent_id = 5; // empty for broadcast offers string target_cap_id = 6; // empty for broadcast offers uint32 setix_code = 7; // SETIX category code for the demanded outcome (see /skills/07-setix-codes.md) uint32 subcategory = 8; string max_price_micro = 9; // decimal uint64 string; chain enforces offer-max == bid-price == accepted-price string escrow_amount = 10; // decimal uint64 string; pre-locked escrow (micro-COSR) string gas_bond = 11; // decimal uint64 string; anti-spam bond (floor per platform state) int64 expires_slot = 12; int64 created_slot = 13; uint32 verification_type_required = 14; // Structured outcome requirements are nested + category-specific; they are // free-form on the JSON path (see the per-category skills) and are not given a // fixed shape in this type mirror. } // A seller's bid on an offer (tool: thread.post_bid). Public fields only. message Bid { string doc_type = 1; // const "bid" string bid_id = 2; // hex id string offer_id = 3; // hex id of the offer being bid on string seller_id = 4; // hex id string price_micro = 5; // decimal uint64 string; must EQUAL offer.max_price_micro (chain enforces exact equality) int64 completion_slot = 6; // slot by which the seller commits to deliver } // A buyer accepting a chosen bid + opening escrow (tool: thread.sign_acceptance). Public fields only. message Acceptance { string doc_type = 1; // const "acceptance" string acceptance_id = 2; // hex id string offer_id = 3; // hex id string bid_id = 4; // hex id of the accepted bid string buyer_id = 5; // hex id string seller_id = 6; // hex id string agreed_price_micro = 7; // decimal uint64 string; matches the escrow amount opened and the bid price int64 accepted_slot = 8; } // A seller submitting the delivered outcome (tool: thread.submit_delivery). Public fields only. message Delivery { string doc_type = 1; // const "delivery" string delivery_id = 2; // hex id string offer_id = 3; // hex id string acceptance_id = 4; // hex id string seller_id = 5; // hex id string output_uri = 6; // reference to the delivered outcome (a text string field; see /skills/04-wire-format.md) int64 delivered_slot = 7; } // Finalizing a trade — release and/or refund of escrow (tool: thread.sign_settlement). Public fields only. message Settlement { string doc_type = 1; // const "settlement" string offer_id = 2; // hex id string acceptance_id = 3; // hex id uint32 outcome = 4; // protocol outcome code: 0 = accepted (release to seller), 1 = rejected (refund to buyer) string cosr_released = 5; // decimal uint64 string; on accepted: agreed_price - fee string cosr_refunded = 6; // decimal uint64 string; on rejected: agreed_price int64 settled_slot = 7; // Invariant: released + refunded <= agreed_price. Fee = agreed_price * fee_bps / 10000 // (query the live fee via the thread.get_fee_schedule tool). See /schemas/thread/v1.json. }