gatelineAPI reference
  • The phase a gate decision is judged against: the run's own, or the one its gate ledger derives when that is further along.

    Two records need the ledger's answer rather than the phase field's. A paused or closed run holds no position in the sequence at all, and yet the ordinary reason a run is paused is a question about the very packet its pending gate covers — which a human answers by deciding that gate. And a phase can simply lag its own ledger for a while: an advancePhase: false approval signs the gate without moving the phase, and the engine's convergence rule (D5) writes the advance on its next tick. A gate signed but not yet walked past is a record mid-transition, not a run that skipped anything.

    A phase ahead of the ledger is the opposite case and keeps its own value, so the decision is judged where the record actually claims to be — refusing is the safe direction when those two disagree that way.

    Parameters

    • state: {
          branch: string;
          budget:
              | null
              | {
                  cost_limit_usd: null
                  | number;
                  cost_spent_usd: null | number;
                  [key: string]: unknown;
              };
          closure: | null
          | {
              as: "already-delivered"
              | "superseded"
              | "obsolete"
              | "abandoned";
              at: null | string;
              by: null | string;
              reason: null | string;
              [key: string]: unknown;
          };
          escalations: {
              at: null
              | string;
              disposition: null | "re-review" | "return-to-implement" | "re-plan";
              from_role: null | string;
              reason: string;
              resolution: null | string;
              resolved: boolean;
              resolved_at: null | string;
              resolved_by: null | string;
              [key: string]: unknown;
          }[];
          gates: {
              G0: {
                  approved: boolean;
                  at: null
                  | string;
                  burden: null | "confirmation" | "light-correction" | "heavy-correction";
                  by: null | string;
                  notes: null | string;
                  [key: string]: unknown;
              };
              G1: {
                  approved: boolean;
                  at: null
                  | string;
                  burden: null | "confirmation" | "light-correction" | "heavy-correction";
                  by: null | string;
                  notes: null | string;
                  [key: string]: unknown;
              };
              G2: {
                  approved: boolean;
                  at: null
                  | string;
                  burden: null | "confirmation" | "light-correction" | "heavy-correction";
                  by: null | string;
                  notes: null | string;
                  [key: string]: unknown;
              };
              G3: {
                  approved: boolean;
                  at: null
                  | string;
                  burden: null | "confirmation" | "light-correction" | "heavy-correction";
                  by: null | string;
                  notes: null | string;
                  [key: string]: unknown;
              };
          };
          paused_reason: null
          | string;
          phase:
              | "spec"
              | "plan"
              | "implement"
              | "integrate"
              | "release"
              | "done"
              | "paused"
              | "closed";
          profile: "patch"
          | "standard"
          | "full";
          run: string;
          tasks: {
              id: string;
              review_rounds: number;
              status: string;
              [key: string]: unknown;
          }[];
      }

    Returns
        | "spec"
        | "plan"
        | "implement"
        | "integrate"
        | "release"
        | "done"
        | "paused"
        | "closed"