toolroll 0.9.110 → 0.9.112
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.
- package/CHANGELOG.md +66 -0
- package/README.md +5 -1
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/action-ledger.js +13 -0
- package/dist/agent-detect.js +1 -1
- package/dist/agent-said-schema.js +4 -0
- package/dist/agent-said.js +77 -0
- package/dist/approval-summary.js +39 -8
- package/dist/bin.js +5 -1
- package/dist/browser/THIRD_PARTY_NOTICES.txt +30 -0
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.js +1 -1
- package/dist/builder.js +6 -1
- package/dist/chat-channel.js +10 -0
- package/dist/claim.js +28 -13
- package/dist/cli-help.js +7 -1
- package/dist/cli.js +2 -0
- package/dist/codex-limits.js +21 -8
- package/dist/console-instance.js +2 -1
- package/dist/contracts/console-api.js +3 -2
- package/dist/contracts/engine-api.js +15 -3
- package/dist/contracts/lead-tools.js +28 -0
- package/dist/contracts/route.js +1 -0
- package/dist/dispatch.js +1 -1
- package/dist/dispose.js +15 -9
- package/dist/easy-start.js +19 -3
- package/dist/engine-reads.js +79 -2
- package/dist/evidence.js +6 -6
- package/dist/fast-start.js +20 -11
- package/dist/flexible-start.js +1 -1
- package/dist/integrations.js +6 -1
- package/dist/lead-tools.js +107 -1
- package/dist/lead.js +1 -1
- package/dist/ledger-view.js +2 -1
- package/dist/local-owner.js +1 -0
- package/dist/needs-you.js +12 -2
- package/dist/operate.js +57 -9
- package/dist/outbound-privacy.js +6 -1
- package/dist/phase-routing.js +3 -1
- package/dist/plain-words.js +1 -1
- package/dist/plane-review.js +1 -1
- package/dist/proposal.js +2 -2
- package/dist/provider-connection.js +14 -2
- package/dist/release.js +1 -0
- package/dist/route-store.js +1 -1
- package/dist/serve.js +6 -4
- package/dist/server/chat.js +6 -1
- package/dist/server/pages.js +4 -1
- package/dist/server/render-history.js +2 -1
- package/dist/server/render-tasks.js +5 -2
- package/dist/server/route-table.js +2 -0
- package/dist/server/settings-section-table.js +3 -0
- package/dist/server/settings-sections.js +36 -0
- package/dist/server/settings.js +36 -0
- package/dist/server/tasks.js +31 -4
- package/dist/settings-proofs.js +1 -0
- package/dist/store.js +83 -11
- package/dist/task-sizing-schema.js +14 -0
- package/dist/task-sizing.js +76 -10
- package/dist/toolroll-update.js +3 -1
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/view-tools.js +94 -0
- package/dist/webhooks.js +8 -2
- package/dist/work-index.js +4 -4
- package/package.json +2 -1
package/dist/builder.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { legacyNetwork, repositoryEcosystems } from "./egress.js";
|
|
2
2
|
import { flexibleAdoption } from "./flexible-merge-guard.js";
|
|
3
|
+
import { agentSaidTail } from "./agent-said.js";
|
|
3
4
|
import { CHECK_ACCESS_DEFAULT, checkAccessHere, checkNetworkOf, localModeCap } from "./check-access.js";
|
|
4
5
|
import { localModeOn } from "./local-owner.js";
|
|
5
6
|
import { checkoutGit, refusal as gitRefusal } from "./teardown-git.js";
|
|
@@ -1150,10 +1151,12 @@ export async function settleProviderOutcome(captured, result) {
|
|
|
1150
1151
|
};
|
|
1151
1152
|
}
|
|
1152
1153
|
if (result.initFailed) {
|
|
1154
|
+
const said = agentSaidTail(result.stderr);
|
|
1153
1155
|
return {
|
|
1154
1156
|
ok: false,
|
|
1155
1157
|
reason: "provider-init",
|
|
1156
1158
|
message: `the provider harness never initialized — ${firstLine(result.stderr) || `exit ${result.code}`}`,
|
|
1159
|
+
...(said.length === 0 ? {} : { agentSaid: said }),
|
|
1157
1160
|
};
|
|
1158
1161
|
}
|
|
1159
1162
|
const liveEnding = captured.live?.close === "turn-budget" || captured.live?.close === "paused-idle";
|
|
@@ -1163,7 +1166,9 @@ export async function settleProviderOutcome(captured, result) {
|
|
|
1163
1166
|
if (kept !== null)
|
|
1164
1167
|
return kept;
|
|
1165
1168
|
}
|
|
1166
|
-
|
|
1169
|
+
const ceiling = result.ending?.subtype === "error_max_turns" || result.ending?.subtype === "error_max_budget_usd";
|
|
1170
|
+
const said = agentSaidTail(result.stderr.trim() !== "" ? result.stderr : result.finalMessage);
|
|
1171
|
+
return { ok: false, reason: ceiling ? "agent" : "agent-error", message: agentExitWords(result), ...(said.length === 0 ? {} : { agentSaid: said }) };
|
|
1167
1172
|
}
|
|
1168
1173
|
if (captured.live?.close === "turn-budget" && ![done, mailbox, captured.plan?.proposal].some(name => name !== undefined && existsSync(join(worktree, name)))) {
|
|
1169
1174
|
return { ok: false, reason: "agent", message: agentExitWords({ ...result, ending: { subtype: "error_max_turns", turns: captured.live.maxTurns } }) };
|
package/dist/chat-channel.js
CHANGED
|
@@ -671,6 +671,16 @@ export const CHAT_ACTION_PARITY = {
|
|
|
671
671
|
how: "The door refuses cancel from any card; the card links the exact task's Cancel control when a trusted https console-url is configured, and the cancel is armed there.",
|
|
672
672
|
gap: "Incomplete phone action: no phone path to cancel by design; the button only opens the task.",
|
|
673
673
|
},
|
|
674
|
+
toolroll_view_read: {
|
|
675
|
+
support: "missing",
|
|
676
|
+
how: "Refused on the phone by design: the workbench's look is the person's own conversation in the console on this computer (view-tools.ts); the tool answers in words and nothing is read or written.",
|
|
677
|
+
gap: "No phone path by design: restyle from the console on this computer, or edit tui.toml.",
|
|
678
|
+
},
|
|
679
|
+
toolroll_view_set: {
|
|
680
|
+
support: "missing",
|
|
681
|
+
how: "Refused on the phone by design: the workbench's look is the person's own conversation in the console on this computer (view-tools.ts); the tool answers in words and nothing is read or written.",
|
|
682
|
+
gap: "No phone path by design: restyle from the console on this computer, or edit tui.toml.",
|
|
683
|
+
},
|
|
674
684
|
};
|
|
675
685
|
export function parityGaps() {
|
|
676
686
|
return LEAD_TOOL_SCHEMAS.map((tool) => tool.name).filter((name) => CHAT_ACTION_PARITY[name] === undefined);
|
package/dist/claim.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { INFRASTRUCTURE_TERMINALS } from "./route-store.js";
|
|
3
|
+
import { RUN_REASON_WORDS } from "./needs-you.js";
|
|
2
4
|
import { authenticate, drainOf } from "./runner.js";
|
|
3
5
|
import { pauseForAuth } from "./provider-auth.js";
|
|
4
6
|
import { DEFAULT_MAX_OPEN_DECISIONS, missingCapability, scopeApprovedForDispatch, taskReadinessBlocker, } from "./dispatch.js";
|
|
@@ -542,7 +544,7 @@ function sealFailure(store, leaseId, args) {
|
|
|
542
544
|
if (failureClass !== "commit-failure" && run.terminalClass === "auth-expired") {
|
|
543
545
|
return { ok: true, ...sealAuthExpired(store, run, taskId, now) };
|
|
544
546
|
}
|
|
545
|
-
if (failureClass === "unknown") {
|
|
547
|
+
if (failureClass === "unknown" || failureClass === "agent-error") {
|
|
546
548
|
const moved = moveOnIfExhausted(store, runId, taskId, now);
|
|
547
549
|
if (moved !== null) {
|
|
548
550
|
store.finishRun(runId, { outcome: "failed", reason: "usage-exhausted", now });
|
|
@@ -566,12 +568,13 @@ function sealFailure(store, leaseId, args) {
|
|
|
566
568
|
pushClass: "attention",
|
|
567
569
|
link: `/r/${runId}`,
|
|
568
570
|
subject: `${taskId}: the commit itself failed`,
|
|
569
|
-
body:
|
|
571
|
+
body: `The commit itself failed. The work is preserved, uncommitted, in the task's checkout. Prove it and \`toolroll task requeue ${taskId}\`.`,
|
|
570
572
|
}, now);
|
|
571
573
|
return { ok: true, disposition: "commit-incident", incidentId };
|
|
572
574
|
}
|
|
573
575
|
const strikes = store.addStrike(run.taskRef);
|
|
574
|
-
|
|
576
|
+
const agentStopped = failureClass === "agent-error" && !INFRASTRUCTURE_TERMINALS.has(run.terminalClass ?? "");
|
|
577
|
+
if (strikes >= MAX_STRIKES || agentStopped) {
|
|
575
578
|
const closedState = exhaustUnlessClosed(store, run, taskId, now);
|
|
576
579
|
if (closedState !== null)
|
|
577
580
|
return { ok: true, disposition: "closed", strikes, state: closedState };
|
|
@@ -580,7 +583,8 @@ function sealFailure(store, leaseId, args) {
|
|
|
580
583
|
taskRef: run.taskRef,
|
|
581
584
|
ownerKind: "incident",
|
|
582
585
|
ownerId: String(incidentId),
|
|
583
|
-
reason:
|
|
586
|
+
reason: agentStopped ? "agent-error — the agent stopped with an error; it isn't retried on its own"
|
|
587
|
+
: `attempts-exhausted — ${strikes} consecutive failures, last: ${failureClass}`,
|
|
584
588
|
until: null,
|
|
585
589
|
}, now);
|
|
586
590
|
store.enqueueNotification({
|
|
@@ -589,8 +593,10 @@ function sealFailure(store, leaseId, args) {
|
|
|
589
593
|
kind: "attempts-exhausted",
|
|
590
594
|
pushClass: "attention",
|
|
591
595
|
link: `/r/${runId}`,
|
|
592
|
-
subject: `${taskId} stalled after ${strikes} straight failures`,
|
|
593
|
-
body:
|
|
596
|
+
subject: agentStopped ? `${taskId} stopped: the agent stopped with an error` : `${taskId} stalled after ${strikes} straight failures`,
|
|
597
|
+
body: agentStopped
|
|
598
|
+
? `${outboundFailureWords(failureClass)}.\nIt isn't retried on its own. Read what the agent said on the task, then Retry (\`toolroll task requeue ${taskId}\`).`
|
|
599
|
+
: `Last failure (${failureClass}): ${outboundFailureWords(failureClass)}.\nIt will not be retried. Read the runs, then \`toolroll task requeue ${taskId}\`.`,
|
|
594
600
|
}, now);
|
|
595
601
|
return { ok: true, disposition: "stalled", strikes, incidentId };
|
|
596
602
|
}
|
|
@@ -612,7 +618,7 @@ function sealFailure(store, leaseId, args) {
|
|
|
612
618
|
subject: failureClass === "no-handoff"
|
|
613
619
|
? `${taskId}: the agent stopped before handing off; its work was kept, retry ${strikes}/${MAX_STRIKES}`
|
|
614
620
|
: `${taskId}: attempt failed (${failureClass}), retry ${strikes}/${MAX_STRIKES}`,
|
|
615
|
-
body: `${
|
|
621
|
+
body: `${outboundFailureWords(failureClass)}.\nNext attempt no earlier than ${until.toISOString()}.`,
|
|
616
622
|
}, now);
|
|
617
623
|
return { ok: true, disposition: "backoff", strikes, until: until.toISOString() };
|
|
618
624
|
}
|
|
@@ -855,6 +861,8 @@ function sealPlanFailure(store, leaseId, args) {
|
|
|
855
861
|
const malformedKind = args.malformed === "decision" ? "malformed-decision" : "malformed-plan";
|
|
856
862
|
store.finishRun(runId, { outcome: "failed", reason: kind === "malformed" ? malformedKind : oneLine(message, 120), now });
|
|
857
863
|
if (kind === "malformed") {
|
|
864
|
+
if (message.trim() !== "")
|
|
865
|
+
store.recordOutcomeFacts(runId, { handoff: message });
|
|
858
866
|
const incidentId = store.createIncident({ run: runId, kind: malformedKind }, now);
|
|
859
867
|
store.holdOwned({
|
|
860
868
|
taskRef: run.taskRef,
|
|
@@ -870,7 +878,7 @@ function sealPlanFailure(store, leaseId, args) {
|
|
|
870
878
|
pushClass: "attention",
|
|
871
879
|
link: `/r/${runId}`,
|
|
872
880
|
subject: `${taskId}: the planner's ${args.malformed === "decision" ? "question" : "plan"} failed validation`,
|
|
873
|
-
body:
|
|
881
|
+
body: `The planner's ${args.malformed === "decision" ? "question" : "plan"} failed its checks; what it wrote is on the task.\nResolve the incident to let planning retry.`,
|
|
874
882
|
}, now);
|
|
875
883
|
return { ok: true, disposition: "malformed-incident", incidentId };
|
|
876
884
|
}
|
|
@@ -891,7 +899,7 @@ function sealPlanFailure(store, leaseId, args) {
|
|
|
891
899
|
pushClass: "attention",
|
|
892
900
|
link: `/r/${runId}`,
|
|
893
901
|
subject: `${taskId}: planning stalled after ${strikes} straight failures`,
|
|
894
|
-
body:
|
|
902
|
+
body: `${OUTBOUND_ATTEMPT_WORDS.plan}\nResolve the incident to let planning retry, or write the scope yourself.`,
|
|
895
903
|
}, now);
|
|
896
904
|
return { ok: true, disposition: "exhausted", incidentId, strikes };
|
|
897
905
|
}
|
|
@@ -909,7 +917,7 @@ function sealPlanFailure(store, leaseId, args) {
|
|
|
909
917
|
dedupeKey: `plan-run:${runId}:failed`,
|
|
910
918
|
kind: "plan-failed",
|
|
911
919
|
subject: `${taskId}: planning attempt failed, retry ${strikes}/${MAX_PLAN_STRIKES}`,
|
|
912
|
-
body: `${
|
|
920
|
+
body: `${OUTBOUND_ATTEMPT_WORDS.plan}\nNext attempt no earlier than ${until.toISOString()}.`,
|
|
913
921
|
}, now);
|
|
914
922
|
return { ok: true, disposition: "backoff", strikes };
|
|
915
923
|
}
|
|
@@ -952,6 +960,8 @@ function sealScoutFailure(store, leaseId, args) {
|
|
|
952
960
|
const malformedKind = args.malformed === "decision" ? "malformed-decision" : "malformed-report";
|
|
953
961
|
store.finishRun(runId, { outcome: "failed", reason: kind === "malformed" ? malformedKind : oneLine(message, 120), now });
|
|
954
962
|
if (kind === "malformed") {
|
|
963
|
+
if (message.trim() !== "")
|
|
964
|
+
store.recordOutcomeFacts(runId, { handoff: message });
|
|
955
965
|
const incidentId = store.createIncident({ run: runId, kind: malformedKind }, now);
|
|
956
966
|
store.holdOwned({
|
|
957
967
|
taskRef: run.taskRef,
|
|
@@ -967,7 +977,7 @@ function sealScoutFailure(store, leaseId, args) {
|
|
|
967
977
|
pushClass: "attention",
|
|
968
978
|
link: `/r/${runId}`,
|
|
969
979
|
subject: `${taskId}: the scout's ${args.malformed === "decision" ? "question" : "report"} failed validation`,
|
|
970
|
-
body:
|
|
980
|
+
body: `The scout's ${args.malformed === "decision" ? "question" : "report"} failed its checks; what it wrote is on the task.\nResolve the incident to let scouting retry.`,
|
|
971
981
|
}, now);
|
|
972
982
|
return { ok: true, disposition: "malformed-incident", incidentId };
|
|
973
983
|
}
|
|
@@ -991,7 +1001,7 @@ function sealScoutFailure(store, leaseId, args) {
|
|
|
991
1001
|
pushClass: "attention",
|
|
992
1002
|
link: `/r/${runId}`,
|
|
993
1003
|
subject: `${taskId} stalled after ${strikes} straight scouting failures`,
|
|
994
|
-
body:
|
|
1004
|
+
body: `${OUTBOUND_ATTEMPT_WORDS.scout}\nIt will not be retried. Read the runs, then \`toolroll task requeue ${taskId}\`.`,
|
|
995
1005
|
}, now);
|
|
996
1006
|
return { ok: true, disposition: "stalled", incidentId, strikes };
|
|
997
1007
|
}
|
|
@@ -1009,7 +1019,7 @@ function sealScoutFailure(store, leaseId, args) {
|
|
|
1009
1019
|
dedupeKey: `run:${runId}:failed`,
|
|
1010
1020
|
kind: "scout-failed",
|
|
1011
1021
|
subject: `${taskId}: scouting attempt failed, retry ${strikes}/${MAX_STRIKES}`,
|
|
1012
|
-
body: `${
|
|
1022
|
+
body: `${OUTBOUND_ATTEMPT_WORDS.scout}\nNext attempt no earlier than ${until.toISOString()}.`,
|
|
1013
1023
|
}, now);
|
|
1014
1024
|
return { ok: true, disposition: "backoff", strikes };
|
|
1015
1025
|
}
|
|
@@ -1081,3 +1091,8 @@ export function acquireForCheckCleanup(store, checkId, attempt, runner, options)
|
|
|
1081
1091
|
return acquireLocked(store, bound, runner, options, "refuse");
|
|
1082
1092
|
});
|
|
1083
1093
|
}
|
|
1094
|
+
function outboundFailureWords(failureClass) {
|
|
1095
|
+
const words = RUN_REASON_WORDS[failureClass] ?? "the attempt stopped";
|
|
1096
|
+
return `${words.charAt(0).toUpperCase()}${words.slice(1)}`;
|
|
1097
|
+
}
|
|
1098
|
+
const OUTBOUND_ATTEMPT_WORDS = { plan: "The planning attempt stopped; what happened is on the task.", scout: "The scouting attempt stopped; what happened is on the task." };
|
package/dist/cli-help.js
CHANGED
|
@@ -2,7 +2,7 @@ import { DEFAULT_MAX_DEPTH } from "./scan.js";
|
|
|
2
2
|
export const HELP = `Toolroll — your agents build. You decide.
|
|
3
3
|
|
|
4
4
|
toolroll start here, in this terminal (--web: in the browser)
|
|
5
|
-
keys: n new task · a
|
|
5
|
+
keys: n new task · a accept · r send back · A agents · ? all keys
|
|
6
6
|
toolroll demo try it first: sample tasks, no model calls, no cost
|
|
7
7
|
toolroll repos add <folder> add another project
|
|
8
8
|
toolroll task add "<change>" --repo .
|
|
@@ -65,6 +65,12 @@ Reports
|
|
|
65
65
|
toolroll graph report which work graph is already here
|
|
66
66
|
toolroll integrations which integrations work, and what to do about the ones that don't (--json)
|
|
67
67
|
|
|
68
|
+
Workbench look
|
|
69
|
+
toolroll view the terminal workbench's theme and saved themes
|
|
70
|
+
toolroll view theme set <name>
|
|
71
|
+
switch the workbench's theme (built in, or one your lead saved)
|
|
72
|
+
toolroll view reset put the workbench's settings back to the defaults (keeps tui.toml.bak)
|
|
73
|
+
|
|
68
74
|
Projects
|
|
69
75
|
toolroll repos list connected repositories, and how to adjust
|
|
70
76
|
toolroll repos remove <path>
|
package/dist/cli.js
CHANGED
|
@@ -331,6 +331,8 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
331
331
|
return runReposCommand(rest, write, mainOptions.onboard);
|
|
332
332
|
if (first === "pulls")
|
|
333
333
|
return runPullsCommand(rest, write);
|
|
334
|
+
if (first === "view")
|
|
335
|
+
return (await import("./view-tools.js")).runViewCommand(rest, write, mainOptions.viewRunner);
|
|
334
336
|
if (first === "graph")
|
|
335
337
|
return runGraphCommand(rest, write);
|
|
336
338
|
if (first !== undefined && OPERATE_COMMANDS.has(first)) {
|
package/dist/codex-limits.js
CHANGED
|
@@ -99,21 +99,16 @@ export function readCodexLimits(options = {}) {
|
|
|
99
99
|
child.stdin?.write(`${JSON.stringify({ jsonrpc: "2.0", id: 1, method: "initialize", params: { clientInfo: { name: "toolroll", version: "1" } } })}\n`);
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
|
-
export function startCodexLimits(store, everyMs = 5 * 60_000) {
|
|
102
|
+
export function startCodexLimits(store, signedIn, everyMs = 5 * 60_000) {
|
|
103
103
|
if (process.env["VITEST"] !== undefined || envValue(process.env, "NO_PLAN_PROBE") !== undefined || store.isDemo())
|
|
104
104
|
return () => { };
|
|
105
105
|
let stopped = false, busy = false;
|
|
106
106
|
const pass = async () => {
|
|
107
|
-
if (stopped || busy
|
|
108
|
-
return;
|
|
109
|
-
const recent = new Date(Date.now() - 6 * 3_600_000).toISOString();
|
|
110
|
-
if (store.handle.prepare("SELECT 1 AS live FROM run WHERE provider = 'codex' AND outcome IS NULL AND started_at > ? LIMIT 1").get(recent) !== undefined)
|
|
107
|
+
if (stopped || busy)
|
|
111
108
|
return;
|
|
112
109
|
busy = true;
|
|
113
110
|
try {
|
|
114
|
-
|
|
115
|
-
if (reading !== null && !stopped)
|
|
116
|
-
store.recordProviderLimits(reading, new Date());
|
|
111
|
+
await codexLimitsPass(store, { signedIn, stopped: () => stopped });
|
|
117
112
|
}
|
|
118
113
|
catch {
|
|
119
114
|
}
|
|
@@ -127,3 +122,21 @@ export function startCodexLimits(store, everyMs = 5 * 60_000) {
|
|
|
127
122
|
first.unref?.();
|
|
128
123
|
return () => { stopped = true; clearInterval(timer); clearTimeout(first); };
|
|
129
124
|
}
|
|
125
|
+
export async function codexLimitsPass(store, seams) {
|
|
126
|
+
if (billingOf("codex") !== "subscription")
|
|
127
|
+
return "skipped";
|
|
128
|
+
const recent = new Date(Date.now() - 6 * 3_600_000).toISOString();
|
|
129
|
+
if (store.handle.prepare("SELECT 1 AS live FROM run WHERE provider = 'codex' AND outcome IS NULL AND started_at > ? LIMIT 1").get(recent) !== undefined)
|
|
130
|
+
return "skipped";
|
|
131
|
+
if (!(await seams.signedIn()))
|
|
132
|
+
return "skipped";
|
|
133
|
+
const reading = await (seams.read ?? (() => readCodexLimits()))();
|
|
134
|
+
if (reading !== null && seams.stopped?.() !== true)
|
|
135
|
+
store.recordProviderLimits(reading, new Date());
|
|
136
|
+
return "read";
|
|
137
|
+
}
|
|
138
|
+
export async function codexSignedInNow(check) {
|
|
139
|
+
if ((await check("codex")).state !== "connected")
|
|
140
|
+
return false;
|
|
141
|
+
return (await check("codex", true)).state === "connected";
|
|
142
|
+
}
|
package/dist/console-instance.js
CHANGED
|
@@ -106,7 +106,8 @@ export function instanceSocketTooLong(databaseFile) {
|
|
|
106
106
|
const needs = Buffer.byteLength(join(instanceRunDir(databaseFile), "0123456789abcdef.sock"));
|
|
107
107
|
if (needs <= SOCKET_PATH_MAX)
|
|
108
108
|
return null;
|
|
109
|
-
|
|
109
|
+
const folderMax = SOCKET_PATH_MAX - Buffer.byteLength(`/${INSTANCE_DIR}/0123456789abcdef.sock`);
|
|
110
|
+
return `the database's folder is too deep for Toolroll's socket (${needs} of at most ${SOCKET_PATH_MAX} bytes), so nothing can find a console started on it — move it to a shorter folder (at most ${folderMax} bytes long), or point TOOLROLL_DB at an orders.db in one: \`TOOLROLL_DB=/short/folder/orders.db toolroll\``;
|
|
110
111
|
}
|
|
111
112
|
export function socketPathProblem(path) {
|
|
112
113
|
if (!SOCKET_NAME.test(basename(path)))
|
|
@@ -50,6 +50,7 @@ export const CONSOLE_FORMS = {
|
|
|
50
50
|
passwordless: formContract("POST /settings/passwordless", ["action", "password"]),
|
|
51
51
|
localModeOff: formContract("POST /settings/local-mode/off", ["password"]),
|
|
52
52
|
justMe: formContract("POST /settings/install-mode/solo", ["password"]),
|
|
53
|
+
taskSizing: formContract("POST /settings/task-sizing", ["password", "enabled", "sizer"]),
|
|
53
54
|
releaseApproval: formContract("POST /settings/release-approval", ["repo", "action", "password"]),
|
|
54
55
|
projectFlexible: formContract("POST /settings/project/flexible", ["repo", "action", "max", "digest", "password"]),
|
|
55
56
|
threadAnswer: formContract("POST /agents/live/thread/<id>/answer", ["request", "card", "decision", "question", "answer"]),
|
|
@@ -180,6 +181,7 @@ export const CONSOLE_FORMS = {
|
|
|
180
181
|
taskSteer: formContract("POST /t/<task>/steer", ["note", "return", "run", "key", "after", "request"]),
|
|
181
182
|
taskReply: formContract("POST /t/<task>/reply", ["question", "answer"]),
|
|
182
183
|
taskHold: formContract("POST /t/<task>/hold", ["reason"]),
|
|
184
|
+
taskUnhold: formContract("POST /t/<task>/unhold", ["hold"]),
|
|
183
185
|
taskBlock: formContract("POST /t/<task>/block|unblock", ["on"]),
|
|
184
186
|
taskRepairDependency: formContract("POST /t/<task>/repair-dependency", ["blocker", "operation", "replacement"]),
|
|
185
187
|
taskNext: formContract("POST /t/<task>/next", ["undo"]),
|
|
@@ -189,7 +191,7 @@ export const CONSOLE_FORMS = {
|
|
|
189
191
|
taskFollowUp: formContract("POST /t/<task>/follow-up", ["index"]),
|
|
190
192
|
taskPlanEdit: formContract("POST /t/<task>/plan-edit", ["saw-plan", "plan-document"]),
|
|
191
193
|
taskRevision: formContract("POST /t/<task>/accept-revision|reject-revision", ["revision-id", "token"]),
|
|
192
|
-
taskCancel: formContract("POST /t/<task>/cancel", ["reason"]),
|
|
194
|
+
taskCancel: formContract("POST /t/<task>/cancel", ["reason", "state", "run"]),
|
|
193
195
|
taskRoute: formContract("POST /t/<task>/route", ["size", "risky", "phase", "clear-phase", "agent", "provider", "model", "sawDigest", "return"]),
|
|
194
196
|
taskScope: formContract("POST /t/<task>/scope", ["sawDigest", "permission-mode", "quality-mode", "budget-usd", "budget-microusd", "requirement", "requirement-new", "requirement-how", "requirement-new-how", "goal-brief", "goal", "not", "touches", "acceptance"]),
|
|
195
197
|
taskApprove: formContract("POST /t/<task>/approve", ["return", "digest", "token", "nonce", "rebuild", "sheet"]),
|
|
@@ -208,7 +210,6 @@ export const BODILESS_POSTS = [
|
|
|
208
210
|
"POST /settings/telegram/retry",
|
|
209
211
|
"POST /providers/<provider>/resume",
|
|
210
212
|
"POST /logout",
|
|
211
|
-
"POST /t/<task>/unhold",
|
|
212
213
|
"POST /t/<task>/stop-carrying",
|
|
213
214
|
"POST /t/<task>/retry-review",
|
|
214
215
|
"POST /settings/updates/check",
|
|
@@ -73,17 +73,22 @@ const needRowSchema = z.object({
|
|
|
73
73
|
question: z.object({ id: z.number().int(), text: z.string(), recap: z.string(),
|
|
74
74
|
options: z.array(z.object({ id: z.string(), label: z.string(), consequence: z.string(), recommended: z.boolean() })) }).nullable(),
|
|
75
75
|
});
|
|
76
|
+
export const waitingSchema = z.object({ retryAt: iso.nullable(), lastFailure: z.string().nullable() });
|
|
77
|
+
export const WORK_ROW_GROUPS = ["decide", "review", "unblock", "building", "rest"];
|
|
78
|
+
export const WORK_STATUS_TONES = ["attention", "problem", "live", "ready", "done", "muted", "neutral"];
|
|
79
|
+
export const WORK_WORD_TONES = ["", "needs", "ask", "live", "done", "failed"];
|
|
76
80
|
const workRowSchema = z.object({
|
|
77
81
|
id: z.string(), title: z.string(), href: z.string(), project: z.string().nullable(), age: z.string(),
|
|
78
|
-
status: z.object({ label: z.string(), tone: z.
|
|
79
|
-
word: z.object({ word: z.string(), tone: z.
|
|
82
|
+
status: z.object({ label: z.string(), tone: z.enum(WORK_STATUS_TONES), token: z.string() }),
|
|
83
|
+
word: z.object({ word: z.string(), tone: z.enum(WORK_WORD_TONES) }),
|
|
80
84
|
ask: z.string().nullable(),
|
|
81
85
|
chip: z.string().nullable(),
|
|
82
|
-
group: z.
|
|
86
|
+
group: z.enum(WORK_ROW_GROUPS),
|
|
83
87
|
rank: z.number().int(),
|
|
84
88
|
detail: z.string().nullable(),
|
|
85
89
|
problem: z.string().nullable(),
|
|
86
90
|
need: needRowSchema.nullable(),
|
|
91
|
+
waiting: waitingSchema.nullable(),
|
|
87
92
|
});
|
|
88
93
|
export const workRowsSchema = z.object({
|
|
89
94
|
version,
|
|
@@ -108,6 +113,7 @@ export const stepCardSchema = z.object({
|
|
|
108
113
|
inChain: z.boolean(),
|
|
109
114
|
agent: z.object({ provider: z.string(), model: z.string().nullable() }).nullable(),
|
|
110
115
|
startedAt: iso.nullable(),
|
|
116
|
+
latestStartedAt: iso.nullable(),
|
|
111
117
|
finishedAt: iso.nullable(),
|
|
112
118
|
costUsd: z.number().nullable(),
|
|
113
119
|
runs: z.array(z.number().int()),
|
|
@@ -130,6 +136,12 @@ export const stepCardsSchema = z.object({
|
|
|
130
136
|
review: z.object({ run: z.number().int(), receipt: z.string().regex(/^[0-9a-f]{64}$/), source: z.string(),
|
|
131
137
|
accept: z.object({ owed: z.enum(["person-check", "exception"]).nullable(), blockers: z.array(z.string()), needs: z.string().nullable() }),
|
|
132
138
|
}).nullable(),
|
|
139
|
+
failure: z.object({ line: z.string(), failedInARow: z.number().int(), suggestion: z.string().nullable(),
|
|
140
|
+
agentSaid: z.array(z.string()).max(8).nullable() }).nullable(),
|
|
141
|
+
waiting: waitingSchema.extend({ agentSaid: z.array(z.string()).max(8).nullable() }).nullable(),
|
|
142
|
+
held: z.object({ id: z.number().int(), reason: z.string(), lastFailure: z.string().nullable() }).nullable(),
|
|
143
|
+
retry: z.object({ run: z.number().int(), digest: z.string() }).nullable(),
|
|
144
|
+
approval: z.object({ by: z.string(), you: z.boolean(), automatic: z.boolean() }).nullable(),
|
|
133
145
|
room: z.string(),
|
|
134
146
|
});
|
|
135
147
|
const diffProblemSchema = z.string().nullable();
|
|
@@ -32,6 +32,13 @@ export const touches = z.array(text("taskTouch")).max(50);
|
|
|
32
32
|
export const acceptance = z.array(acceptanceCriterionSchema).min(1).max(ACCEPTANCE_LIMITS.criteria);
|
|
33
33
|
const note = z.string().max(LIMITS.note, { error: issue => overBy(LIMITS.note, issue.input) }).describe(`At most ${LIMITS.note} characters; longer is refused with its length, not cut.`);
|
|
34
34
|
export const CODE_MAP_VIEWS = ["overview", "area", "file", "search"];
|
|
35
|
+
const VIEW_THEME_NAME = /^[a-z][a-z0-9-]{0,31}$/;
|
|
36
|
+
export const VIEW_ROLES = ["paper", "ink", "muted", "line", "selection", "selection-ink", "ground", "raised", "fill"];
|
|
37
|
+
const viewHex = z.string().regex(/^#[0-9a-fA-F]{6}$/);
|
|
38
|
+
const viewColors = z.strictObject({
|
|
39
|
+
paper: viewHex.optional(), ink: viewHex.optional(), muted: viewHex.optional(), line: viewHex.optional(), selection: viewHex.optional(),
|
|
40
|
+
"selection-ink": viewHex.optional(), ground: viewHex.optional(), raised: viewHex.optional(), fill: viewHex.optional(),
|
|
41
|
+
});
|
|
35
42
|
export const LISTED_TASK_STATES = ["queued", "running", "done", "failed", "cancelled"];
|
|
36
43
|
const ACTION_OPERATIONS = Object.keys(CHAT_ACTIONS).filter(one => !one.startsWith("flow_") && !one.startsWith("subagent_") && one !== "task_start");
|
|
37
44
|
const cardProps = z.strictObject({
|
|
@@ -149,6 +156,25 @@ export const LEAD_TOOL_INPUTS = {
|
|
|
149
156
|
}),
|
|
150
157
|
propose_answer: z.strictObject({ decision: id, option: text("answerOption").min(1), rationale: text("answerRationale") }),
|
|
151
158
|
propose_cancel: z.strictObject({ task: taskRef, reason: text("proposalReason") }),
|
|
159
|
+
toolroll_view_read: z.strictObject({}),
|
|
160
|
+
toolroll_view_set: z.strictObject({
|
|
161
|
+
theme: z.string().regex(VIEW_THEME_NAME).optional().describe("A built-in theme (terminal, light, dark, high-contrast) or a saved theme's name."),
|
|
162
|
+
save_theme: z.strictObject({
|
|
163
|
+
name: z.string().regex(VIEW_THEME_NAME).describe("Lowercase letters, digits and dashes, at most 32; not a built-in theme's name."),
|
|
164
|
+
base: z.enum(["terminal", "light", "dark", "high-contrast"]),
|
|
165
|
+
colors: viewColors.optional(),
|
|
166
|
+
use: z.boolean().optional().describe("true: switch to it now."),
|
|
167
|
+
}).optional(),
|
|
168
|
+
colors: viewColors.optional().describe("Role colours laid over the theme."),
|
|
169
|
+
density: z.enum(["compact", "comfortable"]).optional(),
|
|
170
|
+
glyphs: z.enum(["unicode", "ascii", "nerd"]).optional(),
|
|
171
|
+
columns: z.array(z.enum(["agent", "step", "age", "cost", "project"])).max(5).optional(),
|
|
172
|
+
list_side: z.enum(["left", "right"]).optional(),
|
|
173
|
+
reduced_motion: z.boolean().optional(),
|
|
174
|
+
key_bar: z.boolean().optional(),
|
|
175
|
+
show_costs: z.boolean().optional(),
|
|
176
|
+
notifications: z.strictObject({ asks: z.boolean().optional(), finished: z.boolean().optional(), failed: z.boolean().optional() }).optional(),
|
|
177
|
+
}),
|
|
152
178
|
};
|
|
153
179
|
export const LEAD_TOOL_READ_INPUTS = {
|
|
154
180
|
...LEAD_TOOL_INPUTS,
|
|
@@ -257,6 +283,8 @@ export const LEAD_TOOL_OUTPUTS = {
|
|
|
257
283
|
propose_agents: proposed("agents", { task: str }),
|
|
258
284
|
propose_answer: proposed("answer", { decision: int, option: str }),
|
|
259
285
|
propose_cancel: proposed("cancel", { task: str }),
|
|
286
|
+
toolroll_view_read: z.looseObject({ settings: z.looseObject({}), allowed: z.looseObject({}), roles: list, themes: z.looseObject({}), guide: str }),
|
|
287
|
+
toolroll_view_set: z.looseObject({ changed: z.array(str), said: str }),
|
|
260
288
|
};
|
|
261
289
|
export function reportToolOutput(surface, tool, schema, body) {
|
|
262
290
|
const read = parseContract(schema, body);
|
package/dist/contracts/route.js
CHANGED
|
@@ -19,6 +19,7 @@ export const taskSizingSchema = z.strictObject({
|
|
|
19
19
|
risky: z.boolean(),
|
|
20
20
|
source: z.enum(["classifier", "heuristic", "person"]),
|
|
21
21
|
reason: limited("size reason", "sizeReason"),
|
|
22
|
+
by: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9 .:/~()_-]{0,79}$/).optional(),
|
|
22
23
|
});
|
|
23
24
|
export const routeOverrideSchema = z.strictObject({ phase, provider, model, by: text, at: text });
|
|
24
25
|
function legSchema(tiers) {
|
package/dist/dispatch.js
CHANGED
|
@@ -35,7 +35,7 @@ export function taskReadinessBlocker(store, taskRef, now) {
|
|
|
35
35
|
const hold = db
|
|
36
36
|
.prepare(`SELECT owner_kind, until, reason FROM hold
|
|
37
37
|
WHERE task_ref = ? AND (until IS NULL OR until > ?)
|
|
38
|
-
ORDER BY held_at, id LIMIT 1`)
|
|
38
|
+
ORDER BY owner_kind = 'backoff', held_at, id LIMIT 1`)
|
|
39
39
|
.get(taskRef, stamp);
|
|
40
40
|
if (hold !== undefined) {
|
|
41
41
|
return {
|
package/dist/dispose.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { STORAGE_HOLD_PREFIX } from "./needs-you.js";
|
|
2
|
+
import { recordAgentSaid } from "./store.js";
|
|
2
3
|
import { blockAfterSignedOut } from "./fallback.js";
|
|
3
4
|
import { authorizeCheckOnly } from "./check-only.js";
|
|
4
5
|
import { proposeNewRoute } from "./route-change.js";
|
|
@@ -29,6 +30,7 @@ const TICK_FAILURE_REASONS = new Set([
|
|
|
29
30
|
"git",
|
|
30
31
|
"commit-failure",
|
|
31
32
|
"provider-init",
|
|
33
|
+
"agent-error",
|
|
32
34
|
"setup",
|
|
33
35
|
"revision-brief",
|
|
34
36
|
"stopped",
|
|
@@ -223,18 +225,22 @@ function disposeBuildOutcomeLocked(context, result) {
|
|
|
223
225
|
recordExecClass(store, runId, result.reason);
|
|
224
226
|
const failureClass = result.reason === "agent-reported"
|
|
225
227
|
? "agent-reported"
|
|
226
|
-
: result.reason === "
|
|
227
|
-
? "
|
|
228
|
-
: result.reason === "no-
|
|
229
|
-
? "no-
|
|
230
|
-
: result.reason === "
|
|
231
|
-
? "
|
|
232
|
-
: result.reason === "
|
|
233
|
-
? "
|
|
234
|
-
: "
|
|
228
|
+
: result.reason === "agent-error"
|
|
229
|
+
? "agent-error"
|
|
230
|
+
: result.reason === "no-handoff"
|
|
231
|
+
? "no-handoff"
|
|
232
|
+
: result.reason === "no-op" || result.reason === "moved-head" || result.reason === "moved-branch"
|
|
233
|
+
? "no-op"
|
|
234
|
+
: result.reason === "timeout" || result.reason === "git" || result.reason === "provider-init" || result.reason === "setup" || result.reason === "stopped" || result.reason === "provider-unattested" || result.reason === "provider-protocol"
|
|
235
|
+
? "retryable-infra"
|
|
236
|
+
: result.reason === "commit-failure"
|
|
237
|
+
? "commit-failure"
|
|
238
|
+
: "unknown";
|
|
235
239
|
if (result.reason !== "agent-reported" && result.message.trim() !== "") {
|
|
236
240
|
store.recordOutcomeFacts(runId, { handoff: result.message });
|
|
237
241
|
}
|
|
242
|
+
if (result.agentSaid !== undefined && result.agentSaid.length > 0)
|
|
243
|
+
recordAgentSaid(store, runId, result.agentSaid);
|
|
238
244
|
if (leaseId === undefined) {
|
|
239
245
|
store.finishRun(runId, { outcome: "failed", reason: result.reason, now: clock() });
|
|
240
246
|
return { kind: "failed", failureClass, disposition: null, strikes: null, sealed: false, closedState: null };
|
package/dist/easy-start.js
CHANGED
|
@@ -2,12 +2,13 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { existsSync, realpathSync } from "node:fs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { requestLocalLink } from "./console-instance.js";
|
|
5
|
+
import { instanceSocketTooLong, requestLocalLink } from "./console-instance.js";
|
|
6
6
|
import { backgroundInstalled, backgroundOn, startInstalledService } from "./laptop-background.js";
|
|
7
7
|
import { proveConsoleReadOnly } from "./quick-start.js";
|
|
8
8
|
import { backgroundAsked, installationCreatedBy, localModeCandidate, localModeOf, openStore, openStoreReadOnly, recordBackgroundAsked } from "./store.js";
|
|
9
9
|
import { underAgent } from "./prompt.js";
|
|
10
10
|
import { savedLoginFile } from "./login-secrets.js";
|
|
11
|
+
const PROVE_EVERY_MS = 50;
|
|
11
12
|
export { easyStartApplies, easyStartArgs } from "./easy-start-args.js";
|
|
12
13
|
export const SIGN_IN_HANDOFF_MS = 60_000;
|
|
13
14
|
const EXIT = { ok: 0, failed: 1, usage: 2, refused: 3 };
|
|
@@ -32,6 +33,15 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
32
33
|
write(`Toolroll can't open: ${first.message}.`);
|
|
33
34
|
return EXIT.refused;
|
|
34
35
|
}
|
|
36
|
+
const refusedTooDeep = () => {
|
|
37
|
+
if (first.ok || (args.web && !seams.serviceInstalled()))
|
|
38
|
+
return false;
|
|
39
|
+
const deep = seams.socketProblem();
|
|
40
|
+
if (deep === null)
|
|
41
|
+
return false;
|
|
42
|
+
write(`Toolroll can't start: ${deep}.`);
|
|
43
|
+
return true;
|
|
44
|
+
};
|
|
35
45
|
const joinRepo = async () => {
|
|
36
46
|
if (mode !== "start")
|
|
37
47
|
return EXIT.ok;
|
|
@@ -47,6 +57,8 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
47
57
|
};
|
|
48
58
|
let local = seams.localMode();
|
|
49
59
|
if ((local === "candidate" || local === "absent") && !first.ok && first.state === "none") {
|
|
60
|
+
if (refusedTooDeep())
|
|
61
|
+
return EXIT.refused;
|
|
50
62
|
const sandbox = await seams.sandbox();
|
|
51
63
|
if (sandbox.missing.length > 0) {
|
|
52
64
|
const { missingSandboxToolsWords } = await import("./sandbox-runtime.js");
|
|
@@ -59,6 +71,8 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
59
71
|
}
|
|
60
72
|
if (local === "candidate")
|
|
61
73
|
local = "off";
|
|
74
|
+
if (local !== "off" && refusedTooDeep())
|
|
75
|
+
return EXIT.refused;
|
|
62
76
|
if (local === "off") {
|
|
63
77
|
if (seams.passwordByLaptopStart())
|
|
64
78
|
write(START_OVER_POINTER);
|
|
@@ -103,12 +117,13 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
103
117
|
stopOwned(child);
|
|
104
118
|
return { ok: false, state: "refused", message: "it didn't answer in time" };
|
|
105
119
|
}
|
|
106
|
-
await sleep(
|
|
120
|
+
await sleep(PROVE_EVERY_MS);
|
|
107
121
|
}
|
|
108
122
|
};
|
|
109
123
|
let proof = first;
|
|
110
124
|
if (!proof.ok) {
|
|
111
|
-
|
|
125
|
+
if (globalThis[Symbol.for("toolroll.starting-said")] !== true)
|
|
126
|
+
write("Starting Toolroll…");
|
|
112
127
|
proof = seams.serviceInstalled() ? await seams.startService() : await startOwned();
|
|
113
128
|
if (!proof.ok) {
|
|
114
129
|
write(`Toolroll didn't start: ${proof.message}.`);
|
|
@@ -244,6 +259,7 @@ export function defaultEasyStartSeams(options) {
|
|
|
244
259
|
cwd,
|
|
245
260
|
write: options.write,
|
|
246
261
|
prove: () => proveConsoleReadOnly(file, options.build),
|
|
262
|
+
socketProblem: () => instanceSocketTooLong(file),
|
|
247
263
|
localMode: () => localModeRead(file),
|
|
248
264
|
initLocal: async () => (await import("./operate.js")).easyStartInitLocalMode(file, {
|
|
249
265
|
stdin: process.stdin.isTTY === true, stdout: process.stdout.isTTY === true, agent: underAgent(process.env), json: false,
|