ReqManagedAgents.Artifacts.ClaudeFiles (ReqManagedAgents v0.6.2)

Copy Markdown View Source

ReqManagedAgents.Artifacts store over the Anthropic Files API, scoped to one session. list uses the session-scoped file listing (the only way to discover server-minted file ids for files the agent wrote); fetch/delete act on the newest record when a name appears more than once (re-runs accumulate); put uploads and attaches at opts[:mount_path] (default "/data/<name>").

The default mount path is built as "/data/" <> name with no sanitization — callers passing untrusted names must validate them (path traversal, e.g. "../x", is forwarded verbatim).

The outputs-dir convention: only files the agent writes under /mnt/session/outputs/ become session artifacts (session-scoped and downloadable — what list/fetch see). Direct the agent's deliverables there in its system prompt; files written elsewhere in the sandbox are not retrievable.

Summary

Functions

Absolute sandbox path for a named deliverable: "/mnt/session/outputs/" <> name.

The sandbox directory whose files become session artifacts (session-scoped, downloadable — what list/2 and fetch/3 see). Interpolate this into the agent's system prompt rather than copying the string — files written anywhere else in the sandbox are not retrievable

Build a store term. client_mod is injectable for tests (defaults to the live client).

Functions

output_path(name)

Absolute sandbox path for a named deliverable: "/mnt/session/outputs/" <> name.

outputs_dir()

The sandbox directory whose files become session artifacts (session-scoped, downloadable — what list/2 and fetch/3 see). Interpolate this into the agent's system prompt rather than copying the string — files written anywhere else in the sandbox are not retrievable:

system: "Write all output files under /mnt/session/outputs/."

store(client, session_id, opts \\ [])

Build a store term. client_mod is injectable for tests (defaults to the live client).