toolroll 0.9.120 → 0.9.122

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 (40) hide show
  1. package/CHANGELOG.md +46 -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/coding-provider.js +3 -3
  8. package/dist/contracts/console-api.js +1 -0
  9. package/dist/direct-chat-fence.js +9 -3
  10. package/dist/direct-chat.js +82 -10
  11. package/dist/flexible-agents.js +16 -2
  12. package/dist/flexible-session.js +2 -1
  13. package/dist/flexible-thread.js +5 -1
  14. package/dist/install-method.js +1 -3
  15. package/dist/invoke.js +11 -9
  16. package/dist/lead-tools.js +3 -2
  17. package/dist/live-terminal.js +24 -3
  18. package/dist/local-owner.js +1 -0
  19. package/dist/planner.js +2 -0
  20. package/dist/project-delete.js +1 -1
  21. package/dist/project-skills.js +105 -17
  22. package/dist/result-follow-ups.js +2 -2
  23. package/dist/scout.js +2 -1
  24. package/dist/serve.js +8 -1
  25. package/dist/server/direct-chat.js +1 -0
  26. package/dist/server/render-release.js +27 -15
  27. package/dist/server/route-table.js +2 -0
  28. package/dist/server/settings.js +151 -3
  29. package/dist/server/terminals.js +3 -1
  30. package/dist/skill-library-schema.js +70 -0
  31. package/dist/skill-library.js +693 -0
  32. package/dist/skill-local-sync.js +334 -0
  33. package/dist/skills-manifest.js +6 -3
  34. package/dist/skills-ui.js +122 -1
  35. package/dist/store.js +22 -4
  36. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  37. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  38. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  39. package/dist/tui/linux-x64/toolroll-tui +0 -0
  40. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,52 @@ 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.122 — 2026-11-26
8
+
9
+ Share one pinned skill library across every project and agent, approve releases on one clear screen, and enjoy a cleaner Mac titlebar.
10
+
11
+ ### New
12
+
13
+ - **Global Skill Library:** add skills or import a pinned GitHub skill bundle (including 59+ skill packs) once in **Settings → Skills**, shared across all projects by default with whole-library or per-skill project opt-out.
14
+ - **Automatic skill bundle updates & rollback:** daily checks apply clean updates automatically, hold suspicious changes for review with reasons, and offer one-step rollback without touching your manual skills.
15
+ - **Also install on this computer:** mirror enabled global skills into your detected local Claude Code, Codex, and Gemini CLI folders in **Settings → Skills** without overwriting your own skills.
16
+ - **Unified skills across every agent:** tasks, coding sessions, Direct Chat (Claude, Codex, Gemini), Flexible threads, live terminals, and the lead all receive the same pinned skill set.
17
+
18
+ ### Changed
19
+
20
+ - **One-screen release sheet:** `/t/<id>/release` now shows a compact summary card with optional disclosure sections instead of two pages of boilerplate.
21
+ - **Solo-owner skill library management:** solo installs can manage the global skill library, bundles, project opt-outs, and local sync without a password prompt.
22
+
23
+ ### Fixed
24
+
25
+ - **Mac app titlebar alignment:** the top bar now sits cleanly on a single line beside the macOS window controls.
26
+ - **Workbench help layout:** `T`/`S` keys fit on one row with shorter Land labels.
27
+ - **Skill sandbox hardening:** custom evidence roots are denied across all launch kinds, and exact skill file digests and ancestor folders are re-verified at spawn time.
28
+ - **`toolroll update` on checkout-deployed planes:** updating a plane originally deployed from a local checkout now works cleanly.
29
+
30
+ ## 0.9.121 — 2026-11-26
31
+
32
+ Share one pinned skill library across every project and agent, approve releases on one clear screen, and enjoy a cleaner Mac titlebar.
33
+
34
+ ### New
35
+
36
+ - **Global Skill Library:** add skills or import a pinned GitHub skill bundle (including 59+ skill packs) once in **Settings → Skills**, shared across all projects by default with whole-library or per-skill project opt-out.
37
+ - **Automatic skill bundle updates & rollback:** daily checks apply clean updates automatically, hold suspicious changes for review with reasons, and offer one-step rollback without touching your manual skills.
38
+ - **Also install on this computer:** mirror enabled global skills into your detected local Claude Code, Codex, and Gemini CLI folders in **Settings → Skills** without overwriting your own skills.
39
+ - **Unified skills across every agent:** tasks, coding sessions, Direct Chat (Claude, Codex, Gemini), Flexible threads, live terminals, and the lead all receive the same pinned skill set.
40
+
41
+ ### Changed
42
+
43
+ - **One-screen release sheet:** `/t/<id>/release` now shows a compact summary card with optional disclosure sections instead of two pages of boilerplate.
44
+ - **Solo-owner skill library management:** solo installs can manage the global skill library, bundles, project opt-outs, and local sync without a password prompt.
45
+
46
+ ### Fixed
47
+
48
+ - **Mac app titlebar alignment:** the top bar now sits cleanly on a single line beside the macOS window controls.
49
+ - **Workbench help layout:** `T`/`S` keys fit on one row with shorter Land labels.
50
+ - **Skill sandbox hardening:** custom evidence roots are denied across all launch kinds, and exact skill file digests and ancestor folders are re-verified at spawn time.
51
+ - **`toolroll update` on checkout-deployed planes:** updating a plane originally deployed from a local checkout now works cleanly.
52
+
7
53
  ## 0.9.120 — 2026-11-25
8
54
 
9
55
  Landing puts exactly the change you reviewed on your branch, thread work can reach a local project, and Toolroll
package/README.md CHANGED
@@ -29,29 +29,6 @@ For Claude Code, Codex, and Gemini — using the subscriptions already on your m
29
29
 
