Files
dirigent/crates/opencode_client/CLAUDE.md
T
2026-05-08 01:59:04 +02:00

31 lines
1.0 KiB
Markdown

# Package: opencode_client
Rust client library for interacting with the OpenCode.ai API.
## Quick Facts
- **Type**: Library
- **Main Entry**: src/lib.rs
- **Dependencies**: reqwest, serde, serde_json, chrono
## Key Files
- `src/lib.rs` - Public API exports
- `src/types.rs` - OpenCode API type definitions (Session, Message, Part, etc.)
- `src/client.rs` - HTTP client implementation with optional logging callbacks
## Main Exports
- `OpenCodeClient` - Main API client with methods: list_sessions, list_messages, send_message
- `Session` - Session metadata and configuration
- `Message` - User or Assistant message (tagged enum)
- `MessageWithParts` - Message info + content parts
- `Part` - Text, Reasoning, or workflow parts (StepStart, StepFinish, Tool)
- `ClientError` - Error types: Http, Request, Serialization
- `LogCallback` - Type alias for logging callbacks
## Related
- Used by: web, mobile (future), desktop (future)
- Independent: Can be used in any Rust project
## Documentation
- README: ./README.md
- API spec: ../../docs/api/opencode.md