toolroll 0.9.110 → 0.9.111

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 (51) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +5 -1
  3. package/THIRD_PARTY_NOTICES.md +30 -0
  4. package/dist/agent-detect.js +1 -1
  5. package/dist/agent-said-schema.js +4 -0
  6. package/dist/agent-said.js +23 -0
  7. package/dist/approval-summary.js +39 -8
  8. package/dist/browser/THIRD_PARTY_NOTICES.txt +30 -0
  9. package/dist/builder.js +6 -1
  10. package/dist/claim.js +28 -13
  11. package/dist/cli-help.js +1 -1
  12. package/dist/codex-limits.js +21 -8
  13. package/dist/console-instance.js +2 -1
  14. package/dist/contracts/console-api.js +3 -2
  15. package/dist/contracts/engine-api.js +15 -3
  16. package/dist/contracts/route.js +1 -0
  17. package/dist/dispatch.js +1 -1
  18. package/dist/dispose.js +15 -9
  19. package/dist/easy-start.js +15 -1
  20. package/dist/engine-reads.js +79 -2
  21. package/dist/fast-start.js +20 -11
  22. package/dist/flexible-start.js +1 -1
  23. package/dist/integrations.js +6 -1
  24. package/dist/local-owner.js +1 -0
  25. package/dist/needs-you.js +2 -0
  26. package/dist/operate.js +55 -8
  27. package/dist/phase-routing.js +3 -1
  28. package/dist/plane-review.js +1 -1
  29. package/dist/proposal.js +2 -2
  30. package/dist/provider-connection.js +14 -2
  31. package/dist/route-store.js +1 -1
  32. package/dist/serve.js +5 -3
  33. package/dist/server/pages.js +4 -1
  34. package/dist/server/render-tasks.js +5 -2
  35. package/dist/server/route-table.js +2 -0
  36. package/dist/server/settings-section-table.js +3 -0
  37. package/dist/server/settings-sections.js +36 -0
  38. package/dist/server/settings.js +36 -0
  39. package/dist/server/tasks.js +31 -4
  40. package/dist/settings-proofs.js +1 -0
  41. package/dist/store.js +83 -11
  42. package/dist/task-sizing-schema.js +14 -0
  43. package/dist/task-sizing.js +76 -10
  44. package/dist/toolroll-update.js +3 -1
  45. package/dist/tui/darwin-arm64/toolroll-tui +0 -0
  46. package/dist/tui/darwin-x64/toolroll-tui +0 -0
  47. package/dist/tui/linux-arm64/toolroll-tui +0 -0
  48. package/dist/tui/linux-x64/toolroll-tui +0 -0
  49. package/dist/webhooks.js +8 -2
  50. package/dist/work-index.js +2 -2
  51. package/package.json +1 -1
@@ -9,10 +9,13 @@ import { run, terminateOwnedProcesses } from "./exec.js";
9
9
  import { CLAUDE_NO_TOOLS_ARGS, claudeJsonBody } from "./claude-print.js";
10
10
  import { JEV_MODEL, JEV_URL } from "./flow-sort.js";
11
11
  import { readProviderKey } from "./keys.js";
12
- import {} from "./phase-routing.js";
12
+ import { PLANNED_FIRST_REASON, SIZING_OFF_REASON } from "./phase-routing.js";
13
+ import { envValue } from "./names.js";
13
14
  import { ALL_CREDENTIAL_ENV } from "./provider.js";
14
15
  export const SIZING_BUDGET_MS = 5_000;
15
16
  export const SIZING_CLAUDE_MODEL = "claude-haiku-5-5";
17
+ export const CLAUDE_SIZER_NAME = "Claude Haiku 5.5";
18
+ export const JEV_SIZER_NAME = "Jev (OpenRouter)";
16
19
  export const SUBSTANTIAL_WORK = /\b(?:architecture|end[- ]to[- ]end|migrat(?:e|ion)|moderni[sz]e|redesign|refactor|rework|workflow|navigation|accessibility|responsive|performance|security|unif(?:y|ied)|multi[- ](?:step|project|service))\b/i;
