toolroll 0.9.81 → 0.9.83

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 (168) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/cli.js +1 -0
  3. package/dist/commit-extract.d.ts +18 -0
  4. package/dist/commit-extract.js +39 -1
  5. package/dist/converse.d.ts +12 -0
  6. package/dist/converse.js +18 -2
  7. package/dist/deploy-gate.js +8 -0
  8. package/dist/desktop-update.d.ts +1 -1
  9. package/dist/eval-gate.d.ts +51 -0
  10. package/dist/eval-gate.js +199 -0
  11. package/dist/eval-hooks.d.ts +39 -0
  12. package/dist/eval-hooks.js +477 -0
  13. package/dist/eval-oracle-main.d.ts +1 -0
  14. package/dist/eval-oracle-main.js +31 -0
  15. package/dist/eval-oracle.d.ts +60 -0
  16. package/dist/eval-oracle.js +217 -0
  17. package/dist/eval-world.d.ts +17 -0
  18. package/dist/eval-world.js +97 -0
  19. package/dist/evals.d.ts +299 -0
  20. package/dist/evals.js +964 -0
  21. package/dist/exec.js +15 -1
  22. package/dist/first-tasks-child.d.ts +1 -0
  23. package/dist/first-tasks-child.js +11 -0
  24. package/dist/flow-draft.js +4 -0
  25. package/dist/flow-sort.js +4 -0
  26. package/dist/folder-look.d.ts +107 -0
  27. package/dist/folder-look.js +302 -0
  28. package/dist/github-jobs.d.ts +25 -0
  29. package/dist/github-jobs.js +22 -0
  30. package/dist/invoke.d.ts +1 -1
  31. package/dist/invoke.js +14 -0
  32. package/dist/lead.js +4 -1
  33. package/dist/learning-child.d.ts +1 -0
  34. package/dist/learning-child.js +34 -0
  35. package/dist/learning-look.d.ts +25 -0
  36. package/dist/learning-look.js +72 -0
  37. package/dist/memory-pass.js +4 -0
  38. package/dist/nightly-check.d.ts +4 -1
  39. package/dist/nightly-check.js +5 -2
  40. package/dist/nightly-github.d.ts +316 -0
  41. package/dist/nightly-github.js +1022 -0
  42. package/dist/operate.d.ts +123 -1
  43. package/dist/operate.js +344 -29
  44. package/dist/project-identity.d.ts +37 -0
  45. package/dist/project-identity.js +106 -0
  46. package/dist/project-knowledge.d.ts +4 -4
  47. package/dist/project-tools.d.ts +4 -1
  48. package/dist/project-tools.js +7 -2
  49. package/dist/project.d.ts +4 -1
  50. package/dist/project.js +11 -4
  51. package/dist/provider.d.ts +3 -0
  52. package/dist/provider.js +9 -2
  53. package/dist/release-adapters.d.ts +21 -21
  54. package/dist/release-adapters.js +52 -19
  55. package/dist/release-auto.js +26 -0
  56. package/dist/release-card.js +3 -0
  57. package/dist/release-cli.js +59 -3
  58. package/dist/release-view.d.ts +3 -0
  59. package/dist/release-view.js +2 -0
  60. package/dist/release.d.ts +16 -0
  61. package/dist/release.js +16 -0
  62. package/dist/reported-usage.d.ts +69 -0
  63. package/dist/reported-usage.js +97 -0
  64. package/dist/repos.d.ts +7 -0
  65. package/dist/repos.js +57 -0
  66. package/dist/serve.js +35 -8
  67. package/dist/server/chat.js +4 -0
  68. package/dist/server/flows.js +9 -3
  69. package/dist/server/guards.d.ts +4 -0
  70. package/dist/server/guards.js +12 -3
  71. package/dist/server/http.d.ts +11 -0
  72. package/dist/server/http.js +3 -0
  73. package/dist/server/pages.js +62 -88
  74. package/dist/server/render-pages.d.ts +2 -16
  75. package/dist/server/render-pages.js +1 -55
  76. package/dist/server/render-tasks.js +1 -0
  77. package/dist/server/runtime.d.ts +4 -0
  78. package/dist/server/runtime.js +1 -0
  79. package/dist/server/settings.js +14 -3
  80. package/dist/server/tasks.js +15 -4
  81. package/dist/store.d.ts +109 -1
  82. package/dist/store.js +394 -4
  83. package/dist/subagents.js +4 -0
  84. package/dist/subscription-chat.d.ts +2 -0
  85. package/dist/subscription-chat.js +52 -13
  86. package/dist/task-sizing.js +4 -0
  87. package/dist/teardown-git.d.ts +9 -2
  88. package/dist/teardown-git.js +56 -33
  89. package/dist/up-processes.d.ts +13 -0
  90. package/dist/up-processes.js +6 -2
  91. package/evals/cases/catalog/case.json +25 -0
  92. package/evals/cases/catalog/fixture/README.md +3 -0
  93. package/evals/cases/catalog/fixture/package.json +8 -0
  94. package/evals/cases/catalog/fixture/test/catalog.test.mjs +4 -0
  95. package/evals/cases/catalog/oracle.mjs +23 -0
  96. package/evals/cases/catalog/probe.mjs +10 -0
  97. package/evals/cases/catalog/source.md +9 -0
  98. package/evals/cases/csv-quoting/case.json +23 -0
  99. package/evals/cases/csv-quoting/fixture/README.md +3 -0
  100. package/evals/cases/csv-quoting/fixture/csv.js +1 -0
  101. package/evals/cases/csv-quoting/fixture/package.json +8 -0
  102. package/evals/cases/csv-quoting/fixture/test/csv.test.mjs +5 -0
  103. package/evals/cases/csv-quoting/oracle.mjs +14 -0
  104. package/evals/cases/csv-quoting/probe.mjs +9 -0
  105. package/evals/cases/csv-quoting/source.md +9 -0
  106. package/evals/cases/dedupe/case.json +23 -0
  107. package/evals/cases/dedupe/fixture/README.md +3 -0
  108. package/evals/cases/dedupe/fixture/dedupe.js +1 -0
  109. package/evals/cases/dedupe/fixture/package.json +8 -0
  110. package/evals/cases/dedupe/fixture/test/dedupe.test.mjs +5 -0
  111. package/evals/cases/dedupe/oracle.mjs +16 -0
  112. package/evals/cases/dedupe/probe.mjs +13 -0
  113. package/evals/cases/dedupe/source.md +9 -0
  114. package/evals/cases/endpoint/case.json +25 -0
  115. package/evals/cases/endpoint/fixture/README.md +3 -0
  116. package/evals/cases/endpoint/fixture/package.json +8 -0
  117. package/evals/cases/endpoint/fixture/test/endpoint.test.mjs +4 -0
  118. package/evals/cases/endpoint/oracle.mjs +27 -0
  119. package/evals/cases/endpoint/probe.mjs +10 -0
  120. package/evals/cases/endpoint/source.md +11 -0
  121. package/evals/cases/math-divide/case.json +23 -0
  122. package/evals/cases/math-divide/fixture/README.md +3 -0
  123. package/evals/cases/math-divide/fixture/package.json +8 -0
  124. package/evals/cases/math-divide/fixture/src/math.js +1 -0
  125. package/evals/cases/math-divide/fixture/test/math.test.js +5 -0
  126. package/evals/cases/math-divide/oracle.mjs +13 -0
  127. package/evals/cases/math-divide/probe.mjs +9 -0
  128. package/evals/cases/math-divide/source.md +9 -0
  129. package/evals/cases/math-multiply/case.json +23 -0
  130. package/evals/cases/math-multiply/fixture/README.md +3 -0
  131. package/evals/cases/math-multiply/fixture/package.json +8 -0
  132. package/evals/cases/math-multiply/fixture/src/math.js +2 -0
  133. package/evals/cases/math-multiply/fixture/test/math.test.js +5 -0
  134. package/evals/cases/math-multiply/oracle.mjs +12 -0
  135. package/evals/cases/math-multiply/probe.mjs +9 -0
  136. package/evals/cases/math-multiply/source.md +9 -0
  137. package/evals/cases/math-subtract/case.json +23 -0
  138. package/evals/cases/math-subtract/fixture/README.md +3 -0
  139. package/evals/cases/math-subtract/fixture/package.json +8 -0
  140. package/evals/cases/math-subtract/fixture/src/math.js +1 -0
  141. package/evals/cases/math-subtract/fixture/test/math.test.js +5 -0
  142. package/evals/cases/math-subtract/oracle.mjs +12 -0
  143. package/evals/cases/math-subtract/probe.mjs +9 -0
  144. package/evals/cases/math-subtract/source.md +9 -0
  145. package/evals/cases/merge-config/case.json +23 -0
  146. package/evals/cases/merge-config/fixture/README.md +3 -0
  147. package/evals/cases/merge-config/fixture/config.js +1 -0
  148. package/evals/cases/merge-config/fixture/package.json +8 -0
  149. package/evals/cases/merge-config/fixture/test/config.test.mjs +5 -0
  150. package/evals/cases/merge-config/oracle.mjs +28 -0
  151. package/evals/cases/merge-config/probe.mjs +15 -0
  152. package/evals/cases/merge-config/source.md +9 -0
  153. package/evals/cases/paginate/case.json +23 -0
  154. package/evals/cases/paginate/fixture/README.md +3 -0
  155. package/evals/cases/paginate/fixture/package.json +8 -0
  156. package/evals/cases/paginate/fixture/paginate.js +1 -0
  157. package/evals/cases/paginate/fixture/test/paginate.test.mjs +5 -0
  158. package/evals/cases/paginate/oracle.mjs +18 -0
  159. package/evals/cases/paginate/probe.mjs +13 -0
  160. package/evals/cases/paginate/source.md +9 -0
  161. package/evals/cases/round2-asks/case.json +24 -0
  162. package/evals/cases/round2-asks/fixture/README.md +3 -0
  163. package/evals/cases/round2-asks/fixture/package.json +8 -0
  164. package/evals/cases/round2-asks/fixture/src/math.js +1 -0
  165. package/evals/cases/round2-asks/fixture/test/math.test.js +5 -0
  166. package/evals/cases/round2-asks/source.md +11 -0
  167. package/evals/manifest.json +15 -0
  168. package/package.json +2 -1
