toolroll 0.9.120 → 0.9.123

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +10 -23
  3. package/dist/agent-fence.js +57 -9
  4. package/dist/batch-checks.js +2 -2
  5. package/dist/builder.js +10 -7
  6. package/dist/central-recovery-stage.js +3 -3
  7. package/dist/codex-limits.js +2 -2
  8. package/dist/coding-provider.js +3 -3
  9. package/dist/contracts/console-api.js +1 -0
  10. package/dist/direct-chat-fence.js +9 -3
  11. package/dist/direct-chat.js +82 -10
  12. package/dist/first-run.js +1 -1
  13. package/dist/flexible-agents.js +16 -2
  14. package/dist/flexible-save.js +8 -8
  15. package/dist/flexible-session.js +2 -1
  16. package/dist/flexible-thread.js +5 -1
  17. package/dist/install-method.js +1 -3
  18. package/dist/invoke.js +11 -9
  19. package/dist/lead-tools.js +3 -2
  20. package/dist/live-terminal.js +24 -3
  21. package/dist/local-landing.js +48 -8
  22. package/dist/local-owner.js +1 -0
  23. package/dist/operate.js +40 -10
  24. package/dist/plan-limits-demand.js +32 -10
  25. package/dist/planner.js +2 -0
  26. package/dist/project-delete.js +1 -1
  27. package/dist/project-skills.js +105 -17
  28. package/dist/result-follow-ups.js +2 -2
  29. package/dist/scout.js +2 -1
  30. package/dist/serve.js +8 -1
  31. package/dist/server/direct-chat.js +1 -0
  32. package/dist/server/engine-api.js +6 -5
  33. package/dist/server/render-release.js +27 -15
  34. package/dist/server/route-table.js +2 -0
  35. package/dist/server/settings.js +151 -3
  36. package/dist/server/task-views.js +4 -3
  37. package/dist/server/tasks.js +11 -10
  38. package/dist/server/terminals.js +3 -1
  39. package/dist/skill-library-schema.js +70 -0
  40. package/dist/skill-library.js +693 -0
  41. package/dist/skill-local-sync.js +334 -0
  42. package/dist/skills-manifest.js +6 -3
  43. package/dist/skills-ui.js +122 -1
  44. package/dist/store.js +22 -4
  45. package/dist/surface.js +1 -1
  46. package/dist/task-status.js +2 -1
  47. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  48. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  49. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  50. package/dist/tui/linux-x64/toolroll-tui +0 -0
  51. package/dist/work-index.js +5 -2
  52. package/dist/work-summary.js +77 -1
  53. package/dist/workspace-ui.js +12 -6
  54. package/package.json +2 -1
