Skip to main content

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:

  • path is 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 answers 403 WORKSPACE_NOT_ALLOWED with the message path 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 as symlink; its target is never read or returned. A listed path that is a link to a directory reports symlink and no entries.
  • A path that runs through a regular file, such as README.md/x, does not exist and answers 404 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​

Metadata for the path and, for a directory, its direct entries sorted by name.

Response Headers
    X-Session-ID

    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.

    X-Request-ID

    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.