@@ -20,6 +20,7 @@ import { withActor } from "../actor.js";
20
20
  import { gateWords } from "../approval-policy.js";
21
21
  import { acceptAndCompleteAsOperator, assignmentOf, checkAssignmentAsOperator } from '../assignment.js';
22
22
  import { attentionCardForUnverifiedDone, classify } from "../board.js";
23
+ import { nightlyNeedsYou } from "../nightly-github.js";
23
24
  import { codingHandoffPreview, createCodingHandoff } from '../coding-handoff.js';
24
25
  import { codingShippingHtml } from '../coding-shipping-ui.js';
25
26
  import { codingWorkspaceHtml, codingWorkspaceScript } from '../coding-ui.js';
@@ -71,7 +72,7 @@ import { ACCEPT_ANYWAY_NEEDS_REASON, editorFileHref, proofBundleView, rankReview
71
72
  import { approvalFormDigest, approveRefusalWords, checkProgressHtml, consentDoorOf, decisionPage, nonceHashOf, PermissionsWouldChange, requirementsFromEditor, resumeDigestOf, taskOf } from "./render-tasks.js";
72
73
  import {} from "./session.js";
73
74
  export function createTasksHandlers(runtime) {
74
- const { store, peekSay, peekCache, PEEK_CACHE_TTL_MS, peekInFlight, PEEK_GLOBAL_INFLIGHT, peekBySession, PEEK_SESSION_INFLIGHT, clock, peekName, PEEK_FRAGMENT_BYTES, peekEvict, evidenceRoot, sendScreen, chromeFor, visible, consumeApprovalNonce, authenticateApprover, options, mintApprovalNonce, taskScreen, unscopedMode, admissionList, planViewOf, revisionViewOf, runIsTaskResult, leadPrincipal, familyOf, armTaskResume, runIsLive, revisionLedgerOf, resultDetailOf, reviewFactsFor, taskRepoOf, runVisible, restricted, codingActorAllowed, codingProjectAllowed, managedRepos, routeViewOf, workAccess, firstRunStepsNow, revisionDocOf, failureOf, dockedConversation, planContractViewOf, familiesInView, explainAttempt, taskChatFocus, familyTasksInView, liveCeiling, projectOf, ceiling, bustBadge, revisionDestination } = runtime;
75
+ const { identities, store, peekSay, peekCache, PEEK_CACHE_TTL_MS, peekInFlight, PEEK_GLOBAL_INFLIGHT, peekBySession, PEEK_SESSION_INFLIGHT, clock, peekName, PEEK_FRAGMENT_BYTES, peekEvict, evidenceRoot, sendScreen, chromeFor, visible, consumeApprovalNonce, authenticateApprover, options, mintApprovalNonce, taskScreen, unscopedMode, admissionList, planViewOf, revisionViewOf, runIsTaskResult, leadPrincipal, familyOf, armTaskResume, runIsLive, revisionLedgerOf, resultDetailOf, reviewFactsFor, taskRepoOf, runVisible, restricted, codingActorAllowed, codingProjectAllowed, managedRepos, routeViewOf, workAccess, firstRunStepsNow, revisionDocOf, failureOf, dockedConversation, planContractViewOf, familiesInView, explainAttempt, taskChatFocus, familyTasksInView, liveCeiling, projectOf, ceiling, bustBadge, revisionDestination } = runtime;
75
76
  /** A row admitted the address but its path parameter does not parse: the console's unknown page. */
76
77
  function noPage(who, response) {
77
78
  return refuse(response, who, 404, "There's no page at this address.", "/chat");
@@ -414,7 +415,13 @@ export function createTasksHandlers(runtime) {
414
415
  repairChain,
415
416
  });
416
417
  });
