Commit Graph

1 Commits

Author SHA1 Message Date
Joel Hooks 29edbdb5e7 Create @joelclaw/agent-execution as canonical sandbox execution contract package
Story 1: Define shared sandbox execution contract

Created new workspace package @joelclaw/agent-execution to unify ad-hoc types between Restate workflows and system-bus Inngest functions.

Contract types defined:
- SandboxExecutionRequest: workflow ID, request ID, story ID, task, agent identity, sandbox profile, base SHA, verification commands
- SandboxExecutionResult: request ID, execution state, timestamps, duration, artifacts, error
- ExecutionArtifacts: head SHA, touched files, patch, verification summary, log references
- AgentIdentity: name, variant, model, program
- StoryPlan, WavePlan, PrdExecutionPlan: PRD structure types
- Lifecycle states: pending, running, completed, failed, cancelled
- Sandbox profiles: workspace-write, danger-full-access
- InboxResult: legacy format for backward compatibility

Runtime validation:
- Type guards for all contract shapes (isSandboxExecutionRequest, etc.)
- JSON serialization round-trip tests
- Schema validators with comprehensive test coverage

Integration:
- Restate prd-types.ts now re-exports from @joelclaw/agent-execution
- system-bus agent-dispatch.ts imports InboxResult from shared package
- system-bus serve.ts annotated with contract location comment
- docs/architecture.md created with full system architecture overview

Verification:
- 31 tests pass (contract invariants, serialization, validation)
- TypeScript compilation: clean
- Biome formatting: applied

This package provides the stable contract foundation for Story 2 (Restate wrapper), Story 3 (k8s Job launcher), and Story 4 (dispatch routing).
2026-03-06 17:06:56 -08:00