toolroll 0.9.107 → 0.9.109
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 +54 -0
- package/README.md +4 -3
- package/dist/advanced-view.js +0 -1
- package/dist/agent-fence.js +35 -4
- package/dist/agent-state.js +5 -2
- package/dist/assignment-ui.js +5 -5
- package/dist/assignment.js +5 -2
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +38 -33
- package/dist/browser-crew.js +4 -4
- package/dist/browser-shell.js +1 -1
- package/dist/browser-workspace.js +4 -11
- package/dist/builder.js +9 -1
- package/dist/chat-controls.js +6 -5
- package/dist/chat-decide.js +1 -1
- package/dist/chat-quiet.js +3 -3
- package/dist/chat-voice.js +2 -2
- package/dist/cli-help.js +17 -13
- package/dist/cli.js +4 -3
- package/dist/console-chrome.js +10 -3
- package/dist/contracts/cli.js +2 -0
- package/dist/contracts/console-api.js +5 -4
- package/dist/contracts/handoff.js +4 -0
- package/dist/decision.js +17 -0
- package/dist/demo-chat.js +1 -1
- package/dist/demo.js +6 -0
- package/dist/design/kit.js +4 -3
- package/dist/dispatch.js +3 -8
- package/dist/flexible-available.js +1 -0
- package/dist/flexible-schema.js +32 -0
- package/dist/flexible-thread-schema.js +30 -0
- package/dist/flexible-thread.js +526 -0
- package/dist/flexible-ui.js +44 -0
- package/dist/flexible.js +359 -0
- package/dist/folder-look.js +65 -4
- package/dist/git-views.js +38 -38
- package/dist/guides.js +14 -11
- package/dist/keymap.js +1 -1
- package/dist/lead-cli.js +2 -1
- package/dist/lead-context.js +1 -1
- package/dist/limits-ui.js +1 -1
- package/dist/live-bus.js +82 -12
- package/dist/login-secrets.js +43 -0
- package/dist/needs-you.js +3 -3
- package/dist/nightly-github.js +2 -2
- package/dist/operate.js +278 -21
- package/dist/project-admission.js +60 -29
- package/dist/project-delete-ui.js +2 -1
- package/dist/project-delete.js +1 -0
- package/dist/project.js +73 -0
- package/dist/provider-auth.js +1 -1
- package/dist/release.js +1 -0
- package/dist/repos.js +37 -0
- package/dist/result-actions.js +3 -0
- package/dist/result-evidence-readers.js +8 -2
- package/dist/result-review.js +20 -9
- package/dist/route-hooks.js +1 -0
- package/dist/sample-project.js +167 -9
- package/dist/scope.js +17 -2
- package/dist/serve.js +47 -32
- package/dist/server/chat.js +9 -9
- package/dist/server/chrome.js +16 -16
- package/dist/server/guards.js +10 -4
- package/dist/server/home.js +37 -5
- package/dist/server/http.js +4 -2
- package/dist/server/in-place.js +5 -4
- package/dist/server/kit.js +2 -2
- package/dist/server/live.js +103 -10
- package/dist/server/login-help.js +67 -0
- package/dist/server/pages.js +258 -78
- package/dist/server/people-tokens.js +36 -24
- package/dist/server/render-chat.js +1 -1
- package/dist/server/render-history.js +18 -4
- package/dist/server/render-new-task.js +2 -2
- package/dist/server/render-pages.js +21 -39
- package/dist/server/render-people.js +16 -4
- package/dist/server/render-projects.js +63 -15
- package/dist/server/render-results.js +26 -10
- package/dist/server/render-tasks.js +26 -17
- package/dist/server/retired-routes.js +37 -4
- package/dist/server/route-policy.js +8 -0
- package/dist/server/route-table.js +15 -5
- package/dist/server/settings-computers.js +140 -0
- package/dist/server/settings-scripts.js +15 -0
- package/dist/server/settings-section-table.js +56 -0
- package/dist/server/settings-sections.js +258 -0
- package/dist/server/settings.js +167 -19
- package/dist/server/task-views.js +47 -13
- package/dist/server/tasks.js +143 -90
- package/dist/server/welcome.js +35 -23
- package/dist/settings-groups-ui.js +34 -106
- package/dist/settings-proofs.js +5 -2
- package/dist/sqlite-telemetry.js +70 -21
- package/dist/store.js +141 -9
- package/dist/surface.js +4 -1
- package/dist/task-link.js +64 -0
- package/dist/task-outcome-cli.js +99 -4
- package/dist/tui-source.js +11 -3
- package/dist/tui.js +39 -39
- package/dist/typed-words-schema.js +18 -0
- package/dist/welcome-facts.js +15 -7
- package/dist/work-index.js +126 -29
- package/dist/work-reads.js +279 -0
- package/package.json +4 -2
package/dist/flexible.js
ADDED
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { canonicalJson } from "./canonical-json.js";
|
|
3
|
+
import { FLEXIBLE_AVAILABLE } from "./flexible-available.js";
|
|
4
|
+
export const FLEXIBLE_LEVELS = ["supervised", "auto", "full"];
|
|
5
|
+
export const FLEXIBLE_TERMS_VERSION = 1;
|
|
6
|
+
export const FLEXIBLE_DEFAULT_CAPS = Object.freeze({ liveThreads: 3, turnsPerDayProject: 300, turnsPerDayPerson: 150, measuredMicrousdPerDay: null });
|
|
7
|
+
const CAP_LIMITS = { liveThreads: 20, turnsPerDayProject: 10_000, turnsPerDayPerson: 10_000, measuredMicrousdPerDay: 100_000 * 1_000_000 };
|
|
8
|
+
export const FLEXIBLE_LEVEL_WORDS = Object.freeze({ supervised: "Supervised", auto: "Auto", full: "Full access" });
|
|
9
|
+
const rank = (level) => FLEXIBLE_LEVELS.indexOf(level);
|
|
10
|
+
const lowest = (a, b) => (rank(a) <= rank(b) ? a : b);
|
|
11
|
+
export const isFlexibleLevel = (value) => typeof value === "string" && FLEXIBLE_LEVELS.includes(value);
|
|
12
|
+
export function flexibleCeilingAllows(ceiling, level) {
|
|
13
|
+
const top = ceiling === "escalated" ? "full" : ceiling === "standard" ? "auto" : ceiling === "safe" ? "supervised" : null;
|
|
14
|
+
return top !== null && rank(level) <= rank(top);
|
|
15
|
+
}
|
|
16
|
+
export function flexibleTermsJson(terms) {
|
|
17
|
+
return canonicalJson(terms);
|
|
18
|
+
}
|
|
19
|
+
export function flexibleDigestOf(terms) {
|
|
20
|
+
return createHash("sha256").update(`standing-orders:flexible:${flexibleTermsJson(terms)}`, "utf8").digest("hex").slice(0, 32);
|
|
21
|
+
}
|
|
22
|
+
const TERMS_KEYS = ["caps", "default", "max", "network", "passwordFreeUpTo", "repo", "signer", "signerGeneration", "starters", "version"];
|
|
23
|
+
const CAPS_KEYS = ["liveThreads", "measuredMicrousdPerDay", "turnsPerDayPerson", "turnsPerDayProject"];
|
|
24
|
+
const plainObject = (value) => value !== null && typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype;
|
|
25
|
+
const exactKeys = (value, keys) => { const own = Object.keys(value).sort(); return own.length === keys.length && own.every((key, at) => key === keys[at]); };
|
|
26
|
+
const count = (value, max) => typeof value === "number" && Number.isSafeInteger(value) && value >= 1 && value <= max;
|
|
27
|
+
const safeText = (value, max) => typeof value === "string" && value.length > 0 && value.length <= max && !/[\x00-\x1f\x7f]/.test(value);
|
|
28
|
+
function validTerms(value) {
|
|
29
|
+
if (!plainObject(value) || !exactKeys(value, TERMS_KEYS))
|
|
30
|
+
return false;
|
|
31
|
+
const caps = value["caps"];
|
|
32
|
+
if (!plainObject(caps) || !exactKeys(caps, CAPS_KEYS))
|
|
33
|
+
return false;
|
|
34
|
+
if (!count(caps["liveThreads"], CAP_LIMITS.liveThreads) || !count(caps["turnsPerDayProject"], CAP_LIMITS.turnsPerDayProject) || !count(caps["turnsPerDayPerson"], CAP_LIMITS.turnsPerDayPerson))
|
|
35
|
+
return false;
|
|
36
|
+
if (caps["measuredMicrousdPerDay"] !== null && !count(caps["measuredMicrousdPerDay"], CAP_LIMITS.measuredMicrousdPerDay))
|
|
37
|
+
return false;
|
|
38
|
+
const { version, repo, signer, signerGeneration, starters, passwordFreeUpTo, max, network } = value;
|
|
39
|
+
if (version !== FLEXIBLE_TERMS_VERSION || !safeText(repo, 4096) || !repo.startsWith("/") || !safeText(signer, 200))
|
|
40
|
+
return false;
|
|
41
|
+
if (!count(signerGeneration, Number.MAX_SAFE_INTEGER))
|
|
42
|
+
return false;
|
|
43
|
+
if (starters !== "signer" && starters !== "approvers-with-access")
|
|
44
|
+
return false;
|
|
45
|
+
if (network !== "confined" && network !== "open")
|
|
46
|
+
return false;
|
|
47
|
+
if (!isFlexibleLevel(passwordFreeUpTo) || !isFlexibleLevel(max) || !isFlexibleLevel(value["default"]))
|
|
48
|
+
return false;
|
|
49
|
+
return rank(value["default"]) <= rank(passwordFreeUpTo) && rank(passwordFreeUpTo) <= rank(max);
|
|
50
|
+
}
|
|
51
|
+
export function flexibleTermsFromJson(json) {
|
|
52
|
+
if (typeof json !== "string" || json.length > 16_384)
|
|
53
|
+
return null;
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = JSON.parse(json);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
if (!validTerms(parsed))
|
|
62
|
+
return null;
|
|
63
|
+
return canonicalJson(parsed) === json ? parsed : null;
|
|
64
|
+
}
|
|
65
|
+
export function flexibleNarrowerOrEqual(next, signed) {
|
|
66
|
+
if (next.version !== signed.version || next.repo !== signed.repo || next.signer !== signed.signer || next.signerGeneration !== signed.signerGeneration || next.network !== signed.network)
|
|
67
|
+
return false;
|
|
68
|
+
if (next.starters !== signed.starters && next.starters !== "signer")
|
|
69
|
+
return false;
|
|
70
|
+
if (rank(next.max) > rank(signed.max) || rank(next.passwordFreeUpTo) > rank(signed.passwordFreeUpTo) || rank(next.default) > rank(signed.default))
|
|
71
|
+
return false;
|
|
72
|
+
const a = next.caps, b = signed.caps;
|
|
73
|
+
if (a.liveThreads > b.liveThreads || a.turnsPerDayProject > b.turnsPerDayProject || a.turnsPerDayPerson > b.turnsPerDayPerson)
|
|
74
|
+
return false;
|
|
75
|
+
return b.measuredMicrousdPerDay === null || (a.measuredMicrousdPerDay !== null && a.measuredMicrousdPerDay <= b.measuredMicrousdPerDay);
|
|
76
|
+
}
|
|
77
|
+
const plural = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
|
|
78
|
+
export const FULL_ACCESS_WORDS = "Full access removes the agent's permission prompts inside the sandbox only. It never lets the agent leave the sandbox, use your keychain or SSH agent, read or change Toolroll's own data, write to your repository directly, or change how agents are started. It covers the agent's own tools, its MCP servers and plugins, and every program they start. Answering an agent's request never runs anything outside the sandbox, and if the sandbox can't hold, the thread doesn't run.";
|
|
79
|
+
export const OPEN_NETWORK_WORDS = [
|
|
80
|
+
"This project's network is open. The agent can send anything it can read to any website: your code, files the sandbox allows it to read, and the conversation.",
|
|
81
|
+
"If it finds a credential Toolroll missed, such as a token in a project file, it can use it, including to push code anywhere that credential reaches. Branch protection and Toolroll's own push limits don't stop a credential the agent finds itself.",
|
|
82
|
+
"Turn on branch protection for your default branch anyway.",
|
|
83
|
+
];
|
|
84
|
+
export function flexibleTermsWords(terms) {
|
|
85
|
+
const who = terms.starters === "signer" ? `Only ${terms.signer} may` : "People who can approve work in this project may";
|
|
86
|
+
const start = `${who} start Flexible threads at ${FLEXIBLE_LEVEL_WORDS[terms.passwordFreeUpTo]} without a password.`;
|
|
87
|
+
const raise = rank(terms.max) > rank(terms.passwordFreeUpTo) ? ` A thread can be raised to ${FLEXIBLE_LEVEL_WORDS[terms.max]} with that person's password.` : "";
|
|
88
|
+
const levels = [];
|
|
89
|
+
if (rank(terms.max) >= rank("full"))
|
|
90
|
+
levels.push(FULL_ACCESS_WORDS);
|
|
91
|
+
if (rank(terms.max) >= rank("auto"))
|
|
92
|
+
levels.push("Auto lets the agent run routine commands inside the sandbox and asks you before anything outside it.");
|
|
93
|
+
levels.push("Supervised asks you before each command and file change.");
|
|
94
|
+
const caps = terms.caps;
|
|
95
|
+
const spend = caps.measuredMicrousdPerDay === null ? "" : ` New turns stop once today's measured spend reaches $${(caps.measuredMicrousdPerDay / 1_000_000).toFixed(2)}; a turn already running may go past it.`;
|
|
96
|
+
return [
|
|
97
|
+
`${start}${raise} New threads start at ${FLEXIBLE_LEVEL_WORDS[terms.default]}.`,
|
|
98
|
+
...levels,
|
|
99
|
+
"Each thread works in its own copy of the repository, on its own branch, and can read the repository's whole history. Its work reaches your repository only when someone sends it for checks, and nothing merges unless the required check passes on that exact commit.",
|
|
100
|
+
`Limits: ${plural(caps.liveThreads, "thread")} at once, ${plural(caps.turnsPerDayProject, "agent turn")} a day in this project, ${plural(caps.turnsPerDayPerson, "turn")} a day per person. A limit on turns doesn't limit what one turn costs.${spend}`,
|
|
101
|
+
...(terms.network === "open" ? OPEN_NETWORK_WORDS : []),
|
|
102
|
+
"This lasts until someone turns it off or lowers it, or until your account or access changes, the project needs two people to approve, its network setting changes, or the organisation's permission ceiling drops. Turning it off or lowering it stops new threads at once.",
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
export const FLEXIBLE_LAPSE_WORDS = Object.freeze({
|
|
106
|
+
"signer-revoked": "The person who turned it on no longer has an account.",
|
|
107
|
+
"signer-changed": "The account of the person who turned it on changed (password, role or project access).",
|
|
108
|
+
"signer-not-approver": "The person who turned it on can no longer approve work.",
|
|
109
|
+
"signer-lost-access": "The person who turned it on lost access to this project.",
|
|
110
|
+
"two-person": "This project now needs two people to approve work.",
|
|
111
|
+
"network-changed": "This project's network setting changed.",
|
|
112
|
+
"ceiling-lowered": "The organisation's permission ceiling no longer allows these terms.",
|
|
113
|
+
});
|
|
114
|
+
export function flexibleNetworkOf(store, repo) {
|
|
115
|
+
return store.projectNetwork(repo).mode === "open" ? "open" : "confined";
|
|
116
|
+
}
|
|
117
|
+
export function flexibleTwoPerson(store, repo) {
|
|
118
|
+
const rules = store.approvalRules(repo);
|
|
119
|
+
return rules.notRequester || rules.protectProject;
|
|
120
|
+
}
|
|
121
|
+
function approverHere(store, name, repo) {
|
|
122
|
+
const account = store.accountOf(name);
|
|
123
|
+
if (account === null || account.revokedAt !== null || account.role !== "approver")
|
|
124
|
+
return null;
|
|
125
|
+
return store.accountCanAccess(name, repo) ? { generation: account.generation } : null;
|
|
126
|
+
}
|
|
127
|
+
function lapseOf(store, terms) {
|
|
128
|
+
const account = store.accountOf(terms.signer);
|
|
129
|
+
if (account === null || account.revokedAt !== null)
|
|
130
|
+
return "signer-revoked";
|
|
131
|
+
if (account.generation !== terms.signerGeneration)
|
|
132
|
+
return "signer-changed";
|
|
133
|
+
if (account.role !== "approver")
|
|
134
|
+
return "signer-not-approver";
|
|
135
|
+
if (!store.accountCanAccess(terms.signer, terms.repo))
|
|
136
|
+
return "signer-lost-access";
|
|
137
|
+
if (flexibleTwoPerson(store, terms.repo))
|
|
138
|
+
return "two-person";
|
|
139
|
+
if (flexibleNetworkOf(store, terms.repo) !== terms.network)
|
|
140
|
+
return "network-changed";
|
|
141
|
+
if (!flexibleCeilingAllows(store.orgPolicy().ceiling, terms.max))
|
|
142
|
+
return "ceiling-lowered";
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
function readRow(row, repo) {
|
|
146
|
+
const terms = flexibleTermsFromJson(row["terms_json"]);
|
|
147
|
+
const signed = flexibleTermsFromJson(row["signed_terms_json"]);
|
|
148
|
+
if (terms === null || signed === null)
|
|
149
|
+
return null;
|
|
150
|
+
if (flexibleDigestOf(terms) !== row["digest"] || flexibleDigestOf(signed) !== row["signed_digest"])
|
|
151
|
+
return null;
|
|
152
|
+
if (row["repo"] !== repo || terms.repo !== repo || signed.signer !== row["signed_by"] || !flexibleNarrowerOrEqual(terms, signed))
|
|
153
|
+
return null;
|
|
154
|
+
return { id: Number(row["id"]), terms, digest: String(row["digest"]), signedDigest: String(row["signed_digest"]), signedBy: String(row["signed_by"]),
|
|
155
|
+
signedAt: String(row["signed_at"]), changedBy: String(row["changed_by"]), changedAt: String(row["changed_at"]) };
|
|
156
|
+
}
|
|
157
|
+
export function flexibleStanding(store, repo) {
|
|
158
|
+
let row;
|
|
159
|
+
try {
|
|
160
|
+
row = store.handle.prepare("SELECT * FROM flexible_terms WHERE repo = ? AND ended_at IS NULL").get(repo);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return { state: "unreadable", id: null };
|
|
164
|
+
}
|
|
165
|
+
if (row === undefined)
|
|
166
|
+
return { state: "secure" };
|
|
167
|
+
const read = readRow(row, repo);
|
|
168
|
+
if (read === null)
|
|
169
|
+
return { state: "unreadable", id: Number(row["id"]) };
|
|
170
|
+
const lapse = lapseOf(store, read.terms);
|
|
171
|
+
return lapse === null ? { state: "on", ...read } : { state: "lapsed", reason: lapse, ...read };
|
|
172
|
+
}
|
|
173
|
+
export const FLEXIBLE_UNAVAILABLE = "Flexible projects aren't available in this version. Nothing changed.";
|
|
174
|
+
const WORDS = Object.freeze({
|
|
175
|
+
"not-available": FLEXIBLE_UNAVAILABLE,
|
|
176
|
+
"not-an-approver": "Only an approver for this project can do that. Nothing changed.",
|
|
177
|
+
"proof-required": "Turning on Flexible needs your password, typed now. Nothing changed.",
|
|
178
|
+
"two-person": "This project needs two people to approve work, so it can't be Flexible. Nothing changed.",
|
|
179
|
+
"above-ceiling": "The organisation's permission ceiling doesn't allow that level. Nothing changed.",
|
|
180
|
+
"invalid-choice": "Choose Supervised, Auto or Full access, with new threads starting no higher than the highest level. Nothing changed.",
|
|
181
|
+
"terms-changed": "The terms changed since they were shown. Read them again before agreeing. Nothing changed.",
|
|
182
|
+
"not-flexible": "This project isn't Flexible.",
|
|
183
|
+
"terms-unreadable": "This project's Flexible terms can't be read, so they allow nothing. Turn Flexible off, then on again.",
|
|
184
|
+
"not-lower": "Lowering can't raise a level. Turn Flexible on again, with your password, to sign higher terms. Nothing changed.",
|
|
185
|
+
"stale-generation": "Your account changed since this started. Sign in again and retry.",
|
|
186
|
+
"not-a-starter": "These terms let only the person who turned Flexible on start threads.",
|
|
187
|
+
"above-max": "That level is above what this project's Flexible terms allow.",
|
|
188
|
+
});
|
|
189
|
+
const refuse = (reason) => ({ ok: false, reason, message: WORDS[reason] });
|
|
190
|
+
const lapsed = (lapse) => ({ ok: false, reason: "terms-lapsed", message: `This project's Flexible terms no longer count. ${FLEXIBLE_LAPSE_WORDS[lapse]} Turn it on again to sign new terms.` });
|
|
191
|
+
export function proposedFlexibleTerms(store, repo, signer, choice = {}) {
|
|
192
|
+
const standing = approverHere(store, signer, repo);
|
|
193
|
+
if (standing === null)
|
|
194
|
+
return refuse("not-an-approver");
|
|
195
|
+
if (flexibleTwoPerson(store, repo))
|
|
196
|
+
return refuse("two-person");
|
|
197
|
+
const ceiling = store.orgPolicy().ceiling;
|
|
198
|
+
const ceilingTop = [...FLEXIBLE_LEVELS].reverse().find(level => flexibleCeilingAllows(ceiling, level)) ?? null;
|
|
199
|
+
if (ceilingTop === null)
|
|
200
|
+
return refuse("above-ceiling");
|
|
201
|
+
const max = choice.max ?? ceilingTop;
|
|
202
|
+
const level = choice.default ?? max;
|
|
203
|
+
if (!isFlexibleLevel(max) || !isFlexibleLevel(level) || rank(level) > rank(max))
|
|
204
|
+
return refuse("invalid-choice");
|
|
205
|
+
if (!flexibleCeilingAllows(ceiling, max))
|
|
206
|
+
return refuse("above-ceiling");
|
|
207
|
+
const terms = { version: FLEXIBLE_TERMS_VERSION, repo, signer, signerGeneration: standing.generation, starters: "approvers-with-access",
|
|
208
|
+
passwordFreeUpTo: max, max, default: level, network: flexibleNetworkOf(store, repo), caps: { ...FLEXIBLE_DEFAULT_CAPS } };
|
|
209
|
+
if (!validTerms(terms))
|
|
210
|
+
return refuse("invalid-choice");
|
|
211
|
+
return { ok: true, terms, digest: flexibleDigestOf(terms) };
|
|
212
|
+
}
|
|
213
|
+
const levelsWords = (terms) => `max ${terms.max}, password-free ${terms.passwordFreeUpTo}, default ${terms.default}`;
|
|
214
|
+
function endRow(store, id, reason, by, detail, now) {
|
|
215
|
+
const ended = store.handle.prepare("UPDATE flexible_terms SET ended_at = ?, ended_by = ?, end_reason = ?, end_detail = ? WHERE id = ? AND ended_at IS NULL")
|
|
216
|
+
.run(now.toISOString(), by, reason, detail, id);
|
|
217
|
+
return Number(ended.changes) === 1;
|
|
218
|
+
}
|
|
219
|
+
function insertRow(store, row, now) {
|
|
220
|
+
const written = store.handle.prepare(`INSERT INTO flexible_terms (repo, terms_json, digest, signed_terms_json, signed_digest, signed_by, signed_at, proof, changed_by, changed_at, derived_from)
|
|
221
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(row.repo, flexibleTermsJson(row.terms), flexibleDigestOf(row.terms), row.signedJson, row.signedDigest, row.signedBy, row.signedAt, row.proof, row.changedBy, now.toISOString(), row.derivedFrom);
|
|
222
|
+
return Number(written.lastInsertRowid);
|
|
223
|
+
}
|
|
224
|
+
export function enableFlexible(store, input) {
|
|
225
|
+
if (!FLEXIBLE_AVAILABLE)
|
|
226
|
+
return refuse("not-available");
|
|
227
|
+
if (input.proof !== "password-now" && input.proof !== "sso-now")
|
|
228
|
+
return refuse("proof-required");
|
|
229
|
+
const proof = input.proof;
|
|
230
|
+
return store.transact(() => {
|
|
231
|
+
const proposed = proposedFlexibleTerms(store, input.repo, input.by, input.choice ?? {});
|
|
232
|
+
if (!proposed.ok)
|
|
233
|
+
return proposed;
|
|
234
|
+
if (proposed.digest !== input.shownDigest)
|
|
235
|
+
return refuse("terms-changed");
|
|
236
|
+
const live = store.handle.prepare("SELECT id FROM flexible_terms WHERE repo = ? AND ended_at IS NULL").get(input.repo);
|
|
237
|
+
const replaced = live !== undefined;
|
|
238
|
+
if (replaced)
|
|
239
|
+
endRow(store, Number(live["id"]), "replaced", input.by, null, input.now);
|
|
240
|
+
const json = flexibleTermsJson(proposed.terms);
|
|
241
|
+
const id = insertRow(store, { repo: input.repo, terms: proposed.terms, signedJson: json, signedDigest: proposed.digest, signedBy: input.by, signedAt: input.now.toISOString(), proof, changedBy: input.by, derivedFrom: null }, input.now);
|
|
242
|
+
store.recordAction({ at: input.now.toISOString(), actor: input.by, repo: input.repo, taskId: null, runId: null, source: "policy", action: "flexible turned on", outcome: "on",
|
|
243
|
+
detail: `terms ${proposed.digest} · ${levelsWords(proposed.terms)} · network ${proposed.terms.network}${replaced ? " · replaced earlier terms" : ""}` });
|
|
244
|
+
store.bumpWake();
|
|
245
|
+
return { ok: true, id, digest: proposed.digest, terms: proposed.terms, replaced };
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
export function lowerFlexible(store, input) {
|
|
249
|
+
if (!FLEXIBLE_AVAILABLE)
|
|
250
|
+
return refuse("not-available");
|
|
251
|
+
if (!isFlexibleLevel(input.max))
|
|
252
|
+
return refuse("invalid-choice");
|
|
253
|
+
return store.transact(() => {
|
|
254
|
+
if (approverHere(store, input.by, input.repo) === null)
|
|
255
|
+
return refuse("not-an-approver");
|
|
256
|
+
const standing = flexibleStanding(store, input.repo);
|
|
257
|
+
if (standing.state === "secure")
|
|
258
|
+
return refuse("not-flexible");
|
|
259
|
+
if (standing.state === "unreadable")
|
|
260
|
+
return refuse("terms-unreadable");
|
|
261
|
+
if (standing.state === "lapsed")
|
|
262
|
+
return lapsed(standing.reason);
|
|
263
|
+
const current = standing.terms;
|
|
264
|
+
if (rank(input.max) > rank(current.max))
|
|
265
|
+
return refuse("not-lower");
|
|
266
|
+
const next = { ...current, max: input.max, passwordFreeUpTo: lowest(current.passwordFreeUpTo, input.max), default: lowest(current.default, input.max) };
|
|
267
|
+
if (flexibleTermsJson(next) === flexibleTermsJson(current))
|
|
268
|
+
return { ok: true, changed: false, digest: standing.digest, terms: current };
|
|
269
|
+
const signed = store.handle.prepare("SELECT signed_terms_json, proof FROM flexible_terms WHERE id = ?").get(standing.id);
|
|
270
|
+
endRow(store, standing.id, "lowered", input.by, null, input.now);
|
|
271
|
+
insertRow(store, { repo: input.repo, terms: next, signedJson: String(signed["signed_terms_json"]), signedDigest: standing.signedDigest, signedBy: standing.signedBy, signedAt: standing.signedAt,
|
|
272
|
+
proof: signed["proof"] === "sso-now" ? "sso-now" : "password-now", changedBy: input.by, derivedFrom: standing.id }, input.now);
|
|
273
|
+
store.recordAction({ at: input.now.toISOString(), actor: input.by, repo: input.repo, taskId: null, runId: null, source: "policy", action: "flexible lowered", outcome: "lowered",
|
|
274
|
+
detail: `${levelsWords(current)} → ${levelsWords(next)} · terms ${flexibleDigestOf(next)}` });
|
|
275
|
+
store.bumpWake();
|
|
276
|
+
return { ok: true, changed: true, digest: flexibleDigestOf(next), terms: next };
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
export function turnFlexibleOff(store, input) {
|
|
280
|
+
if (!FLEXIBLE_AVAILABLE)
|
|
281
|
+
return refuse("not-available");
|
|
282
|
+
return store.transact(() => {
|
|
283
|
+
if (approverHere(store, input.by, input.repo) === null)
|
|
284
|
+
return refuse("not-an-approver");
|
|
285
|
+
const live = store.handle.prepare("SELECT id FROM flexible_terms WHERE repo = ? AND ended_at IS NULL").get(input.repo);
|
|
286
|
+
if (live === undefined)
|
|
287
|
+
return { ok: true, changed: false };
|
|
288
|
+
endRow(store, Number(live["id"]), "off", input.by, null, input.now);
|
|
289
|
+
store.recordAction({ at: input.now.toISOString(), actor: input.by, repo: input.repo, taskId: null, runId: null, source: "policy", action: "flexible turned off", outcome: "off", detail: null });
|
|
290
|
+
store.bumpWake();
|
|
291
|
+
return { ok: true, changed: true };
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
export function endLapsedFlexible(store, which, by, now) {
|
|
295
|
+
const db = store.handle;
|
|
296
|
+
db.exec("SAVEPOINT flexible_lapse");
|
|
297
|
+
try {
|
|
298
|
+
const rows = which === "all" ? db.prepare("SELECT repo, signed_by FROM flexible_terms WHERE ended_at IS NULL").all()
|
|
299
|
+
: "repo" in which ? db.prepare("SELECT repo, signed_by FROM flexible_terms WHERE ended_at IS NULL AND repo = ?").all(which.repo)
|
|
300
|
+
: db.prepare("SELECT repo, signed_by FROM flexible_terms WHERE ended_at IS NULL AND signed_by = ?").all(which.signer);
|
|
301
|
+
let ended = 0;
|
|
302
|
+
for (const row of rows) {
|
|
303
|
+
const repo = String(row["repo"]);
|
|
304
|
+
const standing = flexibleStanding(store, repo);
|
|
305
|
+
if (standing.state !== "lapsed")
|
|
306
|
+
continue;
|
|
307
|
+
if (!endRow(store, standing.id, "lapsed", by, standing.reason, now))
|
|
308
|
+
continue;
|
|
309
|
+
store.recordAction({ at: now.toISOString(), actor: by, repo, taskId: null, runId: null, source: "policy", action: "flexible terms lapsed", outcome: "lapsed", detail: FLEXIBLE_LAPSE_WORDS[standing.reason] });
|
|
310
|
+
ended++;
|
|
311
|
+
}
|
|
312
|
+
db.exec("RELEASE flexible_lapse");
|
|
313
|
+
return ended;
|
|
314
|
+
}
|
|
315
|
+
catch {
|
|
316
|
+
db.exec("ROLLBACK TO flexible_lapse");
|
|
317
|
+
db.exec("RELEASE flexible_lapse");
|
|
318
|
+
return 0;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
export function flexibleDelegationAtUse(store, input) {
|
|
322
|
+
if (!FLEXIBLE_AVAILABLE)
|
|
323
|
+
return refuse("not-available");
|
|
324
|
+
return store.transact(() => {
|
|
325
|
+
const standing = flexibleStanding(store, input.repo);
|
|
326
|
+
if (standing.state === "secure")
|
|
327
|
+
return refuse("not-flexible");
|
|
328
|
+
if (standing.state === "unreadable")
|
|
329
|
+
return refuse("terms-unreadable");
|
|
330
|
+
if (standing.state === "lapsed")
|
|
331
|
+
return lapsed(standing.reason);
|
|
332
|
+
if (standing.digest !== input.digest)
|
|
333
|
+
return refuse("terms-changed");
|
|
334
|
+
const account = store.accountOf(input.starter.name);
|
|
335
|
+
if (account === null || account.revokedAt !== null || account.role !== "approver")
|
|
336
|
+
return refuse("not-an-approver");
|
|
337
|
+
if (account.generation !== input.starter.generation)
|
|
338
|
+
return refuse("stale-generation");
|
|
339
|
+
if (!store.accountCanAccess(input.starter.name, input.repo))
|
|
340
|
+
return refuse("not-an-approver");
|
|
341
|
+
const terms = standing.terms;
|
|
342
|
+
if (terms.starters === "signer" && input.starter.name !== terms.signer)
|
|
343
|
+
return refuse("not-a-starter");
|
|
344
|
+
if (!isFlexibleLevel(input.level) || rank(input.level) > rank(terms.max))
|
|
345
|
+
return refuse("above-max");
|
|
346
|
+
if (!flexibleCeilingAllows(store.orgPolicy().ceiling, input.level))
|
|
347
|
+
return refuse("above-ceiling");
|
|
348
|
+
if (rank(input.level) > rank(terms.passwordFreeUpTo) && input.freshProof !== true)
|
|
349
|
+
return { ok: false, reason: "proof-required", message: `Starting at ${FLEXIBLE_LEVEL_WORDS[input.level]} needs your password.` };
|
|
350
|
+
return { ok: true, termsId: standing.id, digest: standing.digest, terms };
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
export function flexibleSettingsView(store, repo, viewer) {
|
|
354
|
+
if (!FLEXIBLE_AVAILABLE)
|
|
355
|
+
return undefined;
|
|
356
|
+
const proposed = viewer.canChange ? proposedFlexibleTerms(store, repo, viewer.name) : refuse("not-an-approver");
|
|
357
|
+
return { repo, standing: flexibleStanding(store, repo), canChange: viewer.canChange,
|
|
358
|
+
proposal: proposed.ok ? { terms: proposed.terms, digest: proposed.digest } : { problem: proposed.message.replace(/ Nothing changed\.$/, "") } };
|
|
359
|
+
}
|
package/dist/folder-look.js
CHANGED
|
@@ -59,7 +59,7 @@ function children(folder, roots, links) {
|
|
|
59
59
|
const spelled = path.join(folder, entry.name);
|
|
60
60
|
if (offLimits(spelled, roots)) continue;
|
|
61
61
|
let real, stat;
|
|
62
|
-
try { real = fs.realpathSync(spelled); } catch { continue; }
|
|
62
|
+
try { real = (request.native === true ? fs.realpathSync.native : fs.realpathSync)(spelled); } catch { continue; }
|
|
63
63
|
if (offLimits(real, roots) || !roots.some(root => within(real, root))) continue;
|
|
64
64
|
try { stat = fs.statSync(real); } catch { continue; }
|
|
65
65
|
if (!stat.isDirectory()) continue;
|
|
@@ -70,7 +70,45 @@ function children(folder, roots, links) {
|
|
|
70
70
|
} finally { dir.closeSync(); }
|
|
71
71
|
return out;
|
|
72
72
|
}
|
|
73
|
+
// A folder's identity and the identities of every folder above it, by device and inode (bigint stats: no precision
|
|
74
|
+
// lost), what containment is judged on. A folder that isn't there is said as such, with its path in the disk's spelling
|
|
75
|
+
// for the part that exists; any other failure is "unreadable", never "absent", so a check that can't read fails closed.
|
|
76
|
+
const ABSENT = new Set(["ENOENT", "ENOTDIR"]);
|
|
77
|
+
function absentPath(p) {
|
|
78
|
+
const rest = [];
|
|
79
|
+
let at = p;
|
|
80
|
+
for (;;) {
|
|
81
|
+
const up = path.dirname(at);
|
|
82
|
+
if (up === at) return p;
|
|
83
|
+
rest.unshift(path.basename(at));
|
|
84
|
+
at = up;
|
|
85
|
+
try { return path.join(fs.realpathSync.native(at), ...rest); }
|
|
86
|
+
catch (error) { if (!(error && ABSENT.has(error.code))) return null; }
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function facts(p) {
|
|
90
|
+
const asked = path.resolve(p);
|
|
91
|
+
let real;
|
|
92
|
+
try { real = fs.realpathSync.native(asked); }
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (!(error && ABSENT.has(error.code))) return { kind: "unreadable" };
|
|
95
|
+
const missing = absentPath(asked);
|
|
96
|
+
return missing === null ? { kind: "unreadable" } : { kind: "missing", path: missing };
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
const stat = fs.statSync(real, { bigint: true });
|
|
100
|
+
const names = real.split("/").filter(Boolean);
|
|
101
|
+
const chain = [];
|
|
102
|
+
// Every folder from this one up to the top, each stat'ed: the walk is exactly as long as the path, never cut short.
|
|
103
|
+
for (let depth = names.length; depth >= 0; depth--) {
|
|
104
|
+
const one = fs.statSync("/" + names.slice(0, depth).join("/"), { bigint: true });
|
|
105
|
+
chain.push(String(one.dev) + ":" + String(one.ino));
|
|
106
|
+
}
|
|
107
|
+
return { kind: "found", real, dir: stat.isDirectory(), uid: Number(stat.uid), chain };
|
|
108
|
+
} catch { return { kind: "unreadable" }; }
|
|
109
|
+
}
|
|
73
110
|
function look() {
|
|
111
|
+
if (request.op === "folder") return { target: facts(request.path), compare: request.compare.map(facts) };
|
|
74
112
|
if (request.op === "projectMcp") {
|
|
75
113
|
const text = readBounded(path.join(request.path, ".mcp.json"), 1024 * 1024, 1024 * 1024);
|
|
76
114
|
if (text === null) return { config: null };
|
|
@@ -84,8 +122,9 @@ function look() {
|
|
|
84
122
|
}) };
|
|
85
123
|
}
|
|
86
124
|
const roots = request.roots;
|
|
125
|
+
const realOf = request.native === true ? fs.realpathSync.native : fs.realpathSync;
|
|
87
126
|
if (request.op === "list") {
|
|
88
|
-
const at =
|
|
127
|
+
const at = realOf(request.path);
|
|
89
128
|
const root = rootOf(at, roots);
|
|
90
129
|
if (root === undefined || offLimits(at, roots) || !fs.statSync(at).isDirectory()) return { at: null, entries: [] };
|
|
91
130
|
// A folder on another drive than the root that allows it is not entered (the root itself may be one).
|
|
@@ -163,7 +202,8 @@ let starts = 0;
|
|
|
163
202
|
function lookKey(request) {
|
|
164
203
|
const sorted = (paths) => paths.map(one => resolve(one)).sort();
|
|
165
204
|
switch (request.op) {
|
|
166
|
-
case "list": return JSON.stringify([request.op, resolve(request.path), sorted(request.roots), request.home]);
|
|
205
|
+
case "list": return JSON.stringify([request.op, resolve(request.path), sorted(request.roots), request.home, "native" in request]);
|
|
206
|
+
case "folder": return JSON.stringify([request.op, resolve(request.path), sorted(request.compare)]);
|
|
167
207
|
case "origins": return JSON.stringify([request.op, sorted(request.registered), sorted(request.roots), request.home]);
|
|
168
208
|
case "identities": return JSON.stringify([request.op, sorted(request.paths)]);
|
|
169
209
|
case "projectMcp": return JSON.stringify([request.op, resolve(request.path)]);
|
|
@@ -212,7 +252,7 @@ export async function lookFolders(request, options = {}) {
|
|
|
212
252
|
}
|
|
213
253
|
const text = (value) => typeof value === "string" && value.length > 0 && value.length <= 4096 && !value.includes("\0");
|
|
214
254
|
export async function listFolder(path, roots, options = {}) {
|
|
215
|
-
const looked = await lookFolders({ op: "list", path, roots: [...roots], home: options.home ?? homedir() }, options);
|
|
255
|
+
const looked = await lookFolders(options.native === true ? { op: "list", path, roots: [...roots], home: options.home ?? homedir(), native: true } : { op: "list", path, roots: [...roots], home: options.home ?? homedir() }, options);
|
|
216
256
|
if (!looked.ok)
|
|
217
257
|
return looked;
|
|
218
258
|
const value = looked.value;
|
|
@@ -262,3 +302,24 @@ export async function lookProjectMcp(repo, options = {}) {
|
|
|
262
302
|
const config = value.config;
|
|
263
303
|
return { ok: true, value: config !== null && typeof config === "object" && !Array.isArray(config) ? config : null };
|
|
264
304
|
}
|
|
305
|
+
const factsOf = (value) => {
|
|
306
|
+
const one = value;
|
|
307
|
+
if (one === null || typeof one !== "object")
|
|
308
|
+
return { kind: "unreadable" };
|
|
309
|
+
if (one.kind === "missing" && text(one.path) && one.path.startsWith("/"))
|
|
310
|
+
return { kind: "missing", path: one.path };
|
|
311
|
+
if (one.kind !== "found" || !text(one.real) || typeof one.dir !== "boolean" || typeof one.uid !== "number" || !Array.isArray(one.chain))
|
|
312
|
+
return { kind: "unreadable" };
|
|
313
|
+
const chain = one.chain.filter((id) => typeof id === "string" && /^\d+:\d+$/.test(id));
|
|
314
|
+
const complete = chain.length === one.chain.length && chain.length === one.real.split("/").filter(Boolean).length + 1;
|
|
315
|
+
return complete ? { kind: "found", real: one.real, dir: one.dir, uid: one.uid, chain } : { kind: "unreadable" };
|
|
316
|
+
};
|
|
317
|
+
export async function folderFacts(path, compare, options = {}) {
|
|
318
|
+
const looked = await lookFolders({ op: "folder", path, compare: [...compare] }, options);
|
|
319
|
+
if (!looked.ok)
|
|
320
|
+
return looked;
|
|
321
|
+
const value = looked.value;
|
|
322
|
+
if (value === null || typeof value !== "object" || !Array.isArray(value.compare) || value.compare.length !== compare.length)
|
|
323
|
+
return { ok: false, why: "failed" };
|
|
324
|
+
return { ok: true, value: { target: factsOf(value.target), compare: value.compare.map(factsOf) } };
|
|
325
|
+
}
|
package/dist/git-views.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
|
-
import {
|
|
3
|
+
import { lstatSync, mkdirSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
|
+
import { sqliteRuntime } from "./sqlite-runtime.js";
|
|
5
6
|
export function gitViewsRoot(home) {
|
|
6
7
|
return join(home, ".toolroll", "git-views");
|
|
7
8
|
}
|
|
@@ -35,51 +36,50 @@ export async function lockCheckout(home, checkout, timeoutMs = 10 * 60_000) {
|
|
|
35
36
|
const held = lstatSync(folder);
|
|
36
37
|
if (!held.isDirectory() || held.isSymbolicLink())
|
|
37
38
|
throw new Error(`${folder} isn't a folder of this user's own`);
|
|
38
|
-
const path = join(folder, `${createHash("sha256").update(checkout).digest("hex")}.
|
|
39
|
+
const path = join(folder, `${createHash("sha256").update(checkout).digest("hex")}.lockdb`);
|
|
40
|
+
try {
|
|
41
|
+
if (!lstatSync(path).isFile())
|
|
42
|
+
throw new Error(`${path} isn't a lock file`);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error.code !== "ENOENT")
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
const { DatabaseSync } = sqliteRuntime();
|
|
49
|
+
const db = new DatabaseSync(path);
|
|
39
50
|
const deadline = Date.now() + timeoutMs;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
try {
|
|
52
|
+
db.exec("PRAGMA busy_timeout = 0");
|
|
53
|
+
for (;;) {
|
|
43
54
|
try {
|
|
44
|
-
|
|
55
|
+
db.exec("BEGIN IMMEDIATE");
|
|
56
|
+
break;
|
|
45
57
|
}
|
|
46
|
-
|
|
47
|
-
|
|
58
|
+
catch (error) {
|
|
59
|
+
if (!/locked|busy/i.test(error instanceof Error ? error.message : String(error)))
|
|
60
|
+
throw error;
|
|
48
61
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
rmSync(path, { force: true });
|
|
53
|
-
} };
|
|
54
|
-
}
|
|
55
|
-
catch (error) {
|
|
56
|
-
if (error.code !== "EEXIST")
|
|
57
|
-
throw error;
|
|
62
|
+
if (Date.now() > deadline)
|
|
63
|
+
throw new Error("another of Toolroll's git commands on this checkout is still running");
|
|
64
|
+
await new Promise(done => setTimeout(done, 25));
|
|
58
65
|
}
|
|
59
|
-
let owner = NaN;
|
|
60
|
-
try {
|
|
61
|
-
owner = Number(readFileSync(path, "utf8").trim());
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
owner = NaN;
|
|
65
|
-
}
|
|
66
|
-
if (Number.isSafeInteger(owner) && owner > 0 && owner !== process.pid && !alive(owner)) {
|
|
67
|
-
rmSync(path, { force: true });
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (Date.now() > deadline)
|
|
71
|
-
throw new Error("another of Toolroll's git commands on this checkout is still running");
|
|
72
|
-
await new Promise(done => setTimeout(done, 25));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
function alive(pid) {
|
|
76
|
-
try {
|
|
77
|
-
process.kill(pid, 0);
|
|
78
|
-
return true;
|
|
79
66
|
}
|
|
80
67
|
catch (error) {
|
|
81
|
-
|
|
68
|
+
db.close();
|
|
69
|
+
throw error;
|
|
82
70
|
}
|
|
71
|
+
let released = false;
|
|
72
|
+
return () => {
|
|
73
|
+
if (released)
|
|
74
|
+
return;
|
|
75
|
+
released = true;
|
|
76
|
+
try {
|
|
77
|
+
db.exec("ROLLBACK");
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
db.close();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
83
|
}
|
|
84
84
|
const heldHere = new AsyncLocalStorage();
|
|
85
85
|
export async function withCheckoutLock(home, checkout, work, timeoutMs) {
|
package/dist/guides.js
CHANGED
|
@@ -279,7 +279,9 @@ ${AUTHORITY_LINE}
|
|
|
279
279
|
database in \`.toolroll-secrets/up-login.txt\` (every start prints that path and the
|
|
280
280
|
\`cat\` command that shows the password, never the password itself),
|
|
281
281
|
registers the machine as a worker, runs the console, opens the browser. Later starts ask for the
|
|
282
|
-
password at most once and remember it on that machine.
|
|
282
|
+
password at most once and remember it on that machine. A forgotten
|
|
283
|
+
password: the person runs \`toolroll password reset\` in a terminal on that
|
|
284
|
+
computer (typed twice; never you, never under an agent).
|
|
283
285
|
- From a phone over a tailnet: add \`--host 0.0.0.0 --allow-host
|
|
284
286
|
<name>:4180\`.
|
|
285
287
|
- Console only, no worker: \`toolroll serve --repo .\`. With no
|
|
@@ -291,20 +293,21 @@ ${AUTHORITY_LINE}
|
|
|
291
293
|
|
|
292
294
|
## The console's screens (what each one is for)
|
|
293
295
|
|
|
294
|
-
- **
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
the dispatch order per builder (drag to reorder,
|
|
300
|
-
keep a task for it). The old pages (\`/
|
|
301
|
-
\`/
|
|
296
|
+
- **Work** (\`/\`): what needs a person first (plans to approve, questions to
|
|
297
|
+
answer, results to accept), then what is running, queued and done, with the
|
|
298
|
+
selected task beside the list (\`/?task=<id>\`). Views: Needs you, All,
|
|
299
|
+
Running, Queued, Done (\`/?view=needs-you\` and so on), the Board
|
|
300
|
+
(\`/?view=board\`), Archived, one project (\`/?project=<path>\`). Its *order*
|
|
301
|
+
view (\`/?view=order\`) is the dispatch order per builder (drag to reorder,
|
|
302
|
+
drag onto a builder to keep a task for it). The old pages (\`/tasks\`,
|
|
303
|
+
\`/inbox\`, \`/next\`, \`/board\`, \`/queue\`, \`/workbench\`, \`/done\`,
|
|
304
|
+
\`/work\`) redirect here for good.
|
|
302
305
|
- **task page** (\`/t/<id>\`): the approval ceremony when a scope waits,
|
|
303
306
|
the acts bar (plan first, hold, retry, build next, cancel), scope,
|
|
304
307
|
attempts, decisions, and — for a scout task — the report with one-tap
|
|
305
308
|
follow-ups.
|
|
306
309
|
- **builds** (\`/runs\`): every attempt, newest first; a result's own page
|
|
307
|
-
is \`/
|
|
310
|
+
is its task page's Result section (\`/t/<task>?tab=result&run=<run>\`), and activity (\`/activity\`) is the ledger. **build
|
|
308
311
|
page** (\`/r/<run>\`): one attempt: stage, live transcript, evidence,
|
|
309
312
|
the diff, comments. **peek** (\`/peek\`): every live run at once,
|
|
310
313
|
transcripts following.
|
|
@@ -319,7 +322,7 @@ ${AUTHORITY_LINE}
|
|
|
319
322
|
which messaging service pages, the Telegram bot token, and the Telegram
|
|
320
323
|
digest cadence (away mode). Notifications → Projects mutes one project's
|
|
321
324
|
pings (\`toolroll notifications mute|unmute --repo <p>\`); it still shows
|
|
322
|
-
in
|
|
325
|
+
in Work and the evening digest.
|
|
323
326
|
- The rail is four rows — inbox · board · builds · projects — and a
|
|
324
327
|
**more** group: portfolio, task list, fleet, system,
|
|
325
328
|
requirements, people, operating mode, settings. On a phone the same
|
package/dist/keymap.js
CHANGED
|
@@ -10,7 +10,7 @@ export const SHORTCUTS = [
|
|
|
10
10
|
{ keys: "p", says: "Ask for a plan (presses the button on the page)", web: { kind: "press", selectors: PLAN_SELECTORS }, tui: "plan" },
|
|
11
11
|
{ keys: "/", says: "search", web: { kind: "search" }, tui: { none: "The terminal has no search; press w to open the console." } },
|
|
12
12
|
{ keys: "g h", says: "go Home", web: { kind: "go", href: "/" }, tui: "list" },
|
|
13
|
-
{ keys: "g t", says: "go to
|
|
13
|
+
{ keys: "g t", says: "go to Work", web: { kind: "go", href: "/" }, tui: "list" },
|
|
14
14
|
{ keys: "?", says: "these shortcuts", web: { kind: "help" }, tui: "help" },
|
|
15
15
|
];
|
|
16
16
|
export const keyWords = (keys) => keys.split(" ").join(" then ");
|
package/dist/lead-cli.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { cardPlainOf, isCardProposal } from "./chat-card.js";
|
|
2
2
|
import { currentLocalOwner } from "./local-owner.js";
|
|
3
|
+
import { passwordFreeOwner } from "./task-outcome-cli.js";
|
|
3
4
|
import { parseFeedbackImage } from "./result-review.js";
|
|
4
5
|
import { configureLeadFollow, leadFollowStatus } from './lead-follow.js';
|
|
5
6
|
import { closedQuestionWords } from "./decision.js";
|
|
@@ -337,7 +338,7 @@ export async function runLeadCli(input) {
|
|
|
337
338
|
emit({ ok: outcome.ok, act: "confirm", proposal: proposal.id, ...(outcome.ok ? { said: outcome.said, taskId: outcome.taskId } : { reason: outcome.reason, said: outcome.said }) });
|
|
338
339
|
say(outcome.ok ? outcome.said : outcome.reason === "needs-confirm" ? `${outcome.said}: confirm ${act[2]} yes` : `refused: ${outcome.said}`);
|
|
339
340
|
if (outcome.ok && outcome.kind === "scope" && outcome.taskId !== null)
|
|
340
|
-
say(`approve it with your password: toolroll task approve ${outcome.taskId}`);
|
|
341
|
+
say(passwordFreeOwner(store) ? `approve it in \`toolroll\`: press a on ${outcome.taskId}` : `approve it with your password: toolroll task approve ${outcome.taskId}`);
|
|
341
342
|
}
|
|
342
343
|
continue;
|
|
343
344
|
}
|