toolroll 0.9.117 → 0.9.119

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 (72) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +14 -14
  3. package/dist/agent-fence.js +54 -6
  4. package/dist/assignment.js +40 -29
  5. package/dist/browser/workspace.css +1 -1
  6. package/dist/browser/workspace.js +32 -31
  7. package/dist/builder.js +295 -237
  8. package/dist/central-recovery-stage.js +3 -3
  9. package/dist/check-failure.js +2 -2
  10. package/dist/check-levels.js +3 -0
  11. package/dist/check-report.js +58 -7
  12. package/dist/coding-context.js +16 -2
  13. package/dist/coding-provider.js +7 -3
  14. package/dist/coding-workspace.js +5 -5
  15. package/dist/contracts/console-api.js +4 -1
  16. package/dist/contracts/engine-api.js +1 -0
  17. package/dist/contracts/release-check.js +7 -4
  18. package/dist/contracts/release-terms.js +11 -2
  19. package/dist/contracts/verification-receipt.js +1 -1
  20. package/dist/deploy-gate.js +7 -1
  21. package/dist/direct-chat.js +3 -3
  22. package/dist/easy-start.js +8 -6
  23. package/dist/engine-reads.js +72 -0
  24. package/dist/flexible-conversation-schema.js +24 -0
  25. package/dist/flexible-conversation.js +162 -0
  26. package/dist/flexible-custody.js +3 -0
  27. package/dist/flexible-import.js +51 -0
  28. package/dist/flexible-session.js +84 -11
  29. package/dist/install-mode.js +1 -1
  30. package/dist/invoke.js +18 -6
  31. package/dist/local-landing.js +500 -0
  32. package/dist/local-owner.js +1 -0
  33. package/dist/operate.js +143 -22
  34. package/dist/passwordless.js +1 -1
  35. package/dist/planner.js +6 -1
  36. package/dist/project-delete.js +1 -0
  37. package/dist/project-skills.js +28 -13
  38. package/dist/rehearsal.js +27 -0
  39. package/dist/release-adapters.js +170 -2
  40. package/dist/release-approval.js +11 -8
  41. package/dist/release-card.js +7 -2
  42. package/dist/release-carry.js +1 -1
  43. package/dist/release-cli.js +115 -14
  44. package/dist/release-main-proof.js +49 -0
  45. package/dist/release-main.js +110 -0
  46. package/dist/release-recheck.js +10 -3
  47. package/dist/release.js +221 -33
  48. package/dist/reply-shape.js +6 -1
  49. package/dist/result-actions.js +7 -1
  50. package/dist/result-follow-ups.js +8 -4
  51. package/dist/scout.js +6 -2
  52. package/dist/serve.js +31 -14
  53. package/dist/server/direct-chat.js +88 -3
  54. package/dist/server/engine-api.js +43 -5
  55. package/dist/server/render-results.js +3 -1
  56. package/dist/server/render-tasks.js +10 -1
  57. package/dist/server/route-table.js +9 -0
  58. package/dist/server/settings.js +31 -7
  59. package/dist/server/task-views.js +15 -0
  60. package/dist/server/tasks.js +63 -3
  61. package/dist/settings-groups-ui.js +2 -2
  62. package/dist/skills-manifest.js +57 -0
  63. package/dist/store.js +29 -4
  64. package/dist/surface.js +9 -1
  65. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  66. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  67. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  68. package/dist/tui/linux-x64/toolroll-tui +0 -0
  69. package/dist/verification-evidence.js +17 -6
  70. package/dist/workspace-ui.js +1 -1
  71. package/package.json +3 -2
  72. package/scripts/release-proof.mjs +240 -0
@@ -21,7 +21,8 @@ import { existsSync, lstatSync, realpathSync } from "node:fs";
21
21
  import {} from "node:http";
22
22
  import { withActor } from "../actor.js";
23
23
  import { gateWords } from "../approval-policy.js";
24
- import { acceptAndCompleteAsOperator, assignmentOf, checkAssignmentAsOperator } from '../assignment.js';
24
+ import { acceptAndCompleteAsOperator, assignmentOf, checkAssignmentAsOperator, owedAcceptance } from '../assignment.js';
25
+ import { ACCEPT_NEEDS_REASON } from '../result-acts.js';
25
26
  import { attentionCardForUnverifiedDone, classify } from "../board.js";
26
27
  import { nightlyNeedsYou } from "../nightly-github.js";
27
28
  import { codingHandoffPreview, createCodingHandoff } from '../coding-handoff.js';
@@ -92,8 +93,9 @@ import { approvalFormDigest, approveRefusalWords, checkProgressHtml, consentDoor
92
93
  import {} from "./session.js";
93
94
  import { approveReleaseCard, releaseApprovalCard, releaseSheetHref, releaseTaskOf } from "../release-approval.js";
94
95
  import { releaseSheetPage } from "./render-release.js";
95
- import { approvalFactsNow } from "./kit.js";
96
- import { localOwnerRefusal } from "../local-owner.js";
96
+ import { approvalFactsNow, btn } from "./kit.js";
97
+ import { land, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "../local-landing.js";
98
+ import { localOwnerRefusal, withLocalAct } from "../local-owner.js";
97
99
  import { firstTaskRouted } from "../welcome-facts.js";
98
100
  import { plural } from "../design/kit.js";
99
101
  export const FIRST_TASK_DETECT_WAIT_MS = 8_000;
@@ -1086,7 +1088,20 @@ export function createTasksHandlers(runtime) {
1086
1088
  const typedNote = (body.get("note") ?? "").trim();
1087
1089
  const sentNote = withContext(body.get("context"), typedNote);
1088
1090
  if (body.get("intent") === "revise") {
1091
+ const buildNow = body.get("approve") === "1" && who.via === "cookie" && who.authority === "local-owner" && who.role === "approver";
1089
1092
  const result = requestResultChanges(store, evidenceRoot, {
1093
+ ...(buildNow ? {
1094
+ currentResult: () => {
1095
+ const task = store.externalIdFor(found.taskRef);
1096
+ const current = task === null ? null : assignmentOf(store, task, now, { principal: "operator", repos: admissionList() }, evidenceRoot);
1097
+ return current !== null && current.activeTaskId === task && current.receipt?.runId === id ? null
1098
+ : "A newer build of this task came in since this page was drawn. Open the current result, then send it back.";
1099
+ },
1100
+ approveNow: (child) => withLocalAct("approve-plan", () => {
1101
+ const filed = store.getScope(child);
1102
+ return filed !== null && !approvalOf(filed).approved && approveScope(store, child, who.name, now, filed.digest, "").ok;
1103
+ }),
1104
+ } : {}),
1090
1105
  run: id, batch: body.get("batch"), source: body.get("source"), actor: who.name,
1091
1106
  repos: admissionList(), includeUnplaced: visible(null), allowMode: who.via === "cookie",
1092
1107
  origin: who.via === "cookie" ? "person" : "machine", typedWords: who.via === "cookie" ? typedNote : null,
@@ -2102,6 +2117,11 @@ export function createTasksHandlers(runtime) {
2102
2117
  return redirect(response, withRefusal(back, "reason"));
2103
2118
  return taskScreen(response, who, taskId, ACCEPT_ANYWAY_NEEDS_REASON, 400);
2104
2119
  }
2120
+ if (note === null) {
2121
+ const current = assignmentOf(store, taskId, now, { principal: "operator", repos: admissionList() }, evidenceRoot);
2122
+ if (current?.receipt?.runId === latest.id && owedAcceptance(current.receipt, current.readiness?.blockers ?? []) === "exception")
2123
+ return taskScreen(response, who, taskId, `${ACCEPT_NEEDS_REASON}.`, 400);
2124
+ }
2105
2125
  store.acceptProof(latest.id, verifiedAuthor(who.name), note, now);
2106
2126
  return redirect(response, body.get("return") === null ? taskHref(taskId) : safeReturn(body.get("return")));
2107
2127
  }
@@ -2627,6 +2647,7 @@ export function createTasksHandlers(runtime) {
2627
2647
  "task.act.retry-review": taskAct("retry-review"),
2628
2648
  "task.act.complete": taskAct("complete"),
2629
2649
  "task.act.merge": taskMerge,
2650
+ "task.act.land": taskLand,
2630
2651
  "task.act.recheck-stopped": taskRecheckStopped,
2631
2652
  "task.act.stop": taskAct("stop"),
2632
2653
  "task.act.stop-carrying": taskAct("stop-carrying"),
@@ -2766,6 +2787,45 @@ export function createTasksHandlers(runtime) {
2766
2787
  default: return refused("Reload the page and try again.");
2767
2788
  }
2768
2789
  }
2790
+ async function taskLand(ctx) {
2791
+ const { url, who, response, posted, now } = ctx;
2792
+ const act = matchTaskPath(url.pathname, "/land$");
2793
+ if (act === null)
2794
+ return noPage(who, response);
2795
+ const body = readForm(posted, CONSOLE_FORMS.taskLand);
2796
+ if (store.isDemo())
2797
+ return taskScreen(response, who, act.taskId, "The demo lands nothing.", 403);
2798
+ const ref = store.lookupRef(act.taskId);
2799
+ if (ref === null || !visible(ref.repo) || who.via !== "cookie")
2800
+ return refuse(response, who, 404, "no such task", "/");
2801
+ if (ref.repo !== null && publishesThroughPullRequests(store, ref.repo))
2802
+ return taskScreen(response, who, act.taskId, PULL_REQUESTS_INSTEAD, 409);
2803
+ const local = who.authority === "local-owner";
2804
+ const principal = local ? null : leadPrincipal(who);
2805
+ if (!local && principal === null)
2806
+ return taskScreen(response, who, act.taskId, "Your access changed. Sign in again.", 403);
2807
+ const access = { repos: principal !== null ? principal.repos : store.knownRepos().filter(repo => store.accountCanAccess(who.name, repo)) };
2808
+ const undo = body.get("undo") === "1";
2809
+ const into = (body.get("into") ?? "").trim();
2810
+ const options = { root: evidenceRoot, ...(into === "" ? {} : { into }), ...(undo ? { undo: true } : {}) };
2811
+ const key = body.get("key") ?? "";
2812
+ if (key === "") {
2813
+ const read = await readLanding(store, act.taskId, access, now, options);
2814
+ if (!read.ok)
2815
+ return taskScreen(response, who, act.taskId, read.message, 409);
2816
+ if (!("plan" in read))
2817
+ return redirect(response, taskHref(act.taskId));
2818
+ const plan = read.plan;
2819
+ const title = undo ? "Undo landing" : `Land on ${plan.branch}`;
2820
+ return sendScreen(response, 200, screen(title, html `<h1>${title}</h1>${landingWords(plan).map(line => html `<p>${line}</p>`)}${postForm(`${taskHref(act.taskId)}/land`, html `${btn(undo ? "Undo it" : "Land it", { variant: "primary", type: "submit" })} ${btn("Cancel", { variant: "ghost", href: taskHref(act.taskId) })}`, { hidden: { key: plan.key, ...(into === "" ? {} : { into }), ...(undo ? { undo: "1" } : {}) } })}`, { chrome: chromeFor(ref.repo, "tasks") }));
2821
+ }
2822
+ const done = await land(store, act.taskId, { key, ...(into === "" ? {} : { into }), ...(undo ? { undo: true } : {}) }, principal !== null ? { kind: "person", who: principal } : { kind: "local" }, access, now, { root: evidenceRoot });
2823
+ if (!done.ok)
2824
+ return taskScreen(response, who, act.taskId, done.message, done.reason === "authority" ? 403 : 409);
2825
+ if (answersInPlace(ctx.request))
2826
+ return answerActInPlace(response, "done", `${done.kind === "undo" ? "Undone" : "Landed"} on ${done.branch} (${done.commit.slice(0, 7)}).`, 200);
2827
+ return redirect(response, taskHref(act.taskId));
2828
+ }
2769
2829
  return { registrations, workListFor, showOrder, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
2770
2830
  }
2771
2831
  export function createTidyHandlers(runtime) {
@@ -365,7 +365,7 @@ export function accessGroup(facts, flags) {
365
365
  settingsLink({ href: "/settings/sign-in", title: "Sign-in with a provider", status: facts.sso === null ? "Not set up: everyone uses a password" : `People sign in with ${facts.sso}` })
366
366
  ] : []),
367
367
  ...(facts.operator && (advancedOn(facts) || facts.passwordless === true) ? [
368
- settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: signing in is the only password" : "Off: approvals ask for your password" })
368
+ settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: approvals need no password" : "Off: approvals ask for your password" })
369
369
  ] : []),
370
370
  ...(facts.local?.canTurnOff === true ? [html `<div id="local-mode">${settingsLink({ href: "/settings/general?section=local-mode", title: "Local mode", status: "On · in General" })}</div>`] : []),
371
371
  ];
@@ -541,7 +541,7 @@ export function passwordlessHtml(view) {
541
541
  return settingsSubPage("access", "Passwordless", joinHtml([
542
542
  answer,
543
543
  settingsSection({ id: "passwordless", title: `Passwordless is ${view.on ? "on" : "off"}`, state: view.since === null ? "" : ` · ${view.since}`,
544
- lead: "When it’s on, signing in is the only password: approvals, settings, budgets, signing a mode and starting a terminal no longer ask again, in the browser, on the phone, and in this computer’s toolroll command (through its remembered login).",
544
+ lead: "When it’s on, approvals, settings, budgets, signing a mode and starting a terminal no longer ask for your password again, in the browser, on the phone, and in this computer’s toolroll command (through its remembered login). Changes that add a way in still ask: sign-in, tokens, connections, agent threads and check commands.",
545
545
  body: joinHtml([note(view.trade), control]) }),
546
546
  ]), { lead: "Sign in once; most approvals then need no password." });
547
547
  }
@@ -0,0 +1,57 @@
1
+ import { createHash } from "node:crypto";
2
+ import { closeSync, constants as fsConstants, fstatSync, lstatSync, openSync, readFileSync, realpathSync } from "node:fs";
3
+ import { dirname, isAbsolute, relative } from "node:path";
4
+ export const sha256Of = (bytes) => createHash("sha256").update(bytes).digest("hex");
5
+ export const within = (child, parent) => {
6
+ const rel = relative(parent, child);
7
+ return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
8
+ };
9
+ export function checkSkillsManifest(manifest) {
10
+ const changed = (what) => ({ ok: false, problem: `${what} changed after Toolroll prepared it` });
11
+ try {
12
+ for (const folder of manifest.folders) {
13
+ if (folder !== manifest.directory && !within(folder, manifest.directory))
14
+ return changed("A skill folder");
15
+ const held = lstatSync(folder);
16
+ if (!held.isDirectory() || held.isSymbolicLink() || realpathSync(folder) !== folder)
17
+ return changed("A skill folder");
18
+ }
19
+ for (const file of manifest.files) {
20
+ if (!within(file.path, manifest.directory) || !manifest.folders.includes(dirname(file.path)))
21
+ return changed("A skill file");
22
+ const there = lstatSync(file.path);
23
+ if (!there.isFile() || there.isSymbolicLink())
24
+ return changed("A skill file");
25
+ let fd = null;
26
+ try {
27
+ fd = openSync(file.path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK);
28
+ const held = fstatSync(fd);
29
+ if (!held.isFile() || realpathSync(file.path) !== file.path || sha256Of(readFileSync(fd)) !== file.sha256)
30
+ return changed("A skill file");
31
+ }
32
+ finally {
33
+ if (fd !== null)
34
+ closeSync(fd);
35
+ }
36
+ }
37
+ }
38
+ catch {
39
+ return { ok: false, problem: "A skill file or folder is missing or can't be read where Toolroll left it" };
40
+ }
41
+ return { ok: true, files: manifest.files.map(file => file.path) };
42
+ }
43
+ export function skillsGrant(skills) {
44
+ if (skills === null)
45
+ return { deny: [], files: [], problem: null };
46
+ const canonical = (path) => { try {
47
+ return realpathSync(path);
48
+ }
49
+ catch {
50
+ return path;
51
+ } };
52
+ const deny = [...new Set([skills.root, ...(skills.manifest === null ? [] : [dirname(skills.manifest.directory)])].flatMap(path => [path, canonical(path)]))].sort();
53
+ if (skills.manifest === null)
54
+ return { deny, files: [], problem: null };
55
+ const checked = checkSkillsManifest(skills.manifest);
56
+ return checked.ok ? { deny, files: checked.files, problem: null } : { deny, files: [], problem: checked.problem };
57
+ }
package/dist/store.js CHANGED
@@ -39,6 +39,7 @@ import { V180_SCHEMA, V180_STEPS } from "./agent-change-schema.js";
39
39
  import { V181_REQUIRED_COLUMNS, V181_SCHEMA, V181_STEPS, V181_TABLES, V182_REQUIRED_COLUMNS, V182_SCHEMA, V182_STEPS, V182_TABLES, V183_ADDED_COLUMNS, V183_STEPS, V184_ADDED_COLUMNS, V184_STEPS } from "./direct-chat-schema.js";
40
40
  import { V177_STEPS, V177_SCHEMA, V177_OBJECTS, WORKSPACE_ID_PATTERN, RECOVERY_GENERATION_PATTERN } from "./workspace-identity-schema.js";
41
41
  import { V174_OBJECTS, V174_SCHEMA, V174_STEPS } from "./flexible-everyday-schema.js";
42
+ import { V185_OBJECTS, V185_SCHEMA, V185_STEPS } from "./flexible-conversation-schema.js";
42
43
  import { endThreadAuthorityFor } from "./flexible-authority-end.js";
43
44
  import { relayCancel } from "./flexible-relay-cancel.js";
44
45
  import { endLapsedFlexible } from "./flexible.js";
@@ -845,7 +846,7 @@ export function checkSuitesOf(value) {
845
846
  }
846
847
  }
847
848
  const REGISTERED_AT_FILING = "again, as it was filed";
848
- export const SCHEMA_VERSION = 184;
849
+ export const SCHEMA_VERSION = 185;
849
850
  export const V179_STEPS = Object.freeze(["antigravity-provider"]);
850
851
  export const V118_MERGED_TABLES = Object.freeze({ api_token: "person", coordinator_credential: "coordinator", lead_credential: "lead" });
851
852
  const V118_REFERENCES = /REFERENCES (?:coordinator_credential\(cid\)|api_token\(id\))/g;
@@ -911,7 +912,7 @@ export const V115_DROPPED_TABLES = Object.freeze([
911
912
  "fallback_config", "fallback_cycle", "fallback_transition",
912
913
  ]);
913
914
  const V115_DROPPED_REFERENCES = /\s+REFERENCES (?:contestant|contest|tournament_terms|session_turn|attended_authorization|held_session|fallback_cycle|fallback_config|fallback_transition|routine|routine_fire)\(id\)(?: ON DELETE CASCADE)?/g;
914
- export const UPDATE_SAFE_MIGRATIONS = Object.freeze([108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184]);
915
+ export const UPDATE_SAFE_MIGRATIONS = Object.freeze([108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185]);
915
916
  export const V119_ADDED_COLUMNS = Object.freeze({
916
917
  task_ref: { planning_generation: { definition: "INTEGER NOT NULL DEFAULT 0", saved: "0" } },
917
918
  run: { planning_generation: { definition: "INTEGER NOT NULL DEFAULT 0", saved: "0" } },
@@ -1454,7 +1455,7 @@ export { V156_STEPS };
1454
1455
  export { V157_STEPS };
1455
1456
  export { V158_STEPS };
1456
1457
  export { V159_STEPS };
1457
- export { V160_STEPS, V161_STEPS, V162_STEPS, V163_STEPS, V164_STEPS, V165_STEPS, V166_STEPS, V167_STEPS, V168_STEPS, V169_STEPS, V170_STEPS, V171_STEPS, V172_STEPS, V173_STEPS, V174_STEPS, V175_STEPS, V176_STEPS, V177_STEPS, V178_STEPS, V180_STEPS, V181_STEPS, V182_STEPS, V183_STEPS, V184_STEPS };
1458
+ export { V160_STEPS, V161_STEPS, V162_STEPS, V163_STEPS, V164_STEPS, V165_STEPS, V166_STEPS, V167_STEPS, V168_STEPS, V169_STEPS, V170_STEPS, V171_STEPS, V172_STEPS, V173_STEPS, V174_STEPS, V175_STEPS, V176_STEPS, V177_STEPS, V178_STEPS, V180_STEPS, V181_STEPS, V182_STEPS, V183_STEPS, V184_STEPS, V185_STEPS };
1458
1459
  export const RELEASE_ONCE_SCHEMA = `
1459
1460
  CREATE TABLE IF NOT EXISTS release_authority (
1460
1461
  id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -4243,7 +4244,7 @@ function initializeStore(db, file, options = {}) {
4243
4244
  throw new Error(`${file}: ${problem}; refusing to move chat history it cannot name`);
4244
4245
  }
4245
4246
  if (preflight === SCHEMA_VERSION && !findingSourcesStale(db)) {
4246
- const missing = codeMapShapeProblem(db) ?? viewPreferenceShapeProblem(db) ?? flexibleTermsShapeProblem(db) ?? flexibleThreadShapeProblem(db) ?? typedByPersonShapeProblem(db) ?? flexibleTurnsShapeProblem(db) ?? flexibleLaunchShapeProblem(db) ?? flexibleRelayShapeProblem(db) ?? flexibleAnswersShapeProblem(db) ?? flexibleShipShapeProblem(db) ?? taskSizingShapeProblem(db) ?? agentSaidShapeProblem(db) ?? flexibleSettingShapeProblem(db) ?? flexibleSignInShapeProblem(db) ?? planProblemsShapeProblem(db) ?? flexibleEverydayShapeProblem(db) ?? flexibleInteractiveShapeProblem(db) ?? subagentBackupShapeProblem(db) ?? workspaceIdentityShapeProblem(db) ?? pendingAgentChangeShapeProblem(db) ?? directChatShapeProblem(db) ?? directChatPhase1bShapeProblem(db) ?? directChatHardeningShapeProblem(db);
4247
+ const missing = codeMapShapeProblem(db) ?? viewPreferenceShapeProblem(db) ?? flexibleTermsShapeProblem(db) ?? flexibleThreadShapeProblem(db) ?? typedByPersonShapeProblem(db) ?? flexibleTurnsShapeProblem(db) ?? flexibleLaunchShapeProblem(db) ?? flexibleRelayShapeProblem(db) ?? flexibleAnswersShapeProblem(db) ?? flexibleShipShapeProblem(db) ?? taskSizingShapeProblem(db) ?? agentSaidShapeProblem(db) ?? flexibleSettingShapeProblem(db) ?? flexibleSignInShapeProblem(db) ?? planProblemsShapeProblem(db) ?? flexibleEverydayShapeProblem(db) ?? flexibleInteractiveShapeProblem(db) ?? subagentBackupShapeProblem(db) ?? workspaceIdentityShapeProblem(db) ?? pendingAgentChangeShapeProblem(db) ?? directChatShapeProblem(db) ?? directChatPhase1bShapeProblem(db) ?? directChatHardeningShapeProblem(db) ?? flexibleConversationShapeProblem(db);
4247
4248
  if (missing !== null)
4248
4249
  throw new Error(`${file}: refusing to open — ${missing}, though the schema says v${SCHEMA_VERSION}`);
4249
4250
  db.exec("PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;");
@@ -4728,6 +4729,11 @@ CREATE INDEX IF NOT EXISTS run_checkpoint_by_task ON run_checkpoint (task_ref, i
4728
4729
  if (directChatEffortDamaged !== null)
4729
4730
  throw new Error(`${file}: refusing to open — ${directChatEffortDamaged}`);
4730
4731
  step("direct-chat-effort-usage-columns");
4732
+ db.exec(V185_SCHEMA);
4733
+ const conversationDamaged = flexibleConversationShapeProblem(db);
4734
+ if (conversationDamaged !== null)
4735
+ throw new Error(`${file}: refusing to open — ${conversationDamaged}`);
4736
+ step("flexible-conversation");
4731
4737
  if (!fresh)
4732
4738
  reclaimDatabase(db, "migration");
4733
4739
  const expectedMarker = preflight < 0 ? preflight : -preflight;
@@ -19665,3 +19671,22 @@ function directChatEffortUsageShapeProblem(db) {
19665
19671
  }
19666
19672
  return null;
19667
19673
  }
19674
+ function flexibleConversationShapeProblem(db) {
19675
+ const statements = V185_SCHEMA.split(/;\s*\n(?=CREATE )/).map(one => one.trim().replace(/;$/, "")).filter(one => one !== "");
19676
+ for (const [type, name] of V185_OBJECTS) {
19677
+ const row = db.prepare("SELECT sql FROM sqlite_master WHERE type = ? AND name = ?").get(type, name);
19678
+ if (row === undefined)
19679
+ return `the interactive agent threads ${type} ${name} is missing`;
19680
+ const want = statements.find(one => new RegExp(`^CREATE (?:UNIQUE )?${type.toUpperCase()} IF NOT EXISTS ${name}\\b`).test(one));
19681
+ if (want === undefined || canonicalDdl(String(row["sql"]).replace(/;$/, "")).trim() !== canonicalDdl(want.replace(/;$/, "")).trim())
19682
+ return `the interactive agent threads ${type} ${name} has an unknown shape`;
19683
+ }
19684
+ return null;
19685
+ }
19686
+ export function verifyCommandAt(store, repo, at) {
19687
+ const when = at.toISOString();
19688
+ const row = store.handle
19689
+ .prepare("SELECT * FROM verify_command WHERE repo = ? AND approved_at <= ? AND (revoked_at IS NULL OR revoked_at > ?) ORDER BY id DESC LIMIT 1")
19690
+ .get(repo, when, when);
19691
+ return row === undefined ? null : { ...readVerifyCommand(row), revokedAt: null, revokedBy: null };
19692
+ }
package/dist/surface.js CHANGED
@@ -309,6 +309,13 @@ const GUIDE_ROWS = [
309
309
  { name: "digest", takesValue: true, meaning: "the exact receipt from assignment show; accepts and finishes exactly that result" },
310
310
  { name: "despite", takesValue: true, meaning: "accept with this reason, without finishing; never combines with --finish or --digest (--note is its alias)" }],
311
311
  notableReasons: ["usage", "unknown-task", "no-run", "not-ready"] },
312
+ { ...operator("task land", "put accepted work on the project's own branch when it has no pull requests: bare shows exactly what lands where; --yes --key <key> lands it as a fast-forward; --undo reverts it with a new commit"),
313
+ positionals: [{ name: "id", required: true, meaning: "the task" }],
314
+ flags: [jsonFlag, dbFlag, { name: "into", takesValue: true, meaning: "land on this branch instead of the recorded one (the yes records it)" },
315
+ { name: "undo", takesValue: false, meaning: "revert the landing with a new commit on the branch" },
316
+ { name: "yes", takesValue: false, meaning: "land it; needs --key" },
317
+ { name: "key", takesValue: true, meaning: "the key the bare call showed: what lands is what you read" }],
318
+ notableReasons: ["usage", "not-complete", "checks", "dirty", "moved", "occupied", "stale"] },
312
319
  operator("task repair", "inspect or approve a repair draft; --yes starts the repair a failed check is waiting for, under the normal plan approval"),
313
320
  operatorRead("task handover", "where a task stands, from Toolroll's records: revision, decisions, rejected approaches, open findings, checks and the next action"),
314
321
  operator("task before-after", "before-and-after evidence: read it, save a failing result, or rerun the same check on the latest commit with no agent"),
@@ -492,7 +499,7 @@ const REMOTE_FOLLOW_THROUGH = [
492
499
  ];
493
500
  const REMOTE_STEP_UP = [
494
501
  "proposals", "decide", "task regate", "task approve", "task accept", "task merge", "run settle",
495
- "task archive", "task restore", "task tidy", "knowledge apply",
502
+ "task archive", "task restore", "task tidy", "task land", "knowledge apply",
496
503
  "memory decide", "memory retire", "memory apply", "memory tidy", "memory restore", "memory unmerge",
497
504
  "flows card approve", "flows card send-back", "flows script approve", "flows unattended",
498
505
  "approver list", "approver add", "people list", "people invite", "people projects", "people revoke",
@@ -541,6 +548,7 @@ const LOCAL_ALLOW = {
541
548
  "task continue": "resume-run",
542
549
  "task unhold": "resume-run",
543
550
  "task complete": "complete-task",
551
+ "task land": "land-task",
544
552
  "task plan": "request-plan",
545
553
  "task requeue": "retry-build",
546
554
  "task revise": "request-revision",
Binary file
Binary file
Binary file
Binary file
@@ -7,14 +7,17 @@ import { readVerificationReceipt } from "./contracts/verification-receipt.js";
7
7
  import { LEGACY_GATE_SOURCE, readVerificationView } from "./contracts/verification-view.js";
8
8
  import { readCandidateEndpoints, savedInventoryPaths } from "./contracts/diff-stat.js";
9
9
  import { liveQuickCommand, quickVerifyKey, runCheckLevel } from "./check-levels.js";
10
- import { CHECK_INVENTORY_CAPTURE, CHECK_REPORT_CAPTURE } from "./check-report.js";
10
+ import { CHECK_INVENTORY_CAPTURE, CHECK_REPORT_CAPTURE, readSealedJson } from "./check-report.js";
11
+ import { parseContract } from "./contracts/contract.js";
12
+ import { sealedInventorySchema } from "./contracts/release-check.js";
13
+ import { purposeCheckMode } from "./contracts/release-terms.js";
11
14
  import { provedComposition } from "./release-recheck.js";
12
- import { checkAttemptOf } from "./store.js";
15
+ import { checkAttemptOf, verifyCommandAt } from "./store.js";
13
16
  export const VERIFICATION_RECEIPT_CAPTURE = "machine verification receipt v1";
14
17
  const hash = (value) => createHash("sha256").update(JSON.stringify(value)).digest("hex");
15
18
  const binding = (a) => ({ artifactId: a.id, sha256: a.sha256, bytesStored: a.bytesStored, bytesOriginal: a.bytesOriginal, truncated: a.truncated, redacted: a.redacted, captureStatus: a.captureStatus });
16
19
  export const isVerificationReceipt = (a) => a.kind === "structured-output" && (a.capture === VERIFICATION_RECEIPT_CAPTURE || a.capture === "machine verification reuse v1");
17
- export const coveragePasses = (coverage) => coverage === undefined || coverage === "full" || coverage === "composed";
20
+ export const coveragePasses = (coverage) => coverage === undefined || coverage === "full" || coverage === "composed" || coverage === "deploy";
18
21
  export function effectiveCheckFacts(raw, facts) {
19
22
  if (facts === null || coveragePasses(facts.coverage))
20
23
  return { result: raw, facts };
@@ -41,7 +44,7 @@ export function sealVerificationReceipt(store, root, runId, head, command, resul
41
44
  const hits = scanForSecrets(raw);
42
45
  storeEvidence(store, root, runId, "structured-output", "verification-receipt.json", Buffer.from(hits.length ? redactSecretLines(raw, hits) : raw), reusedFrom === undefined ? VERIFICATION_RECEIPT_CAPTURE : "machine verification reuse v1", now, { captureStatus: "ok", redacted: hits.length > 0 });
43
46
  }
44
- export function verificationEvidence(store, root, runId) {
47
+ export function verificationEvidence(store, root, runId, asOf) {
45
48
  const fail = (problem) => ({ ok: false, problem });
46
49
  const source = store.getRun(runId);
47
50
  if (!source)
@@ -53,7 +56,8 @@ export function verificationEvidence(store, root, runId) {
53
56
  const verified = (machine?.machineVerdict ?? machine?.verdict) === "verified";
54
57
  if (!receipts.length && !verified && runCheckLevel(store, runId) === "off")
55
58
  return { ok: true, bytes: null, digest: hash(null) };
56
- const command = repo ? sealedCommandKey(root, receipts) === quickVerifyKey(repo) ? liveQuickCommand(store, repo) : store.liveVerifyCommand(repo) : null;
59
+ const commandOf = (key) => asOf === undefined ? store.liveVerifyCommand(key) : verifyCommandAt(store, key, asOf);
60
+ const command = repo ? sealedCommandKey(root, receipts) === quickVerifyKey(repo) ? asOf === undefined ? liveQuickCommand(store, repo) : commandOf(quickVerifyKey(repo)) : commandOf(repo) : null;
57
61
  if (!command && !receipts.length && !verified)
58
62
  return { ok: true, bytes: null, digest: hash(null) };
59
63
  if (!command || command.approvedAt > source.startedAt)
@@ -94,7 +98,7 @@ export function verificationEvidence(store, root, runId) {
94
98
  if (!brief || !readObservationEvidence(store, root, runId) || !reused || reused.run !== brief.sourceRun || reused.run >= runId || reused.digest !== brief.gateDigest ||
95
99
  source.baseRevision !== brief.head || source.headRevision !== brief.head || checked.executedHere !== false)
96
100
  return fail("The reused gate is not bound to an unchanged observation follow-up.");
97
- const original = verificationEvidence(store, root, reused.run);
101
+ const original = verificationEvidence(store, root, reused.run, asOf);
98
102
  if (!original.ok || !original.bytes || original.digest !== reused.digest)
99
103
  return fail("The original passing gate no longer verifies.");
100
104
  const previousRead = readVerificationView(original.bytes);
@@ -131,6 +135,13 @@ export function verificationEvidence(store, root, runId) {
131
135
  }
132
136
  if ((checked.coverage === "composed") !== (checked.composed !== undefined))
133
137
  return fail("The release check's coverage and its links disagree.");
138
+ if (checked.coverage === "deploy") {
139
+ const inventory = readSealedJson(store, root, runId, CHECK_INVENTORY_CAPTURE);
140
+ const sealed = inventory === null ? null : parseContract(sealedInventorySchema, inventory.value);
141
+ const purpose = store.getScope(store.refById(source.taskRef)?.externalId ?? "")?.releaseCheck ?? null;
142
+ if (sealed === null || !sealed.ok || sealed.value.sealed.deploy !== true || purposeCheckMode(purpose) !== "deploy")
143
+ return fail("A deploy check's receipt isn't for a release from main sealed with the deploy check.");
144
+ }
134
145
  if (!coveragePasses(checked.coverage) && checked.result.configured && checked.result.ran && checked.result.exitCode === 0)
135
146
  return fail("The release check reads as passed, but its coverage fell short.");
136
147
  if (checked.composed !== undefined) {
@@ -349,7 +349,7 @@ export function acceptWordsOf(facts) {
349
349
  const joined = parts.length <= 1 ? parts.join("") : `${parts.slice(0, -1).join(", ")} and ${parts.at(-1)}`;
350
350
  const effect = facts.action === "accept" ? "Records that you accept it. The task stays open."
351
351
  : facts.publishing === "pull-request" ? "Finishes the task. No pull request opens; you can open one from the task after."
352
- : facts.publishing === "off" ? "Finishes the task. The branch stays; publishing isn't set up."
352
+ : facts.publishing === "off" ? "Finishes the task. Then you can land it on your project's branch."
353
353
  : "Finishes the task. Nothing is published.";
354
354
  const checksGap = facts.checks !== "passed" && facts.checks !== "off";
355
355
  return { label: ready ? "Accept" : checksGap ? "Accept without checks" : "Accept anyway", ready, why: ready ? null : `${joined.charAt(0).toUpperCase()}${joined.slice(1)}.`, effect };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "toolroll",
3
- "version": "0.9.117",
4
- "description": "Your agents build. You decide. A control plane for coding agents \u2014 Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
3
+ "version": "0.9.119",
4
+ "description": "Your agents build. You decide. A control plane for coding agents — Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
5
5
  "directories": {
6
6
  "doc": "docs"
7
7
  },
@@ -124,6 +124,7 @@
124
124
  "scripts/fixtures/pilot-scenarios.mjs",
125
125
  "scripts/proof-preflight.mjs",
126
126
  "scripts/restart-certification.mjs",
127
+ "scripts/release-proof.mjs",
127
128
  "scripts/launchd-certification.mjs",
128
129
  "scripts/fixtures/restart-service.mjs",
129
130
  "THIRD_PARTY_NOTICES.md"