Implement the 5 core service modules in packages/core/src/:
- metadata.ts: Flat-file key=value session metadata read/write matching
existing bash script format. Supports read, write, update, delete
(with archive), and list operations.
- event-bus.ts: In-process pub/sub with JSONL append-only persistence.
Supports typed and wildcard listeners, priority inference from event
type, filtered history queries, and a createEvent() helper.
- tmux.ts: Async wrappers around tmux commands using child_process.execFile
(no shell injection). Handles long/multiline messages via load-buffer/
paste-buffer. Covers list, create, send-keys, capture-pane, kill, and
pane TTY discovery.
- session-manager.ts: Session CRUD that orchestrates Runtime + Agent +
Workspace plugins. Full spawn pipeline (workspace → runtime → agent),
list with live runtime checks, kill with cleanup, batch cleanup checking
PR state + issue state + runtime liveness, and message delivery.
- lifecycle-manager.ts: State machine per session with configurable polling
interval. Detects status transitions, emits events, triggers configured
reactions (send-to-agent, notify, auto-merge) with retry counting and
time-based escalation. Routes notifications by priority to configured
notifier plugins.
All services implement interfaces defined in types.ts. Updated index.ts
to export all new modules.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>