toolroll 0.9.109 → 0.9.111
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 +73 -0
- package/README.md +5 -1
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/agent-detect.js +244 -0
- package/dist/agent-fence.js +12 -1
- package/dist/agent-said-schema.js +4 -0
- package/dist/agent-said.js +23 -0
- package/dist/agentconfig.js +2 -2
- package/dist/approval-summary.js +375 -0
- package/dist/attest.js +2 -2
- package/dist/browser/THIRD_PARTY_NOTICES.txt +30 -0
- package/dist/browser/workspace.css +2 -2
- package/dist/browser/workspace.js +27 -27
- package/dist/builder.js +42 -3
- package/dist/chat-actions.js +24 -17
- package/dist/chat-core.js +3 -1
- package/dist/chat-decide.js +101 -46
- package/dist/chat-delivery-state.js +2 -0
- package/dist/chat-delivery.js +3 -2
- package/dist/chat-live.js +2 -1
- package/dist/chat-task-actions.js +6 -0
- package/dist/check-report.js +1 -1
- package/dist/claim.js +28 -13
- package/dist/cli-help.js +1 -1
- package/dist/cli.js +2 -0
- package/dist/codex-limits.js +21 -8
- package/dist/console-instance.js +11 -1
- package/dist/contracts/console-api.js +13 -7
- package/dist/contracts/engine-api.js +283 -0
- package/dist/contracts/route.js +1 -0
- package/dist/coordinator.js +2 -2
- package/dist/discord-api.js +4 -3
- package/dist/discord-chat.js +3 -1
- package/dist/dispatch.js +1 -1
- package/dist/dispose.js +15 -9
- package/dist/easy-start-args.js +7 -3
- package/dist/easy-start.js +40 -1
- package/dist/egress.js +72 -10
- package/dist/engine-handoff.js +34 -0
- package/dist/engine-reads.js +338 -0
- package/dist/eval-world.js +3 -2
- package/dist/evidence.js +2 -0
- package/dist/fast-start.js +68 -18
- package/dist/fast-terms.js +2 -2
- package/dist/first-run.js +10 -2
- package/dist/flexible-agents.js +234 -0
- package/dist/flexible-answers-schema.js +61 -0
- package/dist/flexible-answers.js +889 -0
- package/dist/flexible-custody.js +494 -0
- package/dist/flexible-import.js +782 -0
- package/dist/flexible-launch-schema.js +72 -0
- package/dist/flexible-launch.js +331 -0
- package/dist/flexible-launcher.js +88 -0
- package/dist/flexible-levels.js +34 -0
- package/dist/flexible-merge-guard.js +47 -0
- package/dist/flexible-refs.js +47 -0
- package/dist/flexible-relay-cancel.js +19 -0
- package/dist/flexible-relay-schema.js +55 -0
- package/dist/flexible-relay-upstreams.js +36 -0
- package/dist/flexible-relay.js +1032 -0
- package/dist/flexible-session.js +732 -0
- package/dist/flexible-ship-schema.js +81 -0
- package/dist/flexible-ship.js +694 -0
- package/dist/flexible-start.js +80 -0
- package/dist/flexible-thread.js +175 -25
- package/dist/flexible-turns-schema.js +69 -0
- package/dist/flexible-turns.js +490 -0
- package/dist/flexible.js +10 -1
- package/dist/flow-actions.js +6 -4
- package/dist/flow-steps.js +1 -1
- package/dist/flows-cli.js +2 -1
- package/dist/git-views.js +6 -3
- package/dist/install-mode.js +225 -0
- package/dist/integrations.js +6 -1
- package/dist/lead-doors.js +7 -1
- package/dist/limits-ui.js +7 -0
- package/dist/live-reply.js +6 -0
- package/dist/live-terminal.js +425 -29
- package/dist/local-owner.js +7 -0
- package/dist/model-choices.js +12 -6
- package/dist/needs-you.js +2 -0
- package/dist/notification-delivery.js +11 -0
- package/dist/operate.js +128 -37
- package/dist/outbound-privacy.js +204 -0
- package/dist/passwordless.js +2 -1
- package/dist/phase-routing.js +3 -1
- package/dist/plane-review.js +1 -1
- package/dist/project-delete.js +14 -0
- package/dist/proposal.js +2 -2
- package/dist/provider-connection.js +19 -5
- package/dist/publish.js +5 -0
- package/dist/pull-request-flow.js +26 -7
- package/dist/push.js +5 -1
- package/dist/release-card.js +11 -3
- package/dist/release.js +10 -1
- package/dist/route-store.js +3 -3
- package/dist/sandbox-launch.js +32 -8
- package/dist/sandbox-runtime.js +16 -7
- package/dist/sandbox-tools.js +176 -0
- package/dist/scope.js +12 -36
- package/dist/scout-net.js +7 -2
- package/dist/serve.js +62 -13
- package/dist/server/chrome.js +3 -1
- package/dist/server/console.css +33 -6
- package/dist/server/engine-api.js +378 -0
- package/dist/server/flows.js +2 -2
- package/dist/server/http.js +7 -0
- package/dist/server/link-redemption.js +52 -0
- package/dist/server/mutation-key.js +21 -7
- package/dist/server/pages.js +72 -40
- package/dist/server/people-tokens.js +17 -41
- package/dist/server/render-chat.js +1 -0
- package/dist/server/render-new-task.js +3 -3
- package/dist/server/render-results.js +4 -4
- package/dist/server/render-tasks.js +133 -139
- package/dist/server/route-table.js +32 -1
- package/dist/server/settings-section-table.js +6 -0
- package/dist/server/settings-sections.js +69 -0
- package/dist/server/settings.js +120 -10
- package/dist/server/task-views.js +8 -2
- package/dist/server/tasks.js +56 -12
- package/dist/server/terminals.js +181 -28
- package/dist/server/welcome.js +35 -10
- package/dist/settings-groups-ui.js +2 -2
- package/dist/settings-proofs.js +14 -9
- package/dist/slack-api.js +4 -3
- package/dist/slack-chat.js +5 -3
- package/dist/spend.js +46 -12
- package/dist/status-probe.js +343 -0
- package/dist/store.js +181 -12
- package/dist/task-sizing-schema.js +14 -0
- package/dist/task-sizing.js +76 -10
- package/dist/teams-api.js +4 -3
- package/dist/teams-chat.js +4 -2
- package/dist/telegram-lead.js +2 -1
- package/dist/telegram-live.js +2 -1
- package/dist/telegram-team.js +2 -1
- package/dist/telegram.js +17 -5
- package/dist/toolroll-update.js +3 -1
- package/dist/trusted-path.js +162 -0
- 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/tui-launch.js +282 -0
- package/dist/tui-source.js +5 -3
- package/dist/tui.js +1 -1
- package/dist/webhooks.js +14 -4
- package/dist/welcome-facts.js +22 -15
- package/dist/work-index.js +2 -2
- package/dist/workspace-ui.js +5 -0
- package/package.json +1 -1
- package/scripts/crash-canary.mjs +1 -1
- package/scripts/pilot.mjs +1 -1
- package/scripts/provider-canary.mjs +5 -3
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { resolveScopeProfile } from "./agentconfig.js";
|
|
3
|
+
import { isProtectedWork } from "./approval-policy.js";
|
|
4
|
+
import { permissionPlainWords, scopeFullAccess } from "./chat-terms.js";
|
|
5
|
+
import { checkAccessWords } from "./check-access.js";
|
|
6
|
+
import { networkWords, unaccountedHosts } from "./egress.js";
|
|
7
|
+
import { agentModelName } from "./model-names.js";
|
|
8
|
+
import { makesNoPlan, NO_READINESS, PLANNED_FIRST_REASON, projectRoute, routeFromJson, sizeWords } from "./phase-routing.js";
|
|
9
|
+
import { sandboxTermsWords } from "./project-sandbox.js";
|
|
10
|
+
import { qualityModeTitle } from "./quality.js";
|
|
11
|
+
import { approvalOf, chainTermsLines, describeApproval, liveChainFromJson, releaseAsksAgainWords, releaseCheckSentence, releaseTermsSentence } from "./scope.js";
|
|
12
|
+
import { writesWords } from "./writes-mode.js";
|
|
13
|
+
export const NO_CONTEXT = { usual: null, revision: null, rules: null };
|
|
14
|
+
export const USUAL_LABEL = "Your usual project settings";
|
|
15
|
+
const OTHER_LABEL = "Other settings";
|
|
16
|
+
export const EVIDENCE_WORDS = { check: "runs automatically", screenshot: "shown in a screenshot", "changed-path": "seen in the changed files", "manual-review": "you review it" };
|
|
17
|
+
export const REPAIR_BRIEF = / — (repair exactly the unmet criteria named below; a comment cannot widen the scope\. Unmet: ([^.]+)\.|Collect only the missing observations for ([^.]+)\. .*|Diagnose the saved failed project check and repair within the original scope\. .*)$/s;
|
|
18
|
+
const money = (micro) => `$${(micro / 1_000_000).toFixed(2)}`;
|
|
19
|
+
const minutes = (seconds) => `${Math.round(seconds / 60)} min`;
|
|
20
|
+
const lowerFirst = (text) => text.charAt(0).toLowerCase() + text.slice(1);
|
|
21
|
+
const plural = (n, one) => `${n} ${one}${n === 1 ? "" : "s"}`;
|
|
22
|
+
const VERB = { plan: "plans", build: "builds", repair: "fixes", review: "reviews" };
|
|
23
|
+
const ROLE = { plan: "planner", build: "builder", repair: "fixer", review: "reviewer" };
|
|
24
|
+
const PERMISSION_KEYS = ["permissionArgv", "approvalArgv", "sandboxMode", "permission"];
|
|
25
|
+
function agentWords(route, profile) {
|
|
26
|
+
if (route === null) {
|
|
27
|
+
if (profile == null)
|
|
28
|
+
return null;
|
|
29
|
+
return `${agentModelName(profile.provider, profile.model)} builds and fixes`;
|
|
30
|
+
}
|
|
31
|
+
const unplanned = makesNoPlan(route.size, route.risk);
|
|
32
|
+
const groups = [];
|
|
33
|
+
const asked = [];
|
|
34
|
+
for (const leg of route.legs) {
|
|
35
|
+
const name = agentModelName(leg.provider, leg.model);
|
|
36
|
+
if (unplanned && leg.phase === "plan" && leg.chosen === "recommended") {
|
|
37
|
+
asked.push(`${name} plans only if you ask for a plan`);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const group = groups.find(one => one.name === name);
|
|
41
|
+
if (group === undefined)
|
|
42
|
+
groups.push({ name, verbs: [VERB[leg.phase]] });
|
|
43
|
+
else
|
|
44
|
+
group.verbs.push(VERB[leg.phase]);
|
|
45
|
+
}
|
|
46
|
+
const list = (verbs) => verbs.length <= 1 ? verbs.join("") : `${verbs.slice(0, -1).join(", ")} and ${verbs.at(-1)}`;
|
|
47
|
+
const who = [...groups.map(one => `${one.name} ${list(one.verbs)}`), ...asked].join("; ");
|
|
48
|
+
const size = sizeWords(route);
|
|
49
|
+
return size === null ? who : `${who} (${lowerFirst(size)})`;
|
|
50
|
+
}
|
|
51
|
+
function timeWords(profile) {
|
|
52
|
+
if ("idleTimeoutSeconds" in profile)
|
|
53
|
+
return `${minutes(profile.timeoutSeconds)}, or ${minutes(profile.idleTimeoutSeconds)} silent`;
|
|
54
|
+
return `${minutes(profile.timeoutSeconds)} ${profile.timeoutKind === "idle" ? "without progress" : "per attempt"}`;
|
|
55
|
+
}
|
|
56
|
+
function usualSummaryOf(usual, profile) {
|
|
57
|
+
const has = (label) => usual.find(one => one.label === label);
|
|
58
|
+
const parts = [];
|
|
59
|
+
if (profile !== null && has("Reads") !== undefined && profile.fencePolicy === 2 && has("Project checks")?.words === checkAccessWords("sandboxed"))
|
|
60
|
+
parts.push("sandboxed");
|
|
61
|
+
if (profile !== null && has("Writes") !== undefined && profile.writes === "workspace")
|
|
62
|
+
parts.push("writes only its checkout");
|
|
63
|
+
const checks = has("Checks");
|
|
64
|
+
if (checks !== undefined)
|
|
65
|
+
parts.push(`${checks.words} checks`);
|
|
66
|
+
return parts.join(", ");
|
|
67
|
+
}
|
|
68
|
+
function limitWords(profile) {
|
|
69
|
+
if ("idleTimeoutSeconds" in profile)
|
|
70
|
+
return `stops after ${minutes(profile.timeoutSeconds)}, or ${minutes(profile.idleTimeoutSeconds)} silent`;
|
|
71
|
+
const time = `${minutes(profile.timeoutSeconds)} ${profile.timeoutKind === "idle" ? "without progress" : "per attempt"}`;
|
|
72
|
+
return typeof profile.maxTurns === "number" ? `stops after ${profile.maxTurns} turns or ${time}` : `stops after ${time}`;
|
|
73
|
+
}
|
|
74
|
+
function fixWords(profile) {
|
|
75
|
+
const model = profile.repairModel === "inherit" ? "the same model" : profile.repairModel;
|
|
76
|
+
if ("repairIdleTimeoutSeconds" in profile)
|
|
77
|
+
return `on ${model}, up to ${minutes(profile.repairTimeoutSeconds)}, or ${minutes(profile.repairIdleTimeoutSeconds)} silent`;
|
|
78
|
+
return typeof profile.repairMaxTurns === "number"
|
|
79
|
+
? `on ${model}, up to ${profile.repairMaxTurns} turns and ${minutes(profile.repairTimeoutSeconds)}`
|
|
80
|
+
: `on ${model}, up to ${minutes(profile.repairTimeoutSeconds)}`;
|
|
81
|
+
}
|
|
82
|
+
const SETTINGS = [
|
|
83
|
+
{ label: "Writes", fields: ["writes"], words: profile => writesWords(profile.writes), routine: profile => profile.writes === "workspace" },
|
|
84
|
+
{ label: "Reads", fields: ["fencePolicy", "readDeny"], words: profile => sandboxTermsWords(profile).reads, routine: () => true },
|
|
85
|
+
{ label: "Time limit", fields: ["maxTurns", "timeoutSeconds", "timeoutKind", "idleTimeoutSeconds"], words: limitWords, routine: () => true },
|
|
86
|
+
{ label: "Fixes", fields: ["repairModel", "repairMaxTurns", "repairTimeoutSeconds", "repairIdleTimeoutSeconds"], words: fixWords, routine: () => true },
|
|
87
|
+
];
|
|
88
|
+
const valueOf = (profile, keys) => JSON.stringify(keys.map(key => profile[key] ?? null));
|
|
89
|
+
function releaseAuthorityWords(release) {
|
|
90
|
+
return `Repository ${release.repo}, branch ${release.branch} into ${release.base}, check grant ${release.grant.id}, ${release.access === "sandboxed" ? "checks in the sandbox" : `checks outside the sandbox (${release.access})`}.`;
|
|
91
|
+
}
|
|
92
|
+
const ACCESS_GROUPS = [
|
|
93
|
+
{ name: "network", fields: ["network"], words: profile => lowerFirst(networkWords(profile.network ?? null, profile.provider).replace(/^Network: /, "")) },
|
|
94
|
+
{ name: "tools", fields: PERMISSION_KEYS, words: profile => permissionPlainWords(profile) ?? "not known" },
|
|
95
|
+
{ name: "writes", fields: ["writes"], words: profile => writesWords(profile.writes) },
|
|
96
|
+
{ name: "reads", fields: ["fencePolicy", "readDeny"], words: profile => sandboxTermsWords(profile).reads },
|
|
97
|
+
{ name: "project checks", fields: ["checkAccess"], words: profile => checkAccessWords(profile.checkAccess ?? "sandboxed") },
|
|
98
|
+
{ name: "macOS services", fields: ["machLookup"], words: profile => sandboxTermsWords(profile).mach ?? "none beyond the sandbox's" },
|
|
99
|
+
{ name: "time limit", fields: ["maxTurns", "timeoutSeconds", "timeoutKind", "idleTimeoutSeconds"], words: limitWords },
|
|
100
|
+
{ name: "fixes", fields: ["repairModel", "repairMaxTurns", "repairTimeoutSeconds", "repairIdleTimeoutSeconds"], words: fixWords },
|
|
101
|
+
];
|
|
102
|
+
const rawOf = (value) => value === undefined ? "none" : typeof value === "string" ? value : JSON.stringify(value);
|
|
103
|
+
function changeOf(label, was, now, fields, words) {
|
|
104
|
+
const differing = fields.filter(field => JSON.stringify(was[field] ?? null) !== JSON.stringify(now[field] ?? null));
|
|
105
|
+
if (differing.length === 0)
|
|
106
|
+
return null;
|
|
107
|
+
const before = words(was), after = words(now);
|
|
108
|
+
if (before !== after)
|
|
109
|
+
return { label, was: before, now: after };
|
|
110
|
+
return { label, was: differing.map(field => `${field} ${rawOf(was[field])}`).join(", "), now: differing.map(field => `${field} ${rawOf(now[field])}`).join(", ") };
|
|
111
|
+
}
|
|
112
|
+
function profileChanges(before, next, prefix = "") {
|
|
113
|
+
return ACCESS_GROUPS.flatMap(group => {
|
|
114
|
+
const change = changeOf(`${prefix}${group.name}`, before, next, group.fields, one => group.words(one));
|
|
115
|
+
return change === null ? [] : [change];
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function fallbackDifferences(scope) {
|
|
119
|
+
const chain = liveChainFromJson(scope.proposedChainJson ?? null);
|
|
120
|
+
if (chain === null)
|
|
121
|
+
return [];
|
|
122
|
+
return chain.slice(1).map((entry, at) => {
|
|
123
|
+
const differs = profileChanges(chain[0].profile, entry.profile);
|
|
124
|
+
return differs.length === 0 ? `Fallback ${at + 2} has the same access and limits as the first.`
|
|
125
|
+
: `Fallback ${at + 2} differs from the first: ${differs.map(one => `${one.label}: ${one.now} (the first: ${one.was})`).join("; ")}.`;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
export function revisionParts(facts) {
|
|
129
|
+
const notes = [];
|
|
130
|
+
if (!facts.hadPlan)
|
|
131
|
+
notes.push("The earlier version had no plan, so nothing was copied.");
|
|
132
|
+
else if (facts.changed !== null && facts.changed.length === 0)
|
|
133
|
+
notes.push("It keeps the same limits.");
|
|
134
|
+
else if (facts.changed !== null)
|
|
135
|
+
notes.push(`${facts.changed.length === 1 ? "One limit changes" : `${facts.changed.length} limits change`} from that build: ${facts.changed.map(one => one.label).join(", ")}.`);
|
|
136
|
+
if (facts.repair !== null && facts.problem === null) {
|
|
137
|
+
notes.push(facts.repair.cap !== null && (facts.repair.remaining ?? 0) > 0
|
|
138
|
+
? `${plural(facts.repair.remaining, "more attempt")} can run without asking you.`
|
|
139
|
+
: "Each extra attempt asks you first.");
|
|
140
|
+
}
|
|
141
|
+
return { lead: facts.sourceRun === null ? `This revises ${facts.sourceTask}.` : `This revises build #${facts.sourceRun}.`, notes };
|
|
142
|
+
}
|
|
143
|
+
export function revisionWords(facts) {
|
|
144
|
+
const parts = revisionParts(facts);
|
|
145
|
+
return [parts.lead, ...parts.notes].join(" ");
|
|
146
|
+
}
|
|
147
|
+
export function revisionChangeRows(facts) {
|
|
148
|
+
return (facts?.changed ?? []).map(one => ({ label: `${one.label.charAt(0).toUpperCase()}${one.label.slice(1)}`, words: `was ${one.was}, now ${one.now}`, fields: [] }));
|
|
149
|
+
}
|
|
150
|
+
export function approvalSummaryOf(scope, context = NO_CONTEXT) {
|
|
151
|
+
const profile = scope.profile ?? null;
|
|
152
|
+
const route = routeFromJson(scope.proposedRouteJson ?? null);
|
|
153
|
+
const usualProfile = context.usual?.profile ?? null;
|
|
154
|
+
const decisions = [];
|
|
155
|
+
const differs = [];
|
|
156
|
+
const warnings = [];
|
|
157
|
+
const usual = [];
|
|
158
|
+
decisions.push({ label: "Goal", words: scope.goal, fields: ["goal"] });
|
|
159
|
+
if (scope.outOfScope !== null)
|
|
160
|
+
decisions.push({ label: "Won’t touch", words: scope.outOfScope, fields: ["outOfScope"] });
|
|
161
|
+
const reviewOnly = scope.acceptance.length === 1 && scope.acceptance[0].statement.trim() === scope.goal.trim()
|
|
162
|
+
&& scope.acceptance[0].evidence.length === 1 && scope.acceptance[0].evidence[0] === "manual-review";
|
|
163
|
+
decisions.push(scope.acceptance.length === 0
|
|
164
|
+
? { label: "Done when", words: "You decide when you review the result.", fields: ["acceptance"] }
|
|
165
|
+
: reviewOnly ? { label: "Done when", words: "You review the result", fields: ["acceptance"] }
|
|
166
|
+
: { label: "Done when", words: `${scope.acceptance[0].statement} (${scope.acceptance[0].evidence.map(kind => EVIDENCE_WORDS[kind] ?? kind).join(", ")})`,
|
|
167
|
+
lines: scope.acceptance.slice(1).map(one => `${one.statement} (${one.evidence.map(kind => EVIDENCE_WORDS[kind] ?? kind).join(", ")})`), fields: ["acceptance"] });
|
|
168
|
+
if (scope.candidate)
|
|
169
|
+
decisions.push({ label: "Commit", words: `${scope.candidate}, checked out as it is; no agent runs`, fields: ["candidate"] });
|
|
170
|
+
const agent = agentWords(route, profile);
|
|
171
|
+
if (agent !== null)
|
|
172
|
+
decisions.push({ label: "Agent", words: agent, fields: [...(route === null ? [] : ["route", ...route.legs.map(leg => `route.${leg.phase}`)]), ...(profile === null ? [] : ["profile.provider", "profile.model"])] });
|
|
173
|
+
const sized = route?.size ?? null;
|
|
174
|
+
if (sized !== null && sized.source === "classifier" && sized.by !== undefined)
|
|
175
|
+
decisions.push({ label: "Sized by", words: sized.by, fields: ["route"] });
|
|
176
|
+
const permissionKey = profile === null ? null : PERMISSION_KEYS.find(key => key in profile) ?? null;
|
|
177
|
+
const tools = permissionPlainWords(profile);
|
|
178
|
+
const usualTools = usualProfile === null ? null : permissionPlainWords(usualProfile);
|
|
179
|
+
decisions.push({ label: "Files", words: scope.touches.length === 0 ? "any file in the project" : `only ${scope.touches.join(", ")}`, fields: ["touches"] });
|
|
180
|
+
if (profile !== null) {
|
|
181
|
+
const network = profile.network ?? null;
|
|
182
|
+
const wide = network !== null && (network.mode === "open" || network.loopback === "any" || unaccountedHosts(network, profile.provider).length > 0);
|
|
183
|
+
decisions.push({ label: "Network", words: lowerFirst(networkWords(network, profile.provider).replace(/^Network: /, "")), fields: ["profile.network"], ...(wide ? { risky: true } : {}) });
|
|
184
|
+
}
|
|
185
|
+
if (tools !== null) {
|
|
186
|
+
decisions.push({ label: "Tools", words: `${tools}${usualTools !== null && usualTools !== tools ? " (not the project’s usual)" : ""}`,
|
|
187
|
+
fields: permissionKey === null ? [] : [`profile.${permissionKey}`], ...(scopeFullAccess(profile) ? { risky: true } : {}) });
|
|
188
|
+
}
|
|
189
|
+
decisions.push({ label: "May cost", words: scope.budgetMicrousd === null ? `No spend cap · stops at its time limit${profile === null ? "" : ` (${timeWords(profile)})`}` : `up to ${money(scope.budgetMicrousd)} per attempt; the agent is stopped there`,
|
|
190
|
+
fields: ["budget"], ...(scope.budgetMicrousd === null ? { risky: true } : {}) });
|
|
191
|
+
if (scope.releaseTerms != null) {
|
|
192
|
+
const terms = scope.releaseTerms;
|
|
193
|
+
decisions.push({ label: "Release", words: releaseTermsSentence(terms), lines: terms.policy.carry ? releaseAsksAgainWords(terms)
|
|
194
|
+
: [releaseAuthorityWords(terms) + ` Until ${terms.expiresAt}.`], fields: ["releaseTerms"] });
|
|
195
|
+
}
|
|
196
|
+
if (scope.releaseCheck != null)
|
|
197
|
+
decisions.push({ label: "Release", words: releaseCheckSentence(scope.releaseCheck), lines: [releaseAuthorityWords(scope.releaseCheck)], fields: ["releaseCheck"] });
|
|
198
|
+
const byHand = route === null ? [] : route.legs.filter(leg => leg.chosen !== "recommended");
|
|
199
|
+
if (byHand.length > 0)
|
|
200
|
+
differs.push({ label: "Your pick", words: `${byHand.map(leg => `${ROLE[leg.phase]} ${agentModelName(leg.provider, leg.model)}`).join("; ")}, not the project’s usual pick`, fields: ["route"] });
|
|
201
|
+
const quality = scope.qualityMode ?? "default";
|
|
202
|
+
const qualityRow = { label: "Checks", words: qualityModeTitle(quality), fields: ["qualityMode"] };
|
|
203
|
+
if (context.usual !== null && quality !== context.usual.qualityMode)
|
|
204
|
+
differs.push({ ...qualityRow, words: `${qualityRow.words} (usually ${qualityModeTitle(context.usual.qualityMode)})` });
|
|
205
|
+
else
|
|
206
|
+
usual.push(qualityRow);
|
|
207
|
+
if (profile !== null) {
|
|
208
|
+
for (const setting of SETTINGS) {
|
|
209
|
+
const row = { label: setting.label, words: setting.words(profile), fields: setting.fields.filter(key => key in profile).map(key => `profile.${key}`) };
|
|
210
|
+
if (usualProfile !== null && valueOf(profile, setting.fields) !== valueOf(usualProfile, setting.fields))
|
|
211
|
+
differs.push({ ...row, words: `${row.words} (usually ${setting.words(usualProfile)})`, ...(setting.routine(profile) ? {} : { risky: true }) });
|
|
212
|
+
else if (!setting.routine(profile))
|
|
213
|
+
differs.push({ ...row, risky: true });
|
|
214
|
+
else
|
|
215
|
+
usual.push(row);
|
|
216
|
+
}
|
|
217
|
+
if (profile.checkAccess !== undefined)
|
|
218
|
+
warnings.push({ words: `Project checks: ${checkAccessWords(profile.checkAccess)}.`, fields: ["profile.checkAccess"] });
|
|
219
|
+
else
|
|
220
|
+
usual.push({ label: "Project checks", words: checkAccessWords("sandboxed"), fields: [] });
|
|
221
|
+
const mach = sandboxTermsWords(profile).mach;
|
|
222
|
+
if (mach !== null)
|
|
223
|
+
warnings.push({ words: `It ${mach}.`, fields: ["profile.machLookup"] });
|
|
224
|
+
}
|
|
225
|
+
const chain = chainTermsLines(scope);
|
|
226
|
+
if (chain.length > 0)
|
|
227
|
+
warnings.push({ words: [...chain, ...fallbackDifferences(scope)].join(" "), fields: ["chain"] });
|
|
228
|
+
if (sized !== null && route !== null && sized.source === "heuristic" && sized.reason === PLANNED_FIRST_REASON && !makesNoPlan(sized, route.risk)) {
|
|
229
|
+
warnings.push({ words: "Planned first: task sizing is off (Settings → General)", fields: ["route"] });
|
|
230
|
+
}
|
|
231
|
+
const rules = context.rules;
|
|
232
|
+
if (rules !== null && isProtectedWork(rules, [...scope.touches]))
|
|
233
|
+
warnings.push({ words: "This project protects this work: two people must approve it.", fields: [] });
|
|
234
|
+
if (rules?.notRequester === true)
|
|
235
|
+
warnings.push({ words: "The person who asked for this can’t approve it.", fields: [] });
|
|
236
|
+
const revision = context.revision === null ? null : revisionWords(context.revision);
|
|
237
|
+
const revisionNotes = context.revision === null ? [] : revisionParts(context.revision).notes;
|
|
238
|
+
const revisionChanges = revisionChangeRows(context.revision);
|
|
239
|
+
if (context.revision?.problem != null)
|
|
240
|
+
warnings.push({ words: `Toolroll can’t check what this revises (${context.revision.problem}), so no fix runs on its own.`, fields: [] });
|
|
241
|
+
const usualLabel = context.usual === null ? OTHER_LABEL : USUAL_LABEL;
|
|
242
|
+
const usualSummary = usualSummaryOf(usual, profile);
|
|
243
|
+
const key = createHash("sha256").update(JSON.stringify({ v: 3, digest: scope.digest, revision, revisionChanges, decisions, differs, warnings, usual, usualLabel, usualSummary, baseline: context.usual }), "utf8").digest("hex").slice(0, 32);
|
|
244
|
+
const why = context.evidence == null || context.evidence === "" ? null : context.evidence.replace(/^Why this model: /, "");
|
|
245
|
+
return { revision, revisionNotes, revisionChanges, decisions, why, differs, warnings, usual, usualLabel, usualSummary, key };
|
|
246
|
+
}
|
|
247
|
+
export function summaryFields(summary) {
|
|
248
|
+
return new Set([...summary.decisions, ...summary.differs, ...summary.usual, ...summary.warnings].flatMap(one => one.fields));
|
|
249
|
+
}
|
|
250
|
+
export function boundFieldsOf(scope) {
|
|
251
|
+
const fields = ["goal", "touches", "acceptance", "budget", "qualityMode"];
|
|
252
|
+
if (scope.outOfScope !== null)
|
|
253
|
+
fields.push("outOfScope");
|
|
254
|
+
if (scope.candidate)
|
|
255
|
+
fields.push("candidate");
|
|
256
|
+
if (scope.releaseTerms != null)
|
|
257
|
+
fields.push("releaseTerms");
|
|
258
|
+
if (scope.releaseCheck != null)
|
|
259
|
+
fields.push("releaseCheck");
|
|
260
|
+
const route = routeFromJson(scope.proposedRouteJson ?? null);
|
|
261
|
+
if (route !== null)
|
|
262
|
+
fields.push("route", ...route.legs.map(leg => `route.${leg.phase}`));
|
|
263
|
+
if (chainTermsLines(scope).length > 0)
|
|
264
|
+
fields.push("chain");
|
|
265
|
+
for (const key of Object.keys(scope.profile ?? {}))
|
|
266
|
+
fields.push(`profile.${key}`);
|
|
267
|
+
return fields;
|
|
268
|
+
}
|
|
269
|
+
export function summaryLines(summary) {
|
|
270
|
+
const pad = (label) => ` ${label.padEnd(12)} `;
|
|
271
|
+
const indent = " ".repeat(15);
|
|
272
|
+
const row = (one) => [`${pad(one.label)}${one.words}`, ...(one.lines ?? []).map(line => `${indent}${line}`)];
|
|
273
|
+
return [
|
|
274
|
+
...(summary.revision === null ? [] : [`${pad("Revision")}${summary.revision}`]),
|
|
275
|
+
...summary.revisionChanges.map(one => `${pad("Changed")}${one.label.toLowerCase()}: ${one.words}`),
|
|
276
|
+
...summary.decisions.flatMap(row),
|
|
277
|
+
...(summary.why === null ? [] : [`${pad("Why model")}${summary.why}`]),
|
|
278
|
+
...summary.differs.flatMap(row),
|
|
279
|
+
...summary.warnings.map(one => `${pad("Note")}${one.words}`),
|
|
280
|
+
...(summary.usual.length === 0 ? [] : [`${pad("Usual")}${summary.usualSummary === "" ? summary.usualLabel : `${summary.usualLabel}: ${summary.usualSummary}`}`,
|
|
281
|
+
...summary.usual.filter(one => !saidInUsualSummary(one, summary.usualSummary)).map(one => `${indent}${one.label}: ${one.words}`)]),
|
|
282
|
+
];
|
|
283
|
+
}
|
|
284
|
+
export function summaryText(summary, omit = () => false) {
|
|
285
|
+
return [
|
|
286
|
+
...(summary.revision === null ? [] : [summary.revision, ...summary.revisionChanges.map(one => `${one.label}: ${one.words}`), ""]),
|
|
287
|
+
...summary.warnings.map(one => one.words),
|
|
288
|
+
...(summary.warnings.length === 0 ? [] : [""]),
|
|
289
|
+
...[...summary.decisions.filter(one => !omit(one)), ...(summary.why === null ? [] : [{ label: "Why model", words: summary.why }]), ...summary.differs].flatMap((one) => [`${one.label}: ${one.words}`, ...(one.lines ?? []).map(line => ` ${line}`)]),
|
|
290
|
+
...(summary.usual.length === 0 ? [] : ["", `${summary.usualLabel}: ${summary.usual.map(one => `${lowerFirst(one.label)} ${one.words}`).join(" · ")}`]),
|
|
291
|
+
].join("\n");
|
|
292
|
+
}
|
|
293
|
+
export function describeScope(scope, readiness = NO_READINESS, evidence = null, context = null) {
|
|
294
|
+
const route = routeFromJson(scope.proposedRouteJson ?? null);
|
|
295
|
+
const halted = route !== null && projectRoute(route, readiness).halted;
|
|
296
|
+
return [
|
|
297
|
+
...summaryLines(approvalSummaryOf(scope, { ...(context ?? NO_CONTEXT), evidence })),
|
|
298
|
+
...(halted ? [" Note An agent here is reported unavailable: nothing runs until it is back or you change the agent."] : []),
|
|
299
|
+
` version ${scope.digest.slice(0, 8)} (the full plan version is in --json)`,
|
|
300
|
+
` approved ${describeApproval(approvalOf(scope))}`,
|
|
301
|
+
];
|
|
302
|
+
}
|
|
303
|
+
export function usualSettingsOf(store, repo, scope, platform = process.platform) {
|
|
304
|
+
const qualityMode = store.qualityDefault().mode;
|
|
305
|
+
const profile = scope.profile ?? null;
|
|
306
|
+
if (profile === null)
|
|
307
|
+
return { profile: null, qualityMode };
|
|
308
|
+
const resolved = resolveScopeProfile(store, repo, undefined, { provider: profile.provider, model: profile.model }, platform, { walk: false });
|
|
309
|
+
return resolved.ok ? { profile: resolved.profile, qualityMode } : null;
|
|
310
|
+
}
|
|
311
|
+
export function limitChanges(before, next) {
|
|
312
|
+
const out = [];
|
|
313
|
+
const scopeOf = (one) => ({ qualityMode: one.qualityMode ?? "default", budgetMicrousd: one.budgetMicrousd, outOfScope: one.outOfScope ?? null, touches: [...one.touches].sort() });
|
|
314
|
+
const was = scopeOf(before), now = scopeOf(next);
|
|
315
|
+
const push = (change) => { if (change !== null)
|
|
316
|
+
out.push(change); };
|
|
317
|
+
push(changeOf("checks level", was, now, ["qualityMode"], one => qualityModeTitle(one["qualityMode"])));
|
|
318
|
+
push(changeOf("cost", was, now, ["budgetMicrousd"], one => one["budgetMicrousd"] === null ? "no cap" : `up to ${money(one["budgetMicrousd"])} per attempt`));
|
|
319
|
+
push(changeOf("won’t touch", was, now, ["outOfScope"], one => one["outOfScope"] ?? "nothing ruled out"));
|
|
320
|
+
push(changeOf("files", was, now, ["touches"], one => one["touches"].length === 0 ? "any file" : `only ${one["touches"].join(", ")}`));
|
|
321
|
+
const wasProfile = before.profile ?? null, nowProfile = next.profile ?? null;
|
|
322
|
+
if (wasProfile === null || nowProfile === null) {
|
|
323
|
+
if (wasProfile !== nowProfile)
|
|
324
|
+
out.push({ label: "agent setup", was: wasProfile === null ? "none" : "set", now: nowProfile === null ? "none" : "set" });
|
|
325
|
+
}
|
|
326
|
+
else
|
|
327
|
+
out.push(...profileChanges(wasProfile, nowProfile));
|
|
328
|
+
const wasChain = liveChainFromJson(before.proposedChainJson ?? null) ?? [], nowChain = liveChainFromJson(next.proposedChainJson ?? null) ?? [];
|
|
329
|
+
for (let at = 1; at < Math.max(wasChain.length, nowChain.length); at++) {
|
|
330
|
+
const one = wasChain[at], two = nowChain[at];
|
|
331
|
+
const name = (entry) => entry === undefined ? "none" : `${agentModelName(entry.profile.provider, entry.profile.model)}${entry.authMode === "api-key" ? " on an API key" : ""}`;
|
|
332
|
+
if (one === undefined || two === undefined || name(one) !== name(two)) {
|
|
333
|
+
out.push({ label: `fallback ${at + 1}`, was: name(one), now: name(two) });
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
out.push(...profileChanges(one.profile, two.profile, `fallback ${at + 1} `));
|
|
337
|
+
}
|
|
338
|
+
return out;
|
|
339
|
+
}
|
|
340
|
+
export function revisionFactsOf(store, lineage, scope) {
|
|
341
|
+
if (lineage === null)
|
|
342
|
+
return null;
|
|
343
|
+
const source = lineage.sourceHadScope ? store.getScope(lineage.sourceTask) : null;
|
|
344
|
+
const changed = source === null ? null : limitChanges(source, scope);
|
|
345
|
+
return {
|
|
346
|
+
sourceTask: lineage.sourceTask,
|
|
347
|
+
sourceRun: lineage.sourceRun,
|
|
348
|
+
hadPlan: lineage.sourceHadScope,
|
|
349
|
+
changed,
|
|
350
|
+
problem: lineage.problem ?? null,
|
|
351
|
+
repair: lineage.repair === null ? null : { cap: lineage.repair.cap, remaining: lineage.repair.remaining },
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
export function summaryContextOf(store, taskId, scope, now, evidence = null, project = null) {
|
|
355
|
+
const ref = store.lookupRef(taskId);
|
|
356
|
+
const repo = ref?.repo ?? project;
|
|
357
|
+
const lineage = ref !== null && ref.revisionBriefArtifact !== null ? store.revisionLineageOf(taskId, now) : null;
|
|
358
|
+
return {
|
|
359
|
+
usual: usualSettingsOf(store, repo, scope),
|
|
360
|
+
revision: revisionFactsOf(store, lineage, scope),
|
|
361
|
+
rules: repo === null ? null : store.approvalRules(repo),
|
|
362
|
+
evidence,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
export function approvalSummaryFor(store, taskId, now, evidence = null) {
|
|
366
|
+
const scope = store.getScope(taskId);
|
|
367
|
+
return scope === null ? null : approvalSummaryOf(scope, summaryContextOf(store, taskId, scope, now, evidence));
|
|
368
|
+
}
|
|
369
|
+
export function shipSummaryOf(digest, decisions, warnings) {
|
|
370
|
+
const key = createHash("sha256").update(JSON.stringify({ v: 2, kind: "flexible-ship", digest, decisions, warnings }), "utf8").digest("hex").slice(0, 32);
|
|
371
|
+
return { revision: null, revisionNotes: [], revisionChanges: [], decisions, why: null, differs: [], warnings, usual: [], usualLabel: USUAL_LABEL, usualSummary: "", key };
|
|
372
|
+
}
|
|
373
|
+
function saidInUsualSummary(row, usualSummary) {
|
|
374
|
+
return row.label === "Checks" && usualSummary.split(", ").includes(`${row.words} checks`);
|
|
375
|
+
}
|
package/dist/attest.js
CHANGED
|
@@ -32,13 +32,13 @@ export function versionInRange(version, range) {
|
|
|
32
32
|
return false;
|
|
33
33
|
return atLeast(v, floor) && !atLeast(v, ceiling);
|
|
34
34
|
}
|
|
35
|
-
export function resolveExecutable(binary) {
|
|
35
|
+
export function resolveExecutable(binary, path = process.env["PATH"] ?? "") {
|
|
36
36
|
const candidates = [];
|
|
37
37
|
if (binary.includes("/") || isAbsolute(binary)) {
|
|
38
38
|
candidates.push(binary);
|
|
39
39
|
}
|
|
40
40
|
else {
|
|
41
|
-
for (const dir of
|
|
41
|
+
for (const dir of path.split(delimiter)) {
|
|
42
42
|
if (dir !== "")
|
|
43
43
|
candidates.push(join(dir, binary));
|
|
44
44
|
}
|
|
@@ -586,6 +586,36 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
586
586
|
See the License for the specific language governing permissions and
|
|
587
587
|
limitations under the License.
|
|
588
588
|
|
|
589
|
+
## vt100 0.16.2 (Rust crate) — MIT
|
|
590
|
+
|
|
591
|
+
The terminal workbench's Terminal tab (the `toolroll-tui` binary) draws a take-over terminal through a vendored,
|
|
592
|
+
modified copy of vt100 0.16.2 by Jesse Luehrs (https://github.com/doy/vt100-rust), kept in `tui/vendor/vt100`. It
|
|
593
|
+
diverges from upstream in `grid.rs`, `row.rs` and `screen.rs` only: rows that scroll are reused and cleared only as
|
|
594
|
+
far as they were written, and one-row and one-column screens no longer overflow. `tui/vendor/vt100/README` lists the
|
|
595
|
+
exact changes.
|
|
596
|
+
|
|
597
|
+
The MIT License (MIT)
|
|
598
|
+
|
|
599
|
+
Copyright (c) 2016 Jesse Luehrs
|
|
600
|
+
|
|
601
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
602
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
603
|
+
the Software without restriction, including without limitation the rights to
|
|
604
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
605
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
606
|
+
so, subject to the following conditions:
|
|
607
|
+
|
|
608
|
+
The above copyright notice and this permission notice shall be included in all
|
|
609
|
+
copies or substantial portions of the Software.
|
|
610
|
+
|
|
611
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
612
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
613
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
614
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
615
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
616
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
617
|
+
SOFTWARE.
|
|
618
|
+
|
|
589
619
|
|
|
590
620
|
## Bundled dependency: @alcalzone/ansi-tokenize 0.2.5
|
|
591
621
|
|