package/dist/first-run.js CHANGED
@@ -166,7 +166,7 @@ export function taskRoad(read, approved, built, facts) {
166
166
  if (waitsAtReady)
167
167
  steps = steps.map(step => step.key === "ready" ? { ...step, state: "stuck" } : step);
168
168
  const at = steps.find(step => step.key === "checks");
169
- if (facts.report !== true && at !== undefined && at.state === "stuck") {
169
+ if (facts.report !== true && at !== undefined && at.state === "stuck" && !complete) {
170
170
  steps = steps.map(step => step.key === "ready" && step.state === "done" ? { ...step, state: "todo" } : step);
171
171
  }
172
172
  if (facts.report === true) {
@@ -7,6 +7,8 @@ import { relayUrlInside } from "./flexible-relay.js";
7
7
  import { flexibleThread, flexibleThreadFence, flexibleThreadSpawn, stopFlexibleThreadAgent, withFlexibleThreadLock } from "./flexible-thread.js";
8
8
  import { beginFlexibleTurn, finishFlexibleTurn, flexibleTurn, interruptFlexibleTurnsOf, withdrawFlexibleTurn, withdrawFlexibleTurnsAbove } from "./flexible-turns.js";
9
9
  import { CLAUDE_BUILD_ISOLATION_ARGV, HEADLESS_DISALLOWED_TOOLS } from "./provider.js";
10
+ import { effectiveSkillsForRepo, materializeProjectSkills } from "./project-skills.js";
11
+ import { formatSkillsBrief } from "./skill-library.js";
10
12
  const WORDS = Object.freeze({
11
13
  "not-available": FLEXIBLE_UNAVAILABLE,
12
14
  "codex-unsupported": "Codex's own sandbox can't keep a Flexible thread away from threads and files made after it starts, so Codex and OpenRouter threads can't run yet. Nothing was started.",
@@ -124,13 +126,25 @@ async function startLocked(store, input) {
124
126
  outcome: "refused", detail: `thread ${turn.thread} · turn ${turn.id} · ${providerProblem}` });
125
127
  return { ok: false, reason: "setup-failed", message: "The agent's configuration folder isn't the one Toolroll made, so it didn't start. Nothing was removed." };
126
128
  }
129
+ let skillsDir = null;
130
+ let skillsPrompt = "";
131
+ try {
132
+ const snapshot = effectiveSkillsForRepo(store, turn.repo);
133
+ if (snapshot.packages.length > 0) {
134
+ const supplied = materializeProjectSkills(snapshot, join(fenced.paths.home, "skills"), turn.id.slice(0, 16));
135
+ skillsDir = supplied.directory;
136
+ skillsPrompt = formatSkillsBrief(supplied.catalog, "Skills supplied for this thread. ");
137
+ }
138
+ }
139
+ catch {
140
+ }
127
141
  let endpoint = null;
128
142
  const agentEnvFor = (launchId) => {
129
143
  endpoint = input.relay.issue({ thread: turn.thread, turn: turn.id, launch: launchId });
130
144
  const spec = flexibleAgentLaunch(turn.provider, turn.level, { model: turn.model, relay: { url: relayInside, token: endpoint.token }, configHome });
131
145
  if (!spec.ok)
132
146
  throw new Error(spec.message);
133
- return spec.spec.env;
147
+ return skillsDir === null ? spec.spec.env : { ...spec.spec.env, TOOLROLL_SKILLS_DIR: skillsDir };
134
148
  };
135
149
  const spawned = await flexibleThreadSpawn(store, { id: turn.thread, network, storage: input.storage,
136
150
  proxyEnv: input.network.proxyEnv, agentEnvFor, launch: { provider: turn.provider, level: turn.level, turn: turn.id, holder: input.holder },
@@ -150,7 +164,7 @@ async function startLocked(store, input) {
150
164
  void stopFlexibleThreadAgent(store, { id: turn.thread, reason: "its agent exited", expect: { launch: launchId, holder: input.holder }, ...(input.seams?.io === undefined ? {} : { io: input.seams.io }) })
151
165
  .then(settled => { input.seams?.exitSettled?.(launchId, settled); }, () => { input.seams?.exitSettled?.(launchId, null); });
152
166
  });
153
- return { ok: true, launched: "started", launchId: spawned.launchId, pid: spawned.pid, child: spawned.child, stopWatching };
167
+ return { ok: true, launched: "started", launchId: spawned.launchId, pid: spawned.pid, child: spawned.child, stopWatching, ...(skillsPrompt !== "" ? { skillsPrompt } : {}) };
154
168
  }
155
169
  export async function lowerFlexibleThreadLevel(store, input) {
156
170
  if (!isFlexibleLevel(input.level) || typeof input.by?.name !== "string" || !Number.isSafeInteger(input.by.generation))
@@ -5,6 +5,7 @@ import { flexibleImportRef, importFlexibleCandidate, projectMergeHint, projectTh
5
5
  import { branchHeld, nextSeq, turnRunning } from "./flexible-ship.js";
6
6
  import { flexibleThread, flexibleThreadBranch, withFlexibleThreadLock } from "./flexible-thread.js";
7
7
  import { machineActing } from "./scope.js";
8
+ import { gitCommand, UNSAFE_FOLDER } from "./local-landing.js";
8
9
  const WORDS = Object.freeze({
9
10
  "machine-proof": "Only a person can save a thread's work. Nothing was saved.",
10
11
  "thread-unknown": "There's no such thread.",
@@ -19,7 +20,6 @@ const WORDS = Object.freeze({
19
20
  });
20
21
  const refuse = (reason) => ({ ok: false, reason, message: WORDS[reason] });
21
22
  export const flexibleSaveDigestOf = (terms) => createHash("sha256").update(`standing-orders:flexible-save:${canonicalJson(terms)}`, "utf8").digest("hex").slice(0, 32);
22
- const shellWord = (text) => /^[A-Za-z0-9_./~+@%=:,-]+$/.test(text) ? text : `'${text.replace(/'/g, "'\\''")}'`;
23
23
  function saverStanding(store, thread, by) {
24
24
  if (thread.createdBy !== by.name)
25
25
  return refuse("not-owner");
@@ -33,13 +33,13 @@ function saverStanding(store, thread, by) {
33
33
  async function nextWords(store, thread, candidate, branch, runner) {
34
34
  const hint = await projectMergeHint(store, { thread, candidate, ...(runner === undefined ? {} : { runner }) });
35
35
  if (hint === null)
36
- return `To use it: merge ${branch} in your repository.`;
37
- const repo = shellWord(hint.repo);
36
+ return { next: `To use it: merge ${branch} in your repository.`, command: null };
37
+ const ff = gitCommand(hint.repo, ["merge", "--ff-only", branch]), merge = gitCommand(hint.repo, ["merge", branch]);
38
38
  if (hint.branch === null)
39
- return `To use it: check out the branch you want it on, then run \`git -C ${repo} merge --ff-only ${branch}\`.`;
39
+ return { next: `To use it: check out the branch you want it on, then ${ff === null ? UNSAFE_FOLDER(`git merge --ff-only ${branch}`) : `run \`${ff}\`.`}`, command: ff };
40
40
  if (hint.fastForward)
41
- return `To put it on ${hint.branch}: \`git -C ${repo} merge --ff-only ${branch}\`.`;
42
- return `${hint.branch} moved since the thread started, so it won't fast-forward. To merge it: \`git -C ${repo} merge ${branch}\`.`;
41
+ return { next: ff === null ? `To put it on ${hint.branch}: ${UNSAFE_FOLDER(`git merge --ff-only ${branch}`)}` : `To put it on ${hint.branch}: \`${ff}\`.`, command: ff };
42
+ return { next: `${hint.branch} moved since the thread started, so it won't fast-forward. ${merge === null ? UNSAFE_FOLDER(`git merge ${branch}`) : `To merge it: \`${merge}\`.`}`, command: merge };
43
43
  }
44
44
  export async function saveFlexibleBranch(store, input) {
45
45
  if (machineActing())
@@ -67,7 +67,7 @@ export async function saveFlexibleBranch(store, input) {
67
67
  return refuse("branch-gone");
68
68
  if (actual !== read.candidate)
69
69
  return refuse("branch-moved");
70
- return { ok: true, already: true, branch, candidate: read.candidate, seq: null, changedPaths: read.changedPaths, next: await nextWords(store, input.thread, read.candidate, branch, input.runner) };
70
+ return { ok: true, already: true, branch, candidate: read.candidate, seq: null, changedPaths: read.changedPaths, ...(await nextWords(store, input.thread, read.candidate, branch, input.runner)) };
71
71
  }
72
72
  const at = input.now.toISOString();
73
73
  const recorded = store.transact(() => {
@@ -105,7 +105,7 @@ export async function saveFlexibleBranch(store, input) {
105
105
  return imported;
106
106
  }
107
107
  store.transact(() => { store.handle.prepare("UPDATE flexible_ship SET state = 'imported', state_at = ? WHERE id = ? AND state = 'approved'").run(at, recorded.digest); });
108
- return { ok: true, already: false, branch, candidate: read.candidate, seq: recorded.seq, changedPaths: read.changedPaths, next: await nextWords(store, input.thread, read.candidate, branch, input.runner) };
108
+ return { ok: true, already: false, branch, candidate: read.candidate, seq: recorded.seq, changedPaths: read.changedPaths, ...(await nextWords(store, input.thread, read.candidate, branch, input.runner)) };
109
109
  });
110
110
  if (locked.ok === false && (locked.reason === "not-available" || locked.reason === "thread-unknown"))
111
111
  return refuse("thread-unknown");
@@ -668,7 +668,8 @@ export async function beginFlexibleThreadTurn(store, sessions, input) {
668
668
  if (!attached.ok)
669
669
  return attached;
670
670
  session.title ??= cardText(input.message.split("\n")[0], 80) || null;
671
- const handed = await conversationFor(store, { thread: turn.thread, turn: input.turn, seq: turn.seq, message: input.message });
671
+ const baseHanded = await conversationFor(store, { thread: turn.thread, turn: input.turn, seq: turn.seq, message: input.message });
672
+ const handed = started.skillsPrompt ? `${started.skillsPrompt}\n${baseHanded}` : baseHanded;
672
673
  session.records.push({ k: "you", at: (input.clock ?? systemClock)().toISOString(), t: saidLines(input.message) });
673
674
  try {
674
675
  session.agent?.stdin.write(`${userFrame(handed, randomUUID())}\n`);
@@ -116,11 +116,15 @@ async function usableRepository(repo, read) {
116
116
  throw new Error("it borrows objects from another repository");
117
117
  const listing = await read(repo, ["config", "--list", "--show-scope", "-z"]);
118
118
  if (listing.code !== 0)
119
- throw new Error("its git config couldn't be read");
119
+ throw new Error(`its git config couldn't be read${gitSaid(listing.stderr)}`);
120
120
  if (lazyFetchSetting(listing.stdout) !== null)
121
121
  throw new Error("it is a partial clone");
122
122
  return { common, objects: realpathSync(objects) };
123
123
  }
124
+ function gitSaid(stderr) {
125
+ const line = stderr.split("\n").map(one => one.replace(/[\u0000-\u001f\u007f-\u009f\u202a-\u202e\u2066-\u2069]/g, "").trim()).find(one => one !== "");
126
+ return line === undefined ? "" : `: ${line.length <= 240 ? line : `${line.slice(0, 239)}…`}`;
127
+ }
124
128
  const ownObjects = (path) => { try {
125
129
  const held = lstatSync(path);
126
130
  return held.isDirectory() && !held.isSymbolicLink();
@@ -25,11 +25,9 @@ function installKind(bin, probe) {
25
25
  catch {
26
26
  }
27
27
  const path = real.replace(/\\/g, "/");
28
- if (path.includes("/staged-upgrades/browser-"))
29
- return "source";
30
28
  if (/\.app\/Contents\/Resources\//.test(path))
31
29
  return "desktop";
32
- if (/\/staged-upgrades\/(release|rollback)-/.test(path))
30
+ if (/\/staged-upgrades\/(release|rollback|browser)-/.test(path))
33
31
  return "managed";
34
32
  if (/\/Cellar\/toolroll\//i.test(path))
35
33
  return "homebrew";
package/dist/invoke.js CHANGED
@@ -279,7 +279,7 @@ export async function invokeAgent(store, runId, spec, invocation, options) {
279
279
  }
280
280
  }
281
281
  const ownTools = tools?.privateDir === undefined ? null : realpathSync(tools.privateDir);
282
- const fenceOf = invocation.phase === "review" ? { fence: [], fileTools: [], grants: NO_GRANTS, gitPaths: [], cache: undefined, problem: undefined } : await runFence(store, runId, spec.provider, options.keyHome, codexProfile ? null : ownTools, launchWrites ?? WRITES_DEFAULT, launchSandbox ?? LEGACY_SANDBOX, options.skills ?? null);
282
+ const fenceOf = invocation.phase === "review" ? { fence: [], fileTools: [], grants: NO_GRANTS, gitPaths: [], cache: undefined, problem: undefined } : await runFence(store, runId, spec.provider, options.keyHome, codexProfile ? null : ownTools, launchWrites ?? WRITES_DEFAULT, launchSandbox ?? LEGACY_SANDBOX, options.skills ?? null, options.evidenceRoot ?? null);
283
283
  if ("skillsProblem" in fenceOf && fenceOf.skillsProblem !== undefined) {
284
284
  try {
285
285
  store.addRunNote(runId, "Toolroll", `Project skills weren't shared with the agent: ${fenceOf.skillsProblem}.`, clock());
@@ -738,7 +738,7 @@ function linkedFor(store, worktree) {
738
738
  const row = worktree === null ? null : store.getWorktree(worktree);
739
739
  return row === null ? null : { repo: row.repo, setupDigest: row.setupDigest ?? null };
740
740
  }
741
- async function runFence(store, runId, provider, keyHome, ownTools, writes = WRITES_DEFAULT, sandbox = LEGACY_SANDBOX, skills = null) {
741
+ async function runFence(store, runId, provider, keyHome, ownTools, writes = WRITES_DEFAULT, sandbox = LEGACY_SANDBOX, skills = null, customEvidenceRoot = null) {
742
742
  let skillsProblem = {};
743
743
  try {
744
744
  const databaseFile = store.databaseFile();
@@ -757,11 +757,13 @@ async function runFence(store, runId, provider, keyHome, ownTools, writes = WRIT
757
757
  const granted = skillsGrant(provider === "command" ? null : skills);
758
758
  if (granted.problem !== null)
759
759
  skillsProblem = { skillsProblem: granted.problem };
760
+ const evidenceDeny = customEvidenceRoot ?? skills?.root ?? null;
760
761
  const allowed = worktree === null || row === null || writes !== "workspace" ? null
761
762
  : writeAllowlist({ provider, home: keyHome ?? homedir(), worktree, binding, launchFolder: ownTools, cache: buildCacheFolder(row.repo, keyHome ?? homedir()) });
762
763
  const launch = fenceFor(provider === "command" ? "command" : "build", { databaseFile, worktree, ...home, boundary, binding, runFolders: folders, poolRoots, storage,
764
+ evidenceRoot: evidenceDeny,
763
765
  extra: [...allowed?.deny ?? [], ...granted.deny], linked: linkedFor(store, worktree), writes: allowed === null ? null : { writes: allowed.writes, readOnly: allowed.readOnly }, policy: sandbox.policy, provider,
764
- ...(provider === "command" ? {} : { exactFile: deliveredFile(store, runId), exactFiles: granted.files }),
766
+ ...(provider === "command" ? {} : { exactFile: deliveredFile(store, runId), exactFiles: granted.files, exactDigests: granted.digests, exactFolders: granted.folders }),
765
767
  readDeny: [...new Set([...sandbox.readDeny, ...(row === null ? [] : store.projectSandbox(row.repo).readDeny)])].map(one => readDenyPath(one, keyHome ?? homedir())), machLookup: sandbox.machLookup });
766
768
  return {
767
769
  fence: launch.fence,
@@ -779,7 +781,7 @@ async function runFence(store, runId, provider, keyHome, ownTools, writes = WRIT
779
781
  return { fence: [], fileTools: [], grants: NO_GRANTS, problem: error instanceof CheckoutBindingError || error instanceof ExactFileChanged ? error.message : "The build fence could not be prepared." };
780
782
  }
781
783
  }
782
- export function fencedCommands(store, runId, writes, inner, available = () => macosFenceAvailable() || linuxFenceAvailable(), access = CHECK_ACCESS_DEFAULT, network, sandbox = LEGACY_SANDBOX) {
784
+ export function fencedCommands(store, runId, writes, inner, available = () => macosFenceAvailable() || linuxFenceAvailable(), access = CHECK_ACCESS_DEFAULT, network, sandbox = LEGACY_SANDBOX, customEvidenceRoot = null) {
783
785
  if (inner !== runCommand)
784
786
  return inner;
785
787
  return async (file, args, options) => {
@@ -799,7 +801,7 @@ export function fencedCommands(store, runId, writes, inner, available = () => ma
799
801
  stampLaunch(store, [runId], unfencedStamp());
800
802
  return await inner(file, args, { ...options, env: { ...(options?.env ?? {}), TMPDIR: temp, TMP: temp, TEMP: temp } });
801
803
  }
802
- const fenced = await runFence(store, runId, "command", undefined, own, writes, sandbox);
804
+ const fenced = await runFence(store, runId, "command", undefined, own, writes, sandbox, null, customEvidenceRoot);
803
805
  if (fenced.problem !== undefined)
804
806
  return { code: 1, stdout: "", stderr: `${fenced.problem}\n`, timedOut: false, notFound: false };
805
807
  if (fenced.fence.length === 0) {
@@ -836,7 +838,7 @@ export function fencedCommands(store, runId, writes, inner, available = () => ma
836
838
  }
837
839
  };
838
840
  }
839
- export function fencedCheckoutCommands(store, repo, checkout, inner, available = () => macosFenceAvailable() || linuxFenceAvailable(), access = CHECK_ACCESS_DEFAULT, network, sandbox = LEGACY_SANDBOX, stampRuns = []) {
841
+ export function fencedCheckoutCommands(store, repo, checkout, inner, available = () => macosFenceAvailable() || linuxFenceAvailable(), access = CHECK_ACCESS_DEFAULT, network, sandbox = LEGACY_SANDBOX, stampRuns = [], customEvidenceRoot = null) {
840
842
  if (inner !== runCommand)
841
843
  return inner;
842
844
  return async (file, args, options) => {
@@ -881,7 +883,7 @@ export function fencedCheckoutCommands(store, repo, checkout, inner, available =
881
883
  const allowed = store.projectWrites(repo) !== "workspace" ? null : writeAllowlist({ provider: "command", home: homedir(), worktree: checkout, binding, launchFolder: own, cache });
882
884
  const database = options?.env?.["TOOLROLL_DB"];
883
885
  const checkData = allowed === null || database === undefined ? null : grantFolder(dirname(database), false);
884
- const launch = fenceFor("check", { databaseFile, worktree: checkout, boundary, binding, runFolders: folders, poolRoots, storage, extra: allowed?.deny ?? [], linked: linkedFor(store, checkout),
886
+ const launch = fenceFor("check", { databaseFile, worktree: checkout, boundary, binding, runFolders: folders, poolRoots, storage, evidenceRoot: customEvidenceRoot, extra: allowed?.deny ?? [], linked: linkedFor(store, checkout),
885
887
  readDeny: sandbox.readDeny.map(one => readDenyPath(one, homedir())), machLookup: sandbox.machLookup, policy: sandbox.policy,
886
888
  writes: allowed === null ? null : { writes: { ...allowed.writes, subpaths: [...allowed.writes.subpaths, ...(checkData === null ? [] : [checkData])] }, readOnly: allowed.readOnly } });
887
889
  const grants = launch.fenceGrants;
@@ -1019,11 +1021,11 @@ export function checkoutLaunchOf(store, repo, runIds, platform = process.platfor
1019
1021
  export const widestRan = (levels) => levels.includes("unsandboxed") ? "unsandboxed" : levels.includes("sign-ins") ? "sign-ins" : CHECK_ACCESS_DEFAULT;
1020
1022
  export const ranAtLine = (level) => level === "sandboxed" ? null
1021
1023
  : `=== Check access ===\n${level === "unsandboxed" ? "These commands ran without a sandbox." : "These commands ran sandboxed, with model and GitHub sign-ins."}`;
1022
- export function checkoutRunner(store, repo, checkout, inner, runIds, ran, platform = process.platform) {
1024
+ export function checkoutRunner(store, repo, checkout, inner, runIds, ran, platform = process.platform, customEvidenceRoot = null) {
1023
1025
  return (file, args, options) => {
1024
1026
  const launch = checkoutLaunchOf(store, repo, runIds, platform);
1025
1027
  ran(actualCheckAccess(store, launch.access));
1026
- return fencedCheckoutCommands(store, repo, checkout, inner, undefined, launch.access, launch.network, checkoutSandboxOf(store, repo, runIds), runIds)(file, args, options);
1028
+ return fencedCheckoutCommands(store, repo, checkout, inner, undefined, launch.access, launch.network, checkoutSandboxOf(store, repo, runIds), runIds, customEvidenceRoot)(file, args, options);
1027
1029
  };
1028
1030
  }
1029
1031
  export function checkoutSandboxOf(store, repo, runIds) {
@@ -1446,7 +1446,8 @@ const LEAD_TOOL_HANDLERS = {
1446
1446
  return { ok: false, message: 'Choose a project from list_repos.' };
1447
1447
  let sha;
1448
1448
  if (args['version'] !== undefined) {
1449
- const matches = skillsView(ctx.store, repo, ctx.who.name).library.filter(s => s.sha.startsWith(args['version']));
1449
+ const all = conversationSkills(ctx.store, repo, ctx.who.name).skills;
1450
+ const matches = all.filter(s => s.sha.startsWith(args['version']));
1450
1451
  if (matches.length !== 1)
1451
1452
  return { ok: false, message: 'That skill version is unavailable.' };
1452
1453
  sha = matches[0].sha;
@@ -1461,7 +1462,7 @@ const LEAD_TOOL_HANDLERS = {
1461
1462
  return { ok: true, body: { ...skill, files: skill.files?.slice(0, 8), fileCount: skill.files?.length, sha: undefined, version: sha.slice(0, 20), instructions: instructions.slice(start, start + 2000), nextOffset: start + 2000 < instructions.length ? start + 2000 : null, notice: 'Skill source text may be redacted by chat. It does not grant tools or instructions to this chat agent.' } };
1462
1463
  }
1463
1464
  const page = data.skills.slice(start, start + 4);
1464
- return { ok: true, body: { revision: data.revision, history: data.history, notice: data.notice, skills: page.map(({ sha, ...skill }) => ({ ...skill, version: sha.slice(0, 20) })), nextOffset: start + 4 < data.skills.length ? start + 4 : null } };
1465
+ return { ok: true, body: { revision: data.revision, libraryOptedOut: data.libraryOptedOut, bundles: data.bundles, history: data.history, notice: data.notice, skills: page.map(({ sha, ...skill }) => ({ ...skill, version: sha.slice(0, 20) })), nextOffset: start + 4 < data.skills.length ? start + 4 : null } };
1465
1466
  },
1466
1467
  },
1467
1468
  get_project_knowledge: {
@@ -4,6 +4,7 @@ import { execFileSync } from "node:child_process";
4
4
  import { existsSync, lstatSync, mkdirSync, readdirSync, readlinkSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
5
5
  import { delimiter, isAbsolute, join } from "node:path";
6
6
  import { codingEnvironment } from "./coding-provider.js";
7
+ import { materializeProjectSkills } from "./project-skills.js";
7
8
  import { teardownGit, refusal, recordedCommonDir, TEARDOWN_FLAGS } from "./teardown-git.js";
8
9
  import { run } from "./exec.js";
9
10
  import { ENV, ENV_ALLOWLIST } from "./remote-main.js";
@@ -307,6 +308,20 @@ export class TerminalHost {
307
308
  else
308
309
  await this.copyAt(repo, worktree, branch, base);
309
310
  const cols = clamp(size.cols, COLS), rows = clamp(size.rows, ROWS);
311
+ let skillsDir = null;
312
+ const launchEnv = { ...env };
313
+ try {
314
+ const snapshot = this.options.skillsForRepo?.(repo);
315
+ if (snapshot && snapshot.packages.length > 0) {
316
+ const materialized = materializeProjectSkills(snapshot, join(this.options.worktreeRoot, ".skills"), id.slice(0, 16));
317
+ if (materialized.directory !== null) {
318
+ skillsDir = materialized.directory;
319
+ launchEnv["TOOLROLL_SKILLS_DIR"] = skillsDir;
320
+ }
321
+ }
322
+ }
323
+ catch {
324
+ }
310
325
  let pty;
311
326
  try {
312
327
  if (this.stopped)
@@ -314,9 +329,11 @@ export class TerminalHost {
314
329
  const refused = admit();
315
330
  if (refused !== null)
316
331
  throw new TerminalError(refused);
317
- pty = this.options.spawn(command.file, command.args, { cwd: worktree, env, cols, rows });
332
+ pty = this.options.spawn(command.file, command.args, { cwd: worktree, env: launchEnv, cols, rows });
318
333
  }
319
334
  catch (error) {
335
+ if (skillsDir !== null)
336
+ rmSync(skillsDir, { recursive: true, force: true });
320
337
  if (from !== null)
321
338
  rmSync(worktree, { recursive: true, force: true });
322
339
  else {
@@ -328,7 +345,7 @@ export class TerminalHost {
328
345
  let resolveExited;
329
346
  const session = { id, owner, generation, localGeneration, task: from?.task ?? null, run: from?.run ?? null, agent: null, base: from === null ? null : base, repo, program, branch, worktree, startedAt: this.clock().toISOString(), endedAt: null, exit: null, endedBy: null, cleanup: null,
330
347
  pty, leader: pty.pid, tty: pty.tty, known: new Map(), exitedAt: null, worktreeReal: realpathSync(worktree), startedMs: Date.now(), residentsOnly: false, residentsSeen: new Map(), cols, rows, screen: new ScreenMirror(cols, rows, this.options.scrollbackLines), paused: false, flowTimer: null, attaching: 0, viewers: new Set(), controller: null, leaseEpoch: 0, viewerActors: new Map(), viewerGates: new Map(), closing: null,
331
- exited: new Promise(resolve => { resolveExited = resolve; }), sensitive: false, attachedOnce: false, early: [], earlyBytes: 0, dropped: false, attachTimer: null };
348
+ exited: new Promise(resolve => { resolveExited = resolve; }), sensitive: false, attachedOnce: false, early: [], earlyBytes: 0, dropped: false, attachTimer: null, skillsDir };
332
349
  this.sessions.set(id, session);
333
350
  this.ledger.running(id);
334
351
  reserved = false;
@@ -421,7 +438,7 @@ export class TerminalHost {
421
438
  let resolveExited;
422
439
  const session = { id, owner, generation, localGeneration, task: null, run: null, agent: { ...agent }, base: null, repo: "", program: "shell", branch: "", worktree: folder, startedAt: this.clock().toISOString(), endedAt: null, exit: null, endedBy: null, cleanup: null,
423
440
  pty, leader: pty.pid, tty: pty.tty, known: new Map(), exitedAt: null, worktreeReal: realpathSync(folder), startedMs: Date.now(), residentsOnly: false, residentsSeen: new Map(), cols, rows, screen: new ScreenMirror(cols, rows, 0), paused: false, flowTimer: null, attaching: 0, viewers: new Set(), controller: null, leaseEpoch: 0, viewerActors: new Map(), viewerGates: new Map(), closing: null,
424
- exited: new Promise(resolve => { resolveExited = resolve; }), sensitive: true, attachedOnce: false, early: [], earlyBytes: 0, dropped: false, attachTimer: null };
441
+ exited: new Promise(resolve => { resolveExited = resolve; }), sensitive: true, attachedOnce: false, early: [], earlyBytes: 0, dropped: false, attachTimer: null, skillsDir: null };
425
442
  this.wire(session, () => { resolveExited(); try {
426
443
  exited();
427
444
  }
@@ -1000,6 +1017,10 @@ export class TerminalHost {
1000
1017
  }
1001
1018
  session.viewers.clear();
1002
1019
  session.screen.dispose();
1020
+ if (session.skillsDir !== null) {
1021
+ rmSync(session.skillsDir, { recursive: true, force: true });
1022
+ session.skillsDir = null;
1023
+ }
1003
1024
  if (session.base !== null || session.agent !== null) {
1004
1025
  rmSync(session.worktree, { recursive: true, force: true });
1005
1026
  this.options.record?.("remove", this.summary(session));
@@ -215,7 +215,7 @@ export async function readLanding(store, taskId, access, now, options) {
215
215
  const checks = receipt.checks.status === "passed" ? "passed" : !projectCheckSet(store, project.repo) && receipt.checks.status === "not-run" ? "none" : null;
216
216
  if (checks === null) {
217
217
  if (receipt.checks.status === "failed")
218
- return refuse("checks", later ? `Its checks failed when they ran again after you accepted it (${receipt.checks.detail}). It stays Complete; it can't land until they pass on its exact commit.`
218
+ return refuse("checks", later ? `Its checks failed when they ran again after you accepted it (${receipt.checks.detail.replace(/\.$/, "")}). It stays Complete; it can't land until they pass on its exact commit.`
219
219
  : "Its checks failed. Only work whose checks passed on its exact commit lands.");
220
220
  return refuse("checks", later ? "Its checks changed since you accepted it and haven't run on its exact commit since. Run checks (it stays Complete), then land it."
221
221
  : "Its checks haven't passed on its exact commit. Run checks, then land it.");
@@ -636,13 +636,14 @@ function oidOrThrow(oid) {
636
636
  throw new Error("not a commit id");
637
637
  return oid;
638
638
  }
639
- const UNSAFE_IN_COMMAND = /[\u0000-\u001f\u007f-\u009f\u2028\u2029\u061c\u200b-\u200f\u202a-\u202e\u2066-\u2069\ufeff]/;
639
+ const UNSAFE_IN_COMMAND = /[\u0000-\u001f\u007f-\u009f\u2028\u2029\u061c\u200b-\u200f\u202a-\u202e\u2060-\u2064\u2066-\u2069\ufeff]/;
640
+ export const unsafeInCommand = (text) => UNSAFE_IN_COMMAND.test(text);
640
641
  export function gitCommand(folder, args) {
641
642
  if (UNSAFE_IN_COMMAND.test(folder))
642
643
  return null;
643
644
  return ["git", "-C", `'${folder.replace(/'/g, "'\\''")}'`, ...args].join(" ");
644
645
  }
645
- const UNSAFE_FOLDER = (what) => `Toolroll can't write a safe command for this folder's name; run ${what} in your project folder.`;
646
+ export const UNSAFE_FOLDER = (what) => `Toolroll can't write a safe command for this folder's name; run ${what} in your project folder.`;
646
647
  function handoffCommand(folder, commit) {
647
648
  return gitCommand(folder, ["merge", "--ff-only", oidOrThrow(commit)]);
648
649
  }
@@ -735,12 +736,45 @@ async function revertCommit(git, plan, scratch) {
735
736
  await git(["worktree", "prune"]).catch(() => null);
736
737
  }
737
738
  }
738
- export function landedWords(store, rootId) {
739
+ export function landedWords(store, rootId, read) {
740
+ return landedStanding(store, rootId, read)?.words ?? null;
741
+ }
742
+ export function landedStanding(store, rootId, read) {
739
743
  const landed = landingOf(store, rootId);
740
744
  if (landed === null)
741
745
  return null;
742
- return landed.undone ? `Landed on ${landed.intent.ref.replace(/^refs\/heads\//, "")} (${short(landed.intent.commit)}), then undone.`
743
- : `Landed on ${landed.intent.ref.replace(/^refs\/heads\//, "")} (${short(landed.intent.commit)}).`;
746
+ const where = `Landed on ${landed.intent.ref.replace(/^refs\/heads\//, "")} (${short(landed.intent.commit)})`;
747
+ if (landed.undone)
748
+ return { words: `${where}, then undone.`, reverted: false };
749
+ const reverted = read !== undefined && revertedOnBranch(landed.intent.repo, landed.intent.ref, landed.intent, read);
750
+ return { words: reverted ? `${where} · a later commit reverted it` : `${where}.`, reverted };
751
+ }
752
+ export function revertedOnBranch(repo, ref, landing, read) {
753
+ if (!OID.test(landing.old) || !OID.test(landing.commit) || !ref.startsWith("refs/heads/"))
754
+ return false;
755
+ const parents = read(repo, ["rev-list", "--parents", "-n", "1", landing.commit])?.split(" ") ?? [];
756
+ if (parents.length !== 2 || parents[0] !== landing.commit || parents[1] !== landing.old)
757
+ return false;
758
+ const changes = (raw) => {
759
+ const lines = raw.split("\n").filter(line => line.startsWith(":"));
760
+ const keys = [];
761
+ for (const line of lines) {
762
+ const match = /^:(\d{6}) (\d{6}) ([0-9a-f]{40}|[0-9a-f]{64}) ([0-9a-f]{40}|[0-9a-f]{64}) [A-Z]\d*\t(.+)$/.exec(line);
763
+ if (match === null)
764
+ return null;
765
+ keys.push(`${match[1]} ${match[2]} ${match[3]} ${match[4]}\t${match[5]}`);
766
+ }
767
+ return keys.sort();
768
+ };
769
+ const own = read(repo, ["diff-tree", "-r", "--no-renames", "--no-abbrev", "--no-commit-id", "--no-ext-diff", "--no-textconv", landing.commit]);
770
+ const mine = own === null ? null : changes(own);
771
+ if (mine === null || mine.length === 0)
772
+ return false;
773
+ const inverse = mine.map(key => { const [modes, path] = key.split("\t"); const [m1, m2, s1, s2] = modes.split(" "); return `${m2} ${m1} ${s2} ${s1}\t${path}`; }).sort().join("\n");
774
+ const later = read(repo, ["log", "--no-show-signature", "--no-merges", "--ancestry-path", "-n", "50", "--format=%x01%H", "--raw", "--no-renames", "--no-abbrev", "--no-ext-diff", "--no-textconv", `${landing.commit}..${ref}`]);
775
+ if (later === null)
776
+ return false;
777
+ return later.split("\u0001").slice(1).some(entry => changes(entry.slice(entry.indexOf("\n") + 1))?.join("\n") === inverse);
744
778
  }
745
779
  export function recognisedOnBranch(store, repo, rootId, candidate, read) {
746
780
  if (candidate === null || !OID.test(candidate))
@@ -749,8 +783,14 @@ export function recognisedOnBranch(store, repo, rootId, candidate, read) {
749
783
  const ref = recorded ?? (() => { const head = read(repo, ["symbolic-ref", "-q", "HEAD"]); return head !== null && head.startsWith("refs/heads/") ? head : null; })();
750
784
  if (ref === null || !landableBranch(ref.slice("refs/heads/".length)))
751
785
  return null;
752
- const commits = [candidate, ...handoffsOf(store, repo, rootId).filter(one => one.candidate === candidate && one.ref === ref).map(one => one.commit)];
753
- return commits.some(commit => read(repo, ["merge-base", "--is-ancestor", commit, ref]) !== null) ? `On ${ref.slice("refs/heads/".length)}` : null;
786
+ const handed = handoffsOf(store, repo, rootId).filter(one => one.candidate === candidate && one.ref === ref);
787
+ const found = [{ commit: candidate, old: null }, ...handed.map(one => ({ commit: one.commit, old: one.old }))]
788
+ .find(one => read(repo, ["merge-base", "--is-ancestor", one.commit, ref]) !== null);
789
+ if (found === undefined)
790
+ return null;
791
+ const reverted = found.old !== null && revertedOnBranch(repo, ref, { old: found.old, commit: found.commit }, read);
792
+ const where = `Landed on ${ref.slice("refs/heads/".length)} (${short(found.commit)})`;
793
+ return { words: reverted ? `${where} · a later commit reverted it` : where, reverted };
754
794
  }
755
795
  export function broughtInOnBranch(store, repo, rootId, read) {
756
796
  const landed = landedCommits(store, rootId);
@@ -27,6 +27,7 @@ export const LOCAL_OWNER_ACTS = Object.freeze([
27
27
  "dismiss-suggestion",
28
28
  "trial-stop",
29
29
  "code-map-switch",
30
+ "skill-library",
30
31
  "memory-review",
31
32
  "request-plan",
32
33
  "retry-build",
package/dist/operate.js CHANGED
@@ -367,7 +367,7 @@ export const OPERATE_HELP = `toolroll — operating the queue
367
367
  toolroll task complete <id> mark the current result complete (--digest for JSON/agents);
368
368
  [--pull-request] --pull-request also opens its pull request
369
369
  toolroll task land <id> put accepted work on the project's own branch (no pull requests): shows what lands
370
- where, then --yes --key <key> lands it as one commit; --undo reverts it
370
+ where, then --yes --key <preview-key> lands it as one commit; --undo reverts it
371
371
  toolroll task merge <id> --as <you> --token <t>
372
372
  merge the task's pull request once checks pass
373
373
  [--anyway] merge without waiting for the full check
@@ -7730,7 +7730,7 @@ function taskAction(action, rest, flags, context) {
7730
7730
  return fail(context.write, context.json, "task", "usage", `unknown \`task ${action ?? ""}\` — try ${TASK_ACTIONS.join(", ")}`, EXIT.usage);
7731
7731
  }
7732
7732
  }
7733
- async function addTask(positional, flags, context) {
7733
+ async function addTask(positional, flags, context, fromNew = false) {
7734
7734
  const { store, write, json, now } = context;
7735
7735
  const title = positional.join(" ").trim();
7736
7736
  if (title === "")
@@ -7838,7 +7838,7 @@ async function addTask(positional, flags, context) {
7838
7838
  }
7839
7839
  }
7840
7840
  const next = filedRef !== null && filedRef.repo !== null && filedRef.plan === null && !flags.has("report")
7841
- ? "Next: run `toolroll`, select it and press p to ask for a plan. To build without a plan, file it with `toolroll task new` instead." : null;
7841
+ ? `Next: run \`toolroll\`, select it and press p to ask for a plan.${fromNew ? "" : " To build without a plan, file it with `toolroll task new` instead."}` : null;
7842
7842
  return succeed(write, json, "task add", {
7843
7843
  task: outcome.task,
7844
7844
  ...(replaces === undefined ? {} : { replaces }),
@@ -7887,16 +7887,17 @@ async function runTaskChecks(positional, flags, context) {
7887
7887
  const state = done?.state ?? "waiting";
7888
7888
  const words = `${CHECK_LEVEL_WORDS[asked.level]} checks`;
7889
7889
  const payload = { task: taskId, run: result.runId, head: result.head, request: asked.request, level: asked.level, state, exitCode: done?.exitCode ?? null };
7890
+ const complete = assignmentOf(store, taskId, clock(), { principal: "operator", repos: null, includeUnplaced: true }, context.evidenceRoot)?.state === "complete";
7890
7891
  if (state === "failed") {
7891
7892
  if (json) {
7892
7893
  write(envelopeJson({ ok: false, command: "task checks", reason: "checks-failed", ...payload }));
7893
7894
  return EXIT.failed;
7894
7895
  }
7895
- write(`${words} failed on ${result.head.slice(0, 7)}${done?.exitCode == null ? "" : ` (exit ${done.exitCode})`}. The result shows the failure.`);
7896
+ write(`${words} failed on ${result.head.slice(0, 7)}${done?.exitCode == null ? "" : ` (exit ${done.exitCode})`}. ${complete ? "It stays Complete; it can't land until they pass on its exact commit." : "The result shows the failure."}`);
7896
7897
  return EXIT.failed;
7897
7898
  }
7898
7899
  return succeed(write, json, "task checks", payload, () => [
7899
- state === "passed" ? `${words} passed on ${result.head.slice(0, 7)}. The result's status is upgraded.`
7900
+ state === "passed" ? `${words} passed on ${result.head.slice(0, 7)}.${complete ? " It stays Complete." : ""}`
7900
7901
  : state === "running" ? `${words} are already running on ${result.head.slice(0, 7)}.`
7901
7902
  : state === "not-run" ? `${words} didn't run: ${done?.note ?? "see the result's log"}`
7902
7903
  : `${words} are queued on ${result.head.slice(0, 7)}.`,
@@ -8208,7 +8209,7 @@ function showTask(positional, context) {
8208
8209
  ...(detail.hold === null ? [] : [` held: ${detail.hold.reason}`]),
8209
8210
  ...detail.steering.slice(-5).map(one => ` note #${one.id} to the agent: ${one.words}`),
8210
8211
  ...(detail.claim === null ? [] : [` claimed by ${detail.claim.runner} until ${detail.claim.expiresAt}`]),
8211
- ...(detail.dispatch === null ? [] : [` dispatch: ${detail.dispatch.detail.startsWith(detail.dispatch.summary) ? detail.dispatch.detail : `${detail.dispatch.summary} — ${detail.dispatch.detail}`}`]),
8212
+ ...(detail.dispatch === null || shared?.headline === "Complete" ? [] : [` dispatch: ${detail.dispatch.detail.startsWith(detail.dispatch.summary) ? detail.dispatch.detail : `${detail.dispatch.summary} — ${detail.dispatch.detail}`}`]),
8212
8213
  ...(detail.control.kind === "none"
8213
8214
  ? []
8214
8215
  : detail.control.kind === "stop"
@@ -12056,7 +12057,7 @@ async function newTaskCommand(positional, flags, context) {
12056
12057
  return fail(write, json, command, "person-only", "Only a person starts a build this way. File it with `task add`.", EXIT.refused);
12057
12058
  if (local === null && (json || !personAtTerminal(context)))
12058
12059
  return fail(write, json, command, "person-only", "`task new` asks a person at a terminal. Use `task add` from a script or an agent.", EXIT.refused);
12059
- const { name, token } = credentialsFrom(flags, context);
12060
+ let { name, token } = credentialsFrom(flags, context);
12060
12061
  const passwordFree = token !== undefined && (local !== null || sessionStandsIn(store));
12061
12062
  const facts = { passwordless: local === null && passwordFree, localOwner: local !== null, freshAt: null, returnTo: "/" };
12062
12063
  const buildNow = (preview, digest) => fastStartBuild(store, { preview, digest, actor: name ?? "", via: local === null ? "cli" : "terminal-ui", password: facts,
@@ -12078,6 +12079,29 @@ async function newTaskCommand(positional, flags, context) {
12078
12079
  if (words === "" || repo === undefined)
12079
12080
  return fail(write, json, command, "usage", "`toolroll task new \"<what should change>\" --repo <project>`", EXIT.usage);
12080
12081
  const placed = canonicalProject(repo) ?? resolve(repo);
12082
+ if (local === null && (flags.has("token") || (!facts.passwordless && !passwordFreeOwner(store)))) {
12083
+ let given = flags.has("token") ? token : undefined;
12084
+ if (given === undefined) {
12085
+ const usual = name === undefined ? soloOperatorOf(store) : null;
12086
+ if (name === undefined) {
12087
+ const answered = await (context.easySeams?.ask ?? ask)(usual === null ? "username: " : `username [${usual}]: `);
12088
+ name = answered === "" && usual !== null ? usual : answered;
12089
+ }
12090
+ given = await (context.easySeams?.askHidden ?? askHidden)("password: ");
12091
+ }
12092
+ else if (name === undefined)
12093
+ name = soloOperatorOf(store) ?? undefined;
12094
+ if (name === undefined || name === "" || given === "") {
12095
+ write("Nothing was filed.");
12096
+ return EXIT.refused;
12097
+ }
12098
+ const person = name;
12099
+ const proved = verifyApproverByPassword(store, person, given, store.knownRepos().filter(one => store.accountCanAccess(person, one)));
12100
+ if (!proved.ok)
12101
+ return fail(write, json, command, "unauthenticated", "That username and password didn't work. Nothing was filed.", EXIT.refused);
12102
+ token = given;
12103
+ facts.freshAt = clock().getTime();
12104
+ }
12081
12105
  const prepared = name === undefined || token === undefined ? { eligible: false, reason: "password" }
12082
12106
  : await prepareFastStart(store, { actor: name, repo: placed, title: words, via: local === null ? "cli" : "terminal-ui", password: facts }, clock());
12083
12107
  const terms = prepared.eligible ? fastTermsLines(store, prepared.scope, placed) : [];
@@ -12088,7 +12112,7 @@ async function newTaskCommand(positional, flags, context) {
12088
12112
  }
12089
12113
  if (!prepared.eligible) {
12090
12114
  write(`${fastRefusalWords(prepared.reason)} Filing it for a plan.`);
12091
- return addTask([words], flags, context);
12115
+ return addTask([words], flags, context, true);
12092
12116
  }
12093
12117
  write("Build approves exactly this:");
12094
12118
  write("");
@@ -13196,7 +13220,8 @@ async function threadCommand(positional, flags, context) {
13196
13220
  return fail(write, json, command, done.reason, done.message, EXIT.refused);
13197
13221
  if (done.stopPending)
13198
13222
  await stopFlexibleThreadsEverywhere(store, { reason: "its owner ended the thread", thread, clock });
13199
- return succeed(write, json, command, { thread, already: done.already }, () => [done.already ? "This thread had already ended." : "Ended. You can still ship its work for a week; then its copy is tidied."]);
13223
+ const keeps = flexibleShipNeedsFor(store, thread) === null ? "ship its work, or save it as a branch," : `save its work as a branch (\`toolroll thread save ${thread.slice(0, 8)}\`)`;
13224
+ return succeed(write, json, command, { thread, already: done.already }, () => [done.already ? "This thread had already ended." : `Ended. You can still ${keeps} for a week; then its copy is tidied.`]);
13200
13225
  }
13201
13226
  if (verb === "save") {
13202
13227
  const saved = await saveFlexibleBranch(store, { thread, by: { name: who.name, generation: account.generation }, now: clock(), prove: proveNow });
@@ -13397,7 +13422,7 @@ async function landTaskCommand(positional, flags, context) {
13397
13422
  return fail(write, json, command, "usage", `--${key} is not a ${command} option.`, EXIT.usage);
13398
13423
  const id = positional[0] === undefined ? undefined : resolveTaskId(store, positional[0]);
13399
13424
  if (id === undefined || positional.length !== 1)
13400
- return fail(write, json, command, "usage", "Use `toolroll task land <id>` to see what landing does, then `--yes --key <key>` to land it.", EXIT.usage);
13425
+ return fail(write, json, command, "usage", "Use `toolroll task land <id>` to see what landing does, then `--yes --key <preview-key>` to land it.", EXIT.usage);
13401
13426
  const into = text(flags, "into"), undo = flags.get("undo") === true, yes = flags.get("yes") === true, key = text(flags, "key");
13402
13427
  if (flags.has("into") && into === undefined)
13403
13428
  return fail(write, json, command, "usage", "--into needs a branch name.", EXIT.usage);
@@ -13418,6 +13443,8 @@ async function landTaskCommand(positional, flags, context) {
13418
13443
  if (!("plan" in read))
13419
13444
  return succeed(write, json, command, { landed: read.landed }, () => [`${id} · Landed on ${read.landed.ref.replace(/^refs\/heads\//, "")} (${read.landed.commit.slice(0, 7)}).`]);
13420
13445
  const plan = read.plan;
13446
+ if (local === null && passwordFreeOwner(store))
13447
+ return succeed(write, json, command, { plan }, () => [...landingWords(plan), LAND_NEEDS_PASSWORD]);
13421
13448
  return succeed(write, json, command, { plan }, () => [...landingWords(plan),
13422
13449
  `To ${undo ? "undo it" : "land it"}: toolroll task land ${id}${into === undefined ? "" : ` --into ${into}`}${undo ? " --undo" : ""} --yes --key ${plan.key}${local === null ? " --as <you>" : ""}`,
13423
13450
  ...(local === null ? ["That asks for your Toolroll password."] : [])]);
@@ -13427,6 +13454,8 @@ async function landTaskCommand(positional, flags, context) {
13427
13454
  let authority;
13428
13455
  if (local !== null)
13429
13456
  authority = { kind: "local" };
13457
+ else if (passwordFreeOwner(store))
13458
+ return fail(write, json, command, "unauthenticated", LAND_NEEDS_PASSWORD, EXIT.refused);
13430
13459
  else {
13431
13460
  const acting = await askCredentials(flags, context);
13432
13461
  const ref = store.lookupRef(id);
@@ -13475,3 +13504,4 @@ function verifyRepoOf(store, raw) {
13475
13504
  }
13476
13505
  return absolute;
13477
13506
  }
13507
+ const LAND_NEEDS_PASSWORD = "Land it from the workbench (B) or the task page in the browser; from a shell it needs a Toolroll password (`toolroll password set`).";