toolroll 0.9.76 → 0.9.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/CHANGELOG.md +273 -0
  2. package/README.md +11 -4
  3. package/THIRD_PARTY_NOTICES.md +5 -5
  4. package/dist/agent-fence.js +46 -10
  5. package/dist/assignment.js +3 -0
  6. package/dist/backup-ui.d.ts +9 -1
  7. package/dist/backup-ui.js +28 -3
  8. package/dist/backup.js +4 -3
  9. package/dist/browser/THIRD_PARTY_NOTICES.txt +5 -5
  10. package/dist/browser/workspace.css +2 -2
  11. package/dist/browser/workspace.js +31 -31
  12. package/dist/browser-workspace.d.ts +2 -0
  13. package/dist/builder.d.ts +18 -3
  14. package/dist/builder.js +152 -47
  15. package/dist/chat-decide.js +4 -0
  16. package/dist/check-failure.d.ts +92 -0
  17. package/dist/check-failure.js +295 -0
  18. package/dist/check-progress.d.ts +28 -1
  19. package/dist/check-progress.js +105 -6
  20. package/dist/check-report.d.ts +67 -6
  21. package/dist/check-report.js +254 -9
  22. package/dist/checkout-cleanup.js +2 -2
  23. package/dist/claim.d.ts +9 -0
  24. package/dist/claim.js +9 -1
  25. package/dist/cli.js +8 -5
  26. package/dist/coding-handoff.d.ts +1 -0
  27. package/dist/coding-handoff.js +20 -11
  28. package/dist/commit-extract.d.ts +6 -0
  29. package/dist/commit-extract.js +63 -8
  30. package/dist/console-chrome.d.ts +41 -0
  31. package/dist/console-chrome.js +166 -0
  32. package/dist/contracts/console-api.d.ts +1 -1
  33. package/dist/contracts/console-api.js +1 -1
  34. package/dist/contracts/release-check.d.ts +12 -0
  35. package/dist/contracts/release-check.js +17 -0
  36. package/dist/contracts/release-terms.d.ts +41 -0
  37. package/dist/contracts/release-terms.js +53 -0
  38. package/dist/contracts/verification-receipt.d.ts +20 -2
  39. package/dist/contracts/verification-receipt.js +15 -3
  40. package/dist/contracts/verification-view.d.ts +8 -0
  41. package/dist/controller-service.js +4 -1
  42. package/dist/controller-supervisor.d.ts +8 -0
  43. package/dist/controller-supervisor.js +33 -1
  44. package/dist/demo.js +3 -2
  45. package/dist/deploy-gate.js +5 -0
  46. package/dist/deploy-rescue.d.ts +41 -0
  47. package/dist/deploy-rescue.js +94 -0
  48. package/dist/desktop-update.d.ts +1 -1
  49. package/dist/dispose.d.ts +3 -0
  50. package/dist/dispose.js +9 -5
  51. package/dist/doctor.d.ts +7 -0
  52. package/dist/doctor.js +10 -2
  53. package/dist/envelope.js +2 -1
  54. package/dist/evidence.d.ts +9 -0
  55. package/dist/evidence.js +19 -4
  56. package/dist/exec.d.ts +9 -0
  57. package/dist/exec.js +22 -2
  58. package/dist/git-floor.d.ts +16 -0
  59. package/dist/git-floor.js +36 -0
  60. package/dist/grant.js +5 -1
  61. package/dist/guides.js +22 -11
  62. package/dist/latency-timeline.d.ts +46 -0
  63. package/dist/latency-timeline.js +120 -0
  64. package/dist/live-backup.d.ts +39 -0
  65. package/dist/live-backup.js +271 -0
  66. package/dist/operate.d.ts +13 -0
  67. package/dist/operate.js +969 -328
  68. package/dist/planner.js +2 -2
  69. package/dist/prepared-evidence.d.ts +2 -1
  70. package/dist/prepared-evidence.js +8 -3
  71. package/dist/project-knowledge.js +6 -2
  72. package/dist/project-learning.js +2 -2
  73. package/dist/proof.js +6 -0
  74. package/dist/read-executor-worker.js +8 -4
  75. package/dist/read-executor.d.ts +18 -1
  76. package/dist/read-executor.js +8 -0
  77. package/dist/release-adapters.d.ts +80 -2
  78. package/dist/release-adapters.js +441 -16
  79. package/dist/release-authority.js +6 -2
  80. package/dist/release-auto.d.ts +38 -7
  81. package/dist/release-auto.js +131 -15
  82. package/dist/release-card.d.ts +15 -3
  83. package/dist/release-card.js +25 -9
  84. package/dist/release-carry.d.ts +21 -1
  85. package/dist/release-carry.js +22 -0
  86. package/dist/release-ci-hold.d.ts +41 -0
  87. package/dist/release-ci-hold.js +53 -0
  88. package/dist/release-cli.d.ts +3 -0
  89. package/dist/release-cli.js +95 -17
  90. package/dist/release-coverage.js +5 -2
  91. package/dist/release-gate.d.ts +5 -0
  92. package/dist/release-gate.js +1 -1
  93. package/dist/release-recheck.d.ts +1 -1
  94. package/dist/release-recheck.js +8 -2
  95. package/dist/release.d.ts +144 -14
  96. package/dist/release.js +421 -81
  97. package/dist/review-context.js +8 -6
  98. package/dist/runner-process.d.ts +67 -0
  99. package/dist/runner-process.js +219 -0
  100. package/dist/runner.d.ts +48 -6
  101. package/dist/runner.js +73 -9
  102. package/dist/sandbox-runtime.d.ts +8 -0
  103. package/dist/sandbox-runtime.js +14 -2
  104. package/dist/scope.d.ts +19 -1
  105. package/dist/scope.js +26 -3
  106. package/dist/scout.js +2 -2
  107. package/dist/secret-mint.d.ts +1 -0
  108. package/dist/secret-mint.js +14 -0
  109. package/dist/serve.js +112 -51
  110. package/dist/server/chat.js +5 -5
  111. package/dist/server/http.d.ts +2 -0
  112. package/dist/server/pages.js +7 -3
  113. package/dist/server/remote-hooks.d.ts +1 -1
  114. package/dist/server/remote-hooks.js +5 -3
  115. package/dist/server/render-results.d.ts +2 -0
  116. package/dist/server/render-results.js +1 -0
  117. package/dist/server/render-tasks.d.ts +2 -0
  118. package/dist/server/render-tasks.js +2 -1
  119. package/dist/server/request-context.d.ts +8 -0
  120. package/dist/server/runtime.d.ts +2 -0
  121. package/dist/server/settings.js +22 -2
  122. package/dist/server/task-views.js +7 -2
  123. package/dist/server/tasks.js +4 -1
  124. package/dist/setup-guide.d.ts +2 -2
  125. package/dist/storage-sweep.js +1 -1
  126. package/dist/storage.d.ts +5 -0
  127. package/dist/storage.js +28 -1
  128. package/dist/store.d.ts +135 -2
  129. package/dist/store.js +275 -13
  130. package/dist/surface.js +3 -1
  131. package/dist/task-base.d.ts +4 -0
  132. package/dist/task-base.js +22 -2
  133. package/dist/teardown-git.d.ts +52 -3
  134. package/dist/teardown-git.js +145 -33
  135. package/dist/test-infra.js +1 -1
  136. package/dist/toolroll-update.js +2 -2
  137. package/dist/up-processes.d.ts +137 -0
  138. package/dist/up-processes.js +165 -0
  139. package/dist/up-role-child.d.ts +1 -0
  140. package/dist/up-role-child.js +81 -0
  141. package/dist/verification-evidence.d.ts +1 -0
  142. package/dist/verification-evidence.js +13 -1
  143. package/dist/workspace-revision.js +3 -1
  144. package/package.json +2 -1
