toolroll 0.9.123 → 0.9.125

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 CHANGED
@@ -4,6 +4,30 @@ Each release opens with one line on its theme, then **New**, **Changed**, **Fixe
4
4
  the ones it has). Each item is at most two lines and says where to find it. Notes for maintainers (CI, the release
5
5
  tooling) go on the GitHub release, not here. Entries before 0.9.104 use the older format.
6
6
 
7
+ ## 0.9.125 — 2026-11-26
8
+
9
+ Everything in 0.9.124, which was tagged but never reached npm.
10
+
11
+ ## 0.9.124 — 2026-11-26
12
+
13
+ Thread commits stop carrying your computer's name, Skills is in Settings, and saving a Direct Chat tells you how to
14
+ bring it in.
15
+
16
+ ### Changed
17
+
18
+ - **Skills is in Settings → Agents and models** for everyone: "Skills for <project>", one status per skill, and an
19
+ import that can't reach GitHub says so and keeps the address you typed.
20
+ - **Saving a Direct Chat as a branch** shows the exact `git merge` to bring it in; the button is "Save the branch".
21
+ - **Turning threads on from the workbench** keeps the message you typed and gives a command that explains its options.
22
+ - **Settings → Passwordless** lists exactly which acts still ask for a password.
23
+
24
+ ### Fixed
25
+
26
+ - **Commits an agent makes in a thread or Direct Chat** use your project's git name and email (or a neutral Toolroll
27
+ one), never your computer's account or host name. Commits made before this keep theirs.
28
+ - **A thread's Diff** no longer offers Accept and Send back for a task; it offers Save as branch.
29
+ - **Reloading a page after Ship, Save or Land** shows what happened instead of "Not found", and never does it again.
30
+
7
31
  ## 0.9.123 — 2026-11-26
8
32
 
9
33
  Accepted work stays accepted, every command Toolroll gives you can be copied whole, and Toolroll stays quiet while
@@ -13,7 +13,6 @@ export const ADVANCED_PAGES = Object.freeze([
13
13
  { title: "Agents", href: "/agents", words: "Every agent at work now, and the computers that build" },
14
14
  { title: "Spend", href: "/spend", words: "What agent work cost, and monthly limits", operator: true },
15
15
  { title: "Subagents", href: "/settings/lead/subagents", words: "Helpers the lead looks after" },
16
- { title: "Skills", href: "/settings/skills", words: "Reusable instructions for agents" },
17
16
  { title: "Learning", href: "/settings/learning", words: "Lessons kept from finished work" },
18
17
  { title: "Operating mode", href: "/mode", words: "Let a project run for a while without asking" },
19
18
  { title: "Policy", href: "/settings/policy", words: "Limits no task can go past" },
@@ -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: Keep branch on this Mac." : "Mode: Ship (runs project check before merging).", "Opens the Ship preview so you can review and confirm before anything is pushed or merged.");
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);
@@ -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
  }
