toolroll 0.9.127 → 0.9.128

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/dist/demo.js CHANGED
@@ -921,7 +921,7 @@ export function createDemoSandbox(now) {
921
921
  { window: "seven_day", usedPercent: 83, windowMinutes: 10_080, resetsAt: later(62), reached: false },
922
922
  ] }, now);
923
923
  store.recordProviderLimits({ provider: "codex", plan: "pro", windows: [{ window: "seven_day", usedPercent: 12, windowMinutes: 10_080, resetsAt: later(130), reached: false }] }, now);
924
- store.setBudget({ scope: "project", key: repos.web, limitMicrousd: 25_000_000, hardStop: true }, seed.login.name, now);
924
+ store.setBudget({ scope: "project", key: realpathSync(repos.web), limitMicrousd: 25_000_000, hardStop: true }, seed.login.name, now);
925
925
  const passwordFile = join(sandbox, "demo-login.txt");
926
926
  writeFileSync(passwordFile, `name: ${seed.login.name}\npassword: ${seed.login.password}\n`, { mode: 0o600 });
927
927
  const lead = createDemoLead({ store, repos, evidenceRoot, approver: seed.login.name, token: seed.login.password });
@@ -109,8 +109,9 @@
109
109
  /* A native select in the same family, with the chevron: 36px (sm 28px in a toolbar). */
110
110
  .k-selw { position: relative; display: inline-block; min-width: 0; max-width: 100%; }
111
111
  .k-selw::after { content: ""; position: absolute; right: 13px; top: 50%; margin-top: -5px; width: 6px; height: 6px; border: solid var(--so-muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); pointer-events: none; }
112
- .k-sel.k-sel { appearance: none; -webkit-appearance: none; height: 36px; min-height: 0; padding: 0 32px 0 12px; line-height: 1; text-overflow: ellipsis; cursor: pointer; }
113
- .k-selw.sm .k-sel { height: 28px; border-radius: 999px; font: 500 12.5px/1 var(--so-font-sans); padding: 0 26px 0 11px; }
112
+ .k-sel.k-sel { appearance: none; -webkit-appearance: none; -moz-appearance: none; background-image: none; height: 36px; min-height: 0; padding: 0 32px 0 12px; line-height: 34px; text-overflow: ellipsis; cursor: pointer; }
113
+ .k-sel.k-sel::picker-icon { display: none; }
114
+ .k-selw.sm .k-sel { height: 28px; border-radius: 999px; font: 500 12.5px/26px var(--so-font-sans); padding: 0 26px 0 11px; }
114
115
  .k-selw.sm::after { right: 11px; }
115
116
  .k-selw.wide { display: block; width: 100%; }
116
117
  /* A select drawn as a pill chip (a composer's project): filled, no box, works without script. */
@@ -226,8 +227,9 @@
226
227
  .k-tb-ctx > .k-seg + .k-seg { margin-left: 8px; }
227
228
  /* Phone header: menu or back · title · one trailing action. Hidden at a desk. */
228
229
  .k-ph { display: none; }
229
- /* Reading pages: one 760px column, a back link and the doc header. */
230
+ /* Reading pages: one 760px column, expanding to 960px on wide desks when reviewing code diffs. */
230
231
  .k-doc { box-sizing: border-box; width: 100%; max-width: 760px; margin: 0 auto; padding: 22px 28px 120px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-content: start; }
232
+ @media (min-width: 1100px) { .k-doc:has(.diff-review) { max-width: 960px; } }
231
233
  .k-backlink { display: inline-flex; align-items: center; gap: 6px; color: var(--so-muted); font: var(--so-typography-label); justify-self: start; min-height: 24px; text-decoration: none; }
232
234
  .k-dh { display: flex; align-items: flex-start; gap: 6px; }
233
235
  .k-dh > div { flex: 1; display: grid; gap: 6px; min-width: 0; }
@@ -564,6 +566,7 @@ html:not(.k-js) .k-composer:focus-within, html.k-kbd .k-composer:focus-within {
564
566
  .k-btn-icon, .k-btn-sm.k-btn-icon { width: 44px; padding: 0; }
565
567
  .k-input.k-input, .k-textarea.k-textarea, .k-sel.k-sel { font-size: 16px; }
566
568
  .k-input.k-input, .k-pop .k-input.k-input, .k-sel.k-sel, .k-selw.sm .k-sel { height: 44px; }
569
+ .k-sel.k-sel, .k-selw.sm .k-sel { line-height: 42px; }
567
570
  .k-selw::after { right: 13px; }
568
571
  .k-seg > a, .k-seg > button { height: 44px; font-size: 13.5px; }
569
572
  .k-seg.k-seg-icons > a, .k-seg.k-seg-icons > button { min-width: 44px; justify-content: center; }
package/dist/models-ui.js CHANGED
@@ -75,7 +75,7 @@ function choiceSection(view, manage, previewing) {
75
75
  const presetItems = view.presets.map(one => ({ value: one.name, label: one.label, text: `${one.words}${one.recommended ? " Recommended." : ""}${one.inUse ? " In use." : ""}` }));
76
76
  const presets = manage
77
77
  ? html `<form method="get" action="/settings/models" class="models-presets" id="models-preset">${view.scope.value === "installation" ? "" : html `<input type="hidden" name="scope" value="${view.scope.value}">`}\
78
- ${radios({ name: "preset", legend: "Preset", current, items: presetItems })}${acts(btn("Review changes", { variant: previewing ? "outline" : "primary", type: "submit", docked: !previewing }))}</form>`
78
+ ${radios({ name: "preset", legend: "Preset", current, items: presetItems })}${acts(btn("Review changes", { variant: previewing || current === "" ? "outline" : "primary", type: "submit", docked: !previewing && current !== "" }))}</form>`
79
79
  : factList(view.presets.map(one => [one.label, `${one.words}${one.inUse ? " In use." : ""}`]));
80
80
  const newer = view.newer.length === 0 ? "" : html `${group("Newer models")}${view.newer.map(one => formRow(one.name, `Newer than ${one.from}, used by ${one.roles}.`, manage ? btn("Switch to it", { sm: true, href: `/settings/models?switch=${encodeURIComponent(one.from)}&to=${encodeURIComponent(one.to)}${scopeQuery(view)}` }) : html ``, "inline"))}`;
81
81
  const main = view.roles.filter(role => !role.tier), tiers = view.roles.filter(role => role.tier);
@@ -109,7 +109,10 @@ function sizingSection(view) {
109
109
  function recentSection(view) {
110
110
  if (view.recent.length === 0)
111
111
  return "";
112
- return sec("recent", "Recent work", "", view.recent.map(one => formRow(one.role, `Chosen ${one.chosen} → ran on ${one.ranOn}`, html `<a class="k-link k-mono" href="/t/${encodeURIComponent(one.taskId)}">${one.taskId}</a>`, "inline")));
112
+ return sec("recent", "Recent work", "", view.recent.map(one => {
113
+ const detail = one.ranOn === "not reported" ? `Set to ${one.chosen} · actual model not reported` : `Set to ${one.chosen} → ran on ${one.ranOn}`;
114
+ return formRow(one.role, detail, html `<a class="k-link k-mono" href="/t/${encodeURIComponent(one.taskId)}">${one.taskId}</a>`, "inline");
115
+ }));
113
116
  }
114
117
  function suggestedSection(view) {
115
118
  const s = view.suggested;
package/dist/operate.js CHANGED
@@ -289,6 +289,21 @@ import { loginFileOf, migrateLegacyLogin, removeStaleSavedLogin, savedLoginFile,
289
289
  import { runWords } from "./needs-you.js";
290
290
  export const EXIT = { ok: 0, failed: 1, usage: 2, refused: 3 };
291
291
  const STATES = ["queued", "running", "done", "failed", "cancelled"];
292
+ export const TASK_HELP = `toolroll task — create, inspect, and ship tasks
293
+
294
+ toolroll task add "<change>" --repo . queue a task (--plan to review plan first; --checks quick|full|off)
295
+ toolroll task list [--view <v>] list tasks (needs-you, ready, running, queued, completed, archived)
296
+ toolroll task show <id> current state, diff summary, checks, and next action
297
+ toolroll task wait <id> [--timeout <s>] wait until this attempt finishes or needs you
298
+ toolroll task accept <id> accept a Ready result
299
+ toolroll task revise <id> --note "<text>" send a result back with feedback (catches up with main automatically)
300
+ toolroll task land <id> fast-forward or merge an accepted result onto your local branch
301
+ toolroll task stop <id> stop a running build
302
+ toolroll task retry <id> retry a failed or stopped task
303
+ toolroll task archive <id...> put tasks away (history kept; restore with \`task restore\`)
304
+ toolroll task evidence <id> [--html] export a task's evidence pack
305
+
306
+ Every command supports --json. Everything else: \`toolroll internals\`.`;
292
307
  export const OPERATE_HELP = `toolroll — operating the queue
293
308
 
294
309
  toolroll status running, queued, ready results, release check and plan windows
@@ -855,11 +870,12 @@ async function runOperateLocal(command, argv, write, options = {}) {
855
870
  const { positional, flags } = parsed;
856
871
  const json = flags.has("json");
857
872
  if (flags.has("help")) {
873
+ const helpText = command === "task" && positional.length === 0 ? TASK_HELP : OPERATE_HELP;
858
874
  if (json) {
859
- write(envelopeJson({ ok: true, command: "help", help: OPERATE_HELP }));
875
+ write(envelopeJson({ ok: true, command: "help", help: helpText }));
860
876
  }
861
877
  else {
862
- write(OPERATE_HELP);
878
+ write(helpText);
863
879
  }
864
880
  return EXIT.ok;
865
881
  }
@@ -7638,7 +7654,7 @@ async function waitTask(positional, flags, context) {
7638
7654
  function taskCommand(positional, flags, context) {
7639
7655
  const [action, ...rest] = positional;
7640
7656
  if (action === undefined) {
7641
- context.write(OPERATE_HELP);
7657
+ context.write(TASK_HELP);
7642
7658
  return EXIT.ok;
7643
7659
  }
7644
7660
  const actor = currentActor();
@@ -195,7 +195,13 @@ export function createSettingsHandlers(runtime) {
195
195
  const items = spendItems(store.handle, current.from, current.to);
196
196
  const saved = store.budgets();
197
197
  const budgets = budgetStates(saved, items);
198
- const has = (scope, key) => saved.some(one => one.scope === scope && one.key === key);
198
+ const canonicalRepoKey = (value) => { try {
199
+ return realpathSync(value);
200
+ }
201
+ catch {
202
+ return value;
203
+ } };
204
+ const has = (scope, key) => saved.some(one => one.scope === scope && (scope === "project" ? canonicalRepoKey(one.key) === canonicalRepoKey(key) : one.key === key));
199
205
  const spentFor = (scope, key) => budgetStates([{ id: 0, scope, key, limitMicrousd: 1, hardStop: false, updatedBy: "", updatedAt: "" }], items)[0].spentMicrousd;
200
206
  const unlimited = [
201
207
  ...(has("installation", "*") ? [] : [{ target: "installation:*", label: "Everything", budget: null, spentMicrousd: spentFor("installation", "*") }]),
@@ -2540,7 +2546,7 @@ ${postForm("/settings/chat-approval/save", html `\
2540
2546
  classifier: readProviderKey("openrouter", providerHome) !== null ? "A quick AI check (Jev, through your OpenRouter key) reads its title and description." : `A quick AI check (${SIZING_CLAUDE_MODEL}, on this computer's Claude sign-in) reads its title and description.` },
2541
2547
  routing: `When a task is filed and Claude has used over ${HEADROOM_FIVE_HOUR_LIMIT}% of its 5-hour window or ${HEADROOM_WEEKLY_LIMIT}% of its week, ${alsoSet ? "the other provider you set for that size is preferred if it has more room" : "an alternate provider with more room would be preferred, but none is set"}; with no room anywhere, the first choice is kept. This is a preference at filing time, not a limit.`,
2542
2548
  recent: recentRuns(store).map(one => ({ taskId: one.taskId, runId: one.runId, role: one.role,
2543
- chosen: one.chosen === null ? "its default" : /^(opus|sonnet|haiku|fable)$/.test(one.chosen) ? `floating ${one.chosen}` : one.chosen,
2549
+ chosen: one.chosen === null ? "its default" : /^(opus|sonnet|haiku|fable)$/.test(one.chosen) ? `${one.chosen} (latest)` : one.chosen,
2544
2550
  ranOn: one.ranOn ?? "not reported" })),
2545
2551
  waiting: canManage ? store.scopesAwaitingApproval(null, 10, admissionList()).map(one => ({ taskId: one.taskId, title: one.title })) : [],
2546
2552
  suggested: suggestedView(repo, projects, query.get("suggestion"), now),
package/dist/skills-ui.js CHANGED
@@ -1,8 +1,13 @@
1
1
  import { randomUUID } from "node:crypto";
2
+ import { homedir } from "node:os";
2
3
  import { whenUtc } from "./when-html.js";
3
4
  import { html, joinHtml, postForm } from "./html.js";
4
5
  import { acts, btn, chip, disclose, facts, formRow, input, note, notice, select, settingsRecord, settingsSection, textarea } from "./server/kit.js";
5
6
  import { plural } from "./design/kit.js";
7
+ function prettyHomePath(target) {
8
+ const home = homedir();
9
+ return home && (target === home || target.startsWith(`${home}/`)) ? `~${target.slice(home.length)}` : target;
10
+ }
6
11
  const fields = (data) => Object.fromEntries(Object.entries(data).map(([k, v]) => [k, String(v ?? "")]));
7
12
  export const SKILLS_CSS = `.skills{max-width:780px;min-width:0;overflow-wrap:anywhere}.skills h2{font-size:1.1rem}.skills .card{padding:18px;margin:14px 0;min-width:0}.skills form,.skills label{display:grid;gap:10px}.skills input,.skills textarea,.skills select{box-sizing:border-box;width:100%;max-width:100%;min-width:0}.skills textarea{resize:vertical;min-height:130px}.skills button{justify-self:start;white-space:nowrap;min-height:44px}.skills summary{cursor:pointer;min-height:44px;display:flex;align-items:center;gap:10px;flex-wrap:wrap}.skills pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:360px;overflow:auto;font-size:.9rem}.skills .skill-heading{display:flex;align-items:baseline;justify-content:space-between;gap:12px}.skills .skill-heading h2{margin:0}.skills .skill-state{font-size:.85rem;flex-shrink:0}.skills .skill-source{font-size:.85rem}.skills .skill-controls{display:flex;gap:12px;flex-wrap:wrap}.skills .skill-controls form{margin:0}.skills details details{margin-top:10px}.skills [hidden]{display:none!important}.skills .skill-files{max-height:200px;overflow:auto}.skills .problem{padding:12px}@media(max-width:600px){.skills input,.skills textarea,.skills select{font-size:16px}.skills .card{padding:14px}.skills .skill-heading{align-items:flex-start}}`;
8
13
  function source(skill) {
@@ -117,11 +122,11 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
117
122
  const projectOptedOutAll = library.projectOptOut?.all === true;
118
123
  const projectOptOutNames = new Set(library.projectOptOut?.names ?? []);
119
124
  const importBundleForm = manage
120
- ? disclose("Import a GitHub skill bundle", libForm("import-bundle", joinHtml([
125
+ ? disclose("Import a GitHub skill bundle", libForm("import-bundle", html `<div class="k-sec">${joinHtml([
121
126
  formRow("GitHub repository URL", "Imports every SKILL.md found in the repository, pinned to its exact commit SHA.", input({ id: "bundle-url", name: "url", type: "url", value: bundleUrl, attrs: { required: true, placeholder: "https://github.com/owner/repo", "aria-label": "GitHub repository URL" } }), "wide"),
122
- html `<label class="k-note"><input type="checkbox" name="autoUpdate" value="1" checked> Check daily and apply clean updates automatically (suspicious changes are held for review)</label>`,
127
+ html `<div class="k-checks"><label><input type="checkbox" name="autoUpdate" value="1" checked> Check daily and apply clean updates automatically (suspicious changes are held for review)</label></div>`,
123
128
  acts(btn("Import bundle", { variant: "primary", type: "submit" })),
124
- ])), bundleUrl !== "" || (library.bundles.length === 0 && library.skills.length === 0))
129
+ ])}</div>`), bundleUrl !== "" || (library.bundles.length === 0 && library.skills.length === 0))
125
130
  : "";
126
131
  const addGlobalSkillForm = manage
127
132
  ? disclose("Add a single skill to all projects", libForm("import-skill", joinHtml([
@@ -195,14 +200,14 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
195
200
  id: "global-library",
196
201
  title: "Global Skill Library",
197
202
  lead: `${enabledCount ? `${plural(enabledCount, "skill", "skills")} active across all projects by default.` : "No global skills installed yet."} Every agent (tasks, Direct Chat, threads, terminals, and the lead) receives this pinned set unless a project opts out.`,
198
- body: joinHtml([
203
+ body: html `<div class="k-sec">${joinHtml([
199
204
  importBundleForm,
200
205
  addGlobalSkillForm,
201
206
  bundleCards.length ? html `<h3>Tracked GitHub bundles</h3>${joinHtml(bundleCards)}` : "",
202
207
  projectOptOutToggle,
203
208
  globalSearch,
204
209
  globalSkillCards.length ? joinHtml(globalSkillCards) : note("Import a GitHub skill repository or add a skill above to share it across every project."),
205
- ]),
210
+ ])}</div>`,
206
211
  });
207
212
  const localToolCards = localTools.map((tool) => {
208
213
  const statusChip = !tool.detected
@@ -211,7 +216,7 @@ export function skillLibrarySectionHtml(library, localTools, csrf, canManage, op
211
216
  ? chip(`Synced (${tool.installedCount})`, "done")
212
217
  : chip("Detected · off", "");
213
218
  const sub = tool.detected
214
- ? html `Writes only Toolroll-managed skills to <span class="k-mono">${tool.skillsDir ?? tool.toolHome}</span>. Your own hand-written skills are never overwritten.`
219
+ ? html `Writes only Toolroll-managed skills to <span class="k-mono">${prettyHomePath(tool.skillsDir ?? tool.toolHome)}</span>. Your own hand-written skills are never overwritten.`
215
220
  : "Folder not found on this computer — Toolroll only writes where a tool is already installed.";
216
221
  const actions = manage && tool.detected
217
222
  ? html `<div class="skill-controls">
package/dist/spend-ui.js CHANGED
@@ -52,11 +52,12 @@ const unknownWords = (line) => {
52
52
  const apiWords = (line) => line.apiMicrousd > 0 ? money(line.apiMicrousd) : "—";
53
53
  const sec = (id, title, state, body, attrs = "") => html `<section class="k-sec spend-sec" aria-labelledby="spend-${id}"${attrs}><div class="k-secthead"><h3 id="spend-${id}">${title}${state ? html ` <small>· ${state}</small>` : ""}</h3></div>${body}</section>`;
54
54
  function bars(head, lines, name, max, top = 12, detail = () => "") {
55
+ const scale = Math.max(max, 1_000_000);
55
56
  const rows = lines.slice(0, top).map(line => {
56
57
  const sub = [detail(line), line.usageCount > 0 ? `plan usage ${usageWords(line)}` : "", line.unknown > 0 || line.estimatedMicrousd > 0 ? `unknown ${unknownWords(line)}` : ""].filter(Boolean).join(" · ");
57
- const width = max > 0 ? Math.max(0, Math.min(100, (line.apiMicrousd / max) * 100)) : 0;
58
+ const width = line.apiMicrousd > 0 ? Math.max(0, Math.min(100, (line.apiMicrousd / scale) * 100)) : 0;
58
59
  return html `<div class="spend-bar" role="row"><span class="spend-bar-n" role="cell">${name(line.key)}${sub === "" ? "" : html `<small data-amount-kind="${line.usageCount > 0 ? "subscription" : "unknown"}">${sub}</small>`}</span>\
59
- <span class="spend-lane" role="cell" aria-hidden="true">${line.apiMicrousd > 0 ? html `<i style="width:${width.toFixed(1)}%"></i>` : ""}</span><span class="spend-bar-v" role="cell" data-amount-kind="api">${apiWords(line)}</span></div>`;
60
+ <span class="spend-lane" role="cell" aria-hidden="true">${line.apiMicrousd > 0 ? html `<i style="width:${width.toFixed(1)}%" title="${apiWords(line)}"></i>` : ""}</span><span class="spend-bar-v" role="cell" data-amount-kind="api">${apiWords(line)}</span></div>`;
60
61
  });
61
62
  const total = lines.reduce((sum, line) => sum + line.apiMicrousd, 0);
62
63
  return html `<div class="spend-bars" role="table" aria-label="${head}"><div class="spend-bar h" role="row"><span role="columnheader">${head}</span><span role="columnheader"></span><span class="spend-bar-v" role="columnheader">API dollars</span></div>${rows}\
package/dist/spend.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { realpathSync } from "node:fs";
1
2
  import { SUBSCRIPTION_CAPABLE, readAuthMode } from "./keys.js";
2
3
  export function billingOf(provider, db) {
3
4
  const base = provider.replace(/-(subscription|api)$/, "");
@@ -270,11 +271,17 @@ export function spendItems(db, from, to, readMode = provider => billingOf(provid
270
271
  }
271
272
  return items;
272
273
  }
274
+ const canonicalRepoPath = (value) => { try {
275
+ return realpathSync(value);
276
+ }
277
+ catch {
278
+ return value;
279
+ } };
273
280
  export function countsToward(item, budget) {
274
281
  if (budget.scope === "installation")
275
282
  return true;
276
283
  if (budget.scope === "project")
277
- return item.project === budget.key;
284
+ return item.project !== null && (item.project === budget.key || canonicalRepoPath(item.project) === canonicalRepoPath(budget.key));
278
285
  if (budget.scope === "person")
279
286
  return item.person === budget.key;
280
287
  return item.subagent !== null && String(item.subagent) === budget.key;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolroll",
3
- "version": "0.9.127",
3
+ "version": "0.9.128",
4
4
  "description": "Your agents build. You decide. A control plane for coding agents — Claude Code, Codex, Gemini: approve the exact scope once, get results back Ready with the diff, the passing check and screenshots. Runs on your machine.",
5
5
  "directories": {
6
6
  "doc": "docs"