toolroll 0.9.111 → 0.9.113

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 (61) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +28 -29
  3. package/dist/action-ledger.js +13 -0
  4. package/dist/agent-said.js +60 -6
  5. package/dist/bin.js +5 -1
  6. package/dist/browser/terminal.js +1 -1
  7. package/dist/browser/workspace.js +1 -1
  8. package/dist/chat-channel.js +10 -0
  9. package/dist/cli-help.js +6 -0
  10. package/dist/cli.js +2 -0
  11. package/dist/contracts/console-api.js +2 -1
  12. package/dist/contracts/engine-api.js +12 -0
  13. package/dist/contracts/lead-tools.js +28 -0
  14. package/dist/easy-start.js +8 -3
  15. package/dist/engine-reads.js +15 -0
  16. package/dist/evidence.js +6 -6
  17. package/dist/fast-terms.js +8 -4
  18. package/dist/flexible-agents.js +2 -8
  19. package/dist/flexible-answers.js +4 -26
  20. package/dist/flexible-available.js +31 -1
  21. package/dist/flexible-import.js +2 -14
  22. package/dist/flexible-launch.js +15 -3
  23. package/dist/flexible-launcher.js +0 -5
  24. package/dist/flexible-relay.js +7 -4
  25. package/dist/flexible-session.js +123 -32
  26. package/dist/flexible-setting-schema.js +10 -0
  27. package/dist/flexible-ship.js +8 -18
  28. package/dist/flexible-start.js +2 -2
  29. package/dist/flexible-thread.js +21 -27
  30. package/dist/flexible-turns.js +7 -17
  31. package/dist/flexible.js +9 -11
  32. package/dist/flow-triggers.js +4 -1
  33. package/dist/lead-tools.js +107 -1
  34. package/dist/lead.js +1 -1
  35. package/dist/ledger-view.js +2 -1
  36. package/dist/live-terminal.js +28 -0
  37. package/dist/local-owner.js +1 -0
  38. package/dist/needs-you.js +10 -2
  39. package/dist/operate.js +62 -5
  40. package/dist/outbound-privacy.js +6 -1
  41. package/dist/plain-words.js +1 -1
  42. package/dist/release.js +2 -0
  43. package/dist/serve.js +10 -1
  44. package/dist/server/chat.js +6 -1
  45. package/dist/server/engine-api.js +91 -27
  46. package/dist/server/mutation-key.js +6 -0
  47. package/dist/server/render-history.js +2 -1
  48. package/dist/server/route-table.js +3 -0
  49. package/dist/server/settings-section-table.js +3 -0
  50. package/dist/server/settings-sections.js +23 -0
  51. package/dist/server/settings.js +36 -3
  52. package/dist/server/terminals.js +3 -3
  53. package/dist/settings-proofs.js +2 -0
  54. package/dist/store.js +18 -4
  55. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  56. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  57. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  58. package/dist/tui/linux-x64/toolroll-tui +0 -0
  59. package/dist/view-tools.js +94 -0
  60. package/dist/work-index.js +6 -2
  61. package/package.json +2 -1