package/dist/planner.js CHANGED
@@ -23,7 +23,7 @@ import { run } from "./exec.js";
23
23
  import { checkoutGit } from "./teardown-git.js";
24
24
  import { auditOf, isProviderId } from "./provider.js";
25
25
  import { currentClaim, heartbeat } from "./claim.js";
26
- import { heartbeat as runnerHeartbeat } from "./runner.js";
26
+ import { heartbeat as runnerHeartbeat, RUNNER_HEARTBEAT_MS } from "./runner.js";
27
27
  import { parseDecision } from "./decision.js";
28
28
  import { parsePlan } from "./plan.js";
29
29
  import { PLAN_MODEL_SCHEMA } from "./contracts/plan.js";
@@ -44,7 +44,7 @@ const GIT = "git";
44
44
  const AGENT_ENV_DENYLIST = [...TELEGRAM_TOKEN_ENVS];
45
45
  const DEFAULT_PLAN_TIMEOUT_MS = 20 * 60_000;
46
46
  const DEFAULT_PLAN_TURNS = CLAUDE_LIMITS.maxTurns;
47
- const DEFAULT_PULSE_MS = 60_000;
47
+ const DEFAULT_PULSE_MS = RUNNER_HEARTBEAT_MS;
48
48
  /**
49
49
  * One line of untrusted text made inert for the planner's brief (Codex
50
50
  * M5-M8 audit, IV-4): controls and separators collapse, protocol-shaped
@@ -1,6 +1,7 @@
1
1
  import { type ParsedProof } from './proof.js';
2
2
  export declare const PREPARED_EVIDENCE_FILE = "standing-orders.evidence.json";
3
- export declare const PREPARED_EVIDENCE_GIT: readonly ['--literal-pathspecs', '--no-lazy-fetch', '--no-replace-objects', '--no-optional-locks'];
3
+ /** Read flags: --no-lazy-fetch where git has it; a partial clone is refused where it doesn't (teardown-git.ts). */
4
+ export declare const preparedEvidenceGit: () => string[];
4
5
  export type PreparedEvidence = {
5
6
  proof: ParsedProof;
6
7
  files: {
@@ -1,12 +1,13 @@
1
1
  /** Committed image inventory, never claimed checks, completion, or approval. */
2
- import { execFileSync } from 'node:child_process';
2
+ import { noLazyFetch, viewedGitSync } from './teardown-git.js';
3
3
  import { createHash } from 'node:crypto';
4
4
  import { lstatSync, writeFileSync } from 'node:fs';
5
5
  import { join } from 'node:path';
6
6
  import { imageDimensions, looksLikeProtocolFile, readMailbox, SCREENSHOT_BYTE_CAP, validateScreenshotBytes } from './evidence.js';
7
7
  import { parseProof, PROOF_LIMITS, SCREENSHOT_EVIDENCE_MIN_BYTES, SCREENSHOT_EVIDENCE_MIN_HEIGHT, SCREENSHOT_EVIDENCE_MIN_WIDTH, serializeProof } from './proof.js';
8
8
  export const PREPARED_EVIDENCE_FILE = 'standing-orders.evidence.json';
9
- export const PREPARED_EVIDENCE_GIT = ['--literal-pathspecs', '--no-lazy-fetch', '--no-replace-objects', '--no-optional-locks'];
9
+ /** Read flags: --no-lazy-fetch where git has it; a partial clone is refused where it doesn't (teardown-git.ts). */
10
+ export const preparedEvidenceGit = () => ['--literal-pathspecs', ...noLazyFetch(), '-c', 'protocol.allow=never', '--no-replace-objects', '--no-optional-locks'];
10
11
  const nextAction = 'Ask Codex to prepare review screenshots and commit them with standing-orders.evidence.json, then review the new result.';
11
12
  const fail = (detail) => { throw Error(`Review screenshots are not ready. ${nextAction} ${detail}`); };
12
13
  const digest = (bytes) => createHash('sha256').update(bytes).digest('hex');
@@ -16,7 +17,11 @@ export function readPreparedEvidence(repo, candidate, required = false) {
16
17
  fail('The saved commit is invalid.');
17
18
  const git = (args, cap) => {
18
19
  try {
19
- return execFileSync('git', [...PREPARED_EVIDENCE_GIT, '-C', repo, ...args], { stdio: ['ignore', 'pipe', 'pipe'], timeout: 10_000, maxBuffer: cap });
20
+ // Every git version through a frozen read view, bounded (eval-harness review 1, finding 7).
21
+ const ran = viewedGitSync(repo, [...preparedEvidenceGit(), ...args], { timeoutMs: 10_000, maxBuffer: cap, buffer: true });
22
+ if (ran.status !== 0)
23
+ throw new Error('git failed');
24
+ return ran.stdout;
20
25
  }
21
26
  catch {
22
27
  return fail('The committed screenshot inventory could not be read.');
@@ -1,5 +1,5 @@
1
1
  /** Project-owned context, independent of provider memory. Never grants authority. */
2
- import { execFileSync } from 'node:child_process';
2
+ import { checkoutGitSync } from './teardown-git.js';
3
3
  import { acceptedIdentities, carryProject, learningIdentity, learningSha } from './project-learning.js';
4
4
  import { currentActor } from './actor.js';
5
5
  import { decisionLines, getDecision, listDecisions } from './project-memory.js';
@@ -35,7 +35,11 @@ CREATE TRIGGER IF NOT EXISTS knowledge_snapshot_no_update BEFORE UPDATE ON knowl
35
35
  CREATE TRIGGER IF NOT EXISTS knowledge_snapshot_no_delete BEFORE DELETE ON knowledge_snapshot BEGIN SELECT RAISE(ABORT,'Knowledge context is immutable'); END;
36
36
  `;
37
37
  const EMPTY = { instructions: '', references: [] };
38
- const git = (repo, args) => execFileSync('git', ['--no-optional-locks', '--no-lazy-fetch', '-c', 'core.fsmonitor=false', '-c', 'core.hooksPath=/dev/null', '-C', repo, ...args], { encoding: 'utf8', maxBuffer: 200_000, stdio: ['ignore', 'pipe', 'pipe'] }).trimEnd();
38
+ // No --no-lazy-fetch: through a frozen read view, which refuses a partial clone from the config git runs with.
39
+ // Every git version through a frozen read view (eval-harness review 1, finding 7): the repository's config is copied
40
+ // once and inspected (an include, a command or a partial clone refused), so an include pointing at a FIFO can't hang
41
+ // the plane, and every call is bounded.
42
+ const git = (repo, args) => checkoutGitSync(repo, args, { timeoutMs: 10_000, maxBuffer: 200_000 }).trimEnd();
39
43
  function clean(value, bytes) {
40
44
  if (Buffer.byteLength(value) > bytes || /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f\ufffd]/u.test(value))
41
45
  throw Error('This text is too long or is not readable text.');
@@ -2,7 +2,6 @@
2
2
  import { inReadOnlyRequest } from "./read-only-request.js";
3
3
  import { checkoutGitSync } from './teardown-git.js';
4
4
  import { createHash } from 'node:crypto';
5
- import { execFileSync } from 'node:child_process';
6
5
  import { closeSync, constants as fsConstants, existsSync, fstatSync, lstatSync, openSync, readSync, realpathSync, statSync } from 'node:fs';
7
6
  import { join, resolve } from 'node:path';
8
7
  import { readVerifiedArtifact, scanForSecrets } from './evidence.js';
@@ -54,7 +53,8 @@ const git = (repo, args, seen) => {
54
53
  return known;
55
54
  // Bounded, and no hook or fsmonitor program: it also runs from the console's background pass.
56
55
  // No lazy fetch either: a partial clone's fetch runs whatever transport command the shared config names.
57
- const out = execFileSync('git', ['--no-optional-locks', '--no-lazy-fetch', '-c', 'core.fsmonitor=false', '-c', 'core.hooksPath=/dev/null', '-C', repo, ...args], { encoding: 'utf8', maxBuffer: 2 * 1024 * 1024, timeout: 10_000, stdio: ['ignore', 'pipe', 'pipe'] }).trimEnd();
56
+ // Every git version through a frozen read view, bounded (eval-harness review 1, finding 7).
57
+ const out = checkoutGitSync(repo, args, { timeoutMs: 10_000, maxBuffer: 2 * 1024 * 1024 }).trimEnd();
58
58
  seen?.set(key, out);
59
59
  return out;
60
60
  };
package/dist/proof.js CHANGED
@@ -622,6 +622,12 @@ function verificationFailureWords(failure) {
622
622
  return "automatic recovery stopped because this worker no longer owned the build";
623
623
  case "coverage-incomplete":
624
624
  return "the release check didn't cover everything it owed, or a required test went missing or was skipped";
625
+ case "no-result":
626
+ return "the release check gave no complete result (no valid report, or a part, file or journey with no outcome), so it can't count as a pass";
627
+ case "baseline-unverifiable":
628
+ return "the last release Toolroll recorded couldn't be verified, so what the release check owed is unknown and it wasn't run";
629
+ case "stopped-by-toolroll":
630
+ return "Toolroll's own shutdown stopped the approved verification command before it finished";
625
631
  case "timed-out":
626
632
  return "the approved verification command timed out before checks finished";
627
633
  case "spawn-failed":
@@ -1,6 +1,7 @@
1
1
  import { parentPort, workerData } from 'node:worker_threads';
2
2
  import { openStoreReadOnly } from './store.js';
3
- import { workIndexPage } from './work-index.js';
3
+ import { workCountsByProject, workIndexPage } from './work-index.js';
4
+ import { projectSummaryOf } from './console-chrome.js';
4
5
  /** One read-only, query-only connection per worker (read-executor.ts). Jobs arrive one at a time. */
5
6
  let store = null;
6
7
  function connection() {
@@ -15,9 +16,12 @@ function connection() {
15
16
  parentPort.on('message', ({ id, job }) => {
16
17
  let reply;
17
18
  try {
18
- if (job.kind !== 'work-index-page')
19
- throw new Error('Unknown read.');
20
- reply = { id, ok: true, value: workIndexPage(connection(), new Date(job.now), job.access, job.options) };
19
+ const now = new Date(job.now);
20
+ const value = job.kind === 'work-index-page' ? workIndexPage(connection(), now, job.access, job.options)
21
+ : job.kind === 'work-counts' ? workCountsByProject(connection(), now, job.access)
22
+ : job.kind === 'project-summary' ? projectSummaryOf(connection(), now, job.access, job.actor, job.projects, job.evidenceRoot ?? undefined)
23
+ : (() => { throw new Error('Unknown read.'); })();
24
+ reply = { id, ok: true, value };
21
25
  }
22
26
  catch (error) {
23
27
  reply = { id, ok: false, error: { name: error instanceof Error ? error.name : 'Error', message: error instanceof Error ? error.message : String(error) } };
@@ -1,5 +1,7 @@
1
1
  import type { Store } from './store.js';
2
- import { type WorkIndexOptions, type WorkIndexPage } from './work-index.js';
2
+ import { type WorkIndexOptions, type WorkIndexPage, type WorkProjectCounts } from './work-index.js';
3
+ import type { BrowserProjectState } from './browser-workspace.js';
4
+ import type { SidebarProject } from './console-chrome.js';
3
5
  import type { WorkSummaryAccess } from './work-summary.js';
4
6
  /**
5
7
  * Heavy, read-only database work for the server, run on worker threads (docs/server-performance.md).
@@ -14,6 +16,17 @@ export type ReadJob = {
14
16
  now: string;
15
17
  access: WorkSummaryAccess;
16
18
  options: WorkIndexOptions;
19
+ } | {
20
+ kind: 'work-counts';
21
+ now: string;
22
+ access: WorkSummaryAccess;
23
+ } | {
24
+ kind: 'project-summary';
25
+ now: string;
26
+ access: WorkSummaryAccess;
27
+ actor: string;
28
+ projects: SidebarProject[];
29
+ evidenceRoot: string | null;
17
30
  };
18
31
  export type ReadReply = {
19
32
  id: number;
@@ -38,6 +51,10 @@ export declare class ReadExecutor {
38
51
  get size(): number;
39
52
  /** workIndexPage(store, now, access, options) on a worker's read-only connection: same rows, same errors. */
40
53
  workIndexPage(now: Date, access: WorkSummaryAccess, options: WorkIndexOptions): Promise<WorkIndexPage>;
54
+ /** workCountsByProject(store, now, access) on a worker: the console's Tasks count and live beat. */
55
+ workCounts(now: Date, access: WorkSummaryAccess): Promise<WorkProjectCounts[]>;
56
+ /** projectSummaryOf (console-chrome.ts) on a worker: the sidebar's project states for one already-admitted reader. */
57
+ projectSummary(now: Date, access: WorkSummaryAccess, actor: string, projects: readonly SidebarProject[], evidenceRoot: string | undefined): Promise<BrowserProjectState[]>;
41
58
  /** Fails every queued and running read once, then stops the workers. */
42
59
  close(): Promise<void>;
43
60
  }
@@ -29,6 +29,14 @@ export class ReadExecutor {
29
29
  throw error;
30
30
  }
31
31
  }
32
+ /** workCountsByProject(store, now, access) on a worker: the console's Tasks count and live beat. */
33
+ async workCounts(now, access) {
34
+ return await this.#run({ kind: 'work-counts', now: now.toISOString(), access });
35
+ }
36
+ /** projectSummaryOf (console-chrome.ts) on a worker: the sidebar's project states for one already-admitted reader. */
37
+ async projectSummary(now, access, actor, projects, evidenceRoot) {
38
+ return await this.#run({ kind: 'project-summary', now: now.toISOString(), access, actor, projects: projects.map(one => ({ path: one.path, name: one.name })), evidenceRoot: evidenceRoot ?? null });
39
+ }
32
40
  #run(job) {
33
41
  if (this.#closed)
34
42
  return Promise.reject(new ReadExecutorError('The server is closing.'));
@@ -4,7 +4,7 @@
4
4
  * Homebrew tap through `gh`. Each call is bounded; none asks for or stores a credential — `gh`, npm and Toolroll use
5
5
  * the sign-ins this machine already has.
6
6
  */
7
- import type { CheckRun, GateState, Installed, ReleaseAdapters } from "./release.js";
7
+ import type { CheckRun, GateState, Installed, MainProtection, ReleaseAdapters } from "./release.js";
8
8
  import { Store } from "./store.js";
9
9
  import { type CiObservation } from "./release-auto.js";
10
10
  import { type BuildRunner } from "./release-carry.js";
@@ -70,6 +70,33 @@ export type AdapterOptions = {
70
70
  export declare const BRANCH_GONE_LOOKS = 5;
71
71
  export declare const BRANCH_GONE_PAUSE_MS = 2000;
72
72
  export declare function releaseAdapters(options: AdapterOptions): ReleaseAdapters;
73
+ /**
74
+ * Why a tap change isn't exactly the formula bump this release proposed (security scan), or null when it is: the tap's
75
+ * own open pull request number `pr` at exactly `head`, from its version branch into the default branch; compared with
76
+ * the default branch's head it is one commit on top of exactly that head, changing exactly one file, the formula; and
77
+ * the formula there is exactly today's with npm's published tarball and that tarball's own sha256.
78
+ */
79
+ export declare function tapChangeProblem(input: {
80
+ tap: string;
81
+ pr: number;
82
+ head: string;
83
+ version: string;
84
+ formula: string;
85
+ defaultBranch: string;
86
+ baseHead: string;
87
+ baseVersion: string | null;
88
+ view: Json;
89
+ compare: Json;
90
+ expected: string;
91
+ atHead: string;
92
+ sha256: string;
93
+ }): string | null;
94
+ /** Whether a pull request's head is a branch of the tap itself (never a fork's). */
95
+ export declare function tapOwnHead(pr: Json, tap: string): boolean;
96
+ /** The version a formula's tarball url names (`…/toolroll-<x.y.z>.tgz`), or null. */
97
+ export declare function formulaVersion(text: string): string | null;
98
+ /** Whether version `a` comes after `b` (both x.y.z). */
99
+ export declare function versionAfter(a: string, b: string): boolean;
73
100
  /**
74
101
  * Whether a workflow's triggers (its top-level `on:` as a name, a list or a map) include a change to the repository.
75
102
  * A file that doesn't parse, or whose triggers aren't one of those shapes, counts as running, so the release waits
@@ -88,9 +115,14 @@ export declare function storeReleaseAdapter(open: () => Store, done: (store: Sto
88
115
  auto?: AutoObservers): NonNullable<ReleaseAdapters["release"]>;
89
116
  /** What the plane itself reads for an automatic release approval. */
90
117
  export type AutoObservers = {
118
+ /** The plane's executor policy, never a report field or project setting. Unknown refuses. Production currently
119
+ * cannot establish this; synthetic observers may supply protected execution to exercise the remaining gates. */
120
+ reportsProtected?: boolean;
91
121
  observe: (sha: string) => Promise<CiObservation>;
92
122
  /** GitHub's merge base of `sha` with the branch `base` of the recorded repository. */
93
123
  mergeBase: (base: string, sha: string) => Promise<string>;
124
+ /** Whether main's protection holds for the account that merges (readMainProtection); null when unreadable. */
125
+ upToDateRequired: () => Promise<boolean | null>;
94
126
  evidenceRoot: string;
95
127
  };
96
128
  /**
@@ -98,9 +130,55 @@ export type AutoObservers = {
98
130
  * lists only the latest of each), every page — with its id, app, check suite and the commit it is filed under, oldest
99
131
  * first. A row that doesn't parse stops the read: a partial answer is never taken for the whole.
100
132
  */
101
- export declare function readCheckRuns(run: Exec, gh: string, repo: string, sha: string): Promise<CheckRun[]>;
133
+ export declare function readCheckRuns(run: Exec, gh: string, repo: string, sha: string,
134
+ /** A release tag (pipeline-speed.md, item 3): a push of exactly this tag binds its workflow file too. */
135
+ options?: {
136
+ tag?: string;
137
+ }): Promise<CheckRun[]>;
138
+ /** One job's step outcomes as GitHub's Actions API reports them. */
139
+ export type JobRecord = {
140
+ id: number;
141
+ status: string;
142
+ conclusion: string | null;
143
+ steps: {
144
+ number: number;
145
+ name: string;
146
+ status: string;
147
+ conclusion: string | null;
148
+ }[];
149
+ };
150
+ /**
151
+ * Whether a finished, unsuccessful job ended before any of the workflow's own steps ran: every step after GitHub's own
152
+ * first one ("Set up job", always number 1) never ran (no conclusion, or skipped) — leaving out only GitHub's own
153
+ * closing "Complete job" when it is the last step. Step numbers and outcomes are the runner's records; nothing the
154
+ * candidate prints is read. A job with no steps never reached one. Anything else (a step that ran, even the checkout)
155
+ * is not confirmed infrastructure.
156
+ */
157
+ export declare function failedBeforeTests(job: JobRecord): boolean;
158
+ /** GitHub's job record for one check run (its job), read strictly: null when it can't be read whole. */
159
+ export declare function readJobBeforeTests(run: Exec, gh: string, repo: string, id: number): Promise<boolean | null>;
102
160
  /** GitHub lists check runs from at most the latest 1000 check suites of a commit: the history is whole only below that. */
103
161
  export declare const CHECK_SUITE_CEILING = 1000;
104
162
  export declare function readSuitesComplete(run: Exec, gh: string, repo: string, sha: string): Promise<boolean>;
105
163
  /** GitHub's merge base of `sha` with branch `base` (the compare API), read by the plane. */
106
164
  export declare function readMergeBase(run: Exec, gh: string, repo: string, base: string, sha: string): Promise<string>;
165
+ /**
166
+ * Main's head as GitHub has it now (eval-harness review 1, finding 4): read by the plane's own gh from GitHub's API,
167
+ * never from a ref in a checkout a build can write.
168
+ */
169
+ export declare function readMainHead(run: Exec, gh: string, repo: string, branch?: string): Promise<string>;
170
+ /** Whether `sha` already holds `ancestor` (GitHub's compare: `sha` is not behind it), as GitHub answers now. */
171
+ export declare function readContains(run: Exec, gh: string, repo: string, sha: string, ancestor: string): Promise<boolean>;
172
+ /**
173
+ * Main's protection, judged for the principal that merges (eval-harness review 2, finding 1; review 1, finding 4): the
174
+ * plane's own gh, which merges as the same account. A layer holds only when it requires branches to be up to date, names
175
+ * a non-empty set of required checks covering PROTECTION_MINIMUM_CHECKS, bound to GitHub Actions (app 15368), and
176
+ * can't be bypassed by that account:
177
+ * classic protection with "Do not allow bypassing the above settings" (`enforce_admins`); an active ruleset whose
178
+ * bypass list reads whole, names no role, team or organization admin, and says this account never bypasses it. Read
179
+ * only — Toolroll never changes a repository's settings. A layer that can't be read never holds; null only when nothing
180
+ * could be read at all.
181
+ */
182
+ export declare function readMainProtection(run: Exec, gh: string, repo: string, branch?: string): Promise<MainProtection | null>;
183
+ /** Whether main's protection holds, as a yes/no (release-auto.ts sealAutoGreen): null when it can't be read. */
184
+ export declare function readUpToDateRequired(run: Exec, gh: string, repo: string, branch?: string): Promise<boolean | null>;