Skip to content

Add weaver-spec contract adapters (SelectableItem / ChoiceCard / RoutingDecision / Frame) #143

@dgenio

Description

@dgenio

Goal

Make interop between contextweaver's internal types and the canonical weaver_contracts types cheap and explicit. This ensures contextweaver can produce and consume spec-compliant data structures without manual translation.

Scope

A minimal mapping layer that converts between:

  • contextweaver internal types ↔ weaver_contracts Core types:
    • SelectableItem
    • ChoiceCard
    • RoutingDecision
    • Frame

Acceptance Criteria

  • Adapter module (e.g., contextweaver/adapters/weaver_contracts.py) providing:
    • to_weaver(internal_type) → weaver_contracts type
    • from_weaver(weaver_contracts type) → internal_type
  • Unit tests proving round-trip mapping: internal → weaver → internal is lossless for all four types
  • weaver_contracts added as an optional dependency (not required for standalone usage)
  • Brief docs on how to use the adapters

Why

Per weaver-spec, the contracts are the interfaces. Without explicit adapters, each integration will implement its own ad-hoc mapping, leading to inconsistencies and subtle bugs.

Context

Part of Milestone E0 — Connect + Align Boundaries.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions