toolroll 0.9.120 → 0.9.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -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/codex-limits.js +2 -2
- 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/first-run.js +1 -1
- package/dist/flexible-agents.js +16 -2
- package/dist/flexible-save.js +8 -8
- 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-landing.js +48 -8
- package/dist/local-owner.js +1 -0
- package/dist/operate.js +40 -10
- package/dist/plan-limits-demand.js +32 -10
- 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/engine-api.js +6 -5
- 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/task-views.js +4 -3
- package/dist/server/tasks.js +11 -10
- 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/surface.js +1 -1
- package/dist/task-status.js +2 -1
- 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/dist/work-index.js +5 -2
- package/dist/work-summary.js +77 -1
- package/dist/workspace-ui.js +12 -6
- package/package.json +2 -1
package/dist/work-summary.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { heldFindingCount } from "./findings.js";
|
|
2
2
|
import { machineChecked } from "./machine-check.js";
|
|
3
|
-
import { resultCheckLevel } from "./result-follow-ups.js";
|
|
3
|
+
import { FOLLOW_UP_LOG, FOLLOW_UP_RECEIPT, resultCheckLevel } from "./result-follow-ups.js";
|
|
4
|
+
import { COMPLETER_ACTOR, COMPLETION_ACTION } from "./result-completion.js";
|
|
5
|
+
import { approvalOf } from "./scope.js";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { MARKER } from "./worktree.js";
|
|
4
9
|
import { projectCheckSet } from "./check-levels.js";
|
|
5
10
|
import { diagnoseTaskDispatch } from "./dispatch.js";
|
|
6
11
|
import { isAlive } from "./runner.js";
|
|
12
|
+
import { refArchived, stopFactOf } from "./store.js";
|
|
7
13
|
import { taskControlOf } from "./task-control.js";
|
|
8
14
|
import { buildReviewOf } from "./review-switch.js";
|
|
9
15
|
import { reviewFactsOf, workStatusOf } from "./workspace-ui.js";
|
|
@@ -82,6 +88,7 @@ export function taskWorkSummaryOf(store, taskId, now, access) {
|
|
|
82
88
|
const publication = result === null ? null : store.publicationForRun(result.id);
|
|
83
89
|
const facts = {
|
|
84
90
|
id: task.id, title: task.title, repo: ref.repo, state: task.state, updatedAt: task.updatedAt,
|
|
91
|
+
...(task.state === "done" && result !== null && completionStands(store, task.id, now, result.id) ? { completed: true } : {}),
|
|
85
92
|
...(machineChecked(store, task.id) ? { machine: true } : {}),
|
|
86
93
|
dispatch: diagnoseTaskDispatch(store, taskId, now, access.dependencyRepos ?? null), liveRunId: live?.id ?? null,
|
|
87
94
|
unfinishedRunId: runs.find(one => one.outcome === null && one.role !== "reviewer")?.id ?? null,
|
|
@@ -107,3 +114,72 @@ export function taskWorkSummaryOf(store, taskId, now, access) {
|
|
|
107
114
|
};
|
|
108
115
|
return workSummaryOf(facts, access.principal);
|
|
109
116
|
}
|
|
117
|
+
export function completionStands(store, taskId, now, resultRunId) {
|
|
118
|
+
try {
|
|
119
|
+
if (resultRunId !== undefined && store.handle.prepare("SELECT 1 AS hit FROM action_ledger WHERE run_id = ? AND action = ? AND source = 'work' LIMIT 1")
|
|
120
|
+
.get(resultRunId, COMPLETION_ACTION) === undefined)
|
|
121
|
+
return false;
|
|
122
|
+
const family = store.taskFamilyOf(taskId, null, true);
|
|
123
|
+
if (family === null || family.problem !== null || family.current.id !== taskId || family.current.state !== "done")
|
|
124
|
+
return false;
|
|
125
|
+
const current = family.current;
|
|
126
|
+
const runs = store.runsFor(current.refId);
|
|
127
|
+
const result = runs.find(run => run.finishedAt !== null && (run.role === "builder" || run.role === "scout"));
|
|
128
|
+
if (result === undefined || result.finishedAt === null)
|
|
129
|
+
return false;
|
|
130
|
+
const valid = result.role === "scout" ? result.outcome === "built"
|
|
131
|
+
: (result.outcome === "built" || result.outcome === "no-change") && /^[0-9a-f]{40}$/.test(result.headRevision ?? "");
|
|
132
|
+
if (!valid)
|
|
133
|
+
return false;
|
|
134
|
+
const scope = store.getScope(current.id);
|
|
135
|
+
if (scope === null || scope.termsProblem != null || !approvalOf(scope).approved || scope.digest !== result.scopeDigest)
|
|
136
|
+
return false;
|
|
137
|
+
const busy = (refId) => store.currentLiveLease(refId, now) !== null || store.runsFor(refId).some(run => run.outcome === null && run.role !== "reviewer");
|
|
138
|
+
if (family.versions.some(version => version.id !== current.id && ((version.state === "queued" && !refArchived(store, version.refId)) || version.state === "running" || busy(version.refId))))
|
|
139
|
+
return false;
|
|
140
|
+
if (busy(current.refId) || store.activeHolds(current.refId, now).length > 0 || store.applicableStopFor(result.id) !== null)
|
|
141
|
+
return false;
|
|
142
|
+
const counted = family.versions.filter(version => version.id === current.id || !refArchived(store, version.refId));
|
|
143
|
+
if (counted.some(version => openQuestionOn(store, version.refId) || custodyUnresolved(store, version.refId, version.state)))
|
|
144
|
+
return false;
|
|
145
|
+
const ids = JSON.stringify(family.versions.map(version => version.id));
|
|
146
|
+
const one = (sql, ...values) => store.handle.prepare(sql).get(...values);
|
|
147
|
+
const updated = String(one("SELECT MAX(updated_at) AS v FROM task WHERE id IN (SELECT value FROM json_each(?))", ids)?.["v"] ?? "");
|
|
148
|
+
const changed = Number(one(`SELECT MAX(id) AS v FROM action_ledger WHERE task_id IN (SELECT value FROM json_each(?))
|
|
149
|
+
AND action IN ('task state changed','scope approved','task placed','run started','run finished')`, ids)?.["v"] ?? 0);
|
|
150
|
+
const saved = String(one(`SELECT MAX(ar.created_at) AS v FROM artifact ar JOIN run r ON r.id = ar.run JOIN task_ref tr ON tr.id = r.task_ref
|
|
151
|
+
WHERE tr.backend = 'built-in' AND tr.external_id IN (SELECT value FROM json_each(?))
|
|
152
|
+
AND NOT (ar.kind = 'structured-output' AND ar.capture IN (?, ?))`, ids, FOLLOW_UP_LOG, FOLLOW_UP_RECEIPT)?.["v"] ?? "");
|
|
153
|
+
const after = [updated, result.finishedAt, scope.approvedAt ?? "", scope.proposedAt ?? ""];
|
|
154
|
+
const rows = store.handle.prepare(`SELECT id, at, actor FROM action_ledger WHERE task_id = ? AND run_id = ? AND action = ? AND source = 'work'
|
|
155
|
+
AND repo IS ? AND length(outcome) = 64 AND outcome NOT GLOB '*[^a-f0-9]*' ORDER BY id DESC`).all(family.root.id, result.id, COMPLETION_ACTION, current.repo);
|
|
156
|
+
return rows.some(row => {
|
|
157
|
+
const at = String(row["at"]);
|
|
158
|
+
if (!COMPLETER_ACTOR.test(String(row["actor"])) || Number(row["id"]) < changed || at < saved || after.some(one => at < one))
|
|
159
|
+
return false;
|
|
160
|
+
return one("SELECT 1 AS hit FROM proof_verdict WHERE run = ? AND decided_at > ?", result.id, at) === undefined
|
|
161
|
+
&& one("SELECT 1 AS hit FROM proof_acceptance WHERE run = ? AND accepted_at > ?", result.id, at) === undefined;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
function openQuestionOn(store, refId) {
|
|
169
|
+
return store.handle.prepare(`SELECT 1 AS hit FROM decision d JOIN run r ON r.id = d.run
|
|
170
|
+
WHERE r.task_ref = ? AND d.state <> 'answered' AND d.answered_at IS NULL LIMIT 1`).get(refId) !== undefined;
|
|
171
|
+
}
|
|
172
|
+
function custodyUnresolved(store, refId, state) {
|
|
173
|
+
const recorded = store.handle.prepare(`SELECT 1 AS hit FROM run r WHERE r.task_ref = ? AND r.provider_started_at IS NOT NULL
|
|
174
|
+
AND NOT EXISTS(SELECT 1 FROM run_process p WHERE p.run = r.id) AND NOT EXISTS(SELECT 1 FROM run_process_summary s WHERE s.run = r.id)
|
|
175
|
+
UNION SELECT 1 FROM run_process p JOIN run r ON r.id = p.run WHERE r.task_ref = ? AND p.exited_at IS NULL AND p.container_empty_at IS NULL
|
|
176
|
+
LIMIT 1`).get(refId, refId) !== undefined;
|
|
177
|
+
const noted = state === "done" && (() => {
|
|
178
|
+
const last = store.handle.prepare(`SELECT worktree FROM run WHERE task_ref = ? AND role IN ('builder','scout') AND finished_at IS NOT NULL
|
|
179
|
+
ORDER BY id DESC LIMIT 1`).get(refId)?.["worktree"];
|
|
180
|
+
return typeof last === "string" && existsSync(join(last, MARKER));
|
|
181
|
+
})();
|
|
182
|
+
if (!recorded && !noted)
|
|
183
|
+
return false;
|
|
184
|
+
return store.runsFor(refId).some(run => { const fact = stopFactOf(store, run.id); return fact !== null && fact.kind !== "open"; });
|
|
185
|
+
}
|
package/dist/workspace-ui.js
CHANGED
|
@@ -361,16 +361,22 @@ export function resultHeadlineOf(status) {
|
|
|
361
361
|
: VERIFIED_RESULT.has(status.token) ? { status: "passed", exitCode: null, head: null } : null });
|
|
362
362
|
return { ...status, label: shared.headline, tone: workToneOf(shared.headline) };
|
|
363
363
|
}
|
|
364
|
+
const COMPLETION_YIELDS = new Set(["waiting-decision", "finding-held", "stopping", "stopped"]);
|
|
364
365
|
export function workStatusOf(facts, resultDisplay) {
|
|
365
366
|
const status = workStatusWordsOf(facts, resultDisplay);
|
|
366
367
|
const done = facts.state === "done" && status.token !== "waiting-decision";
|
|
367
|
-
const read = done ? RESULT_NEEDS_YOU.has(status.token) ? { stage: "needs-you", need: "other" }
|
|
368
|
+
const read = done ? RESULT_NEEDS_YOU.has(status.token) ? { stage: "needs-you", need: "other" }
|
|
369
|
+
: status.token === "finding-held" ? { stage: "needs-you", need: "finding" } : stageOfCode(status.token, { needsPerson: false })
|
|
368
370
|
: stageOfCode(status.token, { needsPerson: status.views.includes("needs-you"), planning: facts.dispatch?.code === "running" && facts.dispatch.role === "planner", operatorHold: facts.dispatch?.action === "unhold" });
|
|
369
|
-
const
|
|
371
|
+
const complete = done && facts.completed === true && !COMPLETION_YIELDS.has(status.token) && (facts.control?.kind ?? "none") === "none"
|
|
372
|
+
&& (facts.openDecision ?? null) === null && (facts.heldFindings ?? 0) === 0;
|
|
373
|
+
const stage = complete ? "complete" : done && read.stage !== "needs-you" && read.stage !== "failed" ? "finished" : read.stage;
|
|
370
374
|
const level = facts.result?.checkLevel ?? null;
|
|
371
375
|
const shared = taskStatusOf({ stage, ...(read.need === undefined ? {} : { need: read.need }), ...(read.wait === undefined ? {} : { wait: read.wait }), reason: plainReasonOf(stage, status.token, status.detail),
|
|
372
|
-
report: facts.result?.role === "scout", ...(facts.machine === true ? { machine: true } : {}), checks: stage !== "finished" ? null : VERIFIED_RESULT.has(status.token) ? { status: "passed", exitCode: null, head: null, level }
|
|
376
|
+
report: facts.result?.role === "scout", ...(facts.machine === true ? { machine: true } : {}), checks: stage !== "finished" && stage !== "complete" ? null : VERIFIED_RESULT.has(status.token) ? { status: "passed", exitCode: null, head: null, level }
|
|
373
377
|
: level === "off" ? { status: "not-run", exitCode: null, head: null, level } : null });
|
|
378
|
+
if (complete)
|
|
379
|
+
return { ...status, label: shared.headline, tone: workToneOf(shared.headline), detail: shared.sentence, action: null, views: status.views.filter(view => view !== "needs-you"), rank: 3 };
|
|
374
380
|
return { ...status, label: shared.headline, tone: workToneOf(shared.headline), detail: stage === "finished" && level !== "off" ? status.detail : shared.sentence };
|
|
375
381
|
}
|
|
376
382
|
function workStatusWordsOf(facts, resultDisplay) {
|
|
@@ -409,12 +415,12 @@ function workStatusWordsOf(facts, resultDisplay) {
|
|
|
409
415
|
return { token: "stopped", label: "Paused", detail: "The stopped attempt's work is preserved. Resuming requires confirmation and checks the current approval again.", tone: "attention", action: { label: "Review pause", kind: "open-task" }, views, rank: 0 };
|
|
410
416
|
}
|
|
411
417
|
if (facts.state === "done" && result !== null) {
|
|
412
|
-
if (question !== null && result.tone !== "problem") {
|
|
418
|
+
if (question !== null && (result.tone !== "problem" || facts.completed === true)) {
|
|
413
419
|
return { token: "waiting-decision", label: "Waiting on your answer", detail: question.question,
|
|
414
420
|
tone: "attention", action: { label: "Answer question", kind: "open-task" }, views, rank: 0,
|
|
415
421
|
diagnostics: [{ token: result.token, label: result.label, detail: result.detail, tone: result.tone }] };
|
|
416
422
|
}
|
|
417
|
-
if (held && result.tone !== "problem")
|
|
423
|
+
if (held && (result.tone !== "problem" || facts.completed === true))
|
|
418
424
|
return findingWords({ token: result.token, label: result.label, detail: result.detail, tone: result.tone });
|
|
419
425
|
return { ...result, views, rank: needs ? 0 : 3 };
|
|
420
426
|
}
|
|
@@ -568,7 +574,7 @@ export function stepRowsOf(view) {
|
|
|
568
574
|
if (step.state === "skipped")
|
|
569
575
|
return { sentence: said === "Checks not run" ? "The checks didn't run" : said === "Checks at release" ? "Checks deferred to release" : "No checks were recorded", at: null };
|
|
570
576
|
if (step.state === "stuck")
|
|
571
|
-
return { sentence: step.needsYou && said === null ? "" : said === "Checks unreadable" ? "The checks couldn't be read" : said === "Checks failed" ? "The checks failed" : stoppedWord, at: null };
|
|
577
|
+
return { sentence: step.needsYou && said === null ? "" : said === "Checks unreadable" ? "The checks couldn't be read" : said === "Checks failed" ? headline === "Complete" ? "The checks failed when they ran again" : "The checks failed" : stoppedWord, at: null };
|
|
572
578
|
if (step.state === "current")
|
|
573
579
|
return { sentence: said === "Checks running" ? "The checks are running" : step.needsYou ? "" : "Waiting for the checks", at: null };
|
|
574
580
|
return { sentence: "The project's checks run on the result", at: null };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolroll",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.123",
|
|
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"
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"test:perf:wire": "TZ=UTC vitest run --config test/perf/vitest.config.ts",
|
|
15
15
|
"test:git": "vitest run test/attacks/checkout-git- test/attacks/fence-git-views test/attacks/repository-context-git test/attacks/discover-dirty src/teardown-git.test.ts src/worktree.slow.test.ts",
|
|
16
16
|
"check:quick": "node scripts/quick-check.mjs",
|
|
17
|
+
"check:fast": "npm run typecheck && vitest run src/password-freshness.test.ts src/central-recovery-stage.test.ts src/migration-check-recovery-index.slow.test.ts src/server/adapter-inventory.test.ts src/contracts/tools.test.ts src/ci-workflow.test.ts",
|
|
17
18
|
"lint:comments": "node scripts/lint-comments.mjs mac/Sources mac/Tests",
|
|
18
19
|
"lint:comments:fix": "node scripts/lint-comments.mjs --fix mac/Sources mac/Tests",
|
|
19
20
|
"dev": "tsx src/cli.ts",
|