417
- const laneCards = [...cards, ...unverifiedCards];
418
+ // Project-level Needs you (evals-nightly.md, part A3): GitHub's nightly lane failures and the plane's own nightly
419
+ // check of main, for the projects this board shows.
420
+ const nightlyCards = nightlyNeedsYou(store, repo => visible(repo) && (all || project === null || repo === project)).map(need => ({
421
+ lane: "attention", taskId: need.key, title: need.title, repo: need.repo, reason: need.reason, href: need.href, claim: null,
422
+ stalledSince: need.since, attempt: null, overdue: false, priority: 0, assignedRunner: null,
423
+ }));
424
+ const laneCards = [...cards, ...unverifiedCards, ...nightlyCards];
418
425
  // The worker strip: the workers this board's work can go to — bound to
419
426
  // this project, or (rolled up) to any project the ceiling admits.
420
427
  const workers = boardWorkers(store.listRunners(), { all, project, visible });
@@ -1015,8 +1022,12 @@ export function createTasksHandlers(runtime) {
1015
1022
  let admitted = unscopedMode ? null : admissionList() ?? [];
1016
1023
  const rootMode = !unscopedMode && ceiling.roots.length > 0;
1017
1024
  if (rootMode && effective !== "") {
1018
- const canonical = (await authorizedProject(liveCeiling(), effective)) ? canonicalProject(effective) : null;
1019
- if (canonical === null || canonical === undefined) {
1025
+ // Resolved off the console's thread (project-identity.ts), then proved against the ceiling as that identity.
1026
+ const resolved = await identities.resolveNow(effective);
1027
+ if (resolved === "no-answer")
1028
+ return newTaskScreen(ctx, 503, `${effective} didn't answer — its folder may be on a drive that's disconnected, or waiting on macOS; try again in a moment`, draft);
1029
+ const canonical = resolved !== null && (await authorizedProject(liveCeiling(), resolved)) ? resolved : null;
1030
+ if (canonical === null) {
1020
1031
  return newTaskScreen(ctx, 403, `${effective} is outside what this server was configured to show`, draft);
1021
1032
  }
1022
1033
  repo = canonical;
package/dist/store.d.ts CHANGED
@@ -37,6 +37,7 @@ import { type RetentionKind, type RetentionPeriods } from "./retention.js";
37
37
  import { type CheckoutCleanup } from "./storage.js";
38
38
  import { type LedgerChainReport } from "./ledger-chain.js";
39
39
  import { type ApprovalGate, type ApprovalRules, type ApproverKind, type Filer } from "./approval-policy.js";
40
+ import { type ReportedAmount } from "./reported-usage.js";
40
41
  /** A lead reply stopped at its deadline, in the thread as plain words: what happened, what it means, one next step. The
41
42
  * proposals it made before then are kept; the cost line only when an unknown cost paused chat. */
42
43
  export declare function leadTimeoutNotice(keptProposals: boolean, unknownCost?: boolean): string;
@@ -110,6 +111,34 @@ export declare const RUN_LIVE_DETAIL_SCHEMA = "\nCREATE TABLE IF NOT EXISTS run_
110
111
  * tables only. A lifecycle row's `holder` binds it to one registration (a worker's registered_at) or one console
111
112
  * process; a row whose holder no longer matches says nothing. Timelines are bounded and pruned as they are written. */
112
113
  export declare const V137_SCHEMA = "\nCREATE TABLE IF NOT EXISTS service_lifecycle (\n component TEXT PRIMARY KEY,\n state TEXT NOT NULL CHECK (state IN ('started','draining','stopped')),\n holder TEXT NOT NULL,\n pid INTEGER,\n changed_at TEXT NOT NULL,\n beat_at TEXT NOT NULL,\n drain_until TEXT\n);\nCREATE TABLE IF NOT EXISTS latency_timeline (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n kind TEXT NOT NULL CHECK (kind IN ('console','release-check','deploy')),\n subject TEXT NOT NULL,\n task_id TEXT,\n run_id INTEGER,\n started_at TEXT NOT NULL,\n total_ms INTEGER NOT NULL,\n milestones_json TEXT NOT NULL\n);\nCREATE INDEX IF NOT EXISTS latency_timeline_by_kind ON latency_timeline (kind, id);\nCREATE INDEX IF NOT EXISTS latency_timeline_by_run ON latency_timeline (run_id) WHERE run_id IS NOT NULL;\nCREATE INDEX IF NOT EXISTS latency_timeline_by_task ON latency_timeline (task_id) WHERE task_id IS NOT NULL;\nCREATE TABLE IF NOT EXISTS live_backup (\n id INTEGER PRIMARY KEY CHECK (id = 1),\n enabled INTEGER NOT NULL DEFAULT 1,\n every_minutes INTEGER NOT NULL DEFAULT 5,\n keep INTEGER NOT NULL DEFAULT 24,\n folder TEXT,\n holder TEXT,\n held_until TEXT,\n latest_file TEXT,\n latest_sha256 TEXT,\n latest_at TEXT,\n latest_schema INTEGER,\n latest_bytes INTEGER,\n tried_at TEXT,\n problem TEXT\n);\n";
114
+ /** v139 (docs/plans/evals-nightly.md, part A): GitHub's nightly as release debt. New tables only. `nightly_lane` keeps
115
+ * one stable id per required check (its workflow file and name when it was seeded); `nightly_lane_alias` a person's
116
+ * rename of one. `github_nightly_cursor` is how far listing has got, `github_nightly_watch` every counted run still
117
+ * read again for new attempts. `nightly_lane_job` records each completed lane job once; `nightly_lane_failure` each
118
+ * test failure, open until a later counted nightly run passes that lane (or a person retires it). `nightly_exemption`
119
+ * is one release candidate's own pull-request job that passed a lane after its failure. Each lane job and failure keeps
120
+ * its run's creation time: only a run created later clears a failure. Kept apart from
121
+ * `main_check_failure`, whose `run` is a Toolroll run. */
122
+ export declare const V139_SCHEMA = "\nCREATE TABLE IF NOT EXISTS nightly_lane (\n repo TEXT NOT NULL,\n lane_id TEXT NOT NULL,\n workflow TEXT NOT NULL,\n display_name TEXT NOT NULL,\n seeded_at TEXT NOT NULL,\n retired_at TEXT,\n retired_by TEXT,\n retired_proof TEXT,\n PRIMARY KEY (repo, lane_id)\n);\nCREATE TABLE IF NOT EXISTS nightly_lane_alias (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n repo TEXT NOT NULL,\n lane_id TEXT NOT NULL,\n name TEXT NOT NULL,\n by TEXT NOT NULL,\n proof TEXT NOT NULL,\n at TEXT NOT NULL\n);\nCREATE INDEX IF NOT EXISTS nightly_lane_alias_by_name ON nightly_lane_alias (repo, name, id);\nCREATE TABLE IF NOT EXISTS github_nightly_cursor (\n repo TEXT PRIMARY KEY,\n page_cursor TEXT NOT NULL,\n last_ok_at TEXT,\n last_why TEXT,\n last_tried_at TEXT\n);\nCREATE TABLE IF NOT EXISTS github_nightly_watch (\n repo TEXT NOT NULL,\n gh_run INTEGER NOT NULL,\n created_at TEXT NOT NULL,\n attempts_read INTEGER NOT NULL DEFAULT 0 CHECK (attempts_read >= 0),\n finished INTEGER NOT NULL DEFAULT 0 CHECK (finished IN (0, 1)),\n last_checked_at TEXT,\n PRIMARY KEY (repo, gh_run)\n);\nCREATE TABLE IF NOT EXISTS nightly_lane_job (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n repo TEXT NOT NULL,\n lane_id TEXT NOT NULL,\n gh_run INTEGER NOT NULL,\n run_created_at TEXT NOT NULL,\n attempt INTEGER NOT NULL,\n job_id INTEGER NOT NULL,\n sha TEXT NOT NULL,\n started_at TEXT,\n completed_at TEXT,\n conclusion TEXT,\n cause TEXT NOT NULL CHECK (cause IN ('passed','test-failure','runner-failure','not-run')),\n read_at TEXT NOT NULL,\n UNIQUE (repo, gh_run, attempt, job_id)\n);\nCREATE INDEX IF NOT EXISTS nightly_lane_job_passes ON nightly_lane_job (repo, lane_id, started_at) WHERE cause = 'passed';\nCREATE TABLE IF NOT EXISTS nightly_lane_failure (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n repo TEXT NOT NULL,\n lane_id TEXT NOT NULL,\n gh_run INTEGER NOT NULL,\n run_created_at TEXT NOT NULL,\n attempt INTEGER NOT NULL,\n job_id INTEGER NOT NULL,\n sha TEXT NOT NULL,\n completed_at TEXT NOT NULL,\n opened_at TEXT NOT NULL,\n cleared_at TEXT,\n cleared_by_job TEXT,\n closed_why TEXT,\n UNIQUE (repo, gh_run, attempt, job_id)\n);\nCREATE INDEX IF NOT EXISTS nightly_lane_failure_open ON nightly_lane_failure (repo, id) WHERE cleared_at IS NULL;\nCREATE TABLE IF NOT EXISTS nightly_exemption (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n task TEXT NOT NULL,\n candidate TEXT NOT NULL,\n failure_id INTEGER NOT NULL REFERENCES nightly_lane_failure(id),\n pr INTEGER NOT NULL,\n gh_run INTEGER NOT NULL,\n attempt INTEGER NOT NULL,\n job_id INTEGER NOT NULL,\n started_at TEXT NOT NULL,\n completed_at TEXT NOT NULL,\n read_at TEXT NOT NULL,\n UNIQUE (task, candidate, failure_id)\n);\n";
123
+ /** v141 (docs/plans/evals-nightly.md, part C): the eval set's own records, written only by the installed plane's eval
124
+ * module (evals.ts). `eval_campaign` is one campaign (an eval set run or a reviewer run), sealed at admission, with the
125
+ * runner that owns it (so an interrupted one can be recovered); one canonical campaign runs at a time (settlement
126
+ * order). `eval_attempt` is one attempt of one case (unique per campaign, case, number and what it replaces: 0 for an
127
+ * original) and what it spent; `eval_invocation` each provider dispatch its world made, with what it was billed as
128
+ * (API dollars, subscription usage or unknown, never added together) and the model it reported. `eval_baseline_pin` and
129
+ * `eval_debt` are C2's (the owner's pinned baseline and regressed cases). New tables only; the columns are
130
+ * V141_ADDED_COLUMNS. No money limit (the owner, 2026-10-30): spending is recorded, not capped. */
131
+ export declare const V141_SCHEMA = "\nCREATE TABLE IF NOT EXISTS eval_campaign (\n id TEXT PRIMARY KEY,\n kind TEXT NOT NULL DEFAULT 'eval' CHECK (kind IN ('eval','reviewer')),\n canonical INTEGER NOT NULL CHECK (canonical IN (0, 1)),\n manifest_digest TEXT NOT NULL,\n build_digest TEXT NOT NULL,\n version TEXT NOT NULL,\n baseline_campaign TEXT,\n k INTEGER NOT NULL CHECK (k >= 1),\n sealed_json TEXT NOT NULL,\n started_by TEXT NOT NULL,\n started_proof TEXT NOT NULL,\n runner_host TEXT NOT NULL,\n runner_pid INTEGER NOT NULL,\n runner_started TEXT,\n admitted_at TEXT NOT NULL,\n finished_at TEXT,\n state TEXT NOT NULL CHECK (state IN ('running','complete','incomplete')),\n why TEXT,\n spending_unknown INTEGER NOT NULL DEFAULT 0 CHECK (spending_unknown IN (0, 1)),\n settled_at TEXT\n);\nCREATE UNIQUE INDEX IF NOT EXISTS eval_campaign_one_canonical ON eval_campaign (canonical) WHERE state = 'running' AND canonical = 1;\nCREATE TABLE IF NOT EXISTS eval_attempt (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n campaign TEXT NOT NULL REFERENCES eval_campaign(id),\n case_id TEXT NOT NULL,\n case_version TEXT NOT NULL,\n n INTEGER NOT NULL CHECK (n >= 1),\n replaces INTEGER NOT NULL DEFAULT 0,\n outcome TEXT CHECK (outcome IN ('pass','fail','error','unevaluated')),\n error_why TEXT,\n model_pinned TEXT NOT NULL,\n model_reported TEXT,\n dispatches INTEGER,\n api_microusd INTEGER,\n subscription_microusd INTEGER,\n usage_unknown INTEGER NOT NULL DEFAULT 0 CHECK (usage_unknown IN (0, 1)),\n turns INTEGER,\n tokens_in INTEGER,\n cache_read INTEGER,\n cache_write INTEGER,\n tokens_out INTEGER,\n tool_calls INTEGER,\n wall_ms INTEGER,\n world_dir TEXT,\n world_pgid INTEGER,\n world_processes_json TEXT,\n started_at TEXT NOT NULL,\n finished_at TEXT,\n UNIQUE (campaign, case_id, n, replaces)\n);\nCREATE TABLE IF NOT EXISTS eval_invocation (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n attempt INTEGER NOT NULL REFERENCES eval_attempt(id),\n kind TEXT NOT NULL,\n world_ref TEXT NOT NULL,\n recorded INTEGER NOT NULL CHECK (recorded IN (0, 1)),\n amount TEXT NOT NULL CHECK (amount IN ('api','subscription','unknown')),\n api_microusd INTEGER CHECK (api_microusd IS NULL OR api_microusd >= 0),\n subscription_microusd INTEGER CHECK (subscription_microusd IS NULL OR subscription_microusd >= 0),\n model_reported TEXT,\n UNIQUE (attempt, world_ref)\n);\nCREATE TABLE IF NOT EXISTS eval_baseline_pin (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n campaign TEXT NOT NULL REFERENCES eval_campaign(id),\n by TEXT NOT NULL,\n proof TEXT NOT NULL,\n at TEXT NOT NULL,\n accepted_worse_json TEXT\n);\nCREATE TABLE IF NOT EXISTS eval_debt (\n id INTEGER PRIMARY KEY AUTOINCREMENT,\n case_id TEXT NOT NULL,\n case_version TEXT NOT NULL,\n campaign TEXT NOT NULL REFERENCES eval_campaign(id),\n baseline_campaign TEXT NOT NULL,\n opened_at TEXT NOT NULL,\n cleared_at TEXT,\n cleared_by_campaign TEXT,\n waived_by TEXT,\n waived_proof TEXT,\n waived_why TEXT\n);\n";
132
+ /** v141 (evals-nightly.md, Codex round 1 #4 and #10): how a run's billing was known — `evidence` (its own events, the
133
+ * key it was given, or its agent's admission) or `default` (this computer's usual billing, a guess) — and how a chat
134
+ * request was billed, as its own events said (null: they didn't). A guess or a silence is unknown money, never
135
+ * subscription usage. Saved rows read NULL: unknown. `run.cost_unknown` (PR #263 review): set once any turn of the run
136
+ * ended without its provider reporting a cost, and never cleared (recordRunCostUnknown); saved rows read 0, and their
137
+ * money is unknown all the same through their NULL billing basis. */
138
+ export declare const V141_ADDED_COLUMNS: Readonly<Record<string, Readonly<Record<string, {
139
+ definition: string;
140
+ saved: string;
141
+ }>>>>;
113
142
  /** A project's "Show commands in the live view" (live-detail.ts): absent means off. */
114
143
  export declare const LIVE_DETAIL_SCHEMA = "\nCREATE TABLE IF NOT EXISTS live_detail_setting (\n repo TEXT PRIMARY KEY,\n commands INTEGER NOT NULL CHECK (commands IN (0,1)),\n updated_by TEXT NOT NULL,\n updated_at TEXT NOT NULL\n);\n-- Every run a steering note reached, kept as it happens (live-notes.ts): a\n-- note's own attached/mailed fields move to the next attempt, this does not.\nCREATE TABLE IF NOT EXISTS steer_note_run (\n note INTEGER NOT NULL REFERENCES task_steer(id) ON DELETE CASCADE,\n run INTEGER NOT NULL REFERENCES run(id) ON DELETE CASCADE,\n how TEXT NOT NULL CHECK (how IN ('attached','mailed','read')),\n at TEXT NOT NULL,\n PRIMARY KEY (note, run, how)\n);\nCREATE INDEX IF NOT EXISTS steer_note_run_by_run ON steer_note_run (run, note);\n";
115
144
  export declare const CHAT_APPROVAL_SCHEMA = "\nCREATE TABLE IF NOT EXISTS chat_approval_setting (\n approver TEXT NOT NULL,\n scope TEXT NOT NULL,\n enabled INTEGER NOT NULL CHECK (enabled IN (0,1)),\n full_access INTEGER NOT NULL DEFAULT 0 CHECK (full_access IN (0,1)),\n attempt_cap_microusd INTEGER CHECK (attempt_cap_microusd IS NULL OR attempt_cap_microusd >= 0),\n generation INTEGER NOT NULL,\n digest TEXT NOT NULL,\n updated_by TEXT NOT NULL,\n updated_at TEXT NOT NULL,\n PRIMARY KEY (approver, scope)\n);\n";
@@ -190,7 +219,7 @@ export type SealedLedgerEntry = LedgerEntry & {
190
219
  hash: string;
191
220
  } | null;
192
221
  };
193
- export declare const SCHEMA_VERSION = 138;
222
+ export declare const SCHEMA_VERSION = 141;
194
223
  /** v118: the tables merged into `credential`, in the order they move (a person's API tokens keep their ids first). */
195
224
  export declare const V118_MERGED_TABLES: Readonly<Record<string, CredentialKind>>;
196
225
  /**
@@ -341,6 +370,12 @@ export declare const V138_ADDED_COLUMNS: Readonly<Record<string, Readonly<Record
341
370
  definition: string;
342
371
  saved: string;
343
372
  }>>>>;
373
+ /** v140 (docs/plans/evals-nightly.md, B1): what the provider itself reported. Recorded from now on; a saved row reads
374
+ * NULL (not reported), never 0. A chat request's cache tokens are v129's columns. */
375
+ export declare const V140_ADDED_COLUMNS: Readonly<Record<string, Readonly<Record<string, {
376
+ definition: string;
377
+ saved: string;
378
+ }>>>>;
344
379
  /**
345
380
  * v135: one approval per release (docs/plans/release-once.md). `release_authority` is the single source of truth for a
346
381
  * release a person approved: one row per generation, changed only by compare-and-swap on `rev`, with a lease whose
@@ -1264,6 +1299,8 @@ export type Run = {
1264
1299
  costUsd: number | null;
1265
1300
  /** v129: the agent's turns where its provider reports them (Claude's num_turns); null when unknown. */
1266
1301
  agentTurns?: number | null;
1302
+ /** v140: the exact model the provider itself reported (reported-usage.ts; several joined by " + "); null when unknown. */
1303
+ modelReported?: string | null;
1267
1304
  /** HEAD after the agent, as accepted — what a publication may push. */
1268
1305
  headRevision: string | null;
1269
1306
  /** The validated terminal handoff's conclusion. */
@@ -4171,6 +4208,13 @@ export declare class Store {
4171
4208
  /** v129: the request's cache read and write tokens, where its provider reports them (unknown stays NULL). */
4172
4209
  cacheReadTokens?: number | null;
4173
4210
  cacheWriteTokens?: number | null;
4211
+ /** v140: what the provider itself reported for this request — its exact model, its own turn count and its
4212
+ * reported cost in dollars (a subscription's is usage, not billed). Absent or null: not reported. */
4213
+ modelReported?: string | null;
4214
+ providerTurns?: number | null;
4215
+ reportedCostUsd?: number | null;
4216
+ /** v141: how the request's own events said it was billed (a subscription harness); absent or null: unknown. */
4217
+ billingReported?: "subscription" | "api-key" | null;
4174
4218
  }, now: Date): boolean;
