Skip to content

Agent asset storage: agent asset upload / list / get commands#29

Merged
hbrooks merged 1 commit into
mainfrom
feat/agent-asset-cli
Jul 6, 2026
Merged

Agent asset storage: agent asset upload / list / get commands#29
hbrooks merged 1 commit into
mainfrom
feat/agent-asset-cli

Conversation

@ellipsis-dev

@ellipsis-dev ellipsis-dev Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

CLI side of the agent asset storage feature (design: documents/eng/AGENT_ASSET_STORAGE.md, ellipsis-dev/ellipsis#5628; backend shipped in ellipsis-dev/ellipsis#5634). An agent in a sandbox can now persist a screenshot and get back an org-membership-gated link to paste into a PR comment:

npx playwright screenshot http://localhost:3000/settings settings.png
agent asset upload settings.png
# → https://app.ellipsis.dev/assets/9f8e7d6c...

Commands (src/commands/asset.ts)

  • agent asset upload <path> [--json] — reads the file, runs fast client-side checks mirroring the server's rules (PNG magic bytes — with format sniffing so "got what looks like JPEG" beats a bare 400 — plus the 10 MiB cap), base64-encodes, POSTs /v1/assets. The bare gated URL is the primary stdout output so an agent (or $(...)) can capture it directly; --json prints the full response. Auth is free: the injected sandbox token (or a device-login token on a laptop) is picked up by the existing config resolution.
  • agent asset list [--session <id>] [--limit <n>] [--json] — newest-first table (id, filename, size, created, session) over GET /v1/assets.
  • agent asset get <asset-id> [-o <path>] [--json] — metadata + the gated URL; -o fetches the ~60s presigned download_url immediately and writes the bytes locally (with a friendly "expired — re-run" hint on 403). The JSON API never carries the file itself.

Client + types

  • ApiClient.uploadAsset / listAssets / getAsset in src/lib/api.ts, following the existing envelope-unwrapping conventions.
  • src/lib/types.ts: AssetView, CreateAssetRequest/Response, ListAssetsQuery/Response, GetAssetResponse — hand-rolled mirrors of assets_service.py's Pydantic models, like the rest of the file.

Tests / docs

  • test/asset.test.ts: upload-request building (magic bytes, cap boundary, format sniffing, basename) and size formatting.
  • test/api.test.ts: the three client methods (paths, query building, id encoding, envelope unwrap).
  • README command list updated.
  • tsc --noEmit clean; 158 vitest tests pass.

CLI side of the agent asset storage design (ellipsis:
documents/eng/AGENT_ASSET_STORAGE.md; backend shipped in
ellipsis-dev/ellipsis#5634).

- src/commands/asset.ts: new 'agent asset <verb>' family —
  'upload <path>' (client-side PNG magic-byte + 10 MiB checks, base64,
  prints the org-gated URL as the bare primary output), 'list' with
  --session/--limit filters, and 'get <id>' with -o to download the
  bytes via the short-lived presigned download_url.
- ApiClient.uploadAsset/listAssets/getAsset + types mirroring
  assets_service.py response models.
- README command list entries; tests for the pure helpers and the
  client methods (typecheck + 158 vitest tests green).
@hbrooks hbrooks merged commit 4998fd1 into main Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant