toolroll 0.9.123 → 0.9.126
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 +60 -0
- package/README.md +1 -1
- package/dist/advanced-view.js +0 -1
- package/dist/agent-detect.js +23 -3
- package/dist/bounded-spawn.js +5 -36
- package/dist/browser/workspace.css +1 -1
- package/dist/browser/workspace.js +29 -29
- package/dist/browser-open.js +49 -0
- package/dist/chat-acceptance.js +1 -1
- package/dist/chat-actions.js +1 -1
- package/dist/check-only.js +1 -1
- package/dist/cli.js +2 -2
- package/dist/connect-cli.js +2 -8
- package/dist/contracts/engine-api.js +5 -0
- package/dist/direct-chat-git.js +20 -0
- package/dist/direct-chat-ship.js +5 -5
- package/dist/direct-chat.js +29 -20
- package/dist/doctor.js +30 -3
- package/dist/easy-start.js +43 -17
- package/dist/engine-reads.js +14 -0
- package/dist/evals.js +17 -19
- package/dist/first-run.js +5 -1
- package/dist/flexible-import.js +3 -2
- package/dist/flexible-save.js +2 -0
- package/dist/flexible-session.js +1 -1
- package/dist/flexible-thread.js +14 -2
- package/dist/flow-code.js +2 -2
- package/dist/git-identity.js +65 -0
- package/dist/invoke.js +4 -4
- package/dist/laptop-background.js +2 -11
- package/dist/linux-packages.js +46 -0
- package/dist/local-landing.js +35 -5
- package/dist/merge-checklist.js +33 -4
- package/dist/operate.js +19 -20
- package/dist/passwordless.js +10 -2
- package/dist/preflight.js +14 -0
- package/dist/process-identity.js +155 -0
- package/dist/project-skills.js +2 -2
- package/dist/quick-start.js +6 -1
- package/dist/release.js +8 -0
- package/dist/runner-process.js +9 -25
- package/dist/sandbox-launch.js +3 -2
- package/dist/sandbox-runtime.js +115 -15
- package/dist/sandbox-tools.js +91 -6
- package/dist/server/direct-chat.js +33 -6
- package/dist/server/merge-ready-view.js +4 -2
- package/dist/server/pages.js +1 -1
- package/dist/server/render-pages.js +1 -0
- package/dist/server/render-results.js +6 -6
- package/dist/server/render-tasks.js +7 -2
- package/dist/server/route-table.js +3 -0
- package/dist/server/settings-sections.js +1 -1
- package/dist/server/settings.js +55 -33
- package/dist/server/task-views.js +14 -8
- package/dist/server/tasks.js +14 -3
- package/dist/settings-groups-ui.js +6 -6
- package/dist/shown-text.js +14 -0
- package/dist/skill-library.js +22 -5
- package/dist/skills-ui.js +24 -11
- package/dist/status-probe.js +32 -0
- package/dist/task-base.js +2 -2
- package/dist/task-status.js +7 -4
- package/dist/telegram-status.js +1 -1
- package/dist/toolroll-update.js +4 -0
- package/dist/trust-repair.js +187 -0
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/dist/work-index.js +51 -3
- package/dist/workspace-ui.js +4 -2
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
const set = (env, name) => (env[name] ?? "") !== "";
|
|
3
|
+
export function noBrowserReason(env = process.env, platform = process.platform) {
|
|
4
|
+
if (chosenCommand(env) !== null || (platform !== "darwin" && platform !== "win32" && browserEntry(env) !== null))
|
|
5
|
+
return null;
|
|
6
|
+
const display = set(env, "DISPLAY") || set(env, "WAYLAND_DISPLAY");
|
|
7
|
+
if ((set(env, "SSH_CONNECTION") || set(env, "SSH_TTY")) && !display)
|
|
8
|
+
return "this is an SSH session";
|
|
9
|
+
if (platform !== "darwin" && platform !== "win32" && !display)
|
|
10
|
+
return "there is no display here";
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
function chosenCommand(env) {
|
|
14
|
+
for (const name of ["TOOLROLL_BROWSER_COMMAND", "STANDING_ORDERS_BROWSER_COMMAND"])
|
|
15
|
+
if (set(env, name))
|
|
16
|
+
return env[name];
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
function browserEntry(env) {
|
|
20
|
+
const first = (env["BROWSER"] ?? "").split(":")[0].trim();
|
|
21
|
+
return first !== "" && /^[A-Za-z0-9._/+-]+$/.test(first) ? first : null;
|
|
22
|
+
}
|
|
23
|
+
export function browserCommand(url, env = process.env, platform = process.platform) {
|
|
24
|
+
const chosen = chosenCommand(env);
|
|
25
|
+
if (chosen !== null)
|
|
26
|
+
return [chosen, url];
|
|
27
|
+
if (platform === "darwin")
|
|
28
|
+
return ["open", url];
|
|
29
|
+
if (platform === "win32")
|
|
30
|
+
return ["cmd", "/c", "start", "", url];
|
|
31
|
+
return [browserEntry(env) ?? "xdg-open", url];
|
|
32
|
+
}
|
|
33
|
+
export function openAddress(url, options = {}) {
|
|
34
|
+
const [command, ...args] = browserCommand(url, options.env ?? process.env, options.platform ?? process.platform);
|
|
35
|
+
return startOpener(command, args, options);
|
|
36
|
+
}
|
|
37
|
+
export function startOpener(command, args, options = {}) {
|
|
38
|
+
if (noBrowserReason(options.env, options.platform) !== null)
|
|
39
|
+
return false;
|
|
40
|
+
try {
|
|
41
|
+
const child = (options.spawn ?? spawn)(command, [...args], { detached: true, stdio: "ignore" });
|
|
42
|
+
child.on("error", () => { });
|
|
43
|
+
child.unref();
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
}
|
package/dist/chat-acceptance.js
CHANGED
|
@@ -10,7 +10,7 @@ export function acceptanceStatus(proof, accepted, check) {
|
|
|
10
10
|
if (manualReviewOnly(proof))
|
|
11
11
|
return "You check the remaining requirements";
|
|
12
12
|
if (proof?.verdict === "verified" && check !== "passed") {
|
|
13
|
-
return check === undefined ? "Open the result to see its checks" : check === "failed" ? "Checks failed" : check === "running" ? "Checks running" : "The check result couldn't be read";
|
|
13
|
+
return check === undefined ? "Open the result to see its checks" : check === "failed" ? "Checks failed" : check === "running" ? "Checks running" : check === "stale" ? "The check command changed since they ran" : "The check result couldn't be read";
|
|
14
14
|
}
|
|
15
15
|
return proof === null ? "No checks recorded" : ({ verified: "Checks passed", attested: "Checks reported by the agent", short: "Some required material is missing", refuted: "Saved result doesn't match the approved plan" }[proof.verdict] ?? "Some required material is missing");
|
|
16
16
|
}
|
package/dist/chat-actions.js
CHANGED
|
@@ -366,7 +366,7 @@ export function prepareSharedAction(store, who, operation, input, root, now = ne
|
|
|
366
366
|
state = { chat, repo };
|
|
367
367
|
const chatTitle = String(row["title"] ?? "Direct Chat").slice(0, 60);
|
|
368
368
|
title = `Ship "${chatTitle}"`;
|
|
369
|
-
terms.push(`Direct Chat: ${chatTitle} (branch ${String(row["branch"] ?? "")})`, changedCount > 0 ? `Changes: ${changedCount} ${changedCount === 1 ? "file" : "files"} changed` : "Inspect current clone changes in the Ship preview.", mode === "keep-branch" ? "Mode:
|
|
369
|
+
terms.push(`Direct Chat: ${chatTitle} (branch ${String(row["branch"] ?? "")})`, changedCount > 0 ? `Changes: ${changedCount} ${changedCount === 1 ? "file" : "files"} changed` : "Inspect current clone changes in the Ship preview.", mode === "keep-branch" ? "Mode: Save the branch on this computer." : "Mode: Ship (runs project check before merging).", "Opens the Ship preview so you can review and confirm before anything is pushed or merged.");
|
|
370
370
|
}
|
|
371
371
|
else {
|
|
372
372
|
const chat = text(input, "chat", 80);
|
package/dist/check-only.js
CHANGED
|
@@ -77,7 +77,7 @@ export function requestMissingRechecks(store, root, now) {
|
|
|
77
77
|
if (run === null || run.finishedAt === null)
|
|
78
78
|
return 0;
|
|
79
79
|
const state = approvedCheckStateOf(assignmentChecksForRun(store, root, auth.run, now));
|
|
80
|
-
if (state === "not-run" || state === "unreadable")
|
|
80
|
+
if (state === "not-run" || state === "unreadable" || state === "stale")
|
|
81
81
|
return claimRecheck(store, auth.id, now) === null ? 0 : 1;
|
|
82
82
|
if (state !== "running" && checkOnlyRecoveryProblem(store, auth.run) === null) {
|
|
83
83
|
store.handle.prepare("UPDATE check_authorization SET closed_at = ? WHERE id = ? AND used_at IS NULL AND closed_at IS NULL").run(now.toISOString(), auth.id);
|
package/dist/cli.js
CHANGED
|
@@ -383,6 +383,7 @@ async function dispatch(argv, write, mainOptions) {
|
|
|
383
383
|
enrolled: async (repo) => { const loaded = await loadRepos(registryBeside(databaseFile)); return !("error" in loaded) && loaded.repos.includes(repo); },
|
|
384
384
|
admit: repo => runReposCommand(["add", repo], write, mainOptions.onboard),
|
|
385
385
|
startUp: () => runOperate("up", [], write, mainOptions.operate ?? {}),
|
|
386
|
+
setUp: async () => { const mode = (await import("./easy-start.js")).localModeRead(databaseFile); return mode === "on" || mode === "off"; },
|
|
386
387
|
openBrowser: async (url) => { (await import("./operate.js")).openBrowser(url); },
|
|
387
388
|
...mainOptions.quickStart,
|
|
388
389
|
});
|
|
@@ -1454,8 +1455,7 @@ async function runRemoteTuiCommand(argv, write, connectOptions) {
|
|
|
1454
1455
|
const origin = profile.origin;
|
|
1455
1456
|
const openUrl = async (path) => {
|
|
1456
1457
|
const target = new URL(path, origin).href;
|
|
1457
|
-
(await import("./operate.js")).openBrowser(target)
|
|
1458
|
-
return `Opened ${target} in your browser.`;
|
|
1458
|
+
return (await import("./operate.js")).openBrowser(target) ? `Opened ${target} in your browser.` : `Open ${target} in a browser.`;
|
|
1459
1459
|
};
|
|
1460
1460
|
const ended = await runTuiBinary({
|
|
1461
1461
|
binary: chosen.binary,
|
package/dist/connect-cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { openAddress } from './browser-open.js';
|
|
2
2
|
import { constants, closeSync, existsSync, fstatSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { request as httpRequest } from 'node:http';
|
|
4
4
|
import { request as httpsRequest } from 'node:https';
|
|
@@ -347,13 +347,7 @@ function pairPostJson(origin, path, body) {
|
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
349
|
function launchBrowserUrl(url) {
|
|
350
|
-
|
|
351
|
-
const args = process.platform === 'win32' ? ['/c', 'start', '', url] : [url];
|
|
352
|
-
try {
|
|
353
|
-
const child = spawn(cmd, args, { stdio: 'ignore', detached: true });
|
|
354
|
-
child.unref();
|
|
355
|
-
}
|
|
356
|
-
catch { }
|
|
350
|
+
openAddress(url);
|
|
357
351
|
}
|
|
358
352
|
async function pairViaBrowser(origin, stderr, options) {
|
|
359
353
|
const started = await pairPostJson(origin, '/api/connect/pair/start');
|
|
@@ -110,6 +110,7 @@ const workRowSchema = z.object({
|
|
|
110
110
|
chip: z.string().nullable(),
|
|
111
111
|
group: z.enum(WORK_ROW_GROUPS),
|
|
112
112
|
rank: z.number().int(),
|
|
113
|
+
check: z.enum(["failed", "stale", "unreadable"]).optional(),
|
|
113
114
|
detail: z.string().nullable(),
|
|
114
115
|
problem: z.string().nullable(),
|
|
115
116
|
need: needRowSchema.nullable(),
|
|
@@ -183,6 +184,9 @@ export const stepCardsSchema = z.object({
|
|
|
183
184
|
agentChoices: z.object({ plan: z.array(z.object({ provider: z.string(), model: z.string() })), build: z.array(z.object({ provider: z.string(), model: z.string() })) }).nullable(),
|
|
184
185
|
pendingAgentChange: z.object({ phase: z.enum(["plan", "build"]), provider: z.string(), model: z.string(), when: z.enum(["next-run", "restart"]), by: z.string(), at: z.string(),
|
|
185
186
|
problem: z.string().nullable() }).nullable(),
|
|
187
|
+
landing: z.object({ words: z.string(), reverted: z.boolean() }).nullable(),
|
|
188
|
+
check: z.enum(["failed", "stale", "unreadable"]).optional(),
|
|
189
|
+
runChecks: z.object({ run: z.number().int(), level: z.enum(["quick", "full"]) }).optional(),
|
|
186
190
|
room: z.string(),
|
|
187
191
|
});
|
|
188
192
|
export const approvalCardSchema = z.object({
|
|
@@ -485,6 +489,7 @@ export const directChatDetailSchema = z.object({
|
|
|
485
489
|
changedFiles: z.array(z.string()),
|
|
486
490
|
diffText: z.string(),
|
|
487
491
|
dirty: z.boolean(),
|
|
492
|
+
unread: z.literal(true).optional(),
|
|
488
493
|
}),
|
|
489
494
|
});
|
|
490
495
|
export const directChatShipPreviewSchema = z.object({
|
package/dist/direct-chat-git.js
CHANGED
|
@@ -7,6 +7,7 @@ import { promisify } from "node:util";
|
|
|
7
7
|
import { run } from "./exec.js";
|
|
8
8
|
import { ENV, ENV_ALLOWLIST } from "./remote-main.js";
|
|
9
9
|
import { checkoutGit, refusal, TEARDOWN_FLAGS, viewedGitSync } from "./teardown-git.js";
|
|
10
|
+
import { DIRECT_CHAT_IDENTITY, identityFrom, identityValues } from "./git-identity.js";
|
|
10
11
|
const execFileAsync = promisify(execFile);
|
|
11
12
|
const EXTRA_DIRECT_CHAT_GIT_FLAGS = [
|
|
12
13
|
...TEARDOWN_FLAGS,
|
|
@@ -238,6 +239,23 @@ export function runTrustedCloneGit(binding, args, input, extraEnv) {
|
|
|
238
239
|
stdio: [input === undefined ? "ignore" : "pipe", "pipe", "pipe"],
|
|
239
240
|
});
|
|
240
241
|
}
|
|
242
|
+
export function cloneCommitIdentity(binding) {
|
|
243
|
+
if (binding === null)
|
|
244
|
+
return DIRECT_CHAT_IDENTITY;
|
|
245
|
+
let listing = "";
|
|
246
|
+
try {
|
|
247
|
+
listing = runTrustedCloneGit(binding, ["config", "--local", "--list", "-z"]);
|
|
248
|
+
}
|
|
249
|
+
catch { }
|
|
250
|
+
const values = identityValues(listing);
|
|
251
|
+
return { name: values.name ?? DIRECT_CHAT_IDENTITY.name, email: values.email ?? DIRECT_CHAT_IDENTITY.email };
|
|
252
|
+
}
|
|
253
|
+
function writeCloneIdentity(realGitDir, realClone, identity) {
|
|
254
|
+
const cloneEnv = cleanGitEnv({ GIT_COMMON_DIR: realGitDir });
|
|
255
|
+
for (const [key, value] of [["user.name", identity.name], ["user.email", identity.email]]) {
|
|
256
|
+
execFileSync("git", [...EXTRA_DIRECT_CHAT_GIT_FLAGS, `--git-dir=${realGitDir}`, `--work-tree=${realClone}`, "config", "--local", key, value], { cwd: realClone, encoding: "utf8", env: cloneEnv, stdio: ["ignore", "pipe", "pipe"] });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
241
259
|
function pinCloneGitConfig(realGitDir) {
|
|
242
260
|
const configPath = join(realGitDir, "config");
|
|
243
261
|
try {
|
|
@@ -289,6 +307,7 @@ export function cloneIsolatedRepo(input) {
|
|
|
289
307
|
catch {
|
|
290
308
|
}
|
|
291
309
|
execFileSync("git", [...EXTRA_DIRECT_CHAT_GIT_FLAGS, `--git-dir=${realGitDir}`, `--work-tree=${realClone}`, "checkout", "-b", input.branch, baseSha], { cwd: realClone, encoding: "utf8", env: cloneEnv, stdio: ["ignore", "pipe", "pipe"] });
|
|
310
|
+
writeCloneIdentity(realGitDir, realClone, identityFrom(runHardenedMainGit(["config", "--local", "--list", "-z"], input.repo), DIRECT_CHAT_IDENTITY));
|
|
292
311
|
const configSha256 = pinCloneGitConfig(realGitDir);
|
|
293
312
|
return { baseSha, gitDir: realGitDir, configSha256, mainDirtyFiles };
|
|
294
313
|
}
|
|
@@ -331,6 +350,7 @@ export async function cloneIsolatedRepoAsync(input) {
|
|
|
331
350
|
catch {
|
|
332
351
|
}
|
|
333
352
|
await execFileAsync("git", [...EXTRA_DIRECT_CHAT_GIT_FLAGS, `--git-dir=${realGitDir}`, `--work-tree=${realClone}`, "checkout", "-b", input.branch, baseSha], { cwd: realClone, encoding: "utf8", env: cloneEnv });
|
|
353
|
+
writeCloneIdentity(realGitDir, realClone, identityFrom(await runHardenedMainGitAsync(["config", "--local", "--list", "-z"], input.repo), DIRECT_CHAT_IDENTITY));
|
|
334
354
|
const configSha256 = pinCloneGitConfig(realGitDir);
|
|
335
355
|
return { baseSha, gitDir: realGitDir, configSha256, mainDirtyFiles };
|
|
336
356
|
}
|
package/dist/direct-chat-ship.js
CHANGED
|
@@ -176,10 +176,10 @@ export function directChatShipReadiness(store, repo) {
|
|
|
176
176
|
const canAutoMerge = github !== null && check !== null;
|
|
177
177
|
let autoMergeReason = null;
|
|
178
178
|
if (github === null) {
|
|
179
|
-
autoMergeReason = "This project isn't connected to GitHub pull requests yet
|
|
179
|
+
autoMergeReason = "This project isn't connected to GitHub pull requests yet, so Save the branch instead.";
|
|
180
180
|
}
|
|
181
181
|
else if (check === null) {
|
|
182
|
-
autoMergeReason = "Set a project check command in Settings before auto-merging
|
|
182
|
+
autoMergeReason = "Set a project check command in Settings before auto-merging, or Save the branch.";
|
|
183
183
|
}
|
|
184
184
|
return {
|
|
185
185
|
canAutoMerge,
|
|
@@ -243,10 +243,10 @@ function previewWithInspection(store, input) {
|
|
|
243
243
|
const canAutoMerge = github !== null && check !== null;
|
|
244
244
|
let autoMergeReason = null;
|
|
245
245
|
if (github === null) {
|
|
246
|
-
autoMergeReason = "This project isn't connected to GitHub pull requests yet
|
|
246
|
+
autoMergeReason = "This project isn't connected to GitHub pull requests yet, so Save the branch instead.";
|
|
247
247
|
}
|
|
248
248
|
else if (check === null) {
|
|
249
|
-
autoMergeReason = "Set a project check command in Settings before auto-merging
|
|
249
|
+
autoMergeReason = "Set a project check command in Settings before auto-merging, or Save the branch.";
|
|
250
250
|
}
|
|
251
251
|
const mode = input.mode ?? (canAutoMerge ? "ship" : "keep-branch");
|
|
252
252
|
const nextSeq = Number(store.handle.prepare("SELECT COALESCE(MAX(seq), 0) + 1 AS n FROM direct_chat_ship WHERE thread_id = ?").get(input.threadId)["n"]);
|
|
@@ -328,7 +328,7 @@ export function executeDirectChatShip(store, input) {
|
|
|
328
328
|
ok: false,
|
|
329
329
|
status: 409,
|
|
330
330
|
code: "auto_merge_unavailable",
|
|
331
|
-
error: preview.autoMergeReason ?? "Auto-merge isn't available for this project;
|
|
331
|
+
error: preview.autoMergeReason ?? "Auto-merge isn't available for this project; Save the branch instead.",
|
|
332
332
|
};
|
|
333
333
|
}
|
|
334
334
|
const thread = store.handle
|
package/dist/direct-chat.js
CHANGED
|
@@ -11,10 +11,11 @@ import { defaultCustodyIO } from "./flexible-launch.js";
|
|
|
11
11
|
import { plainAgentEnv } from "./agent-fence.js";
|
|
12
12
|
import { directChatFence } from "./direct-chat-fence.js";
|
|
13
13
|
import { confined } from "./exec.js";
|
|
14
|
+
import { identityEnv } from "./git-identity.js";
|
|
14
15
|
import { cleanLiveText, HIDDEN_LINE, liveSecretHit } from "./live-records.js";
|
|
15
16
|
import { projectName } from "./project.js";
|
|
16
17
|
import { captureNewWorkspaceArtifacts, extractBase64ImagesFromLine, getDirectChatArtifact, listArtifactsForThread, saveDirectChatArtifact, snapshotWorkspaceImages, } from "./direct-chat-artifacts.js";
|
|
17
|
-
import { assertManagedClonePath, assertTrustedCloneGit, cloneIsolatedRepoAsync, pinnedConfigBackupPath, repairCloneGitBinding, runTrustedCloneGit, } from "./direct-chat-git.js";
|
|
18
|
+
import { assertManagedClonePath, assertTrustedCloneGit, cloneCommitIdentity, cloneIsolatedRepoAsync, pinnedConfigBackupPath, repairCloneGitBinding, runTrustedCloneGit, } from "./direct-chat-git.js";
|
|
18
19
|
import { applyMainDirtyPatch, cloneSafeNodeModulesAsync } from "./direct-chat-workspace.js";
|
|
19
20
|
import { defaultContextWindowFor, normalizeDirectChatEffort, resolveAgyModelForEffort } from "./direct-chat-catalog.js";
|
|
20
21
|
import { effectiveSkillsForRepo, materializeProjectSkills } from "./project-skills.js";
|
|
@@ -598,12 +599,29 @@ async function defaultPrepareCloneAsync(input) {
|
|
|
598
599
|
mainDirtyFiles: cloned.mainDirtyFiles.map(sanitizeLine),
|
|
599
600
|
};
|
|
600
601
|
}
|
|
602
|
+
const UNREAD_DIFF = Object.freeze({ changedFiles: [], diffText: "", dirty: false, unread: true });
|
|
603
|
+
function diffCacheOf(raw) {
|
|
604
|
+
if (typeof raw !== "string" || raw === "")
|
|
605
|
+
return { changedFiles: [], diffText: "", dirty: false };
|
|
606
|
+
try {
|
|
607
|
+
const parsed = JSON.parse(raw);
|
|
608
|
+
return {
|
|
609
|
+
changedFiles: Array.isArray(parsed.changedFiles) ? parsed.changedFiles.filter((x) => typeof x === "string") : [],
|
|
610
|
+
diffText: typeof parsed.diffText === "string" ? parsed.diffText : "",
|
|
611
|
+
dirty: parsed.dirty === true,
|
|
612
|
+
...(parsed.unread === true ? { unread: true } : {}),
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
catch {
|
|
616
|
+
return { changedFiles: [], diffText: "", dirty: false };
|
|
617
|
+
}
|
|
618
|
+
}
|
|
601
619
|
function defaultReadDiff(input) {
|
|
602
620
|
if (!existsSync(input.binding.clonePath))
|
|
603
|
-
return {
|
|
621
|
+
return { ...UNREAD_DIFF };
|
|
604
622
|
const verified = assertTrustedCloneGit(input.binding);
|
|
605
623
|
if (!verified.ok)
|
|
606
|
-
return {
|
|
624
|
+
return { ...UNREAD_DIFF };
|
|
607
625
|
try {
|
|
608
626
|
const statusLines = runTrustedCloneGit(input.binding, ["status", "--porcelain"])
|
|
609
627
|
.split("\n")
|
|
@@ -632,7 +650,7 @@ function defaultReadDiff(input) {
|
|
|
632
650
|
};
|
|
633
651
|
}
|
|
634
652
|
catch {
|
|
635
|
-
return {
|
|
653
|
+
return { ...UNREAD_DIFF };
|
|
636
654
|
}
|
|
637
655
|
}
|
|
638
656
|
function snapshotCloneTree(binding) {
|
|
@@ -881,7 +899,11 @@ export class DirectChatHost {
|
|
|
881
899
|
}
|
|
882
900
|
refreshDiffCache(thread) {
|
|
883
901
|
const binding = this.bindingOf(thread);
|
|
884
|
-
const
|
|
902
|
+
const read = binding === null ? thread.isLegacy ? null : { ...UNREAD_DIFF } : this.readDiffFn({ binding, baseSha: thread.baseSha });
|
|
903
|
+
const saved = diffCacheOf(this.store.handle.prepare(`SELECT diff_cache_json FROM direct_chat_thread WHERE id = ?`).get(thread.id)?.["diff_cache_json"]);
|
|
904
|
+
if (read === null)
|
|
905
|
+
return saved;
|
|
906
|
+
const diff = read.unread === true ? { ...saved, unread: true } : { changedFiles: read.changedFiles, diffText: read.diffText, dirty: read.dirty };
|
|
885
907
|
this.store.handle
|
|
886
908
|
.prepare(`UPDATE direct_chat_thread SET diff_cache_json = ? WHERE id = ?`)
|
|
887
909
|
.run(JSON.stringify(diff), thread.id);
|
|
@@ -1352,7 +1374,7 @@ export class DirectChatHost {
|
|
|
1352
1374
|
`).run(turnId, thread.id, nextSeq, input.requestId, trimmed, switchedFrom, logPath, stderrPath, this.bootId(), stamp);
|
|
1353
1375
|
let launched;
|
|
1354
1376
|
try {
|
|
1355
|
-
const childEnv = buildSanitizedChildEnv(thread.provider);
|
|
1377
|
+
const childEnv = { ...buildSanitizedChildEnv(thread.provider), ...identityEnv(cloneCommitIdentity(bindingForTree)) };
|
|
1356
1378
|
if (turnSkills.dir !== null)
|
|
1357
1379
|
childEnv["TOOLROLL_SKILLS_DIR"] = turnSkills.dir;
|
|
1358
1380
|
launched = this.spawnTurnFn({
|
|
@@ -2038,20 +2060,7 @@ export class DirectChatHost {
|
|
|
2038
2060
|
mainDirtyFiles = [];
|
|
2039
2061
|
}
|
|
2040
2062
|
}
|
|
2041
|
-
|
|
2042
|
-
if (typeof raw["diff_cache_json"] === "string" && raw["diff_cache_json"] !== "") {
|
|
2043
|
-
try {
|
|
2044
|
-
const parsed = JSON.parse(raw["diff_cache_json"]);
|
|
2045
|
-
diffCache = {
|
|
2046
|
-
changedFiles: Array.isArray(parsed.changedFiles) ? parsed.changedFiles.filter((x) => typeof x === "string") : [],
|
|
2047
|
-
diffText: typeof parsed.diffText === "string" ? parsed.diffText : "",
|
|
2048
|
-
dirty: parsed.dirty === true,
|
|
2049
|
-
};
|
|
2050
|
-
}
|
|
2051
|
-
catch {
|
|
2052
|
-
diffCache = { changedFiles: [], diffText: "", dirty: false };
|
|
2053
|
-
}
|
|
2054
|
-
}
|
|
2063
|
+
const diffCache = diffCacheOf(raw["diff_cache_json"]);
|
|
2055
2064
|
return {
|
|
2056
2065
|
id: String(raw["id"]),
|
|
2057
2066
|
owner: String(raw["owner"]),
|
package/dist/doctor.js
CHANGED
|
@@ -7,8 +7,23 @@ import { envelopeJson } from "./envelope.js";
|
|
|
7
7
|
import { GIT_FLOOR_WORDS, installedGitFloorProblem } from "./git-floor.js";
|
|
8
8
|
import { run as runCommand } from "./exec.js";
|
|
9
9
|
import { OWN_KEY_ENV } from "./keys.js";
|
|
10
|
+
import { processIdentityProblem } from "./process-identity.js";
|
|
10
11
|
import { ALL_CREDENTIAL_ENV } from "./provider.js";
|
|
11
|
-
import { SANDBOX_RUNTIME,
|
|
12
|
+
import { SANDBOX_RUNTIME, sandboxAdviceLines, sandboxRuntimeDiagnosis, sandboxRuntimeWords, UNCONFINED_OPT_IN } from "./sandbox-runtime.js";
|
|
13
|
+
async function agentTrustProblems(env, uid) {
|
|
14
|
+
const { excludedFolders, statusBinaryDiagnosis } = await import("./status-probe.js");
|
|
15
|
+
const { agentTrustWords } = await import("./agent-detect.js");
|
|
16
|
+
const { platformAcl } = await import("./trusted-path.js");
|
|
17
|
+
const untrusted = await excludedFolders({}) ?? [];
|
|
18
|
+
const path = (env["PATH"] ?? "").split(":").filter(one => one.startsWith("/")).join(":");
|
|
19
|
+
const found = [];
|
|
20
|
+
for (const [binary, name] of [["claude", "Claude Code"], ["codex", "Codex"]]) {
|
|
21
|
+
const words = agentTrustWords(statusBinaryDiagnosis(binary, { path, uid, untrusted, acl: platformAcl() }));
|
|
22
|
+
if (words !== null)
|
|
23
|
+
found.push({ name, problem: words });
|
|
24
|
+
}
|
|
25
|
+
return found;
|
|
26
|
+
}
|
|
12
27
|
const CREDENTIAL_NAME = /(?:^|_)(?:API_?KEY|ACCESS_?KEY|PRIVATE_?KEY|SECRET|SECRET_?KEY|TOKEN|AUTH_?TOKEN|PASSWORD|PASSWD|CREDENTIALS?|PAT)(?:_|$)/i;
|
|
13
28
|
const POINTER_NAME = /(?:_FILE|_PATH|_DIR|_SOCK|_URL|_HOST)$/i;
|
|
14
29
|
const CREDENTIAL_FLAG = /^--?(?:token|api-?key|key|secret|password|auth-token)$/i;
|
|
@@ -343,6 +358,8 @@ export function doctorLines(report) {
|
|
|
343
358
|
const lines = [];
|
|
344
359
|
if (report.git?.problem != null)
|
|
345
360
|
lines.push(`Git: ${report.git.problem}`, "");
|
|
361
|
+
if (report.processIdentity?.problem != null)
|
|
362
|
+
lines.push(`Processes: ${report.processIdentity.problem}. Toolroll's worker won't start until it can.`, "");
|
|
346
363
|
if (report.findings.length === 0 && report.unreadable.length === 0)
|
|
347
364
|
lines.push("No secrets found in Toolroll's service. A build can't read a key from it.");
|
|
348
365
|
else if (report.findings.length > 0)
|
|
@@ -359,8 +376,13 @@ export function doctorLines(report) {
|
|
|
359
376
|
}
|
|
360
377
|
for (const note of report.notes)
|
|
361
378
|
lines.push("", `Note: ${note}`);
|
|
379
|
+
const optIn = report.sandbox?.repair?.includes(UNCONFINED_OPT_IN) === true;
|
|
362
380
|
if (report.sandbox !== undefined)
|
|
363
|
-
lines.push("", `Sandbox: ${sandboxRuntimeWords()}${report.sandbox.problem === null ? ", working here." : `, not available here: ${report.sandbox.problem}. Builds don't start unless an instance operator allows unconfined agents
|
|
381
|
+
lines.push("", `Sandbox: ${sandboxRuntimeWords()}${report.sandbox.problem === null ? ", working here." : `, not available here: ${report.sandbox.problem}. Builds don't start ${optIn ? "here." : "unless an instance operator allows unconfined agents."}`}`);
|
|
382
|
+
if (report.sandbox?.repair !== undefined && report.sandbox.repair.length > 0)
|
|
383
|
+
lines.push(...report.sandbox.repair, ...report.sandbox.kind === "trust" ? ["Then run `toolroll doctor` again."] : []);
|
|
384
|
+
for (const agent of report.agents ?? [])
|
|
385
|
+
lines.push("", `${agent.name}: ${agent.problem}`);
|
|
364
386
|
if (report.checked.length > 0)
|
|
365
387
|
lines.push("", "Checked:", ...report.checked.map(one => ` ${one}`));
|
|
366
388
|
return lines;
|
|
@@ -378,10 +400,15 @@ export async function runDoctorCommand(argv, write, deps = {}) {
|
|
|
378
400
|
return 2;
|
|
379
401
|
}
|
|
380
402
|
const report = await auditServiceEnvironment(deps);
|
|
381
|
-
|
|
403
|
+
const diagnosis = sandboxRuntimeDiagnosis();
|
|
404
|
+
report.sandbox = { engine: SANDBOX_RUNTIME.name, version: SANDBOX_RUNTIME.version, problem: diagnosis.ok ? null : diagnosis.why, ...(diagnosis.ok ? {} : { kind: diagnosis.kind, repair: sandboxAdviceLines(diagnosis) }) };
|
|
405
|
+
report.agents = await (deps.agentProblems ?? (() => agentTrustProblems(deps.env ?? process.env, deps.uid ?? process.getuid?.() ?? -1)))();
|
|
382
406
|
report.git = { floor: GIT_FLOOR_WORDS, problem: deps.gitFloorProblem === undefined ? installedGitFloorProblem() : deps.gitFloorProblem };
|
|
383
407
|
if (report.git.problem !== null)
|
|
384
408
|
report.ok = false;
|
|
409
|
+
report.processIdentity = { problem: deps.processIdentityProblem === undefined ? processIdentityProblem() : deps.processIdentityProblem };
|
|
410
|
+
if (report.processIdentity.problem !== null)
|
|
411
|
+
report.ok = false;
|
|
385
412
|
if (json)
|
|
386
413
|
write(envelopeJson({ command: "doctor", ...report }));
|
|
387
414
|
else
|
package/dist/easy-start.js
CHANGED
|
@@ -60,9 +60,33 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
60
60
|
if (refusedTooDeep())
|
|
61
61
|
return EXIT.refused;
|
|
62
62
|
const sandbox = await seams.sandbox();
|
|
63
|
+
const others = await (seams.prerequisites?.() ?? Promise.resolve({ blockers: [], advisories: [] }));
|
|
64
|
+
const blockers = [];
|
|
65
|
+
let passwordInstead = false;
|
|
63
66
|
if (sandbox.missing.length > 0) {
|
|
64
67
|
const { missingSandboxToolsWords } = await import("./sandbox-runtime.js");
|
|
65
|
-
|
|
68
|
+
blockers.push(missingSandboxToolsWords(sandbox.missing));
|
|
69
|
+
}
|
|
70
|
+
else if (sandbox.problem !== null) {
|
|
71
|
+
const { UNCONFINED_OPT_IN } = await import("./sandbox-runtime.js");
|
|
72
|
+
blockers.push([`Agents can't run in a sandbox here: ${sandbox.problem}.`, ...(sandbox.repair ?? []).filter(line => line !== UNCONFINED_OPT_IN)]);
|
|
73
|
+
passwordInstead = others.blockers.length === 0;
|
|
74
|
+
}
|
|
75
|
+
blockers.push(...others.blockers);
|
|
76
|
+
if (blockers.length > 0) {
|
|
77
|
+
if (blockers.length === 1) {
|
|
78
|
+
for (const line of blockers[0])
|
|
79
|
+
write(line);
|
|
80
|
+
if (sandbox.missing.length === 0 && sandbox.problem !== null)
|
|
81
|
+
write("Then run toolroll again.");
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
write("Toolroll can't start on this computer yet. Fix these, then run toolroll again:");
|
|
85
|
+
blockers.forEach((lines, index) => lines.forEach((line, at) => write(at === 0 ? `${index + 1}. ${line}` : ` ${line}`)));
|
|
86
|
+
}
|
|
87
|
+
if (passwordInstead)
|
|
88
|
+
write("To start now with a password instead, run `toolroll up`. Agents then run only once the sandbox works, or if an instance operator lets them run without OS confinement (`toolroll config unconfined-agents allow`).");
|
|
89
|
+
for (const line of others.advisories)
|
|
66
90
|
write(line);
|
|
67
91
|
return EXIT.refused;
|
|
68
92
|
}
|
|
@@ -147,9 +171,12 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
147
171
|
return EXIT.ok;
|
|
148
172
|
};
|
|
149
173
|
if (seams.localMode() !== "on") {
|
|
150
|
-
const problem =
|
|
174
|
+
const { problem, repair } = await seams.sandbox();
|
|
151
175
|
if (problem !== null)
|
|
152
176
|
write(`Toolroll can't start without a password here: ${problem}.`);
|
|
177
|
+
if (problem !== null)
|
|
178
|
+
for (const line of repair ?? [])
|
|
179
|
+
write(line);
|
|
153
180
|
const saved = seams.savedLogin();
|
|
154
181
|
write(saved === null ? `Toolroll is on ${url}. Sign in with your password.` : `Toolroll is on ${url}. Your password: run \`cat -- '${saved.replaceAll("'", "'\\''")}'\``);
|
|
155
182
|
await seams.openBrowser(url);
|
|
@@ -193,17 +220,14 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
193
220
|
const target = new URL(setup ? "/password/set" : `${page}#agents`, url);
|
|
194
221
|
if (setup)
|
|
195
222
|
target.searchParams.set("next", page);
|
|
196
|
-
await seams.openBrowser(target.href);
|
|
197
|
-
return "In the browser, open Agents → Change agents and save the new builder.";
|
|
223
|
+
const opened = await seams.openBrowser(target.href);
|
|
224
|
+
return opened === false ? `Open ${target.href} in a browser, then Agents → Change agents and save the new builder.` : "In the browser, open Agents → Change agents and save the new builder.";
|
|
198
225
|
},
|
|
199
226
|
openBrowser: async (page) => {
|
|
200
|
-
if (page === "projects") {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (page === "lead-providers") {
|
|
205
|
-
await seams.openBrowser(new URL("/settings/lead#lead-config", url).href);
|
|
206
|
-
return "Opened Lead settings in your browser.";
|
|
227
|
+
if (page === "projects" || page === "lead-providers") {
|
|
228
|
+
const href = new URL(page === "projects" ? "/projects" : "/settings/lead#lead-config", url).href;
|
|
229
|
+
const opened = await seams.openBrowser(href);
|
|
230
|
+
return opened === false ? `Open ${href} in a browser.` : `Opened ${page === "projects" ? "Projects" : "Lead settings"} in your browser.`;
|
|
207
231
|
}
|
|
208
232
|
const opened = await seams.openSignedIn(page);
|
|
209
233
|
return opened.ok ? "Opened in your browser." : `The browser couldn't be opened: ${opened.message}.`;
|
|
@@ -287,12 +311,14 @@ export function defaultEasyStartSeams(options) {
|
|
|
287
311
|
remote: (await import("./local-owner.js")).localOwnerRequested(),
|
|
288
312
|
}),
|
|
289
313
|
sandbox: async () => {
|
|
290
|
-
const { missingLinuxSandboxTools,
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
314
|
+
const { missingLinuxSandboxTools, sandboxAdviceLines, sandboxRuntimeDiagnosis } = await import("./sandbox-runtime.js");
|
|
315
|
+
const missing = process.platform === "linux" ? missingLinuxSandboxTools() : [];
|
|
316
|
+
if (missing.length > 0)
|
|
317
|
+
return { missing, problem: null };
|
|
318
|
+
const diagnosis = sandboxRuntimeDiagnosis();
|
|
319
|
+
return diagnosis.ok ? { missing, problem: null } : { missing, problem: diagnosis.why, repair: sandboxAdviceLines(diagnosis) };
|
|
295
320
|
},
|
|
321
|
+
prerequisites: async () => (await import("./preflight.js")).startPrerequisites(),
|
|
296
322
|
passwordByLaptopStart: () => {
|
|
297
323
|
const store = openStoreReadOnly(file);
|
|
298
324
|
if (store === null)
|
|
@@ -323,7 +349,7 @@ export function defaultEasyStartSeams(options) {
|
|
|
323
349
|
},
|
|
324
350
|
spawnUp: args => spawnOwnedUp(args, { cwd, databaseFile: file }),
|
|
325
351
|
runUpForeground: async (args) => (await import("./operate.js")).runOperate("up", [...args, "--db", file], options.write, options.operate ?? {}),
|
|
326
|
-
openBrowser: async (url) =>
|
|
352
|
+
openBrowser: async (url) => (await import("./operate.js")).openBrowser(url),
|
|
327
353
|
openSignedIn: page => openLocalSignIn(file, options.build, page === undefined ? {} : { then: page }),
|
|
328
354
|
openTui: async (session) => {
|
|
329
355
|
const { chooseTuiBinary, runTuiBinary } = await import("./tui-launch.js");
|
package/dist/engine-reads.js
CHANGED
|
@@ -3,6 +3,8 @@ import { codexOfflineDependencySuggestion, failedAttemptSentence, latestFinished
|
|
|
3
3
|
import { pendingAgentChangeOf, planSourceOf, retryPinsOf } from "./local-owner-acts.js";
|
|
4
4
|
import { assignmentOf, owedAcceptance, personCompletionRefusal } from "./assignment.js";
|
|
5
5
|
import { assignmentCardOf } from "./assignment-ui.js";
|
|
6
|
+
import { landedNowOf } from "./merge-checklist.js";
|
|
7
|
+
import { liveQuickCommand } from "./check-levels.js";
|
|
6
8
|
import { assignmentStageOf, stageOfCode } from "./task-status.js";
|
|
7
9
|
import { taskRoad } from "./first-run.js";
|
|
8
10
|
import { stepRowsOf } from "./workspace-ui.js";
|
|
@@ -121,9 +123,21 @@ export function stepCardsOf({ store, family, now, access, evidenceRoot, viewer =
|
|
|
121
123
|
scopeDigest: scope?.digest ?? null,
|
|
122
124
|
agentChoices: scope === null || !withChoices ? null : agentChoicesOf(store, current.id, ref, now),
|
|
123
125
|
pendingAgentChange: ref === null ? null : pendingAgentChangeOf(store, ref.id),
|
|
126
|
+
landing: assignment === null ? null : landedNowOf(store, assignment),
|
|
127
|
+
...(card?.status.check === "failed" || card?.status.check === "stale" || card?.status.check === "unreadable" ? { check: card.status.check } : {}),
|
|
128
|
+
...(() => { const offer = runChecksOfferOf(store, assignment, card?.status.check ?? null); return offer === null ? {} : { runChecks: offer }; })(),
|
|
124
129
|
room: `task:${encodeURIComponent(root.id)}`,
|
|
125
130
|
};
|
|
126
131
|
}
|
|
132
|
+
function runChecksOfferOf(store, assignment, check) {
|
|
133
|
+
if (check !== "failed" && check !== "stale" && check !== "unreadable" && check !== "not-run")
|
|
134
|
+
return null;
|
|
135
|
+
const receipt = assignment?.receipt ?? null;
|
|
136
|
+
if (receipt === null || receipt.head === null || receipt.completionKind === "research-report" || assignment.repo === null || store.isDemo())
|
|
137
|
+
return null;
|
|
138
|
+
const level = store.liveVerifyCommand(assignment.repo) !== null ? "full" : liveQuickCommand(store, assignment.repo) !== null ? "quick" : null;
|
|
139
|
+
return level === null ? null : { run: receipt.runId, level };
|
|
140
|
+
}
|
|
127
141
|
export const SHELL_NO_RESULT = "This build has no saved result yet. Wait for it to finish (or stop it), then open the build shell.";
|
|
128
142
|
export const SHELL_NO_COMMIT = "This build has no saved commit to open a terminal on.";
|
|
129
143
|
function shellOf(store, family, runId) {
|
package/dist/evals.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { identityProvider, lstartToIso, processIdentity } from "./process-identity.js";
|
|
1
2
|
import { execFileSync, spawn } from "node:child_process";
|
|
2
3
|
import { createHash, randomBytes } from "node:crypto";
|
|
3
4
|
import { closeSync, constants, lstatSync, mkdirSync, mkdtempSync, openSync, readdirSync, realpathSync, rmSync, writeSync } from "node:fs";
|
|
@@ -785,33 +786,30 @@ export function recoverEvalCampaigns(store, now, options = {}) {
|
|
|
785
786
|
return out;
|
|
786
787
|
}
|
|
787
788
|
export function processStartOf(pid) {
|
|
788
|
-
if (
|
|
789
|
+
if (!Number.isSafeInteger(pid) || pid <= 0)
|
|
789
790
|
return null;
|
|
790
|
-
|
|
791
|
-
const raw = execFileSync("/bin/ps", ["-p", String(pid), "-o", "lstart="], {
|
|
792
|
-
encoding: "utf8", env: { PATH: "/usr/bin:/bin", LC_ALL: "C", TZ: "UTC" }, stdio: ["ignore", "pipe", "ignore"], maxBuffer: 1024, timeout: 2_000, killSignal: "SIGKILL",
|
|
793
|
-
}).trim().replace(/ +/g, " ");
|
|
794
|
-
return /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) \d{1,2} \d{2}:\d{2}:\d{2} \d{4}$/.test(raw) ? raw : null;
|
|
795
|
-
}
|
|
796
|
-
catch {
|
|
797
|
-
return null;
|
|
798
|
-
}
|
|
791
|
+
return processIdentity(pid);
|
|
799
792
|
}
|
|
800
793
|
export function runnerMayBeAlive(pid, started) {
|
|
801
794
|
if (!processMayBeAlive(pid, false))
|
|
802
795
|
return false;
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
const
|
|
796
|
+
if (started === null)
|
|
797
|
+
return true;
|
|
798
|
+
const provider = identityProvider(started);
|
|
799
|
+
if (provider === null)
|
|
800
|
+
return true;
|
|
801
|
+
const now = processIdentity(pid, provider);
|
|
802
|
+
if (now === null)
|
|
803
|
+
return true;
|
|
804
|
+
if (provider === "proc")
|
|
805
|
+
return now === started;
|
|
806
|
+
const was = startMs(started), is = startMs(now);
|
|
806
807
|
return was === null || is === null || Math.abs(is - was) <= 2_000;
|
|
807
808
|
}
|
|
808
809
|
function startMs(raw) {
|
|
809
|
-
const
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
const utc = `${match[1]}, ${match[3].padStart(2, "0")} ${match[2]} ${match[5]} ${match[4]} GMT`;
|
|
813
|
-
const ms = Date.parse(utc);
|
|
814
|
-
return Number.isFinite(ms) && new Date(ms).toUTCString() === utc ? ms : null;
|
|
810
|
+
const iso = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(raw) ? raw : lstartToIso(raw);
|
|
811
|
+
const ms = iso === null ? NaN : Date.parse(iso);
|
|
812
|
+
return Number.isFinite(ms) ? ms : null;
|
|
815
813
|
}
|
|
816
814
|
export function abandonEvalCampaign(store, input) {
|
|
817
815
|
return store.transact(() => {
|
package/dist/first-run.js
CHANGED
|
@@ -2,6 +2,7 @@ import { run } from "./exec.js";
|
|
|
2
2
|
import { hardenedGit } from "./teardown-git.js";
|
|
3
3
|
import { githubIssues } from "./issues.js";
|
|
4
4
|
import { START_BUILDER_HREF } from "./needs-you.js";
|
|
5
|
+
import { CHECKS_OUT_OF_DATE } from "./task-status.js";
|
|
5
6
|
import { firstRunAgentLines, firstTaskOf, withNext } from "./agent-detect.js";
|
|
6
7
|
export const SIGN_IN_COMMAND = "claude auth login";
|
|
7
8
|
export const SANDBOX_COMMAND = "npx toolroll demo";
|
|
@@ -144,6 +145,7 @@ export function taskRoad(read, approved, built, facts) {
|
|
|
144
145
|
case "running": return { ...step, state: "current", say: "Checks running" };
|
|
145
146
|
case "failed": return { ...step, say: "Checks failed" };
|
|
146
147
|
case "unreadable": return { ...step, say: "Checks unreadable" };
|
|
148
|
+
case "stale": return { ...step, say: CHECKS_OUT_OF_DATE };
|
|
147
149
|
default: return step;
|
|
148
150
|
}
|
|
149
151
|
}
|
|
@@ -152,7 +154,8 @@ export function taskRoad(read, approved, built, facts) {
|
|
|
152
154
|
if (step.state === "current")
|
|
153
155
|
return facts.checks === "failed" ? { ...step, state: "stuck", say: "Checks failed" }
|
|
154
156
|
: facts.checks === "unreadable" ? { ...step, state: "stuck", say: "Checks unreadable" }
|
|
155
|
-
: facts.checks === "
|
|
157
|
+
: facts.checks === "stale" ? { ...step, state: "stuck", say: CHECKS_OUT_OF_DATE }
|
|
158
|
+
: facts.checks === "running" ? { ...step, say: "Checks running" } : step;
|
|
156
159
|
switch (facts.checks ?? null) {
|
|
157
160
|
case "passed": return step;
|
|
158
161
|
case "running": return { ...step, state: "current", say: "Checks running" };
|
|
@@ -160,6 +163,7 @@ export function taskRoad(read, approved, built, facts) {
|
|
|
160
163
|
case "not-run": return { ...step, state: "skipped", say: "Checks not run" };
|
|
161
164
|
case "off": return { ...step, state: "skipped", say: "Checks at release" };
|
|
162
165
|
case "unreadable": return { ...step, state: "stuck", say: "Checks unreadable", ...(complete ? {} : { needsYou: true }) };
|
|
166
|
+
case "stale": return { ...step, state: "stuck", say: CHECKS_OUT_OF_DATE, ...(complete ? {} : { needsYou: true }) };
|
|
163
167
|
default: return { ...step, state: "skipped" };
|
|
164
168
|
}
|
|
165
169
|
});
|
package/dist/flexible-import.js
CHANGED
|
@@ -820,9 +820,10 @@ export async function projectMergeHint(store, input) {
|
|
|
820
820
|
const head = await read(project, ["symbolic-ref", "-q", "HEAD"]);
|
|
821
821
|
const ref = head.code === 0 ? head.stdout.trim() : "";
|
|
822
822
|
if (!ref.startsWith("refs/heads/"))
|
|
823
|
-
return { repo: project, branch: null, fastForward: false };
|
|
823
|
+
return { repo: project, branch: null, fastForward: false, contained: false };
|
|
824
824
|
const ancestor = await read(project, ["merge-base", "--is-ancestor", "--end-of-options", ref, input.candidate]);
|
|
825
|
-
|
|
825
|
+
const contained = await read(project, ["merge-base", "--is-ancestor", "--end-of-options", input.candidate, ref]);
|
|
826
|
+
return { repo: project, branch: ref.slice("refs/heads/".length), fastForward: ancestor.code === 0, contained: contained.code === 0 };
|
|
826
827
|
}
|
|
827
828
|
export async function settleInterruptedImport(store, input) {
|
|
828
829
|
const thread = flexibleThread(store, input.thread);
|