@@ -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 — use Keep branch instead.";
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 — or use Keep branch.";
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 — use Keep branch instead.";
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 — or use Keep branch.";
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; use Keep branch instead.",
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
@@ -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";
@@ -1352,7 +1353,7 @@ export class DirectChatHost {
1352
1353
  `).run(turnId, thread.id, nextSeq, input.requestId, trimmed, switchedFrom, logPath, stderrPath, this.bootId(), stamp);
1353
1354
  let launched;
1354
1355
  try {
1355
- const childEnv = buildSanitizedChildEnv(thread.provider);
1356
+ const childEnv = { ...buildSanitizedChildEnv(thread.provider), ...identityEnv(cloneCommitIdentity(bindingForTree)) };
1356
1357
  if (turnSkills.dir !== null)
1357
1358
  childEnv["TOOLROLL_SKILLS_DIR"] = turnSkills.dir;
1358
1359
  launched = this.spawnTurnFn({
@@ -15,6 +15,7 @@ import { processMayBeAlive } from "./process-liveness.js";
15
15
  import { startIdentityOf } from "./flexible-custody.js";
16
16
  import { defaultCustodyIO, holdLaunch, recordGateShut, recordLive, reserveLaunchOpen, recordNeverStarted, recordSpawning, settleLaunch, unsettledLaunch } from "./flexible-launch.js";
17
17
  import { readProjectRefs, saveRefSnapshot } from "./flexible-refs.js";
18
+ import { identityEnv, projectGitIdentity, THREAD_IDENTITY } from "./git-identity.js";
18
19
  import { projectRowKnown } from "./store.js";
19
20
  import { readProjectRegistryNow } from "./repos.js";
20
21
  import { poolRootOf } from "./worktree.js";
@@ -440,12 +441,13 @@ export function flexibleThreadFence(store, input) {
440
441
  ...(unread === undefined ? {} : { pool: unread }) };
441
442
  return { ok: true, launch: { ...made, fenceGrants: grants }, paths, thread };
442
443
  }
443
- export function flexibleThreadEnv(paths, proxy, base = process.env) {
444
+ export function flexibleThreadEnv(paths, proxy, base = process.env, identity = THREAD_IDENTITY) {
444
445
  return {
445
446
  ...plainAgentEnv(base),
446
447
  HOME: real(homedir()), TMPDIR: paths.tmp, ...buildCacheEnv(paths.cache),
447
448
  GIT_TERMINAL_PROMPT: "0", GIT_CONFIG_NOSYSTEM: "1",
448
449
  ...proxy,
450
+ ...identityEnv(identity),
449
451
  };
450
452
  }
451
453
  function outerEnv(env, platform) {
@@ -552,7 +554,17 @@ async function spawnLocked(store, input, file, args, platform, seams) {
552
554
  const terms = termsProblem(launch);
553
555
  if (terms !== null)
554
556
  return refuse("containment", terms);
555
- const base = flexibleThreadEnv(paths, input.proxyEnv);
557
+ let project;
558
+ try {
559
+ project = realpathSync(fenced.thread.repo);
560
+ }
561
+ catch {
562
+ return refuse("repository-unusable");
563
+ }
564
+ const identity = await projectGitIdentity(project, THREAD_IDENTITY);
565
+ if (!identity.ok)
566
+ return refuse("repository-unusable", identity.why);
567
+ const base = flexibleThreadEnv(paths, input.proxyEnv, process.env, identity.identity);
556
568
  const env = { ...Object.fromEntries(Object.entries(input.agentEnv ?? {}).filter(([name]) => !(name in base))), ...base };
557
569
  const probed = await probeContainment(launch, paths, env, platform);
558
570
  if (probed !== null)
@@ -0,0 +1,65 @@
1
+ import { spawnSync } from "node:child_process";
2
+ import { existsSync } from "node:fs";
3
+ import { homedir } from "node:os";
4
+ import { isAbsolute, join } from "node:path";
5
+ import { run } from "./exec.js";
6
+ import { hardenedGit, refusal } from "./teardown-git.js";
7
+ import { unsafeInCommand } from "./local-landing.js";
8
+ export const THREAD_IDENTITY = Object.freeze({ name: "Toolroll thread", email: "thread@toolroll.local" });
9
+ export const DIRECT_CHAT_IDENTITY = Object.freeze({ name: "Toolroll Direct Chat", email: "direct-chat@toolroll.local" });
10
+ const plain = (value) => {
11
+ if (value === undefined || unsafeInCommand(value) || /[<>]/.test(value))
12
+ return null;
13
+ const trimmed = value.trim();
14
+ return trimmed !== "" && trimmed.length <= 200 ? trimmed : null;
15
+ };
16
+ export function identityValues(listing) {
17
+ let name, email;
18
+ for (const entry of listing.split("\0")) {
19
+ const newline = entry.indexOf("\n");
20
+ if (newline < 0)
21
+ continue;
22
+ const key = entry.slice(0, newline).toLowerCase();
23
+ if (key === "user.name")
24
+ name = entry.slice(newline + 1);
25
+ else if (key === "user.email")
26
+ email = entry.slice(newline + 1);
27
+ }
28
+ return { name: plain(name), email: plain(email) };
29
+ }
30
+ function globalValues(home, env) {
31
+ const xdg = env["XDG_CONFIG_HOME"];
32
+ const files = [join(xdg !== undefined && isAbsolute(xdg) ? xdg : join(home, ".config"), "git", "config"), join(home, ".gitconfig")];
33
+ const found = { name: null, email: null };
34
+ for (const file of files) {
35
+ if (!existsSync(file))
36
+ continue;
37
+ const ran = spawnSync("git", ["config", "--file", file, "--no-includes", "--list", "-z"], {
38
+ cwd: "/", encoding: "utf8", timeout: 5_000, killSignal: "SIGKILL", stdio: ["ignore", "pipe", "ignore"], maxBuffer: 1_048_576,
39
+ env: { PATH: process.env["PATH"] ?? "/usr/bin:/bin", HOME: "/nonexistent", GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: "/dev/null", LANG: "C" },
40
+ });
41
+ if (ran.status !== 0)
42
+ continue;
43
+ const values = identityValues(ran.stdout);
44
+ found.name = values.name ?? found.name;
45
+ found.email = values.email ?? found.email;
46
+ }
47
+ return found;
48
+ }
49
+ export function identityFrom(localListing, neutral, home = homedir(), env = process.env) {
50
+ const local = identityValues(localListing);
51
+ const global = local.name !== null && local.email !== null ? { name: null, email: null } : globalValues(home, env);
52
+ return { name: local.name ?? global.name ?? neutral.name, email: local.email ?? global.email ?? neutral.email };
53
+ }
54
+ export async function projectGitIdentity(repo, neutral, inner = run) {
55
+ const ran = await hardenedGit(inner, "read", { repo })("git", ["config", "--local", "--list", "-z"], { cwd: repo, timeoutMs: 60_000 });
56
+ const refused = refusal(ran);
57
+ if (refused !== null)
58
+ return { ok: false, why: refused };
59
+ if (ran.code !== 0)
60
+ return { ok: false, why: "its git config couldn't be read" };
61
+ return { ok: true, identity: identityFrom(ran.stdout, neutral) };
62
+ }
63
+ export function identityEnv(identity) {
64
+ return { GIT_AUTHOR_NAME: identity.name, GIT_AUTHOR_EMAIL: identity.email, GIT_COMMITTER_NAME: identity.name, GIT_COMMITTER_EMAIL: identity.email };
65
+ }
@@ -670,6 +670,15 @@ function handoffRows(store, repo, taskId) {
670
670
  export function handoffsOf(store, repo, taskId) {
671
671
  return handoffRows(store, repo, taskId).filter(one => one.settled);
672
672
  }
673
+ export function keptHandoffOf(store, repo, rootId, candidate) {
674
+ if (candidate === null || !OID.test(candidate))
675
+ return null;
676
+ const one = handoffsOf(store, repo, rootId).find(row => row.candidate === candidate);
677
+ if (one === undefined)
678
+ return null;
679
+ const command = handoffCommand(one.folder, one.commit);
680
+ return { commit: one.commit, branch: one.ref.replace(/^refs\/heads\//, ""), command, words: handoffWords({ command }, one.commit) };
681
+ }
673
682
  class Refused extends Error {
674
683
  result;
675
684
  constructor(result) {
package/dist/operate.js CHANGED
@@ -12827,7 +12827,9 @@ async function projectFlexibleCommand(positional, flags, context) {
12827
12827
  return refused("Only a person changes a project's thread terms, never the lead, a token or a chat app.");
12828
12828
  const acting = await askCredentials(flags, context);
12829
12829
  if (acting === null)
12830
- return refused(`${action === "enable" ? "Turning on interactive agent threads needs your password" : "This needs your sign-in"}: pass --as and --token.`);
12830
+ return refused(action === "enable"
12831
+ ? "Turning on interactive agent threads needs your Toolroll password: run it again with `--as <your name>` and type the password when asked (`--token` is that password, only for scripts: it stays in shell history). Or turn them on in the browser, on the project's page in Settings."
12832
+ : "This needs your sign-in: run it again with `--as <your name>` and type your Toolroll password when asked.");
12831
12833
  if (action === "enable") {
12832
12834
  if (!flexibleAvailable(store))
12833
12835
  return fail(write, json, command, "not-available", FLEXIBLE_UNAVAILABLE, EXIT.refused);
@@ -17,8 +17,16 @@ export function setPasswordless(store, on, by, now) {
17
17
  if (setting.on === on && (on || setting.at !== null))
18
18
  return { changed: false };
19
19
  store.recordAction({ at: now.toISOString(), actor: by, repo: null, taskId: null, runId: null, action: PASSWORDLESS_ACTION, outcome: on ? "on" : "off", source: "policy",
20
- detail: on ? "Passwordless on: approvals need no password" : "Passwordless off: step-ups ask for the password again" });
20
+ detail: on ? "Passwordless on: most browser approvals need no password" : "Passwordless off: step-ups ask for the password again" });
21
21
  store.bumpWake();
22
22
  return { changed: true };
23
23
  }
24
- export const PASSWORDLESS_TRADE = "Anyone holding a signed-in browser — an unlocked laptop, a phone, a stolen session — can then do everything you can without a second check. Signing in, session limits (12 hours idle, 7 days), signing out and ending sessions remain your protection. Creating or widening a way in (passwords, sign-in methods, API tokens, connected apps, people, workers, chat pairing, webhook secrets), or widening what a project's builds and checks reach (its network, where builds write, its home folder and its check access), still asks for your password.";
24
+ export const PASSWORDLESS_TRADE = "Anyone holding a signed-in browser — an unlocked laptop, a phone, a stolen session — can then do everything you can without a second check, except what still asks below. Signing in, session limits (12 hours idle, 7 days), signing out and ending sessions remain your protection.";
25
+ export const PASSWORDLESS_STILL_ASKS = Object.freeze([
26
+ "Signing in, and anything that adds or widens a way in: passwords, sign-in methods, API tokens, connected apps, people, workers, chat pairing and webhook secrets.",
27
+ "Widening what a project’s builds and checks reach: its network, where builds write, its home folder and its check commands.",
28
+ "Turning on interactive agent threads and saving the Claude sign-in they use.",
29
+ "Saving or shipping a Direct Chat’s work, and shipping a thread’s, except in Local mode on a laptop install, where this computer’s own browser and workbench don’t ask.",
30
+ "A toolroll command run in a shell without this computer’s remembered login.",
31
+ ]);
32
+ export const PASSWORDLESS_OTHERS = "Solo stands in the same way while you are the only person on this install. Local mode lets this computer’s browser file tasks, approve plans and add projects with no password at all. Without either, a password you just typed skips standard approvals on this computer for 15 minutes.";
@@ -604,8 +604,8 @@ export function testSkill(store, args, now = new Date()) {
604
604
  ? `Test ${skill.name}`
605
605
  : `Revise test: ${skill.name}`,
606
606
  repo: args.repo,
607
- goal: `Test skill ${skill.name} version ${skill.sha} with this sample request:\n${sample}${feedback ? `\nFeedback from test run #${args.sourceRun}:\n${feedback}` : ""}\nRead the supplied SKILL.md, perform the parts allowed in a read-only report task, and report the actual output, files read, and missing tools or permissions. Do not claim a successful test for steps you could not perform.`,
608
- outOfScope: "No repository changes, deployments, messages to other people, external writes, dependency installation or permission changes. Report any skill steps that require these actions.",
607
+ goal: `Test skill ${skill.name} version ${skill.sha} with this sample request:\n${sample}${feedback ? `\nFeedback from test run #${args.sourceRun}:\n${feedback}` : ""}\nRead the supplied SKILL.md, perform the parts a report task allows (reading the project; a report that changes a file fails, and nothing it wrote is kept), and report the actual output, files read, and missing tools or permissions. Do not claim a successful test for steps you could not perform.`,
608
+ outOfScope: "Nothing it changes in the project is kept (a report that changes a file fails). No deployments, messages to other people, external writes, dependency installation or permission changes. Report any skill steps that require these actions.",
609
609
  acceptance: [
610
610
  {
611
611
  id: "skill-result",
@@ -10,6 +10,7 @@ import { cancelDirectChatShip, executeDirectChatShip, listDirectChatShips, previ
10
10
  import { soloNow } from "../install-mode.js";
11
11
  import { backgroundInstalled } from "../laptop-background.js";
12
12
  import { localOwnerStandsNow } from "../local-owner.js";
13
+ import { gitCommand, UNSAFE_FOLDER } from "../local-landing.js";
13
14
  import { projectName, rowVisible } from "../project.js";
14
15
  import { handlersOf } from "./handler-registry.js";
15
16
  import { redirect, respond } from "./http.js";
@@ -597,12 +598,21 @@ export function createDirectChatHandlers(runtime, deps) {
597
598
  const changes = diff.changedFiles.length === 0 ? html `<p class="k-note">No changes in its copy of the project.</p>`
598
599
  : html `<p class="k-note">${diff.changedFiles.length} ${diff.changedFiles.length === 1 ? "file" : "files"} changed in its own copy of the project, as of its last turn${running ? " (it's still working)" : ""}.</p><ul>${diff.changedFiles.map(file => html `<li class="k-mono">${file}</li>`)}</ul>${shownDiff === "" ? "" : html `<details><summary>The changes</summary><pre class="k-mono" data-direct-chat-diff>${shownDiff}</pre></details>`}`;
599
600
  const ships = listDirectChatShips(store, thread.id);
600
- const shipped = ships.length === 0 ? "" : html `<ul>${ships.map(one => html `<li>${one.mode === "keep-branch" ? "Saved as branch" : "Shipped"} <span class="k-mono">${one.branch}</span> · ${one.state}${one.taskId === null ? "" : html ` · <a class="k-link" href="/t/${encodeURIComponent(one.taskId)}">Open task</a>`}</li>`)}</ul>`;
601
+ const bringIn = (one) => {
602
+ if (one.mode !== "keep-branch" || one.state !== "kept" || !/^[0-9a-f]{40}$/.test(one.candidateSha))
603
+ return "";
604
+ const command = gitCommand(one.repo, ["merge", "--ff-only", one.candidateSha]);
605
+ return command === null ? html `<br><span class="k-note">${UNSAFE_FOLDER(`git merge --ff-only ${one.candidateSha}`)}</span>`
606
+ : html `<br>To bring it in: <code class="k-mono" data-direct-chat-merge>${command}</code>`;
607
+ };
608
+ const shipped = ships.length === 0 ? "" : html `<ul>${ships.map(one => html `<li>${one.mode === "keep-branch" ? "Saved as branch" : "Shipped"} <span class="k-mono">${one.branch}</span> · ${one.state}${one.taskId === null ? "" : html ` · <a class="k-link" href="/t/${encodeURIComponent(one.taskId)}">Open task</a>`}${bringIn(one)}</li>`)}</ul>`;
609
+ const again = ctx.url.searchParams.get("review") === "again" && !running && diff.changedFiles.length > 0
610
+ ? html `<p class="k-note" data-direct-chat-review-again>That Ship review isn't kept after you leave it. Press Review Ship to see it again.</p>` : "";
601
611
  const shipAct = running || diff.changedFiles.length === 0 ? "" : postForm(`/direct-chats/${thread.id}/ship-review`, btn("Review Ship", { variant: "primary", type: "submit" }));
602
612
  const reply = thread.isLegacy ? html `<p class="k-note" data-direct-chat-read-only>Imported from an earlier version: read only. Start a new Direct Chat to go on.</p>`
603
613
  : running ? html `<p class="k-note">It's working on your last message. Reply when it finishes.</p>`
604
614
  : postForm(`/direct-chats/${thread.id}/reply`, html `${field({ id: "direct-chat-reply", label: "Reply", control: textarea({ id: "direct-chat-reply", name: "prompt", rows: 3, attrs: { required: true, maxlength: "20000" } }) })}${btn("Send", { variant: "primary", type: "submit" })}`, { hidden: { request: randomBytes(16).toString("hex") } });
605
- const body = html `<h1>${thread.title || "Direct Chat"}</h1><p class="k-note">${thread.project} · ${thread.provider}${thread.modelId ? ` · ${thread.modelId}` : ""}${running ? " · Working" : ""}</p>${turnHtml}${reply}<h2>Changes</h2>${changes}<h2>Ship</h2>${shipped}${shipAct === "" && ships.length === 0 ? html `<p class="k-note">${running ? "Ship opens when it finishes." : "Nothing to ship yet."}</p>` : shipAct}<p><a class="k-link" href="/direct-chats">All Direct Chats</a></p>`;
615
+ const body = html `<h1>${thread.title || "Direct Chat"}</h1><p class="k-note">${thread.project} · ${thread.provider}${thread.modelId ? ` · ${thread.modelId}` : ""}${running ? " · Working" : ""}</p>${turnHtml}${reply}<h2>Changes</h2>${changes}<h2>Ship</h2>${again}${shipped}${shipAct === "" && ships.length === 0 ? html `<p class="k-note">${running ? "Ship opens when it finishes." : "Nothing to ship yet."}</p>` : shipAct}<p><a class="k-link" href="/direct-chats">All Direct Chats</a></p>`;
606
616
  return runtime.sendScreen(ctx.response, 200, screen(thread.title || "Direct Chat", body, { chrome: runtime.chromeFor(thread.repo, "tasks") }));
607
617
  }
608
618
  async function pageReply(ctx) {
@@ -634,10 +644,24 @@ export function createDirectChatHandlers(runtime, deps) {
634
644
  return pageRefusal(ctx, res.status, res.error);
635
645
  const preview = res.preview;
636
646
  const local = gate.who.authority === "local-owner";
637
- const facts = html `<ul><li>${preview.mode === "keep-branch" ? "Saved as branch" : "Shipped from branch"} <span class="k-mono">${preview.branch}</span></li><li>${preview.changedFiles.length} ${preview.changedFiles.length === 1 ? "file" : "files"}: ${preview.changedFiles.slice(0, 20).join(", ")}${preview.changedFiles.length > 20 ? "…" : ""}</li><li>${preview.checkCommand === null ? "No check command" : html `Check: <span class="k-mono">${preview.checkCommand}</span>`}</li><li>${preview.mergeSummary}</li>${preview.autoMergeReason === null ? "" : html `<li>${preview.autoMergeReason}</li>`}</ul>`;
647
+ const facts = html `<ul><li>${preview.mode === "keep-branch" ? "Save the branch" : "Ship from branch"} <span class="k-mono">${preview.branch}</span></li><li>${preview.changedFiles.length} ${preview.changedFiles.length === 1 ? "file" : "files"}: ${preview.changedFiles.slice(0, 20).join(", ")}${preview.changedFiles.length > 20 ? "…" : ""}</li><li>${preview.checkCommand === null ? "No check command" : html `Check: <span class="k-mono">${preview.checkCommand}</span>`}</li><li>${preview.mergeSummary}</li>${preview.autoMergeReason === null ? "" : html `<li>${preview.autoMergeReason}</li>`}</ul>`;
638
648
  const form = postForm(`/direct-chats/${threadId}/ship`, html `${local ? "" : html `<label>Password<input type="password" name="password" autocomplete="current-password" required></label>`}${btn(preview.mode === "keep-branch" ? "Save the branch" : "Ship it", { variant: "primary", type: "submit" })} ${btn("Cancel", { variant: "ghost", href: `/direct-chats/${threadId}` })}`, { hidden: { mode: preview.mode, termsDigest: preview.termsDigest, title: preview.title, goal: preview.goal } });
639
649
  return runtime.sendScreen(ctx.response, 200, screen("Ship", html `<h1>Ship ${preview.title}</h1>${facts}${form}`, { chrome: runtime.chromeFor(thread.repo, "tasks") }));
640
650
  }
651
+ async function pageShipReviewAgain(ctx) {
652
+ const gate = admit(ctx, null);
653
+ if (!gate.ok)
654
+ return pageRefusal(ctx, gate.status, gate.error);
655
+ const threadId = PAGE_PATH.exec(ctx.url.pathname)?.[1] ?? "";
656
+ return redirect(ctx.response, `/direct-chats/${threadId}?review=again`);
657
+ }
658
+ async function pageShipDone(ctx) {
659
+ const gate = admit(ctx, null);
660
+ if (!gate.ok)
661
+ return pageRefusal(ctx, gate.status, gate.error);
662
+ const threadId = PAGE_PATH.exec(ctx.url.pathname)?.[1] ?? "";
663
+ return redirect(ctx.response, `/direct-chats/${threadId}`);
664
+ }
641
665
  async function pageShip(ctx) {
642
666
  const gate = admit(ctx, "direct-chat-ship");
643
667
  if (!gate.ok)
@@ -667,6 +691,8 @@ export function createDirectChatHandlers(runtime, deps) {
667
691
  "direct-chat.page": pageDetail,
668
692
  "direct-chat.page-ship-review": pageShipReview,
669
693
  "direct-chat.page-ship": pageShip,
694
+ "direct-chat.page-ship-review-again": pageShipReviewAgain,
695
+ "direct-chat.page-ship-done": pageShipDone,
670
696
  "direct-chat.page-reply": pageReply,
671
697
  "direct-chat.list": list,
672
698
  "direct-chat.detail": detail,
@@ -2345,6 +2345,11 @@ export function landingCardHtml(landing, csrf) {
2345
2345
  const act = csrf === "" ? "" : landing.canLand
2346
2346
  ? postForm(`${taskHref(landing.taskId)}/land`, btn("Land it", { type: "submit" }))
2347
2347
  : landing.canUndo ? postForm(`${taskHref(landing.taskId)}/land`, btn("Undo landing", { variant: "ghost", type: "submit" }), { hidden: { undo: "1" } }) : "";
2348
+ const kept = landing.landed === null ? landing.kept ?? null : null;
2349
+ if (kept !== null) {
2350
+ const how = kept.command === null ? html `<p>${kept.words}</p>` : html `<p>To bring it in: <code class="k-mono" data-land-command>${kept.command}</code></p>`;
2351
+ return html `<section class="card" id="land" data-landing="kept"><strong>Landing commit ${kept.commit.slice(0, 7)} is ready</strong><p class="meta">Your project folder has ${kept.branch} checked out, so Toolroll didn't touch it.</p>${how}</section>`;
2352
+ }
2348
2353
  const title = landing.landed !== null && !landing.canLand ? landing.landed : "Not on your branch yet";
2349
2354
  const meta = landing.canLand ? "You see where it lands before anything moves." : "";
2350
2355
  return html `<section class="card" id="land" data-landing="${landing.landed === null ? "no" : "yes"}"><strong>${title}</strong>${meta === "" ? "" : html `<p class="meta">${meta}</p>`}${act}</section>`;
@@ -282,6 +282,8 @@ get("tasks", "direct-chat.list", "/engine/direct-chats", DIRECT_CHAT);
282
282
  get("tasks", "direct-chat.detail", `^\\/engine\\/direct-chats\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}` });
283
283
  get("tasks", "direct-chat.page-list", "/direct-chats", DIRECT_CHAT);
284
284
  get("tasks", "direct-chat.page", `^\\/direct-chats\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}` });
285
+ get("tasks", "direct-chat.page-ship-review-again", `^\\/direct-chats\\/${TERMINAL}\\/ship-review$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}/ship-review` });
286
+ get("tasks", "direct-chat.page-ship-done", `^\\/direct-chats\\/${TERMINAL}\\/ship$`, { ...DIRECT_CHAT, sample: `/direct-chats/${"a".repeat(32)}/ship` });
285
287
  get("tasks", "direct-chat.artifact", `^\\/engine\\/direct-chats\\/${TERMINAL}\\/artifacts\\/${TERMINAL}$`, { ...DIRECT_CHAT, sample: `/engine/direct-chats/${"a".repeat(32)}/artifacts/${"b".repeat(32)}` });
286
288
  get("pages", "projects.browse", "/projects/browse", free);
287
289
  get("pages", "projects.pick", "/projects/pick", { ...free, callers: ["cookie"], project: "none", ...approver("Sign in as an approver to add projects.", "/projects") });
@@ -353,6 +355,7 @@ get("tasks", "task.diff", `^\\/t\\/${TASK}\\/diff$`, { project: "task", limited:
353
355
  get("tasks", "task.result", `^\\/t\\/${TASK}\\/result$`, { project: "task", limited: "resource", ...free, sample: "/t/one/result" });
354
356
  get("tasks", "task.approval", `^\\/t\\/${TASK}\\/approval$`, { project: "task", limited: "resource", callers: ["cookie"], ...free, sample: "/t/one/approval" });
355
357
  get("tasks", "task.release", `^\\/t\\/${TASK}\\/release$`, { project: "task", limited: "resource", ...free, sample: "/t/one/release" });
358
+ get("tasks", "task.land-again", `^\\/t\\/${TASK}\\/land$`, { project: "task", limited: "resource", ...free, sample: "/t/one/land" });
356
359
  get("tasks", "release.locate", `^\\/approve\\/${ID}$`, { project: "task-ref", limited: "resource", ...free, sample: "/approve/1" });
357
360
  get("pages", "ledger.export", "/ledger/export", { limited: "unscoped", ...free });
358
361
  get("tasks", "runs", "/runs", { limited: "collection", ...free });
@@ -170,7 +170,7 @@ function yourPasswordSection(deps) {
170
170
  ? [formRow("Forgot it?", "On the computer running Toolroll, run this to choose a new one:", html ``, "wide"), codeLine("toolroll password reset")]
171
171
  : [formRow("Where it is", "Your first password is saved on the computer running Toolroll. Toolroll never shows it in a browser. To read it, run this there:", html ``, "wide"), codeLine(`cat ${saved}`)];
172
172
  })(),
173
- summary.passwordless === null ? "" : formRow("Passwordless", "Sign in once; most approvals then need no password.", btn(`${summary.passwordless ? "On" : "Off"} · Change`, { sm: true, href: "/settings/passwordless" }), "inline"),
173
+ summary.passwordless === null ? "" : formRow("Passwordless", "Sign in once; most approvals then need no password. Settings → Passwordless lists what still asks.", btn(`${summary.passwordless ? "On" : "Off"} · Change`, { sm: true, href: "/settings/passwordless" }), "inline"),
174
174
  ]),
175
175
  }),
176
176
  };
@@ -1,4 +1,4 @@
1
- import { PASSWORDLESS_TRADE, passwordlessSetting, setPasswordless } from "../passwordless.js";
1
+ import { PASSWORDLESS_OTHERS, PASSWORDLESS_STILL_ASKS, PASSWORDLESS_TRADE, passwordlessSetting, setPasswordless } from "../passwordless.js";
2
2
  import { approveNetworkRequest } from "../agent-network-request.js";
3
3
  import { declareJustMe, installModeNow, sessionStandsIn, soloNow, TEAM_FACT_WORDS } from "../install-mode.js";
4
4
  import { ACP_AGENTS, isKeyedProvider } from "../acp-agents.js";
@@ -121,9 +121,9 @@ import { deleteProject, holdingsWords, PROJECT_RECOVERY_DELETE_MESSAGE } from ".
121
121
  import { applySavedKnowledge, changeKnowledge, knowledgeVersion, knowledgeView } from "../project-knowledge.js";
122
122
  import { changeLearning } from "../project-learning.js";
123
123
  import { listDecisions, recordDecision, retireDecision, searchMemory } from "../project-memory.js";
124
- import { changeSkills, githubSkill, importSkill, reviseSkillTest, skillsView, testSkill } from "../project-skills.js";
124
+ import { changeSkills, effectiveSkillsForRepo, githubSkill, importSkill, reviseSkillTest, skillsView, testSkill } from "../project-skills.js";
125
125
  import { changeLibrarySkill, currentLibrary, dismissHeldBundleUpdate, enabledLibrarySkills, importGithubSkillBundle, importLibrarySkill, rollbackSkillBundle, setBundleAutoUpdate, setProjectSkillOptOut, skillLibraryView, sweepSkillBundleUpdates } from "../skill-library.js";
126
- import { LOCAL_SKILL_TOOLS, setLocalSkillSync, syncEnabledLocalTools } from "../skill-local-sync.js";
126
+ import { LOCAL_SKILL_TOOLS, LOCAL_TOOL_LABELS, setLocalSkillSync, syncEnabledLocalTools } from "../skill-local-sync.js";
127
127
  import { skillLibrarySectionHtml } from "../skills-ui.js";
128
128
  import { signedIn } from "../oauth-run-token.js";
129
129
  import { addToolTo, catalogTool, localAppOf, removeToolFrom, setToolSecret, splitCommandLine, testToolOf, toolSecretStorage } from "../project-tools.js";
@@ -317,32 +317,7 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
317
317
  const chosen = url.searchParams.get("repo") ?? project ?? projects[0] ?? "";
318
318
  if (chosen && !projects.includes(chosen))
319
319
  return refuse(response, who, 403, "That project is outside your access.", "/projects");
320
- const selector = projectPicker("/settings/skills", projects.map(repo => ({ repo, name: projectName(repo) })), chosen);
321
- const canManage = who.role === "approver";
322
- const csrf = who.via === "cookie" ? who.session.csrf : "";
323
- let globalContent = html ``;
324
- try {
325
- const libView = skillLibraryView(store, { repo: chosen || null });
326
- globalContent = skillLibrarySectionHtml(libView, libView.localSync, csrf, canManage, {
327
- repo: chosen,
328
- said: url.searchParams.get("said"),
329
- error: url.searchParams.get("problem"),
330
- });
331
- }
332
- catch (error) {
333
- globalContent = html `<p class="problem" role="alert">${error instanceof Error ? error.message : "Global skill library is unavailable."}</p>`;
334
- }
335
- let content = html `<p>Add a project to manage project-specific skills.</p>`;
336
- if (chosen) {
337
- try {
338
- const agent = resolvePhaseAgent(store, 'build', chosen, {});
339
- content = (skillsHtml(skillsView(store, chosen, who.name), csrf, canManage, { focus: url.searchParams.get('skill') ?? '', agent: agent.ok ? `Report agent: ${agent.spec.provider} · ${agent.spec.model ?? 'default'}. Change it on the test task before approval` : 'Choose a report agent on the test task before approval' }));
340
- }
341
- catch (error) {
342
- content = html `<p class="problem" role="alert">${error instanceof Error ? error.message : 'Skills are unavailable. Reload to retry.'}</p>`;
343
- }
344
- }
345
- return sendScreen(response, 200, screen('Skills', settingsSubPage("agents", "Skills", html `${url.searchParams.get('saved') === '1' ? html `<p role="status">Saved.</p>` : ''}${globalContent}${selector}${content}`), { chrome: chromeFor(chosen || project, 'settings'), functional: { script: skillsScript() } }));
320
+ return skillsScreen(ctx, chosen, { said: url.searchParams.get("said"), problem: url.searchParams.get("problem") }, 200);
346
321
  }
347
322
  async function toolsPage(ctx) {
348
323
  const { url, who, response, project } = ctx;
@@ -573,7 +548,7 @@ ${connectionHtml(asked, connection, task)}${command === null ? "" : html `<p>On
573
548
  const setting = passwordlessSetting(store);
574
549
  const said = url.searchParams.get("said"), problem = url.searchParams.get("problem");
575
550
  const since = setting.at === null ? null : `${setting.on ? "on" : "off"} since ${new Date(setting.at).toLocaleString("en-US", { dateStyle: "medium", timeStyle: "short" })}, by ${setting.setBy ?? "someone"}`;
576
- return sendScreen(response, 200, screen("Passwordless", passwordlessHtml({ on: sessionStandsIn(store), since, trade: PASSWORDLESS_TRADE, said, problem }), { chrome: chromeFor(project, "settings") }));
551
+ return sendScreen(response, 200, screen("Passwordless", passwordlessHtml({ on: sessionStandsIn(store), since, trade: PASSWORDLESS_TRADE, stillAsks: PASSWORDLESS_STILL_ASKS, others: PASSWORDLESS_OTHERS, said, problem }), { chrome: chromeFor(project, "settings") }));
577
552
  }
578
553
  async function passwordlessSave(ctx) {
579
554
  const { response, now, posted } = ctx;
@@ -3589,8 +3564,8 @@ ${postForm("/settings/chat-approval/save", html `\
3589
3564
  const lib = enabledLibrarySkills(store);
3590
3565
  const res = setLocalSkillSync(store, { tool: tool, enabled, actor: who.name, skills: lib.packages, libraryRevision: lib.revision }, now);
3591
3566
  said = enabled && res
3592
- ? `Synced ${res.written.length} skill${res.written.length === 1 ? "" : "s"} to ${tool}${res.skippedForeign.length ? ` (left ${res.skippedForeign.length} of your own skills untouched)` : ""}.`
3593
- : `Turned off local sync for ${tool} and removed Toolroll-managed skills.`;
3567
+ ? `Synced ${res.written.length} skill${res.written.length === 1 ? "" : "s"} to ${LOCAL_TOOL_LABELS[tool]}${res.skippedForeign.length ? ` (left ${res.skippedForeign.length} of your own skills untouched)` : ""}.`
3568
+ : `Turned off local sync for ${LOCAL_TOOL_LABELS[tool]} and removed Toolroll-managed skills.`;
3594
3569
  }
3595
3570
  else if (action === "local-sync-now") {
3596
3571
  const lib = enabledLibrarySkills(store);
@@ -3603,8 +3578,55 @@ ${postForm("/settings/chat-approval/save", html `\
3603
3578
  return backWith("said", said);
3604
3579
  }
3605
3580
  catch (error) {
3606
- return backWith("problem", error instanceof Error ? error.message : "Could not update the skill library.");
3581
+ const why = error instanceof Error ? error.message : "Could not update the skill library.";
3582
+ if (action === "import-bundle")
3583
+ return skillsScreen(ctx, repo, { problem: `${why.replace(/\.?$/, ".")} Nothing was imported.`, bundleUrl: (body.get("url") ?? "").slice(0, 2000) }, 409);
3584
+ return backWith("problem", why);
3585
+ }
3586
+ }
3587
+ function skillsScreen(ctx, chosen, extra, status) {
3588
+ const { url, who, response, project } = ctx;
3589
+ const projects = consoleProjects();
3590
+ const selector = projectPicker("/settings/skills", projects.map(repo => ({ repo, name: projectName(repo) })), chosen, { evenOne: true });
3591
+ const canManage = who.role === "approver";
3592
+ const csrf = who.via === "cookie" ? who.session.csrf : "";
3593
+ let view = null, viewProblem = null;
3594
+ if (chosen) {
3595
+ try {
3596
+ view = skillsView(store, chosen, who.name);
3597
+ }
3598
+ catch (error) {
3599
+ viewProblem = error instanceof Error ? error.message : "Skills are unavailable. Reload to retry.";
3600
+ }
3601
+ }
3602
+ let globalContent = html ``;
3603
+ try {
3604
+ const libView = skillLibraryView(store, { repo: chosen || null });
3605
+ globalContent = skillLibrarySectionHtml(libView, libView.localSync, csrf, canManage, {
3606
+ repo: chosen,
3607
+ said: extra.said ?? null,
3608
+ error: extra.problem ?? null,
3609
+ ...(view === null ? {} : { projectSelection: view.selection }),
3610
+ ...(extra.bundleUrl === undefined ? {} : { bundleUrl: extra.bundleUrl }),
3611
+ });
3612
+ }
3613
+ catch (error) {
3614
+ globalContent = html `<p class="problem" role="alert">${error instanceof Error ? error.message : "Global skill library is unavailable."}</p>`;
3615
+ }
3616
+ let content = html `<p>Add a project to manage project-specific skills.</p>`;
3617
+ if (viewProblem !== null)
3618
+ content = html `<p class="problem" role="alert">${viewProblem}</p>`;
3619
+ else if (view !== null) {
3620
+ try {
3621
+ const agent = resolvePhaseAgent(store, 'build', chosen, {});
3622
+ content = (skillsHtml(view, csrf, canManage, { focus: url.searchParams.get('skill') ?? '', effective: effectiveSkillsForRepo(store, chosen).packages, agent: agent.ok ? `Report agent: ${agent.spec.provider} · ${agent.spec.model ?? 'default'}. Change it on the test task before approval` : 'Choose a report agent on the test task before approval' }));
3623
+ }
3624
+ catch (error) {
3625
+ content = html `<p class="problem" role="alert">${error instanceof Error ? error.message : 'Skills are unavailable. Reload to retry.'}</p>`;
3626
+ }
3607
3627
  }
3628
+ const title = chosen ? `Skills for ${projectName(chosen)}` : "Skills";
3629
+ return sendScreen(response, status, screen('Skills', settingsSubPage("agents", title, html `${url.searchParams.get('saved') === '1' ? html `<p role="status">Saved.</p>` : ''}${selector}${globalContent}${content}`), { chrome: chromeFor(chosen || project, 'settings'), functional: { script: skillsScript() } }));
3608
3630
  }
3609
3631
  return { registrations, modelsView };
3610
3632
  }
@@ -1,5 +1,5 @@
1
1
  import { localOwnerRefusal } from "../local-owner.js";
2
- import { broughtInOnBranch, landedStanding, landingOf, publishesThroughPullRequests, recognisedOnBranch } from "../local-landing.js";
2
+ import { broughtInOnBranch, keptHandoffOf, landedStanding, landingOf, publishesThroughPullRequests, recognisedOnBranch } from "../local-landing.js";
3
3
  import { requestContext } from "./request-context.js";
4
4
  import { heldFindingCount } from "../findings.js";
5
5
  import { familyInWebReach } from "../findings.js";
@@ -622,7 +622,9 @@ export function createTaskViews(runtime) {
622
622
  if (onBranch !== null)
623
623
  return { taskId: rootId, landed: onBranch.words, canLand: false, canUndo: person && !onBranch.reverted && broughtInOnBranch(runtime.store, repo, rootId, baseGit) };
624
624
  const standing = landedStanding(runtime.store, rootId, baseGit);
625
- return { taskId: rootId, landed: standing?.words ?? null, canLand: person && complete && (record === null || record.undone), canUndo: person && record !== null && !record.undone && standing?.reverted !== true };
625
+ const kept = complete && (record === null || record.undone) ? keptHandoffOf(runtime.store, repo, rootId, assignment?.receipt?.head ?? null) : null;
626
+ return { taskId: rootId, landed: standing?.words ?? null, canLand: person && complete && (record === null || record.undone), canUndo: person && record !== null && !record.undone && standing?.reverted !== true,
627
+ ...(kept === null ? {} : { kept }) };
626
628
  }
627
629
  function failureOf(runs, assignment, readLog = true) {
628
630
  const last = latestFinishedAttempt(runs);
@@ -2662,6 +2662,7 @@ export function createTasksHandlers(runtime) {
2662
2662
  "task.act.complete": taskAct("complete"),
2663
2663
  "task.act.merge": taskMerge,
2664
2664
  "task.act.land": taskLand,
2665
+ "task.land-again": taskLandAgain,
2665
2666
  "task.act.recheck-stopped": taskRecheckStopped,
2666
2667
  "task.act.stop": taskAct("stop"),
2667
2668
  "task.act.stop-carrying": taskAct("stop-carrying"),
@@ -2844,12 +2845,22 @@ export function createTasksHandlers(runtime) {
2844
2845
  return taskScreen(response, who, shown, done.message, done.reason === "authority" ? 403 : 409);
2845
2846
  if (done.handoff !== null) {
2846
2847
  const words = `Landing commit ${done.commit.slice(0, 7)} is ready. Your project folder has ${done.branch} checked out, so Toolroll didn't touch it. ${handoffWords(done.handoff, done.commit)}`;
2847
- return answersInPlace(ctx.request) ? answerActInPlace(response, "done", words, 200, done.handoff.command) : taskScreen(response, who, shown, words, 200);
2848
+ return answersInPlace(ctx.request) ? answerActInPlace(response, "done", words, 200, done.handoff.command) : redirect(response, `${taskHref(shown)}#land`);
2848
2849
  }
2849
2850
  if (answersInPlace(ctx.request))
2850
2851
  return answerActInPlace(response, "done", `${done.kind === "undo" ? "Undone" : "Landed"} on ${done.branch} (${done.commit.slice(0, 7)}).`, 200);
2851
2852
  return redirect(response, taskHref(shown));
2852
2853
  }
2854
+ async function taskLandAgain(ctx) {
2855
+ const { url, who, response } = ctx;
2856
+ const act = matchTaskPath(url.pathname, "/land$");
2857
+ if (act === null)
2858
+ return noPage(who, response);
2859
+ const ref = store.lookupRef(act.taskId);
2860
+ if (ref === null || !visible(ref.repo))
2861
+ return refuse(response, who, 404, "no such task", "/");
2862
+ return redirect(response, `${taskHref(store.taskFamilyOf(act.taskId, null, true)?.current.id ?? act.taskId)}#land`);
2863
+ }
2853
2864
  return { registrations, workListFor, showOrder, runListPane, peekFragment, taskMutation, queueRegionFor, ciFailingFor, completedRowFor, attemptRowFor, resultRowOf, reviewCockpitViewOf, decisionEvidence, runEvidence, sendArtifact, peekGuards, liveRunIds };
2854
2865
  }
2855
2866
  export function createTidyHandlers(runtime) {
@@ -136,7 +136,7 @@ export function agentsGroup(facts, flags) {
136
136
  settingsLink({ href: "/settings/lead", title: "Chat", status: "The assistant you chat with" }),
137
137
  ...(advancedOn(facts) ? [settingsLink({ href: "/settings/lead/subagents", title: "Subagents", status: "Helpers the lead looks after" })] : []),
138
138
  settingsLink({ href: "/settings/tools", title: "Tools", status: "What builds can use, per project" }),
139
- ...(advancedOn(facts) ? [settingsLink({ href: "/settings/skills", title: "Skills", status: "Reusable instructions for agents" })] : []),
139
+ settingsLink({ href: "/settings/skills", title: "Skills", status: "Reusable instructions for agents" }),
140
140
  settingsLink({ href: "/settings/knowledge", title: "Knowledge", status: "What agents know about each project" }),
141
141
  ...(advancedOn(facts) ? [settingsLink({ href: "/settings/learning", title: "Learning", status: "Lessons kept from finished work" })] : []),
142
142
  ]);
@@ -365,7 +365,7 @@ export function accessGroup(facts, flags) {
365
365
  settingsLink({ href: "/settings/sign-in", title: "Sign-in with a provider", status: facts.sso === null ? "Not set up: everyone uses a password" : `People sign in with ${facts.sso}` })
366
366
  ] : []),
