gatelineAPI reference

Implements

Constructors

  • options.identity pins the author of every write from this source — the v1 orchestrator's bot identity (ORCHESTRATOR.md §4.3). Human surfaces omit it and write as git config user.name/email, so machine bookkeeping and human decisions stay distinguishable at a glance.

    options.frameworkPrefix overrides the default .gateline probe location for a host integrated with a custom gateline init --prefix (#94).

    options.localOnly forces push off (belt-and-braces — loadSources already resolves push: false under local-only) and is what syncFromRemote reads to skip fetching origin entirely. Direct construction without this option behaves exactly as before it existed: no source-level auto-detect.

    Parameters

    • id: string
    • dir: string
    • options: {
          fetchIntervalSeconds?: number;
          frameworkPrefix?: string;
          identity?: Identity;
          localOnly?: boolean;
          push?: boolean;
      } = {}

    Returns LocalGitSource

Properties

dir: string
frameworkRoots: () => Promise<FrameworkRoots>

Resolved core-layer roots, cached for the life of this source and shared with any other consumer resolving paths against this same repo (the orchestrator's Engine, #95) so the layout is probed once.

git: Git
id: string
localOnly: boolean

True when this source is running in local-only mode — no push, no origin fetch. A plain own field rather than a prototype accessor: sync.ts's planSyncForSource test (task 02) stubs a source via Object.assign(Object.create(getPrototypeOf(real)), real, { localOnly: true }), which throws against a getter-only prototype accessor (no setter) but assigns cleanly onto a plain own data property.

Contract templates of this repo, for R3 validation.

Accessors

Methods

  • Commits on the run branch that origin does not yet have — unpushed writes (#149): the lineage Gatehouse renders and the lineage origin consumers see have silently diverged. Absent method or null result means "not knowable" (no origin tracking, remote-kind run) — display nothing, never zero.

    Parameters

    Returns Promise<null | number>

  • Commits origin has that the local run branch does not (#99). Non-zero together with aheadOfOrigin means the branch has genuinely diverged — local-wins observation is then a deliberate choice that must be visible, never silent. Absent method or null means "not knowable".

    Parameters

    Returns Promise<null | number>

  • remote.origin.url as configured, or null when there is nothing to link out to (#267). Local-only short-circuits before reading git config, the same way syncFromRemote short-circuits before fetching: a local-only source has no origin by designation, whatever a stale config line says.

    Returns Promise<null | string>

  • Parameters

    Returns Promise<
        | { error: string; raw: null; state: null }
        | {
            error: null | string;
            raw: string;
            state:
                | null
                | {
                    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;
                    }[];
                };
        },
    >

  • Every commit on the run branch touching the run's own directory, newest first — the branch's own order, which is what "after" means when the clocks that stamped the facts disagree (#346, branch-order.ts). One log, no per-commit reads: stateHistory is the expensive walk, this is the cheap index that places its commits alongside the artifact landings.

    Optional, like the origin-divergence counts: a driver with no history to offer omits it, and its callers fall back to timestamps.

    Parameters

    Returns Promise<CommitInfo[]>

  • Pull remote state into this clone. Remote-tracking refs always update (listRuns already reads refs/remotes/*); existing local branches are fast-forwarded only when the same branch exists on origin, so a branch holding an unpushed decision commit is never clobbered — the decision's own push reconciles it. New remote branches are not materialized locally; writeState does that lazily on the first decision.

    Local-only mode (AC2.4) short-circuits before any git invocation — the one guard covering both the engine's heartbeat sync and the server's interval sync.

    Returns Promise<void>

  • The single write path (rule R2): apply a mutation to state.yaml and commit it to the run branch, compare-and-swap semantics. expectedTip extends the CAS window back to the caller's read: when given and the branch no longer points there, the write refuses with ref-moved — the machine co-writer's derive-then-write guard (ORCHESTRATOR.md §4.4). Human surfaces omit it: their reads happen inside this call.

    Parameters

    Returns Promise<WriteResult>