toolroll 0.9.118 → 0.9.120

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 (75) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/README.md +22 -22
  3. package/dist/assignment.js +43 -30
  4. package/dist/browser/workspace.css +1 -1
  5. package/dist/browser/workspace.js +32 -31
  6. package/dist/builder.js +288 -237
  7. package/dist/central-recovery-stage.js +3 -3
  8. package/dist/check-failure.js +2 -2
  9. package/dist/check-levels.js +3 -0
  10. package/dist/check-report.js +58 -7
  11. package/dist/cli-help.js +1 -0
  12. package/dist/codex-limits.js +40 -22
  13. package/dist/contracts/console-api.js +6 -1
  14. package/dist/contracts/engine-api.js +1 -0
  15. package/dist/contracts/release-check.js +7 -4
  16. package/dist/contracts/release-terms.js +11 -2
  17. package/dist/contracts/verification-receipt.js +1 -1
  18. package/dist/deploy-gate.js +7 -1
  19. package/dist/direct-chat.js +3 -3
  20. package/dist/easy-start.js +8 -6
  21. package/dist/engine-reads.js +74 -0
  22. package/dist/flexible-conversation-schema.js +24 -0
  23. package/dist/flexible-conversation.js +162 -0
  24. package/dist/flexible-custody.js +3 -0
  25. package/dist/flexible-import.js +89 -0
  26. package/dist/flexible-save.js +128 -0
  27. package/dist/flexible-session.js +93 -13
  28. package/dist/flexible-ship.js +3 -3
  29. package/dist/flexible-thread.js +2 -2
  30. package/dist/install-mode.js +1 -1
  31. package/dist/local-checks.js +32 -0
  32. package/dist/local-landing.js +758 -0
  33. package/dist/local-owner.js +3 -0
  34. package/dist/operate.js +165 -26
  35. package/dist/passwordless.js +1 -1
  36. package/dist/plan-limits-demand.js +48 -0
  37. package/dist/project-delete.js +1 -0
  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 +30 -12
  51. package/dist/review-context.js +2 -1
  52. package/dist/serve.js +31 -14
  53. package/dist/server/direct-chat.js +109 -3
  54. package/dist/server/engine-api.js +65 -6
  55. package/dist/server/render-results.js +8 -4
  56. package/dist/server/render-tasks.js +10 -1
  57. package/dist/server/route-table.js +15 -1
  58. package/dist/server/send-back-build.js +4 -0
  59. package/dist/server/settings.js +33 -7
  60. package/dist/server/task-views.js +20 -0
  61. package/dist/server/tasks.js +108 -6
  62. package/dist/settings-groups-ui.js +3 -3
  63. package/dist/store.js +29 -4
  64. package/dist/subscription-usage.js +11 -5
  65. package/dist/surface.js +11 -2
  66. package/dist/task-base.js +23 -4
  67. package/dist/task-outcome-cli.js +10 -1
  68. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  69. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  70. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  71. package/dist/tui/linux-x64/toolroll-tui +0 -0
  72. package/dist/verification-evidence.js +20 -7
  73. package/dist/workspace-ui.js +1 -1
  74. package/package.json +2 -1
  75. package/scripts/release-proof.mjs +240 -0
