Agent asset storage: agent asset upload / list / get commands#29
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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;--jsonprints 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) overGET /v1/assets.agent asset get <asset-id> [-o <path>] [--json]— metadata + the gated URL;-ofetches the ~60s presigneddownload_urlimmediately 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/getAssetinsrc/lib/api.ts, following the existing envelope-unwrapping conventions.src/lib/types.ts:AssetView,CreateAssetRequest/Response,ListAssetsQuery/Response,GetAssetResponse— hand-rolled mirrors ofassets_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).tsc --noEmitclean; 158 vitest tests pass.