367
367
  ...(facts.operator && (advancedOn(facts) || facts.passwordless === true) ? [
368
- settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: approvals need no password" : "Off: approvals ask for your password" })
368
+ settingsLink({ href: "/settings/passwordless", title: "Passwordless", status: facts.passwordless ? "On: most approvals need no password" : "Off: approvals ask for your password" })
369
369
  ] : []),
370
370
  ...(facts.local?.canTurnOff === true ? [html `<div id="local-mode">${settingsLink({ href: "/settings/general?section=local-mode", title: "Local mode", status: "On · in General" })}</div>`] : []),
371
371
  ];
@@ -541,12 +541,12 @@ export function passwordlessHtml(view) {
541
541
  return settingsSubPage("access", "Passwordless", joinHtml([
542
542
  answer,
543
543
  settingsSection({ id: "passwordless", title: `Passwordless is ${view.on ? "on" : "off"}`, state: view.since === null ? "" : ` · ${view.since}`,
544
- lead: "When it’s on, approvals, settings, budgets, signing a mode and starting a terminal no longer ask for your password again, in the browser, on the phone, and in this computer’s toolroll command (through its remembered login). Changes that add a way in still ask: sign-in, tokens, connections, agent threads and check commands.",
545
- body: joinHtml([note(view.trade), control]) }),
544
+ lead: "When it’s on, approvals, settings, budgets, signing a mode and starting a terminal no longer ask for your password again, in the browser, on the phone, and in this computer’s toolroll command (through its remembered login).",
545
+ body: joinHtml([html `<p><strong>Still asks for your password</strong></p><ul data-passwordless-still-asks>${view.stillAsks.map(one => html `<li>${one}</li>`)}</ul>`, note(view.trade), note(view.others), control]) }),
546
546
  ]), { lead: "Sign in once; most approvals then need no password." });
547
547
  }
