/** * @module koi/taskplane/types * * Shared shapes for the task execution plane: the device side of the * platform's task-orchestration control plane (skykoi-live * src/lib/orchestrator). The platform is the source of truth for task state; * this device pulls self-contained TaskPackets, executes them in isolated * git worktrees, and reports structured TaskEvents back through a durable * at-least-once outbox. Keep these in sync with the platform's * orchestrator/types.ts — the wire contract is intentionally small. */ export type TaskPacketKind = "task" | "merge" | "effect" | "cancel"; export type TaskContract = { reads: string[]; writes: string[]; exclusive: string[]; effects: string[]; forbiddenPaths: string[]; }; export type TaskPacketGit = { /** {kind:"workspace"} | {kind:"path", path, trunk} */ repo: { kind: "workspace"; } | { kind: "path"; path: string; trunk?: string; }; trunkBranch: string; baseSha: string | null; branchName: string; }; export type TaskPacket = { kind: TaskPacketKind; attemptId: string; taskId: string; planId: string; planRevision: number; taskKey: string; title: string; goal: string; instructions: string[]; contract: TaskContract; git: TaskPacketGit | null; acceptance: { criteria: string[]; commands: string[]; }; permissions: Record | null; timeoutSec: number; lease: { id: string; expiresAt: string; extendEverySec: number; } | null; /** kind "effect" only: the idempotent action to perform. */ effect?: { effectId: string; action: string; idempotencyKey: string; params: Record; } | null; }; export declare const TASKPLANE_EVENT_KINDS: readonly ["STARTED", "PROGRESS_CHECKPOINT", "BLOCKED_ON_DEPENDENCY", "SCOPE_EXPANSION_REQUIRED", "CONTRACT_CHANGED", "RESULT_READY", "VALIDATION_RESULT", "VALIDATION_FAILED", "COMPLETED", "MERGE_RESULT", "EFFECT_RESULT", "LOG"]; export type TaskplaneEventKind = (typeof TASKPLANE_EVENT_KINDS)[number]; export type TaskplaneEventDraft = { attemptId: string; kind: TaskplaneEventKind; content?: Record; occurredAt?: string; }; export type TaskplaneOutboxEvent = TaskplaneEventDraft & { /** Outbox identity AND the platform-side dedupe key — at-least-once safe. */ eventId: string; content: Record; occurredAt: string; };