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.
- package/CHANGELOG.md +46 -0
- package/README.md +10 -23
- package/dist/agent-fence.js +57 -9
- package/dist/batch-checks.js +2 -2
- package/dist/builder.js +10 -7
- package/dist/central-recovery-stage.js +3 -3
- package/dist/coding-provider.js +3 -3
- package/dist/contracts/console-api.js +1 -0
- package/dist/direct-chat-fence.js +9 -3
- package/dist/direct-chat.js +82 -10
- package/dist/flexible-agents.js +16 -2
- package/dist/flexible-session.js +2 -1
- package/dist/flexible-thread.js +5 -1
- package/dist/install-method.js +1 -3
- package/dist/invoke.js +11 -9
- package/dist/lead-tools.js +3 -2
- package/dist/live-terminal.js +24 -3
- package/dist/local-owner.js +1 -0
- package/dist/planner.js +2 -0
- package/dist/project-delete.js +1 -1
- package/dist/project-skills.js +105 -17
- package/dist/result-follow-ups.js +2 -2
- package/dist/scout.js +2 -1
- package/dist/serve.js +8 -1
- package/dist/server/direct-chat.js +1 -0
- package/dist/server/render-release.js +27 -15
- package/dist/server/route-table.js +2 -0
- package/dist/server/settings.js +151 -3
- package/dist/server/terminals.js +3 -1
- package/dist/skill-library-schema.js +70 -0
- package/dist/skill-library.js +693 -0
- package/dist/skill-local-sync.js +334 -0
- package/dist/skills-manifest.js +6 -3
- package/dist/skills-ui.js +122 -1
- package/dist/store.js +22 -4
- package/dist/tui/darwin-arm64/toolroll-tui +0 -0
- package/dist/tui/darwin-x64/toolroll-tui +0 -0
- package/dist/tui/linux-arm64/toolroll-tui +0 -0
- package/dist/tui/linux-x64/toolroll-tui +0 -0
- package/package.json +2 -1
package/dist/flexible-agents.js
CHANGED
|
@@ -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))
|
package/dist/flexible-session.js
CHANGED
|
@@ -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
|
|
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`);
|
package/dist/flexible-thread.js
CHANGED
|
@@ -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(
|
|
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();
|
package/dist/install-method.js
CHANGED
|
@@ -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) {
|
package/dist/lead-tools.js
CHANGED
|
@@ -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
|
|
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: {
|
package/dist/live-terminal.js
CHANGED
|
@@ -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));
|
package/dist/local-owner.js
CHANGED
package/dist/planner.js
CHANGED
|
@@ -637,6 +637,7 @@ export async function plan(store, request) {
|
|
|
637
637
|
idleTimeoutMs: timeoutMs,
|
|
638
638
|
omitEnv: AGENT_ENV_DENYLIST,
|
|
639
639
|
skills: projectSkills,
|
|
640
|
+
evidenceRoot: root,
|
|
640
641
|
...(agent === undefined ? {} : { runner: agent }),
|
|
641
642
|
...(request.onProviderSpawn === undefined ? {} : { onSpawn: request.onProviderSpawn }),
|
|
642
643
|
clock,
|
|
@@ -783,6 +784,7 @@ export async function plan(store, request) {
|
|
|
783
784
|
timeoutMs: STRUCTURED_REPAIR_TIMEOUT_MS,
|
|
784
785
|
omitEnv: AGENT_ENV_DENYLIST,
|
|
785
786
|
skills: projectSkills,
|
|
787
|
+
evidenceRoot: root,
|
|
786
788
|
...(agent === undefined ? {} : { runner: agent }),
|
|
787
789
|
...(request.onProviderSpawn === undefined ? {} : { onSpawn: request.onProviderSpawn }),
|
|
788
790
|
clock,
|
package/dist/project-delete.js
CHANGED
|
@@ -302,7 +302,7 @@ function deleteRows(store, repo, d, now) {
|
|
|
302
302
|
del(table, `${column} = ?`, repo);
|
|
303
303
|
rows += forgetProjectModels(store, repo, now);
|
|
304
304
|
del("project_mute", "repo = ?", repo);
|
|
305
|
-
for (const table of ["knowledge_change", "project_identity_carry", "project_skill_change", "memory_gap", "memory_proposal", "memory_rejection", "memory_session", "memory_search", "mode_rail", "side_spend", "watch_episode", "worktree", "coordinator_proposal", "lead_commitment"])
|
|
305
|
+
for (const table of ["knowledge_change", "project_identity_carry", "project_skill_change", "skill_project_opt_out", "memory_gap", "memory_proposal", "memory_rejection", "memory_session", "memory_search", "mode_rail", "side_spend", "watch_episode", "worktree", "coordinator_proposal", "lead_commitment"])
|
|
306
306
|
del(table, "repo = ?", repo);
|
|
307
307
|
del("watch_lease", "repo = ? AND expires_at <= ?", repo, now.toISOString());
|
|
308
308
|
const flexibleThreads = `thread IN (SELECT id FROM flexible_thread WHERE repo = ? AND state IN ('removed', 'failed'))`;
|
package/dist/project-skills.js
CHANGED
|
@@ -9,6 +9,7 @@ import { fileTaskProposal } from "./proposal.js";
|
|
|
9
9
|
import { TEXT_LIMITS } from "./text-limits.js";
|
|
10
10
|
import { contractError } from "./contracts/contract.js";
|
|
11
11
|
import { SKILL_COUNTS, SKILL_LIMITS, readSkillsSnapshotPayload, savedSkillPackageSchema, savedSkillsSnapshotSchema, skillPackageSchema, skillSelectionSchema, } from "./contracts/project-skills.js";
|
|
12
|
+
import { LIBRARY_LIMITS, currentLibrary, enabledLibrarySkills, listSkillBundles, mergeProjectAndLibrarySkills, projectSkillOptOuts, } from "./skill-library.js";
|
|
12
13
|
export { SKILL_LIMITS };
|
|
13
14
|
export { checkSkillsManifest } from "./skills-manifest.js";
|
|
14
15
|
export const SKILLS_SCHEMA = `
|
|
@@ -208,10 +209,39 @@ export function skillsView(store, repo, actor) {
|
|
|
208
209
|
export function selectProjectSkills(store, repo, actor) {
|
|
209
210
|
const { identity, accepted } = admit(store, repo, actor);
|
|
210
211
|
const value = current(store, repo, accepted);
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
212
|
+
const projectPackages = Object.values(value.selection).filter(choice => choice.enabled).map(choice => packageOf(store, choice.sha));
|
|
213
|
+
if (projectPackages.length > SKILL_LIMITS.enabled || Buffer.byteLength(JSON.stringify(projectPackages)) > SKILL_LIMITS.selectionBytes)
|
|
213
214
|
throw Error('Enable up to 8 skills, totaling at most 2 MB.');
|
|
214
|
-
|
|
215
|
+
const { libraryRevision, packages } = mergeProjectAndLibrarySkills(store, repo, value.selection);
|
|
216
|
+
if (packages.length > LIBRARY_LIMITS.maxSkills || Buffer.byteLength(JSON.stringify(packages)) > LIBRARY_LIMITS.maxBundleBytes)
|
|
217
|
+
throw Error('Too many enabled skills.');
|
|
218
|
+
return { version: 1, revision: Math.max(value.revision, libraryRevision), identity, inheritedFrom: null, test: false, packages };
|
|
219
|
+
}
|
|
220
|
+
export function effectiveSkillsForRepo(store, repo) {
|
|
221
|
+
if (!store.schemaCurrent()) {
|
|
222
|
+
return { version: 1, revision: 0, identity: "unconfigured", inheritedFrom: null, test: false, packages: [] };
|
|
223
|
+
}
|
|
224
|
+
let projectSelection = {};
|
|
225
|
+
let revision = 0;
|
|
226
|
+
let identity = "unconfigured";
|
|
227
|
+
try {
|
|
228
|
+
const saved = store.handle
|
|
229
|
+
.prepare("SELECT identity FROM project_skill_change WHERE repo=? ORDER BY revision DESC LIMIT 1")
|
|
230
|
+
.get(repo);
|
|
231
|
+
if (saved) {
|
|
232
|
+
const accepted = acceptedIdentities(store, repo);
|
|
233
|
+
if (accepted.has(String(saved["identity"]))) {
|
|
234
|
+
const value = current(store, repo, accepted);
|
|
235
|
+
revision = value.revision;
|
|
236
|
+
identity = learningIdentity(repo);
|
|
237
|
+
projectSelection = value.selection;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
}
|
|
243
|
+
const { libraryRevision, packages } = mergeProjectAndLibrarySkills(store, repo, projectSelection);
|
|
244
|
+
return { version: 1, revision: Math.max(revision, libraryRevision), identity, inheritedFrom: null, test: false, packages };
|
|
215
245
|
}
|
|
216
246
|
export function skillsVersion(store, repo, actor, revision) {
|
|
217
247
|
const { accepted } = admit(store, repo, actor);
|
|
@@ -287,21 +317,64 @@ export function changeSkills(store, args, now = new Date()) {
|
|
|
287
317
|
}
|
|
288
318
|
export function conversationSkills(store, repo, actor, sha) {
|
|
289
319
|
const v = skillsView(store, repo, actor);
|
|
290
|
-
const
|
|
291
|
-
|
|
320
|
+
const globalLib = currentLibrary(store);
|
|
321
|
+
const optOuts = projectSkillOptOuts(store, repo);
|
|
322
|
+
const globalEnabled = new Map(enabledLibrarySkills(store, repo).packages.map((p) => [p.sha, p]));
|
|
323
|
+
const combinedBySha = new Map();
|
|
324
|
+
for (const p of v.library) {
|
|
325
|
+
const enabled = v.selection[p.name]?.sha === p.sha &&
|
|
326
|
+
v.selection[p.name]?.enabled === true;
|
|
327
|
+
combinedBySha.set(p.sha, { pkg: p, scope: "project", enabled, optedOut: false });
|
|
328
|
+
}
|
|
329
|
+
for (const [name, choice] of Object.entries(globalLib.selection)) {
|
|
330
|
+
const existing = combinedBySha.get(choice.sha);
|
|
331
|
+
const isOptedOut = optOuts.all || optOuts.names.has(name);
|
|
332
|
+
const activeHere = globalEnabled.has(choice.sha);
|
|
333
|
+
if (existing) {
|
|
334
|
+
if (!v.selection[name] || v.selection[name]?.sha !== choice.sha) {
|
|
335
|
+
existing.scope = "global";
|
|
336
|
+
existing.optedOut = isOptedOut;
|
|
337
|
+
}
|
|
338
|
+
if (activeHere)
|
|
339
|
+
existing.enabled = true;
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
try {
|
|
343
|
+
const pkg = packageOf(store, choice.sha);
|
|
344
|
+
combinedBySha.set(choice.sha, { pkg, scope: "global", enabled: activeHere, optedOut: isOptedOut });
|
|
345
|
+
}
|
|
346
|
+
catch {
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
const entries = [...combinedBySha.values()]
|
|
351
|
+
.sort((a, b) => a.pkg.name.localeCompare(b.pkg.name))
|
|
352
|
+
.filter((entry) => !sha || entry.pkg.sha === sha);
|
|
353
|
+
if (sha && !entries.length)
|
|
292
354
|
throw Error("Choose a skill from the library.");
|
|
355
|
+
const bundles = listSkillBundles(store).map((b) => ({
|
|
356
|
+
id: b.id,
|
|
357
|
+
repo: `${b.owner}/${b.repoName}`,
|
|
358
|
+
commit: b.pinnedCommit.slice(0, 12),
|
|
359
|
+
skillCount: b.skillNames.length,
|
|
360
|
+
autoUpdate: b.autoUpdate,
|
|
361
|
+
heldUpdate: b.heldCommit ? { commit: b.heldCommit.slice(0, 12), reason: b.heldReason } : null,
|
|
362
|
+
}));
|
|
293
363
|
return {
|
|
294
|
-
revision: v.revision,
|
|
364
|
+
revision: Math.max(v.revision, globalLib.revision),
|
|
365
|
+
libraryOptedOut: optOuts.all,
|
|
366
|
+
bundles,
|
|
295
367
|
history: v.history.map(({ revision, enabled }) => ({ revision, enabled })),
|
|
296
|
-
skills:
|
|
368
|
+
skills: entries.map(({ pkg: p, scope, enabled, optedOut }) => ({
|
|
297
369
|
name: p.name,
|
|
298
370
|
description: p.description,
|
|
299
371
|
sha: p.sha,
|
|
300
372
|
source: p.source,
|
|
301
373
|
requirements: p.requirements,
|
|
302
374
|
warnings: p.warnings,
|
|
303
|
-
|
|
304
|
-
|
|
375
|
+
scope,
|
|
376
|
+
optedOut,
|
|
377
|
+
enabled,
|
|
305
378
|
...(sha
|
|
306
379
|
? {
|
|
307
380
|
instructions: Buffer.from(p.files.find((f) => f.path === "SKILL.md").base64, "base64").toString("utf8"),
|
|
@@ -309,7 +382,7 @@ export function conversationSkills(store, repo, actor, sha) {
|
|
|
309
382
|
}
|
|
310
383
|
: {}),
|
|
311
384
|
})),
|
|
312
|
-
notice: "Managed skills for future worker runs. Usage is not implied by enablement. Use shared action proposals
|
|
385
|
+
notice: "Managed skills for future worker runs, Direct Chat, threads, and terminals. Usage is not implied by enablement. Use shared action proposals or Settings → Skills to manage. Skills cannot grant tools or change approvals.",
|
|
313
386
|
};
|
|
314
387
|
}
|
|
315
388
|
export function readSkillsSnapshot(store, runId) {
|
|
@@ -391,15 +464,30 @@ export function freezeSkills(store, runId) {
|
|
|
391
464
|
inheritedFrom: null,
|
|
392
465
|
packages: [packageOf(store, String(test["package"]))],
|
|
393
466
|
};
|
|
394
|
-
else
|
|
395
|
-
|
|
467
|
+
else {
|
|
468
|
+
let projectSelection = {};
|
|
469
|
+
let revision = 0;
|
|
470
|
+
let identity = "unconfigured";
|
|
471
|
+
if (saved && accepted.has(String(saved["identity"]))) {
|
|
472
|
+
const value = current(store, ref.repo, accepted);
|
|
473
|
+
revision = value.revision;
|
|
474
|
+
identity = learningIdentity(ref.repo);
|
|
475
|
+
projectSelection = value.selection;
|
|
476
|
+
}
|
|
477
|
+
const { libraryRevision, packages: merged } = mergeProjectAndLibrarySkills(store, ref.repo, projectSelection);
|
|
478
|
+
if (merged.length > 0 && identity === "unconfigured") {
|
|
479
|
+
try {
|
|
480
|
+
identity = learningIdentity(ref.repo);
|
|
481
|
+
}
|
|
482
|
+
catch {
|
|
483
|
+
identity = "global-library";
|
|
484
|
+
}
|
|
485
|
+
}
|
|
396
486
|
snapshot = {
|
|
397
487
|
...snapshot,
|
|
398
|
-
revision:
|
|
399
|
-
identity
|
|
400
|
-
packages:
|
|
401
|
-
.filter((c) => c.enabled)
|
|
402
|
-
.map((c) => packageOf(store, c.sha)),
|
|
488
|
+
revision: Math.max(revision, libraryRevision),
|
|
489
|
+
identity,
|
|
490
|
+
packages: merged,
|
|
403
491
|
};
|
|
404
492
|
}
|
|
405
493
|
}
|
|
@@ -262,7 +262,7 @@ export async function runFollowUpCheck(store, root, request, deps = {}) {
|
|
|
262
262
|
let ready = true;
|
|
263
263
|
if (setup !== null) {
|
|
264
264
|
const shell = approvedCommandShell(setup.command);
|
|
265
|
-
const prepared = await runWithIsolatedDatabase(launched(checkoutRunner(store, target.repo, checkout, guardedRunner, [runId], level => ranAt.push(level))), shell.file, shell.args, { cwd: checkout, timeoutMs: setup.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
|
|
265
|
+
const prepared = await runWithIsolatedDatabase(launched(checkoutRunner(store, target.repo, checkout, guardedRunner, [runId], level => ranAt.push(level), undefined, root)), shell.file, shell.args, { cwd: checkout, timeoutMs: setup.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
|
|
266
266
|
note("Approved project setup", setup.command, prepared);
|
|
267
267
|
proveLaunch();
|
|
268
268
|
if (prepared.code !== 0 || prepared.timedOut || prepared.notFound) {
|
|
@@ -277,7 +277,7 @@ export async function runFollowUpCheck(store, root, request, deps = {}) {
|
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
279
279
|
const shell = approvedCommandShell(live.command);
|
|
280
|
-
const ran = await runWithIsolatedDatabase(launched(checkoutRunner(store, target.repo, checkout, guardedRunner, [runId], level => ranAt.push(level))), shell.file, shell.args, { cwd: checkout, timeoutMs: live.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
|
|
280
|
+
const ran = await runWithIsolatedDatabase(launched(checkoutRunner(store, target.repo, checkout, guardedRunner, [runId], level => ranAt.push(level), undefined, root)), shell.file, shell.args, { cwd: checkout, timeoutMs: live.timeoutMs, processGroup: true, envAllowlist: SETUP_ENV_ALLOWLIST, omitEnv: SETUP_ENV_DENYLIST });
|
|
281
281
|
note(`${CHECK_LEVEL_WORDS[target.level]} check`, live.command, ran);
|
|
282
282
|
proveLaunch();
|
|
283
283
|
if (!ran.timedOut && !ran.notFound) {
|
package/dist/scout.js
CHANGED
|
@@ -310,6 +310,7 @@ async function scoutWith(store, request, outputDir) {
|
|
|
310
310
|
...(proxy === null ? {} : { env: proxyEnv }),
|
|
311
311
|
...(proxy === null ? {} : { network: { via: [portOf(proxy.url), ...(browserServer === null ? [] : [portOf(browserServer.url)])] } }),
|
|
312
312
|
skills: projectSkills,
|
|
313
|
+
evidenceRoot: root,
|
|
313
314
|
...(agent === undefined ? {} : { runner: agent }),
|
|
314
315
|
...(request.onProviderSpawn === undefined ? {} : { onSpawn: request.onProviderSpawn }),
|
|
315
316
|
clock,
|
|
@@ -467,7 +468,7 @@ async function scoutWith(store, request, outputDir) {
|
|
|
467
468
|
skipPermissions: false,
|
|
468
469
|
resumeSession: session,
|
|
469
470
|
...(structured ? { jsonSchema: SCOUT_OUTPUT_JSON_SCHEMA } : {}),
|
|
470
|
-
}, { cwd: worktree, timeoutMs: SHORTEN_TIMEOUT_MS, omitEnv: AGENT_ENV_DENYLIST, skills: projectSkills, ...(agent === undefined ? {} : { runner: agent }), clock });
|
|
471
|
+
}, { cwd: worktree, timeoutMs: SHORTEN_TIMEOUT_MS, omitEnv: AGENT_ENV_DENYLIST, skills: projectSkills, evidenceRoot: root, ...(agent === undefined ? {} : { runner: agent }), clock });
|
|
471
472
|
if (spoken.kind === "refused" || spoken.outcome.timedOut || spoken.outcome.code !== 0 || !heartbeat(store, request.leaseId, clock()).ok)
|
|
472
473
|
return null;
|
|
473
474
|
const head = await git(GIT, ["--no-optional-locks", "rev-parse", "HEAD"], { cwd: worktree });
|
package/dist/serve.js
CHANGED
|
@@ -118,6 +118,7 @@ import { createDirectChatHandlers } from './server/direct-chat.js';
|
|
|
118
118
|
import { declareSoloOnUpgrade, sessionStandsIn } from './install-mode.js';
|
|
119
119
|
import { keepTypedFields, openProjectFor, settingsCrumbs } from './settings-kit.js';
|
|
120
120
|
import { createSweepHandlers } from './server/sweeps.js';
|
|
121
|
+
import { sweepSkillBundleUpdates } from './skill-library.js';
|
|
121
122
|
import { createFlowsHandlers } from './server/flows.js';
|
|
122
123
|
import { createPagesHandlers } from './server/pages.js';
|
|
123
124
|
import { createPeopleHandlers } from './server/people-tokens.js';
|
|
@@ -203,7 +204,7 @@ function buildDecisionServer(options, leaveRehearsal) {
|
|
|
203
204
|
const database = store.handle.prepare('PRAGMA database_list').all().find(row => row['name'] === 'main')?.['file'];
|
|
204
205
|
if (typeof database === 'string' && database !== '') {
|
|
205
206
|
try {
|
|
206
|
-
coding = new CodingWorkspace({ database: `${database}.coding.sqlite`, worktreeRoot: join(dirname(database), 'coding-worktrees'), permissions: codingSessionPermissions(store, join(dirname(database), 'coding-worktrees')), admissionPaused: () => updateAdmissionPaused(store.raw()), authorize: (actor, repo) => codingActorAllowed(actor) && codingProjectAllowed(repo), context: input => prepareCodingContext(store, { ...input, root: join(dirname(database), 'coding-context') }) });
|
|
207
|
+
coding = new CodingWorkspace({ database: `${database}.coding.sqlite`, worktreeRoot: join(dirname(database), 'coding-worktrees'), permissions: codingSessionPermissions(store, join(dirname(database), 'coding-worktrees'), evidenceRoot ?? null), admissionPaused: () => updateAdmissionPaused(store.raw()), authorize: (actor, repo) => codingActorAllowed(actor) && codingProjectAllowed(repo), context: input => prepareCodingContext(store, { ...input, root: join(dirname(database), 'coding-context') }) });
|
|
207
208
|
}
|
|
208
209
|
catch (error) {
|
|
209
210
|
codingProblem = error instanceof Error ? error.message : 'The coding workspace could not open.';
|
|
@@ -1776,6 +1777,12 @@ function buildDecisionServer(options, leaveRehearsal) {
|
|
|
1776
1777
|
const last = lastChecks.known("release");
|
|
1777
1778
|
if (lastChecks.due("release", last !== null && "problem" in last.value ? 60_000 : 15 * 60_000))
|
|
1778
1779
|
waits.push(checkRelease());
|
|
1780
|
+
if (!store.isDemo() && store.schemaCurrent() && lastChecks.due("skill-bundles", 24 * 60 * 60_000)) {
|
|
1781
|
+
waits.push(lastChecks.run("skill-bundles", async () => {
|
|
1782
|
+
await sweepSkillBundleUpdates(store, { actor: "toolroll", now: clock() });
|
|
1783
|
+
return true;
|
|
1784
|
+
}));
|
|
1785
|
+
}
|
|
1779
1786
|
}
|
|
1780
1787
|
if (firstRunStepsNow(clock()) !== null && !store.hasAnyWork()) {
|
|
1781
1788
|
for (const repo of managedRepos()) {
|
|
@@ -26,6 +26,7 @@ export function createDirectChatHandlers(runtime, deps) {
|
|
|
26
26
|
const stateRoot = deps.seams?.stateRoot ?? (dbFile && dbFile !== ":memory:" ? dirname(dbFile) : join(tmpdir(), "toolroll-direct-chat"));
|
|
27
27
|
const host = new DirectChatHost(store, {
|
|
28
28
|
stateRoot,
|
|
29
|
+
evidenceRoot: runtime.evidenceRoot ?? null,
|
|
29
30
|
...deps.seams,
|
|
30
31
|
onNotify: note => {
|
|
31
32
|
deps.seams?.onNotify?.(note);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { html,
|
|
2
|
-
import { ciWords
|
|
1
|
+
import { html, postForm } from "../html.js";
|
|
2
|
+
import { ciWords } from "../release-approval.js";
|
|
3
|
+
import { releaseAccessWords } from "../release-card.js";
|
|
3
4
|
import { checkAccessWords } from "../check-access.js";
|
|
4
5
|
import { projectName } from "../project.js";
|
|
5
6
|
import { screen } from "./chrome.js";
|
|
@@ -15,23 +16,36 @@ function changesHtml(card) {
|
|
|
15
16
|
const head = changes.baseline === null ? `Pull request #${id.pr}'s commits` : `Since the last verified release (${changes.baseline.slice(0, 7)})`;
|
|
16
17
|
const list = changes.commits.length === 0 ? note("No commits.")
|
|
17
18
|
: html `<ul class="k-list">${changes.commits.map(one => html `<li><code class="k-mono">${one.sha.slice(0, 7)}</code> ${one.subject}</li>`)}</ul>`;
|
|
18
|
-
return disclose(`What changed: ${changes.commits.length} commit${changes.commits.length === 1 ? "" : "s"}`, html `<p class="k-note">${head}</p>${list}
|
|
19
|
+
return disclose(`What changed: ${changes.commits.length} commit${changes.commits.length === 1 ? "" : "s"}`, html `<p class="k-note">${head}</p>${list}`, changes.commits.length > 0 && changes.commits.length <= 5);
|
|
20
|
+
}
|
|
21
|
+
function releaseSummaryHtml(card) {
|
|
22
|
+
const id = card.seal.identity;
|
|
23
|
+
const carries = card.seal.kind === "terms" && card.seal.terms.policy.carry;
|
|
24
|
+
const checkKind = card.seal.kind === "check" && card.seal.purpose.check === "deploy"
|
|
25
|
+
? "Deploy check (~4 min)"
|
|
26
|
+
: checkAccessWords(id.access);
|
|
27
|
+
const accessWarning = releaseAccessWords(id.access);
|
|
28
|
+
const rows = [
|
|
29
|
+
["Commit", html `<code class="k-mono" title="${id.approvedSha}">${id.approvedSha.slice(0, 7)}</code> · <code class="k-mono">${id.branch}</code>`],
|
|
30
|
+
["Check", checkKind],
|
|
31
|
+
["On approve", `Runs the release check on ${id.approvedSha.slice(0, 7)}, then deploys, merges, tags and publishes once GitHub CI and the check pass.`],
|
|
32
|
+
["Later commits", carries ? "Later commits that only change tests, docs or the changelog carry this approval." : "Every later commit asks again."],
|
|
33
|
+
];
|
|
34
|
+
return html `${accessWarning === null ? "" : notice(accessWarning)}${facts(rows)}`;
|
|
19
35
|
}
|
|
20
36
|
function termsHtml(card) {
|
|
21
|
-
|
|
37
|
+
const isRelease = (key) => key.startsWith("release.") || key.startsWith("releaseCheck.");
|
|
38
|
+
const releaseTerms = card.terms.filter(line => isRelease(line.key));
|
|
39
|
+
const scopeTerms = card.terms.filter(line => !isRelease(line.key));
|
|
40
|
+
const renderRows = (lines) => facts(lines.map(line => [line.label, html `<span class="k-mono">${line.value}</span>`]));
|
|
41
|
+
const inner = html `${releaseTerms.length === 0 ? "" : html `<h3>Release</h3>${renderRows(releaseTerms)}`}${scopeTerms.length === 0 ? "" : html `<h3>Underlying scope & settings</h3>${renderRows(scopeTerms)}`}`;
|
|
42
|
+
return disclose(`Every term (${card.terms.length})`, inner, false);
|
|
22
43
|
}
|
|
23
44
|
export function releaseSheetPage(chrome, data) {
|
|
24
45
|
const card = data.card;
|
|
25
46
|
const id = card.seal.identity;
|
|
26
47
|
const title = `Release ${id.packageVersion}`;
|
|
27
|
-
const
|
|
28
|
-
["Pull request", `#${id.pr}`],
|
|
29
|
-
["Branch", html `<code class="k-mono">${id.branch}</code>`],
|
|
30
|
-
["Commit", html `<code class="k-mono">${id.approvedSha}</code>`],
|
|
31
|
-
["Project", projectName(id.repo)],
|
|
32
|
-
["Checks", checkAccessWords(id.access)],
|
|
33
|
-
]);
|
|
34
|
-
const consequence = releaseConsequence(card);
|
|
48
|
+
const summaryHtml = releaseSummaryHtml(card);
|
|
35
49
|
const ci = ciWords(card.ci, id.approvedSha);
|
|
36
50
|
const notRunning = card.stopped === null ? "" : infoLine(html `The release isn't running (it stopped at ${card.stopped.step}). After you approve, run <code class="k-mono">toolroll release ${id.branch}</code>.`);
|
|
37
51
|
let status, text, acts, terms, wait = false;
|
|
@@ -60,12 +74,10 @@ export function releaseSheetPage(chrome, data) {
|
|
|
60
74
|
text = ci;
|
|
61
75
|
acts = data.nonce === "" ? "" : approveForm({
|
|
62
76
|
action: `${taskHref(card.taskId)}/approve`, kind: "standard", facts: data.facts, label: "Approve release", primary: true,
|
|
63
|
-
before: html `<section class="k-sec"><h3>What approving does</h3>${joinHtml(consequence.map(line => html `<p class="k-note">${line}</p>`))}${termsHtml(card)}</section>`,
|
|
64
77
|
form: { hidden: { nonce: data.nonce, digest: card.digest, sheet: "release" }, attrs: { class: "k-form", "data-release-approve": card.digest } },
|
|
65
78
|
});
|
|
66
79
|
terms = approvalTerms("standard", data.facts);
|
|
67
80
|
}
|
|
68
|
-
const
|
|
69
|
-
const body = doc(docHeader({ title, back: [taskHref(card.taskId), "Task"], meta: `${projectName(id.repo)} · pull request #${id.pr}` }), data.problem === null ? "" : notice(data.problem), summary, changesHtml(card), slots({ wait, attrs: { "data-release-sheet": card.taskId }, status, text, acts, terms }), notRunning, data.held == null ? "" : html `<section class="k-sec" data-release-held><h3>Held after its merge</h3><p class="k-note">${data.held}.</p>${postForm(`${taskHref(card.taskId)}/release/go-on`, html `${field({ id: "go-on-password", label: "Your password", control: input({ id: "go-on-password", name: "password", type: "password", attrs: { required: true, autocomplete: "current-password" } }) })}${btn("Let it go on", { variant: "primary", type: "submit" })}`, { attrs: { class: "k-form" } })}</section>`, formShown ? "" : html `<section class="k-sec"><h3>What approving does</h3>${joinHtml(consequence.map(line => html `<p class="k-note">${line}</p>`))}</section>${termsHtml(card)}`);
|
|
81
|
+
const body = doc(docHeader({ title, back: [taskHref(card.taskId), "Task"], meta: `${projectName(id.repo)} · pull request #${id.pr}` }), data.problem === null ? "" : notice(data.problem), slots({ wait, attrs: { "data-release-sheet": card.taskId }, status, text, body: summaryHtml, acts, terms }), notRunning, data.held == null ? "" : html `<section class="k-sec" data-release-held><h3>Held after its merge</h3><p class="k-note">${data.held}.</p>${postForm(`${taskHref(card.taskId)}/release/go-on`, html `${field({ id: "go-on-password", label: "Your password", control: input({ id: "go-on-password", name: "password", type: "password", attrs: { required: true, autocomplete: "current-password" } }) })}${btn("Let it go on", { variant: "primary", type: "submit" })}`, { attrs: { class: "k-form" } })}</section>`, changesHtml(card), termsHtml(card));
|
|
70
82
|
return screen(title, body, { chrome });
|
|
71
83
|
}
|