Skip to content

feat: per-member player character behind CtxFeatCharacter (wire revision 5)#34

Merged
BCook98 merged 10 commits into
mainfrom
add-player-character
Jun 11, 2026
Merged

feat: per-member player character behind CtxFeatCharacter (wire revision 5)#34
BCook98 merged 10 commits into
mainfrom
add-player-character

Conversation

@BCook98

@BCook98 BCook98 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

What

Implements the kit half of shellcade's add-character-builder change (platform half: shellcade/shellcade#109, merged): every roster member in the CallContext can carry a player character — one width-1 glyph + resolved ink/bg RGB + an ASCII fallback byte — so games (boneyard, casino, …) render player avatars with zero width logic.

Wire (revision 5)

Per member, immediately after its u8 kind, iff the guest's meta declares CtxFeatCharacter (1<<1):

str glyph · u8 inkR · u8 inkG · u8 inkB · u8 bgR · u8 bgG · u8 bgB · u8 asciiFallback
  • Present in both member-bearing forms (legacy full roster + 0xFFFE epoch-full); the 0xFFFF unchanged sentinel never carries members.
  • No in-band discriminator (unlike roster-epoch's sentinels) — encoder/decoder take the declared feature bitset: new EncodeCtxFeat / EncodeCtxEpochFeat / DecodeCtxFeat; the existing functions are frozen features=0 wrappers, so non-declaring guests decode byte-identically (asserted byte-for-byte in tests, all three forms).

SDKs

  • Go: Player.Character (value-comparable), kit.CharacterCell(c) Cell returning the one styled cell; the guest decodes with its own registered meta's CtxFeatures, including the legacy-mode roster byte-skim cache (alignment pinned by an identical-bytes ⇒ unchanged test and a character-flip ⇒ changed test).
  • Rust: Player.character, character_cell, declared features cached once per instance (thread-local, first callback); feature-off path provably unchanged + truncation-fuzzed.
  • Cross-language: committed Go-emitted golden ctx vectors (rust/tests/golden/ctx_character.txt, freshness-gated) replayed decode-side in Rust with reader-position and full-consumption assertions.

Docs & release

  • ABI.md §4.1 layout + §4.2 feature vocabulary + revision-5 ledger (consistent with the wire.go/wire.rs ledgers; Go↔Rust revision crosscheck green).
  • Changeset: kit minor (→ v2.9.0).

Gates

go test ./..., go vet, wasip1 build, cargo test (rust + crossverify) — all green. kittest conformance covers flag-on and flag-off at the public API.

Sequencing

After merge + tag, the platform pins the new version and populates sdk.Player.Character in gameabi/encodeCtx (tasks §5 of the OpenSpec change); game-side adoption follows in the games repo.

🤖 Generated with Claude Code

BCook98 and others added 9 commits June 11, 2026 07:17
str glyph + ink/bg RGB + ascii fallback after each member's kind byte,
in both member-bearing forms, iff the guest's meta declares the feature.
EncodeCtx/EncodeCtxEpoch/DecodeCtx stay frozen features=0 wrappers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ning

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…the roster skim

The guest decodes with its own registered meta's CtxFeatures — the
character section has no in-band discriminator. The legacy-mode byte-skim
cache skips the section per member so its memcmp region stays aligned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ABI.md §4.1 gains the per-member character section and the 1<<1 feature
bit; kittest covers flag-on and flag-off; a Go-emitted golden ctx fixture
lands for the Rust decode-parity test (next commit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r_cell

Decode-side parity with the Go kit: the member character section is read
iff the registered meta declares the bit; golden ctx vectors replay
byte-identically; character_cell returns the one styled cell.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@BCook98
BCook98 marked this pull request as ready for review June 11, 2026 00:10
@BCook98
BCook98 merged commit e4f2e4d into main Jun 11, 2026
7 checks passed
@BCook98
BCook98 deleted the add-player-character branch June 11, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant