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.

    id is taken as given (#494): loadSources derives it from the origin and checks it, and a direct constructor — the engine, a test — names its source as it likes. options.displayName defaults to the id's last segment; options.formerIds to none.

    options.mode is what loadSources resolved (§7.3). A view source refuses writeState and stageRun before anything else; absent — the engine's own source, a test — refuses nothing, as before modes existed.

    Parameters

    Returns LocalGitSource

Properties

dir: string
displayName: string

The short name an interface shows. Presentation only: never in a URL, a cache key or a commit. Optional so a driver or a test double need not say; read it through displayNameOf, which falls back to the id's last segment.

formerIds: readonly string[]

Names this repository was reached by before its current id, so a link made under one still resolves (§6.3, §6.4): the config's former_ids:, and the ids a deployment used before #494 — the config name, the directory's basename, and either with a -2 suffix. Absent means none.

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

The repository's id (docs/MULTI-REPO.md §6): <host>/<owner>/<name> from its origin, or local/<name> when it has none. What URLs, cache keys and logs carry. Two ids that differ only in case name the same repository; compare them with sameRepositoryId.

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.

mode: undefined | "decide" | "view" | "dispatch"

What this deployment may do here (§7.3), as resolved for this process: a config entry's mode, except that a dispatch entry reads as decide where no engine runs (ui, the CLI); a repository given by --repo or the working directory is dispatch under up and decide otherwise. Optional so a driver or a test double need not say, and absent means no restriction — how the engine's own source is built. A view source refuses every write (writeState, stageRun), which is where the rule is enforced so that no caller can forget it.

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>

  • The commit a branch points at now, or null when it names none. What the remote runner's intents are pinned to (runner-api.ts). Absent means the driver cannot resolve names.

    Parameters

    • branch: string

    Returns Promise<null | string>

  • The origin URL as git resolves it (git remote get-url origin, so an insteadOf rewrite applies — the same string the id is derived from), or null when there is nothing to link out to (#267). Local-only short-circuits before asking git, 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 refs this source's views read, as comparable strings (#461): what a cache validates an entry against, and what decides whether a change is worth announcing. Optional: a driver that cannot say omits it, and its views are refreshed on a timer instead.

    Returns Promise<ViewRefs>

  • Watches this clone's ref storage (watch-refs.ts); the default debounce is 300 ms.

    Parameters

    • onChange: () => void
    • options: { debounceMs?: number; onTouch?: () => void } = {}

    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>