# Consumer contract
This library is the pure, stateless parser and typed-value boundary for the five K1 Web-code model calls. It performs no authorization, I/O, KTO work, service or actor state, discovery, prompting, publication, or migration.
```rust
pub const WEB_CODE_DOCS: &str = "WebCodeDocs";
pub const WEB_CODE_OPEN: &str = "WebCodeOpen";
pub const WEB_CODE_OVERWRITE: &str = "WebCodeOverwrite";
pub const WEB_CODE_CHECK: &str = "WebCodeCheck";
pub const WEB_CODE_PUBLISH: &str = "WebCodePublish";
pub const WEB_CODE_DOCS_METADATA_TYPE: &str = "k1.web-code-docs/v1";
pub const WEB_CODE_OPEN_METADATA_TYPE: &str = "k1.web-code-open/v1";
pub const WEB_CODE_OVERWRITE_METADATA_TYPE: &str = "k1.web-code-overwrite/v1";
pub const WEB_CODE_CHECK_METADATA_TYPE: &str = "k1.web-code-check/v1";
pub const WEB_CODE_PUBLISH_METADATA_TYPE: &str = "k1.web-code-publish/v1";
pub fn parse(name: &str, arguments: &str) -> Result<Call, ParseError>;
pub enum Call { Docs(IdentityRequest), Open(OpenRequest), Overwrite(OverwriteRequest), Check(IdentityRequest), Publish(IdentityRequest) }
pub struct Identity;
impl Identity { pub fn authority(&self) -> AuthorityId; pub fn name(&self) -> &str; pub fn version(&self) -> &Version; pub fn web_id(&self) -> &WebId; }
pub struct IdentityRequest;
impl IdentityRequest { pub fn identity(&self) -> &Identity; }
pub struct OpenRequest;
impl OpenRequest { pub fn identity(&self) -> &Identity; pub const fn language(&self) -> Option<Language>; }
pub struct OverwriteRequest;
impl OverwriteRequest { pub const fn box_id(&self) -> BoxId; pub fn contents(&self) -> &str; pub fn into_contents(self) -> String; }
pub enum Language { Javascript, Html, Css }
impl Language { pub const fn as_str(self) -> &'static str; }
pub enum ParseError { UnknownTool, InvalidArguments }
```
All public value types implement `Debug`, `Eq`, and `PartialEq`; `Language` and `ParseError` also implement `Clone` and `Copy`. `Language` and `ParseError` implement `Display`, and `ParseError` implements `std::error::Error`.
`WebCodeDocs`, `WebCodeCheck`, and `WebCodePublish` accept exactly JSON objects `{authority,name,version}`. `WebCodeOpen` accepts those fields plus optional `language`; the service requires it only when neither a private candidate nor exact publication exists and otherwise verifies any supplied value matches. `WebCodeOverwrite` accepts exactly `{box_id,contents}`. Missing required fields, explicit null, wrong types, duplicate or unknown fields, non-objects, invalid values, and trailing input are rejected as `InvalidArguments`. Tool names are exact and case-sensitive; every other name is `UnknownTool`.
An authority is exactly 24 lowercase hexadecimal characters. A name is the Web package canonical 1–36-byte lowercase-kebab form. A version is canonical stable SemVer with no prerelease or build metadata. Languages are exactly `javascript`, `html`, and `css`.
`box_id` is a nonempty ASCII decimal string fitting `u64` and becomes the existing open-domain `BoxId`; zero and leading zeroes remain accepted. `contents` is preserved exactly after JSON decoding.
Parsing is linear in supplied argument bytes and short identity strings, allocates only decoded owned values, and performs no I/O. No benchmark guarantee is claimed.