548
- export function projectPicker(action, projects, chosen) {
549
- if (projects.length < 2)
548
+ export function projectPicker(action, projects, chosen, options = {}) {
549
+ if (projects.length < (options.evenOne === true ? 1 : 2))
550
550
  return html ``;
551
551
  return html `<form method="get" action="${action}" class="k-acts k-picker">${select({ name: "repo", label: "Project", current: chosen, items: projects.map(one => [one.repo, one.name]) })}${btn("Show", { sm: true, type: "submit" })}</form>`;
552
552
  }
@@ -310,12 +310,29 @@ export function parseGithubBundleUrl(rawUrl) {
310
310
  : `https://github.com/${owner}/${repoName}`;
311
311
  return { id, repoUrl, owner: owner, repoName: repoName, ref: ref ?? null, subpath };
312
312
  }
313
+ function unreachableWhy(error) {
314
+ const cause = error?.cause;
315
+ const code = typeof cause?.code === "string" ? cause.code : "";
316
+ if (error?.name === "TimeoutError")
317
+ return "it didn't answer within 20 seconds";
318
+ if (code === "ENOTFOUND" || code === "EAI_AGAIN")
319
+ return "its address couldn't be looked up (this computer may be offline)";
320
+ if (code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPERM" || code === "EACCES")
321
+ return "the connection was refused or blocked";
322
+ return "the connection failed (this computer may be offline, or a firewall blocks it)";
323
+ }
313
324
  async function githubJson(owner, repoName, path, fetcher, budget) {
314
- const response = await fetcher(`https://api.github.com/repos/${owner}/${repoName}${path}`, {
315
- redirect: "error",
316
- signal: AbortSignal.timeout(20_000),
317
- headers: { Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28" },
318
- });
325
+ let response;
326
+ try {
327
+ response = await fetcher(`https://api.github.com/repos/${owner}/${repoName}${path}`, {
328
+ redirect: "error",
329
+ signal: AbortSignal.timeout(20_000),
330
+ headers: { Accept: "application/vnd.github+json", "X-GitHub-Api-Version": "2022-11-28" },
331
+ });
332
+ }
333
+ catch (error) {
334
+ throw Error(`Couldn't reach GitHub: ${unreachableWhy(error)}.`);
335
+ }
319
336
  if (!response.ok) {
320
337
  throw Error(`GitHub returned ${response.status} for ${owner}/${repoName}${path.split("?")[0]}.`);
321
338
  }
package/dist/skills-ui.js CHANGED
@@ -23,7 +23,8 @@ export function skillsHtml(view, csrf, canManage, options = {}) {
23
23
  revision: view.revision,
24
24
  };
25
25
  const form = (action, contents, extra = {}) => postForm("/settings/skills/change", contents, { hidden: fields({ ...base, action, ...extra }) });
26
- const active = Object.values(view.selection).filter((c) => c.enabled).length;
26
+ const active = options.effective?.length ?? Object.values(view.selection).filter((c) => c.enabled).length;
27
+ const reaches = new Set((options.effective ?? []).map((one) => one.sha));
27
28
  const renderSkill = (skill) => {
28
29
  const enabled = view.selection[skill.name]?.sha === skill.sha &&
29
30
  view.selection[skill.name]?.enabled === true;
@@ -34,13 +35,15 @@ export function skillsHtml(view, csrf, canManage, options = {}) {
34
35
  acts(btn(enabled ? "Disable skill" : "Enable skill", { sm: true, type: "submit" })),
35
36
  ]), { sha: skill.sha }) : "";
36
37
  const testing = manage ? disclose("Test skill", form("test", joinHtml([
37
- note(`${options.agent ?? "Uses this project’s configured report agent"}. Runs a read-only sample through the normal task and approval flow.`),
38
+ note(`${options.agent ?? "Uses this project’s configured report agent"}. Runs the sample as a report task through the normal approval: it reads the project, and a report that changes a file fails with nothing kept.`),
38
39
  formRow("Sample request", "The report shows what worked and what needs tools or permission. Enabled status alone does not prove use.", textarea({ id: `skill-sample-${skill.sha.slice(0, 12)}`, name: "sample", rows: 3, value: options.draft?.["sha"] === skill.sha ? (options.draft?.["sample"] ?? "") : "",
39
40
  attrs: { required: true, maxlength: 800, placeholder: "Review this project’s home page and suggest three clearer button labels.", "aria-label": "Sample request" } }), "top"),
40
41
  acts(btn("Create test", { sm: true, type: "submit" })),
41
42
  ]), { sha: skill.sha, nonce: randomUUID() }), options.draft?.["sha"] === skill.sha) : "";
42
43
  return settingsRecord({
43
- title: html `<span>${skill.name}</span>${chip(enabled ? "Enabled" : "In library", enabled ? "done" : "")}`,
44
+ title: html `<span>${skill.name}</span>${enabled ? chip("Enabled here", "done")
45
+ : view.selection[skill.name]?.enabled === false ? chip("Off in this project", "")
46
+ : reaches.has(skill.sha) ? chip("Active from the global library", "done") : chip("In library", "")}`,
44
47
  sub: skill.description,
45
48
  attrs: { id: `skill-${skill.sha}` },
46
49
  more: joinHtml([
@@ -89,7 +92,7 @@ export function skillsHtml(view, csrf, canManage, options = {}) {
89
92
  : "";
90
93
  const library = settingsSection({
91
94
  id: "library", title: "Library",
92
- lead: `${active ? `${active} skill${active === 1 ? "" : "s"} enabled for new tasks.` : "No skills enabled for this project."} Active tasks keep their saved versions.`,
95
+ lead: `${active ? `${active} skill${active === 1 ? "" : "s"} reach${active === 1 ? "es" : ""} new tasks in this project.` : "No skills reach new tasks in this project."} Active tasks keep their saved versions.`,
93
96
  body: joinHtml([add, search, cards.length ? joinHtml(cards) : note("Your library is empty. Add a skill to review and enable it here."), history]),
94
97
  });
95
98
  return joinHtml([options.error ? notice(options.error) : "", library]);
@@ -108,16 +111,17 @@ export function skillTestFeedbackHtml(test, csrf, canManage, error = "", draft =
108
111
  export function skillLibrarySectionHtml(library, localTools, csrf, canManage, options = {}) {
109
112
  const manage = canManage && !!csrf;
110
113
  const repo = options.repo ?? "";
114
+ const bundleUrl = options.bundleUrl ?? "";
111
115
  const libForm = (action, contents, extra = {}) => postForm("/settings/skills/library", contents, { hidden: fields({ action, repo, revision: library.revision, ...extra }) });
112
116
  const enabledCount = Object.values(library.selection).filter((c) => c.enabled).length;
113
117
  const projectOptedOutAll = library.projectOptOut?.all === true;
114
118
  const projectOptOutNames = new Set(library.projectOptOut?.names ?? []);
115
119
  const importBundleForm = manage
116
120
  ? disclose("Import a GitHub skill bundle", libForm("import-bundle", joinHtml([
117
- formRow("GitHub repository URL", "Imports every SKILL.md found in the repository, pinned to its exact commit SHA.", input({ id: "bundle-url", name: "url", type: "url", attrs: { required: true, placeholder: "https://github.com/owner/repo", "aria-label": "GitHub repository URL" } }), "wide"),
121
+ formRow("GitHub repository URL", "Imports every SKILL.md found in the repository, pinned to its exact commit SHA.", input({ id: "bundle-url", name: "url", type: "url", value: bundleUrl, attrs: { required: true, placeholder: "https://github.com/owner/repo", "aria-label": "GitHub repository URL" } }), "wide"),
118
122
  html `<label class="k-note"><input type="checkbox" name="autoUpdate" value="1" checked> Check daily and apply clean updates automatically (suspicious changes are held for review)</label>`,
119
123
  acts(btn("Import bundle", { variant: "primary", type: "submit" })),
120
- ])), library.bundles.length === 0 && library.skills.length === 0)
124
+ ])), bundleUrl !== "" || (library.bundles.length === 0 && library.skills.length === 0))
121
125
  : "";
122
126
  const addGlobalSkillForm = manage
123
127
  ? disclose("Add a single skill to all projects", libForm("import-skill", joinHtml([
@@ -156,11 +160,19 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
156
160
  const enabled = library.selection[skill.name]?.sha === skill.sha && library.selection[skill.name]?.enabled === true;
157
161
  const optedOutThis = projectOptOutNames.has(skill.name);
158
162
  const optOut = optedOutThis || projectOptedOutAll;
159
- const statusChip = !enabled
160
- ? chip("Disabled", "")
161
- : optOut
162
- ? chip("Opted out here", "")
163
- : chip("Active", "done");
163
+ const own = repo ? options.projectSelection?.[skill.name] : undefined;
164
+ const statusChip = own?.enabled === false
165
+ ? chip("Off in this project", "")
166
+ : own !== undefined && own.sha !== skill.sha
167
+ ? chip("This project uses another version", "")
168
+ : own !== undefined
169
+ ? chip("Active: this project enables it", "done")
170
+ : !enabled
171
+ ? chip("Disabled", "")
172
+ : optOut
173
+ ? chip("Opted out here", "")
174
+ : chip("Active", "done");
175
+ const globalWords = own === undefined ? "" : note(`Global library: ${enabled ? "enabled" : "disabled"}${optOut ? ", and this project opted out of it" : ""}. This project’s own choice decides here.`);
164
176
  const controls = manage
165
177
  ? html `<div class="skill-controls">
166
178
  ${libForm(enabled ? "disable-skill" : "enable-skill", btn(enabled ? "Disable globally" : "Enable globally", { sm: true, type: "submit" }), { sha: skill.sha })}
@@ -171,6 +183,7 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
171
183
  title: html `<span>${skill.name}</span>${statusChip}`,
172
184
  sub: skill.description,
173
185
  more: joinHtml([
186
+ globalWords,
174
187
  disclose("Review skill", joinHtml([sourceKit(skill), controls])),
175
188
  ]),
176
189
  })}</div>`;
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolroll",
3
- "version": "0.9.123",
3
+ "version": "0.9.125",
4
4
  "description": "Your agents build. You decide. A control plane for coding agents — Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
5
5
  "directories": {
6
6
  "doc": "docs"