17
20
  export function planningSignals(input) {
18
21
  const goal = input.goal ?? "";
@@ -74,7 +77,8 @@ export function claudeSizer(runner = run, model = SIZING_CLAUDE_MODEL, budgetMs
74
77
  const body = claudeJsonBody(result.stdout, 256 * 1024);
75
78
  if (body === null || body["is_error"] === true || body["subtype"] !== "success")
76
79
  return null;
77
- return answerOf(body["structured_output"]);
80
+ const answer = answerOf(body["structured_output"]);
81
+ return answer === null ? null : { ...answer, by: model === SIZING_CLAUDE_MODEL ? CLAUDE_SIZER_NAME : `Claude ${model}` };
78
82
  }
79
83
  finally {
80
84
  signal.removeEventListener("abort", stop);
@@ -108,16 +112,24 @@ export function jevSizer(fetcher, key) {
108
112
  if (typeof risky !== "number" || !Number.isFinite(risky))
109
113
  return null;
110
114
  const sure = answers["size"]?.["confidence"];
111
- return answerOf({ size, risky: risky >= 0.5, reason: typeof sure === "number" && Number.isFinite(sure) ? `Jev is ${Math.round(Math.min(1, Math.max(0, sure)) * 100)}% sure` : "" });
115
+ const answer = answerOf({ size, risky: risky >= 0.5, reason: typeof sure === "number" && Number.isFinite(sure) ? `Jev is ${Math.round(Math.min(1, Math.max(0, sure)) * 100)}% sure` : "" });
116
+ return answer === null ? null : { ...answer, by: JEV_SIZER_NAME };
112
117
  };
113
118
  }
114
- export function ownerSizer(fetcher = fetch, keyOf = () => readProviderKey("openrouter")) {
115
- const claude = claudeSizer();
116
- return (input, signal) => {
119
+ export function ownerSizer(fetcher = fetch, keyOf = () => readProviderKey("openrouter"), claude = claudeSizer()) {
120
+ return (input, signal, only) => {
117
121
  const key = keyOf();
122
+ if (only === "claude")
123
+ return claude(input, signal);
124
+ if (only === "jev")
125
+ return key === null ? Promise.resolve(null) : jevSizer(fetcher, key)(input, signal);
118
126
  return key === null ? claude(input, signal) : jevSizer(fetcher, key)(input, signal);
119
127
  };
120
128
  }
129
+ export function availableSizer(keyOf = () => readProviderKey("openrouter")) {
130
+ return keyOf() === null ? "claude" : "jev";
131
+ }
132
+ export const SIZER_WORDS = { claude: "Claude Haiku, on your plan", jev: "Jev via OpenRouter, your credit" };
121
133
  export async function classifyTask(input, sizer, budgetMs = SIZING_BUDGET_MS) {
122
134
  if (sizer === null)
123
135
  return heuristicSizing(input);
@@ -130,7 +142,7 @@ export async function classifyTask(input, sizer, budgetMs = SIZING_BUDGET_MS) {
130
142
  return heuristicSizing(input, `no classifier answer within ${Math.round(budgetMs / 1000)}s`);
131
143
  if (answer === null)
132
144
  return heuristicSizing(input, "the classifier could not answer");
133
- return { size: answer.size, risky: answer.risky, source: "classifier", reason: answer.reason };
145
+ return { size: answer.size, risky: answer.risky, source: "classifier", reason: answer.reason, ...(typeof answer.by === "string" ? { by: answer.by } : {}) };
134
146
  }
135
147
  finally {
136
148
  clearTimeout(timer);
@@ -146,11 +158,18 @@ export function installFilingSizer(sizer, budgetMs = SIZING_BUDGET_MS) {
146
158
  return () => { installed = previous; budget = previousBudget; };
147
159
  }
148
160
  let budget = SIZING_BUDGET_MS;
149
- export const filingSizer = () => ({ sizer: installed, budget });
150
- export function refineFiledSizing(store, taskId, input, followPlanning, clock = () => new Date()) {
161
+ export const filingSizer = (store, keyOf) => {
162
+ const read = taskSizingSetting(store, keyOf);
151
163
  const sizer = installed;
152
- if (sizer === null)
164
+ return { sizer: read.on && sizer !== null && read.sizer !== null ? ((input, signal) => sizer(input, signal, read.sizer)) : null, budget, off: !read.on };
165
+ };
166
+ export function refineFiledSizing(store, taskId, input, followPlanning, clock = () => new Date()) {
167
+ const read = taskSizingSetting(store);
168
+ const installedSizer = installed;
169
+ if (installedSizer === null || !read.on || read.sizer === null)
153
170
  return null;
171
+ const consented = read.sizer;
172
+ const sizer = (asked, signal) => installedSizer(asked, signal, consented);
154
173
  const work = classifyTask(input, sizer, budget)
155
174
  .then(sizing => { if (sizing.source === "classifier")
156
175
  store.applySizing(taskId, sizing, { followPlanning }, clock()); })
@@ -163,3 +182,50 @@ export async function settleSizings() {
163
182
  while (pending.size > 0)
164
183
  await Promise.allSettled([...pending]);
165
184
  }
185
+ export { SIZING_OFF_REASON } from "./phase-routing.js";
186
+ export function taskSizingSetting(store, keyOf) {
187
+ const byEnv = envValue(process.env, "NO_TASK_CLASSIFIER") !== undefined;
188
+ const available = availableSizer(keyOf);
189
+ let row;
190
+ try {
191
+ row = store.handle.prepare("SELECT enabled, sizer, updated_by, updated_at FROM task_sizing_setting WHERE id = 1").get();
192
+ }
193
+ catch {
194
+ row = undefined;
195
+ }
196
+ if (row === undefined)
197
+ return { on: false, chosen: false, sizer: null, available, by: null, at: null, byEnv };
198
+ const chosen = Number(row["enabled"]) === 1;
199
+ const sizer = row["sizer"] === "claude" || row["sizer"] === "jev" ? row["sizer"] : null;
200
+ return { on: chosen && sizer !== null && sizer === available, chosen, sizer: chosen ? sizer : null, available, by: String(row["updated_by"]), at: String(row["updated_at"]), byEnv };
201
+ }
202
+ export const taskSizingOn = (store) => taskSizingSetting(store).on;
203
+ export function setTaskSizing(store, on, by, now) {
204
+ store.handle.prepare(`INSERT INTO task_sizing_setting (id, enabled, sizer, updated_by, updated_at) VALUES (1, ?, ?, ?, ?)
205
+ ON CONFLICT(id) DO UPDATE SET enabled = excluded.enabled, sizer = excluded.sizer, updated_by = excluded.updated_by, updated_at = excluded.updated_at`)
206
+ .run(on === false ? 0 : 1, on === false ? null : on, by, now.toISOString());
207
+ store.recordAction({ at: now.toISOString(), actor: by, repo: null, taskId: null, runId: null, action: "task sizing by a quick model call", outcome: on === false ? "off" : `on: ${on}`, source: "policy", detail: null });
208
+ }
209
+ export const RISKY_WORDS = /\b(?:auth\w*|payments?|billing|delet\w*|migrat\w*|secur\w*|deploy\w*)\b/i;
210
+ const TINY_WORDING = /\b(?:typos?|misspell\w*|spelling|renam\w*)\b/i;
211
+ const NAMED_FILE = /(?:^|[\s`'"(])((?:[\w.-]+\/)*[\w-]{2,}\.[A-Za-z][A-Za-z0-9]{0,7})(?=$|[\s`'"),:;!?]|\.(?:\s|$))/g;
212
+ export const TINY_TEXT_MAX = 140;
213
+ export function tinyTask(input) {
214
+ const goal = input.goal ?? "";
215
+ const text = goal.trim() === "" || goal.trim() === input.title.trim() ? input.title : `${input.title}\n${goal}`;
216
+ if (text.length > TINY_TEXT_MAX || (input.outOfScope ?? "").trim() !== "" || (input.touches?.length ?? 0) > 1)
217
+ return false;
218
+ if (RISKY_WORDS.test(text) || planningSignals(input))
219
+ return false;
220
+ const files = new Set([...text.matchAll(NAMED_FILE)].map(one => one[1]));
221
+ const named = (input.touches?.length ?? 0) === 1 ? files.size <= 1 : files.size === 1;
222
+ return named || (files.size === 0 && TINY_WORDING.test(text));
223
+ }
224
+ export function cautiousSizing(input) {
225
+ return tinyTask(input)
226
+ ? { size: "small", risky: false, source: "heuristic", reason: `${SIZING_OFF_REASON}; a tiny change` }
227
+ : { size: "medium", risky: false, source: "heuristic", reason: PLANNED_FIRST_REASON };
228
+ }
229
+ export function filingSizing(store, input) {
230
+ return taskSizingOn(store) ? heuristicSizing(input) : cautiousSizing(input);
231
+ }
@@ -20,6 +20,8 @@ import { orphanKey, updateSafeSchema, V117_RENAMED_COLUMNS, V117_RENAMED_TABLES,
20
20
  import { V152_ADDED_COLUMNS } from "./code-map-store.js";
21
21
  import { V153_ADDED_COLUMNS } from "./plain-schema.js";
22
22
  import { V158_ADDED_COLUMNS } from "./lead-latency-schema.js";
23
+ import { V169_ADDED_COLUMNS } from "./task-sizing-schema.js";
24
+ import { V170_ADDED_COLUMNS } from "./agent-said-schema.js";
23
25
  import { V159_ADDED_COLUMNS } from "./one-step-chat-schema.js";
24
26
  import { isNewer, REGISTRY } from "./releases.js";
25
27
  import { markNeverIndex } from "./never-index.js";
@@ -324,7 +326,7 @@ const HISTORY_RULES = {
324
326
  ...Object.fromEntries(Object.entries(V117_RENAMED_TABLES).map(([old, now]) => [old, { moved: { into: now, where: "1" } }])),
325
327
  ...Object.fromEntries(V117_RENAMED_COLUMNS.filter(([table]) => !Object.values(V117_RENAMED_TABLES).includes(table)).map(([table, from, to]) => [table, { renamed: { [from]: to } }])),
326
328
  ...Object.fromEntries(Object.entries(V118_MERGED_TABLES).map(([table, kind]) => [table, { moved: { into: "credential", where: `kind = '${kind}'` } }])),
327
- ...Object.fromEntries(Object.entries(addedColumns(V119_ADDED_COLUMNS, V120_ADDED_COLUMNS, V121_ADDED_COLUMNS, V122_ADDED_COLUMNS, V123_ADDED_COLUMNS, V125_ADDED_COLUMNS, V126_ADDED_COLUMNS, V128_ADDED_COLUMNS, V129_ADDED_COLUMNS, V134_ADDED_COLUMNS, V135_ADDED_COLUMNS, V138_ADDED_COLUMNS, V143_ADDED_COLUMNS, V147_ADDED_COLUMNS, V148_ADDED_COLUMNS, V150_ADDED_COLUMNS, V151_ADDED_COLUMNS, V152_ADDED_COLUMNS, V153_ADDED_COLUMNS, V158_ADDED_COLUMNS, V159_ADDED_COLUMNS))
329
+ ...Object.fromEntries(Object.entries(addedColumns(V119_ADDED_COLUMNS, V120_ADDED_COLUMNS, V121_ADDED_COLUMNS, V122_ADDED_COLUMNS, V123_ADDED_COLUMNS, V125_ADDED_COLUMNS, V126_ADDED_COLUMNS, V128_ADDED_COLUMNS, V129_ADDED_COLUMNS, V134_ADDED_COLUMNS, V135_ADDED_COLUMNS, V138_ADDED_COLUMNS, V143_ADDED_COLUMNS, V147_ADDED_COLUMNS, V148_ADDED_COLUMNS, V150_ADDED_COLUMNS, V151_ADDED_COLUMNS, V152_ADDED_COLUMNS, V153_ADDED_COLUMNS, V158_ADDED_COLUMNS, V159_ADDED_COLUMNS, V169_ADDED_COLUMNS, V170_ADDED_COLUMNS))
328
330
  .map(([table, rule]) => [table, { ...EARLIER_RULES[table], ...rule }])),
329
331
  };
330
332
  export const RETIRED_TABLES = Object.freeze(Object.keys(HISTORY_RULES).filter(name => HISTORY_RULES[name].retired));
Binary file
Binary file
Binary file
Binary file
package/dist/webhooks.js CHANGED
@@ -163,8 +163,9 @@ export function linkFor(consoleUrl, notification) {
163
163
  }
164
164
  export async function postWebhook(target, notification, link, fetcher = fetch) {
165
165
  const withheld = outboundPrivate([notification.subject, notification.body]);
166
- const subject = withheld ? safeWords({ project: notification.project }) : notification.subject;
167
- const said = withheld ? [] : [notification.body];
166
+ const escape = (text) => escapeFor(target.kind, text);
167
+ const subject = escape(withheld ? safeWords({ project: notification.project }) : notification.subject);
168
+ const said = withheld ? [] : [escape(notification.body)];
168
169
  const body = target.kind === "slack"
169
170
  ? {
170
171
  text: [
@@ -222,3 +223,8 @@ export async function webhookPass(store, options) {
222
223
  }
223
224
  return report;
224
225
  }
226
+ export function escapeFor(kind, text) {
227
+ if (kind === "slack")
228
+ return text.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
229
+ return text.replace(/([\\`*_~|>#[\]()-])/g, "\\$1").replace(/@(everyone|here)\b/gi, "@\u200b$1");
230
+ }
@@ -93,7 +93,7 @@ const PROJECTION = `WITH RECURSIVE admitted AS MATERIALIZED (
93
93
  AND lease_generation=(SELECT MAX(lease_generation) FROM claim WHERE task_ref=a.ref_id)) live_lease,
94
94
  (SELECT id FROM run WHERE task_ref=a.ref_id AND outcome IS NULL ORDER BY id DESC LIMIT 1) unfinished,
95
95
  CASE WHEN a.state='done' THEN (SELECT id FROM run WHERE task_ref=a.ref_id AND finished_at IS NOT NULL AND role IN ('builder','scout') ORDER BY id DESC LIMIT 1) END result_id,
96
- (SELECT h.id FROM hold h WHERE h.task_ref=a.ref_id AND (h.until IS NULL OR h.until>$now) ORDER BY h.held_at,h.id LIMIT 1) hold_id,
96
+ (SELECT h.id FROM hold h WHERE h.task_ref=a.ref_id AND (h.until IS NULL OR h.until>$now) ORDER BY h.owner_kind='backoff',h.held_at,h.id LIMIT 1) hold_id,
97
97
  q.decision_id,${AGENT_ASK} agent_ask,EXISTS(SELECT 1 FROM task_archive ta WHERE ta.task_ref=a.ref_id) member_archived,(cu.task_ref IS NOT NULL OR a.ref_id IN (SELECT value FROM json_each($workspaceCustody)))
98
98
  AND a.ref_id NOT IN (SELECT value FROM json_each($settledCustody)) custody_unresolved
99
99
  FROM admitted a LEFT JOIN lineage l ON l.ref_id=a.ref_id
@@ -788,7 +788,7 @@ function itemOf(row, principal, probe, leadName, readiness, readable = false, no
788
788
  completedBy: code !== 'complete' || landed !== null ? null : n(row, 'completed_by_lead') === 1 ? 'the lead' : String(row['checked_actor']).replace(/^(?:operator|coordinator|lead):/, ''),
789
789
  ...(landed === null ? {} : { landed }),
790
790
  ...(lead === null ? {} : { lead, ...(leadName === undefined ? {} : { leadName }) }) });
791
- label = shared.headline;
791
+ label = code === 'cancelled' && shared.headline === 'Stopped' && !shared.sentence.startsWith('Replaced by ') ? 'Cancelled' : shared.headline;
792
792
  detail = shared.sentence;
793
793
  const firstSignIn = code === 'signed-out' && n(row, 'no_agent') > 0 && s(row, 'signed_out') === null;
794
794
  if (shared.need != null && shared.need.key !== 'other' && shared.need.key !== 'review-result' && primaryAction !== null && !firstSignIn) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolroll",
3
- "version": "0.9.110",
3
+ "version": "0.9.111",
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"