30
30
  ## Quick start
31
31
 
32
- ### Native macOS app (recommended on Mac)
33
-
34
- Install the native SwiftUI macOS app and local CLI together via Homebrew Cask (macOS 14 Sonoma+, Apple Silicon & Intel):
35
-
36
- ```sh
37
- brew install --cask ap9000/toolroll/toolroll
38
- ```
39
-
40
- Or download the signed, notarized `Toolroll-<version>-macos.dmg` directly from [GitHub Releases](https://github.com/ap9000/toolroll/releases/latest) and drag **Toolroll.app** to Applications. On launch, Toolroll automatically discovers or starts your local engine — no manual terminal setup required.
41
-
42
- <details>
43
- <summary>Building the native Mac app from source</summary>
44
-
45
- ```sh
46
- cd mac && bash build-app.sh && open build/Toolroll.app
47
- # Or package a local .dmg:
48
- cd mac && bash build-dmg.sh
49
- ```
50
-
51
- See [macOS release & signing guide](https://github.com/ap9000/toolroll/blob/main/docs/guide/mac-release.md) for Developer ID signing, notarization, and Homebrew Cask automation.
52
-
53
- </details>
54
-
55
32
  ### CLI & Terminal Workbench (macOS or Linux)
56
33
 
57
34
  Requires Node.js 22.20+, git 2.41+, and Claude Code (`claude`), Codex (`codex`), or Gemini signed in on this computer. On Linux, also install the sandbox tools: `sudo apt update && sudo apt install bubblewrap socat ripgrep`.
@@ -76,6 +53,16 @@ npm uninstall -g standing-orders && npm install -g toolroll
76
53
 
77
54
  </details>
78
55
 
56
+ ### Native macOS app (macOS 14 Sonoma+)
57
+
58
+ Build and launch the native SwiftUI **Toolroll.app** from a checkout (requires Xcode 16 / Swift 6; automatically discovers or starts your local Toolroll engine):
59
+
60
+ ```sh
61
+ cd mac && bash build-app.sh && open build/Toolroll.app
62
+ ```
63
+
64
+ Signed, notarized `.dmg` downloads and Homebrew Cask distribution are configured in [macOS release & signing guide](https://github.com/ap9000/toolroll/blob/main/docs/guide/mac-release.md) and will publish automatically once Developer ID signing secrets are enabled.
65
+
79
66
  Toolroll opens locally with no password and no login file — on your own computer you're already in. Start a **Direct Chat** for fast interactive iteration in an isolated clone, or delegate a **Task** to build while you walk away. Every result returns **Ready** with its diff and real check status; press `⌘⏎` (Mac app) or `a` (terminal) to accept and ship, or send it back with notes. To explore without model calls or spend, run `toolroll demo`. More: [Getting started](https://github.com/ap9000/toolroll/blob/main/docs/guide/getting-started.md).
80
67
 
81
68
  ## The terminal loop
@@ -228,6 +228,10 @@ export function agentFence(options) {
228
228
  }
229
229
  for (const path of options.extra ?? [])
230
230
  fence.add(real(path));
231
+ if (typeof options.evidenceRoot === "string" && options.evidenceRoot !== "") {
232
+ fence.add(resolve(options.evidenceRoot));
233
+ fence.add(real(options.evidenceRoot));
234
+ }
231
235
  for (const path of options.boundary?.protectedShell ?? [])
232
236
  fence.add(real(path));
233
237
  const protectedPaths = new Set([...fence].flatMap(path => literal.has(path) ? [path] : path === runFolder || [RUNNER_PROCESS_DIR, "backups", SECRETS_DIR].includes(basename(path)) ? [path, real(path)] : [real(path)]));
@@ -784,17 +788,48 @@ export function flattened(fence, grants = NO_GRANTS, list = path => readdirSync(
784
788
  return { deny, readOnly: [...readOnly].filter(path => !denied.some(one => path === one || inside(path, one))) };
785
789
  }
786
790
  export function exactFileReads(grants) {
787
- return (grants.exactFiles ?? []).filter(path => grants.readable.includes(path) && regularAt(path));
791
+ return (grants.exactFiles ?? []).filter(path => grants.readable.includes(path) && exactEntryValid(path, grants));
788
792
  }
789
- function regularAt(path) {
793
+ function exactRegularDigest(path) {
794
+ let fd = null;
790
795
  try {
791
- const held = lstatSync(path);
792
- return held.isFile() && !held.isSymbolicLink() && realpathSync(path) === path;
796
+ const there = lstatSync(path);
797
+ if (!there.isFile() || there.isSymbolicLink())
798
+ return null;
799
+ fd = openSync(path, fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK);
800
+ const held = fstatSync(fd);
801
+ if (!held.isFile() || realpathSync(path) !== path)
802
+ return null;
803
+ return createHash("sha256").update(readFileSync(fd)).digest("hex");
804
+ }
805
+ catch {
806
+ return null;
807
+ }
808
+ finally {
809
+ if (fd !== null)
810
+ closeSync(fd);
811
+ }
812
+ }
813
+ function realFolderAt(folder) {
814
+ try {
815
+ const held = lstatSync(folder);
816
+ return held.isDirectory() && !held.isSymbolicLink() && realpathSync(folder) === folder;
793
817
  }
794
818
  catch {
795
819
  return false;
796
820
  }
797
821
  }
822
+ function exactEntryValid(path, grants) {
823
+ for (const folder of grants.exactFolders ?? []) {
824
+ if ((path === folder || inside(path, folder)) && !realFolderAt(folder))
825
+ return false;
826
+ }
827
+ const digest = exactRegularDigest(path);
828
+ if (digest === null)
829
+ return false;
830
+ const expected = grants.exactDigests?.[path];
831
+ return expected === undefined || digest === expected;
832
+ }
798
833
  export class ExactFileChanged extends Error {
799
834
  }
800
835
  export function claudeFenceSettings(fence, readOnly = []) {
@@ -843,7 +878,7 @@ export class LinuxFenceUnavailable extends Error {
843
878
  export function srtTermsOf(fence, grants = NO_GRANTS) {
844
879
  const denyRead = new Set(fence.map(real));
845
880
  const regular = new Set(grants.exactRegular ?? []);
846
- const allowRead = new Set(grants.readable.flatMap(path => regular.has(path) ? (regularAt(path) ? [path] : [])
881
+ const allowRead = new Set(grants.readable.flatMap(path => regular.has(path) ? (exactEntryValid(path, grants) ? [path] : [])
847
882
  : grants.exactFiles?.includes(path) === true ? [real(path)] : [real(path), real(dirname(path))]));
848
883
  const denyWrite = new Set([...fence, ...grants.readOnly].map(real));
849
884
  for (const path of grants.writeDenies ?? [])
@@ -972,13 +1007,26 @@ export function launchSandboxOf(profile) {
972
1007
  export function fenceFor(kind, ctx) {
973
1008
  const home = ctx.home === undefined ? {} : { home: ctx.home };
974
1009
  const storage = ctx.storage?.denies ?? protectedStorageDenies(ctx.home ?? homedir());
975
- const fence = agentFence({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, ...home, boundary: ctx.boundary, binding: ctx.binding, runFolders: ctx.runFolders, extra: [...ctx.extra ?? [], ...ctx.readDeny ?? []], protectedStorage: storage });
1010
+ const fence = agentFence({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, ...home, boundary: ctx.boundary, binding: ctx.binding, runFolders: ctx.runFolders, extra: [...ctx.extra ?? [], ...ctx.readDeny ?? []], ...(ctx.evidenceRoot === undefined ? {} : { evidenceRoot: ctx.evidenceRoot }), protectedStorage: storage });
976
1011
  const found = fenceGrants({ databaseFile: ctx.databaseFile, worktree: ctx.worktree, boundary: ctx.boundary, runFolders: ctx.runFolders, linked: ctx.linked ?? null, binding: ctx.binding, ...home, poolRoots: ctx.poolRoots });
977
1012
  const made = installDenied(found, ctx.worktree, ctx.home ?? homedir(), ctx.binding?.main ?? null);
978
1013
  const written = ctx.writes ?? null;
979
- const exact = [...new Set([...(ctx.exactFile == null ? [] : [ctx.exactFile]), ...ctx.exactFiles ?? []])].filter(path => {
980
- if (regularAt(path))
1014
+ const exactFolders = [...ctx.exactFolders ?? []];
1015
+ const rawExact = [...new Set([...(ctx.exactFile == null ? [] : [ctx.exactFile]), ...ctx.exactFiles ?? []])];
1016
+ if (rawExact.length > 0 && exactFolders.some(folder => !realFolderAt(folder))) {
1017
+ throw new ExactFileChanged("A skill folder this launch was to read changed before it started, so nothing was started.");
1018
+ }
1019
+ const exactDigests = {};
1020
+ const exact = rawExact.filter(path => {
1021
+ const digest = exactRegularDigest(path);
1022
+ if (digest !== null) {
1023
+ const expected = ctx.exactDigests?.[path];
1024
+ if (expected !== undefined && digest !== expected) {
1025
+ throw new ExactFileChanged("A file this launch was to read changed before it started, so nothing was started.");
1026
+ }
1027
+ exactDigests[path] = digest;
981
1028
  return true;
1029
+ }
982
1030
  try {
983
1031
  lstatSync(path);
984
1032
  }
@@ -990,7 +1038,7 @@ export function fenceFor(kind, ctx) {
990
1038
  const grants = {
991
1039
  ...made,
992
1040
  ...(written === null ? {} : { writes: written.writes, readOnly: [...new Set([...made.readOnly, ...written.readOnly])].sort() }),
993
- ...(exact.length === 0 ? {} : { readable: [...made.readable, ...exact], exactFiles: exact, exactRegular: exact, readOnly: [...new Set([...made.readOnly, ...(written?.readOnly ?? []), ...exact])].sort() }),
1041
+ ...(exact.length === 0 ? {} : { readable: [...made.readable, ...exact], exactFiles: exact, exactRegular: exact, exactDigests, ...(exactFolders.length === 0 ? {} : { exactFolders }), readOnly: [...new Set([...made.readOnly, ...(written?.readOnly ?? []), ...exact])].sort() }),
994
1042
  ...(ctx.network === undefined ? {} : { network: ctx.network }),
995
1043
  ...(ctx.machLookup === undefined || ctx.machLookup.length === 0 ? {} : { machLookup: [...ctx.machLookup] }),
996
1044
  ...(kind === "check" || (kind === "flow" && ctx.browser === true) ? { browser: true } : {}),
@@ -174,7 +174,7 @@ async function checkCohort(store, root, repo, cohort, deps) {
174
174
  return { conflict: false, tested, outcome: { ran: false, failure: "The project's approved setup changed before the check started." }, setupFailed: false };
175
175
  if (liveSetup !== null) {
176
176
  const shell = approvedCommandShell(liveSetup.command);
177
- const prepared = await runWithIsolatedDatabase(checkoutRunner(store, repo, checkout, guardedRunner, set.map(one => one.runId), setRan), shell.file, shell.args, { cwd: checkout, timeoutMs: liveSetup.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
177
+ const prepared = await runWithIsolatedDatabase(checkoutRunner(store, repo, checkout, guardedRunner, set.map(one => one.runId), setRan, undefined, root), shell.file, shell.args, { cwd: checkout, timeoutMs: liveSetup.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
178
178
  note(set, section(`${label} · approved project setup on ${tested.slice(0, 7)}`, liveSetup.command, prepared));
179
179
  proveSet(set);
180
180
  if (prepared.code !== 0 || prepared.timedOut || prepared.notFound)
@@ -184,7 +184,7 @@ async function checkCohort(store, root, repo, cohort, deps) {
184
184
  if (live === null || live.digest !== command.digest)
185
185
  return { conflict: false, tested, outcome: { ran: false, failure: "The approved check changed before it started." }, setupFailed: false };
186
186
  const shell = approvedCommandShell(live.command);
187
- const ran = await runWithIsolatedDatabase(checkoutRunner(store, repo, checkout, guardedRunner, set.map(one => one.runId), setRan), shell.file, shell.args, { cwd: checkout, timeoutMs: live.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
187
+ const ran = await runWithIsolatedDatabase(checkoutRunner(store, repo, checkout, guardedRunner, set.map(one => one.runId), setRan, undefined, root), shell.file, shell.args, { cwd: checkout, timeoutMs: live.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
188
188
  note(set, section(`${label} · full check on ${tested.slice(0, 7)}`, live.command, ran));
189
189
  proveSet(set);
190
190
  if (set.length === 1 && !ran.timedOut && !ran.notFound) {
package/dist/builder.js CHANGED
@@ -215,10 +215,10 @@ function buildCheckoutGit(given, worktree, mainCheckout = null) {
215
215
  return trusted !== null && at === trusted && at !== own && query ? given(file, args, options) : hardened(file, args, options);
216
216
  };
217
217
  }
218
- function commandRunner(store, runId, profile, inner) {
218
+ function commandRunner(store, runId, profile, inner, customEvidenceRoot = null) {
219
219
  const { access, network } = checkLaunchOf(store, runId, profile);
220
220
  store.stampRunCheckAccess(runId, access, network);
221
- return fencedCommands(store, runId, launchWritesOf(profile), inner, undefined, access, network ?? undefined, launchSandboxOf(profile));
221
+ return fencedCommands(store, runId, launchWritesOf(profile), inner, undefined, access, network ?? undefined, launchSandboxOf(profile), customEvidenceRoot);
222
222
  }
223
223
  export function checkLaunchOf(store, runId, profile, platform = process.platform) {
224
224
  const asked = checkAccessHere(profile.checkAccess ?? CHECK_ACCESS_DEFAULT, platform);
@@ -531,7 +531,7 @@ export async function build(store, request) {
531
531
  }
532
532
  const runSetup = request.setup ?? run;
533
533
  const shell = approvedCommandShell(setupWanted.command);
534
- const made = await underStopWatch(store, request.runId, () => runWithIsolatedDatabase(witnessedRunner(store, request.runId, request.clock ?? (() => now), commandRunner(store, request.runId, effective.profile, runSetup)), shell.file, shell.args, {
534
+ const made = await underStopWatch(store, request.runId, () => runWithIsolatedDatabase(witnessedRunner(store, request.runId, request.clock ?? (() => now), commandRunner(store, request.runId, effective.profile, runSetup, request.evidenceRoot ?? evidenceRoot(homedir()))), shell.file, shell.args, {
535
535
  cwd: worktree,
536
536
  timeoutMs: setupWanted.timeoutMs,
537
537
  processGroup: true,
@@ -1022,6 +1022,7 @@ export async function build(store, request) {
1022
1022
  network: launchNetworkOf(store, request.taskRef, effective.profile),
1023
1023
  writes: launchWritesOf(effective.profile), sandbox: launchSandboxOf(effective.profile),
1024
1024
  skills: projectSkills,
1025
+ evidenceRoot: root,
1025
1026
  ...(agent === undefined ? {} : { runner: agent }),
1026
1027
  onSpawn: (pid) => { spawned = true; request.onProviderSpawn?.(pid); },
1027
1028
  onStreamEvent: (event) => liveLog.observe(event),
@@ -1339,7 +1340,7 @@ export async function settleProviderOutcome(captured, result) {
1339
1340
  };
1340
1341
  if (!eligible())
1341
1342
  throw Error("The observation source or execution authority changed.");
1342
- const execute = (file, args, options) => underStopWatch(store, request.runId, () => runWithIsolatedDatabase(witnessedRunner(store, request.runId, clock, commandRunner(store, request.runId, captured.effective.profile, request.verify ?? run)), file, args, {
1343
+ const execute = (file, args, options) => underStopWatch(store, request.runId, () => runWithIsolatedDatabase(witnessedRunner(store, request.runId, clock, commandRunner(store, request.runId, captured.effective.profile, request.verify ?? run, root)), file, args, {
1343
1344
  ...options, processGroup: true, owner: runOwnerTag(store, request.runId), beforeSpawn: eligible,
1344
1345
  onSpawn: pid => request.onProviderSpawn?.(pid), envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST,
1345
1346
  }));
@@ -1767,7 +1768,7 @@ async function settleProof(captured, statArtifactId, sealedHead) {
1767
1768
  ? { code: 127, stdout: "", stderr: `Toolroll did not start the check: ${missing} wasn't found.`, timedOut: false, notFound: false }
1768
1769
  : await underStopWatch(store, runId, () => {
1769
1770
  loadWatch?.attemptStarted();
1770
- return runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, verifyRunner)), verifyShell.file, verifyShell.args, {
1771
+ return runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, verifyRunner, root)), verifyShell.file, verifyShell.args, {
1771
1772
  cwd: worktree,
1772
1773
  timeoutMs: loadWatch?.limitMs ?? configured.timeoutMs,
1773
1774
  processGroup: true,
@@ -1814,7 +1815,7 @@ async function settleProof(captured, statArtifactId, sealedHead) {
1814
1815
  detachShared(worktree, depsRoot);
1815
1816
  const label = "Own install · approved project setup (package.json or lockfile changed)";
1816
1817
  const setupShell = approvedCommandShell(live.command);
1817
- const installed = await underStopWatch(store, runId, () => runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, request.setup ?? run)), setupShell.file, setupShell.args, {
1818
+ const installed = await underStopWatch(store, runId, () => runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, request.setup ?? run, root)), setupShell.file, setupShell.args, {
1818
1819
  cwd: worktree,
1819
1820
  timeoutMs: live.timeoutMs,
1820
1821
  processGroup: true,
@@ -1903,7 +1904,7 @@ async function settleProof(captured, statArtifactId, sealedHead) {
1903
1904
  else {
1904
1905
  const setupRunner = request.setup ?? run;
1905
1906
  const setupShell = approvedCommandShell(liveBeforeSetup.command);
1906
- const restored = await underStopWatch(store, runId, () => runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, setupRunner)), setupShell.file, setupShell.args, {
1907
+ const restored = await underStopWatch(store, runId, () => runWithIsolatedDatabase(witnessedRunner(store, runId, now, commandRunner(store, runId, captured.effective.profile, setupRunner, root)), setupShell.file, setupShell.args, {
1907
1908
  cwd: worktree,
1908
1909
  timeoutMs: liveBeforeSetup.timeoutMs,
1909
1910
  processGroup: true,
@@ -2185,6 +2186,7 @@ async function resumeUnhandedWork(captured, sessionId) {
2185
2186
  network: launchNetworkOf(store, request.taskRef, effective.profile),
2186
2187
  writes: launchWritesOf(effective.profile), sandbox: launchSandboxOf(effective.profile),
2187
2188
  skills: captured.skills ?? null,
2189
+ evidenceRoot: request.evidenceRoot ?? evidenceRoot(homedir()),
2188
2190
  ...(agent === undefined ? {} : { runner: agent }),
2189
2191
  ...(request.onProviderSpawn === undefined ? {} : { onSpawn: request.onProviderSpawn }),
2190
2192
  clock,
@@ -2432,6 +2434,7 @@ async function ingestPark(args) {
2432
2434
  omitEnv: AGENT_ENV_DENYLIST,
2433
2435
  ...(args.profile === undefined ? {} : { network: launchNetworkOf(store, request.taskRef, args.profile), writes: launchWritesOf(args.profile), sandbox: launchSandboxOf(args.profile) }),
2434
2436
  skills: resumableRepair ? (args.skills ?? null) : null,
2437
+ evidenceRoot: request.evidenceRoot ?? evidenceRoot(homedir()),
2435
2438
  ...(agent === undefined ? {} : { runner: agent }),
2436
2439
  ...(request.onProviderSpawn === undefined ? {} : { onSpawn: request.onProviderSpawn }),
2437
2440
  clock,
@@ -6,9 +6,9 @@ import { openStore } from "./store.js";
6
6
  import { holdAutoPublish, autoPublishHeld, PUBLISH_ALLOWED_ACTION, PUBLISH_HELD_ACTION } from "./release-auto.js";
7
7
  import { revokeCoordinator } from "./coordinator.js";
8
8
  export const MAX_STAGE_BYTES = 128 * 1024 * 1024;
9
- const SUPPORTED_SCHEMA = 185;
10
- const SCHEMA_OBJECT_COUNT = 726;
11
- const SCHEMA_DIGEST = "8e589635cf648eef4a4c85fb12c614b3c004d983df639ccd2bf95b3005bf5791";
9
+ const SUPPORTED_SCHEMA = 186;
10
+ const SCHEMA_OBJECT_COUNT = 732;
11
+ const SCHEMA_DIGEST = "5bd44762a424f9dccb0f4adeac674b53c6978b253cdf0c74c349c321ba43a361";
12
12
  const INVENTORY = [
13
13
  ["person-credentials", "store.ts:revokeApiToken", "credential", true],
14
14
  ["lead-credentials", "store.ts:revokeLeadCredentials", "credential", true],
@@ -404,8 +404,8 @@ export function createCodexCodingProvider(options = {}) {
404
404
  close,
405
405
  };
406
406
  }
407
- export function codingSessionPermissions(store, worktreeRoot) {
408
- return input => sessionPermissions(store, { ...input, worktreeRoot });
407
+ export function codingSessionPermissions(store, worktreeRoot, evidenceRoot = null) {
408
+ return input => sessionPermissions(store, { ...input, worktreeRoot, evidenceRoot });
409
409
  }
410
410
  async function sessionPermissions(store, input) {
411
411
  const databaseFile = store.databaseFile();
@@ -420,7 +420,7 @@ async function sessionPermissions(store, input) {
420
420
  const skills = skillsGrant({ root: join(dirname(databaseFile), "coding-context"), manifest: input.skills ?? null });
421
421
  if (skills.problem !== null)
422
422
  return { problem: `${skills.problem}, so the session was not started.` };
423
- const launch = fenceFor("build", { databaseFile, worktree: input.worktree, boundary, binding, runFolders: runFolders(null), poolRoots, readDeny, extra: skills.deny, policy: FENCE_POLICY_CURRENT, storage, exactFiles: skills.files });
423
+ const launch = fenceFor("build", { databaseFile, worktree: input.worktree, boundary, binding, runFolders: runFolders(null), poolRoots, readDeny, evidenceRoot: input.evidenceRoot ?? null, extra: skills.deny, policy: FENCE_POLICY_CURRENT, storage, exactFiles: skills.files, exactDigests: skills.digests, exactFolders: skills.folders });
424
424
  return { config: codexFenceConfig(launch.fence, false, launch.fenceGrants) };
425
425
  }
426
426
  catch (error) {
@@ -69,6 +69,7 @@ export const CONSOLE_FORMS = {
69
69
  agentsCheck: formContract("POST /engine/agents/check", []),
70
70
  skillsRevise: formContract("POST /settings/skills/revise", ["run", "repo", "feedback", "nonce"]),
71
71
  skillsChange: formContract("POST /settings/skills/import, /settings/skills/change", ["repo", "identity", "revision", "method", "content", "files", "url", "action", "sha", "sample", "nonce", "restore"]),
72
+ skillsLibrary: formContract("POST /settings/skills/library", ["action", "repo", "url", "skill", "sha", "bundle", "tool", "enabled", "autoUpdate", "optedOut", "method", "content", "files", "revision"]),
72
73
  kit: formContract("POST /kits/<kit>/<act>", ["repo", "password"]),
73
74
  subagents: formContract("POST /settings/lead/subagents/new, /settings/lead/subagents/<id>/<part>, /settings/lead/subagents/questions/<id>/answer", ["choice", "text", "repo", "template", "name", "soul", "op", "id", "schedule", "tool", "state", "note", "model", "dailyTurns", "manager", "password", "backupPresent", "codexBackupModel"], { prefixes: ["use.", "undo.", "field.", "over."] }),
74
75
  galleryUse: formContract("POST /flows/new/<template>", ["repo", "send-result", "name", "intent", "previewed", "password"], { dynamic: true }),
@@ -5,6 +5,7 @@ import { fenceFor, FENCE_POLICY_CURRENT, linuxFenceAvailable, macosFenceAvailabl
5
5
  import { proxyEnv, repositoryEcosystems, resolveNetwork, startEgressProxy } from "./egress.js";
6
6
  import { readDenyPath } from "./project-sandbox.js";
7
7
  import { prepareProtectedStorage, storageRefusalOf } from "./protected-storage.js";
8
+ import { skillsGrant } from "./skills-manifest.js";
8
9
  import { poolRootOf } from "./worktree.js";
9
10
  const real = (path) => { try {
10
11
  return realpathSync(path);
@@ -12,7 +13,7 @@ const real = (path) => { try {
12
13
  catch {
13
14
  return path;
14
15
  } };
15
- export function directChatFence(store) {
16
+ export function directChatFence(store, evidenceRoot = null) {
16
17
  return async (input) => {
17
18
  if (!macosFenceAvailable() && !linuxFenceAvailable()) {
18
19
  return store.unfencedAgentsAllowed() ? { unfenced: true }
@@ -74,15 +75,20 @@ export function directChatFence(store) {
74
75
  const boundary = taskBoundary({ worktree: clone, provider: "claude", binding: null, policy: FENCE_POLICY_CURRENT, storage });
75
76
  const allowed = writeAllowlist({ provider: "claude", home, worktree: clone, binding: null, launchFolder: temp, cache: null });
76
77
  const gitReadOnly = ["config", "hooks", "info"].map(name => join(gitDir, name));
78
+ const skills = skillsGrant({ root: join(input.stateRoot, "direct-chat", "skills"), manifest: input.skills ?? null });
77
79
  const made = fenceFor("build", {
78
80
  databaseFile, worktree: clone, boundary, binding: null, runFolders: runFolders(temp), poolRoots, storage, policy: FENCE_POLICY_CURRENT, provider: "claude",
79
- extra: [repo, ...allowed.deny],
81
+ evidenceRoot,
82
+ extra: [repo, ...allowed.deny, ...skills.deny],
83
+ exactFiles: skills.files,
84
+ exactDigests: skills.digests,
85
+ exactFolders: skills.folders,
80
86
  readDeny: store.projectSandbox(input.repo).readDeny.map(one => readDenyPath(one, home)),
81
87
  writes: { writes: { subpaths: [...allowed.writes.subpaths, gitDir], prefixes: allowed.writes.prefixes }, readOnly: [...allowed.readOnly, ...gitReadOnly] },
82
88
  network: { mode: "allowlist", proxyPort: proxy.port, brokerPorts: [], loopback: policy.loopback, socketRoots: [clone, temp], token: proxy.secret },
83
89
  });
84
90
  const grants = { ...made.fenceGrants, readDenyOnly: [...made.fenceGrants.readDenyOnly ?? [], chats],
85
- readable: [...made.fenceGrants.readable, clone, gitDir], exactFiles: [...made.fenceGrants.exactFiles ?? [], clone, gitDir] };
91
+ readable: [...made.fenceGrants.readable, clone, gitDir, ...skills.files], exactFiles: [...made.fenceGrants.exactFiles ?? [], clone, gitDir, ...skills.files] };
86
92
  return { launch: { ...made, fenceGrants: grants }, temp, env: { ...proxyEnv(proxy, policy.loopback), TMPDIR: temp, TMP: temp, TEMP: temp, CLAUDE_CODE_TMPDIR: temp }, close };
87
93
  }
88
94
  catch (error) {
@@ -17,6 +17,8 @@ import { captureNewWorkspaceArtifacts, extractBase64ImagesFromLine, getDirectCha
17
17
  import { assertManagedClonePath, assertTrustedCloneGit, cloneIsolatedRepoAsync, pinnedConfigBackupPath, repairCloneGitBinding, runTrustedCloneGit, } from "./direct-chat-git.js";
18
18
  import { applyMainDirtyPatch, cloneSafeNodeModulesAsync } from "./direct-chat-workspace.js";
19
19
  import { defaultContextWindowFor, normalizeDirectChatEffort, resolveAgyModelForEffort } from "./direct-chat-catalog.js";
20
+ import { effectiveSkillsForRepo, materializeProjectSkills } from "./project-skills.js";
21
+ import { formatSkillsBrief } from "./skill-library.js";
20
22
  export const DIRECT_CHAT_PROVIDERS = Object.freeze(["claude", "codex", "gemini"]);
21
23
  export function isDirectChatProvider(value) {
22
24
  return value === "claude" || value === "codex" || value === "gemini";
@@ -568,6 +570,9 @@ export function buildTurnPrompt(input) {
568
570
  const parts = [];
569
571
  if (input.isFirstTurnForProvider) {
570
572
  parts.push(`[Workspace boundary: you are working in an isolated local clone on branch ${input.branch} with no remote. Work only inside this directory; never push, force-reset, or delete files outside this workspace. Leave your changes in the working tree — do not run git commit or git push, because Toolroll commits and ships snapshots for you.]`);
573
+ if (input.skillsPrompt && input.skillsPrompt.trim() !== "") {
574
+ parts.push(input.skillsPrompt.trim());
575
+ }
571
576
  if (input.priorTurns.length > 0) {
572
577
  const slice = input.priorTurns.slice(-HANDOFF_MAX_TURNS);
573
578
  let handoff = "[Context handed off from earlier turns in this chat:]\n";
@@ -728,6 +733,7 @@ export class DirectChatHost {
728
733
  spawnTurnFn;
729
734
  fenceTurnFn;
730
735
  turnFences = new Map();
736
+ turnSkillDirs = new Map();
731
737
  prepareCloneFn;
732
738
  readDiffFn;
733
739
  hasCustomReadDiff;
@@ -751,7 +757,7 @@ export class DirectChatHost {
751
757
  this.stopGraceMs = seams.stopGraceMs ?? DEFAULT_STOP_GRACE_MS;
752
758
  this.locateBinary = seams.locateBinary ?? (provider => locateDirectChatBinary(provider));
753
759
  this.spawnTurnFn = seams.spawnTurn ?? (input => defaultSpawnTurn(this.custody, input));
754
- this.fenceTurnFn = seams.fenceTurn ?? (seams.spawnTurn === undefined ? directChatFence(store) : null);
760
+ this.fenceTurnFn = seams.fenceTurn ?? (seams.spawnTurn === undefined ? directChatFence(store, seams.evidenceRoot ?? null) : null);
755
761
  this.prepareCloneFn = seams.prepareClone ?? defaultPrepareCloneAsync;
756
762
  this.hasCustomReadDiff = seams.readDiff !== undefined;
757
763
  this.readDiffFn = seams.readDiff ?? defaultReadDiff;
@@ -782,6 +788,13 @@ export class DirectChatHost {
782
788
  }
783
789
  for (const turnId of [...this.turnFences.keys()])
784
790
  this.closeTurnFence(turnId);
791
+ for (const [turnId, dir] of [...this.turnSkillDirs.entries()]) {
792
+ this.turnSkillDirs.delete(turnId);
793
+ try {
794
+ rmSync(dir, { recursive: true, force: true });
795
+ }
796
+ catch { }
797
+ }
785
798
  }
786
799
  closeTurnFence(turnId) {
787
800
  const close = this.turnFences.get(turnId);
@@ -1208,33 +1221,71 @@ export class DirectChatHost {
1208
1221
  const thread = this.mapThread(this.store.handle.prepare(`SELECT * FROM direct_chat_thread WHERE id = ?`).get(threadId));
1209
1222
  return { ok: true, thread, turn: started.turn, created: true };
1210
1223
  }
1224
+ prepareTurnSkills(repo, label) {
1225
+ try {
1226
+ const snapshot = effectiveSkillsForRepo(this.store, repo);
1227
+ if (snapshot.packages.length === 0)
1228
+ return { dir: null, prompt: "", manifest: null };
1229
+ const materialized = materializeProjectSkills(snapshot, join(this.stateRoot, "direct-chat", "skills"), label);
1230
+ return {
1231
+ dir: materialized.directory,
1232
+ prompt: formatSkillsBrief(materialized.catalog, "Skills supplied for this Direct Chat. "),
1233
+ manifest: materialized.manifest,
1234
+ };
1235
+ }
1236
+ catch {
1237
+ return { dir: null, prompt: "", manifest: null };
1238
+ }
1239
+ }
1211
1240
  async sendMessage(input) {
1212
1241
  const thread = HEX32.test(input.threadId) ? this.getThreadRecord(input.owner, input.threadId) : null;
1213
1242
  if (thread === null || thread.provider !== "claude" || thread.isLegacy || this.fenceTurnFn === null)
1214
- return this.sendMessageNow(input, null);
1243
+ return this.sendMessageNow(input, null, null);
1215
1244
  if (thread.gitDir === null)
1216
1245
  return { ok: false, status: 409, error: "This chat has no isolated Git folder, so its agent can't be fenced. Start a new chat instead." };
1217
1246
  const known = this.store.handle.prepare(`SELECT 1 FROM direct_chat_turn WHERE thread_id = ? AND request_id = ?`).get(thread.id, input.requestId);
1218
1247
  if (known !== undefined)
1219
- return this.sendMessageNow(input, null);
1220
- const made = await this.fenceTurnFn({ stateRoot: this.stateRoot, repo: thread.repo, clone: thread.clonePath, gitDir: thread.gitDir });
1221
- if ("problem" in made)
1248
+ return this.sendMessageNow(input, null, null);
1249
+ const preparedSkills = this.prepareTurnSkills(thread.repo, `dc-${randomBytes(6).toString("hex")}`);
1250
+ const made = await this.fenceTurnFn({ stateRoot: this.stateRoot, repo: thread.repo, clone: thread.clonePath, gitDir: thread.gitDir, skills: preparedSkills.manifest });
1251
+ if ("problem" in made) {
1252
+ if (preparedSkills.dir !== null) {
1253
+ try {
1254
+ rmSync(preparedSkills.dir, { recursive: true, force: true });
1255
+ }
1256
+ catch { }
1257
+ }
1222
1258
  return { ok: false, status: 409, error: made.problem };
1259
+ }
1223
1260
  const fence = "unfenced" in made ? null : made;
1224
1261
  let started;
1225
1262
  try {
1226
- started = this.sendMessageNow(input, fence);
1263
+ started = this.sendMessageNow(input, fence, preparedSkills);
1227
1264
  }
1228
1265
  catch (error) {
1229
1266
  if (fence !== null)
1230
1267
  await fence.close();
1268
+ if (preparedSkills.dir !== null) {
1269
+ try {
1270
+ rmSync(preparedSkills.dir, { recursive: true, force: true });
1271
+ }
1272
+ catch { }
1273
+ }
1231
1274
  throw error;
1232
1275
  }
1233
- if (fence !== null && (!started.ok || !started.created))
1234
- await fence.close();
1276
+ if (!started.ok || !started.created) {
1277
+ if (fence !== null)
1278
+ await fence.close();
1279
+ if (preparedSkills.dir !== null) {
1280
+ try {
1281
+ rmSync(preparedSkills.dir, { recursive: true, force: true });
1282
+ }
1283
+ catch { }
1284
+ }
1285
+ }
1235
1286
  return started;
1236
1287
  }
1237
- sendMessageNow(input, fence) {
1288
+ sendMessageNow(input, fence, prebuiltSkills) {
1238
1289
  if (!HEX32.test(input.threadId) || !HEX32.test(input.requestId)) {
1239
1290
  return { ok: false, status: 400, error: "Invalid thread or request id." };
1240
1291
  }
@@ -1272,11 +1323,13 @@ export class DirectChatHost {
1272
1323
  const logPath = join(this.stateRoot, "direct-chat", "turns", thread.id, `${turnId}.jsonl`);
1273
1324
  const stderrPath = join(this.stateRoot, "direct-chat", "turns", thread.id, `${turnId}.stderr`);
1274
1325
  const isFirstForProvider = thread.providerSessionId === null || thread.providerSessionId === "";
1326
+ const turnSkills = prebuiltSkills ?? this.prepareTurnSkills(thread.repo, `dc-${turnId.slice(0, 12)}`);
1275
1327
  const effectivePrompt = buildTurnPrompt({
1276
1328
  userPrompt: trimmed,
1277
1329
  branch: thread.branch,
1278
1330
  isFirstTurnForProvider: isFirstForProvider,
1279
1331
  priorTurns: priorTurns.filter(t => t.assistantText !== "" || t.userPrompt !== ""),
1332
+ ...(turnSkills.prompt !== "" ? { skillsPrompt: turnSkills.prompt } : {}),
1280
1333
  });
1281
1334
  const args = buildProviderCommand({
1282
1335
  provider: thread.provider,
@@ -1299,17 +1352,26 @@ export class DirectChatHost {
1299
1352
  `).run(turnId, thread.id, nextSeq, input.requestId, trimmed, switchedFrom, logPath, stderrPath, this.bootId(), stamp);
1300
1353
  let launched;
1301
1354
  try {
1355
+ const childEnv = buildSanitizedChildEnv(thread.provider);
1356
+ if (turnSkills.dir !== null)
1357
+ childEnv["TOOLROLL_SKILLS_DIR"] = turnSkills.dir;
1302
1358
  launched = this.spawnTurnFn({
1303
1359
  binary,
1304
1360
  args,
1305
1361
  cwd: managed.realClone,
1306
- env: buildSanitizedChildEnv(thread.provider),
1362
+ env: childEnv,
1307
1363
  logPath,
1308
1364
  stderrPath,
1309
1365
  ...(fence === null ? {} : { fence }),
1310
1366
  });
1311
1367
  }
1312
1368
  catch (error) {
1369
+ if (prebuiltSkills === null && turnSkills.dir !== null) {
1370
+ try {
1371
+ rmSync(turnSkills.dir, { recursive: true, force: true });
1372
+ }
1373
+ catch { }
1374
+ }
1313
1375
  const msg = `Could not launch ${thread.provider}: ${error instanceof Error ? error.message : String(error)}`;
1314
1376
  this.store.handle.prepare(`
1315
1377
  UPDATE direct_chat_turn SET status = 'failed', error_text = ?, finished_at = ? WHERE id = ?
@@ -1323,6 +1385,8 @@ export class DirectChatHost {
1323
1385
  }
1324
1386
  if (fence !== null)
1325
1387
  this.turnFences.set(turnId, fence.close);
1388
+ if (turnSkills.dir !== null)
1389
+ this.turnSkillDirs.set(turnId, turnSkills.dir);
1326
1390
  this.store.handle.prepare(`
1327
1391
  UPDATE direct_chat_turn SET pid = ?, start_identity = ?, pgid = ? WHERE id = ?
1328
1392
  `).run(launched.pid, launched.startIdentity, launched.pgid, turnId);
@@ -1886,6 +1950,14 @@ export class DirectChatHost {
1886
1950
  }
1887
1951
  cleanupTurnState(turnId) {
1888
1952
  this.closeTurnFence(turnId);
1953
+ const skillDir = this.turnSkillDirs.get(turnId);
1954
+ if (skillDir !== undefined) {
1955
+ this.turnSkillDirs.delete(turnId);
1956
+ try {
1957
+ rmSync(skillDir, { recursive: true, force: true });
1958
+ }
1959
+ catch { }
1960
+ }
1889
1961
  this.sawTerminalByTurn.delete(turnId);
1890
1962
  this.resetOnNextTextDelta.delete(turnId);
1891
1963
  this.preTurnImages.delete(turnId);