kcode-kennedy-session-kweb-contracts 0.1.1

Strict Kweb mutation argument decoding for Kennedy sessions
Documentation
# kcode-kennedy-session-kweb-contracts 0.1.0

Strict, effect-free decoding for Kweb mutation arguments used by Kennedy sessions.

## Public API

```rust
pub enum DecodedKwebTool {
    ConnectNodes(Vec<String>),
    ConsolidateFanout {
        parent: String,
        fanout: Vec<String>,
        aggregator: String,
    },
    SetFixedConnection {
        parent: String,
        child: Option<String>,
        slot: usize,
    },
    CreateNode {
        parents: Vec<String>,
        owner: String,
        short_name: String,
        short_description: String,
        long_description: String,
    },
    UpdateNode {
        id: String,
        owner: String,
        short_name: String,
        short_description: String,
        long_description: String,
    },
}

pub fn decode(
    tool: &str,
    value: &serde_json::Value,
) -> anyhow::Result<Option<DecodedKwebTool>>;

pub fn canonical_node_ids(
    value: &serde_json::Value,
    key: &str,
    maximum: Option<usize>,
    require_nonempty: bool,
) -> anyhow::Result<Vec<String>>;
```

`decode` accepts only the exact argument sets for `ConnectNodes`, `ConsolidateFanout`, `SetFixedConnection`, `CreateNode`, and `UpdateNode`. It returns `Ok(None)` for tools owned by another subsystem. It validates canonical and pending node identifiers, uniqueness, positive fixed slots, and node text limits in compatibility-sensitive order.

`canonical_node_ids` decodes one array of canonical node IDs, rejects duplicates, and enforces the caller-supplied maximum and nonempty requirement.

These operations perform no Kweb reads, writes, authorization, planning, or effects. Callers retain tool authorization and mutation execution.