toolroll 0.9.118 → 0.9.119
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 +32 -0
- package/README.md +14 -14
- package/dist/assignment.js +40 -29
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +32 -31
- package/dist/builder.js +286 -236
- package/dist/central-recovery-stage.js +3 -3
- package/dist/check-failure.js +2 -2
- package/dist/check-levels.js +3 -0
- package/dist/check-report.js +58 -7
- package/dist/contracts/console-api.js +4 -1
- package/dist/contracts/engine-api.js +1 -0
- package/dist/contracts/release-check.js +7 -4
- package/dist/contracts/release-terms.js +11 -2
- package/dist/contracts/verification-receipt.js +1 -1
- package/dist/deploy-gate.js +7 -1
- package/dist/direct-chat.js +3 -3
- package/dist/easy-start.js +8 -6
- package/dist/engine-reads.js +72 -0
- package/dist/flexible-conversation-schema.js +24 -0
- package/dist/flexible-conversation.js +162 -0
- package/dist/flexible-custody.js +3 -0
- package/dist/flexible-import.js +51 -0
- package/dist/flexible-session.js +84 -11
- package/dist/install-mode.js +1 -1
- package/dist/local-landing.js +500 -0
- package/dist/local-owner.js +1 -0
- package/dist/operate.js +143 -22
- package/dist/passwordless.js +1 -1
- package/dist/project-delete.js +1 -0
- package/dist/rehearsal.js +27 -0
- package/dist/release-adapters.js +170 -2
- package/dist/release-approval.js +11 -8
- package/dist/release-card.js +7 -2
- package/dist/release-carry.js +1 -1
- package/dist/release-cli.js +115 -14
- package/dist/release-main-proof.js +49 -0
- package/dist/release-main.js +110 -0
- package/dist/release-recheck.js +10 -3
- package/dist/release.js +221 -33
- package/dist/reply-shape.js +6 -1
- package/dist/result-actions.js +7 -1
- package/dist/result-follow-ups.js +8 -4
- package/dist/serve.js +31 -14
- package/dist/server/direct-chat.js +88 -3
- package/dist/server/engine-api.js +43 -5
- package/dist/server/render-results.js +3 -1
- package/dist/server/render-tasks.js +10 -1
- package/dist/server/route-table.js +9 -0
- package/dist/server/settings.js +31 -7
- package/dist/server/task-views.js +15 -0
- package/dist/server/tasks.js +63 -3
- package/dist/settings-groups-ui.js +2 -2
- package/dist/store.js +29 -4
- package/dist/surface.js +9 -1
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/verification-evidence.js +17 -6
- package/dist/workspace-ui.js +1 -1
- package/package.json +2 -1
- package/scripts/release-proof.mjs +240 -0
package/dist/flexible-import.js
CHANGED
|
@@ -354,6 +354,57 @@ export async function readFlexibleCandidate(store, input) {
|
|
|
354
354
|
return { ok: true, candidate, base: source.thread.baseSha, changedPaths: entries.map(one => one.path).sort() };
|
|
355
355
|
}));
|
|
356
356
|
}
|
|
357
|
+
export const FLEXIBLE_CHANGES_LIMITS = Object.freeze({ readMs: 30_000, patchBytes: 4 * 1024 * 1024 });
|
|
358
|
+
export function flexibleThreadTip(store, id) {
|
|
359
|
+
const thread = flexibleThread(store, id);
|
|
360
|
+
const state = thread === null || thread.state !== "ready" ? null : stateFolderOf(store);
|
|
361
|
+
if (thread === null || state === null)
|
|
362
|
+
return null;
|
|
363
|
+
const paths = flexibleThreadPaths(state, thread.id);
|
|
364
|
+
if (thread.folder !== paths.folder || !ownFolder(paths.root) || !ownFolder(paths.folder))
|
|
365
|
+
return null;
|
|
366
|
+
try {
|
|
367
|
+
const tip = threadBranchTip(paths, thread.id);
|
|
368
|
+
return tip !== null && tip.length === thread.baseSha.length ? tip : null;
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
return null;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
export async function readFlexibleChanges(store, input) {
|
|
375
|
+
const limits = { ...limitsOf(input.limits), importMs: input.limits?.readMs ?? FLEXIBLE_CHANGES_LIMITS.readMs };
|
|
376
|
+
const patchBytes = input.limits?.patchBytes ?? FLEXIBLE_CHANGES_LIMITS.patchBytes;
|
|
377
|
+
const deadline = Date.now() + limits.importMs;
|
|
378
|
+
const source = sourceOf(store, input.thread, limits, deadline);
|
|
379
|
+
if ("ok" in source)
|
|
380
|
+
return source;
|
|
381
|
+
const base = input.from ?? source.thread.baseSha;
|
|
382
|
+
const tip = input.to ?? threadBranchTip(source.paths, source.thread.id);
|
|
383
|
+
if (tip === null || !SHA.test(base) || !SHA.test(tip) || tip.length !== source.thread.baseSha.length || base.length !== tip.length)
|
|
384
|
+
return refused("candidate-unreadable");
|
|
385
|
+
if (tip === base)
|
|
386
|
+
return { ok: true, none: true, base };
|
|
387
|
+
const read = gitIn(input.runner ?? run, "read", deadline);
|
|
388
|
+
return guarded(() => withQuarantine(source, async (repo) => {
|
|
389
|
+
for (const commit of [base, tip]) {
|
|
390
|
+
const type = await read(repo, ["cat-file", "-t", commit]);
|
|
391
|
+
if (type.code !== 0 || type.stdout.trim() !== "commit")
|
|
392
|
+
return refused("candidate-unreadable", "it isn't a commit Toolroll can read");
|
|
393
|
+
}
|
|
394
|
+
const entries = await changedEntries(read, repo, base, tip);
|
|
395
|
+
if (!Array.isArray(entries))
|
|
396
|
+
return entries;
|
|
397
|
+
const paths = entries.map(one => one.path).sort();
|
|
398
|
+
if (!input.patch)
|
|
399
|
+
return { ok: true, base, tip, paths, patch: "", truncated: false };
|
|
400
|
+
const patched = await read(repo, ["diff-tree", "-r", "-p", "--no-commit-id", "--no-renames", "--no-ext-diff", "--no-textconv", "--no-color", base, tip], { maxBuffer: patchBytes });
|
|
401
|
+
const cut = patched.code !== 0 && patched.stdout.length >= patchBytes;
|
|
402
|
+
if (patched.code !== 0 && !cut)
|
|
403
|
+
return refused("unreadable", "its changes couldn't be read");
|
|
404
|
+
const text = cut ? patched.stdout.slice(0, Math.max(0, patched.stdout.lastIndexOf("\ndiff --git ") + 1)) : patched.stdout;
|
|
405
|
+
return { ok: true, base, tip, paths, patch: text, truncated: cut };
|
|
406
|
+
}));
|
|
407
|
+
}
|
|
357
408
|
async function guarded(work) {
|
|
358
409
|
try {
|
|
359
410
|
return await work();
|
package/dist/flexible-session.js
CHANGED
|
@@ -14,6 +14,8 @@ import { flexibleThread, prepareFlexibleThread, removeFlexibleThread, stopFlexib
|
|
|
14
14
|
import { admitFlexibleTurn, finishFlexibleTurn, flexibleTurn, interruptFlexibleThreadTurns, interruptFlexibleTurnsOf, withdrawFlexibleTurn } from "./flexible-turns.js";
|
|
15
15
|
import { userFrame } from "./live-input.js";
|
|
16
16
|
import { cleanLiveText, createLiveRecorder, HIDDEN_LINE, liveSecretHit } from "./live-records.js";
|
|
17
|
+
import { flexibleConversationOf, flexibleTurnMessage, recordFlexibleFiles, recordFlexibleReply, recordFlexibleSaid, recordFlexibleStartTip, saidLines } from "./flexible-conversation.js";
|
|
18
|
+
import { flexibleThreadTip, readFlexibleChanges } from "./flexible-import.js";
|
|
17
19
|
import { primaryResultEvent } from "./stream-scope.js";
|
|
18
20
|
const WORDS = Object.freeze({
|
|
19
21
|
"not-available": FLEXIBLE_UNAVAILABLE,
|
|
@@ -329,7 +331,7 @@ export async function startFlexibleThreadSession(store, sessions, input) {
|
|
|
329
331
|
const relay = await startFlexibleRelay(store, { thread: input.thread });
|
|
330
332
|
if ("ok" in relay)
|
|
331
333
|
return relay;
|
|
332
|
-
const session = held ?? { thread: input.thread, relay: null, agent: null, records:
|
|
334
|
+
const session = held ?? { thread: input.thread, relay: null, agent: null, records: conversationRecords(store, input.thread), dropped: 0, epoch: randomBytes(8).toString("hex"), asked: new Map(), title: null };
|
|
333
335
|
session.relay = relay;
|
|
334
336
|
sessions.threads.set(input.thread, session);
|
|
335
337
|
return { ok: true, relayPort: relay.port };
|
|
@@ -529,6 +531,12 @@ export function attachFlexibleAgent(store, sessions, input) {
|
|
|
529
531
|
keep(link.recorder.observe(raw));
|
|
530
532
|
if (primaryResultEvent(raw) && link.turn !== null) {
|
|
531
533
|
const failed = raw["is_error"] === true;
|
|
534
|
+
if (!failed && typeof raw["result"] === "string") {
|
|
535
|
+
try {
|
|
536
|
+
recordFlexibleReply(store, { turn: link.turn, reply: raw["result"] });
|
|
537
|
+
}
|
|
538
|
+
catch { }
|
|
539
|
+
}
|
|
532
540
|
void endFlexibleThreadTurn(store, sessions, { thread: input.thread, turn: link.turn, outcome: failed ? "unknown" : "finished", ...(failed ? { detail: "The agent stopped with an error." } : {}), ...clocked });
|
|
533
541
|
}
|
|
534
542
|
};
|
|
@@ -660,8 +668,10 @@ export async function beginFlexibleThreadTurn(store, sessions, input) {
|
|
|
660
668
|
if (!attached.ok)
|
|
661
669
|
return attached;
|
|
662
670
|
session.title ??= cardText(input.message.split("\n")[0], 80) || null;
|
|
671
|
+
const handed = await conversationFor(store, { thread: turn.thread, turn: input.turn, seq: turn.seq, message: input.message });
|
|
672
|
+
session.records.push({ k: "you", at: (input.clock ?? systemClock)().toISOString(), t: saidLines(input.message) });
|
|
663
673
|
try {
|
|
664
|
-
session.agent?.stdin.write(`${userFrame(
|
|
674
|
+
session.agent?.stdin.write(`${userFrame(handed, randomUUID())}\n`);
|
|
665
675
|
}
|
|
666
676
|
catch { }
|
|
667
677
|
bump(sessions, turn.thread);
|
|
@@ -706,6 +716,7 @@ export async function startFlexibleThread(store, sessions, input) {
|
|
|
706
716
|
if (!admitted.ok)
|
|
707
717
|
return admitted;
|
|
708
718
|
turn = admitted.turn;
|
|
719
|
+
recordFlexibleSaid(store, { turn: admitted.turn, thread: id, seq: admitted.seq, said: input.message, at: clock().toISOString() });
|
|
709
720
|
const title = cardText(input.message.split("\n")[0], 80);
|
|
710
721
|
if (title !== "")
|
|
711
722
|
store.handle.prepare("INSERT INTO flexible_thread_meta (thread, title) VALUES (?, ?) ON CONFLICT (thread) DO NOTHING").run(id, title);
|
|
@@ -782,8 +793,11 @@ export async function continueFlexibleThread(store, sessions, input) {
|
|
|
782
793
|
? "Threads use your own Claude sign-in, and you haven't saved one (or it was removed). Add one, then reply. Nothing was sent."
|
|
783
794
|
: "Claude didn't accept your sign-in for threads. Save a new one, then reply. Nothing was sent." };
|
|
784
795
|
const level = levelOf(store, input.thread) ?? before.level;
|
|
785
|
-
|
|
796
|
+
const made = admitFlexibleTurn(store, { thread: input.thread, starter: input.by, digest: before.termsDigest, level, freshProof: input.freshProof, provider: before.provider, model: before.model,
|
|
786
797
|
billing: billing.billing, requestKey: `reply:${input.key}`, holder: sessions.holder, clock });
|
|
798
|
+
if (made.ok)
|
|
799
|
+
recordFlexibleSaid(store, { turn: made.turn, thread: input.thread, seq: made.seq, said: input.message, at: clock().toISOString() });
|
|
800
|
+
return made;
|
|
787
801
|
});
|
|
788
802
|
if (!admitted.ok)
|
|
789
803
|
return admitted;
|
|
@@ -1059,18 +1073,21 @@ export function flexibleThreadLiveOf(store, sessions, input) {
|
|
|
1059
1073
|
const session = sessions.threads.get(thread.id);
|
|
1060
1074
|
const facts = factsOf(store, sessions, thread, session);
|
|
1061
1075
|
const live = session?.agent != null;
|
|
1062
|
-
if (input.file === "sub"
|
|
1076
|
+
if (input.file === "sub")
|
|
1077
|
+
return { ok: true, live, window: { ok: false, reason: "missing" }, facts };
|
|
1078
|
+
const source = session ?? { records: conversationRecords(store, thread.id), dropped: 0, epoch: RECORDED_EPOCH };
|
|
1079
|
+
if (source.records.length === 0 && session === undefined)
|
|
1063
1080
|
return { ok: true, live, window: { ok: false, reason: "missing" }, facts };
|
|
1064
|
-
const total =
|
|
1081
|
+
const total = source.dropped + source.records.length;
|
|
1065
1082
|
const named = input.cursor === null ? null : /^([0-9a-f]{16})\.(0|[1-9][0-9]{0,11})$/.exec(input.cursor);
|
|
1066
|
-
const restarted = input.cursor !== null && (named === null || named[1] !==
|
|
1067
|
-
let from = named !== null && !restarted ? Number(named[2]) :
|
|
1068
|
-
const earlier = from <
|
|
1083
|
+
const restarted = input.cursor !== null && (named === null || named[1] !== source.epoch || Number(named[2]) > total);
|
|
1084
|
+
let from = named !== null && !restarted ? Number(named[2]) : source.dropped;
|
|
1085
|
+
const earlier = from < source.dropped;
|
|
1069
1086
|
if (earlier)
|
|
1070
|
-
from =
|
|
1071
|
-
const records =
|
|
1087
|
+
from = source.dropped;
|
|
1088
|
+
const records = source.records.slice(from - source.dropped, from - source.dropped + WINDOW_RECORDS);
|
|
1072
1089
|
const next = from + records.length;
|
|
1073
|
-
return { ok: true, live, window: { ok: true, records, cursor: `${
|
|
1090
|
+
return { ok: true, live, window: { ok: true, records, cursor: `${source.epoch}.${next}`, restarted, earlier, quarantined: 0, skipped: 0, more: next < total }, facts };
|
|
1074
1091
|
}
|
|
1075
1092
|
export function flexibleThreadsOf(store, sessions, input) {
|
|
1076
1093
|
if (typeof input.owner !== "string")
|
|
@@ -1288,3 +1305,59 @@ async function stopSessionLocked(store, sessions, input) {
|
|
|
1288
1305
|
return stopped;
|
|
1289
1306
|
return { ok: true, stopped: stopped.ok, why: stopped.ok ? null : stopped.why };
|
|
1290
1307
|
}
|
|
1308
|
+
const RECORDED_EPOCH = "0".repeat(16);
|
|
1309
|
+
function conversationRecords(store, thread) {
|
|
1310
|
+
let turns;
|
|
1311
|
+
try {
|
|
1312
|
+
turns = flexibleConversationOf(store, thread);
|
|
1313
|
+
}
|
|
1314
|
+
catch {
|
|
1315
|
+
return [];
|
|
1316
|
+
}
|
|
1317
|
+
return turns.filter(one => one.status !== "admitted" && one.status !== "running").flatMap((one) => [
|
|
1318
|
+
{ k: "you", at: one.saidAt, t: saidLines(one.said) },
|
|
1319
|
+
...(one.reply === null ? [] : [{ k: "say", at: one.saidAt, t: saidLines(one.reply, 400) }]),
|
|
1320
|
+
]);
|
|
1321
|
+
}
|
|
1322
|
+
const FILES_READ_PER_TURN = 1;
|
|
1323
|
+
const FILES_READ_MS = 10_000;
|
|
1324
|
+
async function conversationFor(store, input) {
|
|
1325
|
+
try {
|
|
1326
|
+
const tip = flexibleThreadTip(store, input.thread);
|
|
1327
|
+
if (tip !== null)
|
|
1328
|
+
recordFlexibleStartTip(store, { turn: input.turn, tip });
|
|
1329
|
+
const turns = flexibleConversationOf(store, input.thread);
|
|
1330
|
+
let read = 0;
|
|
1331
|
+
for (let at = turns.length - 1; at >= 0 && read < FILES_READ_PER_TURN; at--) {
|
|
1332
|
+
const one = turns[at];
|
|
1333
|
+
const next = turns.slice(at + 1).find(later => later.startTip !== null);
|
|
1334
|
+
if (one.files !== null || one.startTip === null || next === undefined || one.seq >= input.seq)
|
|
1335
|
+
continue;
|
|
1336
|
+
if (one.startTip === next.startTip) {
|
|
1337
|
+
recordFlexibleFiles(store, { turn: one.turn, files: [] });
|
|
1338
|
+
continue;
|
|
1339
|
+
}
|
|
1340
|
+
read++;
|
|
1341
|
+
const changed = await readFlexibleChanges(store, { thread: input.thread, from: one.startTip, to: next.startTip, patch: false, limits: { readMs: FILES_READ_MS } });
|
|
1342
|
+
if (changed.ok)
|
|
1343
|
+
recordFlexibleFiles(store, { turn: one.turn, files: "none" in changed ? [] : changed.paths });
|
|
1344
|
+
}
|
|
1345
|
+
return flexibleTurnMessage(flexibleConversationOf(store, input.thread).filter(one => one.seq < input.seq), input.message, input.seq);
|
|
1346
|
+
}
|
|
1347
|
+
catch {
|
|
1348
|
+
return input.message;
|
|
1349
|
+
}
|
|
1350
|
+
}
|
|
1351
|
+
export function flexibleThreadTipOf(store, thread) {
|
|
1352
|
+
return ID.test(thread) ? flexibleThreadTip(store, thread) : null;
|
|
1353
|
+
}
|
|
1354
|
+
export async function flexibleThreadChanges(store, input) {
|
|
1355
|
+
if (!ID.test(input.thread))
|
|
1356
|
+
return { tip: null, changes: { ok: false, message: WORDS["invalid-request"] } };
|
|
1357
|
+
const read = await readFlexibleChanges(store, { thread: input.thread, patch: true });
|
|
1358
|
+
if (!read.ok)
|
|
1359
|
+
return { tip: null, changes: { ok: false, message: read.message } };
|
|
1360
|
+
if ("none" in read)
|
|
1361
|
+
return { tip: read.base, changes: { ok: true, none: true } };
|
|
1362
|
+
return { tip: read.tip, changes: { ok: true, patch: read.patch, truncated: read.truncated } };
|
|
1363
|
+
}
|
package/dist/install-mode.js
CHANGED
|
@@ -163,7 +163,7 @@ export const TEAM_FACT_WORDS = Object.freeze({
|
|
|
163
163
|
});
|
|
164
164
|
export function installModeLine(mode) {
|
|
165
165
|
return mode === "solo"
|
|
166
|
-
? { label: "Solo", words: "Just you. Approvals need no password; sign-in, tokens and
|
|
166
|
+
? { label: "Solo", words: "Just you. Approvals need no password; changes that add a way in still do: sign-in, tokens, connections, agent threads and check commands." }
|
|
167
167
|
: { label: "Team", words: "More than one person can use this install." };
|
|
168
168
|
}
|
|
169
169
|
export const SOLO_ON_UPGRADE_WORDS = "declared solo on upgrade: one person, nothing else ever";
|