runtime_sandboxes_files_watch
Watch a sandbox file or directory for changes. start (path, recursive, events, include and exclude globs, timeoutMs, webhook: true to have Runtime send the changes to the account's webhooks) returns the watch and a cursor; read (watchId, cursor, waitMs) returns the events since it, repeated writes folded with a count, and nextCursor; list; stop (watchId). Access events are opt-in. At most 4 watches per sandbox; a watch ends after timeoutMs (1 h by default, zero until stopped). Reading never wakes a paused sandbox.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| path | No | ||
| action | Yes | ||
| cursor | No | ||
| events | No | Only these event types. Default: all of create, write, remove, rename, chmod. | |
| waitMs | No | ||
| batchMs | No | Gather events this long and send them as one batch, folding repeated writes to a file into one event with a count. Default 100. | |
| exclude | No | Skip paths matching these globs. A directory excluded (`node_modules`, `dist/**`) is not watched at all. | |
| include | No | Report only paths matching one of these globs, relative to path (`**/*.py`; a bare `*.py` matches at any depth). | |
| watchId | No | A watch's id. | |
| webhook | No | Also send its changes to the account's webhooks as sandbox.files.changed events, read by Runtime without waking the sandbox: at most one event every 2 s a watch, 16 such watches an account. Default false. | |
| recursive | No | Watch every directory under it too. Default false. | |
| timeoutMs | No | The watch ends by itself after running this long; 0 lasts until stopped or the sandbox ends. Default 3600000 (1 h). | |
| maxWatches | No | Directories watched at most; past it a `limit` notice. Default 10000. | |
| idempotencyKey | No | Optional: left out, one is made and returned as idempotencyKey. Send it back only to retry this exact call after a temporary error. |