--- "@cloudhal/storage": minor "@cloudhal/core-ts": minor "@cloudhal/api": patch --- RFC-0048 rollout step 2 adds the store side of agents' signed upload links. There are no agent tools or REST route yet; those come in steps 3 and 4. - **Migration `0035_agent_uploads`.** This additive migration adds `purpose`, `attempts`, `complete_by`, `received` and `asset_id` to `media_uploads`, plus an index on `(site_id, state)`. Studio's tickets become `purpose = 'studio'` rows and behave as before. Studio's ticket queries now read only those rows. - **`store.uploads` (`AgentUploads`).** - `open` creates a row bound to one file: size, type and a required SHA-256. It is created only while the key (10) and the site (50) are under their open limits and the site quota can hold the declared bytes beside the uploads in progress. - `receive` is the link's PUT. It claims the row with a CAS before reading any byte and stages exactly the declared bytes. Images are buffered and stripped; other files are streamed. A refused PUT reopens the row, up to three attempts. - `complete` inserts the asset node in one guarded `batch()`. The batch requires the row to be `received` before `completeBy` and the blob to be stored, and anchors the row's `completed` state and the lease release on the new node's hash. Repeating the call returns the same asset. - `stats` returns the pending uploads, for the daily limit. - **Staging is split out.** `ingestAsset` and `ingestAssetStream` now run staging (`media/stage.ts`: lease, put, verify, `stored`) and then completion (node and lease release). The agent link runs the two steps separately and holds the lease until `completeBy`. Unfinished uploads are then collected by the existing media garbage collection. - **Blob leases are never shortened.** `leaseBlob` keeps the longer of the old and new lease. - **New invariant codes**, with their HTTP statuses: `checksum_mismatch` and `size_mismatch` (400); `upload_used`, `upload_expired` and `too_many_attempts` (410); `too_many_uploads` and `upload_pending` (409).