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.
- package/CHANGELOG.md +38 -0
- package/README.md +5 -1
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/agent-detect.js +1 -1
- package/dist/agent-said-schema.js +4 -0
- package/dist/agent-said.js +23 -0
- package/dist/approval-summary.js +39 -8
- package/dist/browser/THIRD_PARTY_NOTICES.txt +30 -0
- package/dist/builder.js +6 -1
- package/dist/claim.js +28 -13
- package/dist/cli-help.js +1 -1
- package/dist/codex-limits.js +21 -8
- package/dist/console-instance.js +2 -1
- package/dist/contracts/console-api.js +3 -2
- package/dist/contracts/engine-api.js +15 -3
- package/dist/contracts/route.js +1 -0
- package/dist/dispatch.js +1 -1
- package/dist/dispose.js +15 -9
- package/dist/easy-start.js +15 -1
- package/dist/engine-reads.js +79 -2
- package/dist/fast-start.js +20 -11
- package/dist/flexible-start.js +1 -1
- package/dist/integrations.js +6 -1
- package/dist/local-owner.js +1 -0
- package/dist/needs-you.js +2 -0
- package/dist/operate.js +55 -8
- package/dist/phase-routing.js +3 -1
- package/dist/plane-review.js +1 -1
- package/dist/proposal.js +2 -2
- package/dist/provider-connection.js +14 -2
- package/dist/route-store.js +1 -1
- package/dist/serve.js +5 -3
- package/dist/server/pages.js +4 -1
- package/dist/server/render-tasks.js +5 -2
- package/dist/server/route-table.js +2 -0
- package/dist/server/settings-section-table.js +3 -0
- package/dist/server/settings-sections.js +36 -0
- package/dist/server/settings.js +36 -0
- package/dist/server/tasks.js +31 -4
- package/dist/settings-proofs.js +1 -0
- package/dist/store.js +83 -11
- package/dist/task-sizing-schema.js +14 -0
- package/dist/task-sizing.js +76 -10
- package/dist/toolroll-update.js +3 -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/webhooks.js +8 -2
- package/dist/work-index.js +2 -2
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -35,7 +35,7 @@ export function taskReadinessBlocker(store, taskRef, now) {
|
|
|
35
35
|
const hold = db
|
|
36
36
|
.prepare(`SELECT owner_kind, until, reason FROM hold
|
|
37
37
|
WHERE task_ref = ? AND (until IS NULL OR until > ?)
|
|
38
|
-
ORDER BY held_at, id LIMIT 1`)
|
|
38
|
+
ORDER BY owner_kind = 'backoff', held_at, id LIMIT 1`)
|
|
39
39
|
.get(taskRef, stamp);
|
|
40
40
|
if (hold !== undefined) {
|
|
41
41
|
return {
|
package/dist/dispose.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { STORAGE_HOLD_PREFIX } from "./needs-you.js";
|
|
2
|
+
import { recordAgentSaid } from "./store.js";
|
|
2
3
|
import { blockAfterSignedOut } from "./fallback.js";
|
|
3
4
|
import { authorizeCheckOnly } from "./check-only.js";
|
|
4
5
|
import { proposeNewRoute } from "./route-change.js";
|
|
@@ -29,6 +30,7 @@ const TICK_FAILURE_REASONS = new Set([
|
|
|
29
30
|
"git",
|
|
30
31
|
"commit-failure",
|
|
31
32
|
"provider-init",
|
|
33
|
+
"agent-error",
|
|
32
34
|
"setup",
|
|
33
35
|
"revision-brief",
|
|
34
36
|
"stopped",
|
|
@@ -223,18 +225,22 @@ function disposeBuildOutcomeLocked(context, result) {
|
|
|
223
225
|
recordExecClass(store, runId, result.reason);
|
|
224
226
|
const failureClass = result.reason === "agent-reported"
|
|
225
227
|
? "agent-reported"
|
|
226
|
-
: result.reason === "
|
|
227
|
-
? "
|
|
228
|
-
: result.reason === "no-
|
|
229
|
-
? "no-
|
|
230
|
-
: result.reason === "
|
|
231
|
-
? "
|
|
232
|
-
: result.reason === "
|
|
233
|
-
? "
|
|
234
|
-
: "
|
|
228
|
+
: result.reason === "agent-error"
|
|
229
|
+
? "agent-error"
|
|
230
|
+
: result.reason === "no-handoff"
|
|
231
|
+
? "no-handoff"
|
|
232
|
+
: result.reason === "no-op" || result.reason === "moved-head" || result.reason === "moved-branch"
|
|
233
|
+
? "no-op"
|
|
234
|
+
: result.reason === "timeout" || result.reason === "git" || result.reason === "provider-init" || result.reason === "setup" || result.reason === "stopped" || result.reason === "provider-unattested" || result.reason === "provider-protocol"
|
|
235
|
+
? "retryable-infra"
|
|
236
|
+
: result.reason === "commit-failure"
|
|
237
|
+
? "commit-failure"
|
|
238
|
+
: "unknown";
|
|
235
239
|
if (result.reason !== "agent-reported" && result.message.trim() !== "") {
|
|
236
240
|
store.recordOutcomeFacts(runId, { handoff: result.message });
|
|
237
241
|
}
|
|
242
|
+
if (result.agentSaid !== undefined && result.agentSaid.length > 0)
|
|
243
|
+
recordAgentSaid(store, runId, result.agentSaid);
|
|
238
244
|
if (leaseId === undefined) {
|
|
239
245
|
store.finishRun(runId, { outcome: "failed", reason: result.reason, now: clock() });
|
|
240
246
|
return { kind: "failed", failureClass, disposition: null, strikes: null, sealed: false, closedState: null };
|
package/dist/easy-start.js
CHANGED
|
@@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import { existsSync, realpathSync } from "node:fs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { requestLocalLink } from "./console-instance.js";
|
|
5
|
+
import { instanceSocketTooLong, requestLocalLink } from "./console-instance.js";
|
|
6
6
|
import { backgroundInstalled, backgroundOn, startInstalledService } from "./laptop-background.js";
|
|
7
7
|
import { proveConsoleReadOnly } from "./quick-start.js";
|
|
8
8
|
import { backgroundAsked, installationCreatedBy, localModeCandidate, localModeOf, openStore, openStoreReadOnly, recordBackgroundAsked } from "./store.js";
|
|
@@ -32,6 +32,15 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
32
32
|
write(`Toolroll can't open: ${first.message}.`);
|
|
33
33
|
return EXIT.refused;
|
|
34
34
|
}
|
|
35
|
+
const refusedTooDeep = () => {
|
|
36
|
+
if (first.ok || (args.web && !seams.serviceInstalled()))
|
|
37
|
+
return false;
|
|
38
|
+
const deep = seams.socketProblem();
|
|
39
|
+
if (deep === null)
|
|
40
|
+
return false;
|
|
41
|
+
write(`Toolroll can't start: ${deep}.`);
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
35
44
|
const joinRepo = async () => {
|
|
36
45
|
if (mode !== "start")
|
|
37
46
|
return EXIT.ok;
|
|
@@ -47,6 +56,8 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
47
56
|
};
|
|
48
57
|
let local = seams.localMode();
|
|
49
58
|
if ((local === "candidate" || local === "absent") && !first.ok && first.state === "none") {
|
|
59
|
+
if (refusedTooDeep())
|
|
60
|
+
return EXIT.refused;
|
|
50
61
|
const sandbox = await seams.sandbox();
|
|
51
62
|
if (sandbox.missing.length > 0) {
|
|
52
63
|
const { missingSandboxToolsWords } = await import("./sandbox-runtime.js");
|
|
@@ -59,6 +70,8 @@ export async function runEasyStart(mode, args, seams) {
|
|
|
59
70
|
}
|
|
60
71
|
if (local === "candidate")
|
|
61
72
|
local = "off";
|
|
73
|
+
if (local !== "off" && refusedTooDeep())
|
|
74
|
+
return EXIT.refused;
|
|
62
75
|
if (local === "off") {
|
|
63
76
|
if (seams.passwordByLaptopStart())
|
|
64
77
|
write(START_OVER_POINTER);
|
|
@@ -244,6 +257,7 @@ export function defaultEasyStartSeams(options) {
|
|
|
244
257
|
cwd,
|
|
245
258
|
write: options.write,
|
|
246
259
|
prove: () => proveConsoleReadOnly(file, options.build),
|
|
260
|
+
socketProblem: () => instanceSocketTooLong(file),
|
|
247
261
|
localMode: () => localModeRead(file),
|
|
248
262
|
initLocal: async () => (await import("./operate.js")).easyStartInitLocalMode(file, {
|
|
249
263
|
stdin: process.stdin.isTTY === true, stdout: process.stdout.isTTY === true, agent: underAgent(process.env), json: false,
|
package/dist/engine-reads.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { agentSaidOf } from "./store.js";
|
|
2
|
+
import { failedAttemptSentence, latestFinishedAttempt, stopSuggestionOf } from "./needs-you.js";
|
|
3
|
+
import { retryPinsOf } from "./local-owner-acts.js";
|
|
1
4
|
import { assignmentOf, owedAcceptance, personCompletionRefusal } from "./assignment.js";
|
|
2
5
|
import { assignmentCardOf } from "./assignment-ui.js";
|
|
3
6
|
import { assignmentStageOf, stageOfCode } from "./task-status.js";
|
|
@@ -14,6 +17,7 @@ import { agentSetupOf, detectionLines, NO_AGENT_YET, npmRegistryOf } from "./age
|
|
|
14
17
|
import { scanPatchForSecrets } from "./evidence.js";
|
|
15
18
|
import { fastCompletionProblem } from "./fast-start.js";
|
|
16
19
|
import { viewedGitSync } from "./teardown-git.js";
|
|
20
|
+
import { wasInterrupted } from "./run-ending.js";
|
|
17
21
|
export const isResultRun = (run) => run.finishedAt !== null && (run.role === "builder" || run.role === "scout");
|
|
18
22
|
const AUTOMATIC = new Set(["auto-check", "auto-green"]);
|
|
19
23
|
export function stepCardsOf({ store, family, now, access, evidenceRoot, viewer = null }) {
|
|
@@ -58,7 +62,7 @@ export function stepCardsOf({ store, family, now, access, evidenceRoot, viewer =
|
|
|
58
62
|
rows: [...summary.revisionChanges, ...summary.decisions, ...(summary.why === null ? [] : [{ label: "Why model", words: summary.why }]), ...summary.differs].map(one => ({ label: one.label, words: one.words, lines: "lines" in one ? [...(one.lines ?? [])] : [] })),
|
|
59
63
|
warnings: summary.warnings.map(one => one.words), usualLabel: summary.usualLabel, usual: summary.usual.map(one => ({ label: one.label, words: one.words })) };
|
|
60
64
|
})();
|
|
61
|
-
const cards = rows === null ? null : rows.map(row => ({
|
|
65
|
+
const cards = current.state === "cancelled" ? cancelledCards(builds, current.updatedAt ?? null) : rows === null ? null : rows.map(row => ({
|
|
62
66
|
key: row.key, label: row.label, state: row.state, mark: row.mark, sentence: row.sentence, at: row.at, needsYou: row.needsYou,
|
|
63
67
|
inChain: !(justCode && (row.key === "plan" || row.key === "approve")),
|
|
64
68
|
...runFacts(behind[row.key]),
|
|
@@ -78,21 +82,94 @@ export function stepCardsOf({ store, family, now, access, evidenceRoot, viewer =
|
|
|
78
82
|
version: ENGINE_API_VERSION,
|
|
79
83
|
task: { id: current.id, root: root.id, title: root.title, state: current.state, project: current.repo },
|
|
80
84
|
chain: justCode ? "just-code" : "plan-first",
|
|
81
|
-
headline: card?.status.headline ?? null,
|
|
85
|
+
headline: current.state === "cancelled" ? "Cancelled" : card?.status.headline ?? null,
|
|
82
86
|
liveRun: live?.id ?? null,
|
|
83
87
|
cards,
|
|
84
88
|
review: assignment !== null && assignment.state === "ready-to-check" && assignment.receipt !== null && assignment.receipt.taskId === current.id
|
|
85
89
|
? { run: assignment.receipt.runId, receipt: assignment.receipt.digest, source: revisionSourceOf(scope?.digest ?? null),
|
|
86
90
|
accept: acceptFactsOf(store, assignment, viewer, evidenceRoot) } : null,
|
|
91
|
+
failure: current.state === "failed" ? failureOf(store, ref?.id ?? null, builds) : null,
|
|
92
|
+
waiting: (() => {
|
|
93
|
+
const waiting = waitingOf(store, current.id, now);
|
|
94
|
+
if (waiting === null)
|
|
95
|
+
return null;
|
|
96
|
+
const last = latestFinishedAttempt(builds);
|
|
97
|
+
return { ...waiting, agentSaid: last !== null && last.outcome === "failed" ? agentSaidOf(store, last.id) : null };
|
|
98
|
+
})(),
|
|
99
|
+
held: current.state === "cancelled" || current.state === "done" ? null : heldOf(store, ref?.id ?? null, builds, now),
|
|
100
|
+
retry: current.state === "failed" ? (() => { const pins = retryPinsOf(store, current.id); return pins === null ? null : { run: pins.run, digest: pins.digest }; })() : null,
|
|
101
|
+
approval: scope !== null && approved && scope.approvedBy !== null
|
|
102
|
+
? { by: scope.approvedBy, you: viewer !== null && scope.approvedBy === viewer, automatic: AUTOMATIC.has(String(scope.approvalBasis ?? "")) } : null,
|
|
87
103
|
room: `task:${encodeURIComponent(root.id)}`,
|
|
88
104
|
};
|
|
89
105
|
}
|
|
106
|
+
function failureOf(store, taskRef, builds) {
|
|
107
|
+
const last = latestFinishedAttempt(builds);
|
|
108
|
+
const failedInARow = taskRef === null ? 0
|
|
109
|
+
: Number(store.handle.prepare("SELECT strikes FROM task_ref WHERE id = ?").get(taskRef)?.["strikes"] ?? 0);
|
|
110
|
+
return { line: failedAttemptSentence(last?.reason), failedInARow, suggestion: last === null ? null : stopSuggestionOf(last.reason),
|
|
111
|
+
agentSaid: last === null ? null : agentSaidOf(store, last.id) };
|
|
112
|
+
}
|
|
113
|
+
function cancelledCards(builds, at) {
|
|
114
|
+
const out = [];
|
|
115
|
+
const latest = builds[0] ?? null;
|
|
116
|
+
if (latest !== null) {
|
|
117
|
+
const failed = latest.outcome === "failed" || latest.outcome === "refused" || wasInterrupted(latest);
|
|
118
|
+
out.push({ key: "build", label: "Build", state: failed ? "stuck" : "done", mark: failed ? "stuck" : "done",
|
|
119
|
+
sentence: failed ? failedAttemptSentence(latest.reason).replace(/[.\s]+$/, "") : "The build finished", at: latest.finishedAt,
|
|
120
|
+
needsYou: false, inChain: true, ...runFacts(builds) });
|
|
121
|
+
}
|
|
122
|
+
out.push({ key: "ready", label: "Cancelled", state: "skipped", mark: "skipped", sentence: "Cancelled: nothing else will run for this task.",
|
|
123
|
+
at, needsYou: false, inChain: true, ...runFacts([]) });
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
function heldOf(store, taskRef, builds, now) {
|
|
127
|
+
if (taskRef === null)
|
|
128
|
+
return null;
|
|
129
|
+
const hold = store.activeHolds(taskRef, now).find(one => one.ownerKind === "operator") ?? null;
|
|
130
|
+
if (hold === null)
|
|
131
|
+
return null;
|
|
132
|
+
const last = latestFinishedAttempt(builds);
|
|
133
|
+
return { id: hold.id, reason: hold.reason,
|
|
134
|
+
lastFailure: last !== null && last.outcome === "failed" ? failedAttemptSentence(last.reason).replace(/[.\s]+$/, "") : null };
|
|
135
|
+
}
|
|
136
|
+
export function waitingOf(store, taskId, now) {
|
|
137
|
+
return waitingForTasks(store, [taskId], now).get(taskId) ?? null;
|
|
138
|
+
}
|
|
139
|
+
export function waitingForTasks(store, taskIds, now) {
|
|
140
|
+
const out = new Map();
|
|
141
|
+
const ids = [...new Set(taskIds)];
|
|
142
|
+
if (ids.length === 0)
|
|
143
|
+
return out;
|
|
144
|
+
const at = now.toISOString();
|
|
145
|
+
const rows = store.handle.prepare(`SELECT task.id AS task,
|
|
146
|
+
EXISTS (SELECT 1 FROM hold WHERE hold.task_ref = task_ref.id AND hold.owner_kind = 'backoff' AND (hold.until IS NULL OR hold.until > ?)) AS held,
|
|
147
|
+
(SELECT hold.until FROM hold WHERE hold.task_ref = task_ref.id AND hold.owner_kind = 'backoff' AND (hold.until IS NULL OR hold.until > ?) ORDER BY hold.held_at, hold.id LIMIT 1) AS until,
|
|
148
|
+
(SELECT run.outcome FROM run WHERE run.task_ref = task_ref.id AND run.role IN ('builder', 'scout', 'repair') AND (run.finished_at IS NOT NULL OR run.outcome IS NOT NULL) ORDER BY run.id DESC LIMIT 1) AS outcome,
|
|
149
|
+
(SELECT run.reason FROM run WHERE run.task_ref = task_ref.id AND run.role IN ('builder', 'scout', 'repair') AND (run.finished_at IS NOT NULL OR run.outcome IS NOT NULL) ORDER BY run.id DESC LIMIT 1) AS reason
|
|
150
|
+
FROM task JOIN task_ref ON task_ref.backend = 'built-in' AND task_ref.external_id = task.id
|
|
151
|
+
WHERE task.state = 'queued' AND task.id IN (${ids.map(() => "?").join(", ")})
|
|
152
|
+
-- A person's hold (Stop retrying, a pause, a question, an incident) means it isn't waiting to try again.
|
|
153
|
+
AND NOT EXISTS (SELECT 1 FROM hold WHERE hold.task_ref = task_ref.id AND hold.owner_kind <> 'backoff' AND (hold.until IS NULL OR hold.until > ?))`).all(at, at, ...ids, at);
|
|
154
|
+
for (const row of rows) {
|
|
155
|
+
const failed = row["outcome"] === "failed";
|
|
156
|
+
const held = Number(row["held"]) === 1;
|
|
157
|
+
if (!failed && !held)
|
|
158
|
+
continue;
|
|
159
|
+
out.set(String(row["task"]), {
|
|
160
|
+
retryAt: held && row["until"] != null ? String(row["until"]) : null,
|
|
161
|
+
lastFailure: failed ? failedAttemptSentence(row["reason"] == null ? null : String(row["reason"])).replace(/[.\s]+$/, "") : null,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
90
166
|
function runFacts(runs) {
|
|
91
167
|
const latest = runs[0] ?? null;
|
|
92
168
|
const costs = runs.map(run => run.costUsd).filter((one) => typeof one === "number" && Number.isFinite(one));
|
|
93
169
|
return {
|
|
94
170
|
agent: latest === null ? null : { provider: latest.provider, model: latest.modelReported ?? latest.model ?? null },
|
|
95
171
|
startedAt: runs.at(-1)?.startedAt ?? null,
|
|
172
|
+
latestStartedAt: latest?.startedAt ?? null,
|
|
96
173
|
finishedAt: latest?.finishedAt ?? null,
|
|
97
174
|
costUsd: costs.length === 0 ? null : Math.round(costs.reduce((sum, one) => sum + one, 0) * 1e6) / 1e6,
|
|
98
175
|
runs: runs.map(run => run.id),
|
package/dist/fast-start.js
CHANGED
|
@@ -11,7 +11,8 @@ import { COMPLETION_ACTION, COMPLETION_BY_PERSON } from "./result-completion.js"
|
|
|
11
11
|
import { approvalSummaryOf, summaryContextOf } from "./approval-summary.js";
|
|
12
12
|
import { deployGateScope, machineActing, propose, releaseCheckScope } from "./scope.js";
|
|
13
13
|
import { BUILT_IN, withdrawApproval } from "./store.js";
|
|
14
|
-
import { classifyTask, filingSizer, heuristicSizing } from "./task-sizing.js";
|
|
14
|
+
import { classifyTask, filingSizer, filingSizing, heuristicSizing, SIZING_OFF_REASON, taskSizingOn } from "./task-sizing.js";
|
|
15
|
+
const JUST_CODE_SIZING_OFF = `${SIZING_OFF_REASON}; Just code, as you chose`;
|
|
15
16
|
import { issueImported } from "./task-source.js";
|
|
16
17
|
import { titleWithin } from "./task-text.js";
|
|
17
18
|
import { viewedGitSync } from "./teardown-git.js";
|
|
@@ -28,6 +29,7 @@ const FAST_WORDS = {
|
|
|
28
29
|
setting: "Small tasks don't start right away in this project.",
|
|
29
30
|
size: "This looks bigger than a small change.",
|
|
30
31
|
classifier: "Toolroll couldn't confirm this is a small change.",
|
|
32
|
+
"sizing-off": "Quick start needs task sizing, which is off.",
|
|
31
33
|
plan: "This needs a plan first.",
|
|
32
34
|
quality: "Strict checks need a plan first.",
|
|
33
35
|
rules: "This project's approval rules need a plan first.",
|
|
@@ -77,11 +79,12 @@ export function fastStartRules(store, input, now) {
|
|
|
77
79
|
const account = store.accountOf(input.actor);
|
|
78
80
|
if (account === null || account.revokedAt !== null || account.role !== "approver" || !store.accountCanAccess(input.actor, input.repo))
|
|
79
81
|
return no("rules");
|
|
80
|
-
|
|
82
|
+
const sizingOff = !solo && !taskSizingOn(store);
|
|
83
|
+
if (!solo && !sizingOff && heuristicSizing({ title: input.title, goal: input.title }).size !== "small")
|
|
81
84
|
return no("size");
|
|
82
|
-
if (!solo && input.sizing.source !== "classifier")
|
|
85
|
+
if (!solo && !sizingOff && input.sizing.source !== "classifier")
|
|
83
86
|
return no("classifier");
|
|
84
|
-
if (!solo && (input.sizing.size !== "small" || input.sizing.risky))
|
|
87
|
+
if (!solo && !sizingOff && (input.sizing.size !== "small" || input.sizing.risky))
|
|
85
88
|
return no("size");
|
|
86
89
|
const scope = store.getScope(input.taskId);
|
|
87
90
|
if (scope === null)
|
|
@@ -93,7 +96,7 @@ export function fastStartRules(store, input, now) {
|
|
|
93
96
|
const route = routeFromJson(scope.proposedRouteJson ?? null);
|
|
94
97
|
if (route === null)
|
|
95
98
|
return no("agents");
|
|
96
|
-
if (!solo && !makesNoPlan(input.sizing, route.risk))
|
|
99
|
+
if (!solo && !sizingOff && !makesNoPlan(input.sizing, route.risk))
|
|
97
100
|
return no("plan");
|
|
98
101
|
if ((scope.qualityMode ?? "default") !== "default")
|
|
99
102
|
return no("quality");
|
|
@@ -104,6 +107,8 @@ export function fastStartRules(store, input, now) {
|
|
|
104
107
|
return no("rules");
|
|
105
108
|
if (isProtectedWork(rules, scope.touches))
|
|
106
109
|
return no("protected");
|
|
110
|
+
if (sizingOff)
|
|
111
|
+
return no("sizing-off");
|
|
107
112
|
const gate = store.approvalGate(input.taskId, input.actor, "person");
|
|
108
113
|
if (gate.verdict !== "seal" || gate.protectedWork)
|
|
109
114
|
return no("rules");
|
|
@@ -172,15 +177,17 @@ export async function prepareFastStart(store, input, now) {
|
|
|
172
177
|
return { eligible: false, reason: "rules" };
|
|
173
178
|
if (!fastStartOn(store, input.repo))
|
|
174
179
|
return { eligible: false, reason: "setting" };
|
|
175
|
-
const small =
|
|
180
|
+
const small = filingSizing(store, { title: input.title, goal: input.title }).size === "small";
|
|
176
181
|
const solo = input.planFirst !== true && soloNow(store);
|
|
177
182
|
if (!small && !solo)
|
|
178
|
-
return { eligible: false, reason: "size" };
|
|
183
|
+
return { eligible: false, reason: taskSizingOn(store) ? "size" : "sizing-off" };
|
|
179
184
|
const mode = store.activeMode(input.repo, now);
|
|
180
185
|
if (mode !== null && /"autoApproveFiling":true/.test(mode.termsJson))
|
|
181
186
|
return { eligible: false, reason: "mode" };
|
|
182
|
-
const sizer = filingSizer();
|
|
183
|
-
const
|
|
187
|
+
const sizer = filingSizer(store);
|
|
188
|
+
const words = filingSizing(store, { title: input.title, goal: input.title });
|
|
189
|
+
const sizing = small && !sizer.off ? await classifyTask({ title: input.title, goal: input.title }, sizer.sizer, sizer.budget)
|
|
190
|
+
: sizer.off && words.size !== "small" ? { ...words, reason: JUST_CODE_SIZING_OFF } : words;
|
|
184
191
|
const taskId = `task-${randomBytes(8).toString("hex")}`;
|
|
185
192
|
const readUnder = (rule) => dryRun(store, () => {
|
|
186
193
|
const filed = fileIt(store, taskId, { ...input, sizing }, now);
|
|
@@ -190,7 +197,7 @@ export async function prepareFastStart(store, input, now) {
|
|
|
190
197
|
});
|
|
191
198
|
let rule = small ? "small" : "solo";
|
|
192
199
|
let read = readUnder(rule);
|
|
193
|
-
if (!read.ok && rule === "small" && solo && (read.reason === "size" || read.reason === "classifier" || read.reason === "plan"))
|
|
200
|
+
if (!read.ok && rule === "small" && solo && (read.reason === "size" || read.reason === "classifier" || read.reason === "sizing-off" || read.reason === "plan"))
|
|
194
201
|
read = readUnder(rule = "solo");
|
|
195
202
|
if (!read.ok)
|
|
196
203
|
return { eligible: false, reason: read.reason };
|
|
@@ -431,12 +438,14 @@ export async function prepareChatStart(store, input, now) {
|
|
|
431
438
|
return { eligible: false, reason: "rules" };
|
|
432
439
|
if (!fastStartOn(store, input.repo))
|
|
433
440
|
return { eligible: false, reason: "setting" };
|
|
441
|
+
if (!taskSizingOn(store))
|
|
442
|
+
return { eligible: false, reason: "sizing-off" };
|
|
434
443
|
if (heuristicSizing({ title: input.title, goal: input.title }).size !== "small")
|
|
435
444
|
return { eligible: false, reason: "size" };
|
|
436
445
|
const mode = store.activeMode(input.repo, now);
|
|
437
446
|
if (mode !== null && /"autoApproveFiling":true/.test(mode.termsJson))
|
|
438
447
|
return { eligible: false, reason: "mode" };
|
|
439
|
-
const sizer = filingSizer();
|
|
448
|
+
const sizer = filingSizer(store);
|
|
440
449
|
const sizing = await classifyTask({ title: input.title, goal: input.title }, sizer.sizer, sizer.budget);
|
|
441
450
|
const taskId = `task-${randomBytes(8).toString("hex")}`;
|
|
442
451
|
const filing = { actor: input.actor, repo: input.repo, title: input.title };
|
package/dist/flexible-start.js
CHANGED
|
@@ -75,6 +75,6 @@ export function flexibleStartCard(store, input) {
|
|
|
75
75
|
const networkDigest = flexibleNetworkDigest(network);
|
|
76
76
|
const key = createHash("sha256").update(JSON.stringify({ v: 1, kind: "standing-orders:flexible-start", digest: standing.digest, repo: input.repo, by: input.by, model, level: "full", billing,
|
|
77
77
|
network: networkDigest, message: digestOfMessage, decisions, warnings }), "utf8").digest("hex").slice(0, 32);
|
|
78
|
-
const summary = { revision: null, revisionNotes: [], revisionChanges: [], decisions, why: null, differs: [], warnings, usual: [], usualLabel: "Other settings", key };
|
|
78
|
+
const summary = { revision: null, revisionNotes: [], revisionChanges: [], decisions, why: null, differs: [], warnings, usual: [], usualLabel: "Other settings", usualSummary: "", key };
|
|
79
79
|
return { ok: true, card: { summary, digest: standing.digest, network: networkDigest, model, level: "full", billing, terms } };
|
|
80
80
|
}
|
package/dist/integrations.js
CHANGED
|
@@ -285,7 +285,7 @@ async function probeAgent(io, provider) {
|
|
|
285
285
|
case "key-works":
|
|
286
286
|
case "key-present": return { outcome: "ok", account, detail };
|
|
287
287
|
case "not-installed": return { outcome: "absent", problem: `The ${name} CLI isn't installed on this computer.` };
|
|
288
|
-
case "signed-out": return { outcome: "
|
|
288
|
+
case "signed-out": return { outcome: "absent", problem: agentSignedOutWords(command) };
|
|
289
289
|
case "missing-key": return { outcome: "failed", problem: `${name} is set to use an API key, and none is saved. Run ${command}.`, fix: { command } };
|
|
290
290
|
case "key-refused": return { outcome: "failed", problem: `${name} refused the saved API key. Save a new one with ${command}.`, fix: { command } };
|
|
291
291
|
default: return { outcome: "ok", account, detail: "Signed in; the account couldn't be read" };
|
|
@@ -479,6 +479,11 @@ export async function checkIntegrations(io, keys) {
|
|
|
479
479
|
}));
|
|
480
480
|
return integrationsNow(io);
|
|
481
481
|
}
|
|
482
|
+
export const agentSignedOutWords = (command) => `signed out (run \`${command}\`)`;
|
|
483
|
+
const SIGNED_OUT_DETAIL = /^signed out \(run `[^`]+`\)$/;
|
|
484
|
+
export function agentsSignedOutLines(list) {
|
|
485
|
+
return list.filter(one => one.group === "agents" && one.state === "not-set-up" && one.detail !== null && SIGNED_OUT_DETAIL.test(one.detail)).map(one => `${one.name} · ${one.detail}`);
|
|
486
|
+
}
|
|
482
487
|
export function integrationsBrokenLine(list) {
|
|
483
488
|
const broken = list.filter(one => one.state === "broken").map(one => one.name);
|
|
484
489
|
if (broken.length === 0)
|
package/dist/local-owner.js
CHANGED
package/dist/needs-you.js
CHANGED
|
@@ -216,6 +216,7 @@ export const RUN_REASON_WORDS = {
|
|
|
216
216
|
interrupted: "the attempt was interrupted",
|
|
217
217
|
orphaned: "the attempt lost its builder",
|
|
218
218
|
"retryable-infra": "a temporary problem on the machine stopped it",
|
|
219
|
+
"agent-error": "the agent stopped with an error",
|
|
219
220
|
unknown: "the attempt stopped unexpectedly",
|
|
220
221
|
"spawn-failed": "the agent process could not start",
|
|
221
222
|
"provider-protocol": "the agent's reply could not be read",
|
|
@@ -286,6 +287,7 @@ const STOP_SUGGESTIONS = {
|
|
|
286
287
|
"moved-head": "Retry: the next attempt starts from where the branch is now.",
|
|
287
288
|
"moved-branch": "Retry: the next attempt starts from where the branch is now.",
|
|
288
289
|
"retryable-infra": "Retry as it is.",
|
|
290
|
+
"agent-error": "Read what the agent said, change what it needs, then retry.",
|
|
289
291
|
interrupted: "Retry as it is.",
|
|
290
292
|
orphaned: "Retry as it is.",
|
|
291
293
|
capability: "Add what the project is missing, then retry.",
|
package/dist/operate.js
CHANGED
|
@@ -48,16 +48,16 @@ import { runTokensCommand } from "./tokens-cli.js";
|
|
|
48
48
|
import { startTokenNotices } from "./token-notices.js";
|
|
49
49
|
import { liftAuthPause, openAuthPauses, signInGate, signInWords, startSignInProbes } from "./provider-auth.js";
|
|
50
50
|
import { createConnectionChecker } from "./provider-connection.js";
|
|
51
|
-
import { checkIntegrations, integrationsBrokenLine, integrationsNow, renderIntegrations } from "./integrations.js";
|
|
51
|
+
import { agentsSignedOutLines, checkIntegrations, integrationsBrokenLine, integrationsNow, renderIntegrations } from "./integrations.js";
|
|
52
52
|
import { buildHandoff, handoffLines, loginAccount, runOnboard } from "./agent-onboard.js";
|
|
53
53
|
import { backupFiles, backupFolderOf, backupOwner, backupNow, restoreDatabase, startBackups } from "./backup.js";
|
|
54
54
|
import { startLiveBackups } from "./live-backup.js";
|
|
55
55
|
import { pushLimitSink } from "./provider-limits.js";
|
|
56
|
-
import {
|
|
56
|
+
import { filingSizing, installFilingSizer, ownerSizer, refineFiledSizing, setTaskSizing, settleSizings, taskSizingSetting } from "./task-sizing.js";
|
|
57
57
|
import { tierLines, tierReport } from "./tier-report.js";
|
|
58
58
|
import { savingsLines, savingsReportOrError } from "./route-savings.js";
|
|
59
59
|
import { limitsView } from "./limits-ui.js";
|
|
60
|
-
import { startCodexLimits } from "./codex-limits.js";
|
|
60
|
+
import { codexSignedInNow, startCodexLimits } from "./codex-limits.js";
|
|
61
61
|
import { packageVersion, startMonitoring, targetOf } from "./monitoring.js";
|
|
62
62
|
import { origin, readMonitoring } from "./monitoring-settings.js";
|
|
63
63
|
import { logEvent } from "./log.js";
|
|
@@ -581,6 +581,10 @@ Agents — which provider and model each phase runs on
|
|
|
581
581
|
toolroll config set|clear|show quick-answers --as <you> --token <t>
|
|
582
582
|
quick answers on (set) or off (clear): plain status questions go to a
|
|
583
583
|
faster model on the Claude membership; changes stay on the main model
|
|
584
|
+
toolroll config set task-sizing on|off --as <you> --token <t>
|
|
585
|
+
size each new task with a quick model call (Claude Haiku, on your
|
|
586
|
+
plan) before you approve; off, the default, sizes from the words alone
|
|
587
|
+
and plans anything uncertain (config show task-sizing says which)
|
|
584
588
|
toolroll chat --as <you> [--repo <path>…] [--say "…"] [--end]
|
|
585
589
|
[--ceiling-usd <n>] [--json] (password at the prompt;
|
|
586
590
|
--token <t> only for scripts — it lands in shell history)
|
|
@@ -3447,13 +3451,14 @@ async function startConsole(options) {
|
|
|
3447
3451
|
store: context.store, settings: () => readMonitoring(dirname(context.databaseFile)),
|
|
3448
3452
|
instance: options.publicUrl ?? hostname(), version: packageVersion(),
|
|
3449
3453
|
});
|
|
3454
|
+
const signIns = createConnectionChecker({ store: context.store });
|
|
3450
3455
|
const besideConsole = [
|
|
3451
3456
|
stopMonitoring,
|
|
3452
3457
|
startBudgetAlerts(context.store),
|
|
3453
3458
|
startTokenNotices(context.store),
|
|
3454
|
-
startSignInProbes(context.store,
|
|
3459
|
+
startSignInProbes(context.store, signIns),
|
|
3455
3460
|
startBackups(context.store, context.databaseFile),
|
|
3456
|
-
startCodexLimits(context.store),
|
|
3461
|
+
startCodexLimits(context.store, () => codexSignedInNow(signIns)),
|
|
3457
3462
|
startUpdateChecks(context.store, dirname(context.databaseFile), PACKAGE_VERSION, installMethod(context.installBin).updateCommand, context.releaseIo ?? {}),
|
|
3458
3463
|
];
|
|
3459
3464
|
server.on("close", () => { for (const stop of besideConsole)
|
|
@@ -3544,6 +3549,7 @@ async function requeueTask(positional, flags, context) {
|
|
|
3544
3549
|
"accepted-result": `${id}'s last result was accepted; change it through a revision, not a rerun`,
|
|
3545
3550
|
published: `${id}'s last result is published; revise it through its pull request`,
|
|
3546
3551
|
moved: `${id} changed since its page was read; read it again`,
|
|
3552
|
+
stale: `${id} changed since its page was read; read it again`,
|
|
3547
3553
|
archived: `${id} is put away — restore it with \`toolroll task restore ${id}\` first`,
|
|
3548
3554
|
};
|
|
3549
3555
|
return fail(write, json, "task requeue", result.reason, why[result.reason], EXIT.refused);
|
|
@@ -4221,6 +4227,8 @@ async function configCommand(positional, flags, context) {
|
|
|
4221
4227
|
const scope = repoGiven === undefined ? INSTALLATION_SCOPE : canonicalProject(repoGiven) ?? resolve(repoGiven);
|
|
4222
4228
|
if (phase === "quick-answers")
|
|
4223
4229
|
return quickAnswersConfig(action ?? "show", repoGiven !== undefined, flags, context);
|
|
4230
|
+
if (phase === "task-sizing")
|
|
4231
|
+
return taskSizingConfig(action ?? "show", positional[2], repoGiven !== undefined, flags, context);
|
|
4224
4232
|
if (action === undefined || action === "show") {
|
|
4225
4233
|
const installation = store.listPhaseConfig(INSTALLATION_SCOPE);
|
|
4226
4234
|
const project = scope === INSTALLATION_SCOPE ? [] : store.listPhaseConfig(scope);
|
|
@@ -7366,8 +7374,11 @@ async function statusCommand(positional, flags, context) {
|
|
|
7366
7374
|
notifySecurityRelease(context.store, release, current, method.updateCommand, context.clock());
|
|
7367
7375
|
const line = updateLine(release, current, method.updateCommand);
|
|
7368
7376
|
const update = release === null ? {} : { update: { current, latest: release.version, security: release.security, updateCommand: method.updateCommand, url: release.url } };
|
|
7369
|
-
const
|
|
7377
|
+
const savedList = await savedIntegrations(context).catch(() => []);
|
|
7378
|
+
const brokenIntegrations = savedList.filter(one => one.state === "broken");
|
|
7370
7379
|
const brokenLine = integrationsBrokenLine(brokenIntegrations);
|
|
7380
|
+
const signedOutLines = agentsSignedOutLines(savedList);
|
|
7381
|
+
const signedOut = signedOutLines.length === 0 ? {} : { agentsSignedOut: signedOutLines };
|
|
7371
7382
|
const integrations = brokenIntegrations.length === 0 ? {} : { integrations: { broken: brokenIntegrations.map(one => ({ key: one.key, name: one.name, fix: one.action.kind === "fix" ? one.action.words : null })) } };
|
|
7372
7383
|
const waiting = waitingUpdate(context.databaseFile, run => context.store.stopQuiescenceProblem(run) !== null, context.clock());
|
|
7373
7384
|
const updateWaiting = waiting === null ? {} : { updateWaiting: { app: waiting.app, version: waiting.version, stopped: waiting.stopped, run: waiting.run, on: waiting.on, action: waiting.action } };
|
|
@@ -7381,7 +7392,7 @@ async function statusCommand(positional, flags, context) {
|
|
|
7381
7392
|
const laptop = { laptop: await laptopStatus(context.store, context.databaseFile, context.laptopSeams) };
|
|
7382
7393
|
if (!laptop.laptop.running && laptop.laptop.background === "on" && !machineActing())
|
|
7383
7394
|
await restartOwnBuilder(context.store, context.databaseFile, context.laptopSeams, context.clock()).catch(() => null);
|
|
7384
|
-
return succeed(context.write, context.json, command, { ...status, projects, ...laptop, ...update, ...integrations, ...updateWaiting, ...unsentReplies, ...(legacyWebhookWarning === null ? {} : { legacyWebhookWarning }) }, () => [...(waiting === null ? [] : [waiting.words]), ...(unsentLine === null ? [] : [unsentLine]), ...renderInstallationStatus(status), ...(projectsLine === null ? [] : [projectsLine]), ...(line === null ? [] : [line]), ...(brokenLine === null ? [] : [brokenLine]), ...(legacyWebhookWarning === null ? [] : [legacyWebhookWarning])]);
|
|
7395
|
+
return succeed(context.write, context.json, command, { ...status, projects, ...laptop, ...update, ...integrations, ...signedOut, ...updateWaiting, ...unsentReplies, ...(legacyWebhookWarning === null ? {} : { legacyWebhookWarning }) }, () => [...(waiting === null ? [] : [waiting.words]), ...(unsentLine === null ? [] : [unsentLine]), ...renderInstallationStatus(status), ...(projectsLine === null ? [] : [projectsLine]), ...(line === null ? [] : [line]), ...signedOutLines, ...(brokenLine === null ? [] : [brokenLine]), ...(legacyWebhookWarning === null ? [] : [legacyWebhookWarning])]);
|
|
7385
7396
|
}
|
|
7386
7397
|
function unsentRepliesLine(unsent) {
|
|
7387
7398
|
if (unsent.length === 0)
|
|
@@ -8702,7 +8713,7 @@ async function scopeTask(positional, flags, context) {
|
|
|
8702
8713
|
previous?.proposedVia === "coordinator" || store.filedViaOf(id)?.startsWith("mcp:"))
|
|
8703
8714
|
return null;
|
|
8704
8715
|
const input = { title: store.getTask(id).title, goal, outOfScope: text(flags, "not") ?? null, touches };
|
|
8705
|
-
const sized = store.applySizing(id,
|
|
8716
|
+
const sized = store.applySizing(id, filingSizing(store, input), { followPlanning: true }, now);
|
|
8706
8717
|
if (sized.ok)
|
|
8707
8718
|
refinement = refineFiledSizing(store, id, input, true, context.clock);
|
|
8708
8719
|
return null;
|
|
@@ -12643,3 +12654,39 @@ async function projectFlexibleCommand(positional, flags, context) {
|
|
|
12643
12654
|
return fail(write, json, command, done.reason, done.message, EXIT.refused);
|
|
12644
12655
|
return succeed(write, json, command, { repo, changed: done.changed, flexible: { state: "secure" } }, () => [done.changed ? `${repo} is Secure again. No new Flexible threads start.` : `${repo} is already Secure.`]);
|
|
12645
12656
|
}
|
|
12657
|
+
async function taskSizingConfig(action, value, repoGiven, flags, context) {
|
|
12658
|
+
const { store, write, json, clock } = context;
|
|
12659
|
+
const command = `config ${action}`;
|
|
12660
|
+
if (repoGiven)
|
|
12661
|
+
return fail(write, json, command, "usage", "task sizing is installation-wide: no --repo", EXIT.usage);
|
|
12662
|
+
const said = () => {
|
|
12663
|
+
const read = taskSizingSetting(store);
|
|
12664
|
+
const on = read.on && !read.byEnv;
|
|
12665
|
+
const name = (one) => one === "jev" ? "Jev via OpenRouter (your credit)" : "Claude Haiku (on your plan)";
|
|
12666
|
+
return { payload: { taskSizing: { on, setting: read.chosen ? "on" : "off", sizer: read.sizer, available: read.available, byEnv: read.byEnv } }, lines: () => [read.byEnv
|
|
12667
|
+
? "Task sizing is off: TOOLROLL_NO_TASK_CLASSIFIER is set, so no model call happens before you approve; uncertain tasks get a plan first."
|
|
12668
|
+
: on ? `Task sizing is on: each new task is sized by ${name(read.sizer)} before you approve.`
|
|
12669
|
+
: read.chosen && read.sizer !== null ? `Task sizing is off: it was turned on for ${name(read.sizer)}, but ${name(read.available)} is the one available now, so nothing is sent. Run \`toolroll config set task-sizing on\` to choose it.`
|
|
12670
|
+
: "Task sizing is off: no model call before you approve; uncertain tasks get a plan first."] };
|
|
12671
|
+
};
|
|
12672
|
+
if (action === "show") {
|
|
12673
|
+
const shown = said();
|
|
12674
|
+
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12675
|
+
}
|
|
12676
|
+
if (action !== "set" || (value !== "on" && value !== "off"))
|
|
12677
|
+
return fail(write, json, command, "usage", "`toolroll config set task-sizing on|off --as <you> --token <t>`", EXIT.usage);
|
|
12678
|
+
const acting = await askCredentials(flags, context);
|
|
12679
|
+
if (acting === null)
|
|
12680
|
+
return fail(write, json, command, "usage", "changing task sizing takes `--as <you> --token <t>`", EXIT.usage);
|
|
12681
|
+
const saved = store.transact(() => {
|
|
12682
|
+
const verified = authenticateApprover(store, acting.name, acting.token);
|
|
12683
|
+
if (!verified.ok || !store.isInstanceOperator(acting.name))
|
|
12684
|
+
return false;
|
|
12685
|
+
setTaskSizing(store, value === "on" ? taskSizingSetting(store).available : false, acting.name, clock());
|
|
12686
|
+
return true;
|
|
12687
|
+
});
|
|
12688
|
+
if (!saved)
|
|
12689
|
+
return fail(write, json, command, "unauthenticated", "an instance operator changes task sizing, with their password", EXIT.refused);
|
|
12690
|
+
const shown = said();
|
|
12691
|
+
return succeed(write, json, command, shown.payload, shown.lines);
|
|
12692
|
+
}
|
package/dist/phase-routing.js
CHANGED
|
@@ -23,6 +23,8 @@ export const TASK_SIZES = TASK_SIZE_WORDS;
|
|
|
23
23
|
export function isTaskSize(value) {
|
|
24
24
|
return value === "small" || value === "medium" || value === "large";
|
|
25
25
|
}
|
|
26
|
+
export const SIZING_OFF_REASON = "task sizing is off";
|
|
27
|
+
export const PLANNED_FIRST_REASON = `${SIZING_OFF_REASON}; planned first`;
|
|
26
28
|
export function makesNoPlan(size, risk) {
|
|
27
29
|
return size != null && size.size === "small" && !size.risky && risk === "routine";
|
|
28
30
|
}
|
|
@@ -468,7 +470,7 @@ export function canonicalRouteJson(route) {
|
|
|
468
470
|
...(route.version === 3 && leg.selection !== undefined ? { selection: leg.selection } : {}),
|
|
469
471
|
})),
|
|
470
472
|
overrides: route.overrides.map(one => ({ phase: one.phase, provider: one.provider, model: one.model, by: one.by, at: one.at })),
|
|
471
|
-
...(route.version === 1 ? {} : { size: route.size === null ? null : { size: route.size.size, risky: route.size.risky, source: route.size.source, reason: route.size.reason } }),
|
|
473
|
+
...(route.version === 1 ? {} : { size: route.size === null ? null : { size: route.size.size, risky: route.size.risky, source: route.size.source, reason: route.size.reason, ...(route.size.by === undefined ? {} : { by: route.size.by }) } }),
|
|
472
474
|
});
|
|
473
475
|
}
|
|
474
476
|
export function routeDigestOf(route) {
|
package/dist/plane-review.js
CHANGED
|
@@ -27,7 +27,7 @@ export function excerpt(text, cap = 160) {
|
|
|
27
27
|
return "[hidden: it looked like it held a key or password]";
|
|
28
28
|
return clean.length > cap ? `${clean.slice(0, cap - 1).trimEnd()}…` : clean;
|
|
29
29
|
}
|
|
30
|
-
const PROVIDER_REASONS = new Set(["retryable-infra", "provider-init", "provider-protocol", "provider-unattested", "setup"]);
|
|
30
|
+
const PROVIDER_REASONS = new Set(["retryable-infra", "agent-error", "provider-init", "provider-protocol", "provider-unattested", "setup"]);
|
|
31
31
|
const TIMEOUT_WORDS = /made no observable progress|ran past \d+ minutes|timed out/i;
|
|
32
32
|
export function runCause(run) {
|
|
33
33
|
const reason = run.reason ?? "";
|
package/dist/proposal.js
CHANGED
|
@@ -2,7 +2,7 @@ import { validateTaskText } from "./task-text.js";
|
|
|
2
2
|
export { validateTaskText } from "./task-text.js";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { canonicalProject } from "./project.js";
|
|
5
|
-
import {
|
|
5
|
+
import { filingSizing, planningSignals, refineFiledSizing } from "./task-sizing.js";
|
|
6
6
|
import { FolderUnavailable } from "./folder-gate.js";
|
|
7
7
|
const FILED_VIA = /^[a-z][a-z0-9:-]{0,63}$/;
|
|
8
8
|
export function shouldPlanTask(input, sizing) {
|
|
@@ -53,7 +53,7 @@ export function fileTaskProposal(store, input, now) {
|
|
|
53
53
|
const badText = validateTaskText(input);
|
|
54
54
|
if (badText !== null)
|
|
55
55
|
return badText;
|
|
56
|
-
const sizing = input.sizing ??
|
|
56
|
+
const sizing = input.sizing ?? filingSizing(store, input);
|
|
57
57
|
const outOfScope = input.outOfScope ?? null;
|
|
58
58
|
const touches = input.touches ?? [];
|
|
59
59
|
const repo = checkRepo(input.repo, input.admittedRepos);
|
|
@@ -4,6 +4,8 @@ import { statusProbe } from "./status-probe.js";
|
|
|
4
4
|
import { ALL_CREDENTIAL_ENV, inspectionOf } from "./provider.js";
|
|
5
5
|
import { isAcpProvider } from "./acp-agents.js";
|
|
6
6
|
import { keyStatus, PROVIDER_KEY_ENV, readAuthMode, readProviderKey, verifyProviderKey } from "./keys.js";
|
|
7
|
+
export const SIGNED_OUT_RECHECK_MS = 10 * 60_000;
|
|
8
|
+
const ANSWER_MS = 30_000;
|
|
7
9
|
export function signInFacts(provider, result, now = new Date()) {
|
|
8
10
|
const base = { mode: "subscription", checkedAt: now.toISOString() };
|
|
9
11
|
if (result.notFound)
|
|
@@ -46,6 +48,7 @@ export function createConnectionChecker(options = {}) {
|
|
|
46
48
|
const verify = options.verify ?? ((provider, key) => verifyProviderKey(provider, key));
|
|
47
49
|
const clock = options.clock ?? (() => new Date());
|
|
48
50
|
const cache = new Map();
|
|
51
|
+
const absentStreak = new Map();
|
|
49
52
|
const pending = new Map();
|
|
50
53
|
return async (provider, fresh = false) => {
|
|
51
54
|
if (isAcpProvider(provider))
|
|
@@ -86,8 +89,16 @@ export function createConnectionChecker(options = {}) {
|
|
|
86
89
|
const value = await check;
|
|
87
90
|
const currentKeyFacts = keyStatus(provider, home);
|
|
88
91
|
const currentKey = JSON.stringify([provider, readAuthMode(provider, home), currentKeyFacts.set, currentKeyFacts.updatedAt, !!(options.env ?? process.env)[PROVIDER_KEY_ENV[provider]]]);
|
|
89
|
-
if (currentKey === key)
|
|
90
|
-
|
|
92
|
+
if (currentKey === key) {
|
|
93
|
+
const before = absentStreak.get(provider);
|
|
94
|
+
const absent = value.state === "signed-out" || value.state === "not-installed";
|
|
95
|
+
const count = absent ? (before?.state === value.state ? before.count + 1 : 1) : 0;
|
|
96
|
+
if (absent)
|
|
97
|
+
absentStreak.set(provider, { state: value.state, count });
|
|
98
|
+
else
|
|
99
|
+
absentStreak.delete(provider);
|
|
100
|
+
cache.set(provider, { key, until: value.verdict !== undefined ? Number.POSITIVE_INFINITY : clock().getTime() + answerStandsMs(value.state, count), value });
|
|
101
|
+
}
|
|
91
102
|
return value;
|
|
92
103
|
}
|
|
93
104
|
finally {
|
|
@@ -95,3 +106,4 @@ export function createConnectionChecker(options = {}) {
|
|
|
95
106
|
}
|
|
96
107
|
};
|
|
97
108
|
}
|
|
109
|
+
export const answerStandsMs = (state, inARow) => state === "signed-out" || state === "not-installed" ? Math.min(ANSWER_MS * 4 ** Math.max(0, inARow - 1), SIGNED_OUT_RECHECK_MS) : ANSWER_MS;
|
package/dist/route-store.js
CHANGED
|
@@ -8,7 +8,7 @@ import { BUILT_IN, nightlyTaskRef, releaseTaskRef } from "./store.js";
|
|
|
8
8
|
export const EXEC_CLASS_OF_REASON = Object.freeze({
|
|
9
9
|
timeout: "model", agent: "model", "agent-reported": "model", "no-op": "model", "no-handoff": "model",
|
|
10
10
|
"moved-head": "model", "moved-branch": "model", "commit-failure": "model",
|
|
11
|
-
git: "infrastructure", setup: "infrastructure", "provider-init": "infrastructure", "provider-unattested": "infrastructure",
|
|
11
|
+
git: "infrastructure", setup: "infrastructure", "provider-init": "infrastructure", "agent-error": "model", "provider-unattested": "infrastructure",
|
|
12
12
|
"provider-protocol": "infrastructure", stopped: "infrastructure",
|
|
13
13
|
});
|
|
14
14
|
export const INFRASTRUCTURE_TERMINALS = new Set(["auth-expired", "usage-exhausted", "credits-depleted", "transient-throttle"]);
|