@@ -0,0 +1,94 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { chooseTuiBinary, identityOf } from "./tui-launch.js";
3
+ import { engineContractDigest } from "./contracts/engine-api.js";
4
+ const VIEW_TIMEOUT_MS = 5_000;
5
+ const VIEW_MAX_OUTPUT = 256 * 1024;
6
+ const same = (a, b) => a !== null && a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeNs === b.mtimeNs;
7
+ function viewEnv(env) {
8
+ const out = { PATH: "/usr/bin:/bin" };
9
+ for (const key of ["HOME", "XDG_CONFIG_HOME", "XDG_STATE_HOME"])
10
+ if (env[key] !== undefined)
11
+ out[key] = env[key];
12
+ return out;
13
+ }
14
+ export function viewAnswerOf(stdout) {
15
+ let parsed;
16
+ try {
17
+ parsed = JSON.parse(stdout.trim().split("\n").pop() ?? "");
18
+ }
19
+ catch {
20
+ return { ok: false, why: "the workbench answered something unreadable", unsure: true };
21
+ }
22
+ if (typeof parsed !== "object" || parsed === null)
23
+ return { ok: false, why: "the workbench answered something unreadable", unsure: true };
24
+ const body = parsed;
25
+ if (body["ok"] === false)
26
+ return { ok: false, why: typeof body["why"] === "string" ? body["why"].slice(0, 400) : "the workbench refused it" };
27
+ return { ok: true, body };
28
+ }
29
+ export function binaryViewRunner(env = process.env) {
30
+ return (verb, input) => {
31
+ const choice = chooseTuiBinary({ env, screenReader: false, platform: process.platform, arch: process.arch, contract: engineContractDigest() });
32
+ if (!choice.ok)
33
+ return { ok: false, why: `the terminal workbench isn't available here (${choice.why})` };
34
+ if (!same(identityOf(choice.binary), choice.identity))
35
+ return { ok: false, why: "the terminal workbench changed while it was being checked" };
36
+ try {
37
+ const stdout = execFileSync(choice.binary, ["view", verb], {
38
+ input: input ?? "", encoding: "utf8", timeout: VIEW_TIMEOUT_MS, maxBuffer: VIEW_MAX_OUTPUT, env: viewEnv(env), stdio: ["pipe", "pipe", "ignore"],
39
+ });
40
+ return viewAnswerOf(stdout);
41
+ }
42
+ catch (error) {
43
+ const out = error.stdout;
44
+ if (typeof out === "string" && out.trim() !== "")
45
+ return viewAnswerOf(out);
46
+ return { ok: false, why: "the terminal workbench didn't answer", unsure: true };
47
+ }
48
+ };
49
+ }
50
+ export const THEME_NAME = /^[a-z][a-z0-9-]{0,31}$/;
51
+ export const BUILT_IN_THEMES = ["terminal", "light", "dark", "high-contrast"];
52
+ export const VIEW_CHANGES_PER_MINUTE = 10;
53
+ export const VIEW_LEDGER_ACTION = "workbench look changed";
54
+ export async function runViewCommand(argv, write, runner = binaryViewRunner()) {
55
+ const [verb, ...rest] = argv;
56
+ const say = (answer, words) => {
57
+ if (!answer.ok) {
58
+ write(`toolroll view: ${answer.why}`);
59
+ return 1;
60
+ }
61
+ write(words(answer.body));
62
+ return 0;
63
+ };
64
+ if (verb === undefined || verb === "show") {
65
+ return say(runner("read"), body => {
66
+ const settings = (body["settings"] ?? {});
67
+ const saved = (body["themes"]?.["saved"] ?? []);
68
+ return [`theme: ${String(settings["theme"] ?? "terminal")}`, `density: ${String(settings["density"] ?? "compact")}`,
69
+ `saved themes: ${saved.length === 0 ? "none" : saved.map(one => String(one.name)).join(", ")}`].join("\n");
70
+ });
71
+ }
72
+ if (verb === "theme" && rest[0] === "set" && rest.length === 2) {
73
+ const name = rest[1];
74
+ if (!BUILT_IN_THEMES.includes(name) && !THEME_NAME.test(name)) {
75
+ write("toolroll view: a theme is terminal, light, dark, high-contrast or a saved theme's name (lowercase letters, digits and dashes)");
76
+ return 2;
77
+ }
78
+ return say(runner("set", JSON.stringify({ theme: name })), body => {
79
+ const changed = Array.isArray(body["changed"]) ? body["changed"].map(String) : [];
80
+ return changed.length === 0 ? `Theme: ${name}.` : changed.join("\n");
81
+ });
82
+ }
83
+ if (verb === "reset" && rest.length === 0)
84
+ return say(runner("reset"), body => String(body["said"] ?? "Your workbench settings are back to the defaults."));
85
+ write("usage: toolroll view [show] | toolroll view theme set <name> | toolroll view reset");
86
+ return 2;
87
+ }
88
+ export function viewAllowedFor(facts) {
89
+ if (facts.via !== "cookie" || !facts.fromThisComputer)
90
+ return false;
91
+ if (facts.authority === "local-owner")
92
+ return true;
93
+ return facts.approvers.length === 1 && facts.approvers[0] === facts.name;
94
+ }
@@ -479,7 +479,7 @@ function readWorkIndexPage(store, now, access, options, taskId = null) {
479
479
  'proof_verdict',(SELECT COALESCE(machine_verdict,verdict) FROM proof_verdict WHERE run=page_result_id),
480
480
  'proof_failed_check',(SELECT verdict='refuted' AND reasons_json LIKE '%approved verification command exited%' FROM proof_verdict WHERE run=page_result_id),'code',code,'ask_group',ask_group,'needs',needs,'person_need',person_need,'lead_claim',lead_claim,'family_running',family_running,'rank',rank,'ask_rank',ask_rank,'list_order',${ORDER},'sort_at',sort_at,
481
481
  'checked_actor',checked_actor,'checked_at',checked_at,'checked_digest',checked_digest,'checked_detail',checked_detail,'question_id',question_id,
482
- 'dependency_id',dependency_id,'dependency_state',dependency_state,'hold_until',hold_until,'attempt_run',(SELECT id FROM run WHERE task_ref IN (SELECT value FROM json_each(page.fam_refs)) AND (finished_at IS NOT NULL OR outcome IS NOT NULL) AND role NOT IN ('planner','reviewer') ORDER BY id DESC LIMIT 1),'custody_unresolved',custody_unresolved,'hold_kind',hold_kind,'hold_reason',substr(hold_reason,1,600),'hold_id',hold_id,'live_lease',live_lease IS NOT NULL,'approved',COALESCE(approved,0),
482
+ 'dependency_id',dependency_id,'dependency_state',dependency_state,'hold_until',hold_until,'attempt_run',(SELECT id FROM run WHERE task_ref IN (SELECT value FROM json_each(page.fam_refs)) AND (finished_at IS NOT NULL OR outcome IS NOT NULL) AND role NOT IN ('planner','reviewer') ORDER BY id DESC LIMIT 1),'attempt_no',CASE WHEN code='retry-scheduled' THEN (SELECT count(*) FROM run WHERE task_ref IN (SELECT value FROM json_each(page.fam_refs)) AND (finished_at IS NOT NULL OR outcome IS NOT NULL) AND role NOT IN ('planner','reviewer')) END,'custody_unresolved',custody_unresolved,'hold_kind',hold_kind,'hold_reason',substr(hold_reason,1,600),'hold_id',hold_id,'live_lease',live_lease IS NOT NULL,'approved',COALESCE(approved,0),
483
483
  'plan_changed',scope_digest IS NOT NULL AND digest IS NOT scope_digest,'head_ok',length(head_revision)=40 AND head_revision NOT GLOB '*[^a-f0-9]*','stop_run',stop_run,'unfinished',unfinished,'signed_out',signed_out,'no_agent',no_agent,'models_cleared',models_cleared,
484
484
  'question_run',(SELECT run FROM decision WHERE id=page.question_id),'agent_ask',page.agent_ask,
485
485
  'agent_ask_run',(SELECT run FROM agent_question WHERE id=page.agent_ask),'agent_ask_text',(SELECT substr(question,1,300) FROM agent_question WHERE id=page.agent_ask),'replaced_by',(SELECT successor FROM task_replacement WHERE task_ref=page.ref_id),
@@ -706,7 +706,7 @@ function itemOf(row, principal, probe, leadName, readiness, readable = false, no
706
706
  if (code === 'waiting-incident')
707
707
  detail = `The last attempts failed the same way (${failedAttemptSentence(s(row, 'attempt_reason')).replace(/[.\s]+$/, '').replace(/^./, first => first.toLowerCase())}). Retry, or change the plan.`;
708
708
  const context = code === 'stopping' ? { build: n(row, 'stop_run') || null }
709
- : code === 'retry-scheduled' ? { build: n(row, 'attempt_run') || null, retry: s(row, 'hold_until') === null ? null : retryWhenWords(s(row, 'hold_until'), now) }
709
+ : code === 'retry-scheduled' ? { build: n(row, 'attempt_run') || null, attempt: n(row, 'attempt_no') || null, retry: s(row, 'hold_until') === null ? null : retryWhenWords(s(row, 'hold_until'), now) }
710
710
  : code === 'vanished-run' ? { build: n(row, 'unfinished') || null }
711
711
  : code === 'earlier-active' ? { task: s(row, 'earlier_id') }
712
712
  : code === 'waiting-dependency' ? { task: s(row, 'dependency_id') } : {};
@@ -790,6 +790,10 @@ function itemOf(row, principal, probe, leadName, readiness, readable = false, no
790
790
  ...(lead === null ? {} : { lead, ...(leadName === undefined ? {} : { leadName }) }) });
791
791
  label = code === 'cancelled' && shared.headline === 'Stopped' && !shared.sentence.startsWith('Replaced by ') ? 'Cancelled' : shared.headline;
792
792
  detail = shared.sentence;
793
+ if (code === 'held' && s(row, 'hold_reason') === 'stopped retrying from the terminal') {
794
+ label = 'On hold';
795
+ detail = 'you stopped retrying';
796
+ }
793
797
  const firstSignIn = code === 'signed-out' && n(row, 'no_agent') > 0 && s(row, 'signed_out') === null;
794
798
  if (shared.need != null && shared.need.key !== 'other' && shared.need.key !== 'review-result' && primaryAction !== null && !firstSignIn) {
795
799
  actionLabel = shared.need.action.label;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolroll",
3
- "version": "0.9.111",
3
+ "version": "0.9.113",
4
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"
@@ -94,6 +94,7 @@
94
94
  "class-variance-authority": "0.7.1",
95
95
  "clsx": "2.1.1",
96
96
  "esbuild": "0.28.2",
97
+ "fast-check": "4.10.2",
97
98
  "happy-dom": "20.14.5",
98
99
  "ink": "6.8.0",
99
100
  "ink-testing-library": "4.0.0",