feat(v2): builder-agent self-modification WIP + container-config as per-group file

Checkpoints the builder-agent dev-agent/worktree/swap flow (create_dev_agent,
request_swap, classifier, deadman, promote) before pivoting to a unified
draft-activate approach with OS-level RO enforcement. Lifts container_config
out of the agent_groups row into groups/<folder>/container.json so install_packages,
add_mcp_server, and rebuild flows can eventually route through the same draft
path as source edits.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gavrielc
2026-04-15 18:42:10 +03:00
parent c54c779834
commit 75c2fde2b5
48 changed files with 4385 additions and 134 deletions

View File

@@ -5,7 +5,6 @@ export interface AgentGroup {
name: string;
folder: string;
agent_provider: string | null;
container_config: string | null; // JSON: { additionalMounts, timeout }
created_at: string;
}
@@ -180,6 +179,47 @@ export interface PendingCredential {
created_at: string;
}
// ── Pending swaps (central DB, builder-agent feature) ──
/** Classification of a swap's diff — drives approval routing + warning UX. */
export type SwapClassification = 'group' | 'host' | 'combined';
/**
* Swap lifecycle status. Transitions:
* pending_approval → awaiting_confirmation → (finalized | rolled_back | rejected)
* `rejected` is also reachable directly from pending_approval.
*/
export type SwapStatus =
| 'pending_approval'
| 'awaiting_confirmation'
| 'finalized'
| 'rolled_back'
| 'rejected';
/**
* Deadman handshake state — only meaningful while status = awaiting_confirmation.
* pending_restart — swap applied, container/host restarting, message 1 not yet sent.
* message1_sent — handshake prompt delivered, waiting for user confirm/rollback.
*/
export type SwapHandshakeState = 'pending_restart' | 'message1_sent';
export interface PendingSwap {
request_id: string;
dev_agent_id: string;
originating_group_id: string;
dev_branch: string;
commit_sha: string;
classification: SwapClassification;
status: SwapStatus;
summary_json: string;
pre_swap_sha: string | null;
db_snapshot_path: string | null;
deadman_started_at: string | null;
deadman_expires_at: string | null;
handshake_state: SwapHandshakeState | null;
created_at: string;
}
// ── Agent destinations (central DB) ──
export interface AgentDestination {