extensions/cli/docs/storage-sync.md
cn serveThe --id <storageId> flag enables the cn serve command to periodically persist session state to an external Continue-managed storage bucket. On startup, the CLI exchanges the provided storageId for two pre-signed S3 URLs - one for session.json and one for diff.txt - and then pushes fresh copies of those files every 30 seconds.
This document captures the responsibilities for both the CLI and backend components so we can iterate on the feature together.
cn serve is invoked with --id <storageId>, the CLI treats that value as an opaque identifier.POST https://api.continue.dev/agents/storage/presigned-url with JSON payload { "storageId": "<storageId>" }.PUT URLs and their target object keys:
{
"session": {
"key": "sessions/<sessionId>/session.json",
"putUrl": "https://<s3-host>/..."
},
"diff": {
"key": "sessions/<sessionId>/diff.txt",
"putUrl": "https://<s3-host>/..."
}
}
session.json and fetch the /diff payload to produce diff.txt.PUT URLs. For now we overwrite the same objects each cycle.main), diff.txt uploads an empty string and we log the condition once for debugging.POST /agents/storage/presigned-url accepts a JSON body { "storageId": string }.Authorization: Bearer <apiKey> header). Apply normal auth/tenant validation so users can only request URLs tied to their account/org.storageId into the desired S3 prefix (e.g., sessions/<org>/<storageId>/).PUT URLs: one for session.json, one for diff.txt.Pre-signed URLs are automatically refreshed using a dual-strategy approach:
This ensures continuous operation during devbox suspension, network interruptions, and clock drift.
diff.txt currently mirrors the /diff endpoint response. Confirm backend expectations for format and size limits.storageId mapping (e.g., require both org + storageId and validate ownership).This document should evolve alongside implementation details; update it whenever the API contract or client behavior changes.