You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add variant labels and capability advertisement (Tasks #33, #34) (#29)
## Summary
Extends the local-coord peer model to support free-form model/variant
identifiers (Task #33) and capability advertisement for cold-start
routing (Task #34). Adds two new client kinds (OpenAI, Mistral) and
introduces FFI functions to set and read variant labels, capability
classes, tiers, and prover strengths.
Closes#33, #34
## Changes
- **Task #33 — Variant Labels**: Added `variant` field to `Peer` struct
(max 32 bytes, alphanumeric + `.`/`-`/`_`). New FFI exports:
- `coord_set_variant()` — set/clear variant after registration
- `coord_read_peer_variant()` — read another peer's variant
(broadcast-visible)
- **Task #34 — Capability Advertisement**: Added `class_csv`, `tier`,
and `prover_strengths` fields to `Peer` struct. New FFI exports:
- `coord_set_capabilities()` — set class/tier/prover_strengths in one
call
- `coord_read_peer_class()`, `coord_read_peer_tier()`,
`coord_read_peer_provers()` — read capabilities
- `coord_get_peer_capabilities()` — adapter endpoint for querying
another peer's full capability profile
- **Client Kind Extensions**: Added `openai` (4) and `mistral` (5) to
`ClientKind` enum; both default to apprentice role.
- **Adapter Support**:
- `kindFromString()` and `arrayToCsv()` helpers for JSON→FFI marshalling
- Variant and capabilities accepted at registration time
- `coord_set_variant` and `coord_set_capabilities` tools for
post-registration updates
- `coord_get_peer_capabilities` tool for querying peer metadata
- **Durability**: Added event types `peer_variant_set` (15) and
`peer_capabilities_set` (16) with encode/decode functions for replay.
- **Validation**: Variant and capability fields validated for length and
character set (CSV-safe); tier clamped to 0..5; oversized payloads
rejected with -2 return code.
- **Tests**: Added unit tests for variant setting/reading and capability
advertisement (set/read round-trips, validation, slot reuse cleanup).
- **Version Bump**: Cartridge version 0.2.0 → 0.7.0; schema version
0.6.0 → 0.7.0.
## RSR Quality Checklist
### Required
- [x] Tests pass (added `test "set and read peer variant"` and `test
"set and read peer capabilities"`)
- [x] Code is formatted (Zig style consistent with existing codebase)
- [x] Linter is clean (no new warnings)
- [x] No banned language patterns
- [x] No `unsafe` blocks
- [x] No banned functions
- [x] SPDX headers present (existing files, no new source files added)
- [x] No secrets or credentials
### As Applicable
- [x] ABI/FFI changes validated (new FFI exports in
`local_coord_ffi.zig`, adapter marshalling in `local_coord_adapter.zig`,
durability codecs in `coord_durability.zig`)
- [x] Schema updated (`cartridge.json` and `cartridge.ncl` reflect new
tools and parameters)
- [x] Idris ABI stub updated (`SafeLocalCoord.idr` extended with
`Openai` and `Mistral` constructors)
## Testing
Unit tests cover:
- Variant validation (alphanumeric + `.`/`-`/`_`, max 32 bytes; rejects
spaces)
- Capability round-trips (class/tier/prover_strengths set and read)
- Tier range validation (0..5; rejects >5)
- Character validation (CSV-safe alphabet; rejects quotes)
- Slot reuse cleanup (variant and capabilities cleared on peer
deregistration)
Existing tests for peer registration, role derivation, and token
authentication remain passing
https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments