Write computer file content
Code Mode: praxis.agent.computers.files.updateContent
HTTP: PUT /agent/v1/computers/{computer_id}/files/content
Write the bytes of one existing file on a computer, only if the file is still the version you read.
Send the raw bytes as the body (at most 16 MiB) and the version you edited in If-Match: the version field of the file listing (<size>-<mtimeMs>). The file must already exist; the write replaces it whole and keeps its permissions. A request without If-Match answers 428 FILE_VERSION_REQUIRED and nothing is written. When the file has changed since that version, the answer is 412 FILE_VERSION_MISMATCH with error.current_version, and nothing is written: read the file again, redo the edit and write with the new version. The version is checked against the file’s current size and modification time, then the content digest is bound into the write itself, so a change that lands while the bytes are being written is refused instead of overwritten. Paths under /attachments and /skills are read-only (403 READ_ONLY). A successful write answers the new path, size, mtime and version; use that version for the next write.
签名
praxis.agent.computers.files.updateContent(args:{path:{/** pattern: ^cmp_[A-Za-z0-9_-]{1,64}$ */ computer_id:string};query:{path:string};headers?:{"If-Match":string};body:Blob|File}):Promise<{/** Absolute path of the file that was written. */ path:string;/** Size of the file now, in bytes. */ size:number;/** Modification time of the file now, when the machine reports one. */ mtime:string|null;/** The file's version now (<size>-<mtimeMs>); send it as If-Match on the next write. */ version:string}>;参数
| 名称 | 位置 | 类型 | 必填 | 说明 |
|---|---|---|---|---|
| computer_id | path | string | 是 | Computer id from computer creation or listing; a computer another tenant owns is not found. |
| path | query | string | 是 | Absolute path of the existing file on the computer, or a /workspace/ relative path. |
| If-Match | header | string | 是 | The file version you edited, as the file listing gives it (<size>-<mtimeMs>); a quoted value is accepted. |
请求体
| 必填 | 内容类型 | 说明 |
|---|---|---|
| 是 | application/octet-stream |
响应
| 状态码 | 内容类型 | 说明 |
|---|---|---|
| 200 | application/json | The file after the write. |
| 400 | application/json | INVALID_PARAMS: path is missing, a query parameter is unsupported, or the path is a directory (IS_DIRECTORY). |
| 401 | application/json | Platform error in the one /agent/v1 error body; computer failures add error.hint |
| 403 | application/json | READ_ONLY: the path is under /attachments or /skills. |
| 404 | application/json | Computer or path not found; foreign computers are indistinguishable from absent computers, and a write never creates a file. |
| 412 | application/json | FILE_VERSION_MISMATCH: the file changed since the version in If-Match; error.current_version is its version now. Nothing was written. |
| 413 | application/json | FILE_TOO_LARGE: the body exceeds 16 MiB. |
| 428 | application/json | FILE_VERSION_REQUIRED: If-Match is missing. Nothing was written. |
| 429 | application/json | Platform error in the one /agent/v1 error body; computer failures add error.hint |
| 500 | application/json | Platform error in the one /agent/v1 error body; computer failures add error.hint |
| 503 | application/json | Platform error in the one /agent/v1 error body; computer failures add error.hint |