toolroll 0.9.111 → 0.9.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +28 -29
- package/dist/action-ledger.js +13 -0
- package/dist/agent-said.js +60 -6
- package/dist/bin.js +5 -1
- package/dist/browser/terminal.js +1 -1
- package/dist/browser/workspace.js +1 -1
- package/dist/chat-channel.js +10 -0
- package/dist/cli-help.js +6 -0
- package/dist/cli.js +2 -0
- package/dist/contracts/console-api.js +2 -1
- package/dist/contracts/engine-api.js +12 -0
- package/dist/contracts/lead-tools.js +28 -0
- package/dist/easy-start.js +8 -3
- package/dist/engine-reads.js +15 -0
- package/dist/evidence.js +6 -6
- package/dist/fast-terms.js +8 -4
- package/dist/flexible-agents.js +2 -8
- package/dist/flexible-answers.js +4 -26
- package/dist/flexible-available.js +31 -1
- package/dist/flexible-import.js +2 -14
- package/dist/flexible-launch.js +15 -3
- package/dist/flexible-launcher.js +0 -5
- package/dist/flexible-relay.js +7 -4
- package/dist/flexible-session.js +123 -32
- package/dist/flexible-setting-schema.js +10 -0
- package/dist/flexible-ship.js +8 -18
- package/dist/flexible-start.js +2 -2
- package/dist/flexible-thread.js +21 -27
- package/dist/flexible-turns.js +7 -17
- package/dist/flexible.js +9 -11
- package/dist/flow-triggers.js +4 -1
- package/dist/lead-tools.js +107 -1
- package/dist/lead.js +1 -1
- package/dist/ledger-view.js +2 -1
- package/dist/live-terminal.js +28 -0
- package/dist/local-owner.js +1 -0
- package/dist/needs-you.js +10 -2
- package/dist/operate.js +62 -5
- package/dist/outbound-privacy.js +6 -1
- package/dist/plain-words.js +1 -1
- package/dist/release.js +2 -0
- package/dist/serve.js +10 -1
- package/dist/server/chat.js +6 -1
- package/dist/server/engine-api.js +91 -27
- package/dist/server/mutation-key.js +6 -0
- package/dist/server/render-history.js +2 -1
- package/dist/server/route-table.js +3 -0
- package/dist/server/settings-section-table.js +3 -0
- package/dist/server/settings-sections.js +23 -0
- package/dist/server/settings.js +36 -3
- package/dist/server/terminals.js +3 -3
- package/dist/settings-proofs.js +2 -0
- package/dist/store.js +18 -4
- 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/work-index.js +6 -2
- package/package.json +2 -1
package/dist/flexible-turns.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { flexibleAvailable } from "./flexible-available.js";
|
|
3
3
|
import { threadLevelAllowed } from "./flexible-levels.js";
|
|
4
4
|
import { flexibleDelegationAtUse, FLEXIBLE_LEVEL_WORDS, FLEXIBLE_LEVELS, FLEXIBLE_UNAVAILABLE, isFlexibleLevel } from "./flexible.js";
|
|
5
5
|
import { budgetHoldWords, budgetLabel, budgetStates, canPrice, countsToward, monthOf, priceWork, spendItems } from "./spend.js";
|
|
@@ -150,7 +150,7 @@ function validRequest(input) {
|
|
|
150
150
|
&& (input.opening === undefined || typeof input.opening === "boolean") && clockOk(input.clock);
|
|
151
151
|
}
|
|
152
152
|
export function admitFlexibleTurn(store, input) {
|
|
153
|
-
if (!
|
|
153
|
+
if (!flexibleAvailable(store))
|
|
154
154
|
return refuse("not-available");
|
|
155
155
|
if (!validRequest(input))
|
|
156
156
|
return refuse("invalid-request");
|
|
@@ -277,7 +277,7 @@ function spendRefusal(store, repo, owner, provider, billing, terms, now, modeRea
|
|
|
277
277
|
return budgetRefusal(store, repo, owner, provider, now);
|
|
278
278
|
}
|
|
279
279
|
export function beginFlexibleTurn(store, input) {
|
|
280
|
-
if (!
|
|
280
|
+
if (!flexibleAvailable(store))
|
|
281
281
|
return refuse("not-available");
|
|
282
282
|
if (!clockOk(input.clock))
|
|
283
283
|
return refuse("invalid-request");
|
|
@@ -327,8 +327,6 @@ function priced(store, turn, usage, model) {
|
|
|
327
327
|
return { microusd: Math.max(0, price.microusd), basis: price.source === "reported" ? "measured" : "estimated" };
|
|
328
328
|
}
|
|
329
329
|
export function chargeFlexibleTurn(store, input) {
|
|
330
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
331
|
-
return refuse("not-available");
|
|
332
330
|
if (!validUsage(input.usage) || (input.model !== undefined && (typeof input.model !== "string" || !MODEL.test(input.model)))
|
|
333
331
|
|| (input.incomplete !== undefined && typeof input.incomplete !== "boolean"))
|
|
334
332
|
return refuse("invalid-request");
|
|
@@ -347,8 +345,6 @@ export function chargeFlexibleTurn(store, input) {
|
|
|
347
345
|
});
|
|
348
346
|
}
|
|
349
347
|
export function finishFlexibleTurn(store, input) {
|
|
350
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
351
|
-
return refuse("not-available");
|
|
352
348
|
if ((input.outcome !== "finished" && input.outcome !== "unknown") || (input.usage !== null && !validUsage(input.usage)) || !clockOk(input.clock))
|
|
353
349
|
return refuse("invalid-request");
|
|
354
350
|
return store.transact(() => {
|
|
@@ -377,8 +373,6 @@ export function finishFlexibleTurn(store, input) {
|
|
|
377
373
|
});
|
|
378
374
|
}
|
|
379
375
|
export function interruptFlexibleTurnsOf(store, input) {
|
|
380
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
381
|
-
return refuse("not-available");
|
|
382
376
|
if (typeof input.holder !== "string" || !KEY.test(input.holder) || !clockOk(input.clock))
|
|
383
377
|
return refuse("invalid-request");
|
|
384
378
|
return store.transact(() => {
|
|
@@ -407,8 +401,6 @@ export function interruptFlexibleTurnsOf(store, input) {
|
|
|
407
401
|
const INSTALLATION_LIMITS = { liveThreads: 1000, turnsPerDay: 1_000_000, measuredMicrousdPerDay: 100_000_000 * 1_000_000 };
|
|
408
402
|
const limitOk = (value, max) => value === null || (typeof value === "number" && Number.isSafeInteger(value) && value >= 1 && value <= max);
|
|
409
403
|
export function setFlexibleInstallationCaps(store, input) {
|
|
410
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
411
|
-
return refuse("not-available");
|
|
412
404
|
const caps = input.caps;
|
|
413
405
|
if (typeof caps !== "object" || caps === null || !limitOk(caps.liveThreads, INSTALLATION_LIMITS.liveThreads) || !limitOk(caps.turnsPerDay, INSTALLATION_LIMITS.turnsPerDay)
|
|
414
406
|
|| !limitOk(caps.measuredMicrousdPerDay, INSTALLATION_LIMITS.measuredMicrousdPerDay) || !clockOk(input.clock))
|
|
@@ -418,6 +410,10 @@ export function setFlexibleInstallationCaps(store, input) {
|
|
|
418
410
|
if (account === null || account.revokedAt !== null || !store.isInstanceOperator(input.by))
|
|
419
411
|
return refuse("not-an-operator");
|
|
420
412
|
const before = flexibleInstallationCaps(store);
|
|
413
|
+
const tighter = (now, was) => now !== null && (was === null || now <= was);
|
|
414
|
+
if (!flexibleAvailable(store) && !(tighter(caps.liveThreads, before.liveThreads) && tighter(caps.turnsPerDay, before.turnsPerDay)
|
|
415
|
+
&& tighter(caps.measuredMicrousdPerDay, before.measuredMicrousdPerDay)))
|
|
416
|
+
return refuse("not-available");
|
|
421
417
|
const at = timeOf(input.clock).toISOString();
|
|
422
418
|
store.handle.prepare(`INSERT INTO flexible_installation_caps (id, live_threads, turns_per_day, measured_microusd_per_day, updated_by, updated_at) VALUES (1, ?, ?, ?, ?, ?)
|
|
423
419
|
ON CONFLICT (id) DO UPDATE SET live_threads = excluded.live_threads, turns_per_day = excluded.turns_per_day, measured_microusd_per_day = excluded.measured_microusd_per_day,
|
|
@@ -428,8 +424,6 @@ export function setFlexibleInstallationCaps(store, input) {
|
|
|
428
424
|
});
|
|
429
425
|
}
|
|
430
426
|
export function withdrawFlexibleTurn(store, input) {
|
|
431
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
432
|
-
return refuse("not-available");
|
|
433
427
|
if (typeof input.detail !== "string" || !clockOk(input.clock))
|
|
434
428
|
return refuse("invalid-request");
|
|
435
429
|
return store.transact(() => {
|
|
@@ -446,8 +440,6 @@ export function withdrawFlexibleTurn(store, input) {
|
|
|
446
440
|
});
|
|
447
441
|
}
|
|
448
442
|
export function interruptFlexibleThreadTurns(store, input) {
|
|
449
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
450
|
-
return refuse("not-available");
|
|
451
443
|
if (typeof input.thread !== "string" || typeof input.detail !== "string" || !clockOk(input.clock))
|
|
452
444
|
return refuse("invalid-request");
|
|
453
445
|
return store.transact(() => {
|
|
@@ -471,8 +463,6 @@ export function interruptFlexibleThreadTurns(store, input) {
|
|
|
471
463
|
});
|
|
472
464
|
}
|
|
473
465
|
export function withdrawFlexibleTurnsAbove(store, input) {
|
|
474
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
475
|
-
return refuse("not-available");
|
|
476
466
|
if (typeof input.thread !== "string" || !isFlexibleLevel(input.level) || typeof input.detail !== "string" || !clockOk(input.clock))
|
|
477
467
|
return refuse("invalid-request");
|
|
478
468
|
return store.transact(() => {
|
package/dist/flexible.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { canonicalJson } from "./canonical-json.js";
|
|
3
|
-
import {
|
|
3
|
+
import { flexibleAvailable } from "./flexible-available.js";
|
|
4
4
|
export const FLEXIBLE_LEVELS = ["supervised", "auto", "full"];
|
|
5
5
|
export const FLEXIBLE_TERMS_VERSION = 1;
|
|
6
6
|
export const FLEXIBLE_DEFAULT_CAPS = Object.freeze({ liveThreads: 3, turnsPerDayProject: 300, turnsPerDayPerson: 150, measuredMicrousdPerDay: null });
|
|
@@ -170,7 +170,7 @@ export function flexibleStanding(store, repo) {
|
|
|
170
170
|
const lapse = lapseOf(store, read.terms);
|
|
171
171
|
return lapse === null ? { state: "on", ...read } : { state: "lapsed", reason: lapse, ...read };
|
|
172
172
|
}
|
|
173
|
-
export const FLEXIBLE_UNAVAILABLE = "
|
|
173
|
+
export const FLEXIBLE_UNAVAILABLE = "Interactive agent threads are off: Settings → General, or `toolroll config set flexible on`.";
|
|
174
174
|
const WORDS = Object.freeze({
|
|
175
175
|
"not-available": FLEXIBLE_UNAVAILABLE,
|
|
176
176
|
"not-an-approver": "Only an approver for this project can do that. Nothing changed.",
|
|
@@ -231,7 +231,7 @@ function insertRow(store, row, now) {
|
|
|
231
231
|
return Number(written.lastInsertRowid);
|
|
232
232
|
}
|
|
233
233
|
export function enableFlexible(store, input) {
|
|
234
|
-
if (!
|
|
234
|
+
if (!flexibleAvailable(store))
|
|
235
235
|
return refuse("not-available");
|
|
236
236
|
if (input.proof !== "password-now" && input.proof !== "sso-now")
|
|
237
237
|
return refuse("proof-required");
|
|
@@ -255,8 +255,6 @@ export function enableFlexible(store, input) {
|
|
|
255
255
|
});
|
|
256
256
|
}
|
|
257
257
|
export function lowerFlexible(store, input) {
|
|
258
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
259
|
-
return refuse("not-available");
|
|
260
258
|
if (!isFlexibleLevel(input.max))
|
|
261
259
|
return refuse("invalid-choice");
|
|
262
260
|
return store.transact(() => {
|
|
@@ -286,8 +284,6 @@ export function lowerFlexible(store, input) {
|
|
|
286
284
|
});
|
|
287
285
|
}
|
|
288
286
|
export function turnFlexibleOff(store, input) {
|
|
289
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
290
|
-
return refuse("not-available");
|
|
291
287
|
return store.transact(() => {
|
|
292
288
|
if (approverHere(store, input.by, input.repo) === null)
|
|
293
289
|
return refuse("not-an-approver");
|
|
@@ -328,7 +324,7 @@ export function endLapsedFlexible(store, which, by, now) {
|
|
|
328
324
|
}
|
|
329
325
|
}
|
|
330
326
|
export function flexibleDelegationAtUse(store, input) {
|
|
331
|
-
if (!
|
|
327
|
+
if (!flexibleAvailable(store))
|
|
332
328
|
return refuse("not-available");
|
|
333
329
|
return store.transact(() => {
|
|
334
330
|
const standing = flexibleStanding(store, input.repo);
|
|
@@ -360,9 +356,11 @@ export function flexibleDelegationAtUse(store, input) {
|
|
|
360
356
|
});
|
|
361
357
|
}
|
|
362
358
|
export function flexibleSettingsView(store, repo, viewer) {
|
|
363
|
-
|
|
359
|
+
const standing = flexibleStanding(store, repo);
|
|
360
|
+
const on = flexibleAvailable(store);
|
|
361
|
+
if (!on && standing.state === "secure")
|
|
364
362
|
return undefined;
|
|
365
|
-
const proposed = viewer.canChange ? proposedFlexibleTerms(store, repo, viewer.name) : refuse("not-an-approver");
|
|
366
|
-
return { repo, standing
|
|
363
|
+
const proposed = !on ? refuse("not-available") : viewer.canChange ? proposedFlexibleTerms(store, repo, viewer.name) : refuse("not-an-approver");
|
|
364
|
+
return { repo, standing, canChange: viewer.canChange,
|
|
367
365
|
proposal: proposed.ok ? { terms: proposed.terms, digest: proposed.digest } : { problem: proposed.message.replace(/ Nothing changed\.$/, "") } };
|
|
368
366
|
}
|
package/dist/flow-triggers.js
CHANGED
|
@@ -804,7 +804,10 @@ async function checkTrigger(store, trigger, config, now, io) {
|
|
|
804
804
|
const more = fetched.more ?? fresh.length > CARDS_PER_CHECK;
|
|
805
805
|
const cursor = fetched.more !== undefined ? fetched.cursor ?? trigger.cursor : more ? due.at(-1)?.at ?? trigger.cursor : fetched.cursor ?? trigger.cursor;
|
|
806
806
|
const said = results.length === 0 && fetched.said !== undefined ? fetched.said : outcomeWords(results, more);
|
|
807
|
-
store.
|
|
807
|
+
store.transact(() => {
|
|
808
|
+
const moved = store.getFlowTrigger(trigger.id)?.cursor !== trigger.cursor;
|
|
809
|
+
store.updateFlowTrigger(trigger.id, { failures: 0, ...(moved ? {} : { cursor }), lastAt: now.toISOString(), lastOutcome: said, nextAt: new Date(now.getTime() + POLL_EVERY_MS).toISOString() }, now);
|
|
810
|
+
});
|
|
808
811
|
return { ok: true, said, added: results.filter(one => one.made === "added").length };
|
|
809
812
|
}
|
|
810
813
|
async function fetchMail(store, config, trigger, io, now) {
|
package/dist/lead-tools.js
CHANGED
|
@@ -71,6 +71,8 @@ import { aboutYouOf, checkAboutYouLine } from "./lead-about.js";
|
|
|
71
71
|
import { steerStandingWords } from "./steer-status.js";
|
|
72
72
|
import { agentQuestion, openAgentQuestions } from "./agent-board.js";
|
|
73
73
|
import { utcMinute } from "./when-html.js";
|
|
74
|
+
import { RECORD_WHOLE_MAX, recordActionWhole } from "./action-ledger.js";
|
|
75
|
+
import { VIEW_CHANGES_PER_MINUTE, VIEW_LEDGER_ACTION } from "./view-tools.js";
|
|
74
76
|
const REPO_ID = /^r[0-9]{1,3}$/;
|
|
75
77
|
const TASK_ID = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
76
78
|
const ISO_STAMP = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z$/;
|
|
@@ -334,6 +336,8 @@ export const LEAD_CORE_TOOLS = new Set([
|
|
|
334
336
|
"get_agents", "propose_dependency_repair",
|
|
335
337
|
]);
|
|
336
338
|
const LEAD_TOOL_KEYWORDS = {
|
|
339
|
+
toolroll_view_read: ["workbench", "theme", "colours", "colors", "look", "restyle", "style", "terminal", "dark", "light"],
|
|
340
|
+
toolroll_view_set: ["workbench", "theme", "colours", "colors", "look", "restyle", "style", "density", "glyphs", "columns", "make it look"],
|
|
337
341
|
show_card: ["findings", "handover", "card", "table", "chart", "graph", "report", "summary", "numbers", "data", "spend", "projects", "builders", "workers", "integrations", "show", "dashboard"],
|
|
338
342
|
propose_flow: ["flow", "automation", "workflow", "schedule", "trigger", "every", "when", "email", "inbox", "sort", "follow-up", "nudge"],
|
|
339
343
|
get_findings: ["finding", "findings", "review", "handover", "follow-through", "failed check", "send back"],
|
|
@@ -383,6 +387,54 @@ function summaryLine(description) {
|
|
|
383
387
|
const first = /^(.+?[.!?])(\s|$)/.exec(description)?.[1] ?? description;
|
|
384
388
|
return first.length <= 160 ? first : `${first.slice(0, 157).trimEnd()}…`;
|
|
385
389
|
}
|
|
390
|
+
function viewRefusal(ctx) {
|
|
391
|
+
if (ctx.view === undefined || teamRoomOf(ctx.store, ctx.thread) !== null) {
|
|
392
|
+
return { ok: false, message: "Restyling the workbench is for the person's own conversation in the console on this computer: ask there, or they can edit tui.toml themselves." };
|
|
393
|
+
}
|
|
394
|
+
return null;
|
|
395
|
+
}
|
|
396
|
+
const VIEW_HISTORY_SCAN = 200;
|
|
397
|
+
function viewHistory(ctx) {
|
|
398
|
+
const rows = ctx.store.handle.prepare("SELECT id, at, outcome, detail FROM action_ledger WHERE actor = ? AND action = ? ORDER BY id DESC LIMIT ?")
|
|
399
|
+
.all(ctx.who.name, VIEW_LEDGER_ACTION, VIEW_HISTORY_SCAN).reverse();
|
|
400
|
+
const parsed = (text) => {
|
|
401
|
+
if (typeof text !== "string")
|
|
402
|
+
return null;
|
|
403
|
+
try {
|
|
404
|
+
const value = JSON.parse(text);
|
|
405
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
406
|
+
}
|
|
407
|
+
catch {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
};
|
|
411
|
+
const pending = [];
|
|
412
|
+
const byId = new Map();
|
|
413
|
+
for (const row of rows) {
|
|
414
|
+
const detail = parsed(row["detail"]);
|
|
415
|
+
if (row["outcome"] === "pending") {
|
|
416
|
+
const change = detail?.["change"];
|
|
417
|
+
const one = { id: Number(row["id"]), at: String(row["at"]), change: typeof change === "object" && change !== null ? change : null, final: null };
|
|
418
|
+
pending.push(one);
|
|
419
|
+
byId.set(one.id, one);
|
|
420
|
+
}
|
|
421
|
+
else if (row["outcome"] === "done" || row["outcome"] === "failed" || row["outcome"] === "uncertain") {
|
|
422
|
+
const of = byId.get(Number(detail?.["pending"]));
|
|
423
|
+
if (of !== undefined && of.final === null)
|
|
424
|
+
of.final = row["outcome"];
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return pending;
|
|
428
|
+
}
|
|
429
|
+
const VIEW_UNCONFIRMED_MS = 60_000;
|
|
430
|
+
export const VIEW_UNCERTAIN_WORDS = "This change may or may not have applied: the workbench never confirmed it.";
|
|
431
|
+
function settleViewChanges(ctx) {
|
|
432
|
+
const stale = ctx.now.getTime() - VIEW_UNCONFIRMED_MS;
|
|
433
|
+
for (const one of viewHistory(ctx).filter(row => row.final === null && Date.parse(row.at) < stale)) {
|
|
434
|
+
recordActionWhole(ctx.store.handle, { at: ctx.now.toISOString(), actor: ctx.who.name, repo: null, taskId: null, runId: null, action: VIEW_LEDGER_ACTION,
|
|
435
|
+
outcome: "uncertain", source: "request" }, { pending: one.id, said: VIEW_UNCERTAIN_WORDS });
|
|
436
|
+
}
|
|
437
|
+
}
|
|
386
438
|
function controlTarget(ctx, args) {
|
|
387
439
|
const control = args["control"];
|
|
388
440
|
if (!isChatControl(control))
|
|
@@ -2205,6 +2257,60 @@ const LEAD_TOOL_HANDLERS = {
|
|
|
2205
2257
|
return { ok: true, body: { proposal: proposalId, kind: "answer", decision: id, option: chosen.id, awaiting: chosen.reversible ? "the operator's confirmation" : "the operator's explicit confirmation — this option is irreversible" } };
|
|
2206
2258
|
},
|
|
2207
2259
|
},
|
|
2260
|
+
toolroll_view_read: {
|
|
2261
|
+
description: "Read the person's terminal workbench look before restyling it: its settings, what may be changed and to what, the theme roles (what each colours), the built-in and saved themes, and a short styling guide. Only in the person's own conversation on this computer.",
|
|
2262
|
+
handle: ctx => {
|
|
2263
|
+
const refused = viewRefusal(ctx);
|
|
2264
|
+
if (refused !== null)
|
|
2265
|
+
return refused;
|
|
2266
|
+
const read = ctx.view("read");
|
|
2267
|
+
if (!read.ok)
|
|
2268
|
+
return { ok: false, message: read.why };
|
|
2269
|
+
settleViewChanges(ctx);
|
|
2270
|
+
const body = read.body;
|
|
2271
|
+
return { ok: true, body: { settings: body["settings"], colors: body["colors"], allowed: body["allowed"], roles: body["roles"], themes: body["themes"], guide: body["guide"] } };
|
|
2272
|
+
},
|
|
2273
|
+
},
|
|
2274
|
+
toolroll_view_set: {
|
|
2275
|
+
description: "Restyle the person's terminal workbench (tui.toml) when they ask: a theme (built-in or saved), a saved theme of your own (save_theme: name, base, role colours; use: true switches to it, so 'make it look like X' is reusable), role colours (never a status's), density, glyphs, list columns (add only), list side, reduced motion, key bar, costs, notifications (on only: turning anything off is the person's). Read toolroll_view_read first. Contrast is enforced on every colour pair drawn: a change that makes text too faint is refused with the reason. Keys are never changed here (the person changes them). The running workbench repaints within a second; the person can undo with `toolroll view reset`.",
|
|
2276
|
+
handle: (ctx, args) => {
|
|
2277
|
+
const refused = viewRefusal(ctx);
|
|
2278
|
+
if (refused !== null)
|
|
2279
|
+
return refused;
|
|
2280
|
+
const raw = args;
|
|
2281
|
+
if ("keys" in raw)
|
|
2282
|
+
return { ok: false, message: "Keys can't be changed by an agent: they stay with the person (tui.toml's [keys], or the workbench's Settings screen), so an accept or a cancel never becomes a one-key accident." };
|
|
2283
|
+
const allowed = new Set(Object.keys(LEAD_TOOL_INPUTS.toolroll_view_set.shape));
|
|
2284
|
+
const unknown = Object.keys(raw).filter(key => !allowed.has(key));
|
|
2285
|
+
if (unknown.length > 0)
|
|
2286
|
+
return { ok: false, message: `toolroll_view_set takes ${[...allowed].join(", ")}; not ${unknown.slice(0, 3).map(one => redactForLead(one.slice(0, 32), { repos: [], names: [] })).join(", ")}.` };
|
|
2287
|
+
const change = Object.fromEntries(Object.entries(raw).filter(([, value]) => value !== undefined));
|
|
2288
|
+
if (Object.keys(change).length === 0)
|
|
2289
|
+
return { ok: false, message: "Nothing to change: name at least one setting." };
|
|
2290
|
+
const text = JSON.stringify(change);
|
|
2291
|
+
if (text.length > RECORD_WHOLE_MAX - 64)
|
|
2292
|
+
return { ok: false, message: "That change is too large: change a few settings at a time." };
|
|
2293
|
+
settleViewChanges(ctx);
|
|
2294
|
+
const since = ctx.now.getTime() - 60_000;
|
|
2295
|
+
const recent = viewHistory(ctx).filter(one => Date.parse(one.at) > since && one.final !== "failed").length;
|
|
2296
|
+
if (recent >= VIEW_CHANGES_PER_MINUTE)
|
|
2297
|
+
return { ok: false, message: `That's ${VIEW_CHANGES_PER_MINUTE} workbench changes in a minute; wait a moment before the next.` };
|
|
2298
|
+
const entry = { at: ctx.now.toISOString(), actor: ctx.who.name, repo: null, taskId: null, runId: null, action: VIEW_LEDGER_ACTION, source: "request" };
|
|
2299
|
+
const pending = recordActionWhole(ctx.store.handle, { ...entry, outcome: "pending" }, { change });
|
|
2300
|
+
const set = ctx.view("set", text);
|
|
2301
|
+
if (!set.ok) {
|
|
2302
|
+
if (set.unsure === true) {
|
|
2303
|
+
recordActionWhole(ctx.store.handle, { ...entry, outcome: "uncertain" }, { pending, said: VIEW_UNCERTAIN_WORDS, why: set.why.slice(0, 200) });
|
|
2304
|
+
return { ok: false, message: `${set.why}. This change may or may not have applied: read the workbench's settings before trying again.` };
|
|
2305
|
+
}
|
|
2306
|
+
recordActionWhole(ctx.store.handle, { ...entry, outcome: "failed" }, { pending, why: set.why.slice(0, 500) });
|
|
2307
|
+
return { ok: false, message: set.why };
|
|
2308
|
+
}
|
|
2309
|
+
const changed = Array.isArray(set.body["changed"]) ? set.body["changed"].filter((one) => typeof one === "string").slice(0, 40) : [];
|
|
2310
|
+
recordActionWhole(ctx.store.handle, { ...entry, outcome: "done" }, { pending, changed });
|
|
2311
|
+
return { ok: true, body: { changed, said: "Saved to tui.toml; the running workbench shows it within a second. `toolroll view reset` undoes it (the previous file is kept as tui.toml.bak)." } };
|
|
2312
|
+
},
|
|
2313
|
+
},
|
|
2208
2314
|
propose_cancel: {
|
|
2209
2315
|
description: "Propose task cancellation/reason; operator must arm and confirm.",
|
|
2210
2316
|
handle: (ctx, args) => {
|
|
@@ -2223,7 +2329,7 @@ const LEAD_TOOL_HANDLERS = {
|
|
|
2223
2329
|
};
|
|
2224
2330
|
export const LEAD_TOOLS = Object.keys(LEAD_TOOL_INPUTS).map((name) => {
|
|
2225
2331
|
const input = LEAD_TOOL_INPUTS[name];
|
|
2226
|
-
const reader = name === "propose_flow" ? LEAD_TOOL_READ_INPUTS[name] : name === "propose_action" ? LEAD_TOOL_READ_INPUTS[name].loose() : LEAD_TOOL_READ_INPUTS[name].strip();
|
|
2332
|
+
const reader = name === "propose_flow" ? LEAD_TOOL_READ_INPUTS[name] : name === "propose_action" || name === "toolroll_view_set" ? LEAD_TOOL_READ_INPUTS[name].loose() : LEAD_TOOL_READ_INPUTS[name].strip();
|
|
2227
2333
|
const handler = LEAD_TOOL_HANDLERS[name];
|
|
2228
2334
|
return {
|
|
2229
2335
|
name,
|
package/dist/lead.js
CHANGED
|
@@ -523,7 +523,7 @@ export async function runLeadTurn(input) {
|
|
|
523
523
|
}
|
|
524
524
|
const progressId = `${turnId}:${steps}:${index}`;
|
|
525
525
|
progress({ kind: "tool", turn: turnId, step: steps, id: progressId, label: leadToolLabel(call.name) });
|
|
526
|
-
const toolContext = () => ({ store, who, now: clock(), draft, selectEvidence, ...(input.replyImage === undefined ? {} : { replyImage: input.replyImage }), step: steps, readDecisions, readResults, searchedMemory, checkedCapabilities, ask, findTools, ...(input.integrations === undefined ? {} : { integrations: input.integrations }), thread: thread.id, turn: turnId, ...(promiseChannelOfTurn(input.channel) === undefined ? {} : { channel: promiseChannelOfTurn(input.channel) }), ...(input.evidenceRoot === undefined ? {} : { evidenceRoot: input.evidenceRoot }), ...(input.mediaDelivery === undefined ? {} : { mediaDelivery: input.mediaDelivery }) });
|
|
526
|
+
const toolContext = () => ({ store, who, now: clock(), draft, selectEvidence, ...(input.replyImage === undefined ? {} : { replyImage: input.replyImage }), step: steps, readDecisions, readResults, searchedMemory, checkedCapabilities, ask, findTools, ...(input.integrations === undefined ? {} : { integrations: input.integrations }), thread: thread.id, turn: turnId, ...(promiseChannelOfTurn(input.channel) === undefined ? {} : { channel: promiseChannelOfTurn(input.channel) }), ...(input.evidenceRoot === undefined ? {} : { evidenceRoot: input.evidenceRoot }), ...(input.mediaDelivery === undefined ? {} : { mediaDelivery: input.mediaDelivery }), ...(input.view === undefined ? {} : { view: input.view }) });
|
|
527
527
|
let startPrepared;
|
|
528
528
|
if (call.name === "propose_start" && advertisedNames.has(call.name)) {
|
|
529
529
|
const checked = startInputOf(toolContext(), call.args);
|
package/dist/ledger-view.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { detailShown } from "./action-ledger.js";
|
|
1
2
|
import { projectName } from "./project.js";
|
|
2
3
|
import { exactWhenHtml } from "./when-html.js";
|
|
3
4
|
import { html, postForm } from "./html.js";
|
|
@@ -44,7 +45,7 @@ ${text("ledger-outcome", "Outcome", "outcome", "Any outcome")}${text("ledger-tas
|
|
|
44
45
|
const byActor = new URLSearchParams(kept);
|
|
45
46
|
byActor.set("actor", row.actor);
|
|
46
47
|
return html `<article class="h-audit" data-ledger-id="${row.id}"><span class="h-audit-time k-num">${exactWhenHtml(row.at)}</span>\
|
|
47
|
-
<span class="h-audit-what"><a class="h-actor" href="/ledger?${byActor.toString()}" title="Only this actor's actions">${row.actor}</a> ${row.action}${row.detail === null ? "" : html `<span class="h-audit-detail">${row.detail}</span>`}</span>\
|
|
48
|
+
<span class="h-audit-what"><a class="h-actor" href="/ledger?${byActor.toString()}" title="Only this actor's actions">${row.actor}</a> ${row.action}${row.detail === null ? "" : html `<span class="h-audit-detail">${detailShown(row.detail)}</span>`}</span>\
|
|
48
49
|
<span class="h-audit-place">${row.repo === null ? "Instance" : projectName(row.repo)} ${subject}</span><span class="h-audit-out">${row.outcome} · ${row.source}</span></article>`;
|
|
49
50
|
})}</div>`;
|
|
50
51
|
const paging = kept.has("before") || params.has("before") || more
|
package/dist/live-terminal.js
CHANGED
|
@@ -30,6 +30,17 @@ export function pendingInputOf(pty) {
|
|
|
30
30
|
}
|
|
31
31
|
return bytes;
|
|
32
32
|
}
|
|
33
|
+
export function dropPendingInput(pty) {
|
|
34
|
+
const stream = pty?._writeStream;
|
|
35
|
+
if (stream === undefined || !Array.isArray(stream._writeQueue))
|
|
36
|
+
return false;
|
|
37
|
+
stream._writeQueue.length = 0;
|
|
38
|
+
if (stream._writeImmediate !== undefined) {
|
|
39
|
+
clearImmediate(stream._writeImmediate);
|
|
40
|
+
stream._writeImmediate = undefined;
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
33
44
|
export function loadPtySpawn() {
|
|
34
45
|
try {
|
|
35
46
|
const pty = createRequire(import.meta.url)("@lydell/node-pty");
|
|
@@ -46,6 +57,7 @@ export function loadPtySpawn() {
|
|
|
46
57
|
kill: signal => native.kill(signal),
|
|
47
58
|
pause: () => native.pause(),
|
|
48
59
|
resume: () => native.resume(),
|
|
60
|
+
dropInput: () => { dropPendingInput(native); },
|
|
49
61
|
};
|
|
50
62
|
};
|
|
51
63
|
}
|
|
@@ -311,6 +323,10 @@ export class TerminalHost {
|
|
|
311
323
|
this.flow(session);
|
|
312
324
|
});
|
|
313
325
|
pty.onExit(({ exitCode, signal }) => {
|
|
326
|
+
try {
|
|
327
|
+
pty.dropInput?.();
|
|
328
|
+
}
|
|
329
|
+
catch { }
|
|
314
330
|
session.pty = null;
|
|
315
331
|
if (session.flowTimer !== null) {
|
|
316
332
|
clearInterval(session.flowTimer);
|
|
@@ -452,6 +468,10 @@ export class TerminalHost {
|
|
|
452
468
|
this.flow(session);
|
|
453
469
|
});
|
|
454
470
|
pty.onExit(({ exitCode, signal }) => {
|
|
471
|
+
try {
|
|
472
|
+
pty.dropInput?.();
|
|
473
|
+
}
|
|
474
|
+
catch { }
|
|
455
475
|
session.pty = null;
|
|
456
476
|
if (session.flowTimer !== null) {
|
|
457
477
|
clearInterval(session.flowTimer);
|
|
@@ -731,6 +751,10 @@ export class TerminalHost {
|
|
|
731
751
|
return found;
|
|
732
752
|
};
|
|
733
753
|
const signal = (found, name) => {
|
|
754
|
+
try {
|
|
755
|
+
session.pty?.dropInput?.();
|
|
756
|
+
}
|
|
757
|
+
catch { }
|
|
734
758
|
const table = this.processes();
|
|
735
759
|
if (table === null)
|
|
736
760
|
readable = false;
|
|
@@ -764,6 +788,10 @@ export class TerminalHost {
|
|
|
764
788
|
let cleanup = "uncertain";
|
|
765
789
|
try {
|
|
766
790
|
if (process.platform === "win32") {
|
|
791
|
+
try {
|
|
792
|
+
session.pty?.dropInput?.();
|
|
793
|
+
}
|
|
794
|
+
catch { }
|
|
767
795
|
try {
|
|
768
796
|
session.pty?.kill();
|
|
769
797
|
}
|
package/dist/local-owner.js
CHANGED
package/dist/needs-you.js
CHANGED
|
@@ -3,7 +3,8 @@ export const START_BUILDER_HREF = "/settings/computers?section=start";
|
|
|
3
3
|
export const startBuilderHref = (taskId) => taskId === null ? START_BUILDER_HREF : `/settings/computers?task=${encodeURIComponent(taskId)}§ion=start`;
|
|
4
4
|
export const START_BUILDER_COMMAND = "toolroll up";
|
|
5
5
|
const always = () => true;
|
|
6
|
-
const build = (context) => context.build == null ? "the last build"
|
|
6
|
+
const build = (context) => context.build == null ? "the last build"
|
|
7
|
+
: context.attempt == null ? `build #${context.build}` : `attempt ${context.attempt} (build #${context.build})`;
|
|
7
8
|
const Build = (context) => context.build == null ? "The last build" : `Build #${context.build}`;
|
|
8
9
|
export const NEEDS = {
|
|
9
10
|
approval: { sentence: () => "Review the plan and approve it to start.", action: { code: "approve-scope", label: "Approve plan" } },
|
|
@@ -102,7 +103,9 @@ export const WAITS = {
|
|
|
102
103
|
"plan-next": () => "Waiting to plan.",
|
|
103
104
|
"research-next": () => "Waiting to research.",
|
|
104
105
|
"builders-busy": () => "Waiting its turn: builders are busy.",
|
|
105
|
-
"retry-later": context =>
|
|
106
|
+
"retry-later": context => context.attempt != null && context.build != null
|
|
107
|
+
? `Waiting: Toolroll tries attempt ${context.attempt + 1} ${context.retry ?? "soon"}, after attempt ${context.attempt} (build #${context.build}).`
|
|
108
|
+
: `Waiting: Toolroll retries ${build(context)} ${context.retry ?? "soon"}.`,
|
|
106
109
|
"app-update": () => "Waiting: Toolroll is updating. New work starts after it.",
|
|
107
110
|
"other-task": context => context.task == null ? "Waiting for another task to finish first." : `Waiting for ${context.task} to finish first.`,
|
|
108
111
|
};
|
|
@@ -320,3 +323,8 @@ export function retryNoteOf(suggestion) {
|
|
|
320
323
|
return plain;
|
|
321
324
|
return `${plain.slice(0, RETRY_NOTE_LIMIT - 1).replace(/\s+\S*$/, "").replace(/[,;:\s]+$/, "")}…`;
|
|
322
325
|
}
|
|
326
|
+
export function runWords(runs, id) {
|
|
327
|
+
const builds = runs.filter(one => one.role === "builder" || one.role === "scout" || one.role === "repair").map(one => one.id).sort((a, b) => a - b);
|
|
328
|
+
const at = builds.indexOf(id);
|
|
329
|
+
return at < 0 ? `build #${id}` : `attempt ${at + 1} (build #${id})`;
|
|
330
|
+
}
|
package/dist/operate.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FLEXIBLE_CANDIDATE_FIXED, FLEXIBLE_FILED_PREFIX, flexibleMergeRefusal } from "./flexible-merge-guard.js";
|
|
2
2
|
import { flexibleArmedPass } from "./flexible-ship.js";
|
|
3
|
+
import { stopFlexibleThreadsEverywhere } from "./flexible-session.js";
|
|
3
4
|
import { runCardCommand } from "./card-cli.js";
|
|
4
5
|
import { mintSecret } from "./secret-mint.js";
|
|
5
6
|
import { ACP_AGENTS, ACP_PROVIDER_IDS, isAcpProvider, isKeyedProvider } from "./acp-agents.js";
|
|
@@ -266,13 +267,14 @@ import { latestRelease, newerRelease, notifySecurityRelease, notifyVersionLive,
|
|
|
266
267
|
import { installMethod } from "./install-method.js";
|
|
267
268
|
import { PACKAGE_VERSION } from "./version.js";
|
|
268
269
|
import { machineActing } from "./scope.js";
|
|
269
|
-
import {
|
|
270
|
+
import { flexibleAvailable, flexibleSetting, setFlexibleSetting } from "./flexible-available.js";
|
|
270
271
|
import { enableFlexible, FLEXIBLE_LAPSE_WORDS, FLEXIBLE_LEVEL_WORDS, FLEXIBLE_UNAVAILABLE, flexibleStanding, flexibleTermsWords, isFlexibleLevel, lowerFlexible, proposedFlexibleTerms, turnFlexibleOff } from "./flexible.js";
|
|
271
272
|
import { reevaluateResultRecords } from "./route-results.js";
|
|
272
273
|
import { holdRuleOff, routeRulesPass, taskEvidenceWords } from "./route-rules.js";
|
|
273
274
|
import { ruleHoldOf } from "./route-store.js";
|
|
274
275
|
import { wasInterrupted } from "./run-ending.js";
|
|
275
276
|
import { loginFileOf, migrateLegacyLogin, removeStaleSavedLogin, savedLoginFile, writableLoginFile } from "./login-secrets.js";
|
|
277
|
+
import { runWords } from "./needs-you.js";
|
|
276
278
|
export const EXIT = { ok: 0, failed: 1, usage: 2, refused: 3 };
|
|
277
279
|
const STATES = ["queued", "running", "done", "failed", "cancelled"];
|
|
278
280
|
export const OPERATE_HELP = `toolroll — operating the queue
|
|
@@ -585,6 +587,10 @@ Agents — which provider and model each phase runs on
|
|
|
585
587
|
size each new task with a quick model call (Claude Haiku, on your
|
|
586
588
|
plan) before you approve; off, the default, sizes from the words alone
|
|
587
589
|
and plans anything uncertain (config show task-sizing says which)
|
|
590
|
+
toolroll config set flexible on|off --as <you> --token <t>
|
|
591
|
+
interactive agent threads (beta), off by default: T in the workbench
|
|
592
|
+
starts a Claude Code thread inside Toolroll's sandbox, with your Claude
|
|
593
|
+
sign-in relayed (config show flexible says which)
|
|
588
594
|
toolroll chat --as <you> [--repo <path>…] [--say "…"] [--end]
|
|
589
595
|
[--ceiling-usd <n>] [--json] (password at the prompt;
|
|
590
596
|
--token <t> only for scripts — it lands in shell history)
|
|
@@ -4229,6 +4235,8 @@ async function configCommand(positional, flags, context) {
|
|
|
4229
4235
|
return quickAnswersConfig(action ?? "show", repoGiven !== undefined, flags, context);
|
|
4230
4236
|
if (phase === "task-sizing")
|
|
4231
4237
|
return taskSizingConfig(action ?? "show", positional[2], repoGiven !== undefined, flags, context);
|
|
4238
|
+
if (phase === "flexible")
|
|
4239
|
+
return flexibleConfig(action ?? "show", positional[2], repoGiven !== undefined, flags, context);
|
|
4232
4240
|
if (action === undefined || action === "show") {
|
|
4233
4241
|
const installation = store.listPhaseConfig(INSTALLATION_SCOPE);
|
|
4234
4242
|
const project = scope === INSTALLATION_SCOPE ? [] : store.listPhaseConfig(scope);
|
|
@@ -8058,7 +8066,7 @@ function showTask(positional, context) {
|
|
|
8058
8066
|
`${task.id} ${task.state}${ref.deliverable === "report" ? " (scout — delivers a report)" : ""}`,
|
|
8059
8067
|
` ${task.title}`,
|
|
8060
8068
|
...(detail.work === null ? [] : [
|
|
8061
|
-
` status: ${shared?.headline ?? detail.work.status.label}${shared === null ? "" :
|
|
8069
|
+
` status: ${shared?.headline ?? detail.work.status.label}${shared === null ? "" : `${shared.headline === "On hold" ? " · " : " — "}${shared.sentence}`}`,
|
|
8062
8070
|
...(primaryAction === null ? [] : [` next: ${primaryAction.label}${primaryAction.target.decisionId === null ? "" : ` — decision #${primaryAction.target.decisionId}`}`]),
|
|
8063
8071
|
]),
|
|
8064
8072
|
...(task.state !== "done" || detail.proofVerdict === null
|
|
@@ -8106,7 +8114,7 @@ function showTask(positional, context) {
|
|
|
8106
8114
|
...detail.runs
|
|
8107
8115
|
.filter(one => one.route !== null)
|
|
8108
8116
|
.slice(0, 8)
|
|
8109
|
-
.map(one => `
|
|
8117
|
+
.map(one => ` ${runWords(detail.runs, one.id)} ${one.role.padEnd(8)} ${one.route.provider}${one.route.model === null ? "" : ` · ${one.route.model}`} [${one.route.chosen}]`),
|
|
8110
8118
|
]);
|
|
8111
8119
|
}
|
|
8112
8120
|
function reviewStatusLines(review, sourceRun) {
|
|
@@ -12574,8 +12582,6 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12574
12582
|
const action = positional[1] ?? "show";
|
|
12575
12583
|
const command = `project flexible ${action}`;
|
|
12576
12584
|
const { write, json } = context;
|
|
12577
|
-
if (!FLEXIBLE_AVAILABLE)
|
|
12578
|
-
return fail(write, json, command, "not-available", FLEXIBLE_UNAVAILABLE, EXIT.refused);
|
|
12579
12585
|
const options = { show: [], enable: ["max", "default", "digest"], lower: ["max"], off: [] };
|
|
12580
12586
|
const own = options[action];
|
|
12581
12587
|
if (own === undefined || positional.length > 2)
|
|
@@ -12617,6 +12623,8 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12617
12623
|
if (acting === null)
|
|
12618
12624
|
return refused(`${action === "enable" ? "Turning on Flexible needs your password" : "This needs your sign-in"}: pass --as and --token.`);
|
|
12619
12625
|
if (action === "enable") {
|
|
12626
|
+
if (!flexibleAvailable(store))
|
|
12627
|
+
return fail(write, json, command, "not-available", FLEXIBLE_UNAVAILABLE, EXIT.refused);
|
|
12620
12628
|
const proved = credentialApprover(store, acting.name, acting.token, repo);
|
|
12621
12629
|
if (!proved.ok)
|
|
12622
12630
|
return refused("Only an approver of this project, with their password typed now, turns on Flexible.");
|
|
@@ -12690,3 +12698,52 @@ async function taskSizingConfig(action, value, repoGiven, flags, context) {
|
|
|
12690
12698
|
const shown = said();
|
|
12691
12699
|
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12692
12700
|
}
|
|
12701
|
+
async function flexibleConfig(action, value, repoGiven, flags, context) {
|
|
12702
|
+
const { store, write, json, clock } = context;
|
|
12703
|
+
const command = `config ${action}`;
|
|
12704
|
+
if (repoGiven)
|
|
12705
|
+
return fail(write, json, command, "usage", "interactive agent threads are installation-wide: no --repo", EXIT.usage);
|
|
12706
|
+
const said = () => {
|
|
12707
|
+
const read = flexibleSetting(store);
|
|
12708
|
+
return { payload: { flexible: { on: read.on, by: read.by, at: read.at } }, lines: () => [read.on
|
|
12709
|
+
? "Interactive agent threads (beta) are on: T in the workbench starts a Claude Code thread. Claude Code only for now; it runs inside Toolroll's sandbox with your Claude sign-in relayed, and Toolroll never gives the agent your key."
|
|
12710
|
+
: "Interactive agent threads (beta) are off. Turn them on with `toolroll config set flexible on`."] };
|
|
12711
|
+
};
|
|
12712
|
+
if (action === "show") {
|
|
12713
|
+
const shown = said();
|
|
12714
|
+
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12715
|
+
}
|
|
12716
|
+
if (action !== "set" || (value !== "on" && value !== "off"))
|
|
12717
|
+
return fail(write, json, command, "usage", "`toolroll config set flexible on|off --as <you> --token <t>`", EXIT.usage);
|
|
12718
|
+
const personOnly = value === "on"
|
|
12719
|
+
? "Only an instance operator, with their password typed for this command, turns interactive agent threads on; never a remembered sign-in, a token, the lead or a chat app."
|
|
12720
|
+
: "Only an instance operator, as a person with their password, turns interactive agent threads off; never a token, the lead or a chat app.";
|
|
12721
|
+
if (machineActing() || process.env["TOOLROLL_LEAD_TOKEN"] !== undefined || process.env["TOOLROLL_REMOTE_TOKEN"] !== undefined)
|
|
12722
|
+
return fail(write, json, command, "person-only", personOnly, EXIT.refused);
|
|
12723
|
+
if (passwordFreeOwner(store))
|
|
12724
|
+
return fail(write, json, command, "local-owner", "You haven't set a password yet, and this needs one. Set it first with `toolroll password set`, then run this again.", EXIT.refused);
|
|
12725
|
+
const acting = await askCredentials(flags, context);
|
|
12726
|
+
if (acting === null)
|
|
12727
|
+
return fail(write, json, command, "usage", "This needs your name and password: run it in your own terminal to be asked, or add `--as <your Toolroll name> --token <your password>`.", EXIT.usage);
|
|
12728
|
+
const saved = store.transact(() => {
|
|
12729
|
+
const verified = value === "on" ? credentialApprover(store, acting.name, acting.token) : authenticateApprover(store, acting.name, acting.token);
|
|
12730
|
+
if (!verified.ok || !personProof(verified.method) || !store.isInstanceOperator(acting.name))
|
|
12731
|
+
return false;
|
|
12732
|
+
setFlexibleSetting(store, value === "on", acting.name, clock());
|
|
12733
|
+
return true;
|
|
12734
|
+
});
|
|
12735
|
+
if (!saved)
|
|
12736
|
+
return fail(write, json, command, "unauthenticated", personOnly, EXIT.refused);
|
|
12737
|
+
const shown = said();
|
|
12738
|
+
if (value === "on")
|
|
12739
|
+
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12740
|
+
const report = await stopFlexibleThreadsEverywhere(store, { reason: "interactive agent threads were turned off", clock });
|
|
12741
|
+
const short = (thread) => thread.slice(0, 8);
|
|
12742
|
+
const lines = [
|
|
12743
|
+
...shown.lines(),
|
|
12744
|
+
...(report.stopped.length === 0 ? [] : [`Stopped ${report.stopped.length === 1 ? "1 running thread" : `${report.stopped.length} running threads`}: every process of ${report.stopped.length === 1 ? "its agent" : "their agents"} is gone and ${report.stopped.length === 1 ? "its turn" : "their turns"} ended (${report.stopped.map(one => short(one.thread)).join(", ")}).`]),
|
|
12745
|
+
...(report.stopped.some(one => one.network) ? ["The console that started them closes their network on its next check, within a few seconds."] : []),
|
|
12746
|
+
...report.survivors.map(one => `Thread ${short(one.thread)} couldn't be stopped yet${one.pids.length === 0 ? "" : `: process${one.pids.length === 1 ? "" : "es"} ${one.pids.join(", ")} still running`} (${one.why}). A running console keeps trying every few seconds; run this command again to try now.`),
|
|
12747
|
+
];
|
|
12748
|
+
return succeed(write, json, command, { ...shown.payload, stopped: report.stopped, survivors: report.survivors }, () => lines);
|
|
12749
|
+
}
|
package/dist/outbound-privacy.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { scanForSecrets } from "./evidence.js";
|
|
2
2
|
const HOME_FOLDER = /(?:^|[\s"'`(<[=:,])(?:\/Users\/|\/home\/|\/root\/|~\/)/;
|
|
3
3
|
const DRIVE_OR_SHARE = /(?<![A-Za-z0-9+.-])[A-Za-z]:[\\/]|\\\\|\bfile:\/\//i;
|
|
4
|
+
const HOME_OTHERWISE = /(?:^|[\s"'`(<[=:,])\\\/(?:Users|home|root)\\\/|\$HOME[\\/]|\$\{HOME\}[\\/]|%USERPROFILE%|%HOMEPATH%|\$env:USERPROFILE\b|:\/\/\/(?:Users|home|root|[A-Za-z]:)[\\/]/i;
|
|
5
|
+
const decodedOnce = (text) => text.replace(/%([0-9A-Fa-f]{2})/g, (_, hex) => String.fromCharCode(Number.parseInt(hex, 16)));
|
|
6
|
+
const folderWords = (text) => HOME_FOLDER.test(text) || DRIVE_OR_SHARE.test(text) || HOME_OTHERWISE.test(text);
|
|
4
7
|
export function privateWords(text) {
|
|
5
|
-
|
|
8
|
+
if (scanForSecrets(text).length > 0 || /\b\d{5,}:[A-Za-z0-9_-]{20,}\b/.test(text) || folderWords(text))
|
|
9
|
+
return true;
|
|
10
|
+
return /%[0-9A-Fa-f]{2}/.test(text) && folderWords(` ${decodedOnce(text)}`);
|
|
6
11
|
}
|
|
7
12
|
export const outboundPrivate = (fields) => fields.some(privateWords);
|
|
8
13
|
export function textsOf(value, depth = 0) {
|
package/dist/plain-words.js
CHANGED
|
@@ -26,7 +26,7 @@ export const PLAIN_WORDS = [
|
|
|
26
26
|
row("Draft a repair task", "draft\\s+a\\s+repair\\s+task", "Send back"),
|
|
27
27
|
row("put away", "put(?:s|ting)?\\s+(?:it\\s+|them\\s+|tasks\\s+|old\\s+tasks\\s+)?away", "Archive"),
|
|
28
28
|
row("tidy", "tidy|tidied|tidying", "Archive"),
|
|
29
|
-
row("run #N", "(?:run|
|
|
29
|
+
row("run #N", "(?:run|result)\\s+#?\\d+|attempt\\s+#?\\d+(?!\\s+\\(build\\s+#\\d+\\))", "build #N, or attempt N (build #M)"),
|
|
30
30
|
row("reconcile", "reconcile[ds]?|reconciling|reconciliation", "Waiting: Toolroll is …"),
|
|
31
31
|
row("requeue", "requeue[ds]?|requeuing", "Waiting: Toolroll is …"),
|
|
32
32
|
row("claim", "claim|claimed", "Waiting: Toolroll is …"),
|
package/dist/release.js
CHANGED
|
@@ -46,6 +46,8 @@ export const ADVISORY_PR_CHECKS = {
|
|
|
46
46
|
"workbench bundle / binary · linux-x64": ".github/workflows/tui-bundle.yml",
|
|
47
47
|
"workbench bundle / binary · linux-arm64": ".github/workflows/tui-bundle.yml",
|
|
48
48
|
"workbench bundle / assemble": ".github/workflows/tui-bundle.yml",
|
|
49
|
+
"gate changes": ".github/workflows/gate-changes.yml",
|
|
50
|
+
"guard checks": ".github/workflows/guard-checks.yml",
|
|
49
51
|
};
|
|
50
52
|
export const RELEASE_TAG_CHECKS = ["release proof", "package / binary · darwin-arm64", "package / binary · darwin-x64", "package / binary · linux-x64", "package / binary · linux-arm64", "package / assemble", "publish"];
|
|
51
53
|
export const RELEASE_TAG_WORKFLOW = ".github/workflows/publish.yml";
|