contract_publish
Publish an interface contract before implementation, including paths that will consume it. Republishing creates a new version and notifies consumers; use expected_version to prevent overwrites.
Instructions
Publish the shape of an interface (an endpoint, function, type, event or CLI) before either side implements it, with the paths that will consume it. Publishing an existing name creates a new version and sends its consumers a change notice by itself, so do not also call notice_publish. Omitting consumers on a republish keeps the list, and expected_version refuses the write with conflict if another agent published first. To read contracts use contract_get or contract_list.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | One of `http`, `function`, `type`, `event`, `cli`, `other`. | |
| name | Yes | Unique contract name, for example `POST /api/sessions` or `State::claim`. | |
| agent | Yes | Your stable agent name. | |
| notes | No | Free-text notes stored with this version. | |
| shape | Yes | The interface shape as JSON: signatures, request and response types, errors. | |
| consumers | No | Paths expected to depend on this contract. | |
| expected_version | No | Refuse unless the contract is at this version now (0 = absent). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ok. conflict: expected_version was set and the contract is at another version. invalid: bad input. | |
| message | No | Human-readable detail, on most outcomes other than ok. | |
| contract | No | id, name, kind, consumers, current (version, shape, notes, published_by, published_at), history. | |
| notice_id | No | The change notice emitted to consumers of a republished contract. | |
| published_by | No | On conflict: who published that version. | |
| current_version | No | On conflict: the version the contract is at. | |
| previous_version | No | The version this one replaced; absent or null on a first publish. |