Skip to content

Conversation

@jonastemplestein
Copy link
Contributor

@jonastemplestein jonastemplestein commented Jan 7, 2026

Summary

  • Completed durable-streams implementation with three-layer architecture (Stream, StreamManager, HTTP routes)
  • Migrated project from Bun to Node.js runtime using tsx
  • Added comprehensive test coverage: 38 tests including native fetch e2e tests

Test plan

  • All 38 tests passing (stream unit, manager unit, Effect HTTP integration, native fetch e2e)
  • HTTP endpoints verified: POST (append), GET (subscribe/list), DELETE (remove)
  • SSE streaming tested with offset parameter support

🤖 Generated with Claude Code


Note

Introduces an agent-wrapper that connects the Pi coding agent to durable streams and provides a small CLI for session control.

  • New agent-wrapper module: AdapterRunnerService (manage adapters), runPiAdapter (Pi SDK integration), cli.ts with commands: start, prompt, abort, subscribe, list, and entry main.ts
  • Integrates with StreamClientService and DaemonService to create streams, subscribe to events, and append results
  • Adds src/agent-wrapper/e2e-test.ts to exercise start→prompt end-to-end and validate persisted events in .iterate/streams
  • Tooling/docs: migrate conventions to Node.js + pnpm in CLAUDE.md, update package.json scripts (tsx, doppler), extend .gitignore with opensrc/ and .iterate/

Written by Cursor Bugbot for commit 2941a18. This will update automatically on new commits. Configure here.

jonastemplestein and others added 3 commits January 7, 2026 20:48
Complete durable-streams implementation with three layers:
- Stream (persistence, append/subscribe)
- StreamManager (multi-stream coordination)
- HTTP routes (REST + SSE endpoints)

Migrate from Bun to Node.js:
- Use @effect/platform-node for HTTP server
- Use tsx for TypeScript execution
- Add native fetch e2e tests alongside Effect tests

38 tests passing (stream, manager, Effect HTTP, native fetch e2e).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Remove bun.lock, add pnpm-lock.yaml
- Update scripts to use pnpm instead of npm/bun
- Remove @effect/platform-bun dependency
- Update CLAUDE.md docs with pnpm commands

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jonastemplestein and others added 9 commits January 7, 2026 21:52
- New daemon.ts: DaemonService for process management (start/stop/restart/status)
- New client.ts: HTTP client with SSE parsing and auto-daemon support
- New README.md: Design docs, architecture, CLI reference, tmux testing guide
- Rewrite cli.ts with server and stream subcommand groups
- Update main.ts with proper layer composition

CLI structure:
  server run/start/stop/restart/status
  stream subscribe/append/list/delete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Storage.FileSystem adapter for persistent event storage
  - Events stored in .iterate/streams/*.json
  - Each stream gets its own JSON file

- Update daemon to use .iterate/ for all runtime files
  - PID, port, and log files now in .iterate/

- Add stream get CLI command for fetching historic events
  - One-shot fetch (vs subscribe which waits for live events)
  - Supports --offset and --limit options

- Add GET /streams/:name/events HTTP endpoint
  - Returns historic events without SSE streaming
  - Supports offset and limit query params

- Add StreamManagerService.Live layer
  - Properly injects Storage dependency
  - FileSystem storage used in production server

- Write e2e test proving persistence across server restarts
  - Events survive server stop/start
  - Offsets continue monotonically after restart

- Update README with new commands and file locations

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@effect/cli requires options to come before positional arguments.
Updated all CLI examples in Stream Commands and tmux sections.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Server commands now accept --storage [memory|fs] (default: fs):
- memory: Volatile in-memory storage for testing
- fs: Persistent file-based storage in .iterate/streams/

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
All stream commands now use -n/--name for stream name:
  stream append -n mystream -m "hello"
  stream get -n mystream
  stream subscribe -n mystream
  stream delete -n mystream

Also changed limit option from -n to -l to avoid conflict.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes CI failures by replacing all Bun-specific platform imports
with Node.js equivalents:
- BunContext → NodeContext
- BunRuntime → NodeRuntime
- BunHttpServer → NodeHttpServer
- BunStream → native Node.js stdin handling

Test files updated to use `npx tsx` instead of `bun` for CLI execution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The body property can be undefined, but with exactOptionalPropertyTypes
enabled, we can't pass undefined to fetch()'s body. Fix by conditionally
spreading the body property only when defined.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add proper server ready polling with timeout instead of fixed sleep
- Fix script path resolution using import.meta.url for daemon spawn
- Better error messages for connection failures

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add comprehensive architecture-sketch.md documenting:
  - Event design with source-based namespacing
  - Harness bridge architecture (hooks-based, not translation)
  - Concrete bridge implementations for OpenCode, Claude Code, Pi
  - 24 open questions with multiple solutions per domain
  - Recommendations summary table

- Add hooks system to durable-streams:
  - BeforeAppendHook and AfterAppendHook interfaces
  - withHooks() wrapper for stream composition
  - StreamFactory for creating hooked streams
  - Tests for hook behavior

Bridge implementations cover:
- OpenCode: HTTP/SSE server, SDK client
- Claude Code: CLI subprocess, SDK async generator, global hooks
- Pi: stdin/stdout RPC, JSONL sessions

Open questions organized into:
- Session management & concurrency
- Event streaming & format
- Process lifecycle & supervision
- TUI compatibility & handoff
- Tool injection & routing
- Error recovery & state
- Storage architecture

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

# Agent runtime data (contexts, logs)
.mini-agent/
opensrc/
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexplained gitignore entry for opensrc/ directory

Low Severity

The opensrc/ directory is added to .gitignore without any explanatory comment and doesn't appear anywhere else in the codebase. Unlike .iterate/ which has a descriptive comment and is documented in src/durable-streams/README.md, there's no documentation or code referencing opensrc/. This appears to be an accidentally committed personal or local directory ignore entry that isn't related to the PR's stated purpose of implementing durable-streams.

Fix in Cursor Fix in Web

jonastemplestein and others added 3 commits January 8, 2026 21:52
- Add agent-wrapper package for wrapping Pi coding agent with durable streams
- Pi adapter connects Pi SDK sessions to event streams
- Use file-based SessionManager.create() for Pi CLI interop
- Sessions stored in ~/.pi/agent/sessions/ (Pi's default location)
- Use INIT_CWD env var to preserve shell working directory
- Add CLI commands: start, prompt, abort, subscribe, list
- Add e2e test for full session flow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants