Skip to content

Conversation

@manno23
Copy link
Owner

@manno23 manno23 commented Jan 10, 2026

Create a new package @opencode-ai/sessions-api that serves as a Cloudflare Worker API server for storing and managing OpenCode agent sessions in R2 object storage.

Features:

  • Hono-based REST API compatible with share-next.ts API
  • Processes and destructures sync messages into complete agent sessions
  • Stores sessions in Cloudflare R2 bucket
  • Returns sessions as typed cryptobject structures
  • Supports create, sync, retrieve, and delete operations

The API implements the following endpoints:

  • POST /api/share - Create new share
  • POST /api/share/:id/sync - Sync session data
  • GET /api/share/:id - Retrieve complete session
  • GET /api/share/:id/metadata - Get session metadata
  • DELETE /api/share/:id - Delete share
  • GET /api/sessions - List all sessions

Create a new package @opencode-ai/sessions-api that serves as a Cloudflare Worker API server for storing and managing OpenCode agent sessions in R2 object storage.

Features:
- Hono-based REST API compatible with share-next.ts API
- Processes and destructures sync messages into complete agent sessions
- Stores sessions in Cloudflare R2 bucket
- Returns sessions as typed cryptobject structures
- Supports create, sync, retrieve, and delete operations

The API implements the following endpoints:
- POST /api/share - Create new share
- POST /api/share/:id/sync - Sync session data
- GET /api/share/:id - Retrieve complete session
- GET /api/share/:id/metadata - Get session metadata
- DELETE /api/share/:id - Delete share
- GET /api/sessions - List all sessions
Updates:
- Import core types (Session, Message, Part, FileDiff, Model) from @opencode-ai/sdk/v2 instead of redefining them
- Add @opencode-ai/sdk as workspace dependency
- Update tsconfig.json to use Wrangler-generated worker-configuration.d.ts
- Generate worker-configuration.d.ts with wrangler types command
- Successfully build-tested with wrangler --dry-run

This aligns the sessions-api implementation with the enterprise package pattern for session sync handling.
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.

3 participants