@@ -55,6 +55,7 @@ const LOCAL_POSTS = Object.freeze({
55
55
  "agents.live.thread.ship": "ship-thread",
56
56
  "agents.live.thread.ship-cancel": "cancel-ship",
57
57
  "agents.live.thread.ship-send-back": "reply-thread",
58
+ "agents.live.thread.save": "save-thread",
58
59
  "task.act.reply": "answer-question",
59
60
  "task.act.stop": "stop-run",
60
61
  "task.act.cancel": "stop-run",
@@ -64,6 +65,7 @@ const LOCAL_POSTS = Object.freeze({
64
65
  "task.act.resume-arm": "resume-run",
65
66
  "task.act.resume": "resume-run",
66
67
  "task.act.complete": "complete-task",
68
+ "task.act.land": "land-task",
67
69
  "task.act.plan": "request-plan",
68
70
  "task.act.requeue": "retry-build",
69
71
  "task.act.route": "change-task-agents",
@@ -71,6 +73,7 @@ const LOCAL_POSTS = Object.freeze({
71
73
  "flow.trigger.resume": "trigger-resume",
72
74
  "flow.trigger.check": "trigger-run",
73
75
  "flow.trigger.press": "trigger-run",
76
+ "run.act.checks": "run-checks",
74
77
  "run.act.revise": "request-revision",
75
78
  "run.act.note": "request-revision",
76
79
  "run.act.comment": "request-revision",
@@ -87,6 +90,9 @@ const LOCAL_POSTS = Object.freeze({
87
90
  "direct-chat.repair": "direct-chat-manage",
88
91
  "direct-chat.ship-preview": "read",
89
92
  "direct-chat.ship": "direct-chat-ship",
93
+ "direct-chat.page-ship-review": "read",
94
+ "direct-chat.page-ship": "direct-chat-ship",
95
+ "direct-chat.page-reply": "direct-chat-send",
90
96
  "direct-chat.ship-cancel": "direct-chat-manage",
91
97
  "term.agent-sign-in": "agent-sign-in",
92
98
  "term.agent-install": "agent-install",
@@ -273,6 +279,8 @@ get("tasks", "term.socket", `^\\/term\\/${TERMINAL}\\/socket$`, { ...TERM, sampl
273
279
  const DIRECT_CHAT = { ...free, callers: ["cookie"], project: "none", limited: "deny", ...operator("Direct chat is for local solo operators.", "/") };
274
280
  get("tasks", "direct-chat.list", "/engine/direct-chats", DIRECT_CHAT);
275
281
  get("tasks", "direct-chat.detail", `^\\/engine\\/direct-chats\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}` });
282
+ get("tasks", "direct-chat.page-list", "/direct-chats", DIRECT_CHAT);
283
+ get("tasks", "direct-chat.page", `^\\/direct-chats\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}` });
276
284
  get("tasks", "direct-chat.artifact", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/artifacts\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/artifacts/${"b".repeat(32)}` });
277
285
  get("pages", "projects.browse", "/projects/browse", free);
278
286
  get("pages", "projects.pick", "/projects/pick", { ...free, callers: ["cookie"], project: "none", ...approver("Sign in as an approver to add projects.", "/projects") });
@@ -321,6 +329,7 @@ get("pages", "agents.live", "/agents/live", { limited: "unscoped", callers: ["co
321
329
  get("pages", "agents.live.read", `^\\/agents\\/live\\/${ID}$`, { limited: "unscoped", callers: ["cookie"], ...free, sample: "/agents/live/1" });
322
330
  get("pages", "agents.live.run", `^\\/agents\\/live\\/run\\/${ID}$`, { limited: "unscoped", callers: ["cookie", "bearer"], ...free, sample: "/agents/live/run/1" });
323
331
  get("pages", "agents.live.thread", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}$", { limited: "unscoped", callers: ["cookie"], ...free, sample: `/agents/live/thread/${"a".repeat(32)}` });
332
+ get("pages", "agents.live.thread.diff", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/diff$", { limited: "unscoped", callers: ["cookie"], ...free, sample: `/agents/live/thread/${"a".repeat(32)}/diff` });
324
333
  get("pages", "agents.live.threads", "/agents/live/threads", { limited: "unscoped", callers: ["cookie"], ...free });
325
334
  post("pages", "agents.live.thread.answer", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/answer$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/answer` });
326
335
  post("pages", "agents.live.thread.start", "/agents/live/thread", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver starts threads.") });
@@ -330,6 +339,7 @@ post("pages", "agents.live.thread.end", "^\\/agents\\/live\\/thread\\/[0-9a-f]{3
330
339
  post("pages", "agents.live.thread.ship", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver ships their own thread's work."), sample: `/agents/live/thread/${"a".repeat(32)}/ship` });
331
340
  post("pages", "agents.live.thread.ship-cancel", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship\\/cancel$", { limited: "unscoped", callers: ["cookie"], project: "none", sample: `/agents/live/thread/${"a".repeat(32)}/ship/cancel` });
332
341
  post("pages", "agents.live.thread.ship-send-back", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/ship\\/send-back$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver sends back their own thread's Ship."), sample: `/agents/live/thread/${"a".repeat(32)}/ship/send-back` });
342
+ post("pages", "agents.live.thread.save", "^\\/agents\\/live\\/thread\\/[0-9a-f]{32}\\/save$", { limited: "unscoped", callers: ["cookie"], project: "none", ...approver("An approver saves their own thread's work as a branch."), sample: `/agents/live/thread/${"a".repeat(32)}/save` });
333
343
  get("pages", "agents.terminals", "/agents/terminals", TERM);
334
344
  get("pages", "fleet", "/fleet", free);
335
345
  get("tasks", "tasks.new", "/tasks/new", { limited: "collection", ...free });
@@ -440,6 +450,9 @@ post("tasks", "direct-chat.apply-main", `^\\/engine\\/direct-chats\\/${TERMINAL}
440
450
  post("tasks", "direct-chat.repair", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/repair$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/repair` });
441
451
  post("tasks", "direct-chat.ship-preview", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship-preview$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/ship-preview` });
442
452
  post("tasks", "direct-chat.ship", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/engine/direct-chats/${"a".repeat(32)}/ship` });
453
+ post("tasks", "direct-chat.page-ship-review", `^\\/direct-chats\\/${TERMINAL}\\/ship-review$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}/ship-review` });
454
+ post("tasks", "direct-chat.page-ship", `^\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/direct-chats/${"a".repeat(32)}/ship` });
455
+ post("tasks", "direct-chat.page-reply", `^\\/direct-chats\\/${TERMINAL}\\/reply$`, { ...DIRECT_CHAT, scope: "step-up", sample: `/direct-chats/${"a".repeat(32)}/reply` });
443
456
  post("tasks", "direct-chat.ship-cancel", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/ship-cancel$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/ship-cancel` });
444
457
  for (const one of ["send", "stop", "resume", "recover", "continue", "ship", "answer"])
445
458
  post("tasks", `code.${one}-send`, `^\\/code\\/${SESSION}\\/${one}$`, { ...CODING_ACT, sample: `/code/${"a".repeat(32)}/${one}` });
@@ -616,6 +629,7 @@ post("tasks", "task.act.route", `^\\/t\\/${TASK}\\/route$`, { project: "task", l
616
629
  post("tasks", "task.act.retry-review", `^\\/t\\/${TASK}\\/retry-review$`, { project: "task", limited: "resource", sample: "/t/one/retry-review" });
617
630
  post("tasks", "task.act.complete", `^\\/t\\/${TASK}\\/complete$`, { project: "task", limited: "resource", sample: "/t/one/complete", ...approver("Only an approver can mark a result complete.") });
618
631
  post("tasks", "task.act.merge", `^\\/t\\/${TASK}\\/merge$`, { project: "task", limited: "resource", sample: "/t/one/merge", ...approver("Only an approver can merge.") });
632
+ post("tasks", "task.act.land", `^\\/t\\/${TASK}\\/land$`, { project: "task", limited: "resource", sample: "/t/one/land", ...approver("Only an approver can land work.") });
619
633
  post("tasks", "task.act.recheck-stopped", `^\\/t\\/${TASK}\\/recheck-stopped$`, { project: "task", limited: "resource", sample: "/t/one/recheck-stopped", ...approver("Only an approver can have Toolroll check a build again.") });
620
634
  post("tasks", "task.act.stop-carrying", `^\\/t\\/${TASK}\\/stop-carrying$`, { project: "task", limited: "resource", sample: "/t/one/stop-carrying", ...approver("Only an approver can stop carrying a release.") });
621
635
  post("tasks", "task.act.stop", `^\\/t\\/${TASK}\\/stop$`, { project: "task", limited: "resource", sample: "/t/one/stop" });
@@ -651,7 +665,7 @@ for (const one of ["prepare", "preview", "import", "save"])
651
665
  post("flows", `recipes.${one}-send`, `/recipes/${one}`, { limited: "collection" });
652
666
  post("flows", "recipes.launch-send", "/recipes/launch", { limited: "collection" });
653
667
  for (const one of ["note", "comment", "revise", "draft-repair", "checks", "add-tests"])
654
- post("tasks", `run.act.${one}`, `^\\/r\\/${ID}\\/${one}$`, { project: "run", limited: "resource", sample: `/r/1/${one}` });
668
+ post("tasks", `run.act.${one}`, `^\\/r\\/${ID}\\/${one}$`, { project: "run", limited: "resource", sample: `/r/1/${one}`, ...(one === "comment" ? { freshness: "allowlist" } : {}) });
655
669
  post("tasks", "run.act.reveal", `^\\/r\\/${ID}\\/reveal$`, { project: "run", limited: "resource", callers: ["cookie"], sample: "/r/1/reveal", ...approver("Only an approver can show an agent's files.") });
656
670
  post("tasks", "session.editor-links", "/session/editor-links", { viewer: true });
657
671
  post("tasks", "agents.seen", "/agents/seen", { callers: ["cookie"], project: "none", limited: "unscoped", viewer: true });
@@ -0,0 +1,4 @@
1
+ import { freshnessFor, passwordlessSessionFor, ssoNowAvailable, withFreshness } from "../scope.js";
2
+ export function sessionYesPossible(store, by, preview) {
3
+ return passwordlessSessionFor(store, by) || ssoNowAvailable(by) || withFreshness("approve-standard", () => freshnessFor(by, Date.now(), preview)) !== null;
4
+ }
@@ -146,6 +146,7 @@ import { approvalFactsNow } from "./kit.js";
146
146
  import { spendReport, spendReportCsv, spendRows } from "../spend-report.js";
147
147
  import { savingsReportOrError } from "../route-savings.js";
148
148
  import { limitsView } from "../limits-ui.js";
149
+ import { notePlanLimitsViewed } from "../plan-limits-demand.js";
149
150
  import { budgetStates, monthNamed, spendItems, usd as spendUsd, subagentNames as subagentNamesOf } from "../spend.js";
150
151
  import { removeSsoSettings, saveSsoSettings, SSO_CALLBACK, ssoChangeWords } from "../sso-settings.js";
151
152
  import { ssoSettingsHtml } from "../sso-ui.js";
@@ -209,6 +210,7 @@ export function createSettingsHandlers(runtime) {
209
210
  fieldError: url.searchParams.get("field") === "usd" ? url.searchParams.get("problem") : null,
210
211
  problem: url.searchParams.get("field") === "usd" ? null : url.searchParams.get("problem"),
211
212
  };
213
+ notePlanLimitsViewed(store, now);
212
214
  const windows = limitsView(store.providerLimits(), [], { project: projectName, subagent: id => subagentNames.get(id) ?? `Subagent ${id}` }, now);
213
215
  const view = { month: month.name, previous: shift(-1), next: month.name === current.name ? null : shift(1), current: current.name, report: spendReport(rows),
214
216
  budgets, unlimited, targets, windows, subagentNames, edit, facts: approvalFactsNow(),
@@ -495,10 +497,10 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
495
497
  }
496
498
  async function pullRequestsPage(ctx) {
497
499
  const { url, who, response, project } = ctx;
498
- const repo = url.searchParams.get("repo") ?? "";
499
500
  const known = [...new Set([...managedRepos(), ...store.knownRepos(), ...store.listProjects().map(one => one.path)])];
500
- if (who.via !== "cookie" || !known.includes(repo) || !visible(repo))
501
- return refuse(response, who, 404, "No such project.", "/projects");
501
+ const repo = projectForPage(ctx, "/settings/pull-requests", "Pull requests", known);
502
+ if (repo === null || who.via !== "cookie")
503
+ return;
502
504
  const publishing = publishingOf(store, repo);
503
505
  const canChange = who.role === "approver" && !store.isDemo();
504
506
  const check = publishing.on || !canChange ? null : lastChecks.known(`publishing:${repo}`)?.value ?? "unchecked";
@@ -508,10 +510,10 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
508
510
  }
509
511
  async function checksPage(ctx) {
510
512
  const { url, who, response, project } = ctx;
511
- const repo = url.searchParams.get("repo") ?? "";
512
513
  const known = [...new Set([...managedRepos(), ...store.knownRepos(), ...store.listProjects().map(one => one.path)])];
513
- if (who.via !== "cookie" || !known.includes(repo) || !visible(repo))
514
- return refuse(response, who, 404, "No such project.", "/projects");
514
+ const repo = projectForPage(ctx, "/settings/checks", "Checks", known);
515
+ if (repo === null || who.via !== "cookie")
516
+ return;
515
517
  const quick = liveQuickCommand(store, repo);
516
518
  const body = (checkSettingsHtml({ repo, name: projectName(repo), csrf: who.session.csrf, canChange: who.role === "approver" && !store.isDemo(),
517
519
  level: projectCheckLevel(store, repo).level, full: store.liveVerifyCommand(repo), quick, suggestion: quick === null ? suggestQuickCommand(repo) : null,
@@ -571,7 +573,7 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
571
573
  if (!authenticateCredential(who, body.get("password") ?? "").ok)
572
574
  return back("problem", "Enter your Toolroll password to turn Passwordless on.");
573
575
  setPasswordless(store, true, who.name, now);
574
- return back("said", "Passwordless is on. Signing in is the only password now.");
576
+ return back("said", "Passwordless is on. Approvals need no password now; changes that add a way in still ask.");
575
577
  }
576
578
  async function knowledgePage(ctx) {
577
579
  const { url, who, response, project } = ctx;
@@ -3432,6 +3434,30 @@ ${postForm("/settings/chat-approval/save", html `\
3432
3434
  : self ? `Removed.${stopWords} Your threads can't reach Claude until you add one again. The token still works at Claude until you revoke it in your Claude account.`
3433
3435
  : `Removed ${person}'s Claude sign-in for threads.${stopWords} Their threads can't reach Claude until they add one again.`);
3434
3436
  }
3437
+ function projectForPage(ctx, path, title, known) {
3438
+ const { url, who, response, project } = ctx;
3439
+ const named = url.searchParams.get("repo");
3440
+ if (who.via !== "cookie") {
3441
+ refuse(response, who, 404, "No such project.", "/projects");
3442
+ return null;
3443
+ }
3444
+ if (named !== null) {
3445
+ if (!known.includes(named) || !visible(named)) {
3446
+ refuse(response, who, 404, "No such project.", "/projects");
3447
+ return null;
3448
+ }
3449
+ return named;
3450
+ }
3451
+ const mine = known.filter(repo => visible(repo));
3452
+ if (project != null && mine.includes(project))
3453
+ return project;
3454
+ if (mine.length === 1)
3455
+ return mine[0];
3456
+ const body = mine.length === 0 ? html `<p>No projects yet. <a class="k-link" href="/projects">Add one on Projects</a>.</p>`
3457
+ : html `<p>Pick a project.</p>${projectPicker(path, mine.map(repo => ({ repo, name: projectName(repo) })), "")}`;
3458
+ sendScreen(response, 200, screen(title, settingsSubPage("projects", title, body), { chrome: chromeFor(project, "projects") }));
3459
+ return null;
3460
+ }
3435
3461
  return { registrations, modelsView };
3436
3462
  }
3437
3463
  function savedLoginOf(store) {
@@ -1,4 +1,5 @@
1
1
  import { localOwnerRefusal } from "../local-owner.js";
2
+ import { broughtInOnBranch, landedWords, landingOf, publishesThroughPullRequests, recognisedOnBranch } from "../local-landing.js";
2
3
  import { requestContext } from "./request-context.js";
3
4
  import { heldFindingCount } from "../findings.js";
4
5
  import { familyInWebReach } from "../findings.js";
@@ -13,6 +14,7 @@ import { agentSaidOf, releaseProgressFor, shipChecksForTask } from "../store.js"
13
14
  import { releaseCiRunningOf } from "../release-ci-hold.js";
14
15
  import { releaseObligationsOf } from "../release-recheck.js";
15
16
  import { approvalProofOf, freshnessFor, withFreshness } from "../scope.js";
17
+ import { sessionYesPossible } from "./send-back-build.js";
16
18
  import { approvalPasswordField } from "../approval-password.js";
17
19
  import { fastChangeProblem, fastStarted } from "../fast-start.js";
18
20
  import { routeChangeOf } from "../route-change.js";
@@ -605,6 +607,22 @@ export function createTaskViews(runtime) {
605
607
  return null;
606
608
  return { taskId: rootId, view: null, offer: { taskId: receipt.taskId, runId: receipt.runId, digest: receipt.digest }, target };
607
609
  }
610
+ function taskLandingOf(taskId, who) {
611
+ const repo = runtime.store.lookupRef(taskId)?.repo ?? null;
612
+ if (repo === null || publishesThroughPullRequests(runtime.store, repo))
613
+ return null;
614
+ const rootId = runtime.familyOf(taskId)?.root.id ?? taskId;
615
+ const record = landingOf(runtime.store, rootId);
616
+ const assignment = assignmentOf(runtime.store, taskId, runtime.clock(), runtime.workAccess(), runtime.evidenceRoot);
617
+ const complete = assignment?.state === "complete";
618
+ if (!complete && record === null)
619
+ return null;
620
+ const person = who.via === "cookie" && who.role === "approver";
621
+ const onBranch = record === null || record.undone ? recognisedOnBranch(runtime.store, repo, rootId, complete ? assignment?.receipt?.head ?? null : null, baseGit) : null;
622
+ if (onBranch !== null)
623
+ return { taskId: rootId, landed: onBranch, canLand: false, canUndo: person && broughtInOnBranch(runtime.store, repo, rootId, baseGit) };
624
+ return { taskId: rootId, landed: landedWords(runtime.store, rootId), canLand: person && complete && (record === null || record.undone), canUndo: person && record !== null && !record.undone };
625
+ }
608
626
  function failureOf(runs, assignment, readLog = true) {
609
627
  const last = latestFinishedAttempt(runs);
610
628
  if (last === null)
@@ -736,6 +754,7 @@ export function createTaskViews(runtime) {
736
754
  if (resultSection !== null && extras.result.current)
737
755
  presentedData.resultSection = resultSection;
738
756
  presentedData.pullRequest = taskPullRequestOf(taskId, who);
757
+ presentedData.landing = taskLandingOf(taskId, who);
739
758
  if (family !== null && family.problem === null) {
740
759
  presentedData.family = { root: { id: family.root.id, title: family.root.title, createdAt: family.root.createdAt, goal: runtime.store.getScope(family.root.id)?.goal ?? null },
741
760
  versions: family.versions.map(one => ({ id: one.id, title: one.title, state: one.state })),
@@ -1038,6 +1057,7 @@ export function createTaskViews(runtime) {
1038
1057
  terminal,
1039
1058
  publication,
1040
1059
  pullRequestTo: pullRequestTargetOf(run.id),
1060
+ buildNowOnSendBack: who.via === "cookie" && who.role === "approver" && (who.authority === "local-owner" || sessionYesPossible(runtime.store, who.name, true)),
1041
1061
  publishing: pullRequestTargetOf(run.id) !== null ? "pull-request" : publishingOf(runtime.store, runtime.store.refById(run.taskRef)?.repo ?? null).on ? "other" : "off",
1042
1062
  ciFailing: publication !== null && publication.prNumber !== null && runtime.store.hasOpenCiEpisode(publication.githubRepo, publication.prNumber),
1043
1063
  files,
@@ -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,11 @@ 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 { handoffWords, land, landingWords, publishesThroughPullRequests, PULL_REQUESTS_INSTEAD, readLanding } from "../local-landing.js";
98
+ import { localActNow, localOwnerRefusal, withLocalAct } from "../local-owner.js";
99
+ import { localChecksRefusal } from "../local-checks.js";
100
+ import { sessionYesPossible } from "./send-back-build.js";
97
101
  import { firstTaskRouted } from "../welcome-facts.js";
98
102
  import { plural } from "../design/kit.js";
99
103
  export const FIRST_TASK_DETECT_WAIT_MS = 8_000;
@@ -1086,12 +1090,27 @@ export function createTasksHandlers(runtime) {
1086
1090
  const typedNote = (body.get("note") ?? "").trim();
1087
1091
  const sentNote = withContext(body.get("context"), typedNote);
1088
1092
  if (body.get("intent") === "revise") {
1089
- const result = requestResultChanges(store, evidenceRoot, {
1093
+ const localBuild = who.via === "cookie" && who.authority === "local-owner" && who.role === "approver";
1094
+ const sessionBuild = who.via === "cookie" && who.authority !== "local-owner" && who.role === "approver" && sessionYesPossible(store, who.name, false);
1095
+ const buildNow = body.get("approve") === "1" && (localBuild || sessionBuild);
1096
+ const result = spendingOnlyOnSuccess(() => requestResultChanges(store, evidenceRoot, {
1097
+ ...(buildNow ? {
1098
+ currentResult: () => {
1099
+ const task = store.externalIdFor(found.taskRef);
1100
+ const current = task === null ? null : assignmentOf(store, task, now, { principal: "operator", repos: admissionList() }, evidenceRoot);
1101
+ return current !== null && current.activeTaskId === task && current.receipt?.runId === id ? null
1102
+ : "A newer build of this task came in since this page was drawn. Open the current result, then send it back.";
1103
+ },
1104
+ approveNow: localBuild ? (child) => withLocalAct("approve-plan", () => {
1105
+ const filed = store.getScope(child);
1106
+ return filed !== null && !approvalOf(filed).approved && approveScope(store, child, who.name, now, filed.digest, "").ok;
1107
+ }) : (child) => sessionYesNow(store, child, who.name, now),
1108
+ } : {}),
1090
1109
  run: id, batch: body.get("batch"), source: body.get("source"), actor: who.name,
1091
1110
  repos: admissionList(), includeUnplaced: visible(null), allowMode: who.via === "cookie",
1092
1111
  origin: who.via === "cookie" ? "person" : "machine", typedWords: who.via === "cookie" ? typedNote : null,
1093
1112
  note: sentNote, path: body.get("path") ?? "", line: body.get("line") ?? "", request: body.get("request"), image,
1094
- }, now);
1113
+ }, now), revised => !revised.ok);
1095
1114
  if (answersInPlace(incoming))
1096
1115
  return result.ok ? answerActInPlace(response, "done", "Sent back. The revision is filed.", 200) : answerActInPlace(response, "refused", result.message, result.status);
1097
1116
  if (!result.ok) {
@@ -1201,7 +1220,17 @@ export function createTasksHandlers(runtime) {
1201
1220
  if (store.isDemo())
1202
1221
  return refuse(response, who, 403, "The demo runs no checks.", back);
1203
1222
  const level = body.get("level") === "full" ? "full" : "quick";
1204
- const asked = requestFollowUpChecks(store, { runId: id, level, actor: who.name }, now);
1223
+ const asked = who.authority === "local-owner"
1224
+ ? store.transact(() => {
1225
+ if (localActNow(store, "run-checks") === null)
1226
+ return { ok: false, message: "Sign in with your password to do this." };
1227
+ const task = store.externalIdFor(found.taskRef);
1228
+ const problem = task === null ? "No such result." : localChecksRefusal(store, who.name, task);
1229
+ if (problem !== null)
1230
+ return { ok: false, message: problem };
1231
+ return requestFollowUpChecks(store, { runId: id, level, actor: who.name, why: "local-owner" }, now);
1232
+ })
1233
+ : requestFollowUpChecks(store, { runId: id, level, actor: who.name }, now);
1205
1234
  if (!asked.ok)
1206
1235
  return refuse(response, who, 409, asked.message, back);
1207
1236
  return redirect(response, back.startsWith("/t/") && !/[?&]tab=result(?:[&#]|$)/.test(back) ? back : `${back.split("#")[0]}#follow-ups`);
@@ -2102,6 +2131,11 @@ export function createTasksHandlers(runtime) {
2102
2131
  return redirect(response, withRefusal(back, "reason"));
2103
2132
  return taskScreen(response, who, taskId, ACCEPT_ANYWAY_NEEDS_REASON, 400);
2104
2133
  }
2134
+ if (note === null) {
2135
+ const current = assignmentOf(store, taskId, now, { principal: "operator", repos: admissionList() }, evidenceRoot);
2136
+ if (current?.receipt?.runId === latest.id && owedAcceptance(current.receipt, current.readiness?.blockers ?? []) === "exception")
2137
+ return taskScreen(response, who, taskId, `${ACCEPT_NEEDS_REASON}.`, 400);
2138
+ }
2105
2139
  store.acceptProof(latest.id, verifiedAuthor(who.name), note, now);
2106
2140
  return redirect(response, body.get("return") === null ? taskHref(taskId) : safeReturn(body.get("return")));
2107
2141
  }
@@ -2627,6 +2661,7 @@ export function createTasksHandlers(runtime) {
2627
2661
  "task.act.retry-review": taskAct("retry-review"),
2628
2662
  "task.act.complete": taskAct("complete"),
2629
2663
  "task.act.merge": taskMerge,
2664
+ "task.act.land": taskLand,
2630
2665
  "task.act.recheck-stopped": taskRecheckStopped,
2631
2666
  "task.act.stop": taskAct("stop"),
2632
2667
  "task.act.stop-carrying": taskAct("stop-carrying"),
@@ -2766,6 +2801,54 @@ export function createTasksHandlers(runtime) {
2766
2801
  default: return refused("Reload the page and try again.");
2767
2802
  }
2768
2803
  }
2804
+ async function taskLand(ctx) {
2805
+ const { url, who, response, posted, now } = ctx;
2806
+ const act = matchTaskPath(url.pathname, "/land$");
2807
+ if (act === null)
2808
+ return noPage(who, response);
2809
+ const body = readForm(posted, CONSOLE_FORMS.taskLand);
2810
+ if (store.isDemo())
2811
+ return taskScreen(response, who, act.taskId, "The demo lands nothing.", 403);
2812
+ const ref = store.lookupRef(act.taskId);
2813
+ if (ref === null || !visible(ref.repo) || who.via !== "cookie")
2814
+ return refuse(response, who, 404, "no such task", "/");
2815
+ if (ref.repo !== null && publishesThroughPullRequests(store, ref.repo))
2816
+ return taskScreen(response, who, act.taskId, PULL_REQUESTS_INSTEAD, 409);
2817
+ const local = who.authority === "local-owner";
2818
+ const principal = local ? null : leadPrincipal(who);
2819
+ if (!local && principal === null)
2820
+ return taskScreen(response, who, act.taskId, "Your access changed. Sign in again.", 403);
2821
+ const access = { repos: principal !== null ? principal.repos : store.knownRepos().filter(repo => store.accountCanAccess(who.name, repo)) };
2822
+ const undo = body.get("undo") === "1";
2823
+ const into = (body.get("into") ?? "").trim();
2824
+ const options = { root: evidenceRoot, ...(into === "" ? {} : { into }), ...(undo ? { undo: true } : {}) };
2825
+ const key = body.get("key") ?? "";
2826
+ if (key === "") {
2827
+ const read = await readLanding(store, act.taskId, access, now, options);
2828
+ if (!read.ok)
2829
+ return taskScreen(response, who, act.taskId, read.message, 409);
2830
+ if (!("plan" in read)) {
2831
+ if (answersInPlace(ctx.request))
2832
+ return answerActInPlace(response, "done", `Already on ${read.landed.ref.replace(/^refs\/heads\//, "")} (${read.landed.commit.slice(0, 7)}).`, 200);
2833
+ return redirect(response, taskHref(act.taskId));
2834
+ }
2835
+ const plan = read.plan;
2836
+ if (answersInPlace(ctx.request))
2837
+ return respond(response, 200, "application/json; charset=utf-8", JSON.stringify({ outcome: "land-terms", key: plan.key, lines: landingWords(plan) }));
2838
+ const title = undo ? "Undo landing" : `Land on ${plan.branch}`;
2839
+ 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") }));
2840
+ }
2841
+ 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 });
2842
+ if (!done.ok)
2843
+ return taskScreen(response, who, act.taskId, done.message, done.reason === "authority" ? 403 : 409);
2844
+ if (done.handoff !== null) {
2845
+ const words = `Landing commit ${done.commit.slice(0, 7)} is ready. Your project folder has ${done.branch} checked out, so Toolroll didn't touch it. ${handoffWords(done.handoff, done.commit)}`;
2846
+ return answersInPlace(ctx.request) ? answerActInPlace(response, "done", words, 200) : taskScreen(response, who, act.taskId, words, 200);
2847
+ }
2848
+ if (answersInPlace(ctx.request))
2849
+ return answerActInPlace(response, "done", `${done.kind === "undo" ? "Undone" : "Landed"} on ${done.branch} (${done.commit.slice(0, 7)}).`, 200);
2850
+ return redirect(response, taskHref(act.taskId));
2851
+ }
2769
2852
  return { registrations, workListFor, showOrder, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
2770
2853
  }
2771
2854
  export function createTidyHandlers(runtime) {
@@ -3026,3 +3109,22 @@ export function localOwnerRoute(store, taskId, body, now) {
3026
3109
  const done = localOwnerChangeAgents(store, taskId, { phase, provider, model, sawDigest }, when, now);
3027
3110
  return done.ok ? { ok: true, words: done.words } : done;
3028
3111
  }
3112
+ const NOT_SEALED = Symbol("not sealed");
3113
+ function sessionYesNow(store, child, by, now) {
3114
+ try {
3115
+ return store.savepoint(() => {
3116
+ const filed = store.getScope(child);
3117
+ if (filed === null || approvalOf(filed).approved)
3118
+ throw NOT_SEALED;
3119
+ const yes = spendingOnlyOnSuccess(() => withFreshness("approve-standard", () => approveScope(store, child, by, now, filed.digest, "")), result => !result.ok);
3120
+ if (!yes.ok)
3121
+ throw NOT_SEALED;
3122
+ return true;
3123
+ });
3124
+ }
3125
+ catch (error) {
3126
+ if (error === NOT_SEALED)
3127
+ return false;
3128
+ throw error;
3129
+ }
3130
+ }
@@ -360,12 +360,12 @@ export function accessGroup(facts, flags) {
360
360
  const people = facts.people;
361
361
  const links = [
362
362
  settingsLink({ href: "/people", title: "People", status: people === null ? "Your own access" : [accessWords({ ...facts, passwordless: null }), people.invites === 0 ? "no open invites" : plural(people.invites, "open invite", "open invites")].join(" · ") }),
363
- settingsLink({ href: "/settings/sessions", title: "Sessions and tokens", status: `Signed in on ${plural(facts.access.sessions, "device", "devices")} · ${plural(facts.access.tokens, "API token", "API tokens")}` }),
363
+ settingsLink({ href: "/settings/sessions", title: "Sessions and tokens", status: `${plural(facts.access.sessions, "session", "sessions")} signed in · ${plural(facts.access.tokens, "API token", "API tokens")}` }),
364
364
  ...(facts.operator && (advancedOn(facts) || facts.sso !== null) ? [
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
  }
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
+ }
@@ -8,6 +8,7 @@ import { codingEnvironment } from "./coding-provider.js";
8
8
  import { readCodexLimits } from "./codex-limits.js";
9
9
  import { claudeLimitsOf } from "./provider-limits.js";
10
10
  import { billingOf } from "./spend.js";
11
+ import { directChatRunning } from "./plan-limits-demand.js";
11
12
  const CLAUDE_STALE_MS = 30 * 60_000;
12
13
  const GEMINI_STALE_MS = 15 * 60_000;
13
14
  export function subscriptionStatusPath(databaseFile) {
@@ -187,6 +188,8 @@ function claudeNeedsRefresh(store, now) {
187
188
  if (store.handle.prepare("SELECT 1 AS live FROM run WHERE provider = 'claude' AND outcome IS NULL AND started_at > ? LIMIT 1").get(recent) !== undefined) {
188
189
  return false;
189
190
  }
191
+ if (directChatRunning(store, "claude", now))
192
+ return false;
190
193
  const rows = store.providerLimits().filter(one => one.provider === "claude");
191
194
  if (rows.length === 0)
192
195
  return true;
@@ -205,15 +208,18 @@ function geminiNeedsRefresh(databaseFile, now) {
205
208
  return now.getTime() - Date.parse(stored.observedAt) > GEMINI_STALE_MS;
206
209
  }
207
210
  export async function refreshSubscriptions(store, databaseFile, options = {}) {
211
+ const readers = options.readers ?? {};
212
+ const gate = (read, otherwise) => options.stillWanted?.() === false ? otherwise() : read();
208
213
  const now = options.now ?? new Date();
209
214
  const shouldCodex = options.skipCodex !== true && billingOf("codex") === "subscription";
210
215
  const shouldClaude = options.forceClaude === true || claudeNeedsRefresh(store, now);
211
216
  const shouldGemini = options.forceGemini === true || geminiNeedsRefresh(databaseFile, now);
217
+ const readGemini = shouldGemini && options.stillWanted?.() !== false;
212
218
  const [codex, claude, gemini] = await Promise.all([
213
- shouldCodex ? readCodexLimits() : Promise.resolve(null),
214
- shouldClaude ? readClaudeLimits() : Promise.resolve(null),
215
- shouldGemini
216
- ? readGeminiSubscription({ now })
219
+ shouldCodex ? gate(() => (readers.codex ?? (() => readCodexLimits()))(), () => Promise.resolve(null)) : Promise.resolve(null),
220
+ shouldClaude ? gate(() => (readers.claude ?? (() => readClaudeLimits()))(), () => Promise.resolve(null)) : Promise.resolve(null),
221
+ readGemini
222
+ ? (readers.gemini ?? (at => readGeminiSubscription({ now: at })))(now)
217
223
  : Promise.resolve((databaseFile !== null ? readStoredGeminiStatus(databaseFile) : null) ?? {
218
224
  connected: false,
219
225
  provider: "antigravity",
@@ -227,7 +233,7 @@ export async function refreshSubscriptions(store, databaseFile, options = {}) {
227
233
  store.recordProviderLimits(codex, now);
228
234
  if (claude !== null)
229
235
  store.recordProviderLimits(claude, now);
230
- if (databaseFile !== null && shouldGemini)
236
+ if (databaseFile !== null && readGemini)
231
237
  writeStoredGeminiStatus(databaseFile, gemini);
232
238
  return { claude, codex, gemini, refreshedAt: now.toISOString() };
233
239
  }
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 one new commit on top; --undo reverts that commit with a new one"),
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"),
@@ -431,6 +438,7 @@ const GUIDE_ROWS = [
431
438
  operator("thread end", "end one of your threads for good (its agent stops; its work can still be shipped for a week)"),
432
439
  operator("thread remove", "remove one of your threads' working copy (refused while its agent may run or a Ship is open)"),
433
440
  operator("thread ship", "ship one of your threads' committed work: shows its terms, asks, then takes your password typed now"),
441
+ operator("thread save", "save one of your threads' committed work as the branch toolroll/code-<id> in its project (no pull request, no merge); says the git merge that puts it on your branch"),
434
442
  operator("setup clear", "clear installation setup"),
435
443
  operator("verify set", "approve the one shell command the plane re-runs after every future commit (--quick \"<cmd>\" approves the fast check Quick runs); --self-heal binds one approved-setup replay when a required project executable is missing"),
436
444
  operator("verify clear", "revoke a repository's approved verification command; --level quick revokes only the quick command"),
@@ -479,7 +487,7 @@ const REMOTE_NO = [
479
487
  "models results",
480
488
  "models suggestions", "models accept", "models dismiss", "models turn-off", "models keep", "models try", "models stop",
481
489
  "map on", "map off", "map holdout end", "map report",
482
- "thread list", "thread show", "thread end", "thread remove", "thread ship",
490
+ "thread list", "thread show", "thread end", "thread remove", "thread ship", "thread save",
483
491
  "publish", "publish status", "publish merge", "publish refire", "publish unblock", "publish rearm", "publish grant", "publish revoke",
484
492
  "enroll", "revoke",
485
493
  "flows import", "flows trigger check", "flows script save",
@@ -492,7 +500,7 @@ const REMOTE_FOLLOW_THROUGH = [
492
500
  ];
493
501
  const REMOTE_STEP_UP = [
494
502
  "proposals", "decide", "task regate", "task approve", "task accept", "task merge", "run settle",
495
- "task archive", "task restore", "task tidy", "knowledge apply",
503
+ "task archive", "task restore", "task tidy", "task land", "knowledge apply",
496
504
  "memory decide", "memory retire", "memory apply", "memory tidy", "memory restore", "memory unmerge",
497
505
  "flows card approve", "flows card send-back", "flows script approve", "flows unattended",
498
506
  "approver list", "approver add", "people list", "people invite", "people projects", "people revoke",
@@ -541,6 +549,7 @@ const LOCAL_ALLOW = {
541
549
  "task continue": "resume-run",
542
550
  "task unhold": "resume-run",
543
551
  "task complete": "complete-task",
552
+ "task land": "land-task",
544
553
  "task plan": "request-plan",
545
554
  "task requeue": "retry-build",
546
555
  "task revise": "request-revision",