List a workspace directory or inspect a file
GET/session/files
Returns metadata for one path in the session's workspace directory and, when the path is a directory, its direct entries sorted by name. Hidden files are included. The listing is not recursive and not paged. A file path returns its own metadata with an empty entries list.
Path rules, shared by every workspace file operation:
pathis relative to the workspace and uses/separators. It must already be clean: no leading/, no.or..segment, no empty segment or trailing/, no NUL byte. A path that breaks these rules answers403 WORKSPACE_NOT_ALLOWEDwith the messagepath must be a clean relative path inside the workspace.- Symbolic links are followed while they stay inside the workspace. Naming a path that goes through a link with an absolute target, or one that resolves outside the workspace, answers the same
403. - Entries are reported without following links: a link is
symlink, with the size of the link itself, wherever it points. A directory that contains a link leading outside the workspace still lists, with that entry assymlink; its target is never read or returned. A listed path that is a link to a directory reportssymlinkand no entries. - A path that runs through a regular file, such as
README.md/x, does not exist and answers404 NOT_FOUND. - The operations work on the workspace directory itself, the one the agent works in, whether or not a turn is running. They never address the system session, which answers
403 WORKSPACE_NOT_ALLOWED.
Errors: 404 SESSION_NOT_FOUND when the session does not exist, 404 NOT_FOUND (workspace path not found) when the path does not exist, 403 as above, 400 for a malformed request.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 406
- 500
Metadata for the path and, for a directory, its direct entries sorted by name.
Response Headers
The session this response belongs to. For session-scoped requests it echoes the X-Session-ID request header; for POST /sessions/open and POST /sessions/system it is the session that was opened or created.
The request's correlation ID. When the request carried an X-Request-ID header holding a UUID, Peen echoes it; otherwise Peen generates a new UUID. The controller log records the same value for this request.
The request is invalid. code is VALIDATION_FAILED for a bad parameter, body field, page bound, base64 value or file size, or a body that is not one JSON value or exceeds the body limit, and INVALID_SESSION_ID for a malformed X-Session-ID header.
PEEN_API_TOKEN is set and the request's bearer token is missing or wrong. code is UNAUTHORIZED. A deployment with no token never returns this.
The deployment does not allow what the request names. code is WORKSPACE_NOT_ALLOWED for a workspace outside every workspace root, a workspace file path that is not a clean relative path inside the workspace, or a file operation on the system session; AGENT_SPACE_NOT_ALLOWED for an agent space the deployment does not offer or a move of the system session; and SYSTEM_AGENT_OFF for a system session while PEEN_SYSTEM_AGENT is off.
The session, or the record the request names inside it, does not exist. code is SESSION_NOT_FOUND when no session has the X-Session-ID ID, on every operation. It is NOT_FOUND when the session exists but the record the request names inside it does not, and the message names what is missing, such as job not found. It is WORKSPACE_NOT_FOUND when an opened workspace directory no longer exists.
The request's Accept header allows neither application/json nor */*, and every response is JSON. code is BAD_REQUEST and message is unsupported response representation. Omit Accept or send application/json.
An unexpected server failure. code is INTERNAL_SERVER_ERROR and message is internal server error. The controller log has the details under the response's X-Request-ID.