4175
4219
  /**
4176
4220
  * The crash sweep: turns past their deadline become failed('crashed'),
@@ -7913,3 +7957,67 @@ export declare function recordLiveBackup(store: Store, outcome: {
7913
7957
  ok: false;
7914
7958
  problem: string;
7915
7959
  }, now: Date): void;
7960
+ /** GitHub's nightly lane debt at a release's deploy or merge reservation and at its start (docs/plans/evals-nightly.md,
7961
+ * part A2): the stored open failures less this exact task and candidate's fresh exemptions, read inside the caller's
7962
+ * transaction (nightly-github.ts nightlyDebtHold). Null when nothing holds. */
7963
+ export declare function releaseNightlyProblem(store: Store, input: {
7964
+ repo: string;
7965
+ taskId: string;
7966
+ candidate: string;
7967
+ kind: "deploy" | "merge";
7968
+ now: Date;
7969
+ }): string | null;
7970
+ /** v140 (docs/plans/evals-nightly.md, B1): the exact model a run's provider itself reported, written once its turn's
7971
+ * envelope is read. A resumed turn that adds to the run's usage adds its model too: unknown if either turn's is, the
7972
+ * model when they agree, every model named when they differ (reported-usage.ts combineReportedModels). */
7973
+ export declare function recordRunModelReported(store: Store, runId: number, model: string | null, accumulate: boolean): void;
7974
+ /** A run's accounting as recorded (the eval collector's read, docs/plans/evals-nightly.md part B): what its provider
7975
+ * reported, its tokens normalized with their cache split (run-efficiency.ts usageOf), and its amount kept as API
7976
+ * dollars, subscription usage or unknown (reported-usage.ts runAmountOf). Null when there is no such run. */
7977
+ export declare function runAccounting(store: Store, runId: number): {
7978
+ provider: string;
7979
+ model: string | null;
7980
+ modelReported: string | null;
7981
+ agentTurns: number | null;
7982
+ usage: {
7983
+ in: number | null;
7984
+ out: number | null;
7985
+ cacheRead: number | null;
7986
+ cacheWrite: number | null;
7987
+ };
7988
+ amount: ReportedAmount;
7989
+ } | null;
7990
+ /** A chat request's accounting as recorded (lead steps and fleet chat turns): what its provider reported and its
7991
+ * amount kept as API dollars, subscription usage or unknown (reported-usage.ts chatTurnAmountOf). Null when absent. */
7992
+ export declare function chatTurnAccounting(store: Store, id: number): {
7993
+ provider: string;
7994
+ model: string;
7995
+ modelReported: string | null;
7996
+ providerTurns: number | null;
7997
+ reportedCostUsd: number | null;
7998
+ tokensIn: number | null;
7999
+ tokensOut: number | null;
8000
+ cacheReadTokens: number | null;
8001
+ cacheWriteTokens: number | null;
8002
+ amount: ReportedAmount;
8003
+ } | null;
8004
+ /** v141 (evals-nightly.md, Codex round 1 #4): how a run's billing was known, beside the billing invoke.ts fixed —
8005
+ * `evidence` (its own events, the key it was given, its agent's admission) or `default` (this computer's usual billing,
8006
+ * a guess). Once any turn of the run was a guess the run's money stays unknown. */
8007
+ export declare function recordRunBillingBasis(store: Store, runId: number, basis: "evidence" | "default"): void;
8008
+ /** v141 (PR #263 review): a run whose provider didn't report what a turn cost is unknown money for good. Set when a
8009
+ * turn's cost is unknown, never cleared: a later turn (a review resume) that reports its own cost, and recordUsage's
8010
+ * COALESCE over the usage note, can't make the run's spending read as measured again. */
8011
+ export declare function recordRunCostUnknown(store: Store, runId: number, unknown: boolean): void;
8012
+ /** PR #263 security scan: the Store methods eval accounting pins by body (eval-hooks.ts PINNED_STORE_METHODS) made
8013
+ * unwritable and unconfigurable on the prototype, from the class's own first static block, so no code runs between the
8014
+ * class's definition and the seal. Each must still be the class's own plain method (a writable, configurable function),
8015
+ * or loading refuses. The four references are recorded once, in a frozen module-private map, through the built-ins this
8016
+ * module captured as it loaded; a second seal refuses. */
8017
+ export declare function sealStoreMoneyMethods(prototype: object): void;
8018
+ /** PR #263 security scan: each Store instance holds the sealed money methods as its own unwritable, unconfigurable
8019
+ * properties (the constructor's last step), so shadowing one on an instance, by any means, throws. It uses only the
8020
+ * built-ins captured as this module loaded, refuses when the globals were replaced since, and installs a method only
8021
+ * when the prototype's value is the very reference recorded at the seal. `prototype` is Store's own unless a test
8022
+ * says otherwise; either way nothing but the recorded references is ever installed. */
8023
+ export declare function lockStoreMoneyMethods(store: object, prototype?: object): void;